// update of ajaxified html element selected by given name/id.
//
function activate($trigname) {
-// if (in_ajax())
-// display_error('Activate '. $trigger);
+ if (in_ajax()) {
$this->triggers[$trigname] = true;
+ }
}
//
// Javascript clientside redirection.
//
function redirect($url) {
if(in_ajax()) {
- $this->_addCommand(true, array('n'=>'rd'),$url);
- $this->run();
+ $this->_addCommand(true, array('n'=>'rd'),$url);
+ $this->run();
}
}
//
return $this;
}
//
+ // Set current focus.
+ //
+ function addFocus($trigger, $sTarget)
+ {
+ $this->_addCommand($trigger, array('n'=>'fc'),$sTarget);
+ return $this;
+ }
+ //
// Internal procedure adding command to response.
//
function _addCommand($trigger, $aAttributes, $mData)
function run() {
if (!$this->isActive()) return;
-// $this->addScript(true, "setFocus('".$_POST['_focus']."');");
-
+
// remove not active commands
foreach ($this->aCommands as $idx => $com) {
+ // display_error( $idx.':'.var_dump($com));
+// If we should reload whole page content ignore all commands but the update.
+// This is page repost equivalent, although header and footer are not reloaded.
+ if($com['n'] == 'up' && $com['t'] == '_page_body') {
+ $this->aCommands = array($com);
+ break;
+ }
+ else
if ($com['why'] !== true && !isset($this->triggers[$com['why']]))
unset($this->aCommands[$idx]);
-
}
-
$GLOBALS['_RESULT'] = $this->aCommands;
// exit();
}
include_once($path_to_root . "/admin/db/users_db.inc");
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="")
{
page_header($title, $no_menu, $is_index, $onload, $js);
error_box();
+ div_start('_page_body'); // whole page content for ajax reloading
}
function end_page($no_menu=false, $is_index=false)
$hide_menu = $no_menu;
+ div_end(); // _page_body section
include($path_to_root . "/includes/page/footer.inc");
$Ajax->run();