Issue 19728: Format js files org.openbravo.client.application - personalization
authorIván Perdomo <ivan.perdomo@openbravo.com>
Sat, 11 Feb 2012 16:43:01 +0100
changeset 15467 4cfd9a2819c4
parent 15466 cbfa765a23c4
child 15468 9c44288913ac
Issue 19728: Format js files org.openbravo.client.application - personalization
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-popups.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization-treegrid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-popups.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-popups.js	Sat Feb 11 16:43:01 2012 +0100
@@ -11,7 +11,7 @@
  * 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): ___________
  ************************************************************************
@@ -29,103 +29,101 @@
 //  specific for the delete popup.
 // - OB.Personalization.ManageViewsPopupPropertiesSave: properties specific 
 //  for the save popup
-
 // ** {{{OB.Personalization.ManageViewsPopupProperties}}} **
 // The common part of the popup which allows to save or delete 
 // a view. 
 OB.Personalization.ManageViewsPopupProperties = {
-    toggleSave: true,
-    showMaximizeButton: false,
-    showMinimizeButton: false,
-    
-    initWidget: function() {
-      var layout, window = this, form, saveButton, 
-        buttonsLayout;
-      
-      // create a save button, it is enabled/disabled
-      // from the form
-      saveButton = isc.OBFormButton.create({
-        title: this.actionLabel, 
-        action: function() {
-          // the doAction is overridden/implemented in the 
-          // specific save/delete properties
-          window.doAction(this.form);
-          window.closeClick();
-        },
-        disabled: this.toggleSave
-      });
-      
-      form = isc.DynamicForm.create({
-          // TODO: parts are the same as in the user-profile 
-          // navigation bar component form, should be put in
-          // a generic style somewhere
-          autoFocus: true,
-          overflow: 'visible',
-          titleOrientation: 'top',
-          height: 1,
-          width: 1,
-          titleSuffix: '</b>',
-          titlePrefix: '<b>',
-          requiredTitleSuffix: ' *</b>',
-          requiredRightTitlePrefix: '<b>* ',
-          rightTitlePrefix: '<b>',
-          rightTitleSuffix: '</b>',
-          numCols: 1,
-          errorOrientation: 'right',
-          toggleSave: this.toggleSave,
-          itemChanged: function() {
-            var pers = this.getValue("personalization");
-            if (this.toggleSave) {
-              // enable the save button when there is a 
-              // personalization record chosen/name entered
-              saveButton.setDisabled(!pers);
-            }
-          },
-          
-          handleKeyPress: function(){
-            var key = isc.EH.lastEvent.keyName;
-            if (key === 'Enter' && !this.saveButton.isDisabled()) {
-              this.saveButton.action();
-              return false;
-            } else {
-              return this.Super('handleKeyPress', arguments);
-            }
-          },
+  toggleSave: true,
+  showMaximizeButton: false,
+  showMinimizeButton: false,
 
-          fields: this.getFields()
-      });
-      saveButton.form = form;
-      form.saveButton = saveButton;
+  initWidget: function () {
+    var layout, window = this,
+        form, saveButton, buttonsLayout;
 
-      // create some layouts to put the form/buttons
-      // in the popup window
-      layout = isc.VLayout.create({
-        defaultLayoutAlign: 'center',
-        width: '100%',
-        height: '100%'
-      });
-      this.addItem(layout);
-      
-      buttonsLayout = isc.HStack.create({}, 
-          OB.Styles.Personalization.popupButtonLayout);
-      buttonsLayout.addMembers(saveButton);
-      buttonsLayout.addMembers(isc.OBFormButton.create({
-        title: OB.I18N.getLabel('UINAVBA_Cancel'),
-        click: function() {
-          window.closeClick();
+    // create a save button, it is enabled/disabled
+    // from the form
+    saveButton = isc.OBFormButton.create({
+      title: this.actionLabel,
+      action: function () {
+        // the doAction is overridden/implemented in the 
+        // specific save/delete properties
+        window.doAction(this.form);
+        window.closeClick();
+      },
+      disabled: this.toggleSave
+    });
+
+    form = isc.DynamicForm.create({
+      // TODO: parts are the same as in the user-profile 
+      // navigation bar component form, should be put in
+      // a generic style somewhere
+      autoFocus: true,
+      overflow: 'visible',
+      titleOrientation: 'top',
+      height: 1,
+      width: 1,
+      titleSuffix: '</b>',
+      titlePrefix: '<b>',
+      requiredTitleSuffix: ' *</b>',
+      requiredRightTitlePrefix: '<b>* ',
+      rightTitlePrefix: '<b>',
+      rightTitleSuffix: '</b>',
+      numCols: 1,
+      errorOrientation: 'right',
+      toggleSave: this.toggleSave,
+      itemChanged: function () {
+        var pers = this.getValue("personalization");
+        if (this.toggleSave) {
+          // enable the save button when there is a 
+          // personalization record chosen/name entered
+          saveButton.setDisabled(!pers);
         }
-      }));
-      
-      layout.addMember(form);
-      layout.addMember(buttonsLayout);
-      
-      this.Super('initWidget', arguments);
-    },
-    
-    getFields: function() {
-      // is overridden/implemented in the specific 
-      // implementation below.
-    }
+      },
+
+      handleKeyPress: function () {
+        var key = isc.EH.lastEvent.keyName;
+        if (key === 'Enter' && !this.saveButton.isDisabled()) {
+          this.saveButton.action();
+          return false;
+        } else {
+          return this.Super('handleKeyPress', arguments);
+        }
+      },
+
+      fields: this.getFields()
+    });
+    saveButton.form = form;
+    form.saveButton = saveButton;
+
+    // create some layouts to put the form/buttons
+    // in the popup window
+    layout = isc.VLayout.create({
+      defaultLayoutAlign: 'center',
+      width: '100%',
+      height: '100%'
+    });
+    this.addItem(layout);
+
+    buttonsLayout = isc.HStack.create({}, OB.Styles.Personalization.popupButtonLayout);
+    buttonsLayout.addMembers(saveButton);
+    buttonsLayout.addMembers(isc.OBFormButton.create({
+      title: OB.I18N.getLabel('UINAVBA_Cancel'),
+      click: function () {
+        window.closeClick();
+      }
+    }));
+
+    layout.addMember(form);
+    layout.addMember(buttonsLayout);
+
+    this.Super('initWidget', arguments);
+  },
+
+  getFields: function () {
+    // is overridden/implemented in the specific 
+    // implementation below.
+  }
 };
 
 //** {{{OB.Personalization.ManageViewsPopupPropertiesDelete}}} **
@@ -134,51 +132,50 @@
   title: OB.I18N.getLabel('OBUIAPP_SetDefaultView'),
   actionLabel: OB.I18N.getLabel('OBUIAPP_Apply'),
   toggleSave: true,
- 
-  getFields: function() {
-    var i, value, personalization = this.standardWindow.getClass().personalization, 
-      views = personalization && personalization.views ? personalization.views : [], 
-      valueMap = {}, flds = [], 
-      standardWindow = this.standardWindow, length;
-    
+
+  getFields: function () {
+    var i, value, personalization = this.standardWindow.getClass().personalization,
+        views = personalization && personalization.views ? personalization.views : [],
+        valueMap = {},
+        flds = [],
+        standardWindow = this.standardWindow,
+        length;
+
     if (views) {
       length = views.length;
       for (i = 0; i < length; i++) {
         valueMap[views[i].personalizationId] = views[i].viewDefinition.name;
       }
     }
-    
+
     flds[0] = isc.addProperties({
-        name: 'personalization',
-        title: OB.I18N.getLabel('OBUIAPP_DefaultView'),
-        valueMap: valueMap,
-        editorType: 'select',
-        addUnknownValues: false,
-        required: true,
-        allowEmptyValue: true,
-        changed: function() {
-          // enable the save button when there is a change
-          this.form.saveButton.setDisabled(false);
-          // don't let it be disabled again
-          this.form.toggleSave = false;
-        }
-      },
-      OB.Styles.Personalization.viewFieldDefaults,
-      OB.Styles.OBFormField.DefaultComboBox
-    );
-    
+      name: 'personalization',
+      title: OB.I18N.getLabel('OBUIAPP_DefaultView'),
+      valueMap: valueMap,
+      editorType: 'select',
+      addUnknownValues: false,
+      required: true,
+      allowEmptyValue: true,
+      changed: function () {
+        // enable the save button when there is a change
+        this.form.saveButton.setDisabled(false);
+        // don't let it be disabled again
+        this.form.toggleSave = false;
+      }
+    }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultComboBox);
+
     // set the value
     value = OB.PropertyStore.get('OBUIAPP_DefaultSavedView', this.standardWindow.windowId);
     if (value) {
       flds[0].value = value;
     }
-    
+
     return flds;
   },
-  
+
   // do the set default action
-  doAction: function(form) {
-    var personalizationId = form.getValue("personalization");    
+  doAction: function (form) {
+    var personalizationId = form.getValue("personalization");
     OB.PropertyStore.set('OBUIAPP_DefaultSavedView', personalizationId, this.standardWindow.windowId);
   }
 };
@@ -188,15 +185,17 @@
 OB.Personalization.ManageViewsPopupPropertiesDelete = {
   title: OB.I18N.getLabel('OBUIAPP_DeleteView'),
   actionLabel: OB.I18N.getLabel('OBUIAPP_Delete'),
-  
+
   // creates one combo with the viewdefinitions which can
   // be deleted by the current user
-  getFields: function() {
-    var i, personalization = this.standardWindow.getClass().personalization, 
-      views = personalization && personalization.views ? personalization.views : [], 
-      valueMap = {}, flds = [], 
-      standardWindow = this.standardWindow, length;
-    
+  getFields: function () {
+    var i, personalization = this.standardWindow.getClass().personalization,
+        views = personalization && personalization.views ? personalization.views : [],
+        valueMap = {},
+        flds = [],
+        standardWindow = this.standardWindow,
+        length;
+
     if (views) {
       length = views.length;
       for (i = 0; i < length; i++) {
@@ -205,25 +204,22 @@
         }
       }
     }
-    
+
     flds[0] = isc.addProperties({
-        name: 'personalization',
-        title: OB.I18N.getLabel('OBUIAPP_View'),
-        valueMap: valueMap,
-        editorType: 'select',
-        required: true,
-        allowEmptyValue: true
-      },
-      OB.Styles.Personalization.viewFieldDefaults,
-      OB.Styles.OBFormField.DefaultComboBox
-    );
+      name: 'personalization',
+      title: OB.I18N.getLabel('OBUIAPP_View'),
+      valueMap: valueMap,
+      editorType: 'select',
+      required: true,
+      allowEmptyValue: true
+    }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultComboBox);
     return flds;
   },
-  
+
   // do the delete action
-  doAction: function(form) {
-    var standardWindow = this.standardWindow, 
-      personalizationId = form.getValue("personalization");
+  doAction: function (form) {
+    var standardWindow = this.standardWindow,
+        personalizationId = form.getValue("personalization");
     OB.Personalization.deleteViewDefinition(standardWindow, personalizationId);
   }
 };
@@ -232,19 +228,23 @@
 //Contains delete specific properties for the popup.
 OB.Personalization.ManageViewsPopupPropertiesSave = {
   title: OB.I18N.getLabel('OBUIAPP_SaveView'),
-  
+
   actionLabel: OB.I18N.getLabel('OBUIAPP_Save'),
-  
+
   // 3 combo fields are created: views, level and level value
   // the last 2 are only created if the user is allowed to
   // change or set views for different levels
-  getFields: function() {
-    var i, formData, valueMap = {}, levelMapSet = false, 
-      levelMap = {'': ''}, flds = [], length, 
-      standardWindow = this.standardWindow,
-      personalization = standardWindow.getClass().personalization, 
-      views = personalization && personalization.views ? personalization.views : [];
-    
+  getFields: function () {
+    var i, formData, valueMap = {},
+        levelMapSet = false,
+        levelMap = {
+        '': ''
+        },
+        flds = [],
+        length, standardWindow = this.standardWindow,
+        personalization = standardWindow.getClass().personalization,
+        views = personalization && personalization.views ? personalization.views : [];
+
     // create the view combo
     if (views) {
       length = views.length;
@@ -254,57 +254,55 @@
         }
       }
     }
-    
+
     flds[0] = isc.addProperties({
-        standardWindow: standardWindow,
-        name: 'personalization',
-        title: OB.I18N.getLabel('OBUIAPP_SaveAs'),
-        valueMap: valueMap,
-        editorType: 'ComboBoxItem',
-        allowEmptyValue: true,
-        required: true,
-        
-        // if changed, then set the level and levelvalue
-        // fields to the current level of the personalization
-        changed: function(form, item, value) {
-          var i, levelField = form.getField('level'), length,
-            levelValueField = form.getField('levelValue'), 
-            personalization = this.standardWindow.getClass().personalization, views;
-          
-          // find the personalization
-          if (levelField && personalization.views) {
-            // and the view, and set the level and level value
-            // combos
-            views = personalization.views;
-            length = views.length;
-            for (i = 0; i < length; i++) {
-              if (views[i].personalizationId === value) {
-                if (views[i].clientId) {
-                  levelField.storeValue('clients');
-                  levelValueField.storeValue(views[i].clientId);
-                }
-                if (views[i].orgId) {
-                  levelField.storeValue('orgs');
-                  levelValueField.storeValue(views[i].orgId);
-                }
-                if (views[i].roleId) {
-                  levelField.storeValue('roles');
-                  levelValueField.storeValue(views[i].roleId);
-                }
-                if (views[i].viewDefinition) {
-                  form.setValue('default', views[i].viewDefinition.isDefault);
-                }
-                levelField.updateValueMap(true);
-                levelValueField.updateValueMap(true);
+      standardWindow: standardWindow,
+      name: 'personalization',
+      title: OB.I18N.getLabel('OBUIAPP_SaveAs'),
+      valueMap: valueMap,
+      editorType: 'ComboBoxItem',
+      allowEmptyValue: true,
+      required: true,
+
+      // if changed, then set the level and levelvalue
+      // fields to the current level of the personalization
+      changed: function (form, item, value) {
+        var i, levelField = form.getField('level'),
+            length, levelValueField = form.getField('levelValue'),
+            personalization = this.standardWindow.getClass().personalization,
+            views;
+
+        // find the personalization
+        if (levelField && personalization.views) {
+          // and the view, and set the level and level value
+          // combos
+          views = personalization.views;
+          length = views.length;
+          for (i = 0; i < length; i++) {
+            if (views[i].personalizationId === value) {
+              if (views[i].clientId) {
+                levelField.storeValue('clients');
+                levelValueField.storeValue(views[i].clientId);
               }
+              if (views[i].orgId) {
+                levelField.storeValue('orgs');
+                levelValueField.storeValue(views[i].orgId);
+              }
+              if (views[i].roleId) {
+                levelField.storeValue('roles');
+                levelValueField.storeValue(views[i].roleId);
+              }
+              if (views[i].viewDefinition) {
+                form.setValue('default', views[i].viewDefinition.isDefault);
+              }
+              levelField.updateValueMap(true);
+              levelValueField.updateValueMap(true);
             }
           }
         }
-      },
-      OB.Styles.Personalization.viewFieldDefaults,
-      OB.Styles.OBFormField.DefaultComboBox
-    );
-    
+      }
+    }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultComboBox);
+
     // create the level combo
     if (personalization && personalization.formData) {
       formData = personalization.formData;
@@ -322,62 +320,54 @@
         levelMap.roles = OB.I18N.getLabel("OBUIAPP_Role");
         levelMapSet = true;
       }
-    } 
-    
+    }
+
     // if the user is allowed to set views on different 
     // levels, then create the 2 combos
     if (levelMapSet) {
       flds[1] = isc.addProperties({
-          name: 'level',
-          title: OB.I18N.getLabel('OBUIAPP_Level'),
-          valueMap: levelMap,
-          editorType: 'select',
-          defaultToFirstOption: true,
-          emptyDisplayValue: OB.I18N.getLabel('OBUIAPP_User'),
-          changed: function (form, item, value) {
-            // if the level combo changes, then set the
-            // level value map (so that it shows clients, orgs
-            // or roles resp.)
-            var levelValueField = form.getField('levelValue');
-            levelValueField.setValueMap(formData[value]);
-            levelValueField.clearValue();
-          }
-        },
-        OB.Styles.Personalization.viewFieldDefaults,
-        OB.Styles.OBFormField.DefaultComboBox
-      );
+        name: 'level',
+        title: OB.I18N.getLabel('OBUIAPP_Level'),
+        valueMap: levelMap,
+        editorType: 'select',
+        defaultToFirstOption: true,
+        emptyDisplayValue: OB.I18N.getLabel('OBUIAPP_User'),
+        changed: function (form, item, value) {
+          // if the level combo changes, then set the
+          // level value map (so that it shows clients, orgs
+          // or roles resp.)
+          var levelValueField = form.getField('levelValue');
+          levelValueField.setValueMap(formData[value]);
+          levelValueField.clearValue();
+        }
+      }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultComboBox);
 
       flds[2] = isc.addProperties({
-          name: 'levelValue',
-          title: OB.I18N.getLabel('OBUIAPP_Value'),
-          valueMap: {},
-          editorType: 'select',
-          emptyDisplayValue: OB.User.userName,
-          defaultToFirstOption: true
-        },
-        OB.Styles.Personalization.viewFieldDefaults,
-        OB.Styles.OBFormField.DefaultComboBox
-      );
-      
+        name: 'levelValue',
+        title: OB.I18N.getLabel('OBUIAPP_Value'),
+        valueMap: {},
+        editorType: 'select',
+        emptyDisplayValue: OB.User.userName,
+        defaultToFirstOption: true
+      }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultComboBox);
+
       // and create the checkbox to let it be the default 
       // for other users
       flds[3] = isc.addProperties({
-          name: 'default',
-          title: OB.I18N.getLabel('OBUIAPP_DefaultView'),
-          editorType: 'OBCheckboxItem'
-        },
-        OB.Styles.Personalization.viewFieldDefaults,
-        OB.Styles.OBFormField.DefaultCheckbox
-      );      
+        name: 'default',
+        title: OB.I18N.getLabel('OBUIAPP_DefaultView'),
+        editorType: 'OBCheckboxItem'
+      }, OB.Styles.Personalization.viewFieldDefaults, OB.Styles.OBFormField.DefaultCheckbox);
     }
     return flds;
   },
-  
-  doAction: function(form) {
-    var name, levelInformation = {}, persId = {}, 
-      level = form.getValue('level'), 
-      levelValue = form.getValue('levelValue');
-    
+
+  doAction: function (form) {
+    var name, levelInformation = {},
+        persId = {},
+        level = form.getValue('level'),
+        levelValue = form.getValue('levelValue');
+
     if (level === 'clients' && levelValue) {
       levelInformation.clientId = levelValue;
     }
@@ -392,12 +382,12 @@
     }
     persId = form.getValue("personalization");
     name = form.getField("personalization").getDisplayValue();
-    
+
     // same value, the user typed in a new name
     if (name === persId) {
       persId = null;
     }
-    
+
     OB.Personalization.storeViewDefinition(this.standardWindow, levelInformation, persId, name, form.getValue('default'));
   }
-};
+};
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js	Sat Feb 11 16:43:01 2012 +0100
@@ -11,7 +11,7 @@
  * 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): ___________
  ************************************************************************
@@ -22,13 +22,13 @@
 // and the save/delete option (if enabled).
 (function () {
   var manageViewButtonProperties = {
-    
-    initWidget: function() {
+
+    initWidget: function () {
       this.menu = isc.Menu.create({
         button: this,
 
         // overridden to get much simpler custom style name
-        getBaseStyle: function(record, rowNum, colNum){
+        getBaseStyle: function (record, rowNum, colNum) {
           if (colNum === 0) {
             return this.baseStyle + 'Icon';
           }
@@ -38,188 +38,184 @@
           return this.baseStyle;
         },
 
-        itemClick: function(item, colNum) {
+        itemClick: function (item, colNum) {
           var standardWindow = this.button.view.standardWindow;
           if (item.viewDefinition) {
             if (item.originalView) {
               standardWindow.clearLastViewPersonalization();
             }
             delete standardWindow.lastViewApplied;
-            
+
             OB.Personalization.applyViewDefinition(item.personalizationId, item.viewDefinition, this.button.view.standardWindow);
           } else {
             item.doClick(this.button.view.standardWindow);
           }
-        }      
+        }
       }, OB.Styles.Personalization.Menu);
     },
-    
-    showMenu: function() {      
+
+    showMenu: function () {
       if (!OB.Utilities.checkProfessionalLicense(
-          OB.I18N.getLabel('OBUIAPP_ActivateMessageWindowPersonalization'))) {
+      OB.I18N.getLabel('OBUIAPP_ActivateMessageWindowPersonalization'))) {
         return;
       }
       return this.Super('showMenu', arguments);
     },
-    
+
     // shows the menu with the available views and the save 
     // and delete option
-    action: function() {
-      var data = [], icon, i, item, undef, view, formData,
-        standardWindow = this.view.standardWindow,
-        adminLevel = false, length, viewSelected = false,
-        personalization = standardWindow.getClass().personalization, 
-        views = personalization && personalization.views ? personalization.views : [],
-        canDelete = false;
-      
+    action: function () {
+      var data = [],
+          icon, i, item, undef, view, formData, standardWindow = this.view.standardWindow,
+          adminLevel = false,
+          length, viewSelected = false,
+          personalization = standardWindow.getClass().personalization,
+          views = personalization && personalization.views ? personalization.views : [],
+          canDelete = false;
+
       if (!OB.Utilities.checkProfessionalLicense(
-          OB.I18N.getLabel('OBUIAPP_ActivateMessagePersonalization'))) {
+      OB.I18N.getLabel('OBUIAPP_ActivateMessagePersonalization'))) {
         return;
       }
-      
+
       // add the standard view, but make a copy so that it is not added
       // to the real list of editable/deletable views
       views = isc.shallowClone(views);
       views.push(standardWindow.getClass().originalView);
-      
+
       if (!standardWindow.selectedPersonalizationId) {
         if (!standardWindow.lastViewApplied) {
           standardWindow.selectedPersonalizationId = standardWindow.getClass().originalView.personalizationId;
         }
       }
-      
+
       // create the list of current views to show
       length = views.length;
       for (i = 0; i < length; i++) {
         view = views[i];
         canDelete = view.canEdit || canDelete;
-        
+
         if (standardWindow.selectedPersonalizationId && view.personalizationId === standardWindow.selectedPersonalizationId) {
-          icon = this.menu.itemIcon;          
+          icon = this.menu.itemIcon;
         } else {
           icon = null;
         }
-        
-        item = {title: view.viewDefinition.name, 
-            icon: icon, 
-            personalizationId: view.personalizationId, 
-            viewDefinition: view.viewDefinition};
-        
+
+        item = {
+          title: view.viewDefinition.name,
+          icon: icon,
+          personalizationId: view.personalizationId,
+          viewDefinition: view.viewDefinition
+        };
+
         if (view.originalView) {
           item.originalView = true;
         }
-        
-        data.push(item);        
+
+        data.push(item);
       }
-      
+
       // compute the menu items, only if the user is allowed
       // to personalize
       if (this.isWindowPersonalizationAllowed()) {
-        
+
         if (standardWindow.getClass().personalization && standardWindow.getClass().personalization.formData) {
           formData = standardWindow.getClass().personalization.formData;
           if (formData.clients || formData.orgs || formData.roles) {
             adminLevel = true;
           }
         }
-        
-        data.push({title: OB.I18N.getLabel('OBUIAPP_SaveView'), 
+
+        data.push({
+          title: OB.I18N.getLabel('OBUIAPP_SaveView'),
           showSeparator: data.length > 0,
-          doClick: function(standardWindow) {
+          doClick: function (standardWindow) {
             var popup = isc.OBPopup.create({
-                standardWindow: standardWindow
-              }, 
-              OB.Personalization.ManageViewsPopupProperties,
-              OB.Personalization.ManageViewsPopupPropertiesSave,
-              adminLevel ? 
-                OB.Styles.Personalization.saveViewPopupLarge :
-                OB.Styles.Personalization.saveViewPopupSmall);
+              standardWindow: standardWindow
+            }, OB.Personalization.ManageViewsPopupProperties, OB.Personalization.ManageViewsPopupPropertiesSave, adminLevel ? OB.Styles.Personalization.saveViewPopupLarge : OB.Styles.Personalization.saveViewPopupSmall);
             popup.show();
-          }});
+          }
+        });
 
         // if there are views allow to choose a default
         if (views.length > 0) {
-          data.push({title: OB.I18N.getLabel('OBUIAPP_SetDefaultView'),
+          data.push({
+            title: OB.I18N.getLabel('OBUIAPP_SetDefaultView'),
             standardWindow: standardWindow,
-            doClick: function(standardWindow) {
+            doClick: function (standardWindow) {
               var popup = isc.OBPopup.create({
-                  standardWindow: standardWindow
-                }, 
-                OB.Personalization.ManageViewsPopupProperties,
-                OB.Personalization.ManageViewsPopupPropertiesDefault,
-                OB.Styles.Personalization.deleteViewPopup);
+                standardWindow: standardWindow
+              }, OB.Personalization.ManageViewsPopupProperties, OB.Personalization.ManageViewsPopupPropertiesDefault, OB.Styles.Personalization.deleteViewPopup);
               popup.show();
-            }});
+            }
+          });
         }
-        
+
         // only show the delete option if there are deletable options        
         if (canDelete) {
-          data.push({title: OB.I18N.getLabel('OBUIAPP_DeleteView'),
+          data.push({
+            title: OB.I18N.getLabel('OBUIAPP_DeleteView'),
             standardWindow: standardWindow,
-            doClick: function(standardWindow) {
+            doClick: function (standardWindow) {
               var popup = isc.OBPopup.create({
-                  standardWindow: standardWindow
-                }, 
-                OB.Personalization.ManageViewsPopupProperties,
-                OB.Personalization.ManageViewsPopupPropertiesDelete,
-                OB.Styles.Personalization.deleteViewPopup);
+                standardWindow: standardWindow
+              }, OB.Personalization.ManageViewsPopupProperties, OB.Personalization.ManageViewsPopupPropertiesDelete, OB.Styles.Personalization.deleteViewPopup);
               popup.show();
-            }});
+            }
+          });
         }
       }
-      
+
       if (data.length === 0) {
         // this can not really happen, the button should be disabled
         return;
       }
-      
+
       this.menu.setData(data);
-      
+
       this.Super('action', arguments);
     },
     disabled: false,
     buttonType: 'manageviews',
     prompt: OB.I18N.getLabel('OBUIAPP_ManageViews_Toolbar_Button'),
-    updateState: function(){
+    updateState: function () {
       this.resetBaseStyle();
-      
+
       // no items are shown in this case
       if (!this.isWindowPersonalizationAllowed() && !this.viewsToSelect()) {
         this.setDisabled(true);
       } else {
         this.setDisabled(false);
       }
-      
+
       this.show();
     },
-    
-    viewsToSelect: function() {
+
+    viewsToSelect: function () {
       // standardwindow is not set during initialization
       var pers = (this.view.standardWindow ? this.view.standardWindow.getClass().personalization : null);
       return (pers && pers.views && pers.views.length > 0);
     },
-    
-    isWindowPersonalizationAllowed: function() {
-      var propValue, undef,
-        standardWindow = this.view.standardWindow,
-        personalization = (standardWindow ? standardWindow.getClass().personalization : null),
-        formData = (personalization ? personalization.formData : null);
-      
+
+    isWindowPersonalizationAllowed: function () {
+      var propValue, undef, standardWindow = this.view.standardWindow,
+          personalization = (standardWindow ? standardWindow.getClass().personalization : null),
+          formData = (personalization ? personalization.formData : null);
+
       // standardwindow is not set during initialization
       // don't set the variable yet, but do not allow either
       if (!standardWindow) {
         return false;
       }
-      
+
       // note: false is not cached as during initialization
       // things can be false
-      if (this.userWindowPersonalizationAllowed === undef) {        
+      if (this.userWindowPersonalizationAllowed === undef) {
         // if an admin then allow personalization
         if (formData && (formData.orgs || formData.clients || formData.roles)) {
           this.userWindowPersonalizationAllowed = true;
         } else {
-          propValue = OB.PropertyStore.get('OBUIAPP_WindowPersonalization_Override', 
-              standardWindow ? standardWindow.windowId : null);
+          propValue = OB.PropertyStore.get('OBUIAPP_WindowPersonalization_Override', standardWindow ? standardWindow.windowId : null);
           if (propValue === 'false' || propValue === 'N') {
             return false;
           } else {
@@ -231,8 +227,7 @@
     },
     keyboardShortcutId: 'ToolBar_ManageViews'
   };
-  
-  OB.ToolbarRegistry.registerButton(manageViewButtonProperties.buttonType, 
-      isc.OBToolbarIconButton, manageViewButtonProperties, 320, null);
- 
-}());
+
+  OB.ToolbarRegistry.registerButton(manageViewButtonProperties.buttonType, isc.OBToolbarIconButton, manageViewButtonProperties, 320, null);
+
+}());
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Sat Feb 11 16:43:01 2012 +0100
@@ -11,7 +11,7 @@
  * 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): ___________
  ************************************************************************
@@ -95,19 +95,18 @@
 //      - personalization id: the id of the personalization record
 //  - formData: contains the level information at which the user can edit the views. For each level
 //      (clients, orgs, roles) a 'valuemap' is contained in this object.
-
 // ** {{{OB.Personalization.applyViewDefinition}}} **
 // Apply a selected view definition to a window
-OB.Personalization.applyViewDefinition = function(persId, viewDefinition, standardWindow) {
+OB.Personalization.applyViewDefinition = function (persId, viewDefinition, standardWindow) {
   var i, view, viewTabDefinition, length = standardWindow.views.length,
-    windowDefinition = viewDefinition.window;
-  
+      windowDefinition = viewDefinition.window;
+
   // delete the current form personalization 
   // as these will be overwritten by the new settings
   standardWindow.removeAllFormPersonalizations();
-  
+
   standardWindow.selectedPersonalizationId = persId;
-  
+
   if (windowDefinition) {
     if (windowDefinition.activeTabId) {
       for (i = 0; i < length; i++) {
@@ -136,9 +135,9 @@
           view.childTabSet.setHeight(windowDefinition.childTabSetHeight);
         }
       }
-    }      
+    }
   }
-  
+
   // the viewdefinition contains both the global info (form, canDelete, personalizationid)  
   // set the view state for each tab
   for (i = 0; i < length; i++) {
@@ -154,7 +153,7 @@
       if (view.isShowingForm) {
         view.switchFormGridVisibility();
       }
-      
+
       if (viewTabDefinition.grid) {
         view.viewGrid.setViewState(viewTabDefinition.grid);
       }
@@ -169,44 +168,44 @@
 // Retrieve the view state from the window.
 // The levelInformation contains the level at which to store the view. After the save the internal
 // view state is stored in the standardWindow.getClass().personalization object.
-OB.Personalization.getViewDefinition = function(standardWindow, name, isDefault) {
-  var view, persDataByTab, personalizationData = {}, i, 
-    formData, length = standardWindow.views.length;
-  
+OB.Personalization.getViewDefinition = function (standardWindow, name, isDefault) {
+  var view, persDataByTab, personalizationData = {},
+      i, formData, length = standardWindow.views.length;
+
   // retrieve the viewstate from the server
   for (i = 0; i < length; i++) {
     persDataByTab = {};
     view = standardWindow.views[i];
-    
+
     // get the form personalization information
-    formData = OB.Personalization.getPersonalizationDataFromForm(view.viewForm);    
+    formData = OB.Personalization.getPersonalizationDataFromForm(view.viewForm);
     persDataByTab.form = formData.form;
-    
+
     // ahd the grid state
     persDataByTab.grid = view.viewGrid.getViewState(false, true);
-    
+
     if (view.childTabSet && view.childTabSet.getSelectedTabNumber() >= 0) {
       persDataByTab.selectedTab = view.childTabSet.getSelectedTabNumber();
     }
-    
+
     // and store it in the overall structure
     personalizationData[view.tabId] = persDataByTab;
   }
   personalizationData.name = name;
   if (isDefault) {
-    personalizationData.isDefault = true;    
+    personalizationData.isDefault = true;
   }
   if (standardWindow.activeView) {
     personalizationData.window = {
-        activeTabId: standardWindow.activeView ? standardWindow.activeView.tabId : null
+      activeTabId: standardWindow.activeView ? standardWindow.activeView.tabId : null
     };
-    
+
     if (standardWindow.activeView.parentTabSet) {
       personalizationData.window.parentTabSetState = standardWindow.activeView.parentTabSet.getState();
       personalizationData.window.parentTabSetHeight = standardWindow.activeView.parentTabSet.getHeight();
     } else if (standardWindow.activeView.childTabSet) {
-      personalizationData.window.childTabSetState = standardWindow.activeView.childTabSet.getState();      
-      personalizationData.window.childTabSetHeight = standardWindow.activeView.childTabSet.getHeight();      
+      personalizationData.window.childTabSetState = standardWindow.activeView.childTabSet.getState();
+      personalizationData.window.childTabSetHeight = standardWindow.activeView.childTabSet.getHeight();
     }
   }
   return personalizationData;
@@ -216,10 +215,9 @@
 // Retrieve the view state from the window and stores it in the server using the specified name and id (if set).
 // The levelInformation contains the level at which to store the view. After the save the internal
 // view state is stored in the standardWindow.getClass().personalization object.
-OB.Personalization.storeViewDefinition = function(standardWindow, levelInformation, persId, name, isDefault) {
-  var params, personalizationData = 
-      OB.Personalization.getViewDefinition(standardWindow, name, isDefault);
-  
+OB.Personalization.storeViewDefinition = function (standardWindow, levelInformation, persId, name, isDefault) {
+  var params, personalizationData = OB.Personalization.getViewDefinition(standardWindow, name, isDefault);
+
   // if there is a personalization id then use that
   // this ensures that a specific record will be updated
   // on the server.
@@ -228,117 +226,108 @@
   // also persist the level information
   if (persId) {
     params = {
-        action: 'store',
-        target: 'viewDefinition',
-        clientId: levelInformation.clientId,
-        orgId: levelInformation.orgId,
-        roleId: levelInformation.roleId,
-        userId: levelInformation.userId,
-        personalizationId: persId
+      action: 'store',
+      target: 'viewDefinition',
+      clientId: levelInformation.clientId,
+      orgId: levelInformation.orgId,
+      roleId: levelInformation.roleId,
+      userId: levelInformation.userId,
+      personalizationId: persId
     };
-    
+
   } else {
     // this case is used if there is no personalization record
     // use the level information to store the view state
     params = {
-        action: 'store',
-        target: 'viewDefinition',
-        clientId: levelInformation.clientId,
-        orgId: levelInformation.orgId,
-        roleId: levelInformation.roleId,
-        userId: levelInformation.userId,
-        windowId: standardWindow.windowId
+      action: 'store',
+      target: 'viewDefinition',
+      clientId: levelInformation.clientId,
+      orgId: levelInformation.orgId,
+      roleId: levelInformation.roleId,
+      userId: levelInformation.userId,
+      windowId: standardWindow.windowId
     };
   }
-  
+
   // and store on the server
-  OB.RemoteCallManager.call(
-    'org.openbravo.client.application.personalization.PersonalizationActionHandler', 
-    personalizationData, params,
-    function(resp, data, req){
-      var i = 0, fnd = false, length;
-      var newView, 
-        personalization = standardWindow.getClass().personalization, 
-        views = personalization && personalization.views ? personalization.views : []; 
+  OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', personalizationData, params, function (resp, data, req) {
+    var i = 0,
+        fnd = false,
+        length, newView, personalization = standardWindow.getClass().personalization,
+        views = personalization && personalization.views ? personalization.views : [];
 
-      standardWindow.selectedPersonalizationId = data.personalizationId;
-      
-      // create a new structure, the same way as it is 
-      // returned from the server
-      newView = isc.addProperties({
-          canEdit: true,
-          personalizationId: data.personalizationId,
-          viewDefinition: personalizationData
-        }, levelInformation);
-        
-      // when returning update the in-memory entry,
-      // first check if there is an existing record, if so 
-      // update it
-      if (views) {
-        length = views.length;
-        for (i = 0; i < length; i++) {
-          if (views[i].personalizationId === data.personalizationId) {
-            views[i] = newView;
-            fnd = true;
-            break;
-          }
+    standardWindow.selectedPersonalizationId = data.personalizationId;
+
+    // create a new structure, the same way as it is 
+    // returned from the server
+    newView = isc.addProperties({
+      canEdit: true,
+      personalizationId: data.personalizationId,
+      viewDefinition: personalizationData
+    }, levelInformation);
+
+    // when returning update the in-memory entry,
+    // first check if there is an existing record, if so 
+    // update it
+    if (views) {
+      length = views.length;
+      for (i = 0; i < length; i++) {
+        if (views[i].personalizationId === data.personalizationId) {
+          views[i] = newView;
+          fnd = true;
+          break;
         }
       }
-      
-      // not found create a new one, take into account
-      // that the initial structure maybe empty
-      if (!fnd) {
-        if (!standardWindow.getClass().personalization) {
-          standardWindow.getClass().personalization = {};
+    }
+
+    // not found create a new one, take into account
+    // that the initial structure maybe empty
+    if (!fnd) {
+      if (!standardWindow.getClass().personalization) {
+        standardWindow.getClass().personalization = {};
+      }
+      if (!standardWindow.getClass().personalization.views) {
+        standardWindow.getClass().personalization.views = [];
+        views = standardWindow.getClass().personalization.views;
+      }
+      views.push(newView);
+
+      // sort the viewdefinitions
+      views.sort(function (v1, v2) {
+        var t1 = v1.viewDefinition.name,
+            t2 = v2.viewDefinition.name;
+        if (t1 < t2) {
+          return -1;
+        } else if (t1 === t2) {
+          return 0;
         }
-        if (!standardWindow.getClass().personalization.views) {
-          standardWindow.getClass().personalization.views = [];
-          views = standardWindow.getClass().personalization.views;
-        }
-        views.push(newView);
-        
-        // sort the viewdefinitions
-        views.sort(function(v1, v2) {
-          var t1 = v1.viewDefinition.name, t2 = v2.viewDefinition.name;
-          if (t1 < t2) {
-            return -1;
-          } else if (t1 === t2) {
-            return 0;
-          }
-          return 1;
-        });
+        return 1;
+      });
 
-      }
     }
-  );
+  });
 };
 
 //** {{{OB.Personalization.deleteViewDefinition}}} **
 // Delete the view definition from the server, also remove it from the 
 // in-memory structure.
-OB.Personalization.deleteViewDefinition = function(standardWindow, personalizationId) {
-  OB.RemoteCallManager.call(
-      'org.openbravo.client.application.personalization.PersonalizationActionHandler', 
-      {}, 
-      { 
-        personalizationId: personalizationId,
-        action: 'delete'
-      },
-      function(resp, data, req){
-        var personalization = standardWindow.getClass().personalization, 
-          length, i,
-          views = personalization && personalization.views ? personalization.views : [];
-        
-        if (views) {
-          length = views.length;
-          // remove the entry from the global list
-          for (i = 0; i < length; i++) {
-            if (views[i].personalizationId === personalizationId) {
-              views.splice(i, 1);
-              break;
-            }
-          }
+OB.Personalization.deleteViewDefinition = function (standardWindow, personalizationId) {
+  OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', {}, {
+    personalizationId: personalizationId,
+    action: 'delete'
+  }, function (resp, data, req) {
+    var personalization = standardWindow.getClass().personalization,
+        length, i, views = personalization && personalization.views ? personalization.views : [];
+
+    if (views) {
+      length = views.length;
+      // remove the entry from the global list
+      for (i = 0; i < length; i++) {
+        if (views[i].personalizationId === personalizationId) {
+          views.splice(i, 1);
+          break;
         }
       }
-   );
-};
+    }
+  });
+};
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization-treegrid.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization-treegrid.js	Sat Feb 11 16:43:01 2012 +0100
@@ -11,7 +11,7 @@
  * 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): ___________
  ************************************************************************
@@ -38,7 +38,7 @@
   canAcceptDroppedRecords: true,
   leaveScrollbarGap: false,
   showCellContextMenus: true,
-  
+
   // when an item gets dropped on a closed folder its icon 
   // changes
   showDropIcons: true,
@@ -46,75 +46,82 @@
   dropIconSuffix: 'open',
   closedIconSuffix: 'closed',
   openIconSuffix: 'open',
-  
-  fields: [
-    {name: 'title', canHover: true, showHover: true, 
-      treeField: true,
-      showTitle: false, type: 'text', width: '100%', canEdit: false}
-    // disabled for now, it can be an idea to support direct editing in the tree
-//    {name: 'colSpan', title: OB.I18N.getLabel('OBUIAPP_Personalization_Colspan'), type: 'number', editorType: 'TextItem', keyPressFilterNumeric: '[0-9]'}, 
-//    {name: 'rowSpan', title: OB.I18N.getLabel('OBUIAPP_Personalization_Rowspan'),  type: 'number', editorType: 'TextItem', keyPressFilterNumeric: '[0-9]'}, 
-//    {name: 'startRow', title: OB.I18N.getLabel('OBUIAPP_Personalization_Startrow'), type: 'boolean'}, 
-//    {name: 'hiddenInForm', title: OB.I18N.getLabel('OBUIAPP_Personalization_Hidden'), type: 'boolean'}
-    ],
-    
-  initWidget: function() {
-    var i;
+
+  fields: [{
+    name: 'title',
+    canHover: true,
+    showHover: true,
+    treeField: true,
+    showTitle: false,
+    type: 'text',
+    width: '100%',
+    canEdit: false
+  }
+  // disabled for now, it can be an idea to support direct editing in the tree
+  //    {name: 'colSpan', title: OB.I18N.getLabel('OBUIAPP_Personalization_Colspan'), type: 'number', editorType: 'TextItem', keyPressFilterNumeric: '[0-9]'}, 
+  //    {name: 'rowSpan', title: OB.I18N.getLabel('OBUIAPP_Personalization_Rowspan'),  type: 'number', editorType: 'TextItem', keyPressFilterNumeric: '[0-9]'}, 
+  //    {name: 'startRow', title: OB.I18N.getLabel('OBUIAPP_Personalization_Startrow'), type: 'boolean'}, 
+  //    {name: 'hiddenInForm', title: OB.I18N.getLabel('OBUIAPP_Personalization_Hidden'), type: 'boolean'}
+  ],
+
+  initWidget: function () {
+    var length = this.fields.length,
+        me = this,
+        changedFunction, i;
+
     // todo: show custom items for different types of fields
     this.nodeIcon = OB.Styles.Personalization.Icons.field;
     this.folderIcon = OB.Styles.Personalization.Icons.fieldGroup;
 
     // register a change notifier
-    var length = this.fields.length,
-      me = this, changedFunction = function() {
-        me.personalizeForm.changed();
-      };
-    
+    changedFunction = function () {
+      me.personalizeForm.changed();
+    };
+
     for (i = 0; i < length; i++) {
       this.fields[i].changed = changedFunction;
     }
 
     // hovering
-    this.fields[0].hoverHTML = function(record, value) {
+    this.fields[0].hoverHTML = function (record, value) {
       return me.personalizeForm.getHoverHTML(record, null);
     };
 
     this.computeNodeIcons(this.fieldData);
-    
+
     // create the tree, note the modeltype, idField and parentIdField
     // they determine how the tree is build from the list of nodes
     this.data = isc.Tree.create({
       modelType: 'parent',
-       idField: 'name',
-       parentIdField: 'parentName',
-       data: this.fieldData,
-       dataChanged: function() {
-         me.personalizeForm.changed();
-       },
-       // note Tree is not a widget, it more like a datasource
-       // it has no visual representation, therefore overriding init
-       init: function() {
-         var mainNode;
-         this.Super('init', arguments);
-         
-         // open the main folder as a default
-         mainNode = this.getAllNodes().find('name', OB.Personalization.MAIN_GROUPNAME);
-         this.openFolder(mainNode);
-       }
-  });
-   
+      idField: 'name',
+      parentIdField: 'parentName',
+      data: this.fieldData,
+      dataChanged: function () {
+        me.personalizeForm.changed();
+      },
+      // note Tree is not a widget, it more like a datasource
+      // it has no visual representation, therefore overriding init
+      init: function () {
+        var mainNode;
+        this.Super('init', arguments);
+
+        // open the main folder as a default
+        mainNode = this.getAllNodes().find('name', OB.Personalization.MAIN_GROUPNAME);
+        this.openFolder(mainNode);
+      }
+    });
+
     // does not seem to work for the root, can also
     // be done by overriding the folderDrop method, see below
-//   this.data.getRoot().canAcceptDrop = false;
+    //   this.data.getRoot().canAcceptDrop = false;
     // commented, start closed
-//   this.data.openAll();
-   
-   this.Super('initWidget', arguments);
+    //   this.data.openAll();
+    this.Super('initWidget', arguments);
   },
-  
+
   // open the folders and expands form items, needs to be called
   // after the preview form has been build
-  openFolders: function() {
+  openFolders: function () {
     var i, nodes;
     // open the folders which need to be opened
     for (i = 0, nodes = this.data.getAllNodes(); i < nodes.length; i++) {
@@ -123,14 +130,14 @@
       }
     }
   },
-  
-  destroy: function() {
+
+  destroy: function () {
     if (this.data) {
       this.data.destroy();
     }
     this.Super('destroy', arguments);
   },
-  
+
   // open/close a folder on folder click
   folderClick: function (viewer, folder, recordNum) {
     if (this.data.isOpen(folder)) {
@@ -139,59 +146,57 @@
       this.openFolder(folder);
     }
   },
-  
-  closeFolder: function(folder) {
-    var fld, i, length, 
-      flds = this.personalizeForm.previewForm.getFields();
-    
+
+  closeFolder: function (folder) {
+    var fld, i, length, flds = this.personalizeForm.previewForm.getFields();
+
     this.Super('closeFolder', arguments);
-    
+
     // find the section fld and collapse
     for (i = 0, length = flds.length; i < length; i++) {
       if (flds[i].name === folder.name && flds[i].collapseSection) {
         folder.sectionExpanded = false;
-        flds[i].collapseSection();        
+        flds[i].collapseSection();
         this.personalizeForm.changed();
         break;
       }
     }
   },
-  
-  openFolder: function(folder) {
-    var fld, i, length, 
-      flds = this.personalizeForm.previewForm.getFields();
-    
+
+  openFolder: function (folder) {
+    var fld, i, length, flds = this.personalizeForm.previewForm.getFields();
+
     this.Super('openFolder', arguments);
-    
+
     // find the section fld and collapse
     for (i = 0, length = flds.length; i < length; i++) {
       if (flds[i].name === folder.name && flds[i].expandSection) {
         folder.sectionExpanded = true;
-        flds[i].expandSection();        
+        flds[i].expandSection();
         this.personalizeForm.changed();
         break;
       }
     }
   },
-  
+
   // overridden to:
   // - prevent a change event if a node is dropped
   // in the same location (code commented out, seems to prevent move..)
   // - set isStatusBarField flag when moved into the status bar folder
-  folderDrop : function (nodes, folder, index, sourceWidget, callback) {
+  folderDrop: function (nodes, folder, index, sourceWidget, callback) {
     var i, oldNode, oldValue, newCallback, changed, length;
-    
+
     if (!nodes) {
       return;
     }
-    
+
     // can not drop in the root
     if (folder && folder.name === '/') {
       return;
     }
 
     length = nodes.length;
-    
+
     // don't allow required fields without default value 
     // to be dropped on the statusbar
     if (folder.name === OB.Personalization.STATUSBAR_GROUPNAME) {
@@ -201,25 +206,24 @@
         }
       }
     }
-    
-//    
-//    // check if the nodes are all dropped on their current parent
-//    // in the same place they are now (note index + i is done, as
-//    // index is not an array)
-//    // if that's the case then just return to not get a datachanged
-//    // event
-//    changed = false;
-//    for (i = 0; i < nodes.length; i++) {
-//      if (nodes[i].parentName !== folder.name || 
-//          this.data.indexOf(nodes[i]) !== (index + i)) {
-//        changed = true;
-//        break;
-//      }
-//    }
-//    if (!changed) {
-//      return;
-//    }
-    
+
+    //    
+    //    // check if the nodes are all dropped on their current parent
+    //    // in the same place they are now (note index + i is done, as
+    //    // index is not an array)
+    //    // if that's the case then just return to not get a datachanged
+    //    // event
+    //    changed = false;
+    //    for (i = 0; i < nodes.length; i++) {
+    //      if (nodes[i].parentName !== folder.name || 
+    //          this.data.indexOf(nodes[i]) !== (index + i)) {
+    //        changed = true;
+    //        break;
+    //      }
+    //    }
+    //    if (!changed) {
+    //      return;
+    //    }
     // folders can not be dropped outside of the main group
     for (i = 0; i < length; i++) {
       if (nodes[i].isFolder && (!folder || folder.name !== OB.Personalization.MAIN_GROUPNAME)) {
@@ -227,10 +231,10 @@
       }
       nodes[i].isStatusBarField = (folder.name === OB.Personalization.STATUSBAR_GROUPNAME);
     }
-    
+
     this.Super('folderDrop', arguments);
   },
-  
+
   // show hidden items in a different style
   getBaseStyle: function (record, rowNum, colNum) {
     if (record.hiddenInForm) {
@@ -238,35 +242,37 @@
     }
     return this.baseStyle;
   },
-  
+
   // no context menu on folders
-  folderContextClick: function(me, record, recordNum) {
+  folderContextClick: function (me, record, recordNum) {
     return false;
   },
-  
+
   // overridden to create context menu items specific 
   // for the clicked record
-  cellContextClick: function(record, rowNum, colNum) {
+  cellContextClick: function (record, rowNum, colNum) {
     // select when right clicking, this can have some side effects
     // focus and menus appearing/disappearing, check if this happens
     this.deselectAllRecords();
     this.selectRecord(record);
-    
+
     // create the context items for the clicked record
     this.cellContextItems = this.createCellContextItems(record);
     // continue with normal behavior
     return true;
   },
-  
+
   // the menu entries when right clicking a field, different menu
   // entries are shown for status bar or normal fields
-  createCellContextItems: function(record){
-    var i, menuItems = [], updatePropertyFunction, me = this,
-      personalizeForm = this.personalizeForm, length, allNodes;
-    
-    updatePropertyFunction = function(record, property, value) {
+  createCellContextItems: function (record) {
+    var i, menuItems = [],
+        updatePropertyFunction, me = this,
+        personalizeForm = this.personalizeForm,
+        length, allNodes;
+
+    updatePropertyFunction = function (record, property, value) {
       record[property] = value;
-      
+
       // make sure only one record has first focus
       if (record.firstFocus) {
         allNodes = personalizeForm.fieldsTreeGrid.data.getAllNodes();
@@ -288,62 +294,61 @@
       } else {
         personalizeForm.propertiesLayout.formLayout.form.setValue(property, value);
       }
-      
+
       // this will reset everything
       personalizeForm.changed();
     };
-    
+
     // status status bar fields can be hidden but not removed (as they
     // do not exist on the rest of the form)
     if (record.isStatusBarField) {
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_Personalization_Displayed'),
         checked: !record.hiddenInForm,
-        click: function() {
+        click: function () {
           updatePropertyFunction(record, 'hiddenInForm', !record.hiddenInForm);
-        }        
+        }
       });
     } else {
       // for normal nodes, show some properties which can be changed
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_Personalization_Startrow'),
         checked: record.startRow,
-        click: function() {
+        click: function () {
           updatePropertyFunction(record, 'startRow', !record.startRow);
-        }        
+        }
       });
-      
+
       if (record.wasOnStatusBarField || !record.required || record.hasDefaultValue) {
         menuItems.add({
           title: OB.I18N.getLabel('OBUIAPP_Personalization_Displayed'),
           checked: !record.hiddenInForm,
-          click: function() {
+          click: function () {
             updatePropertyFunction(record, 'hiddenInForm', !record.hiddenInForm);
-          }        
+          }
         });
       }
-      
+
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_Personalization_FirstFocus'),
         checked: record.firstFocus,
-        click: function() {
+        click: function () {
           updatePropertyFunction(record, 'firstFocus', !record.firstFocus);
-        }        
+        }
       });
     }
 
     return menuItems;
   },
-  
-  redraw: function() {
+
+  redraw: function () {
     this.computeNodeIcons();
     this.Super('redraw', arguments);
   },
-  
-  computeNodeIcons: function(nodes) {
-    var iconSuffix, node, i, 
-      data = nodes || this.data.getAllNodes(),
-      length = data.length;
+
+  computeNodeIcons: function (nodes) {
+    var iconSuffix, node, i, data = nodes || this.data.getAllNodes(),
+        length = data.length;
     for (i = 0; i < length; i++) {
       node = data[i];
       if (node.isFolder) {
@@ -362,4 +367,4 @@
       node.icon = OB.Styles.Personalization.Icons['field' + iconSuffix];
     }
   }
-});
+});
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalization.js	Sat Feb 11 16:43:01 2012 +0100
@@ -29,8 +29,8 @@
 //  to update the real form. It is called from the standard window
 //
 OB.Personalization = {
-  STATUSBAR_GROUPNAME : '_statusBar',
-  MAIN_GROUPNAME : '_main'
+  STATUSBAR_GROUPNAME: '_statusBar',
+  MAIN_GROUPNAME: '_main'
 };
 
 // ** {{{OB.Personalization.getPersonalizationDataFromForm}}} **
@@ -39,9 +39,9 @@
 // If an existing personalization data is passed in then that one is
 // used as the basis. This can be used to make sure that the 
 // personalizationData used is up-to-date with the current form fields.
-OB.Personalization.getPersonalizationDataFromForm = function(form) {
-  var i, dataFields = [], statusBarFields, length, record,
-    origPersonalizationData = form && form.view ? form.view.getFormPersonalization(true) : null;
+OB.Personalization.getPersonalizationDataFromForm = function (form) {
+  var i, dataFields = [],
+      statusBarFields, length, record, origPersonalizationData = form && form.view ? form.view.getFormPersonalization(true) : null;
 
   // just use the personalization data which was used on the 
   // form, we can not reconstruct it completely from the form fields
@@ -50,7 +50,7 @@
   if (origPersonalizationData && origPersonalizationData.form) {
     dataFields = origPersonalizationData.form.fields;
   }
-  
+
   // create the statusbar array so we don't use the one from the form
   if (dataFields && dataFields.length > 0) {
     statusBarFields = [];
@@ -65,8 +65,7 @@
   // update with the form data, new fields may have been added, titles
   // may have changed etc.
   // the content of dataFields will be updated
-  this.updatePersonalizationDataFromFields(dataFields, form.getFields(), 
-      statusBarFields || form.statusBarFields);
+  this.updatePersonalizationDataFromFields(dataFields, form.getFields(), statusBarFields || form.statusBarFields);
 
   // set the first focus field
   if (form.firstFocusedField) {
@@ -75,20 +74,21 @@
       record.firstFocus = true;
     }
   }
-  
+
   // if there was already a personalization object, then re-use
   // everything except the fields
   if (origPersonalizationData) {
     return isc.addProperties({}, origPersonalizationData, {
-        form: {
-          fields : dataFields
-        }
+      form: {
+        fields: dataFields
+      }
     });
   }
-  
+
   // and return in the expected format
-  return { form: {
-      fields : dataFields
+  return {
+    form: {
+      fields: dataFields
     }
   };
 };
@@ -97,9 +97,9 @@
 // will update the personalization data from a form, this to handle addition 
 // of new fields in the AD, changes in required and the title and removal of
 // fields.
-OB.Personalization.updatePersonalizationDataFromFields = function(dataFields, fields, statusBarFields) {
+OB.Personalization.updatePersonalizationDataFromFields = function (dataFields, fields, statusBarFields) {
   var fld, j, record, i, dataField, undef, length;
-  
+
   // required and title and removal of fields
   // length is recomputed every time as fields can be removed
   // note: not factored out in a separate length attribute,
@@ -109,21 +109,20 @@
     fld = fields.find('name', dataField.name);
     if (fld) {
       dataField.required = fld.required;
-      dataField.hasDisplayLogic = 
-          fld.hasShowIf === true || (fld.showIf !== undef && !isc.isA.OBSectionItem(fld));
+      dataField.hasDisplayLogic = fld.hasShowIf === true || (fld.showIf !== undef && !isc.isA.OBSectionItem(fld));
       // disabled extra * for now, as we have an icon for it
-//      if (false && dataField.required) {
-//        if (isc.Page.isRTL()) {
-//          dataField.title = '* ' + fld.title;       
-//        } else {
-//          dataField.title = fld.title + ' *';       
-//        }
-//      } else {
-        dataField.title = fld.title;
-        if (fld.sectionExpanded) {
-          dataField.sectionExpanded = true;
-        }
-//      }
+      //      if (false && dataField.required) {
+      //        if (isc.Page.isRTL()) {
+      //          dataField.title = '* ' + fld.title;       
+      //        } else {
+      //          dataField.title = fld.title + ' *';       
+      //        }
+      //      } else {
+      dataField.title = fld.title;
+      if (fld.sectionExpanded) {
+        dataField.sectionExpanded = true;
+      }
+      //      }
     } else if (!dataField.isSystemFolder) {
       // field has been removed, remove it
       // can be a folder
@@ -155,22 +154,22 @@
 
   if (!dataFields.find('name', OB.Personalization.MAIN_GROUPNAME)) {
     dataFields.push({
-      isFolder : true,
+      isFolder: true,
       isSystemFolder: true,
       canDrag: false,
-      title : OB.I18N.getLabel('OBUIAPP_Personalization_Main_Group'),
-      name : OB.Personalization.MAIN_GROUPNAME,
-      isSection : true,
+      title: OB.I18N.getLabel('OBUIAPP_Personalization_Main_Group'),
+      name: OB.Personalization.MAIN_GROUPNAME,
+      isSection: true,
       displayed: true,
-      _canEdit : false
+      _canEdit: false
     });
   }
-  
+
   // iterate over the fields of the form and handle sections and fields
   length = fields.length;
   for (i = 0; i < length; i++) {
     fld = fields[i];
-    
+
     if (fld.personalizable === false) {
       continue;
     }
@@ -189,27 +188,27 @@
       // section items are shown as folders which can not be dragged
       // or edited
       record = {
-        isFolder : true,
-        _canEdit : false,
-        isSection : true,
+        isFolder: true,
+        _canEdit: false,
+        isSection: true,
         // the childNames are used below to resolve parent names
-        childNames : fld.itemIds, 
-        title : fld.title,
-        name : fld.name
+        childNames: fld.itemIds,
+        title: fld.title,
+        name: fld.name
       };
     } else {
       record = {
-        title : fld.title,
-        name : fld.name,
-        hiddenInForm : fld.hiddenInForm,
-        startRow : fld.startRow,
-        colSpan : fld.colSpan,
+        title: fld.title,
+        name: fld.name,
+        hiddenInForm: fld.hiddenInForm,
+        startRow: fld.startRow,
+        colSpan: fld.colSpan,
         required: fld.required,
         hasDefaultValue: fld.hasDefaultValue,
-        rowSpan : fld.rowSpan
+        rowSpan: fld.rowSpan
       };
     }
-    
+
     // is used below to get rid of non-displayed fields which 
     // are not part of the statusbar, explicit equals to false
     // as it might not be set
@@ -218,7 +217,7 @@
     } else {
       record.displayed = true;
     }
-    
+
     // and keep what we computed
     dataFields.push(record);
   }
@@ -256,14 +255,14 @@
   length = dataFields.length;
   for (i = length - 1; i >= 0; i--) {
     record = dataFields[i];
-    
+
     // do not consider the not-displayed ones which are not
     // part of the statusbar, these have item type
     // hidden which means that we can not visualize them, except
     // in the statusbar
     // explicit equals to false as displayed might not be set
     if (!record.isStatusBarField && !record.displayed) {
-      dataFields.removeAt(i); 
+      dataFields.removeAt(i);
     } else if (!record.parentName && !record.isSystemFolder) {
       // otherwise add to the main group
       record.parentName = OB.Personalization.MAIN_GROUPNAME;
@@ -276,9 +275,9 @@
 // a complete window (an instance of ob-standard-window). 
 // Also handles the case that a personalization record is deleted so that the
 // form falls back to the default state
-OB.Personalization.personalizeWindow = function(data, window) {
-  var tabId, personalizationData, undef, form, view, 
-    i, viewsToReset = [], done, length;
+OB.Personalization.personalizeWindow = function (data, window) {
+  var tabId, personalizationData, undef, form, view, i, viewsToReset = [],
+      done, length;
 
   // no personalization, nothing to do
   if (!data) {
@@ -290,16 +289,18 @@
   length = window.views.length;
   for (i = 0; i < length; i++) {
     if (window.getFormPersonalization(window.views[i], true)) {
-      viewsToReset.push({tabId: window.views[i].tabId});
+      viewsToReset.push({
+        tabId: window.views[i].tabId
+      });
     }
   }
-  
+
   // iterate over the tabs
   for (tabId in data) {
     if (data.hasOwnProperty(tabId)) {
       personalizationData = data[tabId];
       view = window.getView(tabId);
-      
+
       done = viewsToReset.find('tabId', tabId);
       if (done) {
         viewsToReset.remove(done);
@@ -311,7 +312,7 @@
       if (personalizationData && view) {
         OB.Personalization.personalizeForm(personalizationData, view.viewForm);
       }
-      
+
       // the personalization button has 2 icons: one 2 show that there is
       // a personalization and one that doesn't
       // this can be changed, update the state
@@ -320,35 +321,35 @@
       }
     }
   }
-  
+
   // a personalization may have been removed, reset the form
   // to its original state
   length = viewsToReset.length;
   for (i = 0; i < length; i++) {
     view = window.getView(viewsToReset[i].tabId);
-    
+
     // the personalization button has 2 icons: one 2 show that there is
     // a personalization and one that doesn't
     // this can be changed, update the state
     if (view) {
       view.toolBar.updateButtonState(false);
     }
-    
+
     if (view.viewForm.originalStatusBarFields) {
-      view.viewForm.statusBarFields = view.viewForm.originalStatusBarFields; 
+      view.viewForm.statusBarFields = view.viewForm.originalStatusBarFields;
     }
     if (view.viewForm.originalFirstFocusedField !== undef) {
       view.viewForm.firstFocusedField = view.viewForm.originalFirstFocusedField;
     }
-    
+
     // always clone the fields as the setFields changes their content
     // and you can not call setFields with content which has already
     // been passed to it
     view.viewForm.setFields(isc.shallowClone(view.viewForm._originalFields));
-  
+
     // the status bar fields may have changed
     view.statusBar.updateContentTitle(view.viewForm.getStatusBarFields());
-    
+
     // redraw the form for the changes
     view.viewForm.markForRedraw();
   }
@@ -357,11 +358,10 @@
 // ** {{{OB.Personalization.personalizeForm}}} **
 // Applies the data structure which contains the personalization settings to a
 // form.
-OB.Personalization.personalizeForm = function(data, form) {
-  var persId, i, j, fld, undef, fldDef, 
-    childFld, newField, newFields = [], record, length, 
-    allChildFieldsHidden, statusBarFields = [];
-  
+OB.Personalization.personalizeForm = function (data, form) {
+  var persId, i, j, fld, undef, fldDef, childFld, newField, newFields = [],
+      record, length, allChildFieldsHidden, statusBarFields = [];
+
   // work further with the fields themselves
   data = data.form.fields;
 
@@ -388,7 +388,7 @@
     // original name is used when a field is visible in the status bar
     // and also on the form
     fld = form.getField(record.name);
-    
+
     // use the originalFields as we are then sure
     // that we do not get ready build form items
     // but just the original simple objects
@@ -403,7 +403,7 @@
     if (form.isPreviewForm && !fldDef.personalizable) {
       continue;
     }
-    
+
     // set the first focused field
     if (record.firstFocus) {
       form.firstFocusedField = record.name;
@@ -490,7 +490,7 @@
 
   // and show me the stuff!
   form.markForRedraw();
-  
+
   if (form.statusBar) {
     // the preview form has a direct reference to the statusbar
     form.statusBar.updateContentTitle(form.getStatusBarFields());
@@ -498,4 +498,4 @@
     // when opened directly from a form
     form.view.statusBar.updateContentTitle(form.getStatusBarFields());
   }
-};
+};
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js	Sat Feb 11 16:43:01 2012 +0100
@@ -11,7 +11,7 @@
  * 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): ___________
  ************************************************************************
@@ -21,15 +21,14 @@
 // Registers buttons to open the form layout manager from a normal form/grid
 // view and from the Window Personalization view.
 (function () {
-  var personalizationButtonProperties, 
-    windowPersonalizationTabButtonProperties;
+  var personalizationButtonProperties, windowPersonalizationTabButtonProperties;
 
   personalizationButtonProperties = {
-    action: function() {
+    action: function () {
       var tabIdentifier, personalizeForm;
-      
+
       if (!OB.Utilities.checkProfessionalLicense(
-          OB.I18N.getLabel('OBUIAPP_ActivateMessagePersonalization'))) {
+      OB.I18N.getLabel('OBUIAPP_ActivateMessagePersonalization'))) {
         return;
       }
 
@@ -38,7 +37,7 @@
       } else {
         tabIdentifier = this.view.standardWindow.tabTitle + ' - ' + this.view.tabTitle;
       }
-      
+
       personalizeForm = isc.OBPersonalizeFormLayout.create({
         form: this.view.viewForm,
         openedInForm: true,
@@ -50,13 +49,12 @@
     disabled: false,
     buttonType: 'personalization',
     prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_Button'),
-    updateState: function(){
+    updateState: function () {
       var propValue, undef;
-      
+
       // set it 
       if (this.userWindowPersonalizationAllowed === undef) {
-        propValue = OB.PropertyStore.get('OBUIAPP_WindowPersonalization_Override', 
-            this.view.standardWindow ? this.view.standardWindow.windowId : null);
+        propValue = OB.PropertyStore.get('OBUIAPP_WindowPersonalization_Override', this.view.standardWindow ? this.view.standardWindow.windowId : null);
         if (propValue === 'false' || propValue === 'N') {
           this.userWindowPersonalizationAllowed = false;
         } else {
@@ -72,25 +70,26 @@
     },
     keyboardShortcutId: 'ToolBar_Personalization'
   };
-  
-  OB.ToolbarRegistry.registerButton(personalizationButtonProperties.buttonType, 
-      isc.OBToolbarIconButton, personalizationButtonProperties, 310, null);
+
+  OB.ToolbarRegistry.registerButton(personalizationButtonProperties.buttonType, isc.OBToolbarIconButton, personalizationButtonProperties, 310, null);
 
   // and register the toolbar button the window personalization tab  
   windowPersonalizationTabButtonProperties = {
-    action: function() {
-      var personalizationData = {}, personalizeForm, view = this.view, grid = view.viewGrid,
-        record = grid.getSelectedRecord();
+    action: function () {
+      var personalizationData = {},
+          personalizeForm, view = this.view,
+          grid = view.viewGrid,
+          record = grid.getSelectedRecord();
       if (record.value) {
         personalizationData = isc.JSON.decode(record.value);
       }
       personalizationData.personalizationId = record.id;
       personalizationData.canDelete = false;
-      
+
       personalizeForm = isc.OBPersonalizeFormLayout.create({
         personalizationData: personalizationData,
-        
-        maintenanceView: view, 
+
+        maintenanceView: view,
         openedFromMaintenanceWindow: true,
 
         tabId: record.tab,
@@ -102,18 +101,20 @@
         roleId: record.visibleAtRole,
         roleIdentifier: record['visibleAtRole._identifier'],
         userId: record.user,
-        userIdentifier: record['user._identifier']        
+        userIdentifier: record['user._identifier']
       });
       personalizeForm.doOpen();
     },
     disabled: false,
     buttonType: 'edit_personalization',
     prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_Edit_Button'),
-    updateState: function(){
-      var view = this.view, form = view.viewForm, 
-        grid = view.viewGrid, length, 
-        selectedRecords = grid.getSelectedRecords(), i;
-      
+    updateState: function () {
+      var view = this.view,
+          form = view.viewForm,
+          grid = view.viewGrid,
+          length, selectedRecords = grid.getSelectedRecords(),
+          i;
+
       // only show for records which can be edited
       if (selectedRecords.length !== 1) {
         this.setDisabled(true);
@@ -137,18 +138,15 @@
         }
       }
       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 !== 1);
+        this.setDisabled(view.readOnly || view.singleRecord || !view.hasValidState() || !grid.getSelectedRecords() || grid.getSelectedRecords().length !== 1);
       }
     },
     keyboardShortcutId: 'ToolBar_Personalization_Edit'
   };
-  
+
   // register only for the window personalization tab
-  OB.ToolbarRegistry.registerButton(windowPersonalizationTabButtonProperties.buttonType, isc.OBToolbarIconButton, 
-      windowPersonalizationTabButtonProperties, 320, 'FF8081813157AED2013157BF6D810023');
-  
-}());
+  OB.ToolbarRegistry.registerButton(windowPersonalizationTabButtonProperties.buttonType, isc.OBToolbarIconButton, windowPersonalizationTabButtonProperties, 320, 'FF8081813157AED2013157BF6D810023');
+
+}());
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js	Sat Feb 11 16:31:48 2012 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form.js	Sat Feb 11 16:43:01 2012 +0100
@@ -69,18 +69,18 @@
 
   // the datastructure with personalization information
   personalizationData: null,
-  
+
   // identifiers displayed in the statusbar of the form personalizer
   tabIdentifier: null,
   clientIdentifier: null,
   orgIdentifier: null,
   roleIdentifier: null,
   userIdentifier: null,
-  
+
   // are used to set a personalization record on the most
   // detailed user level, is not used if personalizationId
   // is set
-  clientId:null,
+  clientId: null,
   orgId: null,
   roleId: null,
   userId: null,
@@ -89,20 +89,20 @@
   isNew: false,
   isChanged: false,
   isSaved: false,
-  
+
   // should the caller be refreshed or not
   hasBeenSaved: false,
-  
+
   // the form instance shown to the user
   previewForm: null,
-  
+
   // retrieved from the server
   previewFormProperties: null,
-  
-  initWidget: function() {
-    
+
+  initWidget: function () {
+
     this.initializing = true;
-    
+
     this.createAddToolbar();
     this.createAddStatusbar();
     this.createAddMainLayout();
@@ -111,42 +111,50 @@
 
   // everything except the toolbar and statusbar in the top, some inner 
   // parts are created later (see buildPreviewForm)
-  createAddMainLayout: function() {
-    var me = this, fieldsTabSet, leftLayout, mainLayout = isc.VLayout.create({}, OB.Styles.Personalization.MainLayout);
-    
-    this.fieldsLayout = isc.Layout.create({height: '100%'}, OB.Styles.Personalization.FieldsLayout);
-    
+  createAddMainLayout: function () {
+    var me = this,
+        fieldsTabSet, leftLayout, mainLayout = isc.VLayout.create({}, OB.Styles.Personalization.MainLayout);
+
+    this.fieldsLayout = isc.Layout.create({
+      height: '100%'
+    }, OB.Styles.Personalization.FieldsLayout);
+
     fieldsTabSet = isc.OBTabSet.create({
-        height: '*',
-          
-        initWidget: function(){
-          // copy the tabBarProperties as it is coming from
-          // OB.Styles.Personalization.TabSet which is also used
-          // by the other tabsets
-          this.tabBarProperties = isc.addProperties({}, this.tabBarProperties);
-          this.tabBarProperties.tabSet = this;
-          this.tabBarProperties.itemClick = function(item, itemNum){
-            me.propertiesTabSet.toggleVisualState();
-          };
-          this.Super('initWidget', arguments);
-        }
-      }, OB.Styles.Personalization.TabSet);
+      height: '*',
+
+      initWidget: function () {
+        // copy the tabBarProperties as it is coming from
+        // OB.Styles.Personalization.TabSet which is also used
+        // by the other tabsets
+        this.tabBarProperties = isc.addProperties({}, this.tabBarProperties);
+        this.tabBarProperties.tabSet = this;
+        this.tabBarProperties.itemClick = function (item, itemNum) {
+          me.propertiesTabSet.toggleVisualState();
+        };
+        this.Super('initWidget', arguments);
+      }
+    }, OB.Styles.Personalization.TabSet);
 
     fieldsTabSet.addTab({
       title: OB.I18N.getLabel('OBUIAPP_Personalization_HeaderFields'),
       pane: this.fieldsLayout
     });
-    
+
     this.previewTabSet = isc.OBTabSet.create(OB.Styles.Personalization.TabSet);
     this.previewTabSet.addTab({
       title: OB.I18N.getLabel('OBUIAPP_Personalization_HeaderPreview')
     });
-    
-    leftLayout = isc.VLayout.create({height: '100%'}, OB.Styles.Personalization.FormPersonalizerLeftPane);
+
+    leftLayout = isc.VLayout.create({
+      height: '100%'
+    }, OB.Styles.Personalization.FormPersonalizerLeftPane);
     leftLayout.addMember(fieldsTabSet);
     leftLayout.addMember(this.createPropertiesLayout());
 
-    this.managementLayout = isc.HLayout.create({height: '100%', width: '100%'}, OB.Styles.Personalization.ManagementLayout);
+    this.managementLayout = isc.HLayout.create({
+      height: '100%',
+      width: '100%'
+    }, OB.Styles.Personalization.ManagementLayout);
     this.managementLayout.addMember(leftLayout);
     this.managementLayout.addMember(this.previewTabSet);
     mainLayout.addMember(this.managementLayout);
@@ -156,15 +164,13 @@
 
   // creates the properties layout which contains the form
   // with a few buttons
-  createPropertiesLayout: function() {
-    var NumericField, CheckboxField,
-      propertiesLayout = 
-        isc.Layout.create(OB.Styles.Personalization.PropertiesLayout);
-    
+  createPropertiesLayout: function () {
+    var NumericField, CheckboxField, propertiesLayout = isc.Layout.create(OB.Styles.Personalization.PropertiesLayout);
+
     // a backpointer
     propertiesLayout.personalizeForm = this;
-      
-    CheckboxField = function(props){
+
+    CheckboxField = function (props) {
       if (props) {
         isc.addProperties(this, props);
       }
@@ -177,13 +183,13 @@
       // HACK: when a checkbox does not have focus and you click
       // the first click is lost, does not happen in normal OBViewForm
       // TODO: research why this happens
-      handleCellClick: function() {
+      handleCellClick: function () {
         this.fromCellClick = true;
         var ret = this.Super('handleClick', arguments);
         delete this.fromCellClick;
         return ret;
       },
-      handleClick: function() {
+      handleClick: function () {
         if (!this.fromCellClick) {
           // cellclick will also be called
           return true;
@@ -191,8 +197,8 @@
         return this.Super('handleClick', arguments);
       }
     };
-    
-    NumericField = function(props){
+
+    NumericField = function (props) {
       if (props) {
         isc.addProperties(this, props);
       }
@@ -216,68 +222,64 @@
     };
 
     propertiesLayout.formLayout = isc.VStack.create({
-        align: 'center',
-        overflow: 'visible',
-        height: 1,
-        visible: false,
-        width: '100%'
-      });
+      align: 'center',
+      overflow: 'visible',
+      height: 1,
+      visible: false,
+      width: '100%'
+    });
 
     propertiesLayout.formLayout.form = isc.DynamicForm.create({
       personalizeForm: this,
       overflow: 'visible',
       numCols: 2,
       width: '100%',
-     
+
       titleSuffix: '</b>',
       titlePrefix: '<b>',
       requiredTitleSuffix: ' *</b>',
       requiredRightTitlePrefix: '<b>* ',
       rightTitlePrefix: '<b>',
       rightTitleSuffix: '</b>',
-     
+
       errorsPreamble: '',
       showErrorIcons: false,
       showErrorStyle: true,
       showInlineErrors: true,
-      
+
       fields: [
-         new NumericField({
-           name: 'colSpan',
-           keyPressFilter: '[1-4]',
-           min: 1,
-           max: 4,
-           title: OB.I18N.getLabel('OBUIAPP_Personalization_Colspan')
-         }),
-         new NumericField({
-           name: 'rowSpan',
-           keyPressFilter: '[1-9]',
-           min: 1,
-           max: 9,
-           required: true,
-           title: OB.I18N.getLabel('OBUIAPP_Personalization_Rowspan')
-         }),
-         new CheckboxField({
-           name: 'startRow',
-           startRow: true,
-           title: OB.I18N.getLabel('OBUIAPP_Personalization_Startrow')
-         }),
-        new CheckboxField({
-          name: 'displayed',
-          startRow: true,
-          title: OB.I18N.getLabel('OBUIAPP_Personalization_Displayed')
-        }),
-        new CheckboxField({
-          name: 'firstFocus',
-          startRow: true,
-          title: OB.I18N.getLabel('OBUIAPP_Personalization_FirstFocus')
-        })
-      ],
-      
+      new NumericField({
+        name: 'colSpan',
+        keyPressFilter: '[1-4]',
+        min: 1,
+        max: 4,
+        title: OB.I18N.getLabel('OBUIAPP_Personalization_Colspan')
+      }), new NumericField({
+        name: 'rowSpan',
+        keyPressFilter: '[1-9]',
+        min: 1,
+        max: 9,
+        required: true,
+        title: OB.I18N.getLabel('OBUIAPP_Personalization_Rowspan')
+      }), new CheckboxField({
+        name: 'startRow',
+        startRow: true,
+        title: OB.I18N.getLabel('OBUIAPP_Personalization_Startrow')
+      }), new CheckboxField({
+        name: 'displayed',
+        startRow: true,
+        title: OB.I18N.getLabel('OBUIAPP_Personalization_Displayed')
+      }), new CheckboxField({
+        name: 'firstFocus',
+        startRow: true,
+        title: OB.I18N.getLabel('OBUIAPP_Personalization_FirstFocus')
+      })],
+
       // is called when a field in the tree is clicked
-      setRecord: function(record) {
-        var fld, i = 0, length = this.getFields().length;
-        
+      setRecord: function (record) {
+        var fld, i = 0,
+            length = this.getFields().length;
+
         this.record = record;
 
         for (i = 0; i < length; i++) {
@@ -289,7 +291,7 @@
             this.setValue(fld.name, record[fld.name]);
           }
         }
-        
+
         // hide some fields, static status bar fields only need the
         // hidden fields and not the other ones
         if (record.isStatusBarField) {
@@ -303,27 +305,27 @@
           this.showItem('firstFocus');
           this.showItem('startRow');
         }
-        
+
         if (!record.wasOnStatusBarField && !record.isStatusBarField && record.required && !record.hasDefaultValue) {
           this.hideItem('displayed');
         } else {
           this.showItem('displayed');
         }
-        
+
         this.rememberValues();
       },
-      
+
       // store the values in the record
-      doSave: function() {
+      doSave: function () {
         var i, allNodes, length;
-        
+
         // don't save if there are errors
         // could be an idea to disable the save button
         this.validate();
         if (this.hasErrors()) {
           return;
         }
-        
+
         // only one field may have first focus
         // first get rid of all first focus if it was set now
         if (this.getValue('firstFocus')) {
@@ -335,7 +337,7 @@
             }
           }
         }
-        
+
         // now it will be set, maximum one field will have 
         // the focus now
         this.record.hiddenInForm = !this.getValue('displayed');
@@ -346,7 +348,7 @@
 
         this.rememberValues();
         this.focus();
-        
+
         // items may have been hidden, which changes their colour
         // so rebuild the tree
         this.personalizeForm.fieldsTreeGrid.markForRedraw();
@@ -354,48 +356,46 @@
         // this will reset everything
         this.personalizeForm.changed();
       },
-      
-      doCancel: function() {
+
+      doCancel: function () {
         this.reset();
         this.focus();
       },
-      
+
       // called when a field in the form changes
       // enable the apply/cancel buttons
-      itemChanged: function(item, newValue) {
+      itemChanged: function (item, newValue) {
         this.doSave();
       }
     });
-    
+
     propertiesLayout.formLayout.addMembers(propertiesLayout.formLayout.form);
-    
+
     // the empty message is shown when no field is selected on the left
-    propertiesLayout.emptyMessage = 
-      isc.Layout.create({
-        margin: 5,
-        members: [
-          isc.Label.create({
-            width: '100%',
-            height: 1,
-            overflow: 'visible',
-            contents: OB.I18N.getLabel('OBUIAPP_Personalization_PropertiesFormEmptyMessage')
-          })
-        ]
-      });
-    
+    propertiesLayout.emptyMessage = isc.Layout.create({
+      margin: 5,
+      members: [
+      isc.Label.create({
+        width: '100%',
+        height: 1,
+        overflow: 'visible',
+        contents: OB.I18N.getLabel('OBUIAPP_Personalization_PropertiesFormEmptyMessage')
+      })]
+    });
+
     propertiesLayout.addMember(propertiesLayout.formLayout);
     propertiesLayout.addMember(propertiesLayout.emptyMessage);
     propertiesLayout.hideMember(propertiesLayout.formLayout);
     propertiesLayout.showMember(propertiesLayout.emptyMessage);
-        
+
     this.propertiesLayout = propertiesLayout;
-    
+
     // put it all in a tabset...    
     this.propertiesTabSet = isc.OBTabSet.create(OB.Styles.Personalization.TabSet, {
       height: OB.Styles.Personalization.PropertiesTabSet.expandedHeight,
       expanded: true,
-      
-      toggleVisualState: function() {
+
+      toggleVisualState: function () {
         if (this.expanded) {
           this.setHeight(OB.Styles.Personalization.PropertiesTabSet.collapsedHeight);
           this.expanded = false;
@@ -404,10 +404,10 @@
           this.expanded = true;
         }
       },
-      
-      initWidget: function(){
+
+      initWidget: function () {
         this.tabBarProperties.tabSet = this;
-        this.tabBarProperties.itemClick = function(item, itemNum){
+        this.tabBarProperties.itemClick = function (item, itemNum) {
           this.tabSet.toggleVisualState();
         };
         this.Super('initWidget', arguments);
@@ -417,9 +417,9 @@
       title: OB.I18N.getLabel('OBUIAPP_Personalization_HeaderProperties'),
       pane: propertiesLayout
     });
-    
+
     // is called when a field in the tree is selected or unselected
-    propertiesLayout.updatePropertiesDisplay = function(record) {
+    propertiesLayout.updatePropertiesDisplay = function (record) {
       var newRecord;
       if (!record) {
         this.hideMember(this.formLayout);
@@ -435,20 +435,20 @@
       }
     };
     propertiesLayout.propertiesTabSet = this.propertiesTabSet;
-    
+
     return this.propertiesTabSet;
   },
-  
+
   // the status bar shows information about the personalization record
   // and it has the close button
-  createAddStatusbar: function() {
+  createAddStatusbar: function () {
     var owner = this;
     this.statusBar = isc.OBStatusBar.create({
       view: this,
       buttonBarProperties: OB.Styles.Personalization.buttonBarProperties,
-      
+
       // add the close button
-      addCreateButtons: function() {
+      addCreateButtons: function () {
         this.buttonBar.setWidth(1);
         this.buttonBar.setOverflow('visible');
         this.buttonBar.defaultLayoutAlign = 'center';
@@ -456,12 +456,11 @@
           view: this.view,
           buttonType: 'close',
           keyboardShortcutId: 'StatusBar_Close',
-          prompt: OB.I18N
-              .getLabel('OBUIAPP_Personalization_Statusbar_Close'),
-          action: function() {
+          prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Statusbar_Close'),
+          action: function () {
             var clz = (owner.getWindow() ? owner.getWindow().getClass() : null);
             if (!clz) {
-              owner.doClose();              
+              owner.doClose();
             } else if (!clz.autoSave) {
               owner.doClose();
             } else if (clz.showAutoSaveConfirmation) {
@@ -471,41 +470,39 @@
             }
           }
         }, OB.Styles.Personalization.closeButtonProperties);
-        this.buttonBar.addMembers([ closeButton ]);
+        this.buttonBar.addMembers([closeButton]);
       }
     });
     this.addMember(this.statusBar);
   },
 
   // the toolbar shows the save, delete and undo button
-  createAddToolbar: function() {
-    var saveButtonProperties, saveCloseButtonProperties, 
-      deleteButtonProperties, cancelButtonProperties,
-      restoreButtonProperties, restoreLayout;
+  createAddToolbar: function () {
+    var saveButtonProperties, saveCloseButtonProperties, deleteButtonProperties, cancelButtonProperties, restoreButtonProperties, restoreLayout;
 
     saveButtonProperties = {
-      action: function() {
+      action: function () {
         this.view.save();
       },
       disabled: true,
       buttonType: 'save',
       prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_Save'),
-      updateState: function() {
+      updateState: function () {
         this.setDisabled(this.view.hasNotChanged());
       },
       keyboardShortcutId: 'ToolBar_Save'
     };
 
     saveCloseButtonProperties = {
-      action: function() {
+      action: function () {
         this.view.saveAndClose();
       },
       saveDisabled: true,
       buttonType: 'savecloseX',
       prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_SaveClose'),
-      updateState: function() {
+      updateState: function () {
         this.saveDisabled = this.view.hasNotChanged();
-        
+
         if (this.saveDisabled) {
           this.buttonType = 'savecloseX';
           this.prompt = OB.I18N.getLabel('OBUIAPP_Personalization_Statusbar_Close');
@@ -519,74 +516,70 @@
     };
 
     deleteButtonProperties = {
-        action: function(){
-          this.view.deletePersonalization();
-        },
-        disabled: true,
-        buttonType: 'eliminate',
-        prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_Delete'),
-        updateState: function(){
-          // never allow delete when opened from the maintenance window
-          this.setDisabled(this.openedFromMaintenanceWindow || 
-              !this.view.form.view.getFormPersonalization(false) || 
-              !this.view.form.view.getFormPersonalization(false).canDelete);
-        },
-        keyboardShortcutId: 'ToolBar_Eliminate'
-      };
-    
+      action: function () {
+        this.view.deletePersonalization();
+      },
+      disabled: true,
+      buttonType: 'eliminate',
+      prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_Delete'),
+      updateState: function () {
+        // never allow delete when opened from the maintenance window
+        this.setDisabled(this.openedFromMaintenanceWindow || !this.view.form.view.getFormPersonalization(false) || !this.view.form.view.getFormPersonalization(false).canDelete);
+      },
+      keyboardShortcutId: 'ToolBar_Eliminate'
+    };
+
     cancelButtonProperties = {
-      action: function() {
+      action: function () {
         this.view.cancel();
       },
       disabled: true,
       buttonType: 'undo',
       prompt: OB.I18N.getLabel('OBUIAPP_Personalization_Toolbar_CancelEdit'),
-      updateState: function() {
+      updateState: function () {
         this.setDisabled(this.view.hasNotChanged());
       },
       keyboardShortcutId: 'ToolBar_Undo'
     };
-    
+
     restoreButtonProperties = {
-      action: function() {
+      action: function () {
         var i, standardWindow = this.view.getStandardWindow(),
-          viewDefinitions = standardWindow.getClass().originalView.viewDefinition,
-          length = standardWindow.views.length, view, viewTabDefinition;
+            viewDefinitions = standardWindow.getClass().originalView.viewDefinition,
+            length = standardWindow.views.length,
+            view, viewTabDefinition;
         for (i = 0; i < length; i++) {
           view = standardWindow.views[i];
           if (view.tabId !== this.view.tabId) {
             continue;
           }
           viewTabDefinition = viewDefinitions[view.tabId];
-          
+
           this.view.initializing = true;
-          
+
           this.view.destroyAndRemoveMembers(this.view.mainLayout);
           this.view.mainLayout = null;
           this.view.createAddMainLayout();
-          
+
           this.view.buildFieldsTreeGrid(viewTabDefinition);
           this.view.buildPreviewForm();
           this.view.fieldsTreeGrid.openFolders();
-          
+
           delete this.view.initializing;
           this.view.changed();
         }
       },
       title: OB.I18N.getLabel('OBUIAPP_RestoreDefaults'),
-      updateState: function() {
-//        this.setDisabled(this.view.hasNotChanged());
+      updateState: function () {
+        //        this.setDisabled(this.view.hasNotChanged());
       }
     };
-   
+
     this.toolBar = isc.OBToolbar.create({
       view: this,
-      leftMembers: [ isc.OBToolbarIconButton.create(saveButtonProperties),
-                     isc.OBToolbarIconButton.create(saveCloseButtonProperties),
-                     isc.OBToolbarIconButton.create(cancelButtonProperties),
-                     isc.OBToolbarIconButton.create(deleteButtonProperties)],
+      leftMembers: [isc.OBToolbarIconButton.create(saveButtonProperties), isc.OBToolbarIconButton.create(saveCloseButtonProperties), isc.OBToolbarIconButton.create(cancelButtonProperties), isc.OBToolbarIconButton.create(deleteButtonProperties)],
       rightMembers: [isc.OBToolbarTextButton.create(restoreButtonProperties)],
-      refreshCustomButtons: function(){
+      refreshCustomButtons: function () {
         this.rightMembers[0].updateState();
       }
     });
@@ -594,10 +587,10 @@
   },
 
   // save the new form layout to the server and updates the preview form
-  save: function(callback) {
-    var params, me = this, newDataFields, 
-      formPers = this.form.view.getFormPersonalization();
-    
+  save: function (callback) {
+    var params, me = this,
+        newDataFields, formPers = this.form.view.getFormPersonalization();
+
     // if there is a personalization id then use that
     // this ensures that a specific record will be updated
     // on the server
@@ -607,77 +600,75 @@
     // personalization data) and not the other parts
     if (formPers && formPers.personalizationId) {
       params = {
-          action: 'store',
-          target: 'form',
-          personalizationId: formPers.personalizationId
+        action: 'store',
+        target: 'form',
+        personalizationId: formPers.personalizationId
       };
-      
+
     } else {
       // this case is used if there is no personalization record
       // it will be created at the most detailed level: client, org, role and user
       params = {
-          action: 'store',
-          target: 'form',
-          clientId: this.clientId,
-          orgId: this.orgId,
-          roleId: this.roleId,
-          userId: this.userId,
-          tabId: this.tabId
+        action: 'store',
+        target: 'form',
+        clientId: this.clientId,
+        orgId: this.orgId,
+        roleId: this.roleId,
+        userId: this.userId,
+        tabId: this.tabId
       };
     }
 
     newDataFields = this.getPersonalizationFields();
-    
+
     // store the data, the reply can contain an id and also if the current
     // user may delete the record, this is allowed if the record is on
     // user level
-    OB.RemoteCallManager.call(
-        'org.openbravo.client.application.personalization.PersonalizationActionHandler', 
-        this.getPersonalizationFields(), params,
-        function(resp, data, req){
-          var personalization;
-          
-          // if there is no personalization data then create it
-          if (!me.personalizationData) {
-            me.personalizationData = {};
-          }
-          
-          // as the user can save, the user can also delete it
-          me.personalizationData.canDelete = true;          
-            
-          if (data && data.personalizationId) {
-            me.personalizationData.personalizationId = data.personalizationId;            
-          }
-          if (!me.personalizationData.form) {
-            me.personalizationData.form = {};
-          }
-          // overwrite what we have
-          me.personalizationData.form = newDataFields;
+    OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', this.getPersonalizationFields(), params, function (resp, data, req) {
+      var personalization;
 
-          me.form.view.standardWindow.updateFormPersonalization(me.form.view, me.personalizationData);
-          
-          me.initializing = true;
-          me.isNew = false;
-          me.isSaved = true;
-          me.isChanged = false;
-          me.hasBeenSaved = true;
-          me.setStatusBarInformation();
-          
-          // update the save, delete, undo buttons 
-          // delete can get enabled if canDelete was set to true
-          me.toolBar.updateButtonState();
-          
-          delete me.initializing;
-          if (callback) {
-            callback();
-          }
-        });
+      // if there is no personalization data then create it
+      if (!me.personalizationData) {
+        me.personalizationData = {};
+      }
+
+      // as the user can save, the user can also delete it
+      me.personalizationData.canDelete = true;
+
+      if (data && data.personalizationId) {
+        me.personalizationData.personalizationId = data.personalizationId;
+      }
+      if (!me.personalizationData.form) {
+        me.personalizationData.form = {};
+      }
+      // overwrite what we have
+      me.personalizationData.form = newDataFields;
+
+      me.form.view.standardWindow.updateFormPersonalization(me.form.view, me.personalizationData);
+
+      me.initializing = true;
+      me.isNew = false;
+      me.isSaved = true;
+      me.isChanged = false;
+      me.hasBeenSaved = true;
+      me.setStatusBarInformation();
+
+      // update the save, delete, undo buttons 
+      // delete can get enabled if canDelete was set to true
+      me.toolBar.updateButtonState();
+
+      delete me.initializing;
+      if (callback) {
+        callback();
+      }
+    });
   },
 
   // called when the delete button is called
-  deletePersonalization: function(confirmed) {
-    var me = this, callback;
-    
+  deletePersonalization: function (confirmed) {
+    var me = this,
+        callback;
+
     // only delete if we have a personalization id
     // this should always be the case
     if (!this.personalizationData.personalizationId) {
@@ -685,59 +676,55 @@
     }
 
     if (!confirmed) {
-      callback = function(ok) {
+      callback = function (ok) {
         if (ok) {
           me.deletePersonalization(true);
         }
       };
-      
+
       isc.ask(OB.I18N.getLabel('OBUIAPP_Personalization_ConfirmDelete'), callback);
       return;
     }
 
-    OB.RemoteCallManager.call(
-        'org.openbravo.client.application.personalization.PersonalizationActionHandler', 
-        {}, 
-        { 
-          personalizationId: this.personalizationData.personalizationId,
-          action: 'delete'
-        },
-        function(resp, data, req){
-          var personalization;
-          
-          me.hasBeenDeleted = true;
-          // close when returned
-          me.doClose(true);
-          
-          personalization = me.getStandardWindow().getClass().personalization;
-          personalization[me.tabId] = null;          
-        }
-     );
+    OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', {}, {
+      personalizationId: this.personalizationData.personalizationId,
+      action: 'delete'
+    }, function (resp, data, req) {
+      var personalization;
+
+      me.hasBeenDeleted = true;
+      // close when returned
+      me.doClose(true);
+
+      personalization = me.getStandardWindow().getClass().personalization;
+      personalization[me.tabId] = null;
+    });
   },
-  
+
   // the undo action, resets everything to the loaded, last-saved state
-  cancel: function(confirmed) {
-    var me = this, callback;
+  cancel: function (confirmed) {
+    var me = this,
+        callback;
     if (!confirmed) {
-      callback = function(ok) {
+      callback = function (ok) {
         if (ok) {
           me.cancel(true);
         }
       };
-      
+
       isc.ask(OB.I18N.getLabel('OBUIAPP_Personalization_ConfirmCancel'), callback);
       return;
     }
-    
+
     this.initializing = true;
     this.isChanged = false;
     this.isSaved = false;
     this.isNew = !this.personalizationData.personalizationId;
-    
+
     this.destroyAndRemoveMembers(this.mainLayout);
     this.mainLayout = null;
     this.createAddMainLayout();
-    
+
     this.buildFieldsTreeGrid();
     this.buildPreviewForm();
     this.setStatusBarInformation();
@@ -747,14 +734,14 @@
   },
 
   // shows the settings in the preview form
-  refresh: function() {
+  refresh: function () {
     this.buildPreviewForm();
   },
 
   // called when something changes in properties, ordering of fields
   // field in a different group etc.
   // will set the changed state which enables buttons
-  changed: function() {
+  changed: function () {
     // nothing to do when we are building everything
     // then changed is fired a few times
     if (this.initializing) {
@@ -765,25 +752,27 @@
     this.setStatusBarInformation();
     this.buildPreviewForm();
   },
-  
+
   // used by buttons to check if the state has changed
-  hasNotChanged: function() {
+  hasNotChanged: function () {
     return !this.isChanged;
   },
-  
+
   // creates the preview form and displays it
-  buildPreviewForm: function() {
+  buildPreviewForm: function () {
     var statusBar, currentPane, i, fld, itemClick, me = this;
-    
-    this.formLayout = isc.VLayout.create({ height: '100%', width: '100%'}, OB.Styles.Personalization.Preview);
-    
+
+    this.formLayout = isc.VLayout.create({
+      height: '100%',
+      width: '100%'
+    }, OB.Styles.Personalization.Preview);
+
     // add a status bar to the formlayout
     statusBar = isc.OBStatusBar.create({
-      addCreateButtons: function() {
-      }
+      addCreateButtons: function () {}
     });
     this.formLayout.addMember(statusBar);
-    
+
     // create the form and add it to the formLayout
     this.previewForm = isc.OBViewForm.create(isc.clone(OB.ViewFormProperties), this.previewFormProperties, {
       preventAllEvents: true,
@@ -791,36 +780,36 @@
       personalizeForm: this,
       isPreviewForm: true,
       autoFocus: false,
-      
+
       // overridden to prevent js errors when switching views
-      visibilityChanged: function() {}, 
-      
-      titleHoverHTML: function(item){
+      visibilityChanged: function () {},
+
+      titleHoverHTML: function (item) {
         return this.personalizeForm.getHoverHTML(null, item);
       },
-      
-      itemHoverHTML: function(item){
+
+      itemHoverHTML: function (item) {
         return this.personalizeForm.getHoverHTML(null, item);
       },
-      
+
       // overridden to always show a statusbar field with some spaces
       // even if the status bar field does not have a value (which it
       // does not have in the form preview)
-      getStatusBarFields: function() {
-        var statusBarFields = [[],[]], i, 
-          item, value, tmpValue, length = this.statusBarFields.length;
-        
-        for(i = 0; i < length; i++) {
+      getStatusBarFields: function () {
+        var statusBarFields = [[], []],
+            i, item, value, tmpValue, length = this.statusBarFields.length;
+
+        for (i = 0; i < length; i++) {
           item = this.getItem(this.statusBarFields[i]);
           statusBarFields[0].push(item.getTitle());
           statusBarFields[1].push('&nbsp;&nbsp&nbsp;');
-       }
+        }
         return statusBarFields;
       }
 
     });
-    
-    itemClick = function(item) {
+
+    itemClick = function (item) {
       // disabled clicking in the form itself as multiple things need to be 
       // solved:
       // - the cursor needs to become a pointer
@@ -829,25 +818,28 @@
       // - when the field is not in the viewport on the left then 
       //    it needs to be scrolled there
       // - we also need to support clicking in the status bar
-//      if (item.parentItem) {
-//        me.doHandlePreviewFormItemClick(item.parentItem);
-//      } else {
-//        me.doHandlePreviewFormItemClick(item);
-//      }
+      //      if (item.parentItem) {
+      //        me.doHandlePreviewFormItemClick(item.parentItem);
+      //      } else {
+      //        me.doHandlePreviewFormItemClick(item);
+      //      }
     };
-    
-    var persFields = this.getPersonalizationFields(), length;
+
+    var persFields = this.getPersonalizationFields(),
+        length;
     if (persFields) {
-      OB.Personalization.personalizeForm({form: persFields}, this.previewForm);
+      OB.Personalization.personalizeForm({
+        form: persFields
+      }, this.previewForm);
     }
-    
+
     // expand by default
     length = this.previewForm.getFields().length;
     for (i = 0; i < length; i++) {
       fld = this.previewForm.getFields()[i];
-      
+
       fld.showFocused = false;
-      
+
       // the personalizable is set in freemarker templates, for example
       // the audit and notes section are not personalizable and not shown
       // in the form preview
@@ -865,23 +857,23 @@
         }
       }
     }
-    
+
     this.formLayout.addMember(this.previewForm);
-    
+
     if (this.previewTabSet.getTab(0).pane) {
       currentPane = this.previewTabSet.getTab(0).pane;
-    }    
+    }
     this.previewTabSet.updateTab(this.previewTabSet.getTab(0), this.formLayout);
     if (currentPane) {
       currentPane.destroy();
     }
   },
-  
-  buildFormAndTree: function() {
+
+  buildFormAndTree: function () {
     var computedPersonalizationData;
-    
+
     this.buildPreviewForm();
-    
+
     // if no personalization data then we need to compute it from the form
     // the personalization data can also be set directly (when called from 
     // the maintenance window)
@@ -895,62 +887,54 @@
       if (!this.personalizationData) {
         this.personalizationData = {};
       }
-      
+
       // and copy over what got computed
       isc.addProperties(this.personalizationData, computedPersonalizationData);
     }
-    
+
     // personalize the preview form, this will remove any non-personalized
     // fields, which are also present in the preview form original field
     // list. Maybe in the future we can personalize these fields also
-    OB.Personalization.personalizeForm(this.personalizationData, 
-        this.previewForm);
-    
+    OB.Personalization.personalizeForm(this.personalizationData, this.previewForm);
+
     // new if no id
     this.isNew = !this.personalizationData.personalizationId;
 
     // handle changes in the AD, needs to be done before building the tree
-    OB.Personalization.updatePersonalizationDataFromFields(this.personalizationData.form.fields, 
-        this.previewForm.getFields(), this.previewForm.statusBarFields || []);
-    
+    OB.Personalization.updatePersonalizationDataFromFields(this.personalizationData.form.fields, this.previewForm.getFields(), this.previewForm.statusBarFields || []);
+
     this.buildFieldsTreeGrid();
-    
+
     this.setStatusBarInformation();
     this.fieldsTreeGrid.openFolders();
   },
-  
-  buildFieldsTreeGrid: function(personalizationData) {
+
+  buildFieldsTreeGrid: function (personalizationData) {
     var i, prop, fld, length;
-    
+
     personalizationData = personalizationData || this.personalizationData;
-    
+
     this.fieldsLayout.destroyAndRemoveMembers(this.fieldsLayout.getMembers());
     if (this.fieldsTreeGrid) {
       this.fieldsTreeGrid.destroy();
     }
-    
+
     // the tree will add properties to the objects as fieldData
     // when retrieving the data from the tree (getPersonalizationFields)
     // we only want these properties and not the original ones.
     // see the function getPersonalizationFields
     // add some default fields
-    this.personalizationDataProperties = [
-      'isStatusBarField', 'displayed', 'isSection',
-      'parentName', 'title', 'hiddenInForm',
-      'colSpan', 'rowSpan', 'required', 'sectionExpanded',
-      'startRow', 'name', 'hasDisplayLogic'
-    ];
+    this.personalizationDataProperties = ['isStatusBarField', 'displayed', 'isSection', 'parentName', 'title', 'hiddenInForm', 'colSpan', 'rowSpan', 'required', 'sectionExpanded', 'startRow', 'name', 'hasDisplayLogic'];
     length = personalizationData.form.fields.length;
     for (i = 0; i < length; i++) {
       fld = personalizationData.form.fields[i];
       for (prop in fld) {
-        if (fld.hasOwnProperty(prop) && 
-            !this.personalizationDataProperties.contains(prop)) {
+        if (fld.hasOwnProperty(prop) && !this.personalizationDataProperties.contains(prop)) {
           this.personalizationDataProperties.push(prop);
         }
       }
     }
-    
+
     // create the tree on the left, the tree only wants the fields
     // and nothing else
     this.fieldsTreeGrid = isc.OBPersonalizationTreeGrid.create({
@@ -958,17 +942,17 @@
       // updated, when doing cancel, the original is restored
       fieldData: isc.shallowClone(personalizationData.form.fields),
       personalizeForm: this,
-      selectionUpdated: function(record, recordList) {
+      selectionUpdated: function (record, recordList) {
         this.personalizeForm.selectionUpdated(record, recordList);
       }
     });
-    
+
     this.fieldsLayout.addMember(this.fieldsTreeGrid);
 
   },
-  
+
   // is called when something is clicked in the form
-  doHandlePreviewFormItemClick: function(item) {
+  doHandlePreviewFormItemClick: function (item) {
     // select the node in the tree 
     var treeNode = this.fieldsTreeGrid.data.find('name', item.name);
     this.fieldsTreeGrid.deselectAllRecords();
@@ -976,68 +960,68 @@
   },
 
   // is called when the selection changes in the tree
-  selectionUpdated: function(record, recordList) {
+  selectionUpdated: function (record, recordList) {
     if (record && !record.isSection && recordList.length === 1) {
       this.propertiesLayout.updatePropertiesDisplay(record);
     } else {
       this.propertiesLayout.updatePropertiesDisplay(null);
     }
   },
-  
-  saveAndClose: function() {
+
+  saveAndClose: function () {
     var view = this;
     if (this.hasNotChanged()) {
-      view.doClose(true);          
+      view.doClose(true);
     } else {
-      view.save(function() {
-        view.doClose(true);    
+      view.save(function () {
+        view.doClose(true);
       });
     }
   },
-  
-  getStandardWindow: function() {
+
+  getStandardWindow: function () {
     if (this.openedFromMaintenanceWindow) {
       return this.maintenanceView.standardWindow;
     } else {
       return this.form.view.standardWindow;
     }
   },
-  
+
   // close the form personalizer, refresh the existing form so that 
   // the changes are shown immediately, or if called from the 
   // maintenance window refresh the record there
-  doClose: function(confirmed) {
-    var callback, me = this, window;
-    
+  doClose: function (confirmed) {
+    var callback, me = this,
+        window;
+
     // ask for confirmation
     if (this.isChanged && !confirmed) {
-      callback = function(ok) {
+      callback = function (ok) {
         if (ok) {
           // do it with a small delay so that any mouse events are processed
           // by the button itself and not by the standard view below it
           me.delayCall('doClose', [true], 100);
         }
       };
-      
+
       isc.ask(OB.I18N.getLabel('OBUIAPP_Personalization_ConfirmClose'), callback);
       return;
     }
-    
+
     if (this.openedFromMaintenanceWindow) {
       window = this.maintenanceView.standardWindow;
     } else if (this.openedInForm) {
       if (this.hasBeenSaved || this.hasBeenDeleted) {
         // update the form in the view
-        OB.Personalization.personalizeForm(me.personalizationData, 
-            this.form.view.viewForm);
+        OB.Personalization.personalizeForm(me.personalizationData, this.form.view.viewForm);
       }
       window = this.form.view.standardWindow;
     }
     window.destroyAndRemoveMembers(this);
-    
+
     // restores the tabtitle
     window.view.updateTabTitle();
-    
+
     window.toolBarLayout.show();
     window.view.show();
 
@@ -1045,8 +1029,8 @@
       this.maintenanceView.refresh();
     }
   },
-  
-  getWindow: function() {
+
+  getWindow: function () {
     if (this.openedFromMaintenanceWindow) {
       return this.maintenanceView.standardWindow;
     } else if (this.openedInForm) {
@@ -1056,25 +1040,28 @@
   },
 
   // called by the buttons in the toolbar of the standard maintenance form/grid
-  doOpen: function(retrievedInitialData) {
-    var me = this, window, i, j, persField, fld, tabSet, tab;
-    
+  doOpen: function (retrievedInitialData) {
+    var me = this,
+        window, i, j, persField, fld, tabSet, tab;
+
     // first get the preview form data, continue after receiving it
     if (!retrievedInitialData) {
-      OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', {}, {action: 'getFormDefinition', tabId: this.tabId}, 
-          function(resp, data, req){
+      OB.RemoteCallManager.call('org.openbravo.client.application.personalization.PersonalizationActionHandler', {}, {
+        action: 'getFormDefinition',
+        tabId: this.tabId
+      }, function (resp, data, req) {
         me.previewFormProperties = data;
-        
+
         // copy some stuff
         me.previewFormProperties._originalFields = isc.clone(me.previewFormProperties.fields);
-        
+
         me.doOpen(true);
       });
       return;
     }
-    
+
     this.buildFormAndTree();
-    
+
     // depending on how we opened set the information here
     if (this.openedFromMaintenanceWindow) {
       window = this.maintenanceView.standardWindow;
@@ -1082,41 +1069,41 @@
       // opened directly from the actual form itself
       // always work on user level then
       window = this.form.view.standardWindow;
-  
+
       this.roleId = OB.User.roleId;
       this.clientId = OB.User.clientId;
       this.orgId = OB.User.organizationId;
       this.userId = OB.User.id;
     }
-    
+
     // hide the part from which we were opened 
     window.toolBarLayout.hide();
     window.view.hide();
     window.addMember(this);
-    
+
     // change the tabtitle
     tabSet = OB.MainView.TabSet;
     tab = OB.MainView.TabSet.getTab(window.view.viewTabId);
-    tabSet.setTabTitle(tab, OB.I18N.getLabel('OBUIAPP_Personalize_TitlePrefix', [this.tabIdentifier])); 
+    tabSet.setTabTitle(tab, OB.I18N.getLabel('OBUIAPP_Personalize_TitlePrefix', [this.tabIdentifier]));
     delete this.initializing;
   },
-  
+
   // is called when hovering over tree fields and also 
   // when hovering over items in the preview form
-  getHoverHTML: function(record, item) {
+  getHoverHTML: function (record, item) {
     if ((record && record.hasDisplayLogic) || (item && item.showIf)) {
       return OB.I18N.getLabel('OBUIAPP_Personalization_DisplayLogicPrompt');
     }
     // TODO: show information about the item being hovered...
     return null;
-//    return title + '<br/>' + 'give me more!';
+    //    return title + '<br/>' + 'give me more!';
   },
-  
+
   // reads the data from the tree grid and returns it in the expected
   // format. Note may return null during initialization
-  getPersonalizationFields: function() {
-    var i, record, result = [], node, nodes, 
-      value, j, undef, length;
+  getPersonalizationFields: function () {
+    var i, record, result = [],
+        node, nodes, value, j, undef, length;
     if (!this.fieldsTreeGrid || !this.fieldsTreeGrid.data) {
       return null;
     }
@@ -1135,15 +1122,21 @@
       }
       result.push(record);
     }
-    return {fields: result};
+    return {
+      fields: result
+    };
   },
-  
+
   // sets information about the current personalization record
   // in the status bar
-  setStatusBarInformation: function() {
+  setStatusBarInformation: function () {
     this.toolBar.updateButtonState();
-    
-    var statusBarFields = null, barFieldValues = [], barFieldTitles = [], label, icon = null, statusCode = null;
+
+    var statusBarFields = null,
+        barFieldValues = [],
+        barFieldTitles = [],
+        label, icon = null,
+        statusCode = null;
     if (this.isNew) {
       icon = this.statusBar.newIcon;
       label = 'OBUIAPP_New';
@@ -1151,10 +1144,10 @@
       icon = this.statusBar.editIcon;
       label = 'OBUIAPP_Editing';
     } else if (this.isSaved) {
-      icon =  this.statusBar.savedIcon;
+      icon = this.statusBar.savedIcon;
       label = 'OBUIAPP_Saved';
     }
-    
+
     if (this.clientIdentifier) {
       barFieldTitles.push(OB.I18N.getLabel('OBUIAPP_Client'));
       barFieldValues.push(this.clientIdentifier);
@@ -1175,13 +1168,13 @@
       barFieldTitles.push(OB.I18N.getLabel('OBUIAPP_Tab'));
       barFieldValues.push(this.tabIdentifier);
     }
-    
+
     if (barFieldTitles.length > 0) {
       statusBarFields = [];
       statusBarFields.push(barFieldTitles);
       statusBarFields.push(barFieldValues);
     }
-        
+
     this.statusBar.setContentLabel(icon, label, statusBarFields, OB.I18N.getLabel('OBUIAPP_WindowPersonalization_Guidance'));
   }
-});
+});
\ No newline at end of file