Related to issue 19728: Do more JS code formatting
authorDavid Baz Fayos <david.baz@openbravo.com>
Wed, 29 Feb 2012 12:05:16 +0100
changeset 15646 42dbbe2c9bec
parent 15645 7f69d5ac8a7e
child 15647 36954df33011
Related to issue 19728: Do more JS code formatting
modules/org.openbravo.client.application/web/org.openbravo.client.application/example/grid-example.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-navbar-test.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-ui-test.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/example/grid-example.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/example/grid-example.js	Wed Feb 29 12:05:16 2012 +0100
@@ -54,17 +54,18 @@
   actionHandler: null,
 
   initWidget: function () {
-    var me = this;
+    var me = this,
+        callBack;
 
     // the data request calls this method, which sets the data in the grid
-    var callBack = function (response, data, request) {
-        me.dataSource = isc.DataSource.create({
-          clientOnly: true,
-          fields: me.fields,
-          testData: data.list
-        });
-        me.filterData();
-        };
+    callBack = function (response, data, request) {
+      me.dataSource = isc.DataSource.create({
+        clientOnly: true,
+        fields: me.fields,
+        testData: data.list
+      });
+      me.filterData();
+    };
 
     // request the data, note the _command value
     OB.RemoteCallManager.call(this.actionHandler, {}, {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Wed Feb 29 12:05:16 2012 +0100
@@ -52,28 +52,29 @@
     // * {{{recordId}}} the record to show
     //
     openLinkedItem: function (tabId, recordId) {
-      var doOpenClassicWindow = function (response, data, request) {
+      var doOpenClassicWindow;
+      doOpenClassicWindow = function (response, data, request) {
 
-          if (!data.recordId || data.recordId.length === 0) {
-            L.ViewManager.openView('OBClassicWindow', {
-              tabTitle: data.tabTitle,
-              windowId: data.windowId,
-              tabId: data.tabId,
-              mappingName: data.mappingName,
-              command: 'DEFAULT'
-            });
-          } else {
-            L.ViewManager.openView('OBClassicWindow', {
-              tabTitle: data.tabTitle,
-              windowId: data.windowId,
-              tabId: data.tabId,
-              mappingName: data.mappingName,
-              keyParameter: data.keyParameter,
-              recordId: data.recordId,
-              command: 'DIRECT'
-            });
-          }
-          };
+        if (!data.recordId || data.recordId.length === 0) {
+          L.ViewManager.openView('OBClassicWindow', {
+            tabTitle: data.tabTitle,
+            windowId: data.windowId,
+            tabId: data.tabId,
+            mappingName: data.mappingName,
+            command: 'DEFAULT'
+          });
+        } else {
+          L.ViewManager.openView('OBClassicWindow', {
+            tabTitle: data.tabTitle,
+            windowId: data.windowId,
+            tabId: data.tabId,
+            mappingName: data.mappingName,
+            keyParameter: data.keyParameter,
+            recordId: data.recordId,
+            command: 'DIRECT'
+          });
+        }
+      };
 
       OB.RemoteCallManager.call('org.openbravo.client.application.ComputeWindowActionHandler', {}, {
         'tabId': tabId,
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js	Wed Feb 29 12:05:16 2012 +0100
@@ -272,30 +272,31 @@
           theForm: form,
           canvas: me,
           click: function () {
-            var fileName, form = this.theForm;
-            var addFunction = function (clickedOK) {
-                if (clickedOK) {
-                  var hTempLayout = isc.HLayout.create();
-                  form.theCanvas.addMember(hTempLayout, form.theCanvas.getMembers().size());
-                  var uploadingFile = isc.Label.create({
-                    contents: fileName
-                  });
-                  var uploading = isc.Label.create({
-                    className: 'OBLinkButtonItemFocused',
-                    contents: '    ' + OB.I18N.getLabel('OBUIAPP_AttachmentUploading')
-                  });
-                  hTempLayout.addMember(uploadingFile);
-                  hTempLayout.addMember(uploading);
-                  var button = form.theCanvas.getForm().view.toolBar.getLeftMember(isc.OBToolbar.TYPE_ATTACHMENTS);
-                  if (!button) {
-                    button = form.theCanvas.getForm().view.toolBar.getLeftMember("attachExists");
-                  }
-                  button.customState = 'Progress';
-                  button.resetBaseStyle();
-                  form.submitForm();
-                  form.popup.hide();
+            var fileName, form = this.theForm,
+                addFunction;
+            addFunction = function (clickedOK) {
+              if (clickedOK) {
+                var hTempLayout = isc.HLayout.create();
+                form.theCanvas.addMember(hTempLayout, form.theCanvas.getMembers().size());
+                var uploadingFile = isc.Label.create({
+                  contents: fileName
+                });
+                var uploading = isc.Label.create({
+                  className: 'OBLinkButtonItemFocused',
+                  contents: '    ' + OB.I18N.getLabel('OBUIAPP_AttachmentUploading')
+                });
+                hTempLayout.addMember(uploadingFile);
+                hTempLayout.addMember(uploading);
+                var button = form.theCanvas.getForm().view.toolBar.getLeftMember(isc.OBToolbar.TYPE_ATTACHMENTS);
+                if (!button) {
+                  button = form.theCanvas.getForm().view.toolBar.getLeftMember("attachExists");
                 }
-                };
+                button.customState = 'Progress';
+                button.resetBaseStyle();
+                form.submitForm();
+                form.popup.hide();
+              }
+            };
             var value = this.theForm.getItem('inpname').getElement().value;
             if (!value) {
               isc.say(OB.I18N.getLabel('OBUIAPP_AttachmentsSpecifyFile'));
@@ -382,34 +383,36 @@
     hLayout.addMember(downloadAllButton);
     hLayout.addMember(removeAllButton);
 
-    var downloadActions = function () {
-        var d = {
-          Command: 'DISPLAY_DATA',
-          inpcFileId: this.attachId
-        };
-        OB.Utilities.postThroughHiddenForm('./businessUtility/TabAttachments_FS.html', d);
-        };
+    var downloadActions;
+    downloadActions = function () {
+      var d = {
+        Command: 'DISPLAY_DATA',
+        inpcFileId: this.attachId
+      };
+      OB.Utilities.postThroughHiddenForm('./businessUtility/TabAttachments_FS.html', d);
+    };
 
-    var removeActions = function () {
-        var i, length, d = {
-          Command: 'DELETE',
-          tabId: this.canvas.tabId,
-          buttonId: this.canvas.ID,
-          recordIds: this.canvas.recordId,
-          attachId: this.attachmentId
-        },
-            canvas = this.canvas;
+    var removeActions;
+    removeActions = function () {
+      var i, length, d = {
+        Command: 'DELETE',
+        tabId: this.canvas.tabId,
+        buttonId: this.canvas.ID,
+        recordIds: this.canvas.recordId,
+        attachId: this.attachmentId
+      },
+          canvas = this.canvas;
 
-        isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmRemove'), function (clickedOK) {
-          if (clickedOK) {
-            OB.RemoteCallManager.call('org.openbravo.client.application.window.AttachmentsAH', {}, d, function (response, data, request) {
-              canvas.fillAttachments(data.attachments);
-            });
-          }
-        }, {
-          title: OB.I18N.getLabel('OBUIAPP_DialogTitle_RemoveAttachment')
-        });
-        };
+      isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmRemove'), function (clickedOK) {
+        if (clickedOK) {
+          OB.RemoteCallManager.call('org.openbravo.client.application.window.AttachmentsAH', {}, d, function (response, data, request) {
+            canvas.fillAttachments(data.attachments);
+          });
+        }
+      }, {
+        title: OB.I18N.getLabel('OBUIAPP_DialogTitle_RemoveAttachment')
+      });
+    };
 
     length = attachments.length;
     for (i = 0; i < attachments.length; i++) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-linked-items.js	Wed Feb 29 12:05:16 2012 +0100
@@ -135,21 +135,22 @@
 
     var that = this;
 
-    var callback = function (response, data, request) {
-        var msg = data.msg;
-        var usedByLinkData = data.usedByLinkData;
-        if (msg !== null) {
-          that.messageLabel.setContents(msg);
-        }
+    var callback;
+    callback = function (response, data, request) {
+      var msg = data.msg;
+      var usedByLinkData = data.usedByLinkData;
+      if (msg !== null) {
+        that.messageLabel.setContents(msg);
+      }
 
-        if (usedByLinkData === null) {
-          usedByLinkData = [];
-        }
+      if (usedByLinkData === null) {
+        usedByLinkData = [];
+      }
 
-        that.linkedItemCategoryDS.setCacheData(usedByLinkData, true);
-        that.linkedItemCategoryListGrid.invalidateCache();
-        that.linkedItemCategoryListGrid.filterData();
-        };
+      that.linkedItemCategoryDS.setCacheData(usedByLinkData, true);
+      that.linkedItemCategoryListGrid.invalidateCache();
+      that.linkedItemCategoryListGrid.filterData();
+    };
 
     var reqObj = {
       params: {
@@ -179,20 +180,21 @@
     var selCatItems = this.linkedItemCategoryListGrid.getSelectedRecord();
 
     var that = this; /* loads linked items to the child grid */
-    var callback = function (response, data, request) {
-        var msg = data.msg;
-        var usedByLinkData = data.usedByLinkData;
-        if (msg !== null) {
-          that.messageLabel.setContents(msg);
-        }
+    var callback;
+    callback = function (response, data, request) {
+      var msg = data.msg;
+      var usedByLinkData = data.usedByLinkData;
+      if (msg !== null) {
+        that.messageLabel.setContents(msg);
+      }
 
-        if (usedByLinkData === null) {
-          usedByLinkData = [];
-        }
-        that.linkedItemListGrid.invalidateCache();
-        that.linkedItemDS.setCacheData(usedByLinkData, true);
-        that.linkedItemListGrid.filterData();
-        };
+      if (usedByLinkData === null) {
+        usedByLinkData = [];
+      }
+      that.linkedItemListGrid.invalidateCache();
+      that.linkedItemDS.setCacheData(usedByLinkData, true);
+      that.linkedItemListGrid.filterData();
+    };
 
     if (!selCatItems) {
       this.linkedItemCategoryListGrid.filterEditorSubmit();
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-navbar-test.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-navbar-test.js	Wed Feb 29 12:05:16 2012 +0100
@@ -28,28 +28,29 @@
 
   expect(16);
 
-  var callback = function (rpcResponse, data, rpcRequest) {
-      ok(data.language, 'Language present');
-      ok(data.language.value, 'Language value present');
-      ok(data.language.valueMap, 'Language valueMap present');
-      ok(data.language.value, 'Language value present');
+  var callback;
+  callback = function (rpcResponse, data, rpcRequest) {
+    ok(data.language, 'Language present');
+    ok(data.language.value, 'Language value present');
+    ok(data.language.valueMap, 'Language valueMap present');
+    ok(data.language.value, 'Language value present');
 
-      ok(data.initialValues.role, 'Initial role value set');
-      ok(data.initialValues.client, 'Initial client value set');
-      ok(data.initialValues.organization, 'Initial organization value set');
-      ok(data.initialValues.language, 'Initial language value set');
+    ok(data.initialValues.role, 'Initial role value set');
+    ok(data.initialValues.client, 'Initial client value set');
+    ok(data.initialValues.organization, 'Initial organization value set');
+    ok(data.initialValues.language, 'Initial language value set');
 
-      ok(data.role, 'Role set');
-      ok(data.role.value, 'Role value set');
-      ok(data.role.valueMap, 'Role valueMap set');
-      ok(data.role.roles, 'Role info set');
-      ok(data.role.roles.length > 0, 'More than one role present');
-      ok(data.role.roles[0].id, 'Role id set');
-      ok(data.role.roles[0].organizationValueMap, 'Role org value map set');
-      ok(data.role.roles[0].warehouseValueMap, 'Role wh value map set');
+    ok(data.role, 'Role set');
+    ok(data.role.value, 'Role value set');
+    ok(data.role.valueMap, 'Role valueMap set');
+    ok(data.role.roles, 'Role info set');
+    ok(data.role.roles.length > 0, 'More than one role present');
+    ok(data.role.roles[0].id, 'Role id set');
+    ok(data.role.roles[0].organizationValueMap, 'Role org value map set');
+    ok(data.role.roles[0].warehouseValueMap, 'Role wh value map set');
 
-      start();
-      };
+    start();
+  };
   var action = 'org.openbravo.client.application.navigationbarcomponents.UserInfoWidgetActionHandler';
   OB.RemoteCallManager.call(action, {}, {
     'command': 'data'
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-ui-test.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-ui-test.js	Wed Feb 29 12:05:16 2012 +0100
@@ -29,15 +29,15 @@
   expect(3);
 
   var canvasID = 'myCanvas',
-      canvas;
-  var createCanvas = function (isc) {
-      var c = isc.Canvas.newInstance({
-        ID: canvasID,
-        width: '100%',
-        height: '100%'
-      });
-      return c;
-      };
+      canvas, createCanvas;
+  createCanvas = function (isc) {
+    var c = isc.Canvas.newInstance({
+      ID: canvasID,
+      width: '100%',
+      height: '100%'
+    });
+    return c;
+  };
 
   canvas = createCanvas(isc);
   canvas.setBackgroundColor('blue');
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Wed Feb 29 11:46:53 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Wed Feb 29 12:05:16 2012 +0100
@@ -1222,8 +1222,7 @@
 
       var noneOrMultipleRecordsSelected = numOfSelRecords !== 1 && !isNew;
 
-      if (currentValues && !noSetSession && !currentContext.isShowingForm && !isNew && !hideAllButtons
-        && currentContext.ID===this.view.ID) {
+      if (currentValues && !noSetSession && !currentContext.isShowingForm && !isNew && !hideAllButtons && currentContext.ID === this.view.ID) {
         if (this.view.tabId === currentContext.tabId) {
           currentTabCalled = true;
         }
@@ -1484,13 +1483,14 @@
   keyboardShortcutId: null,
   enableShortcut: function () {
     if (this.keyboardShortcutId) {
-      var me = this;
-      var ksAction = function () {
-          if (!me.disabled) {
-            me.action();
-          }
-          return false; //To avoid keyboard shortcut propagation
-          };
+      var me = this,
+          ksAction;
+      ksAction = function () {
+        if (!me.disabled) {
+          me.action();
+        }
+        return false; //To avoid keyboard shortcut propagation
+      };
       OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, 'Canvas', ksAction);
     }
   },