details:   /erp/devel/pi/rev/b78c1a760dc0
changeset: 12532:b78c1a760dc0
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Fri May 27 15:28:56 2011 +0200
summary:   Fixed bug 16437: updated missed fields,
removed blank space at the end of element's name

details:   /erp/devel/pi/rev/b1c830dd5ee0
changeset: 12533:b1c830dd5ee0
user:      Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
date:      Mon May 30 10:21:44 2011 +0200
summary:   merge

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
          |  102 ++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
 |  275 +++++++++-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
                   |   24 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
                      |   33 +-
 
modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java
                         |    2 +-
 
modules/org.openbravo.client.myob/src/org/openbravo/client/myob/WidgetProvider.java
                                         |    2 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java
                       |    2 +-
 
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java
                        |    2 +-
 modules/org.openbravo.v3/src-db/database/configScript.xml                      
                                             |    4 -
 src-db/database/sourcedata/AD_ELEMENT.xml                                      
                                             |    4 +-
 src-db/database/sourcedata/AD_FIELD.xml                                        
                                             |   81 +-
 src/index.jsp                                                                  
                                             |   12 +-
 src/org/openbravo/base/secureApp/HttpSecureAppServlet.java                     
                                             |    6 +-
 13 files changed, 408 insertions(+), 141 deletions(-)

diffs (truncated from 1043 to 300 lines):

diff -r b1d467810763 -r b1c830dd5ee0 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
        Fri May 27 14:48:16 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js
        Mon May 30 10:21:44 2011 +0200
@@ -22,7 +22,8 @@
 // adds autocomplete and formatting based on the Openbravo date pattern
 isc.ClassFactory.defineClass('OBDateItem', isc.DateItem);
 
-isc.OBDateItem.addProperties({
+// done like this because the props are re-used in the minidaterange
+OB.DateItemProperties = {
   operator: 'equals',
   // ** {{{ pickerConstructor }}} **
   // Picker constructor class
@@ -52,7 +53,7 @@
 
   dateParts : [],
 
-  init: function() {
+  doInit: function() {
     var i, dateFormatUpper, index = 0, currentTime;
     dateFormatUpper = this.dateFormat.toUpperCase();
     this.dateSeparator = this.dateFormat.toUpperCase().replace(/D/g, '')
@@ -93,29 +94,9 @@
       return true;
     }
   },
-  
-  // ** {{{ blur }}} **
-  // Called when the focus leaves the field (sets value and validates)
-  blur: function(){
-    var newValue = this.blurValue(), oldValue = this.getValue(), editRow;
-    
-    if (oldValue !== newValue) {
-      this.storeValue(OB.Utilities.Date.OBToJS(newValue, this.dateFormat));
-    }
-    if (!this.inBlur) {
-      this.inBlur = true;
-      this.checkOBDateItemValue();
-      this.inBlur = false;
-    }
-    return this.Super('blur', arguments);
-  },
-  
-  blurValue: function() {
-    return this.parseValue();
-  },
 
   parseValue: function() {
-    var i, str = this.getValue(), parts = [ '', '', '' ], partIndex = 0, 
result;
+    var i, str = this.blurValue(), parts = [ '', '', '' ], partIndex = 0, 
result;
     if (!str || isc.isA.Date(str)) {
       return str;
     }
@@ -190,6 +171,35 @@
   isSeparator : function(str, position) {
     return str.charAt(position) === '-' || str.charAt(position) === '\\'
         || str.charAt(position) === '/';
+  } 
+};
+
+isc.OBDateItem.addProperties(OB.DateItemProperties,
+  {
+  
+  init: function() {
+    // this call super.init
+    this.doInit();
+  },
+  
+  // ** {{{ blur }}} **
+  // Called when the focus leaves the field (sets value and validates)
+  blur: function(){
+    var newValue = this.parseValue(), oldValue = this.getValue(), editRow;
+    
+    if (oldValue !== newValue) {
+      this.storeValue(OB.Utilities.Date.OBToJS(newValue, this.dateFormat));
+    }
+    if (!this.inBlur) {
+      this.inBlur = true;
+      this.checkOBDateItemValue();
+      this.inBlur = false;
+    }
+    return this.Super('blur', arguments);
+  },
+  
+  blurValue: function() {
+    return this.getValue();
   },
 
   // ** {{{ checkOBDateItemValue }}} **
@@ -214,30 +224,30 @@
       this.form.markForRedraw();
     }
   },
-  
+
   validateOBDateItem: function(value){
-    var dateValue = OB.Utilities.Date.OBToJS(value, this.dateFormat);
-    var isValid = true;
-    if (this.getValue() && dateValue === null) {
-      isValid = false;
-    }
-    var isRequired = this.required;
-    if (isValid === false) {
-      return false;
-    } else if (isRequired === true && value === null) {
-      return false;
-    }
-    return true;
-  },
-  
-  validators: [{
-    type: 'custom',
-    condition: function(item, validator, value){
-      return item.validateOBDateItem(value);
-    }
-  }]
- 
-});
+      var dateValue = OB.Utilities.Date.OBToJS(value, this.dateFormat);
+      var isValid = true;
+      if (this.getValue() && dateValue === null) {
+        isValid = false;
+      }
+      var isRequired = this.required;
+      if (isValid === false) {
+        return false;
+      } else if (isRequired === true && value === null) {
+        return false;
+      }
+      return true;
+    },
+    
+    validators: [{
+      type: 'custom',
+      condition: function(item, validator, value){
+        return item.validateOBDateItem(value);
+      }
+    }]
+  }    
+);
 
 OB.I18N.getLabel('OBUIAPP_InvalidValue', null, isc.OBDateItem, 
'invalidValueLabel');
 OB.I18N.getLabel('OBUISC_Validator.requiredField', null, isc.OBDateItem, 
'requiredValueLabel');
diff -r b1d467810763 -r b1c830dd5ee0 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
       Fri May 27 14:48:16 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
       Mon May 30 10:21:44 2011 +0200
@@ -19,7 +19,9 @@
 
 // == OBMiniDateRangeItem ==
 // OBMiniDateRangeItem inherits from SmartClient MiniDateRangeItem
-// Is used for filtering dates in the grid.
+// Is used for filtering dates in the grid. Contains the following classes:
+// - OBDateRangeDialog: the popup
+// - OBMiniDateRangeItem: the filter item itself
 isc.ClassFactory.defineClass('OBDateRangeDialog', isc.DateRangeDialog);
 
 isc.OBDateRangeDialog.addProperties({
@@ -49,21 +51,260 @@
 
 });
 
-isc.ClassFactory.defineClass('OBMiniDateRangeItem', isc.MiniDateRangeItem);
 
-isc.OBMiniDateRangeItem.addProperties({
+// == OBMinDateRangeItem ==
+// Item used for filtering by dates in the grid. Replaces the normal 
Smartclient
+// MiniDateRangeItem to make it editable.
+isc.ClassFactory.defineClass('OBMiniDateRangeItem', OBTextItem);
+
+isc.ClassFactory.defineClass('XOBMiniDateRangeItem', TextItem);
+
+isc.OBMiniDateRangeItem.addProperties(OB.DateItemProperties, {
+  validateOnExit: false,
+  showPickerIcon: false,
+  filterOnKeypress: false,
+  operator: 'equals',
+  // prevents date formatting using the simple type formatters
+  applyStaticTypeFormat: true,
+  
   // note this one needs to be set to let the formatDate be called below
   dateDisplayFormat: OB.Format.date,
   rangeDialogConstructor: isc.OBDateRangeDialog,
+
+  textBoxStyle: 'textItem',
+  shouldSaveValue: true,
+  rangeDialogDefaults: {
+    _constructor: 'DateRangeDialog',
+    autoDraw: false,
+    destroyOnClose: false
+  },
+  fromDateOnlyPrefix: OB.I18N.getLabel('OBUIAPP_fromDateOnlyPrefix'),
+  toDateOnlyPrefix: OB.I18N.getLabel('OBUIAPP_toDateOnlyPrefix'),
+  pickerIconPrompt: OB.I18N.getLabel('OBUIAPP_pickerIconPrompt'),
+  iconVAlign: 'center',
+  pickerIconDefaults: {
+    name: 'showDateRange',
+    src: '[SKIN]/DynamicForm/DatePicker_icon.gif',
+    width: 16,
+    height: 16,
+    showOver: false,
+    showFocused: false,
+    showFocusedWithItem: false,
+    hspace: 0,
+    click: function(form, item, icon) {
+      if (!item.disabled) {
+        item.showRangeDialog();
+      }
+    }
+  },
+
+  allowRelativeDates: true,
   
-  // prevent illegal values from showing up
-  updateValue: function(data) {
-    var illegalStart = data && data.start && 
!this.isCorrectRangeValue(data.start);
+  // if the user enters a date directly
+  singleDateMode: false,
+  singleDateValue: null,
+  singleDateDisplayValue: null,
+  
+  init: function() {
+    this.addAutoChild('rangeDialog', {
+      fromDate: this.fromDate,
+      toDate: this.toDate,
+      rangeItemProperties: {
+        allowRelativeDates: this.allowRelativeDates
+      },
+      dateDisplayFormat: this.dateDisplayFormat,
+      callback: this.getID() + '.rangeDialogCallback(value)'
+    });
+
+    this.icons = [ isc.addProperties({
+      prompt: this.pickerIconPrompt
+    }, this.pickerIconDefaults, this.pickerIconProperties) ];
+
+    this.rangeItem = this.rangeDialog.rangeItem;
+    this.rangeItem.name = this.name;
+
+    // this call super.init
+    this.doInit();
+  },
+  
+  blurValue: function() {
+    return this.getElementValue();
+  },
+  
+  expandSingleValue: function(){
+    var newValue = this.parseValue(), oldValue = this.mapValueToDisplay(), 
dateValue, editRow;
+    
+    if (!this.singleDateMode) {
+      return;
+    }
+    
+    if (this.singleDateMode) {
+      dateValue = OB.Utilities.Date.OBToJS(newValue, this.dateFormat);
+      if (isc.isA.Date(dateValue)) {
+        this.singleDateValue = dateValue;
+        this.singleDateDisplayValue = newValue;
+        this.singleDateMode = true;
+        this.setElementValue(newValue, newValue);
+      } else {
+        this.singleDateValue = null;
+        this.singleDateMode = false;
+      }
+      return true;
+    }
+    return false;
+  },
+  
+  blur: function() {
+    if (this.expandSingleValue()) {
+      this.form.grid.performAction();
+    }    
+    return this.Super('blur', arguments);
+  },
+
+  showRangeDialog: function() {
+    if (!this.rangeItemValue) {
+      this.rangeDialog.clear();
+      this.rangeItem.fromField.setValue(null);
+      this.rangeItem.fromField.quantityField.hide();
+      this.rangeItem.toField.setValue(null);
+      this.rangeItem.toField.quantityField.hide();
+    }
+    this.rangeDialog.show();
+  },
+
+  rangeDialogCallback: function(value) {
+    var data = value, illegalStart = data && data.start && 
!this.isCorrectRangeValue(data.start);
     var illegalEnd = data && data.end && !this.isCorrectRangeValue(data.end);
     if (illegalStart || illegalEnd) {
       return;
     }
-    this.Super('updateValue', arguments);
+    this.singleDateMode = false;
+    this.singleDateValue = null;
+    this.rangeItemValue = value;
+    this.displayValue();
+    this.form.grid.performAction();
+  },

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to