From 8c20a46652c0905ba443ad1c0b97b12405f0642d Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 31 Jul 2018 09:30:57 -0600 Subject: [PATCH] Admin - get category colors properly updating by doing a full reload Also maybe squashing a bug where admin would switch to iframe --- admin/inc/class.admin_categories.inc.php | 34 +++++++++++------------- admin/inc/class.admin_ui.inc.php | 7 ++--- admin/js/app.js | 4 +++ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index f4c2494c68..2d0f331fca 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -185,31 +185,27 @@ class admin_categories { if(Api\Json\Response::isJSONResponse()) { - // Update category styles - Api\Json\Response::get()->apply('opener.egw.includeCSS',array(Categories::css($refresh_app == 'admin' ? Categories::GLOBAL_APPNAME : $refresh_app))); - if($refresh_app != $content['appname']) - { - Api\Json\Response::get()->apply('opener.egw.includeCSS',array(Categories::css($content['appname']))); - } if($this->appname != 'admin') { - Api\Json\Response::get()->apply('opener.egw.show_preferences',array( - 'cats', - $this->appname == 'admin' ? Categories::GLOBAL_APPNAME : array($refresh_app) - )); - $change_color = false; + // Need to forcably re-load everything to force the CSS to be loaded + Api\Json\Response::get()->redirect(Framework::link('/index.php', array( + 'menuaction' => 'preferences.preferences_categories_ui.index', + 'ajax' => 'true', + 'cats_app' => $appname + )), TRUE, $this->appname); } else { - Categories::css($refresh_app == 'admin' ? Categories::GLOBAL_APPNAME : $refresh_app); - // Need to forcably re-load the iframe to avoid smart etemplate refresh - Api\Json\Response::get()->apply('opener.app.admin.load',array( - Framework::link('/index.php', array( - 'menuaction' => $this->list_link, - 'appname' => $appname - ) - ))); + // Need to forcably re-load everything to force the CSS to be loaded + Api\Json\Response::get()->redirect(Framework::link('/index.php', array( + 'menuaction' => 'admin.admin_ui.index', + 'load' => $this->list_link, + 'ajax' => 'true', + 'appname' => $appname + )), TRUE, $this->appname); } + Framework::window_close(); + return; } else { diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index bd35dbba40..8c5885c478 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -96,16 +96,13 @@ class admin_ui // important for first time load eg. from an other application calling it's site configuration $tpl->setElementAttribute('nm', 'disabled', !empty($_GET['load'])); $tpl->setElementAttribute('iframe', 'disabled', empty($_GET['load'])); + $content['iframe'] = 'about:blank'; // we show accounts-list be default now if (!empty($_GET['load'])) { $vars = $_GET; $vars['menuaction'] = $vars['load']; unset($vars['load']); - $content['iframe'] = Egw::link('/index.php', $vars); - } - else - { - $content['iframe'] = 'about:blank'; // we show accounts-list be default now + $content[$vars['ajax'] ? 'ajax_target':'iframe'] = Egw::link('/index.php', $vars); } $tpl->exec('admin.admin_ui.index', $content, $sel_options); diff --git a/admin/js/app.js b/admin/js/app.js index e35e988bf3..d9bd81bfe2 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -106,6 +106,10 @@ app.classes.admin = AppJS.extend( } ); } + if( this.ajax_target && this.et2.getArrayMgr('content').getEntry('ajax_target')) + { + this.load(this.et2.getArrayMgr('content').getEntry('ajax_target')); + } break; case 'admin.customfield_edit':