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())
{
// 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,
// 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
{

View File

@ -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);

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