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:
Andreas Stöckel 2011-01-20 14:12:12 +00:00
parent e2b2417170
commit ef09307743
5 changed files with 58 additions and 5 deletions

View File

@ -336,7 +336,10 @@ else
else
{
list($forward,$extra_vars) = explode('?',$forward,2);
$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
if (!isset($_GET['suppress_cd']))
{
$extra_vars .= ($extra_vars ? '&' : '').'cd=yes';
}
}
if(strpos($_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']) === false) {

View File

@ -338,7 +338,21 @@ class egw extends egw_minimal
if ($relpath) $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : ''));
//Header('Location: '.$GLOBALS['egw_info']['server']['webserver_url'].$redirect);
// 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;
}
}

View File

@ -312,8 +312,7 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
typeof res.data.global == 'boolean')
{
//Special handling for framework reload
if (res.data.url.indexOf("?cd=10") > 0)
res.data.global = true;
res.data.global |= (res.data.url.indexOf("?cd=10") > 0);
if (res.data.global)
{

View File

@ -97,6 +97,27 @@ function egw_appWindow(_app)
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;
}
function egw_set_checkbox_multiselect_enabled(_id, _enabled)
{
//Retrieve the checkbox_multiselect base div

View File

@ -6,7 +6,7 @@
<div id="centerBox">
<div id="loginScreenMessage">{lang_message}</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">
<tr class="divLoginboxHeader">
<td colspan="3">{website_title}</td>
@ -63,5 +63,21 @@
<!-- END registration -->
</table>
</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>