include_once($path_to_root . "/includes/ui/ui_view.inc");
include_once($path_to_root . "/includes/ui/ui_controls.inc");
- function page($title, $no_menu=false, $is_index=false, $onload="", $js="")
+ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false)
{
global $path_to_root;
page_header($title, $no_menu, $is_index, $onload, $js);
error_box();
- div_start('_page_body'); // whole page content for ajax reloading
+ if($script_only) {
+ echo '<noscript>';
+ echo display_heading(_('This page is usable only with javascript enabled browsers.'));
+ echo '</noscript>';
+ div_start('_page_body', null, true);
+ } else {
+ div_start('_page_body'); // whole page content for ajax reloading
+ }
}
function end_page($no_menu=false, $is_index=false)
$ajax_divs = array();
-function div_start($id='', $trigger=null)
+function div_start($id='', $trigger=null, $non_ajax=false)
{
global $ajax_divs;
- array_push($ajax_divs, array($id, $trigger===null ? $id : $trigger));
- echo "<div ". ($id !='' ? "id='$id'" : '').">";
- ob_start();
+ if ($non_ajax) { // div for non-ajax elements
+ array_push($ajax_divs, array($id, null));
+ echo "<div style='display:none' class='js_only' ".($id !='' ? "id='$id'" : '').">";
+ } else { // ajax ready div
+ array_push($ajax_divs, array($id, $trigger===null ? $id : $trigger));
+ echo "<div ". ($id !='' ? "id='$id'" : '').">";
+ ob_start();
+ }
}
function div_end()
if (count($ajax_divs))
{
$div = array_pop($ajax_divs);
- $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
+ if ($div[1] !== null)
+ $Ajax->addUpdate($div[1], $div[0], ob_get_flush());
echo "</div>";
}
}
function progbar() {
box = document.getElementById('msgbox');
box.innerHTML= "<center><table width='98%' border='1' cellpadding=3 "
- +"style='border-collapse: collapse' bordercolor='#007700'>"
+ +"bordercolor='#007700' style='border-collapse: collapse'>"
+"<tr><td align='center' bgcolor='#ccffcc' >"
+"<img src='"+user.theme+"images/progressbar.gif' alt='"
+user.loadtxt+"' /></td></tr></table></center><br>";
+ box.style.display = 'block';
}
function save_focus(e) {
// this hides search button for js enabled browsers
e.style.display = 'none';
},
+ 'div.js_only':
+ function(e) {
+ // this shows divs for js enabled browsers only
+ e.style.display = 'block';
+ },
'input.ajaxsubmit,input.editbutton,input.navibutton':
function(e) {
e.onclick = function() {