details:   https://code.openbravo.com/erp/devel/pi/rev/3fec9dfdd735
changeset: 17958:3fec9dfdd735
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Fri Sep 14 16:51:05 2012 +0200
summary:   Fixes Issue 21648 : Adding Read-Only Logic to Attachments

When User has read-only access, they can download attachments, but they cannot 
add/remove attachments.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
 |  12 +++++++--
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
            |   3 ++
 2 files changed, 12 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 357149849277 -r 3fec9dfdd735 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
 Fri Sep 14 14:47:39 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-attachments.js
 Fri Sep 14 16:51:05 2012 +0200
@@ -367,7 +367,9 @@
         }
       }
     });
-    hLayout.addMember(addButton);
+    if (!this.getForm().view.viewForm.readOnly) {
+      hLayout.addMember(addButton);
+    }
     // If there are no attachments, we only display the "[Add]" button
     if (!attachments || attachments.length === 0) {
       
this.getForm().getItem('_attachments_').setValue(OB.I18N.getLabel('OBUIAPP_AttachmentTitle'));
@@ -425,7 +427,9 @@
       }
     });
     hLayout.addMember(downloadAllButton);
-    hLayout.addMember(removeAllButton);
+    if (!this.getForm().view.viewForm.readOnly) {
+      hLayout.addMember(removeAllButton);
+    }
 
     var downloadActions;
     downloadActions = function () {
@@ -495,7 +499,9 @@
       buttonLayout.addMember(attachmentLabel);
       buttonLayout.addMember(attachmentBy);
       buttonLayout.addMember(downloadAttachment);
-      buttonLayout.addMember(removeAttachment);
+      if (!this.getForm().view.viewForm.readOnly) {
+        buttonLayout.addMember(removeAttachment);
+      }
       this.addMember(buttonLayout);
     }
   },
diff -r 357149849277 -r 3fec9dfdd735 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Fri Sep 14 14:47:39 2012 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Fri Sep 14 16:51:05 2012 +0200
@@ -358,6 +358,9 @@
         this.setDisabled(false);
       }
       this.resetBaseStyle();
+      if (this.view.viewForm.readOnly && !this.view.attachmentExists) {
+        this.setDisabled(true);
+      }
     },
     keyboardShortcutId: 'ToolBar_Attachments'
   },

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to