toward spine labels
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 25 Sep 2005 04:02:43 +0000 (04:02 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 25 Sep 2005 04:02:43 +0000 (04:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1872 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/cat/spine_label_wizard.xul [new file with mode: 0644]
Evergreen/staff_client/chrome/content/evergreen/cat/volume.js
Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js

diff --git a/Evergreen/staff_client/chrome/content/evergreen/cat/spine_label_wizard.xul b/Evergreen/staff_client/chrome/content/evergreen/cat/spine_label_wizard.xul
new file mode 100644 (file)
index 0000000..ed39485
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!-- This DTD declaration needs to be fixed for Mozilla locales -->
+<!DOCTYPE wizard SYSTEM "chrome://evergreen/locale/cat.dtd">
+<wizard id="spine_label" title="Spine Label Wizard"
+       orient="vertical" style="overflow: auto"
+       onload="spine_label_init()" width="800" height="600"
+       onwizardfinish=""
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- Overlays for this XUL file -->
+       <?xul-overlay href="chrome://evergreen/content/OpenSRF/OpenSRF_overlay.xul"?>
+       <?xul-overlay href="chrome://evergreen/content/util/util_overlay.xul"?>
+
+       <!-- OpenSRF -->
+       <script>var myPackageDir = "evergreen";</script>
+       <OpenSRF id="OpenSRF_js" />
+
+       <script>
+       <![CDATA[
+
+               function spine_label_init() {
+                       var spine_labels; try { spine_labels = params.spine_labels; } catch(E) { sdump('D_ERROR',js2JSON(E) + '\n'); }
+                       if (!spine_labels) spine_labels = [ [ 'A Call Number', '1' ] ];
+                       var rows = document.getElementById('page1_rows');
+                       for (var i = 0; i < spine_labels.length; i++) {
+                               var sl = spine_labels[i];
+                               var label = sl[0];
+                               var count = sl[1];
+                               var row = document.createElement('row'); rows.appendChild(row);
+                               var btn = document.createElement('button'); row.appendChild(btn);
+                                       btn.setAttribute('label','Test Print');
+                               var label_tb = document.createElement('textbox'); row.appendChild(label_tb);
+                                       label_tb.setAttribute('multiline','true');
+                                       label_tb.setAttribute('value',label);
+                               var count_tb = document.createElement('textbox'); row.appendChild(count_tb);
+                                       count_tb.setAttribute('multiline','true');
+                                       count_tb.setAttribute('value',count);
+                       }
+               }
+
+       ]]>
+       </script>
+
+
+       <wizardpage id="page1" description="Printing Spine Labels" onpageadvanced="">
+               <grid>
+                       <columns> <column flex="0" /> <column flex="1" /> <column flex="0" /> </columns>
+                       <rows id="page1_rows">
+                               <row><spacer/><label value="Label" /><label value="Print This Many"/></row>
+                       </rows>
+               </grid>
+       </wizardpage>
+
+</wizard>
+
+
index 511250a..fb3c9b9 100644 (file)
@@ -67,11 +67,13 @@ function page2_add_volume_row(ou,ti) {
                        //cn_row.setAttribute('id','p2_'+ou.id());
                        cn_row.setAttribute('ou_name',ou.name());
                        cn_row.setAttribute('ou_id',ou.id());
+                       cn_row.setAttribute('spine_row','1');
                rows.appendChild(cn_row);
                cn_row.appendChild( document.createElement('label') );
                var cn_text1 = document.createElement('textbox');
                        cn_text1.setAttribute('size','20');
                        cn_text1.setAttribute('value','A Call Number');
+                       cn_text1.setAttribute('spine_cn','1');
                cn_row.appendChild( cn_text1 );
                var cn_text2 = document.createElement('textbox');
                        cn_text2.setAttribute('size','4');
@@ -80,6 +82,7 @@ function page2_add_volume_row(ou,ti) {
                var cn_text3 = document.createElement('textbox');
                        cn_text3.setAttribute('size','4');
                        cn_text3.setAttribute('value','0');
+                       cn_text3.setAttribute('spine_label_count','1');
                cn_row.appendChild( cn_text3 );
        }
 }
@@ -101,12 +104,14 @@ function copy_add_page2_add_volume_row(ou,ti) {
                        cn_row.setAttribute('ou_name',ou.name());
                        cn_row.setAttribute('ou_id',ou.id());
                        cn_row.setAttribute('volume_id',ti.getAttribute('volume_id'));
+                       cn_row.setAttribute('spine_row','1');
                rows.appendChild(cn_row);
                cn_row.appendChild( document.createElement('label') );
                var cn_text1 = document.createElement('textbox');
                        cn_text1.setAttribute('size','20');
                        cn_text1.setAttribute('volume_id',ti.getAttribute('volume_id'));
                        cn_text1.setAttribute('value',ti.getAttribute('callnumber'));
+                       cn_text1.setAttribute('spine_cn','1');
                cn_row.appendChild( cn_text1 );
                cn_text1.disabled = true;
                var cn_text2 = document.createElement('textbox');
@@ -116,6 +121,7 @@ function copy_add_page2_add_volume_row(ou,ti) {
                var cn_text3 = document.createElement('textbox');
                        cn_text3.setAttribute('size','4');
                        cn_text3.setAttribute('value','0');
+                       cn_text3.setAttribute('spine_label_count','1');
                cn_row.appendChild( cn_text3 );
 }
 
@@ -418,5 +424,17 @@ function submit_edited_volumes() {
 }
 
 function spine_labels() {
-       alert('wizard goes here');
+       var nl = document.getElementsByTagName('row');
+       var spine_labels = [];
+       for (var i = 0; i < nl.length; i++) {
+               var r = nl[i]; var cn = ''; var count = 0;
+               if (! r.getAttribute('spine_row')) continue;
+               for (var j = 0; j < r.childNodes.length; j++) {
+                       var c = r.childNodes[j];
+                       if (c.getAttribute('spine_cn')) cn = c.value;
+                       if (c.getAttribute('spine_label_count')) count = c.value;
+               }
+               spine_labels.push( [ cn, count ] );
+       }
+       mw.spawn_spine_label_wizard(document,'new_window','',{ 'spine_labels' : spine_labels }); 
 }
index ea2b10f..65d2874 100644 (file)
@@ -134,6 +134,11 @@ function spawn_receipt_template_editor(d,placement,place,passthru_params,clone)
        return spawn_interface(d,placement,place,chrome,getString('receipt_template_editor_interface_label'),passthru_params,clone);
 }
 
+function spawn_spine_label_wizard(d,placement,place,passthru_params,clone) {
+       var chrome = 'chrome://evergreen/content/cat/spine_label_wizard.xul';
+       return spawn_interface(d,placement,place,chrome,getString('spine_label_wizard'),passthru_params,clone);
+}
+
 /* legacy code, may be removed or refactored */
 
 function spawn_batch_copy_editor(d,placement,place,passthru_params,clone) {