prettimafication for dem dar reporter
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 22 Nov 2005 13:05:10 +0000 (13:05 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 22 Nov 2005 13:05:10 +0000 (13:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2114 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/reporter/tables.example.xml
Open-ILS/src/reporter/templates/inputs
Open-ILS/src/reporter/templates/stage1.ttk
Open-ILS/src/reporter/templates/stage2.ttk
Open-ILS/src/reporter/templates/widget_manip
Open-ILS/src/reporter/templates/widgets/lib-choose.dropdown [new file with mode: 0644]
Open-ILS/src/reporter/templates/widgets/lib-choose.multiselect [new file with mode: 0644]
Open-ILS/src/reporter/widgets.example.xml

index a721354..ad9d59d 100644 (file)
@@ -17,6 +17,7 @@
                        </field>
                        <field
                          name="barcode"
+                         widget-family="string-input"
                          datatype="text">
                                <label>Barcode</label>
                                <description>Copy Barcode</description>
@@ -63,6 +64,7 @@
                        </field>
                        <field
                          name="call_number_label"
+                         widget-family="string-input"
                          datatype="text">
                                <label>Call Number</label>
                                <description>Copy Call Number Label</description>
                        </field>
                        <field
                          name="name"
+                         widget-family="lib-choose"
                          datatype="text">
                                <label>Name</label>
                                <description>Library Name</description>
                        </field>
                        <field
                          name="shortname"
+                         widget-family="string-choose"
                          datatype="text">
                                <label>Short Name</label>
                                <description>Library Short (Policy) Name</description>
                        </field>
                        <field
                          name="value"
+                         widget-family="string-choose"
                          datatype="text">
                                <label>Language Name</label>
                                <description>Name associated with the MARC code</description>
                        </field>
                        <field
                          name="value"
+                         widget-family="string-choose"
                          datatype="text">
                                <label>Item Form Name</label>
                                <description>Name associated with the MARC code</description>
                        </field>
                        <field
                          name="value"
+                         widget-family="string-choose"
                          datatype="text">
                                <label>Item Type Name</label>
                                <description>Name associated with the MARC code</description>
index 77e4365..0f9373b 100644 (file)
@@ -46,13 +46,13 @@ BLOCK textarea;
 END;
 
 BLOCK select;
-       %]<select id="[% id %]" name="[% name %]" size="[% size %]"[% IF multi %] multiple="multiple" [% END %]>[%
+       %]<select id="[% id %]" name="[% name %]" onchange="[% onchange %]" size="[% size %]"[% IF multi %] multiple="multiple" [% END %]>[%
                content;
        %]</select>[%
 END;
 
 BLOCK option;
-       %]<option value="[% value %]"[% IF selected %] selected="selected" [% END %]>[%
+       %]<option id="[% id %]" value="[% value %]"[% IF selected %] selected="selected" [% END %]>[%
                IF content;
                        content;
                ELSE;
index 45b5670..d6b81e1 100644 (file)
@@ -78,12 +78,12 @@ BLOCK stage2_new;
                <center>
                        <b>Template name (required):</b> <input type="text" name="templatename" id="templatename" size="40" ><br/><br><br>
                </center>
-               <b>Select Filter Widgets</b><br>[%
+               <b>Select Filter Widgets and Output Dimensions</b><br>[%
 
        
        WRAPPER html/table width="100%" style='border-top: 1px solid black';
                WRAPPER html/row;
-                       WRAPPER html/cell colspan=2  align='center' style="border: solid black 1px; background: lightgray;";
+                       WRAPPER html/cell colspan=2  align='left' style="padding-left: 30px; border: solid black 1px; background: lightgray;";
                                # hidden input here ...
                                table = config.findnodes("/reporter/tables/table[@id='$fact_table']");
                                INCLUDE hidden name="filter" value=fact_table;
@@ -108,9 +108,7 @@ BLOCK stage2_new;
 
                WRAPPER html/table width="100%" style='border-top: 1px solid black';
                        WRAPPER html/row;
-                               WRAPPER html/cell colspan=2 align='center' style="border: solid black 1px; background: lightgray;";
-                                       # checkbox input here ...
-                                       INCLUDE checkbox name="filter" value=link_id checked=1;
+                               WRAPPER html/cell align='left' width="33%" style="padding-left: 30px; border: solid black 1px; background: lightgray;";
 
                                        link_label_xpath = '../../fields/field[@name="' _ dim_link.findvalue('@field') _ '"]/label';
                                        dim_link.findvalue(link_label_xpath);
@@ -118,6 +116,12 @@ BLOCK stage2_new;
                                        ' -- ';
                                        dimension.findvalue('label');
                                        ' Dimension';
+
+                               END;
+                               WRAPPER html/cell align='left' style="padding-left: 30px; border: solid black 1px; background: white;";
+                                       # checkbox input here ...
+                                       INCLUDE checkbox name="filter" value=link_id checked=1;
+                                       'Allow these columns to be used in Report Output';
                                END;
                        END;
                        INCLUDE widget_selector tableid=link_id;
index 6ac8e8a..617275b 100644 (file)
@@ -407,6 +407,7 @@ BLOCK run_stage2;
                                                                                fieldname = field.findvalue('@name');
                                                                                widgetname = widget.findvalue('@name');
                                                                                famname = fam.findvalue('@name');
+                                                                               table_alias = t;
        
                                                                                input_prefix = "filter:$t:$fieldname:$famname:$widgetname";
        
index a470b5b..ffac035 100644 (file)
@@ -41,7 +41,7 @@ BLOCK widget_selector;
                                INCLUDE $column_input_type
                                        name="filter:$linkid"
                                        value=column_name
-                                       checked=1
+                                       checked=0
                                column.findvalue('label');
                        END;
                        WRAPPER html/cell;
diff --git a/Open-ILS/src/reporter/templates/widgets/lib-choose.dropdown b/Open-ILS/src/reporter/templates/widgets/lib-choose.dropdown
new file mode 100644 (file)
index 0000000..7461b50
--- /dev/null
@@ -0,0 +1,67 @@
+[%
+
+PROCESS inputs;
+
+root = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou IS NULL ORDER BY name;';
+q = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou = ? ORDER BY name;';
+
+org_unit_type = DBI.tie('actor.org_unit_type', 'id')
+
+%]
+
+<script language="javascript">
+       filters["[% input_prefix %]"] = "[% table_label _ ' -- ' _ field.findvalue('label') %]";
+
+       var hier_[% table_alias %] = [];
+
+       function change_hier_[% table_alias %] ( sel ) {
+               for (var i in hier_[% table_alias %]) {
+                       if (hier_[% table_alias %][i] == sel.options[sel.selectedIndex].id) {
+                               return true;
+                       }
+               }
+               sel.selectedIndex = null;
+               return false;
+       }
+</script>
+
+[%
+
+WRAPPER select name=input_prefix onchange='change_hier_' _ table_alias _ '(this);';
+       depth = 0;
+       FOR f = DBI.query(root);
+               INCLUDE option value=f.$fieldname;
+               INCLUDE next_level parent_ou = f.id depth;
+       END;
+END;
+
+BLOCK next_level;
+       depth = depth + 1;
+       x = depth;
+       s = DBI.prepare(q);
+       FOR f = s.execute(parent_ou);
+               ou_t = f.ou_type;
+
+               logme(["can_have_vols for ou_t", ,org_unit_type.$ou_t.can_have_vols]);
+
+               IF org_unit_type.$ou_t.can_have_vols == 1;
+                       %]
+                       <script language="javascript">
+                               hier_[% table_alias %].push("dr_[% f.id %]");
+                       </script>
+                       [%
+               END;
+
+               x = depth;
+               val = '';
+               WHILE x > 0;
+                       val = val _ '&nbsp;&nbsp;';
+                       x = x - 1;
+               END;
+
+               INCLUDE option value=f.name content=val _ f.name id='dr_' _ f.id;
+               INCLUDE next_level parent_ou = f.id;
+       END;
+END;
+
+%]
diff --git a/Open-ILS/src/reporter/templates/widgets/lib-choose.multiselect b/Open-ILS/src/reporter/templates/widgets/lib-choose.multiselect
new file mode 100644 (file)
index 0000000..96ae4bf
--- /dev/null
@@ -0,0 +1,71 @@
+[%
+
+PROCESS inputs;
+
+root = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou IS NULL ORDER BY name;';
+q = 'SELECT * FROM ' _ table.findvalue('tablename') _ ' WHERE parent_ou = ? ORDER BY name;';
+
+org_unit_type = DBI.tie('actor.org_unit_type', 'id')
+
+%]
+
+<script language="javascript">
+       filters["[% input_prefix %]"] = "[% table_label _ ' -- ' _ field.findvalue('label') %]";
+
+       var multihier_[% table_alias %] = [];
+
+       function change_multihier_[% table_alias %] ( sel ) {
+               for (var i = 0; i < sel.options.length; i++) {
+                       if (sel.options[i].selected) {
+                               sel.options[i].selected = false;
+                               for (var j in multihier_[% table_alias %]) {
+                                       if (multihier_[% table_alias %][j] == sel.options[i].id) {
+                                               sel.options[i].selected = true
+                                               continue;
+                                       }
+                               }
+                       }
+               }
+       }
+</script>
+
+[%
+
+WRAPPER select name=input_prefix multi="multi" onchange='change_multihier_' _ table_alias _ '(this);';
+       depth = 0;
+       FOR f = DBI.query(root);
+               INCLUDE option value=f.$fieldname;
+               INCLUDE next_level parent_ou = f.id depth;
+       END;
+END;
+
+BLOCK next_level;
+       depth = depth + 1;
+       x = depth;
+       s = DBI.prepare(q);
+       FOR f = s.execute(parent_ou);
+               ou_t = f.ou_type;
+
+               logme(["can_have_vols for ou_t", ,org_unit_type.$ou_t.can_have_vols]);
+
+               IF org_unit_type.$ou_t.can_have_vols == 1;
+                       %]
+                       <script language="javascript">
+                               multihier_[% table_alias %].push("mh_[% f.id %]");
+                       </script>
+                       [%
+               END;
+
+               x = depth;
+               val = '';
+               WHILE x > 0;
+                       val = val _ '&nbsp;&nbsp;';
+                       x = x - 1;
+               END;
+
+               INCLUDE option value=f.name content=val _ f.name id='mh_' _ f.id;
+               INCLUDE next_level parent_ou = f.id;
+       END;
+END;
+
+%]
index 369a102..ba1fe89 100644 (file)
                        </description>
                </widget>
        </widget-family>
-</widgets>
+
+       <!-- Library selection from in-database data - special to OpenILS -->
+       <widget-family name="lib-choose" datatype="text">
+               <label>String filter from known data</label>
+       
+               <widget name="dropdown">
+                       <label>Exactly match a Library chosen from a dropdown</label>
+                       <description>
+                               This widget filters on an exact Library Name match.
+                       </description>
+               </widget>
+               
+               <widget name="multiselect">
+                       <label>Match multiple Libraries chosen from a multiselect box</label>
+                       <description>
+                               This widget filters based on multiple Library names.
+                       </description>
+               </widget>
+       </widget-family>
+       </widgets>