diff --git a/addressbook/inc/class.addressbook_hooks.inc.php b/addressbook/inc/class.addressbook_hooks.inc.php index fd0050ea89..c7dbc8d5f3 100644 --- a/addressbook/inc/class.addressbook_hooks.inc.php +++ b/addressbook/inc/class.addressbook_hooks.inc.php @@ -72,11 +72,13 @@ class addressbook_hooks 'Site configuration' => Egw::link('/index.php',array( 'menuaction' => 'admin.uiconfig.index', 'appname' => $appname, + 'ajax' => 'true', )), 'Global Categories' => Egw::link('/index.php',array( 'menuaction' => 'admin.admin_categories.index', 'appname' => $appname, 'global_cats'=> True, + 'ajax' => 'true', )), ); // custom fields are not availible in LDAP diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index df3ee62723..3f5ab0bf31 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -90,7 +90,6 @@ class admin_ui { $vars = $_GET; $vars['menuaction'] = $vars['load']; - unset($vars['ajax']); unset($vars['load']); $content['iframe'] = Egw::link('/index.php', $vars); } diff --git a/admin/js/app.js b/admin/js/app.js index 85becb3fef..5f94ac2c38 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -35,6 +35,13 @@ app.classes.admin = AppJS.extend( */ nm: null, + /** + * Refarence to div to hold AJAX loadable pages + * + * {et2_box} + */ + ajax_target: null, + /** * Reference to ACL edit dialog (not the list) */ @@ -82,6 +89,7 @@ app.classes.admin = AppJS.extend( case 'admin.index': var iframe = this.iframe = this.et2.getWidgetById('iframe'); this.nm = this.et2.getWidgetById('nm'); + this.ajax_target = this.et2.getWidgetById('ajax_target'); if (iframe) { var self = this; @@ -130,9 +138,35 @@ app.classes.admin = AppJS.extend( window.open(_url, '_blank'); return; } + var ajax = false; if (_url) { - this.iframe.set_src(_url); + // Try to load it without the iframe + ajax = _url.match(/ajax=true/); + if(ajax) + { + + if(this.ajax_target.node.children.length) + { + // Node has children already? Check for loading over an + // existing etemplate, and remove it first + jQuery(this.ajax_target.node.children).each(function() { + var old = etemplate2.getById(this.id); + if(old) old.clear(); + }); + jQuery(this.ajax_target.node).empty(); + } + this.egw.json( + framework.activeApp.getMenuaction('ajax_exec'), + // It's important that the context is null, or etemplate2 + // won't load the template properly + [_url], this._ajax_load_callback,null, true, this + ).sendRequest(); + } + else + { + this.iframe.set_src(_url); + } } else { @@ -140,8 +174,9 @@ app.classes.admin = AppJS.extend( // blank iframe, to not keep something running there this.iframe.getDOMNode().contentDocument.location.href = 'about:blank'; } - this.iframe.set_disabled(!_url); - this.nm.set_disabled(!!_url); + this.iframe.set_disabled(!_url || ajax); + this.nm.set_disabled(!!_url || ajax); + this.ajax_target.set_disabled(!ajax); }, /** @@ -263,6 +298,19 @@ app.classes.admin = AppJS.extend( this.load(url); }, + /** + * Callback to load an etemplate + * + * @param {Object[]} _data + */ + _ajax_load_callback: function(_data) + { + if(!_data || _data.type != undefined) return; + + // Insert the content, etemplate will load into it + jQuery(this.ajax_target.node).append(_data[0]); + }, + /** * Link hander for jDots template to just reload our iframe, instead of reloading whole admin app * @@ -276,7 +324,7 @@ app.classes.admin = AppJS.extend( { if (matches) { - _url = _url.replace(/menuaction=admin.admin_ui.index/, 'menuaction='+matches[1]).replace(/&(ajax=true|load=[^&]+)/g, ''); + _url = _url.replace(/menuaction=admin.admin_ui.index/, 'menuaction='+matches[1]).replace(/&(load=[^&]+)/g, ''); } this.load(_url); return true; diff --git a/admin/templates/default/index.xet b/admin/templates/default/index.xet index 6e72f7101b..0c75086076 100644 --- a/admin/templates/default/index.xet +++ b/admin/templates/default/index.xet @@ -50,5 +50,6 @@