forked from extern/egroupware
Got remote applications in the jdots template finally working as they should - this unfortunately required a lot of 'dirty' hacks, as egroupware had not been designed to do this. So e.g. there had to be a litte bit code added to the login page, which prevented it from redirecting to a page with a full framework rebuild.
This commit is contained in:
parent
1abcbb12fc
commit
0f0e57f398
@ -336,8 +336,11 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
list($forward,$extra_vars) = explode('?',$forward,2);
|
list($forward,$extra_vars) = explode('?',$forward,2);
|
||||||
|
if (!isset($_GET['suppress_cd']))
|
||||||
|
{
|
||||||
$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
|
$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {
|
if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {
|
||||||
// login requuest does not come from login.php
|
// login requuest does not come from login.php
|
||||||
|
@ -338,7 +338,21 @@ class egw extends egw_minimal
|
|||||||
if ($relpath) $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : ''));
|
if ($relpath) $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : ''));
|
||||||
//Header('Location: '.$GLOBALS['egw_info']['server']['webserver_url'].$redirect);
|
//Header('Location: '.$GLOBALS['egw_info']['server']['webserver_url'].$redirect);
|
||||||
// do NOT redirect, but set top.location, as this works in framed template too
|
// do NOT redirect, but set top.location, as this works in framed template too
|
||||||
echo "<html>\n<head>\n<script type='text/javascript'>top.location='{$GLOBALS['egw_info']['server']['webserver_url']}$redirect';\n</script></head>\n";
|
$redirect = $GLOBALS['egw_info']['server']['webserver_url'].$redirect;
|
||||||
|
|
||||||
|
echo "<html>\n<head>\n<script type='text/javascript'>
|
||||||
|
if (typeof window.frameElement != 'undefined' &&
|
||||||
|
window.frameElement &&
|
||||||
|
typeof window.frameElement.egw_app != 'undefined' &&
|
||||||
|
typeof window.frameElement.egw_app.isRemote != 'undefined')
|
||||||
|
{
|
||||||
|
window.location='$redirect';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
top.location='$redirect';
|
||||||
|
}
|
||||||
|
</script>\n</head>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,14 +166,15 @@ function _egw_json_plugin_handle(_type, _response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The constructor of the egw_json_request class.
|
/** The constructor of the egw_json_request class.
|
||||||
* @param string _menuaction the menuaction function which should be called and which handles the actual request
|
*
|
||||||
|
* @param string _menuaction the menuaction function which should be called and
|
||||||
|
* which handles the actual request. If the menuaction is a full featured
|
||||||
|
* url, this one will be used instead.
|
||||||
* @param array _parameters which should be passed to the menuaction function.
|
* @param array _parameters which should be passed to the menuaction function.
|
||||||
|
* @param object _context is the context which will be used for the callback function
|
||||||
*/
|
*/
|
||||||
function egw_json_request(_menuaction, _parameters, _context)
|
function egw_json_request(_menuaction, _parameters, _context)
|
||||||
{
|
{
|
||||||
//Copy the supplied parameters
|
|
||||||
this.menuaction = _menuaction;
|
|
||||||
|
|
||||||
this.context = window.document;
|
this.context = window.document;
|
||||||
if (typeof _context != 'undefined')
|
if (typeof _context != 'undefined')
|
||||||
this.context = _context;
|
this.context = _context;
|
||||||
@ -187,15 +188,18 @@ function egw_json_request(_menuaction, _parameters, _context)
|
|||||||
this.parameters = new Array;
|
this.parameters = new Array;
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = window.egw_webserverUrl;
|
// Check whether the supplied menuaction parameter is a full featured url
|
||||||
|
// or just a menuaction
|
||||||
// Search up to parent if the current window is in a frame
|
if (_menuaction.match(/json.php\?menuaction=[a-z_0-9]*\.[a-z_0-9]*\.[a-z_0-9]*/i))
|
||||||
if(typeof url == "undefined")
|
|
||||||
{
|
{
|
||||||
url = top.egw_webserverUrl;
|
// Menuaction is a full featured url
|
||||||
|
this.url = _menuaction
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We only got a menu action, assemble the url manually.
|
||||||
|
this.url = this._assembleAjaxUrl(_menuaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.url = url + '/json.php';
|
|
||||||
|
|
||||||
this.request = null;
|
this.request = null;
|
||||||
this.sender = null;
|
this.sender = null;
|
||||||
@ -210,7 +214,24 @@ function egw_json_request(_menuaction, _parameters, _context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sends the AJAX JSON request.
|
egw_json_request.prototype._assembleAjaxUrl = function(_menuaction)
|
||||||
|
{
|
||||||
|
// Retrieve the webserver url
|
||||||
|
var webserver_url = egw_topWindow().egw_webserverUrl;
|
||||||
|
|
||||||
|
// Check whether the webserver_url is really set
|
||||||
|
if (!webserver_url)
|
||||||
|
{
|
||||||
|
throw "Internal JS error, top window not found, webserver url could not be retrieved.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the ajax relevant parts
|
||||||
|
return webserver_url + '/json.php?menuaction=' + _menuaction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the AJAX JSON request.
|
||||||
|
*
|
||||||
* @param boolean _async specifies whether the request should be handeled asynchronously (true, the sendRequest function immediately returns to the caller) or asynchronously (false, the sendRequest function waits until the request is received)
|
* @param boolean _async specifies whether the request should be handeled asynchronously (true, the sendRequest function immediately returns to the caller) or asynchronously (false, the sendRequest function waits until the request is received)
|
||||||
* @param _callback is an additional callback function which should be called upon a "data" response is received
|
* @param _callback is an additional callback function which should be called upon a "data" response is received
|
||||||
* @param _sender is the reference object the callback function should get
|
* @param _sender is the reference object the callback function should get
|
||||||
@ -238,14 +259,14 @@ egw_json_request.prototype.sendRequest = function(_async, _callback, _sender)
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Send the request via the jquery AJAX interface to the server
|
//Send the request via the jquery AJAX interface to the server
|
||||||
this.request = $.ajax({url: this.url + '?menuaction=' + this.menuaction,
|
this.request = $.ajax({url: this.url,
|
||||||
async: is_async,
|
async: is_async,
|
||||||
context: this,
|
context: this,
|
||||||
data: request_obj,
|
data: request_obj,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: this.handleResponse,
|
success: this.handleResponse,
|
||||||
error: function(_xmlhttp,_err) { alert('Ajax request to '+this.url+'?menuaction='+this.menuaction+' failed: '+_err); }
|
error: function(_xmlhttp,_err) { alert('Ajax request to ' + this.url + ' failed: ' + _err); }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,8 +388,7 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
|
|||||||
typeof res.data.global == 'boolean')
|
typeof res.data.global == 'boolean')
|
||||||
{
|
{
|
||||||
//Special handling for framework reload
|
//Special handling for framework reload
|
||||||
if (res.data.url.indexOf("?cd=10") > 0)
|
res.data.global |= (res.data.url.indexOf("?cd=10") > 0);
|
||||||
res.data.global = true;
|
|
||||||
|
|
||||||
if (res.data.global)
|
if (res.data.global)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +114,27 @@ function egw_appWindow(_app)
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current egw application
|
||||||
|
* @param string _name is only used for fallback, if an onlder version of jdots is used.
|
||||||
|
*/
|
||||||
|
function egw_getApp(_name)
|
||||||
|
{
|
||||||
|
var napp = null;
|
||||||
|
if (typeof window.frameElement != "undefined" &&
|
||||||
|
window.frameElement != null &&
|
||||||
|
typeof window.frameElement.egw_app != "undefined")
|
||||||
|
{
|
||||||
|
napp = window.frameElement.egw_app;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
napp = window.parent.framework.getApplicationByName(_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return napp;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh given application _app display of entry _id, incl. outputting _msg
|
* Refresh given application _app display of entry _id, incl. outputting _msg
|
||||||
*
|
*
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div id="centerBox">
|
<div id="centerBox">
|
||||||
<div id="loginScreenMessage">{lang_message}</div>
|
<div id="loginScreenMessage">{lang_message}</div>
|
||||||
<div id="loginCdMessage">{cd}</div>
|
<div id="loginCdMessage">{cd}</div>
|
||||||
<form name="login_form" method="post" action="{login_url}">
|
<form name="login_form" id="login_form" method="post" action="{login_url}">
|
||||||
<table class="divLoginbox divSideboxEntry" cellspacing="0" cellpadding="2" border="0" align="center">
|
<table class="divLoginbox divSideboxEntry" cellspacing="0" cellpadding="2" border="0" align="center">
|
||||||
<tr class="divLoginboxHeader">
|
<tr class="divLoginboxHeader">
|
||||||
<td colspan="3">{website_title}</td>
|
<td colspan="3">{website_title}</td>
|
||||||
@ -63,5 +63,21 @@
|
|||||||
<!-- END registration -->
|
<!-- END registration -->
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
//Check whether the loginpage is displayed from within the jdots framework
|
||||||
|
//if yes, supress the "cd=yes" being appended to the page loaded
|
||||||
|
if (typeof window.frameElement != 'undefined' &&
|
||||||
|
window.frameElement &&
|
||||||
|
typeof window.frameElement.egw_app != 'undefined' &&
|
||||||
|
typeof window.frameElement.egw_app.isRemote != 'undefined' &&
|
||||||
|
window.frameElement.egw_app.isRemote())
|
||||||
|
{
|
||||||
|
loginForm = document.getElementById('login_form');
|
||||||
|
if (loginForm && loginForm.action.indexOf('phpgw_forward') > 0)
|
||||||
|
{
|
||||||
|
loginForm.action += '&suppress_cd=1';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user