]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Fix #209 (do not complain if empty value when frozen or hidden), and add an option...
authorCharles du Jeu <charles.dujeu@gmail.com>
Thu, 23 Jul 2009 09:18:09 +0000 (09:18 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Thu, 23 Jul 2009 09:18:09 +0000 (09:18 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2726 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/BatchView.js
server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js

index 0574296710dd1943a28b6835353d59ea005593ae..78715de0403652f23aad1095fc6ccf67ba59daa7 100644 (file)
@@ -12,6 +12,11 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                label : "Confirm on batch deletion",\r
                                type  : "boolean",\r
                                defaultValue  : true\r
+                       },\r
+                       "slc.batch.autoclear" : {\r
+                               label : "Autoclear batch on execution",\r
+                               type : "boolean",\r
+                               defaultValue : false\r
                        }\r
                }\r
        },\r
@@ -31,9 +36,25 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                        menu : "Launcher",\r
                                        toolbar : "batch",\r
                                        callback : function(e) {\r
-                                               if (this.getBatchAgentId()) {\r
-                                                       this.executeBatchOnAgent(this.getBatchAgentId());\r
+                                               var batchAgentId = this.getBatchAgentId();\r
+                                               if (!batchAgentId) {\r
+                                                       return;                                                 \r
                                                }\r
+                                               var prefName = "slc.batch.autoclear";\r
+                                               var prefValue = this.getRiaPreferenceValue(prefName);\r
+                                               if(prefValue !== null){\r
+                                                       this.executeBatchOnAgent(batchAgentId, prefValue);\r
+                                                       return;\r
+                                               }\r
+                                               var modal = new org.argeo.ria.components.Modal("Clear?", null);\r
+                                               modal.addYesNoReminder("Do you want to clear the batch automatically after execution?", prefName);\r
+                                               modal.addListener("cancel", function(e){\r
+                                                       this.executeBatchOnAgent(batchAgentId, false);\r
+                                               }, this);\r
+                                               modal.addListener("ok", function(e){\r
+                                                       this.executeBatchOnAgent(batchAgentId, true);\r
+                                               }, this);\r
+                                               modal.attachAndShow();                                          \r
                                        },\r
                                        command : null\r
                                },\r
@@ -396,7 +417,7 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                 * @param agentUuid\r
                 *            {String} The id of the target agent\r
                 */\r
-               executeBatchOnAgent : function(agentUuid) {\r
+               executeBatchOnAgent : function(agentUuid, clearBatch) {\r
                        var selection = this.list.getChildren();\r
                        if (!selection.length)\r
                                return;\r
@@ -418,6 +439,11 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                                                command.execute();\r
                                                        }\r
                                                }, this, 2000);\r
+                               if(clearBatch){\r
+                                       req.addListener("completed", function(e){\r
+                                               this.list.removeAll();\r
+                                       }, this);\r
+                               }                                               \r
                        }catch(e){\r
                                this.error(e);                          \r
                        }\r
index b21749b105b0731eea65e226d75fa1a4aa551ce7..4226699ceff2cb1dfff0c1ecc11b48b88f90933e 100644 (file)
@@ -49,7 +49,7 @@ qx.Class.define("org.argeo.slc.ria.execution.BatchEntrySpec", {
                        var valuesXml = '';\r
                        var values = this.getValues();\r
                        for(var key in values){\r
-                               if(values[key].getValue() == null){\r
+                               if(values[key].getValue() == null && !values[key].isFrozen() && !values[key].isHidden()){\r
                                        throw new Error("Cannot send empty values! (Parameter "+key+")");\r
                                }\r
                                valuesXml += values[key].toValueXml();\r