Commit 1390ccfc authored by Clément Démoulins's avatar Clément Démoulins
Browse files

Use JQuery for url redirection in demo selector and use base_url.

parent 5359acea
......@@ -23,15 +23,14 @@ class DisplayPage
Demos:
<form name="ex2" method="POST">
<param align="left">
<select name="xfer" size="1"
onChange= "window.location = this.options[this.selectedIndex].value;">
<select id="demos_select" size="1">
MENU;
// Handling index page entry.
$selected = "";
if ("index.php" == basename($_SERVER['PHP_SELF']))
$selected = "selected";
$selected = " selected";
$output .= "<option value=\"index.php\"".$selected.">-- Select A Demo</option>";
foreach($modules as $key => $value)
......@@ -89,6 +88,8 @@ MENU;
public function display_headers($page)
{
global $base_url;
$filepath_parts = Explode('/', $_SERVER['SCRIPT_NAME']);
$scriptname = $filepath_parts[count($filepath_parts) - 1];
echo<<<HEADER
<!doctype html><html>
......@@ -140,7 +141,7 @@ MENU;
<script type="text/javascript" src="$base_url/lib/jquery.elevateZoom-2.5.5.min.js"></script>
<!-- Our specific javascript scripts. -->
<script id='my_scripts' type="text/javascript" src="{$base_url}/scripts.js?file={$_SERVER['REQUEST_URI']}"></script>
<script id='my_scripts' type="text/javascript" src="{$base_url}/scripts.js?file={$base_url}/{$scriptname}"></script>
<!-- Stats for Google Analytics. -->
<script type="text/javascript">
......
......@@ -65,6 +65,14 @@ $(document).ready(function(){
// Setup description and main form tabs.
$( "#maintabs" ).tabs();
// bind change event to select
$('#demos_select').bind('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a URL
window.location = url; // redirect
}
return false;
});
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment