Importexport: fix allowed_users_change()

Not allowed to choose "all" or "just me" in combination with actual users, but this was broken by webcomponent upgrade
This commit is contained in:
nathan 2022-11-21 09:24:28 -07:00
parent 67e643be8d
commit 8e0192fb7c

View File

@ -12,7 +12,6 @@
import "../../vendor/bower-asset/jquery/dist/jquery.min.js"; import "../../vendor/bower-asset/jquery/dist/jquery.min.js";
//import "../../vendor/bower-asset/jquery-ui/jquery-ui.js"; //import "../../vendor/bower-asset/jquery-ui/jquery-ui.js";
import {EgwApp} from '../../api/js/jsapi/egw_app'; import {EgwApp} from '../../api/js/jsapi/egw_app';
import {egw} from "../../api/js/jsapi/egw_global"; import {egw} from "../../api/js/jsapi/egw_global";
@ -166,12 +165,15 @@ class ImportExportApp extends EgwApp
* Allowed users widget has been changed, if 'All users' or 'Just me' * Allowed users widget has been changed, if 'All users' or 'Just me'
* was selected, turn off any other options. * was selected, turn off any other options.
*/ */
allowed_users_change(node, widget) allowed_users_change(event, widget)
{ {
var value = widget.getValue(); var value = widget.getValue();
// Only 1 selected, no checking needed // Only 1 selected, no checking needed
if(value == null || value.length <= 1) return; if(value == null || value.length <= 1)
{
return;
}
// Don't jump it to the top, it's weird // Don't jump it to the top, it's weird
widget.selected_first = false; widget.selected_first = false;
@ -183,9 +185,9 @@ class ImportExportApp extends EgwApp
var special = specials[i]; var special = specials[i];
if((index = value.indexOf(special)) >= 0) if((index = value.indexOf(special)) >= 0)
{ {
if(window.event.target.value == special) if(value.indexOf(special) == value.length - 1)
{ {
// Just clicked all/private, clear the others // Just clicked all/private (it's at the end), clear the others
value = [special]; value = [special];
} }
else else
@ -193,9 +195,6 @@ class ImportExportApp extends EgwApp
// Just added another, clear special // Just added another, clear special
value.splice(index, 1); value.splice(index, 1);
} }
// A little highlight to call attention to the change
jQuery('input[value="'+special+'"]',node).parent().parent().effect('highlight',{},500);
break; break;
} }
} }