plugged in initial xpath parsing for provider attr defs. fixed some grid height issue...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 20:37:39 +0000 (20:37 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 May 2009 20:37:39 +0000 (20:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13132 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/acq/provider.js
Open-ILS/web/templates/default/conify/global/acq/provider.tt2

index abfe064..fe447e1 100644 (file)
@@ -2,7 +2,12 @@ dojo.require('dijit.layout.TabContainer');
 dojo.require('openils.widget.AutoGrid');
 dojo.require('dijit.form.FilteringSelect');
 dojo.require('openils.PermaCrud');
+dojo.require('openils.MarcXPathParser');
+
+
 var provider;
+var xpathParser = new openils.MarcXPathParser();
+var subFields= [];
 
 function draw() {
     if(providerId) {
@@ -81,7 +86,7 @@ function drawProviderSummary(child) {
         case 'tab-hold': 
             phsListGrid.overrideEditWidgets.provider = new
                 dijit.form.TextBox({disabled: 'true', value: providerId});
-            phsListGrid.overrideEditWidgets.name = nameSelect;
+            phsListGrid.overrideEditWidgets.name = name;
             phsListGrid.resetStore();
             phsListGrid.loadAll({order_by:{acqphsm : 'provider'}}, {provider : providerId});
             break;
@@ -100,11 +105,20 @@ function drawProviderSummary(child) {
     }
 }
 
-function getProviderName(rowIndex, item) {
-    if(!item) return '';
-    return '<a href="' + location.href + '/' +
-        this.grid.store.getValue(item, 'id') + '">' +
-        this.grid.store.getValue(item, 'name') + '</a>';
+
+function getParsedTag(rowIndex, item) {
+    console.log("in getParsedTag");
+    console.log(item);
+    return item && xpathParser.parse(padListGrid.store.getValue(item, 'xpath')).tags;
 }
 
+
+function getParsedSubf(rowIndex, item) {
+
+    if(item) {
+        var subfields = xpathParser.parse(padListGrid.store.getValue(item, 'xpath')).subfields;
+        return subfields.join(',');
+    }
+    return'';
+}
 openils.Util.addOnLoad(draw);
index 529fbae..a682e53 100644 (file)
@@ -1,7 +1,9 @@
 [% WRAPPER default/base.tt2 %]
 <script src='[% ctx.media_prefix %]/js/ui/default/conify/global/acq/provider.js'> </script>
-<script> var providerId = '[% ctx.page_args.0 %]';</script>
-<script type ="text/javascript">
+
+<script> 
+    var providerId = '[% ctx.page_args.0 %]';
+
     function formatName(inDatum) {
         switch (inDatum) {
             case 'owning_lib':
@@ -16,7 +18,7 @@
                 return 'Local Note';
             case 'price':
                 return 'Price';
-            case 'circ_modifier':
+            case 'circ-Modifier':
                 return 'Circulation Modifier';
             case 'copy_location':
                 return 'Copy Location';
         }
     }
 
+    function getProviderName(rowIndex, item) {
+        if(!item) return '';
+        var name = this.grid.store.getValue(item, 'name');
+        var id = this.grid.store.getValue(item, 'id');
+        return id + ':' + name;
+    }
+
+    function formatName(value) {
+        if(value) {
+            var vals = value.split(/:/);
+            return '<a href="[% ctx.base_path %]/conify/global/acq/provider/'+vals[0]+'">'+vals[1]+'</a>';
+        }
+    }
 </script>
-<div class="hidden"><select dojoType="dijit.form.FilteringSelect" jsId="nameSelect">
-    <option value='owning_lib'>Owning Library</option>
-    <option value='quantity'>Quantity</option>
-    <option value='call_number'>Call Number</option>
-    <option value='fund_code'>Fund Code</option>
-    <option value='local_note'>Local Note</option>
-    <option value='price'>Price</option>
-    <option value='circ_modifier'>Circulation Modifier</option>
-    <option value='copy_location'>Copy Location</option>
-    <option value='collection_code'>Collection Code</option>
-</select>
+
+
+<div class="hidden">
+    <select dojoType="dijit.form.FilteringSelect" jsId="nameSelect">
+        <option value='owning_lib'>Owning Library</option>
+        <option value='quantity'>Quantity</option>
+        <option value='call_number'>Call Number</option>
+        <option value='fund_code'>Fund Code</option>
+        <option value='local_note'>Local Note</option>
+        <option value='price'>Price</option>
+        <option value='circ_modifier'>Circulation Modifier</option>
+        <option value='copy_location'>Copy Location</option>
+        <option value='collection_code'>Collection Code</option>
+    </select>
 </div> 
+
 <div id='provider-list-div' style='height: 600px;'>
     <div dojoType="dijit.layout.ContentPane" layoutAlign='top'>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div>Provider</div>
             <div>
             </div>
         </div>
     </div>
-    <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:90%'>
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
         <table  jsId="pListGrid"
                 dojoType="openils.widget.AutoGrid"
                 fieldOrder="['id', 'name', 'code', 'owner', 'currency_type']"
                 query="{id: '*'}"
-                defaultCellWidth='12'
+                defaultCellWidth='"auto"'
+                autoHeight='true'
                 fmClass='acqpro'
                 editOnEnter='true'>
             <thead>
-                <tr><th field='name' get='getProviderName'/></tr>
+                <tr><th field='name' get='getProviderName' formatter='formatName'/></tr>
             </thead>
         </table>
+        <div/>
     </div>
 </div>
- <div id='provider-summary-pane'></div>     
+
+<div id='provider-summary-pane'></div>     
 <div id='provider-details-div' style='height:600px;'>
 <div dojoType="dijit.layout.TabContainer" style='height:100%;' jsId='providerTabs'>
 
     <div dojoType="dijit.layout.ContentPane" title='Provider Address' select='true' id='provider-address'>
-        
+
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div> Provider Address</div>
             <div>
-                <button dojoType='dijit.form.Button' onClick='paListGrid.showCreateDialog()'>New Provider Address</button>
-                <button dojoType='dijit.form.Button' onClick='paListGrid.deleteSelected()'>Delete Selected</button>
-            </div>
+            <button dojoType='dijit.form.Button' onClick='paListGrid.showCreateDialog()'>New Provider Address</button>
+            <button dojoType='dijit.form.Button' onClick='paListGrid.deleteSelected()'>Delete Selected</button>
         </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
+        </div>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:100px'>
             <table  jsId="paListGrid"
                     dojoType="openils.widget.AutoGrid"
                     fieldOrder="['id', 'address_type', 'provider', 'street1', 'street2', 'city', 'county', 'state', 'country', 'post_code']"
                     query="{id: '*'}"
                     fmClass='acqpa'
+                    defaultCellWidth='"auto"' 
                     editOnEnter='true'>
             </table>
         </div>
     </div>
-    
+
     <div dojoType="dijit.layout.ContentPane" title='Provider Contact' id='tab-pro-contact'>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div> Provider Contact</div>
             <div>
-                <button dojoType='dijit.form.Button' onClick='pcListGrid.showCreateDialog()'>New Contact</button>
-                <button dojoType='dijit.form.Button' onClick='pcListGrid.deleteSelected()'>Delete Selected</button>
+            <button dojoType='dijit.form.Button' onClick='pcListGrid.showCreateDialog()'>New Contact</button>
+            <button dojoType='dijit.form.Button' onClick='pcListGrid.deleteSelected()'>Delete Selected</button>
             </div>
         </div>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:200px'>
             <table  jsId="pcListGrid"
                     dojoType="openils.widget.AutoGrid"
                     fieldOrder="['id', 'name', 'provider', 'role', 'email']"
-                    defaultCellWidth='12'
+                    defaultCellWidth='"auto"'
                     query="{id: '*'}"
                     fmClass='acqpc'
                     editOnEnter='true'>
             </table>
         </div>
-    
+
     <div id='contact-addr-div'>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div>Contact Address</div>
             <div>
-                <button dojoType='dijit.form.Button' onClick='pcaListGrid.showCreateDialog()'>New Contact Address</button>
-                <button dojoType='dijit.form.Button' onClick='pcaListGrid.deleteSelected()'>Delete Selected</button>
+            <button dojoType='dijit.form.Button' onClick='pcaListGrid.showCreateDialog()'>New Contact Address</button>
+            <button dojoType='dijit.form.Button' onClick='pcaListGrid.deleteSelected()'>Delete Selected</button>
             </div>
         </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:200px'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
             <table  jsId="pcaListGrid"
                     dojoType="openils.widget.AutoGrid"
                     fieldOrder="['id', 'address_type', 'contact', 'street1', 'street2', 'city', 'county', 'state', 'country', 'post_code']"
                     query="{id: '*'}"
                     fmClass='acqpca'
+                    defaultCellWidth='"auto"' 
                     editOnEnter='true'>
-                
+
             </table>
         </div>
-    </div> 
-</div>
-    <div dojoType="dijit.layout.ContentPane" title='Attribute Definitions' id='tab-attr'>       
+    </div>
+    </div>
+    <div dojoType="dijit.layout.ContentPane" title='Attribute Definitions' id='tab-attr'>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div> Attribute Definitions</div>
             <div>
-                <button dojoType='dijit.form.Button' onClick='padListGrid.showCreateDialog()'>New Attribute Definition</button>
-                <button dojoType='dijit.form.Button' onClick='padListGrid.deleteSelected()'>Delete Selected</button>
+            <button dojoType='dijit.form.Button' onClick='padListGrid.showCreateDialog()'>New Attribute Definition</button>
+            <button dojoType='dijit.form.Button' onClick='padListGrid.deleteSelected()'>Delete Selected</button>
             </div>
         </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:200px'>
             <table  jsId="padListGrid"
                     dojoType="openils.widget.AutoGrid"
-                    fieldOrder="['id', 'provider', 'code', 'description', 'xpath', 'provider', 'ident']"
-                    defaultCellWidth='20'
+                    fieldOrder="['id', 'provider', 'code', 'description',  'provider', 'ident', 'remove',  'tag', 'subfield', 'xpath']"
                     query="{id: '*'}"
                     fmClass='acqlipad'
                     editOnEnter='true'>
-                
+                <thead>
+                    <tr>
+                        <th field="xpath" width='auto'/>
+                        <th field="tag" get='getParsedTag'/>
+                        <th field="subfield" get='getParsedSubf'/>
+                    </tr>
+                </thead>
             </table>
         </div>
     </div>
-    
-    <div dojoType="dijit.layout.ContentPane" title='Holding Subfield' id='tab-hold'>       
+
+    <div dojoType="dijit.layout.ContentPane" title='Holding Subfield' id='tab-hold'>
         <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
             <div>Holding Subfield</div>
             <div>
-                <button dojoType='dijit.form.Button' onClick='phsListGrid.showCreateDialog()'>New Holding Subfield</button>
-                <button dojoType='dijit.form.Button' onClick='phsListGrid.deleteSelected()'>Delete Selected</button>
+            <button dojoType='dijit.form.Button' onClick='phsListGrid.showCreateDialog()'>New Holding Subfield</button>
+            <button dojoType='dijit.form.Button' onClick='phsListGrid.deleteSelected()'>Delete Selected</button>
             </div>
         </div>
-        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
+        <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:200px'>
             <table  jsId="phsListGrid"
                     dojoType="openils.widget.AutoGrid"
                     fieldOrder="['id', 'provider', 'name', 'subfield']"
-                    defaultCellWidth='20'
                     query="{id: '*'}"
                     fmClass='acqphsm'
                     editOnEnter='true'>
-                <thead>
-                    <tr>
-                        <th field="name" formatter='formatName'/>
-                        </tr>
-                    </thead>
+
             </table>
         </div>
     </div>
-</div>  
+</div>
 </div>
 [% END %]