X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fajax.inc;h=a89b55876f83eb355257f2bed324b54ad1452959;hb=7e6e0807990447d2977b970c3a0fd28dc9250194;hp=f71aaf47c987b2773af02ce0dd0e9ff506e39974;hpb=5b8f4c4b4aa8cf996bc071f116bfce1273200fa2;p=fa-stable.git diff --git a/includes/ajax.inc b/includes/ajax.inc index f71aaf47..a89b5587 100644 --- a/includes/ajax.inc +++ b/includes/ajax.inc @@ -16,9 +16,9 @@ class Ajax extends JsHttpRequest { var $aCommands = array(); var $triggers = array(); - function Ajax() + function __construct() { - $this->JsHttpRequest(@$_SESSION['language']->encoding); + parent::__construct(@$_SESSION['language']->encoding); } // // This function is used in ctrl routines to activate @@ -98,52 +98,37 @@ class Ajax extends JsHttpRequest { // function _addCommand($trigger, $aAttributes, $mData) { - if ($this->isActive() && ($trigger !== false)) { -// display_error('adding '.$trigger.':'.htmlentities($mData)); + if ($this->isActive() && ($trigger !== false)) { - $aAttributes['why'] = $trigger; - $aAttributes['data'] = $mData; - $this->aCommands[] = $aAttributes; - } + $aAttributes['why'] = $trigger; + $aAttributes['data'] = $mData; + $this->aCommands[] = $aAttributes; + } } - /* - * Register binds function with ajax call parameter - - function register($trigger, $function) + + function run() { - if (isset($_REQUEST[$trigger])) { - $function(&$this); - } - } - */ - function run() { - if (!$this->isActive()) return; // remove not active commands foreach ($this->aCommands as $idx => $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['why'] !== true && !isset($this->triggers[$com['why']])) { - unset($this->aCommands[$idx]); -// display_error('unset '.$com['t']); - } - else - if($com['n'] == 'up' && $com['t'] == '_page_body') { - $cmds = array($com); - foreach( $this->aCommands as $k=> $cmd) { - if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') { // save focus - $cmds[] = $cmd; //break; - } - } - $this->aCommands = $cmds; - break; - } + if ($com['why'] !== true && !isset($this->triggers[$com['why']])) { + unset($this->aCommands[$idx]); + } + elseif($com['n'] == 'up' && $com['t'] == '_page_body') { + $cmds = array($com); + foreach( $this->aCommands as $k=> $cmd) { + if ($cmd['n'] == 'fc' || $cmd['n'] == 'js') { // save focus + $cmds[] = $cmd; //break; + } + } + $this->aCommands = $cmds; + break; + } } -// display_error('Activate:'.htmlentities(print_r($this->triggers, true))); -// display_error('Commands :'.htmlentities(print_r($this->aCommands, true))); $GLOBALS['_RESULT'] = $this->aCommands; -// exit(); } }