X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=security%2Fruntime%2Forg.argeo.security.ria%2Fsrc%2Fargeo-ria-lib%2Fsecurity%2Fclass%2Forg%2Fargeo%2Fsecurity%2Fria%2FUsersApplet.js;h=5eb44f42ed1b0feee5ebb76d97d51a8f3d74ebfb;hb=829163c2a8aa042407a6fd2ee45d10cea69e933f;hp=72074cd15b3bb8a5c13486b222d346e28b6f7f83;hpb=30d0df2528e69ed0a0f8fb873fd8d591db949697;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js index 72074cd15..5eb44f42e 100644 --- a/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js +++ b/security/runtime/org.argeo.security.ria/src/argeo-ria-lib/security/class/org/argeo/security/ria/UsersApplet.js @@ -3,7 +3,7 @@ * The only associated command is the "Close" command. */ /* ************************************************* -#asset(resource/org.argeo.ria.sample/window-close.png) +#asset(resource/org.argeo.security.ria/*) ****************************************************/ qx.Class.define("org.argeo.security.ria.UsersApplet", { @@ -28,21 +28,69 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", */ commands : { init : { - "close" : { - label : "Close", - icon : "ria/window-close.png", - shortcut : "Control+w", + "new_user" : { + label : "New User", + icon : "org.argeo.security.ria/list-add.png", + shortcut : "Control+n", enabled : true, - menu : "Applet", - toolbar : "result", + menu : "Users", + toolbar : "userslist", callback : function(e){ // Call service to delete - this.getView().empty(); + var classObj = org.argeo.security.ria.UserEditorApplet; + var iView = org.argeo.ria.components.ViewsManager.getInstance().initIViewClass(classObj, "editor"); + iView.load(); }, command : null - } + }, + "delete_user" : { + label : "Delete User", + icon : "org.argeo.security.ria/list-remove.png", + shortcut : "Control+s", + enabled : true, + menu : "Users", + toolbar : "userslist", + callback : function(e){ + // Call service to delete + var crtUsers = this.getViewSelection().getNodes(); + for(var i=0;i 1)); + }, + command : null + } } }, + + guiMode : { + init : "filter", + apply : "_applyGuiMode" + }, + viewSelection : { nullable:false, check:"org.argeo.ria.components.ViewSelection" @@ -67,8 +115,50 @@ qx.Class.define("org.argeo.security.ria.UsersApplet", return new qx.ui.table.columnmodel.Resize(obj) } }); - this.table.setStatusBarVisible(false); + this.table.setStatusBarVisible(false); + this.table.setShowCellFocusIndicator(false); + this.table.setColumnVisibilityButtonVisible(false); + this.table.highlightFocusedRow(false); viewPane.add(this.table, {height:"100%"}); + this.table.getSelectionModel().addListener("changeSelection", function(){ + this._selectionToValues(this.table.getSelectionModel(), this.getViewSelection()); + }, this); + + this.setGuiMode("chooser"); + }, + + _applyGuiMode : function(newMode, oldMode){ + this.table.getSelectionModel().clearSelection(); + this.resetHiddenRows(); + if(newMode == "filter"){ + this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION); + }else if(newMode == "chooser"){ + this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.MULTIPLE_INTERVAL_SELECTION_TOGGLE); + }else if(newMode == "clear"){ + this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION); + } + }, + + _selectionToValues : function(selectionModel, viewSelection){ + if(viewSelection){ + viewSelection.setBatchMode(true); + viewSelection.clear(); + } + if(!selectionModel.getSelectedCount()) return []; + var ranges = selectionModel.getSelectedRanges(); + var values = []; + for(var i=0;i