details:   /erp/devel/pi/rev/9069258ded36
changeset: 12120:9069258ded36
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Wed May 11 17:24:52 2011 +0200
summary:   [attachments] Improved alignment of attachment components and styling

details:   /erp/devel/pi/rev/999211f9625a
changeset: 12121:999211f9625a
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Thu May 12 10:00:22 2011 +0200
summary:   [attachments] Improved styling of upload button

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
                                                                |   34 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
                                                  |  121 +++++----
 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
 |    7 +-
 3 files changed, 93 insertions(+), 69 deletions(-)

diffs (278 lines):

diff -r ff48f6570c57 -r 999211f9625a 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Wed May 11 18:07:12 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js
    Thu May 12 10:00:22 2011 +0200
@@ -138,8 +138,8 @@
     buttonType: 'eliminate',
     prompt: OB.I18N.getLabel('OBUIAPP_DeleteRow'),
     updateState: function(){
-      var view = this.view, form = view.viewForm, grid = view.viewGrid, 
selectedRecords = grid.getSelectedRecords();
-      for (var i = 0; i < selectedRecords.length; i++) {
+      var view = this.view, form = view.viewForm, grid = view.viewGrid, 
selectedRecords = grid.getSelectedRecords(), i;
+      for (i = 0; i < selectedRecords.length; i++) {
         if (!grid.isWritable(selectedRecords[i])) {
           this.setDisabled(true);
           return;
@@ -186,7 +186,7 @@
     buttonType: 'undo',
     prompt: OB.I18N.getLabel('OBUIAPP_Undo'),
     updateState: function(){
-      var view = this.view, form = view.viewForm, grid = view.viewGrid, 
hasErrors = false, editRow;
+      var view = this.view, form = view.viewForm, grid = view.viewGrid, 
hasErrors = false, editRow, i;
       if (view.isShowingForm) {
         this.setDisabled(form.isSaving || form.readOnly || 
!view.hasValidState() ||
         !form.hasChanged);
@@ -200,7 +200,7 @@
         !form.hasChanged));
       } else {
         var selectedRecords = grid.getSelectedRecords(), allRowsHaveErrors = 
true;
-        for (var i = 0; i < selectedRecords.length; i++) {
+        for (i = 0; i < selectedRecords.length; i++) {
           var rowNum = grid.getRecordIndex(selectedRecords[i]);
           allRowsHaveErrors = allRowsHaveErrors && grid.rowHasErrors(rowNum);
         }
@@ -276,15 +276,7 @@
             {name: 'buttonId', type: 'hidden', value: this.ID},
             {name: 'inpKey', type: 'hidden', value: 
this.view.viewGrid.getSelectedRecord().id},
             {name: 'inpTabId', type: 'hidden', value: this.view.tabId},
-            {name: 'inpwindowId', type: 'hidden', value: this.view.windowId},
-            {name: 'submitbutton', type: 'button', title: 
OB.I18N.getLabel('OBUIAPP_AttachmentSubmit'),
-              click: function(form, item){
-                form.button.customState = 'Progress';
-                form.button.resetBaseStyle();
-                form.submitForm();
-                popup.hide();
-              }
-            }
+            {name: 'inpwindowId', type: 'hidden', value: this.view.windowId}
           ],
           encoding: 'multipart',
           action: './businessUtility/TabAttachments_FS.html',
@@ -298,9 +290,22 @@
           },
           button: this
         });
+
+       var submitbutton = isc.Button.create({
+               title: OB.I18N.getLabel('OBUIAPP_AttachmentSubmit'),
+               theForm: form,
+               click: function(){
+                 var form = this.theForm;
+                 form.button.customState = 'Progress';
+                 form.button.resetBaseStyle();
+                 form.submitForm();
+              popup.hide();
+            }
+       });
         this.oldForm = form;
-        var horizontalLayout = isc.VStack.create({
+        var horizontalLayout = isc.HLayout.create({
           width: '100%',
+          height: '30px',
           align: 'right'
         });
         var popup = isc.OBPopup.create({
@@ -309,6 +314,7 @@
           align: 'right',
           initWidget: function(args){
           horizontalLayout.addMember(form);
+          horizontalLayout.addMember(submitbutton);
           this.items = horizontalLayout;
           this.Super('initWidget', arguments);
           }
diff -r ff48f6570c57 -r 999211f9625a 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
      Wed May 11 18:07:12 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-attachments.js
      Thu May 12 10:00:22 2011 +0200
@@ -212,64 +212,75 @@
             {name: 'buttonId', type: 'hidden', value: this.canvas.ID},
             {name: 'inpKey', type: 'hidden', value: this.canvas.recordId},
             {name: 'inpTabId', type: 'hidden', value: this.canvas.tabId},
-            {name: 'inpwindowId', type: 'hidden', value: this.canvas.windowId},
-            {name: 'submitbutton', type: 'button', title: 
OB.I18N.getLabel('OBUIAPP_AttachmentSubmit'), align:'right',
-              click: function(form, item){
-                var addFunction = function(clickedOK){
-                  if(clickedOK){
-                    var hTempLayout = isc.HLayout.create();
-                    
form.theCanvas.addMember(hTempLayout,form.theCanvas.getMembers().size());
-                    var uploading = isc.Label.create({
-                      contents: fileName + '    
'+OB.I18N.getLabel('OBUIAPP_AttachmentUploading')
-                    });
-                    hTempLayout.addMember(uploading);
-                    var button =  
form.theCanvas.getForm().view.toolBar.getLeftMember(isc.OBToolbar.TYPE_ATTACHMENTS);
-                    if(!button) {
-                      button =  
form.theCanvas.getForm().view.toolBar.getLeftMember("attachExists");
-                    }
-                    button.customState = 'Progress';
-                    button.resetBaseStyle();
-                    form.submitForm();
-                    form.popup.hide();
-                  }
-                };
-                var value = form.getItem('inpname').getElement().value;
-                value = value?value:'';
-                var lastChar=value.lastIndexOf("\\") + 1;
-                var fileName = lastChar===-1?value:value.substring(lastChar);
-                if(form.theCanvas.fileExists(fileName, attachments)){
-                  
isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmUploadOverwrite'), addFunction);
-                }else{
-                  addFunction(true);
-                }
-              }
-            }
+            {name: 'inpwindowId', type: 'hidden', value: this.canvas.windowId}
           ],
           encoding: 'multipart',
           action: './businessUtility/TabAttachments_FS.html',
           target: "background_target",
           numCols: 4,
           align: 'right',
+          height: '30px',
           redraw: function(){
           },
           theCanvas: this.canvas
-        });
-        var horizontalLayout = isc.VStack.create({
-          width: '100%',
-          align: 'right'
-        });
-        var popup = isc.OBPopup.create({
-          height: 30,
-          width: 300,
-          align: 'right',
-          initWidget: function(args){
+      });
+      var submitbutton = isc.Button.create({
+        title: OB.I18N.getLabel('OBUIAPP_AttachmentSubmit'),
+        theForm: form,
+        click: function(){
+          var form = this.theForm;
+          var addFunction = function(clickedOK){
+            if(clickedOK){
+              var hTempLayout = isc.HLayout.create();
+               
form.theCanvas.addMember(hTempLayout,form.theCanvas.getMembers().size());
+              var uploadingFile = isc.Label.create({
+                contents: fileName
+              });
+              var uploading = isc.Label.create({
+                 className: 'OBSectionItemControlLinkUploading',
+                 contents: '    
'+OB.I18N.getLabel('OBUIAPP_AttachmentUploading')
+              });
+              hTempLayout.addMember(uploadingFile);
+              hTempLayout.addMember(uploading);
+              var button =  
form.theCanvas.getForm().view.toolBar.getLeftMember(isc.OBToolbar.TYPE_ATTACHMENTS);
+              if(!button) {
+                button =  
form.theCanvas.getForm().view.toolBar.getLeftMember("attachExists");
+              }
+              button.customState = 'Progress';
+              button.resetBaseStyle();
+              form.submitForm();
+              form.popup.hide();
+            }
+          };
+          var value = this.theForm.getItem('inpname').getElement().value;
+          value = value?value:'';
+          var lastChar=value.lastIndexOf("\\") + 1;
+          var fileName = lastChar===-1?value:value.substring(lastChar);
+          if(this.theForm.theCanvas.fileExists(fileName, attachments)){
+            isc.confirm(OB.I18N.getLabel('OBUIAPP_ConfirmUploadOverwrite'), 
addFunction);
+          }else{
+            addFunction(true);
+          }
+        }
+      });
+      var horizontalLayout = isc.HLayout.create({
+        width: '100%',
+        height: '30px',
+        align: 'right'
+      });
+      var popup = isc.OBPopup.create({
+        height: 30,
+        width: 300,
+        align: 'right',
+        initWidget: function(args){
           horizontalLayout.addMember(form);
-            this.items = horizontalLayout;
-            this.Super('initWidget', arguments);
-          }
-        });
-        form.popup = popup;
-        popup.show();
+          horizontalLayout.addMember(submitbutton);
+          this.items = horizontalLayout;
+          this.Super('initWidget', arguments);
+        }
+      });
+      form.popup = popup;
+      popup.show();
       }
     });
     hLayout.addMember(addButton);
@@ -357,15 +368,17 @@
       var buttonLayout = isc.HLayout.create();
       var attachmentLabel = isc.Label.create({
         contents: attachment.name,
+        className: 'OBNoteListGrid',
         width: '200px',
+        height: 20,
         wrap: false
       });
+      var creationDate = OB.Utilities.getTimePassed(new 
Date(attachment.creationDate));
       var attachmentBy = isc.Label.create({
-        contents: " <i>"+OB.I18N.getLabel('OBUIAPP_AttachmentBy')+" 
"+attachment.createdby+"</i>"
-      });
-      var creationDate = OB.Utilities.getTimePassed(new 
Date(attachment.creationDate));
-      var attachmentCreationDate = isc.Label.create({
-        contents: creationDate
+        height:  1,
+        className: 'OBNoteListGridAuthor',
+        width: '200px',
+        contents: creationDate+" "+OB.I18N.getLabel('OBUIAPP_AttachmentBy')+" 
"+attachment.createdby
       });
       var downloadAttachment = isc.OBSectionItemControlLink.create({
         contents: '[ '+OB.I18N.getLabel('OBUIAPP_AttachmentDownload')+' ]',
@@ -374,6 +387,7 @@
         attachId: attachment.id,
         action: downloadActions
       });
+      downloadAttachment.height=0;
       var removeAttachment = isc.OBSectionItemControlLink.create({
         contents: '[ '+OB.I18N.getLabel('OBUIAPP_AttachmentRemove')+' ]',
         width: '30px',
@@ -383,7 +397,6 @@
         action: removeActions
       });
       buttonLayout.addMember(attachmentLabel);
-      buttonLayout.addMember(attachmentCreationDate);
       buttonLayout.addMember(attachmentBy);
       buttonLayout.addMember(downloadAttachment);
       buttonLayout.addMember(removeAttachment);
diff -r ff48f6570c57 -r 999211f9625a 
modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
     Wed May 11 18:07:12 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.css
     Thu May 12 10:00:22 2011 +0200
@@ -730,7 +730,8 @@
 .OBSectionItemControlLinkDown,
 .OBSectionItemControlLinkFocused,
 .OBSectionItemControlLinkFocusedOver,
-.OBSectionItemControlLinkFocusedDown {
+.OBSectionItemControlLinkFocusedDown ,
+.OBSectionItemControlLinkUploading {
   font-family: 'lucida sans', sans-serif;
   font-size: 12px;
   vertical-align: middle;
@@ -738,6 +739,7 @@
   text-align: right;
   cursor: pointer;
   padding-right: 5px;
+  padding:5px; 
 }
 
 .OBSectionItemControlLink,
@@ -756,6 +758,9 @@
   color: #004E27;
   text-decoration: underline;
 }
+.OBSectionItemControlLinkUploading {
+  color: #FA962F;
+}
 
 /*=======================================================================
  * Used in the label of a foreign key field, for link image 

------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to