Issue 19728: Format js files org.openbravo.client.application - toolbar
authorIván Perdomo <ivan.perdomo@openbravo.com>
Sat, 11 Feb 2012 17:01:05 +0100
changeset 15468 9c44288913ac
parent 15467 4cfd9a2819c4
child 15469 90cd8fb48f1a
Issue 19728: Format js files org.openbravo.client.application - toolbar
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.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/js/toolbar/ob-action-button.js	Sat Feb 11 16:43:01 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-action-button.js	Sat Feb 11 17:01:05 2012 +0100
@@ -130,30 +130,31 @@
     //Force setting context info, it needs to be forced in case the current record has just been saved.
     theView.setContextInfo(sessionProperties, callbackFunction, true);
   },
-  
-  closeProcessPopup: function(newWindow) {
+
+  closeProcessPopup: function (newWindow) {
     //Keep current view for the callback function. Refresh and look for tab message.
     var contextView = OB.ActionButton.executingProcess.contextView,
         currentView = this.view,
-        afterRefresh = function (doRefresh) {
-          var undef,
-              refresh = (doRefresh === undef || doRefresh);
+        afterRefresh;
 
-          // Refresh context view
-          contextView.getTabMessage();
-          currentView.toolBar.refreshCustomButtons();
+    afterRefresh = function (doRefresh) {
+      var undef, refresh = (doRefresh === undef || doRefresh);
 
-          if (contextView !== currentView && currentView.state === isc.OBStandardView.STATE_TOP_MAX) {
-            // Executing an action defined in parent tab, current tab is maximized,
-            // let's set half for each in order to see the message
-            contextView.setHalfSplit();
-          }
+      // Refresh context view
+      contextView.getTabMessage();
+      currentView.toolBar.refreshCustomButtons();
 
-          // Refresh in order to show possible new records
-          if (refresh) {
-            currentView.refresh(null, false, true);
-          }
-        };
+      if (contextView !== currentView && currentView.state === isc.OBStandardView.STATE_TOP_MAX) {
+        // Executing an action defined in parent tab, current tab is maximized,
+        // let's set half for each in order to see the message
+        contextView.setHalfSplit();
+      }
+
+      // Refresh in order to show possible new records
+      if (refresh) {
+        currentView.refresh(null, false, true);
+      }
+    };
 
     if (this.autosave) {
       if (currentView.parentView) {
@@ -178,11 +179,11 @@
 
     if (newWindow) {
       if (OB.Application.contextUrl && newWindow.indexOf(OB.Application.contextUrl) !== -1) {
-        newWindow = newWindow.substr(newWindow.indexOf(OB.Application.contextUrl) + OB.Application.contextUrl.length-1);
+        newWindow = newWindow.substr(newWindow.indexOf(OB.Application.contextUrl) + OB.Application.contextUrl.length - 1);
       }
 
-      if (!newWindow.startsWith('/')){
-        newWindow = '/'+newWindow;
+      if (!newWindow.startsWith('/')) {
+        newWindow = '/' + newWindow;
       }
 
       if (newWindow.startsWith(contextView.mapping250)) {
@@ -190,52 +191,52 @@
         return;
       }
       var windowParams = {
-          viewId : this.title,
-          tabTitle: this.title,
-          obManualURL : newWindow  
-        };
+        viewId: this.title,
+        tabTitle: this.title,
+        obManualURL: newWindow
+      };
       OB.Layout.ViewManager.openView('OBClassicWindow', windowParams);
     }
   },
-  
-  updateState: function(record, hide, context, keepNonAutosave) {
-    var currentValues = record || this.contextView.getCurrentValues() || {},
-        // do not hide non autosave buttons when hidding the rest if keepNonAutosave === true
-        hideButton = hide && (!keepNonAutosave || this.autosave);
+
+  updateState: function (record, hide, context, keepNonAutosave) {
+    var currentValues = record || this.contextView.getCurrentValues() || {};
+    // do not hide non autosave buttons when hidding the rest if keepNonAutosave === true
+    var hideButton = hide && (!keepNonAutosave || this.autosave);
 
     if (hideButton || !record) {
       this.hide();
       return;
     }
-    
-    context = context || this.contextView.getContextInfo(false, true, true); 
-    
-    
+
+    context = context || this.contextView.getContextInfo(false, true, true);
+
+
     OB.Utilities.fixNull250(currentValues);
-    
+
     this.visible = !this.displayIf || (context && this.displayIf(this.contextView.viewForm, record, context));
-    
+
     // Even visible is correctly set, it is necessary to execute show() or hide()
-    if (this.visible){
+    if (this.visible) {
       this.show();
     } else {
       this.hide();
     }
-    
+
     var readonly = this.readOnlyIf && context && this.readOnlyIf(this.contextView.viewForm, record, context);
     if (readonly) {
       this.disable();
     } else {
       this.enable();
     }
-    
+
     var buttonValue = record[this.property];
     if (buttonValue === '--') {
       buttonValue = 'CL';
     }
-    
+
     var label = this.labelValue[buttonValue];
-    if (!label){
+    if (!label) {
       if (this.realTitle) {
         label = this.realTitle;
       } else {
@@ -245,5 +246,4 @@
     this.realTitle = label;
     this.setTitle(label);
   }
-  
-});
+});
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js	Sat Feb 11 16:43:01 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js	Sat Feb 11 17:01:05 2012 +0100
@@ -11,45 +11,45 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011 Openbravo SLU
+ * All portions are Copyright (C) 2011-2012 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):   Sreedhar Sirigiri (TDS), Mallikarjun M (TDS)
  ************************************************************************
  */
 
 // Registers a button to clone an order
-
 // put within a function to hide local vars etc.
 (function () {
   var cloneButtonProps = isc.addProperties({}, isc.OBToolbar.CLONE_BUTTON_PROPERTIES);
-  cloneButtonProps.action = function (){
-    var view = this.view;
-    var callback = function(ok){
+
+  cloneButtonProps.action = function () {
+    var view = this.view,
+        callback;
+
+    callback = function (ok) {
       var requestParams;
-      
+
       if (ok) {
         requestParams = {
-            orderId:view.viewGrid.getSelectedRecord().id
+          orderId: view.viewGrid.getSelectedRecord().id
         };
-        OB.RemoteCallManager.call('org.openbravo.client.application.businesslogic.CloneOrderActionHandler', {}, 
-            requestParams, function(rpcResponse, data, rpcRequest) {
+        OB.RemoteCallManager.call('org.openbravo.client.application.businesslogic.CloneOrderActionHandler', {}, requestParams, function (rpcResponse, data, rpcRequest) {
 
-              var recordIndex = view.viewGrid.getRecordIndex(view.viewGrid.getSelectedRecord()) + 1;
-              // takes care of transforming dates etc.
-              data = view.viewGrid.getDataSource().recordsFromObjects(data)[0];
-              view.viewGrid.data.insertCacheData(data, recordIndex);
-              view.viewGrid.scrollToRow(recordIndex);
-              view.viewGrid.markForRedraw();
-              var visibleRows = view.viewGrid.body.getVisibleRows();
-              view.editRecord(view.viewGrid.getRecord(recordIndex), false);
-            }
-        );
+          var recordIndex = view.viewGrid.getRecordIndex(view.viewGrid.getSelectedRecord()) + 1;
+          // takes care of transforming dates etc.
+          data = view.viewGrid.getDataSource().recordsFromObjects(data)[0];
+          view.viewGrid.data.insertCacheData(data, recordIndex);
+          view.viewGrid.scrollToRow(recordIndex);
+          view.viewGrid.markForRedraw();
+          var visibleRows = view.viewGrid.body.getVisibleRows();
+          view.editRecord(view.viewGrid.getRecord(recordIndex), false);
+        });
       }
     };
     isc.ask(OB.I18N.getLabel('OBUIAPP_WantToCloneOrder'), callback);
   };
-  
+
   // register the button for the sales order tab
   OB.ToolbarRegistry.registerButton(cloneButtonProps.buttonType, isc.OBToolbarIconButton, cloneButtonProps, 100, ['186']);
-    
-}());
+
+}());
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Sat Feb 11 16:43:01 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Sat Feb 11 17:01:05 2012 +0100
@@ -29,38 +29,36 @@
   TYPE_EXPORT: 'export',
   TYPE_ATTACHMENTS: 'attach',
   TYPE_CLONE: 'clone',
-  
+
   SAVE_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       this.view.saveRow();
     },
     disabled: true,
     buttonType: 'save',
     prompt: OB.I18N.getLabel('OBUIAPP_SaveRow'),
-    updateState: function(){
-      var view = this.view, form = view.viewForm, hasErrors = false, editRow;
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm,
+          hasErrors = false,
+          editRow;
       if (view.isShowingForm) {
-        this.setDisabled(!(form.isNew && form.allRequiredFieldsSet()) && 
-        (form.isSaving || form.readOnly ||
-        !view.hasValidState() || form.hasErrors() ||
-        !form.hasChanged || !form.allRequiredFieldsSet()));
+        this.setDisabled(!(form.isNew && form.allRequiredFieldsSet()) && (form.isSaving || form.readOnly || !view.hasValidState() || form.hasErrors() || !form.hasChanged || !form.allRequiredFieldsSet()));
       } else if (view.isEditingGrid) {
         form = view.viewGrid.getEditForm();
         editRow = view.viewGrid.getEditRow();
         hasErrors = view.viewGrid.rowHasErrors(editRow);
-        this.setDisabled(!(form.isNew && form.allRequiredFieldsSet()) && !hasErrors &&
-        (form.isSaving || form.readOnly ||
-        !view.hasValidState() || form.hasErrors() || 
-        !form.hasChanged || !form.allRequiredFieldsSet()));
+        this.setDisabled(!(form.isNew && form.allRequiredFieldsSet()) && !hasErrors && (form.isSaving || form.readOnly || !view.hasValidState() || form.hasErrors() || !form.hasChanged || !form.allRequiredFieldsSet()));
       } else {
         this.setDisabled(true);
       }
     },
     keyboardShortcutId: 'ToolBar_Save'
   },
+
   SAVECLOSE_BUTTON_PROPERTIES: {
     saveDisabled: true,
-    action: function(){
+    action: function () {
       var actionObject = {
         target: this,
         method: this.saveAndClose,
@@ -68,25 +66,23 @@
       };
       this.view.standardWindow.doActionAfterAutoSave(actionObject, false, true);
     },
-    
-    saveAndClose: function() {
-      if(!this.saveDisabled && !this.view.viewForm.validateForm()) {
+
+    saveAndClose: function () {
+      if (!this.saveDisabled && !this.view.viewForm.validateForm()) {
         return;
       }
       this.view.switchFormGridVisibility();
       this.view.messageBar.hide();
     },
-    
+
     buttonType: 'savecloseX',
     prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON'),
-    updateState: function(){
-      var view = this.view, form = view.viewForm;
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm;
       if (view.isShowingForm) {
         this.setDisabled(false);
-        var saveDisabled = !(form.isNew && form.allRequiredFieldsSet()) && 
-          (form.isSaving || form.readOnly ||
-          !view.hasValidState() || form.hasErrors() ||
-          !form.hasChanged || !form.allRequiredFieldsSet());
+        var saveDisabled = !(form.isNew && form.allRequiredFieldsSet()) && (form.isSaving || form.readOnly || !view.hasValidState() || form.hasErrors() || !form.hasChanged || !form.allRequiredFieldsSet());
         if (saveDisabled) {
           this.buttonType = 'savecloseX';
           this.prompt = OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON');
@@ -102,11 +98,12 @@
     },
     keyboardShortcutId: 'ToolBar_SaveClose'
   },
+
   NEW_ROW_BUTTON_PROPERTIES: {
-    action: function(){
-      var view = this.view, 
+    action: function () {
+      var view = this.view,
           grid = view.viewGrid;
-      
+
       // In case of no record selected getRecordIndex(undefined) returns -1,
       // which is the top position, other case it adds bellow current selected row.
       if (grid.getSelectedRecord()) {
@@ -118,22 +115,23 @@
     },
     buttonType: 'newRow',
     prompt: OB.I18N.getLabel('OBUIAPP_NewRow'),
-    updateState: function(){
-      var view = this.view, 
+    updateState: function () {
+      var view = this.view,
           selectedRecords = view.viewGrid.getSelectedRecords();
-      this.setDisabled(view.isShowingForm || view.readOnly || view.singleRecord || !view.hasValidState() || 
-                       (selectedRecords && selectedRecords.length > 1));
+      this.setDisabled(view.isShowingForm || view.readOnly || view.singleRecord || !view.hasValidState() || (selectedRecords && selectedRecords.length > 1));
     },
     keyboardShortcutId: 'ToolBar_NewRow'
   },
+
   NEW_DOC_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       this.view.newDocument();
     },
     buttonType: 'newDoc',
     prompt: OB.I18N.getLabel('OBUIAPP_NewDoc'),
-    updateState: function(){
-      var view = this.view, form = view.viewForm;
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm;
       if (view.isShowingForm) {
         this.setDisabled(form.isSaving || view.readOnly || view.singleRecord || !view.hasValidState());
       } else {
@@ -142,19 +140,22 @@
     },
     keyboardShortcutId: 'ToolBar_NewDoc'
   },
+
   DELETE_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       this.view.deleteSelectedRows();
     },
     disabled: true,
     buttonType: 'eliminate',
     prompt: OB.I18N.getLabel('OBUIAPP_DeleteRow'),
-    updateState: function(){
-      var view = this.view, form = view.viewForm, 
-        grid = view.viewGrid, 
-        selectedRecords = grid.getSelectedRecords(),
-        length = selectedRecords.length, i;
-      
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm,
+          grid = view.viewGrid,
+          selectedRecords = grid.getSelectedRecords(),
+          length = selectedRecords.length,
+          i;
+
       for (i = 0; i < length; i++) {
         if (!grid.isWritable(selectedRecords[i])) {
           this.setDisabled(true);
@@ -166,31 +167,29 @@
         }
       }
       if (view.isShowingForm) {
-        this.setDisabled(form.isSaving || form.readOnly || view.singleRecord ||
-        !view.hasValidState() ||
-        form.isNew);
+        this.setDisabled(form.isSaving || form.readOnly || view.singleRecord || !view.hasValidState() || form.isNew);
       } else {
-        this.setDisabled(view.readOnly || view.singleRecord || !view.hasValidState() ||
-        !grid.getSelectedRecords() ||
-        grid.getSelectedRecords().length === 0);
+        this.setDisabled(view.readOnly || view.singleRecord || !view.hasValidState() || !grid.getSelectedRecords() || grid.getSelectedRecords().length === 0);
       }
     },
     keyboardShortcutId: 'ToolBar_Eliminate'
   },
+
   REFRESH_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       this.view.refresh();
     },
     disabled: false,
     buttonType: 'refresh',
     prompt: OB.I18N.getLabel('OBUIAPP_RefreshData'),
-    updateState: function(){
+    updateState: function () {
       this.setDisabled(!this.view.hasNotChanged());
     },
     keyboardShortcutId: 'ToolBar_Refresh'
   },
+
   UNDO_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       this.view.undo();
       if (!this.view.isShowingForm) {
         this.setDisabled(true);
@@ -199,7 +198,7 @@
     disabled: true,
     buttonType: 'undo',
     prompt: OB.I18N.getLabel('OBUIAPP_CancelEdit'),
-    updateState: function() {
+    updateState: function () {
       if (this.view.isShowingForm) {
         this.setDisabled(false);
       } else {
@@ -208,8 +207,9 @@
     },
     keyboardShortcutId: 'ToolBar_Undo'
   },
+
   EXPORT_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       var requestProperties = {
         exportAs: 'csv',
         exportDisplay: 'download',
@@ -224,18 +224,20 @@
     disabled: false,
     buttonType: 'export',
     prompt: OB.I18N.getLabel('OBUIAPP_ExportGrid'),
-    updateState: function(){
+    updateState: function () {
       this.setDisabled(this.view.isShowingForm || this.view.viewGrid.getTotalRows() === 0);
     },
     keyboardShortcutId: 'ToolBar_Export'
   },
+
   ATTACHMENTS_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       var selectedRows = this.view.viewGrid.getSelectedRecords(),
           attachmentExists = this.view.attachmentExists,
           attachmentSection = this.view.viewForm.getItem('_attachments_'),
-          me = this, i;
-      if(this.view.isShowingForm){
+          me = this,
+          i;
+      if (this.view.isShowingForm) {
         if (!attachmentSection.isExpanded()) {
           attachmentSection.expandSection();
         }
@@ -245,12 +247,12 @@
           this.view.viewForm.parentElement.delayCall('scrollTo', [null, attachmentSection.getTop()], 100);
         }
 
-        if(!attachmentExists){
+        if (!attachmentExists) {
           attachmentSection.attachmentCanvasItem.canvas.getMember(0).getMember(0).click();
         }
         return;
       }
-      if(selectedRows.size() === 1){
+      if (selectedRows.size() === 1) {
         this.view.viewForm.setFocusItem(attachmentSection);
         this.view.viewForm.forceFocusedField = '_attachments_';
         this.view.viewForm.expandAttachments = true;
@@ -258,10 +260,11 @@
 
         // Move from grid view to form view could take a while.
         // Section needs to be expanded before the viewport adjustment.
-        var expandedCount = 0, expandedInterval;
-        expandedInterval = setInterval(function() {
+        var expandedCount = 0,
+            expandedInterval;
+        expandedInterval = setInterval(function () {
           expandedCount += 1;
-          if(attachmentSection.isExpanded()){
+          if (attachmentSection.isExpanded()) {
             me.view.viewForm.parentElement.scrollTo(null, attachmentSection.getTop());
             clearInterval(expandedInterval);
           }
@@ -270,16 +273,17 @@
           }
         }, 100);
 
-        if(!attachmentExists){
+        if (!attachmentExists) {
           if (attachmentSection.attachmentCanvasItem.canvas.getMember(0)) {
             attachmentSection.attachmentCanvasItem.canvas.getMember(0).getMember(0).click();
           } else {
             // The first time the form view is loaded, the section is not already built and it could take a while to be.
             // Section needs to be built before the click event.
-            var clickCount = 0, clickInterval;
-            clickInterval = setInterval(function() {
+            var clickCount = 0,
+                clickInterval;
+            clickInterval = setInterval(function () {
               clickCount += 1;
-              if(attachmentSection.attachmentCanvasItem.canvas.getMember(0)){
+              if (attachmentSection.attachmentCanvasItem.canvas.getMember(0)) {
                 attachmentSection.attachmentCanvasItem.canvas.getMember(0).getMember(0).click();
                 clearInterval(clickInterval);
               }
@@ -291,16 +295,16 @@
         }
       } else {
         var recordIds = "";
-        for(i=0; i<selectedRows.size(); i++){
-          if(i>0){
-            recordIds = recordIds + ",";  
+        for (i = 0; i < selectedRows.size(); i++) {
+          if (i > 0) {
+            recordIds = recordIds + ",";
           }
-          recordIds=recordIds + selectedRows[i].id;
+          recordIds = recordIds + selectedRows[i].id;
         }
         var vTabId = this.view.tabId;
         var vbuttonId = this.ID;
-          isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmDownloadMultiple'), function(clickedOK){
-          if(clickedOK){
+        isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmDownloadMultiple'), function (clickedOK) {
+          if (clickedOK) {
             var d = {
               Command: 'GET_MULTIPLE_RECORDS_OB3',
               tabId: vTabId,
@@ -312,8 +316,8 @@
         });
       }
     },
-    callback: function(){
-      if(this.oldForm){
+    callback: function () {
+      if (this.oldForm) {
         this.oldForm.destroy();
       }
       this.view.attachmentExists = true;
@@ -322,36 +326,37 @@
     },
     disabled: false,
     buttonType: 'attach',
-    updateState: function(){
+    updateState: function () {
       var selectedRows = this.view.viewGrid.getSelectedRecords();
       var attachmentExists = this.view.attachmentExists;
-      if(attachmentExists){
-        if(selectedRows.size()===1){
+      if (attachmentExists) {
+        if (selectedRows.size() === 1) {
           this.prompt = OB.I18N.getLabel('OBUIAPP_GoToAttachments');
         } else {
           this.prompt = OB.I18N.getLabel('OBUIAPP_DownloadAttachments');
         }
         this.buttonType = 'attachExists';
-      }else{
-        this.prompt = OB.I18N.getLabel('OBUIAPP_CreateAttachments');  
+      } else {
+        this.prompt = OB.I18N.getLabel('OBUIAPP_CreateAttachments');
         this.buttonType = 'attach';
       }
-      if(!selectedRows || selectedRows.size()===0){
+      if (!selectedRows || selectedRows.size() === 0) {
         // If there are now selected rows then attachments button will be disabled
-        this.setDisabled(true);  
-      }else if(selectedRows.size() > 1 && !this.view.attachmentExists){
+        this.setDisabled(true);
+      } else if (selectedRows.size() > 1 && !this.view.attachmentExists) {
         // If there are more than one rows selected, and no one has attachments,
         // then attachments button will be disabled
         this.setDisabled(true);
-      }else{
-        this.setDisabled(false);  
+      } else {
+        this.setDisabled(false);
       }
       this.resetBaseStyle();
     },
     keyboardShortcutId: 'ToolBar_Attachments'
   },
+
   LINK_BUTTON_PROPERTIES: {
-    action: function(){
+    action: function () {
       var url = this.view.getDirectLinkUrl();
       var form = isc.OBViewForm.create({
         width: 390,
@@ -359,24 +364,33 @@
         numCols: 1,
         overflow: 'visible',
         fields: [{
-          type: 'OBTextAreaItem', selectOnFocus: true, 
-          width: 390, height: 50, canFocus: true,
+          type: 'OBTextAreaItem',
+          selectOnFocus: true,
+          width: 390,
+          height: 50,
+          canFocus: true,
           showTitle: false,
-          name:'url', 
-          title: OB.I18N.getLabel('OBUIAPP_PasteLink'), value: url},
-          {
-            type: 'CanvasItem', showTitle: false, 
-            width: '100%', height: 1, overFlow: 'visible',  
-            cellStyle: 'OBFormField',
-            titleStyle: 'OBFormFieldLabel',
-            textBoxStyle: 'OBFormFieldInput',
-            name:'url', canvas: isc.Label.create({
-              width: 360,
-              contents: OB.I18N.getLabel('OBUIAPP_DeepLinkNote'), height: 1, overflow: 'visible'
-            })
-          }
-        ],        
-        show: function() {
+          name: 'url',
+          title: OB.I18N.getLabel('OBUIAPP_PasteLink'),
+          value: url
+        }, {
+          type: 'CanvasItem',
+          showTitle: false,
+          width: '100%',
+          height: 1,
+          overFlow: 'visible',
+          cellStyle: 'OBFormField',
+          titleStyle: 'OBFormFieldLabel',
+          textBoxStyle: 'OBFormFieldInput',
+          name: 'url',
+          canvas: isc.Label.create({
+            width: 360,
+            contents: OB.I18N.getLabel('OBUIAPP_DeepLinkNote'),
+            height: 1,
+            overflow: 'visible'
+          })
+        }],
+        show: function () {
           var fld = this.getFields()[0];
           this.setFocusItem(fld);
           this.Super('show', arguments);
@@ -391,16 +405,17 @@
     disabled: false,
     buttonType: 'link',
     prompt: OB.I18N.getLabel('OBUIAPP_GetDirectLink'),
-    updateState: function(){
-    },
+    updateState: function () {},
     keyboardShortcutId: 'ToolBar_Link'
   },
   // This offers a mechanism to add properties at runtime to buttons created through
   // templates and java
   BUTTON_PROPERTIES: {
     'audit': {
-      updateState: function(){
-        var view = this.view, form = view.viewForm, grid = view.viewGrid;
+      updateState: function () {
+        var view = this.view,
+            form = view.viewForm,
+            grid = view.viewGrid;
         var selectedRecords = grid.getSelectedRecords();
         var disabled = false;
         if (selectedRecords && selectedRecords.length > 1) {
@@ -409,72 +424,79 @@
           disabled = true;
         } else if (view.isEditingGrid && grid.getEditForm().isNew) {
           disabled = true;
-        } else if ((selectedRecords && selectedRecords.length > 1) || 
-                  (selectedRecords && selectedRecords.length === 1 && selectedRecords[0].updated && selectedRecords[0].creationDate && selectedRecords[0].updated.getTime() === selectedRecords[0].creationDate.getTime())) {
+        } else if ((selectedRecords && selectedRecords.length > 1) || (selectedRecords && selectedRecords.length === 1 && selectedRecords[0].updated && selectedRecords[0].creationDate && selectedRecords[0].updated.getTime() === selectedRecords[0].creationDate.getTime())) {
           disabled = true;
         }
         this.setDisabled(disabled);
       },
       keyboardShortcutId: 'ToolBar_Audit'
     },
-    'print' : {
-      updateState: function() {
-        var view = this.view, form = view.viewForm, grid = view.viewGrid;
+    'print': {
+      updateState: function () {
+        var view = this.view,
+            form = view.viewForm,
+            grid = view.viewGrid;
         var selectedRecords = grid.getSelectedRecords();
         var disabled = false;
-        if(selectedRecords.length===0) {
-          disabled=true;
+        if (selectedRecords.length === 0) {
+          disabled = true;
         }
-        if(this.view.viewGrid.getTotalRows()===0) {
-          disabled=true;
+        if (this.view.viewGrid.getTotalRows() === 0) {
+          disabled = true;
         }
-        if(view.isShowingForm && form.isNew){
-          disabled=true;
+        if (view.isShowingForm && form.isNew) {
+          disabled = true;
         }
         this.setDisabled(disabled);
-      }, 
-    keyboardShortcutId: 'ToolBar_Print'
+      },
+      keyboardShortcutId: 'ToolBar_Print'
     },
-    'email' : {
-      updateState: function() {
-        var view = this.view, form = view.viewForm, grid = view.viewGrid;
+    'email': {
+      updateState: function () {
+        var view = this.view,
+            form = view.viewForm,
+            grid = view.viewGrid;
         var selectedRecords = grid.getSelectedRecords();
         var disabled = false;
-        if(selectedRecords.length===0) {
-          disabled=true;
+        if (selectedRecords.length === 0) {
+          disabled = true;
         }
-        if(this.view.viewGrid.getTotalRows()===0) {
-          disabled=true;
+        if (this.view.viewGrid.getTotalRows() === 0) {
+          disabled = true;
         }
-        if(view.isShowingForm && form.isNew){
-          disabled=true;
+        if (view.isShowingForm && form.isNew) {
+          disabled = true;
         }
         this.setDisabled(disabled);
-      }, 
+      },
       keyboardShortcutId: 'ToolBar_Email'
     }
   },
+
   CLONE_BUTTON_PROPERTIES: {
-	    action: function(){
-	      alert('this method must be overridden when registering the button');
-	    },
-	    disabled: false,
-	    buttonType: 'clone',
-	    prompt: OB.I18N.getLabel('OBUIAPP_CloneData'),
-	    updateState: function(){
-	        var view = this.view, form = view.viewForm, grid = view.viewGrid, selectedRecords = grid.getSelectedRecords();
-	        if (selectedRecords && selectedRecords.length > 1) {
-	          this.setDisabled(true);
-	        } else if (view.isShowingForm && form.isNew) {
-	          this.setDisabled(true);
-	        } else if (view.isEditingGrid && grid.getEditForm().isNew) {
-		        this.setDisabled(true);
-		      } else {
-		        this.setDisabled(selectedRecords.length === 0);
-		      }
-	    },
-	    keyboardShortcutId: 'ToolBar_Clone'
-	  }
+    action: function () {
+      alert('this method must be overridden when registering the button');
+    },
+    disabled: false,
+    buttonType: 'clone',
+    prompt: OB.I18N.getLabel('OBUIAPP_CloneData'),
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm,
+          grid = view.viewGrid,
+          selectedRecords = grid.getSelectedRecords();
+      if (selectedRecords && selectedRecords.length > 1) {
+        this.setDisabled(true);
+      } else if (view.isShowingForm && form.isNew) {
+        this.setDisabled(true);
+      } else if (view.isEditingGrid && grid.getEditForm().isNew) {
+        this.setDisabled(true);
+      } else {
+        this.setDisabled(selectedRecords.length === 0);
+      }
+    },
+    keyboardShortcutId: 'ToolBar_Clone'
+  }
 });
 
 // = OBToolbar =
@@ -483,50 +505,56 @@
 //
 isc.OBToolbar.addProperties({
   randomId: null,
-  initWidget: function(){
-    var newMembers = [], i = 0, j = 0, length;
-    
+  initWidget: function () {
+    var newMembers = [],
+        i = 0,
+        j = 0,
+        length;
+
     this.Super('initWidget', arguments);
 
-    function getRandomId(){
-      var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz', stringLength = 8, randomString = '', i, rnum;
+    function getRandomId() {
+      var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz',
+          stringLength = 8,
+          randomString = '',
+          i, rnum;
       for (i = 0; i < stringLength; i++) {
         rnum = Math.floor(Math.random() * chars.length);
         randomString += chars.substring(rnum, rnum + 1);
       }
       return randomString;
     }
-    
+
     this.randomId = getRandomId();
-    
+
     this.members = null;
-    
-    if(!this.leftMembers || this.leftMembers.length===0){
+
+    if (!this.leftMembers || this.leftMembers.length === 0) {
       this.leftMembers = OB.ToolbarRegistry.getButtons(this.view.tabId);
     }
-    
+
     newMembers[j] = isc.HLayout.create({
       width: this.leftMargin,
       height: 1
     });
     j++;
-    
+
     if (this.leftMembers) {
-      
+
       length = this.leftMembers.length;
-      
+
       for (i = 0; i < length; i++) {
-       
+
         newMembers[j] = this.leftMembers[i];
-        
+
         if (newMembers[j].buttonType && isc.OBToolbar.BUTTON_PROPERTIES[newMembers[j].buttonType]) {
-       
+
           isc.addProperties(newMembers[j], isc.OBToolbar.BUTTON_PROPERTIES[newMembers[j].buttonType]);
-         
+
         }
-        
+
         OB.TestRegistry.register('org.openbravo.client.application.toolbar.button.' + this.leftMembers[i].buttonType + '.' + this.view.tabId, this.leftMembers[i]);
-        
+
         newMembers[j].toolBar = this;
         newMembers[j].view = this.view;
         j++;
@@ -537,7 +565,7 @@
         j++;
       }
     }
-    
+
     newMembers[j] = isc.HLayout.create({
       width: '100%',
       height: 1
@@ -548,11 +576,11 @@
       height: 1
     });
     j++;
-    
+
     if (this.rightMembers) {
-      
+
       length = this.rightMembers.length;
-      
+
       for (i = 0; i < length; i++) {
         newMembers[j] = this.rightMembers[i];
         OB.TestRegistry.register('org.openbravo.client.application.toolbar.button.' + this.rightMembers[i].property + '.' + this.view.tabId, this.rightMembers[i]);
@@ -566,20 +594,20 @@
         j++;
       }
     }
-    
+
     newMembers[j] = isc.HLayout.create({
       width: this.rightMargin,
       height: 1
     });
     j++;
-    
+
     this.Super('addMembers', [newMembers]);
   },
 
-  addMems: function(m) {
-      this.Super('addMembers', m );
-   },
-  
+  addMems: function (m) {
+    this.Super('addMembers', m);
+  },
+
   // ** {{{ updateButtonState }}} **
   //
   // Updates the visible and disabled state of buttons using the view's form and
@@ -587,29 +615,29 @@
   // 
   // NOTE: new buttons should implement the updateState method.
   //
-  updateButtonState: function(noSetSession, changeEvent){
+  updateButtonState: function (noSetSession, changeEvent) {
     var me = this;
-    this.fireOnPause('updateButtonState', function() {
+    this.fireOnPause('updateButtonState', function () {
       me.pausedUpdateButtonState(noSetSession, changeEvent);
     });
   },
-   
-  pausedUpdateButtonState: function(noSetSession, changeEvent) { 
-    var length = this.leftMembers.length, i, 
-      form = this.view.isEditingGrid ? this.view.viewGrid.getEditForm() : this.view.viewForm;
-    
+
+  pausedUpdateButtonState: function (noSetSession, changeEvent) {
+    var length = this.leftMembers.length,
+        i, form = this.view.isEditingGrid ? this.view.viewGrid.getEditForm() : this.view.viewForm;
+
     for (i = 0; i < length; i++) {
       if (this.leftMembers[i].updateState) {
         this.leftMembers[i].updateState();
       }
     }
-    
+
     // and refresh the process toolbar buttons
     if (!changeEvent) {
       this.refreshCustomButtons(noSetSession);
-    } else if (this.rightMembers){
+    } else if (this.rightMembers) {
       // determine if the buttons should be hidden or not      
-      if (this.view.isEditingGrid || this.view.isShowingForm) {        
+      if (this.view.isEditingGrid || this.view.isShowingForm) {
         if (form.hasErrors() || !form.allRequiredFieldsSet()) {
           this.hideShowRightMembers(false, noSetSession);
         } else {
@@ -620,7 +648,7 @@
       }
     }
   },
-  
+
   // ** {{{ getLeftMember(member) }}} **
   //
   // It works just for left side members.
@@ -632,8 +660,9 @@
   // * {{{member}}} type: String | Number | Canvas - identifier for the required left member.
   //
   // Returns:  type: Canvas - left member widget.
-  getLeftMember: function(member){
-    var i = 0, length = this.leftMembers.length;
+  getLeftMember: function (member) {
+    var i = 0,
+        length = this.leftMembers.length;
     if (typeof member === 'number') {
       if (member >= 0 && member < this.leftMembers.length) {
         return this.leftMembers[member];
@@ -653,7 +682,7 @@
     }
     return;
   },
-  
+
   // ** {{{ getLeftMembers() }}} **
   //
   // It works just for left side members.
@@ -661,10 +690,10 @@
   // NOTE: the returned array should not be modified.
   //
   // Returns: type: Array - the Array of left members.
-  getLeftMembers: function(){
+  getLeftMembers: function () {
     return this.leftMembers;
   },
-  
+
   // ** {{{ getLeftMember(attribute, value) }}} **
   //
   // It works just for left side members.
@@ -676,8 +705,10 @@
   // * {{{value}}} type: String | Number | Canvas - desired value of the attribute.
   //
   // Returns: type: Array - the Array of matching left members.
-  getLeftMembersByAttribute: function(attribute, value){
-    var members = [], i = 0, length = this.leftMembers.length;
+  getLeftMembersByAttribute: function (attribute, value) {
+    var members = [],
+        i = 0,
+        length = this.leftMembers.length;
     for (i = 0; i < length; i++) {
       if (this.leftMembers[i][attribute] === value) {
         members.push(this.leftMembers[i]);
@@ -685,7 +716,7 @@
     }
     return members;
   },
-  
+
   // ** {{{ getLeftMemberNumber(member) }}} **
   //
   // It works just for left side members.
@@ -696,8 +727,9 @@
   // * {{{member}}} type: Canvas - left member Canvas to obtain its position.
   //
   // Returns: type: Number - the left member Canvas position (starting from 0).
-  getLeftMemberNumber: function(member){
-    var i = 0, length = this.leftMembers.length;
+  getLeftMemberNumber: function (member) {
+    var i = 0,
+        length = this.leftMembers.length;
     for (i = 0; i < length; i++) {
       if (this.leftMembers[i] === member) {
         return i;
@@ -705,7 +737,7 @@
     }
     return -1;
   },
-  
+
   // ** {{{ removeLeftMembers(members) }}} **
   //
   // It works just for left side members.
@@ -713,11 +745,17 @@
   //
   // Parameters:
   // * {{{members}}} type: Array | Canvas - array of left members to be removed, or reference to single left member.
-  removeLeftMembers: function(members){
-    var oldMembersSorted = [], oldArray = [], position = 0, 
-      length, i = 0, sortFunc = function(a, b){
-        return (a - b);
-      };
+  removeLeftMembers: function (members) {
+    var oldMembersSorted = [],
+        oldArray = [],
+        position = 0,
+        length, i = 0,
+        sortFunc;
+
+    sortFunc = function (a, b) {
+      return (a - b);
+    };
+
     if (!(typeof members.length === 'number' && !(members.propertyIsEnumerable('length')) && typeof members.splice === 'function')) {
       members = [members];
     }
@@ -739,28 +777,29 @@
       oldArray.push(position, position + 1);
     }
     oldMembersSorted = oldMembersSorted.reverse();
-    
+
     length = oldMembersSorted.length;
     for (i = 0; i < length; i++) { /* Update the 'leftMembers' array */
       this.leftMembers.splice(oldMembersSorted[i], 1);
     }
     this.destroyAndRemoveMembers(oldArray); /* Remove visually the desired elements */
   },
-  
+
   // ** {{{ removeAllLeftMembers() }}} **
   //
   // It works just for left side members.
   // Removes all left members from the layout.
   //
-  removeAllLeftMembers: function(){
-    var membersNumArray = [], i = 0, 
-      length = this.leftMembers.length;
+  removeAllLeftMembers: function () {
+    var membersNumArray = [],
+        i = 0,
+        length = this.leftMembers.length;
     for (i = 0; i < length; i++) {
       membersNumArray.push(i);
     }
     this.removeLeftMembers(membersNumArray);
   },
-  
+
   // ** {{{ addLeftMembers(newMembers, position) }}} **
   //
   // It works just for left side members.
@@ -769,8 +808,9 @@
   // Parameters:
   // * {{{newMembers}}} type: Array || Object - array of canvases to be added, or reference to single canvas.
   // * {{{position (optional)}}} type: Number - position to add newMembers; if omitted newMembers will be added at the last position.
-  addLeftMembers: function(newMembers, position){
-    var i = 0, length;
+  addLeftMembers: function (newMembers, position) {
+    var i = 0,
+        length;
     if (!(typeof newMembers.length === 'number' && !(newMembers.propertyIsEnumerable('length')) && typeof newMembers.splice === 'function')) {
       newMembers = [newMembers];
     }
@@ -794,7 +834,7 @@
       position = position + 1;
     }
   },
-  
+
   // ** {{{ setLeftMembers(newMembers, position) }}} **
   //
   // It works just for left side members.
@@ -802,11 +842,11 @@
   //
   // Parameters:
   // * {{{newMembers}}} type: Array || Object - array of canvases to be displayed, or reference to single canvas.
-  setLeftMembers: function(newMembers){
+  setLeftMembers: function (newMembers) {
     this.removeAllLeftMembers();
     this.addLeftMembers(newMembers);
   },
-  
+
   // ** {{{ setLeftMemberDisabled(member, state) }}} **
   //
   // It works just for left side members.
@@ -815,14 +855,14 @@
   // Parameters:
   // * {{{member}}} type: String | Number | Canvas - identifier for the left member to perform the action.
   // * {{{state}}} type: Boolean - new disabled state of this object; pass true to disable the left member.
-  setLeftMemberDisabled: function(member, state){
+  setLeftMemberDisabled: function (member, state) {
     member = this.getLeftMember(member);
     if (member) {
       member.setDisabled(state);
     }
     return;
   },
-  
+
   // ** {{{ setLeftMemberSelected(member, state) }}} **
   //
   // It works just for left side members.
@@ -831,15 +871,15 @@
   // Parameters:
   // * {{{member}}} type: String | Number | Canvas - identifier for the left member to perform the action.
   // * {{{state}}} type: Boolean - new disabled state of this object; pass true to select the left member.
-  setLeftMemberSelected: function(member, state){
+  setLeftMemberSelected: function (member, state) {
     member = this.getLeftMember(member);
     if (member) {
       member.setSelected(state);
     }
     return;
   },
-  
-  
+
+
   // ** {{{ getRightMember(member) }}} **
   //
   // It works just for right side members.
@@ -851,14 +891,15 @@
   // * {{{member}}} type: String | Number | Canvas - identifier for the required right member.
   //
   // Returns: type: Canvas - right member widget.
-  getRightMember: function(member){
-    var i = 0, length = this.rightMembers.length;
+  getRightMember: function (member) {
+    var i = 0,
+        length = this.rightMembers.length;
     if (typeof member === 'number') {
       if (member >= 0 && member < this.rightMembers.length) {
         return this.rightMembers[member];
       }
     } else if (typeof member === 'string') {
-      
+
       for (i = 0; i < length; i++) {
         if (this.rightMembers[i].ID === member) {
           return this.rightMembers[i];
@@ -873,7 +914,7 @@
     }
     return;
   },
-  
+
   // ** {{{ getRightMembers() }}} **
   //
   // It works just for right side members.
@@ -881,10 +922,10 @@
   // NOTE: the returned array should not be modified.
   //
   // Returns: type: Array - the Array of right members.
-  getRightMembers: function(){
+  getRightMembers: function () {
     return this.rightMembers;
   },
-  
+
   // ** {{{ getRightMembersByAttribute(attribute, value) }}} **
   //
   // It works just for right side members.
@@ -896,8 +937,10 @@
   // * {{{value}}} type: String | Number | Canvas - desired value of the attribute.
   //
   // Returns: type: Array - the Array of matching right members.
-  getRightMembersByAttribute: function(attribute, value){
-    var members = [], i = 0, length = this.rightMembers.length;
+  getRightMembersByAttribute: function (attribute, value) {
+    var members = [],
+        i = 0,
+        length = this.rightMembers.length;
     for (i = 0; i < length; i++) {
       if (this.rightMembers[i][attribute] === value) {
         members.push(this.rightMembers[i]);
@@ -905,7 +948,7 @@
     }
     return members;
   },
-  
+
   // ** {{{ getRightMemberNumber(member) }}} **
   //
   // It works just for right side members.
@@ -916,8 +959,9 @@
   // * {{{member}}} type: Canvas - right member Canvas to obtain its position.
   //
   // Returns: type: Number - the right member Canvas position (starting from 0).
-  getRightMemberNumber: function(member){
-    var i = 0, length = this.rightMembers.length;
+  getRightMemberNumber: function (member) {
+    var i = 0,
+        length = this.rightMembers.length;
     for (i = 0; i < length; i++) {
       if (this.rightMembers[i] === member) {
         return i;
@@ -925,7 +969,7 @@
     }
     return -1;
   },
-  
+
   // ** {{{ removeRightMembers(members) }}} **
   //
   // It works just for right side members.
@@ -933,9 +977,14 @@
   //
   // Parameters:
   // * {{{members}}} type: Array | Canvas - array of right members to be removed, or reference to single right member.
-  removeRightMembers: function(members){
-    var oldMembersSorted = [], length, oldArray = [], 
-      position = 0, i = 0, sortFunc = function(a, b){
+  removeRightMembers: function (members) {
+    var oldMembersSorted = [],
+        length, oldArray = [],
+        position = 0,
+        i = 0,
+        sortFunc;
+
+    sortFunc = function (a, b) {
       return (a - b);
     };
     if (!(typeof members.length === 'number' && !(members.propertyIsEnumerable('length')) && typeof members.splice === 'function')) {
@@ -951,7 +1000,7 @@
       }
       oldMembersSorted = oldMembersSorted.sort(sortFunc);
     }
-    
+
     length = oldMembersSorted.length;
     for (i = 0; i < length; i++) { /* Generate an array to determine which elements visually will be removed */
       position = oldMembersSorted[i];
@@ -967,20 +1016,22 @@
     }
     this.destroyAndRemoveMembers(oldArray); /* Remove visually the desired elements */
   },
-  
+
   // ** {{{ removeAllRightMembers() }}} **
   //
   // It works just for right side members.
   // Removes all right members from the layout.
   //
-  removeAllRightMembers: function(){
-    var membersNumArray = [], i = 0, length = this.rightMembers.length;
+  removeAllRightMembers: function () {
+    var membersNumArray = [],
+        i = 0,
+        length = this.rightMembers.length;
     for (i = 0; i < length; i++) {
       membersNumArray.push(i);
     }
     this.removeRightMembers(membersNumArray);
   },
-  
+
   // ** {{{ addRightMembers(newMembers, position) }}} **
   //
   // It works just for right side members.
@@ -989,15 +1040,16 @@
   // Parameters:
   // * {{{newMembers}}} type: Array || Object - array of canvases to be added, or reference to single canvas.
   // * {{{position (optional)}}} type: Number - position to add newMembers; if omitted newMembers will be added at the last position.
-  addRightMembers: function(newMembers, position){
-    var i = 0, length;
+  addRightMembers: function (newMembers, position) {
+    var i = 0,
+        length;
     if (!(typeof newMembers.length === 'number' && !(newMembers.propertyIsEnumerable('length')) && typeof newMembers.splice === 'function')) {
       newMembers = [newMembers];
     }
     if (position > this.rightMembers.length || typeof position === 'undefined') {
       position = this.rightMembers.length;
     }
-    
+
     length = newMembers.length;
     for (i = 0; i < length; i++) {
       this.rightMembers.splice(position + i, 0, newMembers[i]);
@@ -1017,7 +1069,7 @@
       position = position + 1;
     }
   },
-  
+
   // ** {{{ setRightMembers(newMembers, position) }}} **
   //
   // It works just for right side members.
@@ -1025,11 +1077,11 @@
   //
   // Parameters:
   // * {{{newMembers}}} type: Array || Object - array of canvases to be displayed, or reference to single canvas.
-  setRightMembers: function(newMembers){
+  setRightMembers: function (newMembers) {
     this.removeAllRightMembers();
     this.addRightMembers(newMembers);
   },
-  
+
   // ** {{{ setRightMemberDisabled(member, state) }}} **
   //
   // It works just for right side members.
@@ -1038,14 +1090,14 @@
   // Parameters:
   // * {{{member}}} type: String | Number | Canvas - identifier for the right member to perform the action.
   // * {{{state}}} type: Boolean - new disabled state of this object; pass true to disable the right member.
-  setRightMemberDisabled: function(member, state){
+  setRightMemberDisabled: function (member, state) {
     member = this.getRightMember(member);
     if (member) {
       member.setDisabled(state);
     }
     return;
   },
-  
+
   // ** {{{ setRightMemberSelected(member, state) }}} **
   //
   // It works just for right side members.
@@ -1054,7 +1106,7 @@
   // Parameters:
   // * {{{member}}} type: String | Number | Canvas - identifier for the right member to perform the action.
   // * {{{state}}} type: Boolean - new disabled state of this object; pass true to select the right member.
-  setRightMemberSelected: function(member, state){
+  setRightMemberSelected: function (member, state) {
     member = this.getRightMember(member);
     if (member) {
       member.setSelected(state);
@@ -1066,8 +1118,9 @@
   //
   // Refreshes all the custom buttons in the toolbar based on current record selection
   //
-  refreshCustomButtons: function(noSetSession){
+  refreshCustomButtons: function (noSetSession) {
     var selectedRecords, multipleSelectedRowIds, allProperties, i;
+
     function doRefresh(buttons, currentValues, hideAllButtons, noneOrMultipleRecordsSelected, me) {
       var i, length = me.rightMembers.length;
       for (i = 0; i < length; i++) { // To disable any button previous defined keyboard shortcut
@@ -1082,7 +1135,7 @@
       length = me.leftMembers.length;
       for (i = 0; i < length; i++) {
         if (me.leftMembers[i].updateState) {
-            me.leftMembers[i].updateState();
+          me.leftMembers[i].updateState();
         }
       }
       if (me.view.isActiveView()) {
@@ -1094,8 +1147,10 @@
       }
     }
 
-    var buttons = this.getRightMembers(), buttonContexts = [], 
-      currentContext, buttonsByContext = [], length;
+    var buttons = this.getRightMembers(),
+        buttonContexts = [],
+        currentContext, buttonsByContext = [],
+        length, iButtonContext, callbackHandler;
 
     if (buttons.length === 0) {
       if (!noSetSession && this.view.viewGrid && this.view.viewGrid.getSelectedRecord()) {
@@ -1114,13 +1169,14 @@
       buttonsByContext[currentContext].push(buttons[i]);
     }
 
-    var iButtonContext;
-
     // This is needed to prevent JSLint complaining about "Don't make functions within a loop.
-    var callbackHandler = function (currentContext, me) {
-      return function(response, data, request) {
+    callbackHandler = function (currentContext, me) {
+      return function (response, data, request) {
         var noneOrMultipleRecordsSelected = currentContext.viewGrid.getSelectedRecords().length !== 1;
-        var sessionAttributes = data.sessionAttributes, auxInputs = data.auxiliaryInputValues, attachmentExists = data.attachmentExists, prop;
+        var sessionAttributes = data.sessionAttributes,
+            auxInputs = data.auxiliaryInputValues,
+            attachmentExists = data.attachmentExists,
+            prop;
         if (sessionAttributes) {
           currentContext.viewForm.sessionAttributes = sessionAttributes;
         }
@@ -1139,7 +1195,9 @@
       };
     };
 
-    var currentTabCalled = false, me = this, requestParams;
+    var currentTabCalled = false,
+        me = this,
+        requestParams;
     length = buttonContexts.length;
     for (iButtonContext = 0; iButtonContext < length; iButtonContext++) {
       currentContext = buttonContexts[iButtonContext];
@@ -1147,18 +1205,17 @@
       selectedRecords = currentContext.viewGrid.getSelectedRecords() || [];
       var numOfSelRecords = 0,
           theForm = this.view.isEditingGrid ? this.view.viewGrid.getEditForm() : this.view.viewForm,
-          isNew = currentContext.viewForm.isNew, 
+          isNew = currentContext.viewForm.isNew,
           hideAllButtons = selectedRecords.size() === 0 && !currentContext.isShowingForm,
           currentValues = currentContext.getCurrentValues();
-     
-      if (!hideAllButtons && 
-          (this.view.isEditingGrid || this.view.isShowingForm)) {        
+
+      if (!hideAllButtons && (this.view.isEditingGrid || this.view.isShowingForm)) {
         hideAllButtons = theForm.hasErrors() || !theForm.allRequiredFieldsSet();
       }
       if (hideAllButtons) {
         this.hideShowRightMembers(false, noSetSession);
       }
-      
+
       if (currentContext.viewGrid.getSelectedRecords()) {
         numOfSelRecords = currentContext.viewGrid.getSelectedRecords().length;
       }
@@ -1166,8 +1223,8 @@
       var noneOrMultipleRecordsSelected = numOfSelRecords !== 1 && !isNew;
 
       if (currentValues && !noSetSession && !currentContext.isShowingForm && !isNew && !hideAllButtons) {
-        if(this.view.tabId===currentContext.tabId){
-          currentTabCalled = true;	
+        if (this.view.tabId === currentContext.tabId) {
+          currentTabCalled = true;
         }
         // Call FIC to obtain possible session attributes and set them in form
         requestParams = {
@@ -1177,7 +1234,7 @@
           ROW_ID: currentValues.id
         };
         multipleSelectedRowIds = [];
-        if(selectedRecords.size() > 1){
+        if (selectedRecords.size() > 1) {
           for (i = 0; i < selectedRecords.size(); i++) {
             multipleSelectedRowIds[i] = selectedRecords[i].id;
           }
@@ -1186,11 +1243,11 @@
         allProperties = currentContext.getContextInfo(false, true, false, true);
         OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', allProperties, requestParams, callbackHandler(currentContext, me));
       } else {
-        doRefresh(buttonsByContext[currentContext], currentValues || {}, hideAllButtons || noneOrMultipleRecordsSelected, numOfSelRecords !== 1,this);
+        doRefresh(buttonsByContext[currentContext], currentValues || {}, hideAllButtons || noneOrMultipleRecordsSelected, numOfSelRecords !== 1, this);
       }
     }
 
-    if(!currentTabCalled && !noSetSession && !this.view.isShowingForm && !this.view.viewForm.isNew && this.view.viewGrid.getSelectedRecords().size() !== 0){
+    if (!currentTabCalled && !noSetSession && !this.view.isShowingForm && !this.view.viewForm.isNew && this.view.viewGrid.getSelectedRecords().size() !== 0) {
       selectedRecords = this.view.viewGrid.getSelectedRecords();
       //The call to the FIC for the current tab was not done (probably because it doesn't have buttons, or the buttons do not depend on session vars/aux ins.
       //However, a call still needs to be done, to set the attachments information
@@ -1200,29 +1257,28 @@
         TAB_ID: this.view.tabId
       };
       multipleSelectedRowIds = [];
-      if(selectedRecords.size() >= 1){
+      if (selectedRecords.size() >= 1) {
         for (i = 0; i < selectedRecords.size(); i++) {
-          if(i === 0){
-            requestParams.ROW_ID = selectedRecords[i].id;  
+          if (i === 0) {
+            requestParams.ROW_ID = selectedRecords[i].id;
           }
           multipleSelectedRowIds[i] = selectedRecords[i].id;
         }
-        if(selectedRecords.size() > 1){
+        if (selectedRecords.size() > 1) {
           requestParams.MULTIPLE_ROW_IDS = multipleSelectedRowIds;
         }
       }
       allProperties = this.view.getContextInfo(false, true, false, true);
-      OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', allProperties, requestParams, function(response, data, request){
+      OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', allProperties, requestParams, function (response, data, request) {
         var attachmentExists = data.attachmentExists;
         me.view.attachmentExists = attachmentExists;
         //Call to refresh the buttons. As its called with noSetSession=true, it will not cause an infinite recursive loop
         me.updateButtonState(true);
-      }  
-      );
+      });
     }
   },
-  
-  hideShowRightMembers: function(show, noSetSession) {
+
+  hideShowRightMembers: function (show, noSetSession) {
     var i, button, context;
     // if showing make sure that they are not always shown
     if (show) {
@@ -1232,7 +1288,7 @@
         button = this.rightMembers[i];
         if (button.autosave) {
           button.hide();
-        } else{
+        } else {
           // do not hide non autosave buttons, keep them in case display logic allows it
           context = button.contextView;
           button.updateState(context.getCurrentValues(), false, context.getContextInfo(false, true, true));
@@ -1248,17 +1304,17 @@
   //
   refreshCustomButtonsView: function (view) {
     var i, context = view.getContextInfo(false, true, true),
-      length;
+        length;
 
     length = this.rightMembers.length;
-    for (i=0; i < length; i++) {
+    for (i = 0; i < length; i++) {
       if (this.rightMembers[i].contextView === view) {
         this.rightMembers[i].updateState(view.getCurrentValues(), false, context);
       }
     }
   },
 
-  visibilityChanged: function(state){
+  visibilityChanged: function (state) {
     if (state) {
       this.enableShortcuts();
     } else {
@@ -1266,7 +1322,7 @@
     }
   },
 
-  draw: function(){
+  draw: function () {
     this.Super('draw', arguments);
     this.defineRightMembersShortcuts();
     this.enableShortcuts();
@@ -1274,9 +1330,10 @@
 
   rightMembersShortcuts: [],
 
-  defineRightMembersShortcuts: function(){
+  defineRightMembersShortcuts: function () {
     var i, j, k, id, character, position, length, titleLength;
-    function isAssignedCharacter(character, me){
+
+    function isAssignedCharacter(character, me) {
       var n, length;
       if (character === ' ') {
         return true;
@@ -1295,7 +1352,8 @@
     this.rightMembersShortcuts = [];
     length = this.rightMembers.length;
     for (i = 0; i < length; i++) {
-      var title = this.rightMembers[i].realTitle, haveToContinue = true;
+      var title = this.rightMembers[i].realTitle,
+          haveToContinue = true;
       this.rightMembersShortcuts[i] = [];
       if (haveToContinue) { // Check if free character and assign
         haveToContinue = true;
@@ -1329,8 +1387,8 @@
       this.rightMembers[i].keyboardShortcutPosition = this.rightMembersShortcuts[i][1];
     }
   },
-  
-  enableShortcuts: function(){
+
+  enableShortcuts: function () {
     var length, i;
     if (this.leftMembers) {
       length = this.leftMembers.length;
@@ -1350,8 +1408,8 @@
       }
     }
   },
-  
-  disableShortcuts: function(){
+
+  disableShortcuts: function () {
     var length, i;
     if (this.leftMembers) {
       length = this.leftMembers.length;
@@ -1370,12 +1428,12 @@
       }
     }
   },
-  
+
   addMembers: 'null',
-  
+
   leftMembers: [],
   rightMembers: [],
-  
+
   styleName: 'OBToolbar',
   overflow: 'auto',
   membersMargin: 0
@@ -1397,14 +1455,15 @@
   showHover: true,
   customState: '',
   showMenuButtonImage: false,
-  
-  initWidget: function(){
+
+  initWidget: function () {
     this.Super('initWidget', arguments);
     this.resetBaseStyle();
   },
-  
-  resetBaseStyle: function(){
-    var isMenu = false, extraClass;
+
+  resetBaseStyle: function () {
+    var isMenu = false,
+        extraClass;
     if (this.menu !== null) {
       isMenu = true;
     }
@@ -1417,26 +1476,26 @@
       this.iconWidth = 1;
       this.iconHeight = 1;
     }
-    
+
     this.setBaseStyle('OBToolbarIconButton_icon_' + this.buttonType + this.customState + extraClass + 'OBToolbarIconButton');
   },
-  
+
   keyboardShortcutId: null,
-  enableShortcut: function(){
+  enableShortcut: function () {
     if (this.keyboardShortcutId) {
       var me = this;
-      var ksAction = function(){
-        if (!me.disabled) {
-          me.action();
-        }
-        return false; //To avoid keyboard shortcut propagation
-      };
+      var ksAction = function () {
+          if (!me.disabled) {
+            me.action();
+          }
+          return false; //To avoid keyboard shortcut propagation
+          };
       OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, 'Canvas', ksAction);
     }
   },
-  disableShortcut: function(){
+  disableShortcut: function () {
     if (this.keyboardShortcutId) {
-      OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, null, function(){
+      OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, null, function () {
         return true;
       });
     }
@@ -1453,28 +1512,32 @@
   showDown: true,
   showFocusedAsOver: false,
   title: '',
-  realTitle: '', // difference between title and realTitle is just the <u>xx</u> for keyboard shortcut notation.
-  action: function(){
+  realTitle: '',
+  // difference between title and realTitle is just the <u>xx</u> for keyboard shortcut notation.
+  action: function () {
     alert(this.title);
   },
-  initWidget: function(){
+  initWidget: function () {
     this.Super('initWidget', arguments);
     this.realTitle = this.title;
   },
-  
+
   keyboardShortcutId: null,
   keyboardShortcutCharacter: null,
   keyboardShortcutPosition: null,
-  enableShortcut: function(){
+  enableShortcut: function () {
     if (this.keyboardShortcutId) {
-      var me = this;
-      var newTitle = this.realTitle;
-      var ksAction = function(){
+      var me = this,
+          newTitle = this.realTitle,
+          ksAction;
+
+      ksAction = function () {
         if (!me.disabled && me.visible) {
           me.action();
         }
         return false; //To avoid keyboard shortcut propagation
       };
+
       if (this.keyboardShortcutPosition === 'end') {
         newTitle = newTitle + ' (<u>' + this.keyboardShortcutCharacter + '</u>)';
       } else {
@@ -1491,11 +1554,11 @@
       }
     }
   },
-  disableShortcut: function(){
+  disableShortcut: function () {
     if (this.keyboardShortcutId) {
       var newTitle = this.realTitle;
       this.setTitle(newTitle);
-      OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, null, function(){
+      OB.KeyboardManager.Shortcuts.set(this.keyboardShortcutId, null, function () {
         return true;
       }, '', {
         'ctrl': true,
@@ -1509,17 +1572,19 @@
 
 OB.ToolbarUtils = {};
 
-OB.ToolbarUtils.print = function(view, url, directPrint){
+OB.ToolbarUtils.print = function (view, url, directPrint) {
   var selectedRecords = view.viewGrid.getSelectedRecords(),
-    length = selectedRecords.length;
+      length = selectedRecords.length;
 
   if (length === 0) {
     view.messageBar.setMessage(isc.OBMessageBar.TYPE_WARNING, '', OB.I18N.getLabel('OBUIAPP_PrintNoRecordSelected'));
     return;
   }
 
-  var popupParams = {}, allProperties = view.getContextInfo(false, true, false, true),
-      sessionProperties = view.getContextInfo(true, true, false, true), param, i, value, selectedIds = '';
+  var popupParams = {},
+      allProperties = view.getContextInfo(false, true, false, true),
+      sessionProperties = view.getContextInfo(true, true, false, true),
+      param, i, value, selectedIds = '';
 
   popupParams = {
     Command: 'DEFAULT',
@@ -1547,17 +1612,17 @@
 
   popupParams.inphiddenvalue = selectedIds;
 
-  view.setContextInfo(sessionProperties, function(){
+  view.setContextInfo(sessionProperties, function () {
     OB.Layout.ClassicOBCompatibility.Popup.open('print', 0, 0, OB.Application.contextUrl + 'businessUtility/PrinterReports.html', '', window, false, false, true, popupParams);
   });
 };
 
-OB.ToolbarUtils.showAuditTrail = function(view){
+OB.ToolbarUtils.showAuditTrail = function (view) {
   var selectedRecords = view.viewGrid.getSelectedRecords();
 
   if (selectedRecords.length > 1) {
     var setWarning = {
-      set: function(label){
+      set: function (label) {
         view.messageBar.setMessage(isc.OBMessageBar.TYPE_WARNING, '', label);
       }
     };
@@ -1576,7 +1641,7 @@
   OB.Layout.ClassicOBCompatibility.Popup.open('audit', 900, 600, OB.Application.contextUrl + 'businessUtility/AuditTrail.html?' + popupParams, '', window, false, false, true);
 };
 
-OB.ToolbarUtils.showTree = function(view){
+OB.ToolbarUtils.showTree = function (view) {
   var tabId = view.tabId;
 
   function openPopupTree() {
@@ -1585,80 +1650,84 @@
     popupParams += '&hideMenu=true&noprefs=true';
     OB.Layout.ClassicOBCompatibility.Popup.open('tree', 750, 625, OB.Application.contextUrl + 'utility/WindowTree.html?' + popupParams, '', window, true, true, true, null, false);
   }
-  
+
   view.setContextInfo(view.getContextInfo(true, true, true, true), openPopupTree, true);
 };
 
 OB.ToolbarRegistry = {
-    buttonDefinitions: [],
-    
-    // note tabIds is an array of strings, but maybe null/undefined
-    registerButton: function(buttonId, clazz, properties, sortOrder, tabIds) {
-      var length;
-      
-      if (tabIds && !isc.isA.Array(tabIds)) {
-        tabIds = [tabIds];
+  buttonDefinitions: [],
+
+  // note tabIds is an array of strings, but maybe null/undefined
+  registerButton: function (buttonId, clazz, properties, sortOrder, tabIds) {
+    var length;
+
+    if (tabIds && !isc.isA.Array(tabIds)) {
+      tabIds = [tabIds];
+    }
+
+    // declare the vars and the object which will be stored
+    var i, index = 0,
+        buttonDef;
+
+    buttonDef = {
+      buttonId: buttonId,
+      clazz: clazz,
+      properties: properties,
+      sortOrder: sortOrder,
+      tabIds: tabIds
+    };
+
+    // already registered, bail
+    length = this.buttonDefinitions.length;
+    for (i = 0; i < length; i++) {
+      if (this.buttonDefinitions[i].buttonId === buttonId) {
+        return;
       }
+    }
 
-      // declare the vars and the object which will be stored
-      var i, index = 0, buttonDef = {
-          buttonId: buttonId,
-          clazz: clazz,
-          properties: properties,
-          sortOrder: sortOrder,
-          tabIds: tabIds
-      };
- 
-      // already registered, bail
-      length = this.buttonDefinitions.length;
-      for (i = 0; i < length; i++) {   
-        if (this.buttonDefinitions[i].buttonId === buttonId) {
-          return;
+    index = this.buttonDefinitions.length;
+    for (i = 0; i < length; i++) {
+      if (this.buttonDefinitions[i].sortOrder > sortOrder) {
+        index = i;
+        break;
+      }
+    }
+
+    if (index === this.buttonDefinitions.length) {
+      this.buttonDefinitions[index] = buttonDef;
+    } else {
+      this.buttonDefinitions.splice(index, 0, buttonDef);
+    }
+  },
+
+  getButtons: function (tabId) {
+    // get the buttons for the tabId, this includes all buttons with that tabId or with no tabId set
+    // as the button defs are already stored by their sortorder we can just iterate over the array
+    // and pick them up in the correct order
+    // the return should be an array of button instances created by doing 
+    //  btnDefinitionClass.create(btnDefinitionProperties);
+    var result = [],
+        j, resultIndex = 0,
+        i, validTabId, tabIds, length = this.buttonDefinitions.length,
+        tabIdsLength;
+    for (i = 0; i < length; i++) {
+      tabIds = this.buttonDefinitions[i].tabIds;
+      validTabId = !tabIds;
+      if (tabIds) {
+        tabIdsLength = tabIds.length;
+        for (j = 0; j < tabIdsLength; j++) {
+          if (tabIds[j] === tabId) {
+            validTabId = true;
+            break;
+          }
         }
       }
-      
-      index = this.buttonDefinitions.length;
-      for (i = 0; i < length; i++) {   
-        if (this.buttonDefinitions[i].sortOrder > sortOrder) {
-          index = i;
-          break;
-        }
+      if (validTabId) {
+        result[resultIndex++] = this.buttonDefinitions[i].clazz.create(isc.clone(this.buttonDefinitions[i].properties));
       }
-
-      if (index === this.buttonDefinitions.length) {
-        this.buttonDefinitions[index] = buttonDef;
-      } else {
-        this.buttonDefinitions.splice(index, 0, buttonDef);
-      }
-    },
-
-		getButtons: function(tabId) {
-		  // get the buttons for the tabId, this includes all buttons with that tabId or with no tabId set
-		  // as the button defs are already stored by their sortorder we can just iterate over the array
-		  // and pick them up in the correct order
-		  // the return should be an array of button instances created by doing 
-		  //  btnDefinitionClass.create(btnDefinitionProperties);
-		  var result = [], j, resultIndex = 0, i, validTabId, 
-		    tabIds, length = this.buttonDefinitions.length,
-		    tabIdsLength;	
-		  for (i = 0; i < length; i++) {	
-		    tabIds = this.buttonDefinitions[i].tabIds;
-		    validTabId = !tabIds;
-		    if (tabIds) {
-		      tabIdsLength = tabIds.length;
-		      for (j = 0; j < tabIdsLength; j++) {
-		        if (tabIds[j] === tabId) {
-		          validTabId = true;
-		          break;
-		        }
-		      }
-		    }
-		    if (validTabId) {
-          result[resultIndex++] = this.buttonDefinitions[i].clazz.create(isc.clone(this.buttonDefinitions[i].properties));
-		    }
-		  }
-		  return result;
-		}
+    }
+    return result;
+  }
 };
 
 //These are the icon toolbar buttons shown in all the tabs 
@@ -1671,6 +1740,6 @@
 OB.ToolbarRegistry.registerButton(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.REFRESH_BUTTON_PROPERTIES, 70, null);
 OB.ToolbarRegistry.registerButton(isc.OBToolbar.EXPORT_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.EXPORT_BUTTON_PROPERTIES, 80, null);
 OB.ToolbarRegistry.registerButton(isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES, 90, null);
-          
+
 //and add the direct link at the end
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.LINK_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.LINK_BUTTON_PROPERTIES, 300, null);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.LINK_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.LINK_BUTTON_PROPERTIES, 300, null);
\ No newline at end of file