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')
{
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();
}
break;
@ -242,7 +242,7 @@ class admin_categories
$cmd = new admin_cmd_delete_category($content['id'], $delete_subs);
$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();
return;
}
@ -254,7 +254,7 @@ class admin_categories
break;
}
// 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;
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 {egwAction, egwActionObject} from '../../api/js/egw_action/egw_action.js';
import {LitElement} from "@lion/core";
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
/**
* UI for Admin
@ -264,6 +265,10 @@ class AdminApp extends EgwApp
}
return false; // --> no regular refresh
}
else
{
return false;
}
// invalidate client-side account-cache
this.egw.invalidate_account(_id, _type);
// group deleted, added or updated
@ -295,24 +300,6 @@ class AdminApp extends EgwApp
// not a user or group, eg. categories
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
}
}
@ -338,17 +325,26 @@ class AdminApp extends EgwApp
*/
push(pushData : PushData)
{
// We'll listen to addressbook, but only if it has an account ID
if (pushData.app != this.appname) return;
// Filter out what we're not interested in
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);
}
else if (pushData.id < 0)
else if(pushData.app == this.appname && pushData.id < 0)
{
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')
{
var owner = select_owner.get_value();
var owner = select_owner.value;
}
if(typeof owner != 'object')
@ -908,7 +904,7 @@ class AdminApp extends EgwApp
// If they checked all users, uncheck the others
if(all_users) {
select_owner.set_value(['0']);
select_owner.value = ['0'];
return true;
}
@ -916,7 +912,7 @@ class AdminApp extends EgwApp
var cat_original_owner = this.et2.getArrayMgr('content').getEntry('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++)
{

View File

@ -800,13 +800,13 @@ class Categories
// push category change
$push = new Push($cat['cat_access'] === 'public' || (int)$cat['cat_owner'] <= 0 ? Push::ALL : (int)$cat['cat_owner']);
$push->apply("egw.push", [[
'app' => self::PUSH_APP,
'id' => $values['id'],
'type' => 'edit',
// assuming there is nothing private about a cat, thought private cats are only pushed to that account
'acl' => Db::strip_array_keys($cat, 'cat_'),
'account_id' => $GLOBALS['egw_info']['user']['account_id']
]]);
'app' => self::PUSH_APP,
'id' => $values['id'],
'type' => 'update',
// assuming there is nothing private about a cat, thought private cats are only pushed to that account
'acl' => Db::strip_array_keys($cat, 'cat_'),
'account_id' => $GLOBALS['egw_info']['user']['account_id']
]]);
return (int)$values['id'];
}