Admin push update fixes

- Implement for categories
- Fix some account update duplication
This commit is contained in:
nathan 2022-10-18 11:28:44 -06:00
parent d1ff0a8b4f
commit c985338a11
3 changed files with 31 additions and 35 deletions

View File

@ -231,7 +231,7 @@ class admin_categories
if ($button == 'save') if ($button == 'save')
{ {
Framework::refresh_opener($msg, $refresh_app, $content['id'], $change_color ? null : 'update', $refresh_app); Framework::refresh_opener($msg, $refresh_app, null, null, $refresh_app);
Framework::window_close(); Framework::window_close();
} }
break; break;
@ -242,7 +242,7 @@ class admin_categories
$cmd = new admin_cmd_delete_category($content['id'], $delete_subs); $cmd = new admin_cmd_delete_category($content['id'], $delete_subs);
$msg = $cmd->run(); $msg = $cmd->run();
Framework::refresh_opener($msg, $refresh_app, $content['id'],'delete', $this->appname); Framework::refresh_opener($msg, $refresh_app, null, null, $this->appname);
Framework::window_close(); Framework::window_close();
return; return;
} }
@ -254,7 +254,7 @@ class admin_categories
break; break;
} }
// This should probably refresh the application $this->appname in the target tab $refresh_app, but that breaks pretty much everything // This should probably refresh the application $this->appname in the target tab $refresh_app, but that breaks pretty much everything
Framework::refresh_opener($msg, $refresh_app, $content['id'], $change_color ? null : 'update', $refresh_app); Framework::refresh_opener($msg, $refresh_app, null, null, $refresh_app);
} }
$content['msg'] = $msg; $content['msg'] = $msg;
if(!$content['appname']) $content['appname'] = $appname; if(!$content['appname']) $content['appname'] = $appname;

View File

@ -18,6 +18,7 @@ import {Et2Dialog} from "../../api/js/etemplate/Et2Dialog/Et2Dialog";
import {egw} from "../../api/js/jsapi/egw_global.js"; import {egw} from "../../api/js/jsapi/egw_global.js";
import {egwAction, egwActionObject} from '../../api/js/egw_action/egw_action.js'; import {egwAction, egwActionObject} from '../../api/js/egw_action/egw_action.js';
import {LitElement} from "@lion/core"; import {LitElement} from "@lion/core";
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
/** /**
* UI for Admin * UI for Admin
@ -264,6 +265,10 @@ class AdminApp extends EgwApp
} }
return false; // --> no regular refresh return false; // --> no regular refresh
} }
else
{
return false;
}
// invalidate client-side account-cache // invalidate client-side account-cache
this.egw.invalidate_account(_id, _type); this.egw.invalidate_account(_id, _type);
// group deleted, added or updated // group deleted, added or updated
@ -295,24 +300,6 @@ class AdminApp extends EgwApp
// not a user or group, eg. categories // not a user or group, eg. categories
else if (!_id) else if (!_id)
{ {
// Try just refreshing the nextmatch
if(this.nm)
{
this.nm.refresh();
}
if(this.groups)
{
this.groups.refresh();
}
if(this.et2 && this.et2.getWidgetById('nm') && this.nm !== this.et2.getWidgetById('nm'))
{
this.et2.getWidgetById('nm').refresh();
}
else
{
// Load something else
this.load();
}
return false; // --> no regular refresh needed return false; // --> no regular refresh needed
} }
} }
@ -338,17 +325,26 @@ class AdminApp extends EgwApp
*/ */
push(pushData : PushData) push(pushData : PushData)
{ {
// We'll listen to addressbook, but only if it has an account ID // Filter out what we're not interested in
if (pushData.app != this.appname) return; if([this.appname, "api-cats"].indexOf(pushData.app) == -1)
{
return;
}
if(pushData.id > 0) const cat_template = "admin.categories.index";
if(this.appname.indexOf(pushData.app) != -1 && pushData.id > 0)
{ {
this.nm.refresh(pushData.id, pushData.type); this.nm.refresh(pushData.id, pushData.type);
} }
else if (pushData.id < 0) else if(pushData.app == this.appname && pushData.id < 0)
{ {
this.groups.refresh(pushData.id, pushData.type); this.groups.refresh(pushData.id, pushData.type);
} }
else if(pushData.app == "api-cats" && etemplate2.getByTemplate(cat_template).length == 1)
{
(<et2_nextmatch>etemplate2.getByTemplate(cat_template)[0].widgetContainer.getWidgetById("nm")).refresh(pushData.id, pushData.type);
}
} }
/** /**
@ -894,7 +890,7 @@ class AdminApp extends EgwApp
if (typeof select_owner != 'undefined') if (typeof select_owner != 'undefined')
{ {
var owner = select_owner.get_value(); var owner = select_owner.value;
} }
if(typeof owner != 'object') if(typeof owner != 'object')
@ -908,7 +904,7 @@ class AdminApp extends EgwApp
// If they checked all users, uncheck the others // If they checked all users, uncheck the others
if(all_users) { if(all_users) {
select_owner.set_value(['0']); select_owner.value = ['0'];
return true; return true;
} }
@ -916,7 +912,7 @@ class AdminApp extends EgwApp
var cat_original_owner = this.et2.getArrayMgr('content').getEntry('owner'); var cat_original_owner = this.et2.getArrayMgr('content').getEntry('owner');
if (cat_original_owner) if (cat_original_owner)
{ {
var selected_groups = select_owner.get_value().toString(); var selected_groups = select_owner.value.toString();
for(var i =0;i < cat_original_owner.length;i++) for(var i =0;i < cat_original_owner.length;i++)
{ {

View File

@ -802,7 +802,7 @@ class Categories
$push->apply("egw.push", [[ $push->apply("egw.push", [[
'app' => self::PUSH_APP, 'app' => self::PUSH_APP,
'id' => $values['id'], 'id' => $values['id'],
'type' => 'edit', 'type' => 'update',
// assuming there is nothing private about a cat, thought private cats are only pushed to that account // assuming there is nothing private about a cat, thought private cats are only pushed to that account
'acl' => Db::strip_array_keys($cat, 'cat_'), 'acl' => Db::strip_array_keys($cat, 'cat_'),
'account_id' => $GLOBALS['egw_info']['user']['account_id'] 'account_id' => $GLOBALS['egw_info']['user']['account_id']