Renamed SEPARATOR --> FIELDSEPARATOR, related to issue 20297: [SC Upgrade]
authorMartin Taal <martin.taal@openbravo.com>
Tue, 24 Apr 2012 13:30:51 +0200
changeset 16334 d0f74d3c8943
parent 16333 265ccf14f0c3
child 16335 6155eefcdc2a
Renamed SEPARATOR --> FIELDSEPARATOR, related to issue 20297: [SC Upgrade]
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseTemplateProcessor.java
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Tue Apr 24 13:30:51 2012 +0200
@@ -95,7 +95,7 @@
             },          
         </#if>
         <#if field.searchField>
-            displayField: '${field.name?js_string}$_identifier',
+            displayField: '${field.name?js_string}${Constants_FIELDSEPARATOR}${Constants_IDENTIFIER}',
             <#if field.parentProperty>
                 showPickerIcon: ${(!field.parentProperty)?string},
             </#if>
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Tue Apr 24 13:30:51 2012 +0200
@@ -33,7 +33,7 @@
     }
 
     var display = this.mapValueToDisplay(value),
-        identifierFieldName = this.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
+        identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER;
     form.setValue(identifierFieldName, display);
     // make sure that the grid does not display the old identifier
     if (form.grid) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js	Tue Apr 24 13:30:51 2012 +0200
@@ -261,7 +261,7 @@
       var parentRecord = this.view.getParentRecord();
       if (parentRecord) {
         this.setValue(this.view.parentProperty, parentRecord.id);
-        this.setValue(this.view.parentProperty + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, parentRecord[OB.Constants.IDENTIFIER]);
+        this.setValue(this.view.parentProperty + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, parentRecord[OB.Constants.IDENTIFIER]);
         if (this.getField(this.view.parentProperty) && !this.getField(this.view.parentProperty).valueMap) {
           var valueMap = {};
           this.getField(this.view.parentProperty).valueMap = valueMap;
@@ -986,10 +986,10 @@
             // only set the display field name if the field does not have its own
             // datasource and the field displayfield contains a dot, otherwise 
             // it is a direct field
-            if (field.displayField && field.displayField.contains(OB.Constants.SEPARATOR) && !this.getField(field.displayField) && !field.optionDataSource && !field.getDataSource()) {
+            if (field.displayField && field.displayField.contains(OB.Constants.FIELDSEPARATOR) && !this.getField(field.displayField) && !field.optionDataSource && !field.getDataSource()) {
               field.form.setItemValue(field.displayField, identifier);
             } else if (!field.displayField) {
-              field.form.setItemValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, identifier);
+              field.form.setItemValue(field.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, identifier);
             }
           }
         }
@@ -1000,8 +1000,8 @@
       // note: do not use clearvalue as this removes the value from the form
       // which results it to not be sent to the server anymore
       this.setValue(field.name, null);
-      if (this.getValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
-        this.setItemValue(field.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER, null);
+      if (this.getValue(field.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER)) {
+        this.setItemValue(field.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER, null);
       }
     }
 
@@ -1064,7 +1064,7 @@
           identifier = valueMap[columnValue.value];
         }
         if (identifier) {
-          editValues[prop + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER] = identifier;
+          editValues[prop + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER] = identifier;
         }
         editValues[prop] = columnValue.value;
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Tue Apr 24 13:30:51 2012 +0200
@@ -287,8 +287,8 @@
             continue;
           }
           fullPropName = prop;
-          if (prop.endsWith(OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
-            var index = prop.lastIndexOf(OB.Constants.SEPARATOR);
+          if (prop.endsWith(OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER)) {
+            var index = prop.lastIndexOf(OB.Constants.FIELDSEPARATOR);
             prop = prop.substring(0, index);
           }
           var fnd = false,
@@ -505,8 +505,8 @@
       }
       var value = criterion.value;
       // see the description in setValuesAsCriteria above
-      if (prop.endsWith(OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER)) {
-        var index = prop.lastIndexOf(OB.Constants.SEPARATOR);
+      if (prop.endsWith(OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER)) {
+        var index = prop.lastIndexOf(OB.Constants.FIELDSEPARATOR);
         prop = prop.substring(0, index);
       }
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Tue Apr 24 13:30:51 2012 +0200
@@ -1410,7 +1410,7 @@
         title: OB.I18N.getLabel('OBUIAPP_OpenOnTab'),
         click: function () {
           var fldName = field.name;
-          var dotIndex = fldName.indexOf(OB.Constants.SEPARATOR);
+          var dotIndex = fldName.indexOf(OB.Constants.FIELDSEPARATOR);
           if (dotIndex !== -1) {
             fldName = fldName.substring(0, dotIndex);
           }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view-datasource.js	Tue Apr 24 13:30:51 2012 +0200
@@ -83,7 +83,7 @@
       var correctedData = {},
           prop;
       for (prop in data) {
-        if (data.hasOwnProperty(prop) && !prop.contains(OB.Constants.SEPARATOR)) {
+        if (data.hasOwnProperty(prop) && !prop.contains(OB.Constants.FIELDSEPARATOR)) {
           correctedData[prop] = data[prop];
         }
       }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Tue Apr 24 13:30:51 2012 +0200
@@ -2126,7 +2126,7 @@
       }
 
       if (fld.fkField) {
-        fld.displayField = fld.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER;
+        fld.displayField = fld.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER;
         fld.valueField = fld.name;
       }
 
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseTemplateProcessor.java	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseTemplateProcessor.java	Tue Apr 24 13:30:51 2012 +0200
@@ -25,6 +25,9 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.service.json.JsonConstants;
+
 /**
  * Contains generic code for {@link TemplateProcessor} instances.
  * 
@@ -46,6 +49,10 @@
    */
   public String process(Template template, Map<String, Object> data) {
 
+    // add some defaults
+    data.put("Constants_FIELDSEPARATOR", DalUtil.FIELDSEPARATOR);
+    data.put("Constants_IDENTIFIER", JsonConstants.IDENTIFIER);
+
     T templateImplementation = getTemplateImplementation(template);
     if (templateImplementation == null) {
       final String source = createTemplateSource(template);
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Tue Apr 24 13:30:51 2012 +0200
@@ -58,7 +58,7 @@
     Constants : {
         IDENTIFIER : '_identifier',
         ID : 'id',
-        SEPARATOR : '$',
+        FIELDSEPARATOR : '$',
         WHERE_PARAMETER : '_where',
         ORG_PARAMETER : '_org',
         ORDERBY_PARAMETER : '_orderBy',
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/templates/selector-as-link.ftl	Tue Apr 24 13:30:51 2012 +0200
@@ -20,7 +20,7 @@
     popupTextMatchStyle: '${data.selector.popuptextmatchstyle}',
     suggestionTextMatchStyle: '${data.selector.suggestiontextmatchstyle}',
     defaultPopupFilterField : '${data.defaultPopupFilterField}',
-    displayField: '${data.targetPropertyName?js_string}$_identifier',
+    displayField: '${data.targetPropertyName?js_string}${Constants_FIELDSEPARATOR}${Constants_IDENTIFIER}',
     valueField: '${data.targetPropertyName?js_string}',
     gridDisplayField: '${data.displayField?js_string}',
     gridValueField: '${data.valueField?js_string}',    
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Apr 24 12:08:20 2012 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Apr 24 13:30:51 2012 +0200
@@ -460,23 +460,23 @@
 
   setValueFromRecord: function (record, fromPopup) {
     var currentValue = this.getValue(),
-        identifierFieldName = this.name + OB.Constants.SEPARATOR + OB.Constants.IDENTIFIER,
+        identifierFieldName = this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER,
         i;
     if (!record) {
       this.storeValue(null);
-      this.form.setValue(this.name + OB.Constants.SEPARATOR + this.displayField, null);
+      this.form.setValue(this.name + OB.Constants.FIELDSEPARATOR + this.displayField, null);
       this.form.setValue(identifierFieldName, null);
 
       // make sure that the grid does not display the old identifier
       if (this.form.grid && this.form.grid.getEditForm()) {
         this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name, null);
         this.form.grid.setEditValue(this.form.grid.getEditRow(), identifierFieldName, '');
-        this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name + OB.Constants.SEPARATOR + this.displayField, '');
+        this.form.grid.setEditValue(this.form.grid.getEditRow(), this.name + OB.Constants.FIELDSEPARATOR + this.displayField, '');
       }
     } else {
       this.handleOutFields(record);
       this.storeValue(record[this.valueField]);
-      this.form.setValue(this.name + OB.Constants.SEPARATOR + this.displayField, record[this.displayField]);
+      this.form.setValue(this.name + OB.Constants.FIELDSEPARATOR + this.displayField, record[this.displayField]);
       this.form.setValue(identifierFieldName, record[OB.Constants.IDENTIFIER]);
       if (!this.valueMap) {
         this.valueMap = {};