details:   /erp/devel/pi/rev/ef5f9a8035b3
changeset: 12445:ef5f9a8035b3
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu May 26 01:31:03 2011 +0200
summary:   [KS] Added expand/collapse sections keyboard shortcuts

diffstat:

 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml
                          |   7 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
               |  79 +++++++++-
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
   |   4 +-
 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js
 |   4 +-
 4 files changed, 86 insertions(+), 8 deletions(-)

diffs (186 lines):

diff -r 5717a6f72c27 -r ef5f9a8035b3 
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml
--- 
a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml
     Thu May 26 00:34:53 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml
     Thu May 26 01:31:03 2011 +0200
@@ -82,7 +82,12 @@
   {"id": "StatusBar_Previous", "keyComb": {"alt": true, "shift": true, "key": 
"Page_Up"}},
   {"id": "StatusBar_Next", "keyComb": {"alt": true, "shift": true, "key": 
"Page_Down"}},
   {"id": "StatusBar_Maximize-Restore", "keyComb": {"ctrl": true, "alt": true, 
"key": "Enter"}},
-  {"id": "StatusBar_Close", "keyComb": {"key": "Escape"}}
+  {"id": "StatusBar_Close", "keyComb": {"key": "Escape"}},
+  {"id": "SectionItem_MoreInformation", "keyComb": {"ctrl": true, "shift": 
true, "key": "1"}},
+  {"id": "SectionItem_Audit", "keyComb": {"ctrl": true, "shift": true, "key": 
"2"}},
+  {"id": "SectionItem_Notes", "keyComb": {"ctrl": true, "shift": true, "key": 
"3"}},
+  {"id": "SectionItem_LinkedItems", "keyComb": {"ctrl": true, "shift": true, 
"key": "4"}},
+  {"id": "SectionItem_Attachments", "keyComb": {"ctrl": true, "shift": true, 
"key": "5"}}
 ]]]></VALUE>
 <!--8EE6D055A7FE4C4DA7EB557F6C61D0ED-->  
<PROPERTY><![CDATA[UISTATB_KeyboardShortcuts]]></PROPERTY>
 <!--8EE6D055A7FE4C4DA7EB557F6C61D0ED-->  
<ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST>
diff -r 5717a6f72c27 -r ef5f9a8035b3 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
  Thu May 26 00:34:53 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js
  Thu May 26 01:31:03 2011 +0200
@@ -48,6 +48,12 @@
 
   // always go through the autosave of the window
   action : function() {
+    // to avoid issue that autosave is executed when expading/collapsing 
sections using KS
+    if (this.buttonType === 'maximizeRestore' || this.buttonType === 
'sectionMoreInformation' || this.buttonType === 'sectionAudit' || 
this.buttonType === 'sectionNotes' || this.buttonType === 'sectionLinkedItems' 
|| this.buttonType === 'sectionAttachments') {
+      this.doAction();
+      return;
+    }
+
     // don't do autosave if new and nothing changed
     if (this.buttonType === 'close' && !this.view.viewForm.hasChanged && 
this.view.viewForm.isNew) {
       this.view.standardWindow.setDirtyEditForm(null);
@@ -93,6 +99,26 @@
           }
         }
       }
+    } else if (this.buttonType === 'sectionMoreInformation') {
+      this.handleSectionExpandCollapse('402880E72F1C15A5012F1C7AA98B00E8');
+    } else if (this.buttonType === 'sectionAudit') {
+      this.handleSectionExpandCollapse('1000100001');
+    } else if (this.buttonType === 'sectionNotes') {
+      this.handleSectionExpandCollapse('_notes_');
+    } else if (this.buttonType === 'sectionLinkedItems') {
+      this.handleSectionExpandCollapse('_linkedItems_');
+    } else if (this.buttonType === 'sectionAttachments') {
+      this.handleSectionExpandCollapse('_attachments_');
+    }
+  },
+
+  handleSectionExpandCollapse: function(name) {
+    if (this.view.viewForm.getItem(name)) {
+      if (this.view.viewForm.getItem(name).sectionExpanded ) {
+        this.view.viewForm.getItem(name).collapseSection();
+      } else {
+        this.view.viewForm.getItem(name).expandSection();
+      }
     }
   },
 
@@ -100,9 +126,11 @@
     if (this.keyboardShortcutId) {
       var me = this;
       var ksAction = function(){
-        if ((!me.isDisabled() && me.isVisible()) || me.forceKeyboardShortcut) {
+        if (!me.isDisabled() && me.isVisible()) {
           me.focus();
           me.action();
+        } else if (me.forceKeyboardShortcut) {
+          me.action();
         }
         return false; //To avoid keyboard shortcut propagation
       };
@@ -133,8 +161,18 @@
   view : null,
   iconButtonGroupSpacerWidth : 0, // Set in the skin
 
+  previousButton : null,
   nextButton : null,
-  previousButton : null,
+  closeButton : null,
+  maximizeButton : null,
+  restoreButton : null,
+  maximizeRestoreButton : null,
+  sectionMoreInformation : null,
+  sectionAudit : null,
+  sectionNotes : null,
+  sectionLinkedItems : null,
+  sectionAttachments : null,
+
   newIcon : null,
   showingIcon : false,
   mode : '',
@@ -187,6 +225,41 @@
       forceKeyboardShortcut : true,
       keyboardShortcutId : 'StatusBar_Maximize-Restore'
     });
+    this.sectionMoreInformation = isc.OBStatusBarIconButton.create( { // Only 
for implement 'SectionItem_MoreInformation' keyboard shortcut
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'sectionMoreInformation',
+      forceKeyboardShortcut : true,
+      keyboardShortcutId : 'SectionItem_MoreInformation'
+    });
+    this.sectionAudit = isc.OBStatusBarIconButton.create( { // Only for 
implement 'SectionItem_Audit' keyboard shortcut
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'sectionAudit',
+      forceKeyboardShortcut : true,
+      keyboardShortcutId : 'SectionItem_Audit'
+    });
+    this.sectionNotes = isc.OBStatusBarIconButton.create( { // Only for 
implement 'SectionItem_Notes' keyboard shortcut
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'sectionNotes',
+      forceKeyboardShortcut : true,
+      keyboardShortcutId : 'SectionItem_Notes'
+    });
+    this.sectionLinkedItems = isc.OBStatusBarIconButton.create( { // Only for 
implement 'SectionItem_LinkedItems' keyboard shortcut
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'sectionLinkedItems',
+      forceKeyboardShortcut : true,
+      keyboardShortcutId : 'SectionItem_LinkedItems'
+    });
+    this.sectionAttachments = isc.OBStatusBarIconButton.create( { // Only for 
implement 'SectionItem_Attachments' keyboard shortcut
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'sectionAttachments',
+      forceKeyboardShortcut : true,
+      keyboardShortcutId : 'SectionItem_Attachments'
+    });
     this.buttonBar = isc.OBStatusBarIconButtonBar.create( {});
 
     var buttonSpacer = isc.HLayout.create( {
@@ -194,7 +267,7 @@
     }), i;
 
     this.buttonBar.addMembers( [ this.previousButton, this.nextButton, 
buttonSpacer,
-        this.maximizeButton, this.restoreButton, this.closeButton, 
this.maximizeRestoreButton ]);
+        this.maximizeButton, this.restoreButton, this.closeButton, 
this.maximizeRestoreButton, this.sectionMoreInformation, this.sectionAudit, 
this.sectionNotes, this.sectionLinkedItems, this.sectionAttachments ]);
     for (i = 0; i < this.buttonBar.members.length; i++) {
       if (this.buttonBar.members[i].buttonType) {
         OB.TestRegistry.register(
diff -r 5717a6f72c27 -r ef5f9a8035b3 
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
      Thu May 26 00:34:53 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
      Thu May 26 01:31:03 2011 +0200
@@ -371,7 +371,7 @@
       height: this.popupIconHeight,
       hspace: this.popupIconHspace,
       keyPress: function(keyName, character, form, item, icon){
-        if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown()) {
+        if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown() && 
!isc.EventHandler.altKeyDown() && !isc.EventHandler.shiftKeyDown()) {
           item.openSelectorWindow();
           return false;
         }
@@ -467,7 +467,7 @@
   },
   
   keyPress: function(item, form, keyName, characterValue){
-    if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown()) {
+    if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown() && 
!isc.EventHandler.altKeyDown() && !isc.EventHandler.shiftKeyDown()) {
       this.openSelectorWindow(form, item, null);
       return false;
     }
diff -r 5717a6f72c27 -r ef5f9a8035b3 
modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js
--- 
a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js
    Thu May 26 00:34:53 2011 +0200
+++ 
b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js
    Thu May 26 01:31:03 2011 +0200
@@ -600,7 +600,7 @@
                 // feature:
                 // http://forums.smartclient.com/showthread.php?p=34868
                 keyPress : function(keyName, character, form, item, icon) {
-                  if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown()) {
+                  if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown() && 
!isc.EventHandler.altKeyDown() && !isc.EventHandler.shiftKeyDown()) {
                     this.selector.openSelectorWindow(form, item, icon);
                     return false;
                   }
@@ -632,7 +632,7 @@
               },
 
               keyPress : function(item, form, keyName, characterValue) {
-                if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown()) {
+                if (keyName === 'Enter' && isc.EventHandler.ctrlKeyDown() && 
!isc.EventHandler.altKeyDown() && !isc.EventHandler.shiftKeyDown()) {
                   this.selector.openSelectorWindow(form, item, null);
                   return false;
                 }

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to