]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Implement Preferences
authorCharles du Jeu <charles.dujeu@gmail.com>
Wed, 1 Jul 2009 18:47:48 +0000 (18:47 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Wed, 1 Jul 2009 18:47:48 +0000 (18:47 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2659 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

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

index 4ca360b1b5ef1d6d138a1030bdb4f3ceb31c36e9..03f27df4399aa9aa81f40f6eb696b1782fb8ab17 100644 (file)
@@ -5,7 +5,16 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
 {\r
        extend : qx.ui.container.Composite,\r
        implement : [org.argeo.ria.components.IView], \r
-\r
+       include : [org.argeo.ria.session.MPrefHolder],\r
+       statics : {\r
+               riaPreferences : {\r
+                       "slc.batch.delete.confirm" : {\r
+                               label : "Confirm on batch deletion",\r
+                               type  : "boolean",\r
+                               defaultValue  : true\r
+                       }\r
+               }\r
+       },\r
        properties : \r
        {\r
                /**\r
@@ -82,19 +91,27 @@ qx.Class.define("org.argeo.slc.ria.BatchView",
                                        toolbar : "batch",\r
                                        callback : function(e) {\r
                                                var sel = this.list.getSortedSelection();\r
-                                               var modal = new org.argeo.ria.components.Modal("Confirm", null);\r
-                                               modal.addConfirm("Are you sure you want to remove<br> the selected test"\r
-                                                                               + (sel.length > 1 ? "s" : "")\r
-                                                                               + " from the Batch?");\r
-                                               modal.addListener("ok", function() {\r
-                                                                       for (var i = 0; i < sel.length; i++) {\r
-                                                                               this.list.remove(sel[i]);\r
-                                                                       }\r
-                                                                       if (!this.list.hasChildren()) {\r
-                                                                               this.setBatchAgentId(null);\r
-                                                                       }\r
-                                                               }, this);\r
-                                               modal.attachAndShow();\r
+                                               var confirmPref = this.getRiaPreferenceValue("slc.batch.delete.confirm");\r
+                                               this.debug(confirmPref);\r
+                                               var execution = function() {\r
+                                                       for (var i = 0; i < sel.length; i++) {\r
+                                                               this.list.remove(sel[i]);\r
+                                                       }\r
+                                                       if (!this.list.hasChildren()) {\r
+                                                               this.setBatchAgentId(null);\r
+                                                       }\r
+                                               }\r
+                                               if(confirmPref){\r
+                                                       var modal = new org.argeo.ria.components.Modal("Confirm", null);\r
+                                                       modal.addConfirm("Are you sure you want to remove<br> the selected test"\r
+                                                                                       + (sel.length > 1 ? "s" : "")\r
+                                                                                       + " from the Batch?");\r
+                                                       modal.addListener("ok", execution, this);\r
+                                                       modal.attachAndShow();\r
+                                               }else{\r
+                                                       execution = qx.lang.Function.bind(execution, this);\r
+                                                       execution();\r
+                                               }\r
                                        },\r
                                        selectionChange : function(viewId, selection) {\r
                                                if (viewId != "batch:list")\r