Fixed bug with sidebox menus not opening when you double click on a menu entry: This was caused by the sidebox information sent from the server on the first time an application gets loaded not being parsed by the browser. This problem occured, because the iframe content which contained the sidebox information was immediately reloaded and the server doesn't send the information a second time

This commit is contained in:
Andreas Stöckel 2010-11-13 15:13:35 +00:00
parent d95ad940c3
commit 5823f0a569
2 changed files with 33 additions and 3 deletions

View File

@ -657,10 +657,24 @@ class jdots_framework extends egw_framework
* *
* @param $appname * @param $appname
*/ */
public function ajax_sidebox($appname) public function ajax_sidebox($appname, $md5)
{ {
$response = egw_json_response::get(); $response = egw_json_response::get();
$response->data($this->get_sidebox($appname)); $sidebox = $this->get_sidebox($appname);
$encoded = json_encode($sidebox);
$new_md5 = md5($encoded);
$response_array = array();
$response_array['md5'] = $new_md5;
if ($new_md5 != $md5)
{
//TODO: Add some proper solution to be able to attach the already
//JSON data to the response in order to gain some performace improvements.
$response_array['data'] = $sidebox;
}
$response->data($response_array);
} }
/** /**

View File

@ -177,6 +177,22 @@ egw_fw.prototype.setActiveApp = function(_app)
{ {
this.sidemenuUi.open(_app.sidemenuEntry); this.sidemenuUi.open(_app.sidemenuEntry);
} }
else
{
//Probalby the sidemenu data just got lost along the way. This
//for example happens, when a user double clicks on a menu item
var req = new egw_json_request('home.jdots_framework.ajax_sidebox',
[_app.appName, _app.sidebox_md5]);
_app.sidemenuEntry.showAjaxLoader();
req.sendRequest(false, function(data) {
if ((typeof data.md5 != 'undefined') &&
(typeof data.data != 'undefined'))
{
this.fw.setSidebox(this.app, data.data, data.md5);
this.app.sidemenuEntry.hideAjaxLoader();
}
}, {'app' : _app, 'fw' : this});
}
} }
else else
{ {
@ -510,7 +526,7 @@ egw_fw.prototype.categoryOpenCloseCallback = function(_opened)
// [this.tag.appName, this.catName, _opened]); // [this.tag.appName, this.catName, _opened]);
//req.sendRequest(true); //req.sendRequest(true);
/* Store the state of the category lokaly */ /* Store the state of the category localy */
this.tag.parentFw.categoryOpenCache[this.tag.appName + '#' + this.catName] = _opened; this.tag.parentFw.categoryOpenCache[this.tag.appName + '#' + this.catName] = _opened;
// this.tag.parentFw.scrollAreaUi.update(); // this.tag.parentFw.scrollAreaUi.update();
} }