projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rewritten dimension inquiry, small fix in sales invoice/delivery.
[fa-stable.git]
/
includes
/
ajax.inc
diff --git
a/includes/ajax.inc
b/includes/ajax.inc
index c07bea6809e25896c0e194f12214d9fa55369b66..b95d1928a353b702c882b1c266eed11b43b2e117 100644
(file)
--- a/
includes/ajax.inc
+++ b/
includes/ajax.inc
@@
-25,11
+25,17
@@
class Ajax extends JsHttpRequest {
//
function redirect($url) {
if(in_ajax()) {
//
function redirect($url) {
if(in_ajax()) {
-
$this->_addCommand(true, array('n'=>'rd'),$url
);
- $this->run();
+
$this->_addCommand(true, array('n'=>'rd'), absolute_url($url)
);
+
$this->run();
}
}
//
}
}
//
+ // Popup window (target=_blank)
+ //
+ function popup($url) {
+ $this->_addCommand(true, array('n'=>'pu'), absolute_url($url));
+ }
+ //
// Adds an executable Javascript code.
//
function addScript($trigger, $sJS)
// Adds an executable Javascript code.
//
function addScript($trigger, $sJS)
@@
-114,7
+120,13
@@
class Ajax extends JsHttpRequest {
}
else
if($com['n'] == 'up' && $com['t'] == '_page_body') {
}
else
if($com['n'] == 'up' && $com['t'] == '_page_body') {
- $this->aCommands = array($com);
+ $cmds = array($com);
+ foreach( $this->aCommands as $k=> $cmd) {
+ if ($cmd['n'] == 'fc') { // save focus
+ $cmds[] = $cmd; break;
+ }
+ }
+ $this->aCommands = $cmds;
break;
}
}
break;
}
}
@@
-130,4
+142,11
@@
function in_ajax() {
return $Ajax->isActive();
}
return $Ajax->isActive();
}
+// Returns absolute path of relative $url. To be used in ajax calls
+// for proper redirection from any referer page.
+//
+function absolute_url($url)
+{
+ return strpos($url, '..')===0 ? dirname($_SERVER['PHP_SELF']).'/'.$url : $url;
+}
?>
?>