details:   /erp/devel/pi/rev/705e3208ec21
changeset: 11466:705e3208ec21
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Mon Apr 04 19:19:46 2011 +0200
summary:   Fixes issue 16499: Dramatically improve the usability. Some issues

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
      |  12 +++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
             |  22 ++++++++-
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
 |  11 ++++-
 3 files changed, 40 insertions(+), 5 deletions(-)

diffs (111 lines):

diff -r 19eaac5626ce -r 705e3208ec21 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Apr 04 18:41:52 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Mon Apr 04 19:19:46 2011 +0200
@@ -500,12 +500,16 @@
   // addUnknownValues: false,
 
   selectOnFocus: true,
+  moveFocusOnPickValue: true,
   
   // is overridden to keep track that a value has been explicitly picked
   pickValue : function (value) {
     this._pickedValue = true;
     this.Super('pickValue', arguments);
     delete this._pickedValue;
+    if (this.moveFocusOnPickValue && this.form.focusInNextItem) {
+      this.form.focusInNextItem(this.name);
+    }
   },
 
   changed: function() {
@@ -545,6 +549,7 @@
 isc.ClassFactory.defineClass('OBListFilterItem', OBListItem);
 
 isc.OBListFilterItem.addProperties({
+  moveFocusOnPickValue: false,
   operator: 'equals'
 });
 
@@ -594,6 +599,13 @@
     // When data has changed, force the OBDateItem to get it. Other case 
OBDateItem.blur 
     // gets incorrect value on getValue()
     this.callingFormItem.setValue(this.getData());
+  },
+  dateClick: function() {
+    var ret = this.Super('dateClick', arguments);
+    if (this.callingForm.focusInNextItem) {
+      this.callingForm.focusInNextItem(this.callingFormItem.name);
+    }
+    return ret;
   }
 });
 
diff -r 19eaac5626ce -r 705e3208ec21 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Mon Apr 04 18:41:52 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
  Mon Apr 04 19:19:46 2011 +0200
@@ -919,9 +919,9 @@
       return;
     }
     
-    if(this.inFicCall){
+    if (this.inFicCall) {
       this.callSaveAfterFICReturn = true;
-    }else{
+    } else {
       // last parameter true prevents additional validation
       this.saveData(callback, {
         willHandleError: true,
@@ -930,8 +930,24 @@
     }
   },
   
-  // overridden to prevent focus setting when autoSaving
+  focusInNextItem: function(currentItem) {
+    var chooseNextItem, i, nextItem, length = this.getItems().length;
+    for (i = 0; i < length; i++) {
+      // some items don't have a name, ignore those
+      if (chooseNextItem && this.getItems()[i].name && 
this.getItems()[i].isFocusable && this.getItems()[i].isFocusable()) {
+        nextItem = this.getItems()[i];
+        break;
+      }
+      if (this.getItems()[i].name === currentItem) {
+        chooseNextItem = true;
+      }
+    }
+    if (nextItem) {
+      this.focusInItem(nextItem);
+    }
+  },
   
+  // overridden to prevent focus setting when autoSaving  
   showErrors: function(errors, hiddenErrors, suppressAutoFocus){
     if (this.view.standardWindow.isAutoSaving) {
       return this.Super('showErrors', [errors, hiddenErrors, true]);
diff -r 19eaac5626ce -r 705e3208ec21 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Mon Apr 04 18:41:52 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Mon Apr 04 19:19:46 2011 +0200
@@ -211,7 +211,10 @@
 
   hide: function(){
     this.Super('hide', arguments);
-    this.selector.focusInItem();
+    //focus is now moved to the next item in the form automatically
+    if (!this.selector.form.getFocusItem()) {
+      this.selector.focusInItem();
+    }
   },
 
   show: function(applyDefaultFilter){
@@ -378,7 +381,11 @@
         this.valueMap = {};
       }
       this.valueMap[record[this.valueField]] = record[this.displayField];
-      this.updateValueMap();    
+      this.updateValueMap();
+      
+      if (this.form.focusInNextItem) {
+        this.form.focusInNextItem(this.name);
+      }
     }
     if (this.form && this.form.handleItemChange) {
       this._hasChanged = true;

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to