details:   https://code.openbravo.com/erp/devel/pi/rev/2301ecb7a7e2
changeset: 13616:2301ecb7a7e2
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Tue Aug 30 09:29:49 2011 +0200
summary:   Fixed issue 18183. Zooming in an image will work even in readonly 
windows. The following changes have been made:
- Moved the setting of the readonly property in the processFICresponse to 
_before_ the values for the columns have been set.
- The Image formitem will never be disabled. This is done to allow click() 
events to be triggered.
- Added updateState method to the selectorButton (the deleteButton already had 
it), and saved the selectorButton in the canvas object.
- In the setValue() method, added a call to the updateState method of both 
buttons so that it takes into account the readOnly property in the form and the 
one in the formitem.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
 |  20 +++++++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
               |  11 +++--
 2 files changed, 21 insertions(+), 10 deletions(-)

diffs (86 lines):

diff -r a3a20690578a -r 2301ecb7a7e2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
       Tue Aug 30 08:53:29 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js
       Tue Aug 30 09:29:49 2011 +0200
@@ -21,10 +21,6 @@
 //This class is used for the small image shown within the 
OBImageItemSmallImageContainer
 isc.ClassFactory.defineClass('OBImageItemSmallImage', isc.Img);
 
-isc.OBImageItemSmallImage.addProperties({
-  showDisabled: false
-});
-
 //== OBImageItemSmallImageContainer ==
 //This class is used for the small image container box
 isc.ClassFactory.defineClass('OBImageItemSmallImageContainer', isc.HLayout);
@@ -129,6 +125,13 @@
             imageItem: this.imageItem
           });
           selector.show();
+        },
+        updateState: function(value){
+          if(value){
+            this.setDisabled(false);
+          }else{
+            this.setDisabled(true);
+          }
         }
     });
     var deleteButton = isc.OBImageItemButton.create({
@@ -181,6 +184,7 @@
     }
     
     this.deleteButton = deleteButton;
+    this.selectorButton = selectorButton;
     buttonLayout.addMember(selectorButton);
     buttonLayout.addMember(deleteButton);
     this.addMember(buttonLayout);
@@ -212,6 +216,10 @@
     this.canvasProperties.parentItem = this;
     this.Super('init', arguments);
   },
+  //This formitem will never be disabled, so even if the form is readonly, 
click events will still be triggered
+  isDisabled: function() {
+    return false;
+  },
   setValue: function(newValue){
     if(!newValue || newValue === '') {
       this.canvas.setImage('');
@@ -244,7 +252,9 @@
         }
       });
     }
-    this.canvas.deleteButton.updateState(newValue);
+    //Buttons will not be shown if the form is readonly
+    this.canvas.deleteButton.updateState(newValue && !this.form.readOnly && 
!this.readOnly);
+    this.canvas.selectorButton.updateState(!this.form.readOnly && 
!this.readOnly);
     return this.Super('setValue', arguments);
   },
   refreshImage: function(imageId){
diff -r a3a20690578a -r 2301ecb7a7e2 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Tue Aug 30 08:53:29 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Tue Aug 30 09:29:49 2011 +0200
@@ -585,6 +585,12 @@
       delete this.inFicCall;
       return;
     }
+
+    if (data._readOnly || this.view.readOnly) {
+      this.readOnly = true;
+    } else {
+      this.readOnly = false;
+    }
     
     var columnValues = data.columnValues, calloutMessages = 
data.calloutMessages,
                        auxInputs = data.auxiliaryInputValues, prop, value, i, 
j,
@@ -641,11 +647,6 @@
     if (dynamicCols) {
       this.dynamicCols = dynamicCols;
     }
-    if (data._readOnly || this.view.readOnly) {
-      this.readOnly = true;
-    } else {
-      this.readOnly = false;
-    }
 
     // grid editing    
     if (this.grid && this.grid.setEditValues && this.grid.getEditRow() === 
editRow) {

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to