[open-ils-commits] r13020 - in trunk/Open-ILS/web: js/ui/default/conify/global/acq templates/default/conify/global/acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 29 16:05:35 EDT 2009
Author: erickson
Date: 2009-04-29 16:05:31 -0400 (Wed, 29 Apr 2009)
New Revision: 13020
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/acq/provider.js
trunk/Open-ILS/web/templates/default/conify/global/acq/provider.tt2
Log:
big re-work of the provider config page
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/acq/provider.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/acq/provider.js 2009-04-29 18:08:55 UTC (rev 13019)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/acq/provider.js 2009-04-29 20:05:31 UTC (rev 13020)
@@ -1,3 +1,4 @@
+dojo.require('dijit.layout.TabContainer');
dojo.require('openils.widget.AutoGrid');
dojo.require('dijit.form.FilteringSelect');
dojo.require('openils.PermaCrud');
@@ -2,51 +3,97 @@
var provider;
-var contactIds = [];
+
function draw() {
if(providerId) {
openils.Util.addCSSClass(dojo.byId('provider-list-div'), 'hidden');
+ console.log('in draw');
+ var pcrud = new openils.PermaCrud();
+ pcrud.retrieve('acqpro', providerId, {
+ oncomplete : function(r) {
+ provider = openils.Util.readResponse(r);
+ console.log('provider is' + js2JSON(provider));
+ var pane = new openils.widget.EditPane({fmObject:provider}, dojo.byId('provider-summary-pane'));
+ pane.startup();
+ console.log("pane started");
+ dojo.connect(providerTabs, 'selectChild', drawProviderSummary);
+ }
+
+ });
+
drawProviderSummary();
} else {
+ console.log('in else block');
openils.Util.addCSSClass(dojo.byId('provider-details-div'), 'hidden');
+ pListGrid.loadAll({order_by:{acqpro : 'name'}});
pListGrid.onPostCreate = function(fmObject) {
location.href = location.href + '/' + fmObject.id();
}
- pListGrid.loadAll({order_by:{acqpro : 'name'}});
+
}
+
}
-openils.Util.addOnLoad(draw);
-
-function drawProviderSummary() {
- openils.Util.removeCSSClass(dojo.byId('provider-details-div'), 'hidden');
- var pcrud = new openils.PermaCrud();
- pcrud.retrieve('acqpro', providerId, {
- oncomplete : function(r) {
- provider = openils.Util.readResponse(r);
- var pane = new openils.widget.EditPane({fmObject:provider}, dojo.byId('provider-summary-pane'));
- pane.startup();
-
- }
- });
- paListGrid.overrideEditWidgets.provider = new
- dijit.form.TextBox({style:'display:none', value: providerId});
- paListGrid.loadAll({order_by:{acqpa : 'provider'}}, {provider : providerId});
- pcListGrid.overrideEditWidgets.provider = new
- dijit.form.TextBox({style:'display:none', value: providerId});
- pcListGrid.loadAll(
- {
- order_by:{acqpc : 'name'},
-
- oncomplete: function(){
- pcListGrid.store.fetch({
- onComplete: function(items) {
- dojo.forEach(items, function(item) {
- contactIds.push(pcListGrid.store.getValue(item, 'id')); }
- );
- console.log("contact IDs are " + js2JSON(contactIds));
- pcaListGrid.overrideEditWidgets.contact = new
- dijit.form.FilteringSelect({store: pcListGrid.store});
- pcaListGrid.loadAll({order_by:{acqpca : 'contact'}}, {contact: contactIds});
+function drawProviderSummary(child) {
+ console.log(child);
+ openils.Util.addCSSClass(dojo.byId('provider-details-div'), 'visible');
+ console.log("hidden provider-details");
+
+ var loadedTabs = {'provider-address' : true};
+ if(child){
+ if(loadedTabs[child.id]) return;
+ loadedTabs[child.id] = true;
+ switch(child.id) {
+ case 'tab-pro-contact':
+ pcListGrid.overrideEditWidgets.provider = new
+ dijit.form.TextBox({disabled: 'true', value: providerId});
+ openils.Util.removeCSSClass(dojo.byId('contact-addr-div'), 'hidden');
+ pcListGrid.resetStore();
+ pcListGrid.loadAll( {oncomplete:function(r){
+ var count = 0;
+ pcListGrid.store.fetch( {onComplete:function(list) {
+ count = list.length
+ if(count>=1){
+ var contactIds = [];
+ dojo.forEach(list, function(item) {
+ contactIds.push(pcListGrid.store.getValue(item, 'id')); }
+ );
+ openils.Util.addCSSClass(dojo.byId('contact-addr-div'), 'visible');
+ pcaListGrid.overrideEditWidgets.contact = new
+ dijit.form.FilteringSelect({store: pcListGrid.store});
+ pcaListGrid.resetStore();
+ pcaListGrid.loadAll({order_by:{acqpca : 'contact'}}, {contact: contactIds});
+ }else{
+ return;
+ }
+ }
}
- });
+ );
+ }
+ }, {provider : providerId});
+
+ break;
+ case 'tab-attr':
+ padListGrid.overrideEditWidgets.provider = new
+ dijit.form.TextBox({disabled: 'true', value: providerId});
+ padListGrid.resetStore();
+ padListGrid.loadAll({order_by:{acqlipad : 'provider'}}, {provider : providerId});
+ break;
+ case 'tab-hold':
+ phsListGrid.overrideEditWidgets.provider = new
+ dijit.form.TextBox({disabled: 'true', value: providerId});
+ phsListGrid.overrideEditWidgets.name = nameSelect;
+ phsListGrid.resetStore();
+ phsListGrid.loadAll({order_by:{acqphsm : 'provider'}}, {provider : providerId});
+ break;
+ default:
+ paListGrid.overrideEditWidgets.provider = new
+ dijit.form.TextBox({disabled: 'true', value: providerId});
+ paListGrid.resetStore();
+ paListGrid.loadAll({order_by:{acqpa:'provider'}}, {provider: providerId});
}
- }, {provider : providerId});
+
+ } else {
+ paListGrid.overrideEditWidgets.provider = new
+ dijit.form.TextBox({disabled: 'true', value: providerId});
+ paListGrid.resetStore();
+ paListGrid.loadAll({order_by:{acqpa:'provider'}}, {provider: providerId});
+ }
}
@@ -60,3 +107,4 @@
this.grid.store.getValue(item, 'name') + '</a>';
}
+openils.Util.addOnLoad(draw);
Modified: trunk/Open-ILS/web/templates/default/conify/global/acq/provider.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/acq/provider.tt2 2009-04-29 18:08:55 UTC (rev 13019)
+++ trunk/Open-ILS/web/templates/default/conify/global/acq/provider.tt2 2009-04-29 20:05:31 UTC (rev 13020)
@@ -1,16 +1,54 @@
[% 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">
+ function formatName(inDatum) {
+ switch (inDatum) {
+ case 'owning_lib':
+ return 'Owning Library';
+ case 'quantity':
+ return 'Quantity';
+ case 'call_number':
+ return 'Call Number';
+ case 'fund_code':
+ return 'Fund Code';
+ case 'local_note':
+ return 'Local Note';
+ case 'price':
+ return 'Price';
+ case 'circ-Modifier':
+ return 'Circulation Modifier';
+ case 'copy_location':
+ return 'Copy Location';
+ case 'collection_code':
+ return 'Collection Code';
+ }
+ }
-
-<div id='provider-list-div'>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ </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 Locations</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>
- <button dojoType='dijit.form.Button' onClick='pListGrid.showCreateDialog()'>New Provider</button>
- <button dojoType='dijit.form.Button' onClick='pListGrid.deleteSelected()'>Delete Selected</button> </div>
+ <div>Provider</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='pListGrid.showCreateDialog()'>New Provider</button>
+ <button dojoType='dijit.form.Button' onClick='pListGrid.deleteSelected()'>Delete Selected</button> </div>
</div>
+ </div>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:90%'>
<table jsId="pListGrid"
dojoType="openils.widget.AutoGrid"
fieldOrder="['id', 'name', 'code', 'owner', 'currency_type']"
@@ -24,16 +62,16 @@
</table>
</div>
</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 id='provider-details-div'>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
- <div id='provider-summary-pane'/>
- </div>
+ <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> Provider Address</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:100px'>
<table jsId="paListGrid"
@@ -44,10 +82,13 @@
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> Provider Contact</div>
<button dojoType='dijit.form.Button' onClick='pcListGrid.showCreateDialog()'>New Contact</button>
+ <button dojoType='dijit.form.Button' onClick='pcListGrid.deleteSelected()'>Delete Selected</button>
</div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:200px'>
<table jsId="pcListGrid"
@@ -59,24 +100,67 @@
editOnEnter='true'>
</table>
</div>
-
-
-
+
+ <div id='contact-addr-div'>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
<div>Contact Address</div>
<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 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', 'provider', 'street1', 'street2', 'city', 'county', 'state', 'country', 'post_code']"
+ fieldOrder="['id', 'address_type', 'contact', 'street1', 'street2', 'city', 'county', 'state', 'country', 'post_code']"
query="{id: '*'}"
fmClass='acqpca'
editOnEnter='true'>
-
+
</table>
</div>
+ </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>
+ <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 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'
+ query="{id: '*'}"
+ fmClass='acqlipad'
+ editOnEnter='true'>
+
+ </table>
+ </div>
</div>
+
+ <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>
+ <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 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>
[% END %]
More information about the open-ils-commits
mailing list