mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Send category sel_options each time to fix category colors not being updated.
Use update types to refresh just the changed row or whole nextmatch contents, as needed.
This commit is contained in:
parent
5fa9a9c0d0
commit
c983e02c9e
@ -147,6 +147,12 @@ class admin_categories
|
|||||||
if($content['owner'] == '') $content['owner'] = 0;
|
if($content['owner'] == '') $content['owner'] = 0;
|
||||||
if ($content['id'] && self::$acl_edit)
|
if ($content['id'] && self::$acl_edit)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// If color changed, we need to do an edit 'refresh' instead of 'update'
|
||||||
|
// to reload the whole nextmatch instead of just the row
|
||||||
|
$data = $cats->id2name($content['id'],'data');
|
||||||
|
$change_color = ($data['color'] != $content['data']['color']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$cats->edit($content);
|
$cats->edit($content);
|
||||||
$msg = lang('Category saved.');
|
$msg = lang('Category saved.');
|
||||||
@ -170,7 +176,7 @@ class admin_categories
|
|||||||
}
|
}
|
||||||
if ($button == 'save')
|
if ($button == 'save')
|
||||||
{
|
{
|
||||||
egw_framework::refresh_opener($msg, 'admin', $content['id']);
|
egw_framework::refresh_opener($msg, 'admin', $content['id'], $change_color ? 'edit' : 'update');
|
||||||
egw_framework::window_close();
|
egw_framework::window_close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -181,7 +187,7 @@ class admin_categories
|
|||||||
$cats->delete($content['id'],$delete_subs,!$delete_subs);
|
$cats->delete($content['id'],$delete_subs,!$delete_subs);
|
||||||
$msg = lang('Category deleted.');
|
$msg = lang('Category deleted.');
|
||||||
// Refresh internally looks for template name, which starts with 'admin'
|
// Refresh internally looks for template name, which starts with 'admin'
|
||||||
egw_framework::refresh_opener($msg, 'admin', $content['id']);
|
egw_framework::refresh_opener($msg, 'admin', $content['id'],'delete');
|
||||||
egw_framework::window_close();
|
egw_framework::window_close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -193,7 +199,7 @@ class admin_categories
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Refresh internally looks for template name, which starts with 'admin'
|
// Refresh internally looks for template name, which starts with 'admin'
|
||||||
egw_framework::refresh_opener($msg, 'admin', $content['id']);
|
egw_framework::refresh_opener($msg, 'admin', $content['id'], $change_color ? 'edit' : 'update');
|
||||||
}
|
}
|
||||||
$content['msg'] = $msg;
|
$content['msg'] = $msg;
|
||||||
if(!$content['appname']) $content['appname'] = $appname;
|
if(!$content['appname']) $content['appname'] = $appname;
|
||||||
@ -375,6 +381,11 @@ class admin_categories
|
|||||||
$rows['appname'] = $query['appname'];
|
$rows['appname'] = $query['appname'];
|
||||||
$rows['edit_link'] = $this->edit_link;
|
$rows['edit_link'] = $this->edit_link;
|
||||||
|
|
||||||
|
// Send categories to make sure row colors stay up to date
|
||||||
|
// We use update types to prevent nm from doing unneeded calls to get_rows()
|
||||||
|
// TODO: figure out how to only send this if a category color has changed
|
||||||
|
$rows['sel_options']['cat_id'] = etemplate_widget_menupopup::typeOptions('select-cat', ',,,'.$query['appname'].',0');
|
||||||
|
|
||||||
// disable access column for global categories
|
// disable access column for global categories
|
||||||
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'admin') $rows['no_access'] = true;
|
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'admin') $rows['no_access'] = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user