details:   /erp/devel/pi/rev/b6e41e27b0bb
changeset: 12025:b6e41e27b0bb
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Fri May 06 12:15:37 2011 +0200
summary:   Upgraded to Smartclient version of 5 May

diffstat:

 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
                                               |  111 +++++++--
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/colHeaderDown.gif
 |    0 
 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/rowHeaderDown.gif
 |    0 
 3 files changed, 83 insertions(+), 28 deletions(-)

diffs (128 lines):

diff -r 6c1980aa7164 -r b6e41e27b0bb 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- 
a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Fri May 06 12:13:37 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
  Fri May 06 12:15:37 2011 +0200
@@ -174,37 +174,92 @@
 // when a picklist has been detached from a formitem
 isc.PickList.getPrototype().cachePickListResults = false;
 
-// allow max 10000 days/years/quarters in the past/future
-isc.RelativeDateItem.changeDefaults('quantityFieldDefaults', {max: 1000, 
alwaysTakeSpace: false});
-
-//isc.RelativeDateItem.changeDefaults('valueFieldDefaults', 
-//    {validateOnExit: true,
-//    icons : [{
-//    src: 
'[SKIN]/../../org.openbravo.client.application/images/form/date_control.png',
-//    canFocus: false,
-//    showOver: false,
-//    showFocused: false,
-//    showFocusedWithItem: false,
-//    width: 21,
-//    height: 21,
-//    hspace: 0,
-//    keyPress: function(keyName, character, form, item, icon){
-//      if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown()) {
-//        item.showPicker();
-//        return false;
-//      }
-//      return true;
-//    },
-//    click: function(form, item, icon){
-//      item.showPicker();
-//    }
-//  }]  
-//});
-
 isc.RelativeDateItem.addProperties({
+  displayFormat: OB.Format.date,
+  inputFormat: OB.Format.date,
+  pickerConstructor: 'OBDateChooser',
+  
   // overridden as the displayDateFormat does not seem to work fine
   formatDate: function(dt) {
-    return OB.Utilities.Date.JSToOB(dt, OB.Format.date);
+   return OB.Utilities.Date.JSToOB(dt, OB.Format.date);
+  },
+
+  // updateEditor() Fired when the value changes (via updateValue or setValue)
+  // Shows or hides the quantity box and updates the hint to reflect the 
current value.
+  // overridden to solve: https://issues.openbravo.com/view.php?id=16295
+  updateEditor : function () {
+  
+      if (!this.valueField || !this.quantityField) return;
+      
+      var focusItem,
+          selectionRange,
+          mustRefocus = false;
+          
+      if (this.valueField.hasFocus) {
+          focusItem = this.valueField;
+          selectionRange = this.valueField.getSelectionRange();
+      } else if (this.quantityField.hasFocus) {
+          focusItem = this.quantityField;
+          selectionRange = this.quantityField.getSelectionRange()
+      }
+      
+      var value = this.valueField.getValue(),
+          quantity = this.quantityField.getValue();
+
+      var showQuantity = (value && isc.isA.String(value) && 
this.relativePresets[value]);
+
+      if (!showQuantity) {
+          if (this.quantityField.isVisible()) {
+              mustRefocus = true;
+              this.quantityField.hide();
+          }
+      } else {
+          if (!this.quantityField.isVisible()) {
+            mustRefocus = true;
+              this.quantityField.show();
+          }
+      }
+
+      if (this.calculatedDateField) {
+        value = this.getValue();
+        var displayValue = this.editor.getValue('valueField');
+        // only show if the value is not a direct date
+        // https://issues.openbravo.com/view.php?id=16295
+        if (displayValue && displayValue.length > 0) {
+          displayValue = OB.Utilities.trim(displayValue);
+          // if it starts with a number then it must be a real date
+          if (displayValue.charAt(0) < '0' || displayValue.charAt(0) > '9' ) {
+            this.calculatedDateField.setValue(!value ? '' : 
+              '(' + this.formatDate(value) + ')');          
+          } else {
+            this.calculatedDateField.setValue('');                  
+          }
+        } else {
+          this.calculatedDateField.setValue('');                  
+        }
+      }
+      
+      // If we redrew the form to show or hide the qty field, we may need to 
refocus and
+      // reset the selection range
+      
+      if (mustRefocus && focusItem != null) {
+          if (!showQuantity && focusItem == this.quantityField) {
+              this.valueField.focusInItem();
+          } else {
+              if (selectionRange) {
+                  focusItem.delayCall("setSelectionRange", 
[selectionRange[0],selectionRange[1]]);
+              }
+          }
+      }
+      this.calculatedDateField.canFocus = false;
+  },
+    
+  // overridden because the picker is now part of the combo and not a separate 
field.
+  // custom code to center the picker over the picker icon
+  getPickerRect : function () {
+      // we want the date chooser to float centered over the picker icon.
+      var form = this.canvas;
+      return [this.getPageLeft() + form.getLeft(), this.getPageTop() + 
form.getTop() - 40];
   }
 
 });
diff -r 6c1980aa7164 -r b6e41e27b0bb 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/colHeaderDown.gif
Binary file 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/colHeaderDown.gif
 has changed
diff -r 6c1980aa7164 -r b6e41e27b0bb 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/rowHeaderDown.gif
Binary file 
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/smartclient/images/CubeGrid/rowHeaderDown.gif
 has changed

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to