[open-ils-commits] r10984 - in branches/rel_1_4/Open-ILS/web: js/dojo/openils vandelay vandelay/inc

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Oct 30 09:49:35 EDT 2008


Author: erickson
Date: 2008-10-30 09:49:34 -0400 (Thu, 30 Oct 2008)
New Revision: 10984

Modified:
   branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
   branches/rel_1_4/Open-ILS/web/vandelay/inc/toolbar.xml
   branches/rel_1_4/Open-ILS/web/vandelay/vandelay.css
   branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js
Log:
added add/remove css functions to util class (didn't see such a beast in dojo).  apply some css to the selected menu option

Modified: branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js	2008-10-29 21:39:51 UTC (rev 10983)
+++ branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js	2008-10-30 13:49:34 UTC (rev 10984)
@@ -118,4 +118,49 @@
         return val;
     };
 
+
+    /**
+     * Given a DOM node, adds the provided class to the node 
+     */
+    openils.Util.addCSSClass = function(node, cls) {
+        if(!(node && cls)) return; 
+        var className = node.className;
+
+        if(!className) {
+            node.className = cls;
+            return;
+        }
+
+        var classList = className.split(/\s+/);
+        var newName = '';
+            
+        for (var i = 0; i < classList.length; i++) {
+            if(classList[i] == cls) return;
+            if(classList[i] != null)
+                newName += classList[i] + " ";
+        }
+
+        newName += cls;
+        node.className = newName;
+    },
+
+    /**
+     * Given a DOM node, removes the provided class from the CSS class 
+     * name list.
+     */
+    openils.Util.removeCSSClass = function(node, cls) {
+        if(!(node && cls && node.className)) return;
+        var classList = node.className.split(/\s+/);
+        var className = '';
+        for(var i = 0; i < classList.length; i++) {
+            if (classList[i] != cls) {
+                if(i == 0)
+                    className = classList[i];
+                else 
+                    className += ' ' + classList[i];
+            }
+        }
+        node.className = className;
+    }
+
 }

Modified: branches/rel_1_4/Open-ILS/web/vandelay/inc/toolbar.xml
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/inc/toolbar.xml	2008-10-29 21:39:51 UTC (rev 10983)
+++ branches/rel_1_4/Open-ILS/web/vandelay/inc/toolbar.xml	2008-10-30 13:49:34 UTC (rev 10984)
@@ -1,11 +1,10 @@
 <div dojoType="dijit.Toolbar" id='toolbar'>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" 
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" id='vl-menu-marc-export'
         onclick="displayGlobalDiv('vl-marc-export-div');" showLabel="true">&vandelay.export.records;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" 
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-marc-upload'
         onclick="displayGlobalDiv('vl-marc-upload-div');" showLabel="true">&vandelay.import.records;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" 
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-queue-select'
         onclick="vlShowQueueSelect();" showLabel="true">&vandelay.inspect.queue;</div>
-    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy" 
+    <div dojoType="dijit.form.Button" iconClass="dijitEditorIcon dijitEditorIconCopy"  id='vl-menu-attr-editor'
         onclick="vlShowAttrEditor();" showLabel="true">&vandelay.edit.attributes;</div>
 </div>
-

Modified: branches/rel_1_4/Open-ILS/web/vandelay/vandelay.css
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/vandelay.css	2008-10-29 21:39:51 UTC (rev 10983)
+++ branches/rel_1_4/Open-ILS/web/vandelay/vandelay.css	2008-10-30 13:49:34 UTC (rev 10984)
@@ -33,3 +33,4 @@
 
 .export_tr_border td { border-top: 1px solid #808080; }
 .nav_row_div {padding:1px; text-align:center; }
+.toolbar_selected { border: 2px dashed #808080; text-decoration:underline; font-weight:bold;}

Modified: branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js	2008-10-29 21:39:51 UTC (rev 10983)
+++ branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js	2008-10-30 13:49:34 UTC (rev 10984)
@@ -87,6 +87,7 @@
 
     openils.Util.registerEnterHandler(
         vlQueueDisplayPage.domNode, function(){retrieveQueuedRecords();});
+    openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
 
     function checkInitDone() {
         initCount++;
@@ -207,6 +208,26 @@
         }
     }
     dojo.style(dojo.byId(id),'display','block');
+
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
+    openils.Util.removeCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
+
+    switch(id) {
+        case 'vl-marc-export-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-export'), 'toolbar_selected');
+            break;
+        case 'vl-marc-upload-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-marc-upload'), 'toolbar_selected');
+            break;
+        case 'vl-queue-select-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-queue-select'), 'toolbar_selected');
+            break;
+        case 'vl-attr-editor-div':
+            openils.Util.addCSSClass(dojo.byId('vl-menu-attr-editor'), 'toolbar_selected');
+            break;
+    }
 }
 
 function runStartupCommands() {



More information about the open-ils-commits mailing list