Skip to content

Commit

Permalink
HTML5: Fixed the need to call x_navigateToPage twice. First page now …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
JohnSmith-LT committed Nov 17, 2012
1 parent 43691d6 commit f9d7697
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 48 deletions.
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
}

Expand Down
36 changes: 18 additions & 18 deletions modules/xerte/play_html5.php
Expand Up @@ -27,7 +27,7 @@ function show_template($row_play){

?>

<!--
<!--
University of Nottingham Xerte Online Toolkits
Expand All @@ -39,24 +39,24 @@ function show_template($row_play){
<!DOCTYPE html>
<html>
<head>

<title><?PHP echo XERTE_PREVIEW_TITLE; ?></title>

<meta name="viewport" id="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=10.0, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />

<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/css/smoothness/jquery-ui-1.8.18.custom.css" type="text/css" />
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/css/mainStyles.css" type="text/css" />
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaelementplayer.min.css" />

<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery.ui.touch-punch.min.js"></script> <!-- allows jQuery components to work on touchscreen devices -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/imageLens.js"></script> <!-- for creating magnifiers on images -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaelement-and-player.js"></script> <!-- for audio & video players -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaPlayer.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaPlayer.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/swfobject.js"></script>

<script type="text/javascript">
var FileLocation = "<?PHP echo $string_for_flash ?>";
var x_templateLocation = "<?PHP echo $template_path_string ?>/";
Expand All @@ -75,30 +75,30 @@ function show_template($row_play){
}
?>};
</script>

</head>

<body>

<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/xenith.js"></script>

<div id="x_mainHolder">

<div id="x_mobileScroll">
<div id="x_headerBlock">
<div>
<h1> </h1>
<h2> </h2>
</div>
</div>

<div id="x_pageHolder">
<div id="x_pageDiv">

</div>
</div>
</div>

<div id="x_footerBlock">
<div id="x_footerBg"></div>
<div class="x_floatLeft"></div>
Expand All @@ -111,14 +111,14 @@ function show_template($row_play){
</div>
</div>
</div>

<div id="x_background"></div>

</div>

<script type="text/javascript" language="JavaScript">
<?PHP

echo "</script></body></html>";

}
Expand Down
52 changes: 26 additions & 26 deletions modules/xerte/preview_html5.php
@@ -1,7 +1,7 @@
<?PHP

/**
*
*
* preview page, allows the site to make a preview page for a xerte module
*
* @author Patrick Lockley
Expand All @@ -12,7 +12,7 @@
*/

/**
*
*
* Function show_preview_code
* This function creates folders needed when creating a template
* @param array $row - an array from a mysql query for the template
Expand All @@ -35,45 +35,45 @@ function show_preview_code($row, $row_username){
$string_for_flash_xml = $xmlfile . "?time=" . time();

$string_for_flash = $xerte_toolkits_site->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");

?>
<!--

<!--
University of Nottingham Xerte Online Toolkits
HTML to use at the top of the Xerte preview and play windows
Version 1.0
-->

<!DOCTYPE html>
<html>
<head>

<title><?PHP echo XERTE_PREVIEW_TITLE; ?></title>

<meta name="viewport" id="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=10.0, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />

<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/css/smoothness/jquery-ui-1.8.18.custom.css" type="text/css" />
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/css/mainStyles.css" type="text/css" />
<link rel="stylesheet" href="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaelementplayer.min.css" />

<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/jquery.ui.touch-punch.min.js"></script> <!-- allows jQuery components to work on touchscreen devices -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/imageLens.js"></script> <!-- for creating magnifiers on images -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaelement-and-player.js"></script> <!-- for audio & video players -->
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaPlayer.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/mediaelement/mediaPlayer.js"></script>
<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/swfobject.js"></script>

<script type="text/javascript">
var FileLocation = "<?PHP echo $string_for_flash ?>";
var x_templateLocation = "<?PHP echo $template_path_string ?>/";
Expand All @@ -92,30 +92,30 @@ function show_preview_code($row, $row_username){
}
?>};
</script>

</head>

<body>

<script type="text/javascript" src="<?PHP echo $template_path_string ?>/common_html5/js/xenith.js"></script>

<div id="x_mainHolder">

<div id="x_mobileScroll">
<div id="x_headerBlock">
<div>
<h1> </h1>
<h2> </h2>
</div>
</div>

<div id="x_pageHolder">
<div id="x_pageDiv">

</div>
</div>
</div>

<div id="x_footerBlock">
<div id="x_footerBg"></div>
<div class="x_floatLeft"></div>
Expand All @@ -128,14 +128,14 @@ function show_preview_code($row, $row_username){
</div>
</div>
</div>

<div id="x_background"></div>

</div>

<script type="text/javascript" language="JavaScript">
<?PHP

echo "</script></body></html>";

}
Expand Down

0 comments on commit f9d7697

Please sign in to comment.