From 5694e36049832e41d1135a8ef45fa2b474fcd007 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 17 Nov 2012 16:43:10 +0000 Subject: [PATCH] HTML5: Fixed the need to call x_navigateToPage twice. First page now loaded correctly if pageID or linkID doesn't exist or page= number is out of bounds. git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@511 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641 --- .../Nottingham/common_html5/js/xenith.js | 15 ++++-- modules/xerte/play_html5.php | 36 ++++++------- modules/xerte/preview_html5.php | 52 +++++++++---------- 3 files changed, 55 insertions(+), 48 deletions(-) diff --git a/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js b/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js index 1e9489a71f..7d4c95b817 100644 --- a/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js +++ b/modules/xerte/parent_templates/Nottingham/common_html5/js/xenith.js @@ -598,8 +598,7 @@ function x_setUp() { x_mediaText.push(mediaTextObj); } - x_navigateToPage({type:'page', ID:1}); - x_navigateToPage(x_startPage); + x_navigateToPage(true, x_startPage); } // function called on page change to load page model - x_currentPage should be changed to index of page to load before calling this function @@ -961,7 +960,7 @@ function x_addPageLinks(pageText, returnMethod) { } } -function x_navigateToPage(pageInfo) { // {type, ID} +function x_navigateToPage(force, pageInfo) { // {type, ID} var page; if (pageInfo.type == "linkID" || pageInfo.type == "pageID") { page = x_lookupPage(pageInfo.type, pageInfo.ID); @@ -970,13 +969,21 @@ function x_navigateToPage(pageInfo) { // {type, ID} x_currentPage = page; x_changePage(); } + else if (force == true) { + x_currentPage = 0; + x_changePage(); + } } else { page = parseInt(pageInfo.ID); if (page > 0 && page <= x_pages.length) { x_currentPage = page - 1; + x_changePage(); + } + else if (force == true) { + x_currentPage = 0; + x_changePage(); } - x_changePage(); } } diff --git a/modules/xerte/play_html5.php b/modules/xerte/play_html5.php index ea5fb1348e..9aa8bfcac6 100644 --- a/modules/xerte/play_html5.php +++ b/modules/xerte/play_html5.php @@ -27,7 +27,7 @@ function show_template($row_play){ ?> - - + - + - + - + - +
- +
@@ -91,14 +91,14 @@ function show_template($row_play){

- +
- +
- +
@@ -111,14 +111,14 @@ function show_template($row_play){
- +
- + - + "; } diff --git a/modules/xerte/preview_html5.php b/modules/xerte/preview_html5.php index f07bedb536..00b6d9caa3 100644 --- a/modules/xerte/preview_html5.php +++ b/modules/xerte/preview_html5.php @@ -1,7 +1,7 @@ users_file_area_short . $row['template_id'] . "-" . $row_username['username'] . "-" . $row['template_name'] . "/"; - + $template_path_string = "modules/xerte/parent_templates/" . $row['template_name']; - + require_once("config.php"); - + _load_language_file("/modules/xerte/preview.inc"); - + ?> - - - + - + <?PHP echo XERTE_PREVIEW_TITLE; ?> - + - + - + - + - + - + - + - +
- +
@@ -108,14 +108,14 @@ function show_preview_code($row, $row_username){

- +
- +
- +
@@ -128,14 +128,14 @@ function show_preview_code($row, $row_username){
- +
- + - + "; }