Admin - get category colors properly updating by doing a full reload

Also maybe squashing a bug where admin would switch to iframe
This commit is contained in:
nathangray 2018-07-31 09:30:57 -06:00
parent e1b1339f80
commit 8c20a46652
3 changed files with 21 additions and 24 deletions

View File

@ -185,31 +185,27 @@ class admin_categories
{ {
if(Api\Json\Response::isJSONResponse()) 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') if($this->appname != 'admin')
{ {
Api\Json\Response::get()->apply('opener.egw.show_preferences',array( // Need to forcably re-load everything to force the CSS to be loaded
'cats', Api\Json\Response::get()->redirect(Framework::link('/index.php', array(
$this->appname == 'admin' ? Categories::GLOBAL_APPNAME : array($refresh_app) 'menuaction' => 'preferences.preferences_categories_ui.index',
)); 'ajax' => 'true',
$change_color = false; 'cats_app' => $appname
)), TRUE, $this->appname);
} }
else else
{ {
Categories::css($refresh_app == 'admin' ? Categories::GLOBAL_APPNAME : $refresh_app); // Need to forcably re-load everything to force the CSS to be loaded
// Need to forcably re-load the iframe to avoid smart etemplate refresh Api\Json\Response::get()->redirect(Framework::link('/index.php', array(
Api\Json\Response::get()->apply('opener.app.admin.load',array( 'menuaction' => 'admin.admin_ui.index',
Framework::link('/index.php', array( 'load' => $this->list_link,
'menuaction' => $this->list_link, 'ajax' => 'true',
'appname' => $appname 'appname' => $appname
) )), TRUE, $this->appname);
)));
} }
Framework::window_close();
return;
} }
else else
{ {

View File

@ -96,16 +96,13 @@ class admin_ui
// important for first time load eg. from an other application calling it's site configuration // important for first time load eg. from an other application calling it's site configuration
$tpl->setElementAttribute('nm', 'disabled', !empty($_GET['load'])); $tpl->setElementAttribute('nm', 'disabled', !empty($_GET['load']));
$tpl->setElementAttribute('iframe', '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'])) if (!empty($_GET['load']))
{ {
$vars = $_GET; $vars = $_GET;
$vars['menuaction'] = $vars['load']; $vars['menuaction'] = $vars['load'];
unset($vars['load']); unset($vars['load']);
$content['iframe'] = Egw::link('/index.php', $vars); $content[$vars['ajax'] ? 'ajax_target':'iframe'] = Egw::link('/index.php', $vars);
}
else
{
$content['iframe'] = 'about:blank'; // we show accounts-list be default now
} }
$tpl->exec('admin.admin_ui.index', $content, $sel_options); $tpl->exec('admin.admin_ui.index', $content, $sel_options);

View File

@ -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; break;
case 'admin.customfield_edit': case 'admin.customfield_edit':