[open-ils-commits] r12568 - in trunk/Open-ILS/web: css/skin/default js/ui/default/acq/common js/ui/default/acq/picklist templates/default/acq/common (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 17 18:10:34 EDT 2009
Author: erickson
Date: 2009-03-17 18:10:28 -0400 (Tue, 17 Mar 2009)
New Revision: 12568
Modified:
trunk/Open-ILS/web/css/skin/default/acq.css
trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js
trunk/Open-ILS/web/js/ui/default/acq/picklist/view.js
trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
added basic copy list grid (lineitem_details) linked from li table. other small tweaks
Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css 2009-03-17 22:09:22 UTC (rev 12567)
+++ trunk/Open-ILS/web/css/skin/default/acq.css 2009-03-17 22:10:28 UTC (rev 12568)
@@ -95,6 +95,9 @@
#acq-lit-table th {padding:5px; font-weight: bold; text-align:left;}
#acq-lit-table td {padding:2px;}
.acq-lit-row { border-bottom: 1px solid #AAA; }
-.acq-lit-alt-row td:first-child { width:30px; }
+.acq-lit-alt-row td { padding-left:30px; }
#acq-lit-info-tbody td {padding:5px;}
+#acq-lit-li-details-table {width:100%;}
+#acq-lit-li-details-table td {padding:5px;}
+#acq-lit-li-details-table th {padding:5px;}
Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-03-17 22:09:22 UTC (rev 12567)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-03-17 22:10:28 UTC (rev 12568)
@@ -1,6 +1,9 @@
+dojo.require('dijit.form.Button');
+dojo.require('dijit.form.TextBox');
dojo.require('openils.User');
dojo.require('openils.Util');
dojo.require('openils.acq.Lineitem');
+dojo.require('openils.widget.AutoFieldWidget');
function AcqLiTable() {
@@ -9,10 +12,13 @@
this.toggleState = false;
this.tbody = dojo.byId('acq-lit-tbody');
this.selectors = [];
+ this.authtoken = openils.User.authtoken;
this.rowTemplate = this.tbody.removeChild(dojo.byId('acq-lit-row'));
- this.authtoken = openils.User.authtoken;
+ this.copyTbody = dojo.byId('acq-lit-li-details-tbody');
+ this.copyRow = this.copyTbody.removeChild(dojo.byId('acq-lit-li-details-row'));
+
dojo.byId('acq-lit-select-toggle').onclick = function(){self.toggleSelect()};
- dojo.byId('acq-lit-info-back-button').onclick = function(){self.showTable()};
+ dojo.byId('acq-lit-info-back-button').onclick = function(){self.show('list')};
this.reset = function() {
while(self.tbody.childNodes[0])
@@ -40,21 +46,27 @@
}
};
+ this.show = function(div) {
+ openils.Util.hide('acq-lit-table-div');
+ openils.Util.hide('acq-lit-info-div');
+ openils.Util.hide('acq-lit-li-details');
+ switch(div){
+ case 'list':
+ openils.Util.show('acq-lit-table-div');
+ break;
+ case 'info':
+ openils.Util.show('acq-lit-info-div');
+ break;
+ case 'copies':
+ openils.Util.show('acq-lit-li-details');
+ break;
+ }
+ }
- this.showTable = function() {
- dojo.style(dojo.byId('acq-lit-table-div'), 'display', 'block');
- dojo.style(dojo.byId('acq-lit-info-div'), 'display', 'none');
- };
+ this.hide = function() {
+ this.show(null);
+ }
- this.hideTable = function() {
- dojo.style(dojo.byId('acq-lit-table-div'), 'display', 'none');
- };
-
- this.showInfo = function() {
- self.hideTable();
- dojo.style(dojo.byId('acq-lit-info-div'), 'display', 'block');
- };
-
this.toggleSelect = function() {
if(self.toggleState)
dojo.forEach(self.selectors, function(i){i.checked = false});
@@ -93,19 +105,27 @@
// XXX media prefix for added content
dojo.query('[name=jacket]', row)[0].setAttribute('src', '/opac/extras/ac/jacket/small/' + isbn);
}
- dojo.query('[attr=title]', row)[0].onclick = function() {self.drawInfo(li.id())};
+ dojo.query('[name=infolink]', row)[0].onclick = function() {self.drawInfo(li.id())};
+ dojo.query('[name=copieslink]', row)[0].onclick = function() {self.drawCopies(li.id())};
self.tbody.appendChild(row);
self.selectors.push(dojo.query('[name=selectbox]', row)[0]);
};
this.drawInfo = function(liId) {
- this.showInfo();
+ this.show('info');
openils.acq.Lineitem.fetchAttrDefs(
- function() { self._fetchLineitem(liId); }
+ function() {
+ self._fetchLineitem(liId, function(li){self._drawInfo(li);});
+ }
);
};
- this._fetchLineitem = function(liId) {
+ this._fetchLineitem = function(liId, handler) {
+
+ if(this.liCache[liId] && this.liCache[liId].marc()) {
+ return handler(this.liCache[liId]);
+ }
+
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem.retrieve'],
{ async: true,
@@ -118,7 +138,7 @@
oncomplete: function(r) {
var li = openils.Util.readResponse(r);
- self._drawInfo(li);
+ handler(li)
}
}
);
@@ -160,6 +180,52 @@
}
);
}
+
+ this.drawCopies = function(liId) {
+ this.show('copies');
+ openils.acq.Lineitem.fetchAttrDefs(
+ function() {
+ self._fetchLineitem(liId, function(li){self._drawCopies(li);});
+ }
+ );
+ };
+
+
+ this._drawCopies = function(li) {
+ acqLitAddCopyCount.onClick = function() {
+ var count = acqLitCopyCountInput.attr('value');
+ for(var i = 0; i < count; i++)
+ self.addCopy(li);
+ }
+ dojo.forEach(li.lineitem_details(),
+ function(copy) {
+ self.addCopy(copy);
+ }
+ );
+ };
+
+ this.addCopy = function(li, copy) {
+ var row = this.copyRow.cloneNode(true);
+ this.copyTbody.appendChild(row);
+
+ dojo.forEach(['fund', 'owning_lib', 'location'],
+ function(field) {
+ var widget = new openils.widget.AutoFieldWidget({
+ fmObject : copy,
+ fmField : field,
+ fmClass : 'acqlid',
+ parentNode : dojo.query('[name='+field+']', row)[0],
+ orgLimitPerms : ['CREATE_PICKLIST'],
+ });
+ widget.build();
+ }
+ );
+
+ if(copy) {
+ dojo.query('[name=barcode]', row)[0].value = copy.barcode();
+ dojo.query('[name=cn_label]', row)[0].value = copy.cn_label();
+ }
+ }
}
Modified: trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js 2009-03-17 22:09:22 UTC (rev 12567)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js 2009-03-17 22:10:28 UTC (rev 12568)
@@ -129,7 +129,7 @@
function handleResult(r) {
var result = openils.Util.readResponse(r);
- liTable.showTable();
+ liTable.show('list');
dojo.style(dojo.byId('oils-acq-pl-search-results'), 'display', 'block');
var tbody = dojo.byId('plist-tbody');
if(result.lineitem)
@@ -144,7 +144,7 @@
'oils-acq-search-block',
'oils-acq-pl-loading' ];
dojo.forEach(divs, function(d) {dojo.style(d,'display', 'none')});
- liTable.hideTable();
+ liTable.hide();
dojo.style(div, 'display', 'block');
}
Modified: trunk/Open-ILS/web/js/ui/default/acq/picklist/view.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/picklist/view.js 2009-03-17 22:09:22 UTC (rev 12567)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/view.js 2009-03-17 22:10:28 UTC (rev 12568)
@@ -79,7 +79,7 @@
params: [openils.User.authtoken, plId,
{flesh_attrs:true, clear_marc:true, offset:plOffset, limit:plLimit}],
onresponse: function(r) {
- liTable.showTable();
+ liTable.show('list');
liTable.addLineitem(openils.Util.readResponse(r));
}
}
Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-03-17 22:09:22 UTC (rev 12567)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-03-17 22:10:28 UTC (rev 12568)
@@ -20,25 +20,29 @@
<tbody id='acq-lit-tbody'>
<tr id='acq-lit-row' class='acq-lit-row'>
<td name='selector'><input type='checkbox' name='selectbox'/></td>
- <td>
- <table>
- <tr>
- <td rowspan='3'><img style='width:40px;height:65px;' name='jacket'/></td>
- <td colspan='0'><a href='javascript:void(0);' attr='title'></a></td>
- </tr>
- <tr class='acq-lit-alt-row'>
- <td/>
- <td attr='author'/>
- <td attr='isbn'/>
- <td attr='issn'/>
- <td attr='edition'/>
- <td attr='pubdate'/>
- <td attr='publisher'/>
- </tr>
- <tr class='acq-lit-alt-row'>
- <td/>
- <td name='source_label' colspan='0'/>
- </tr>
+ <td style='width:100%;'>
+ <table style='width:100%;'>
+ <tbody>
+ <tr>
+ <td rowspan='2'><img style='width:40px;height:65px;' name='jacket'/></td>
+ <td attr='title' style='width:70%;font-weight:bold;'/>
+ <td style='text-align:right'>
+ <a name='infolink' href='javascript:void(0);'>Details</a>
+ <a name='copieslink' href='javascript:void(0);'>Copies</a>
+ </td>
+ </tr>
+ <tr class='acq-lit-alt-row'>
+ <td colspan='0'>
+ <span attr='author'></span>
+ <span attr='isbn'></span>
+ <span attr='issn'></span>
+ <span attr='edition'></span>
+ <span attr='pubdate'></span>
+ <span attr='publisher'></span>
+ <span name='source_label'/>
+ </td>
+ </tr>
+ </tbody>
</table>
</td>
</tr>
@@ -59,5 +63,36 @@
</div>
</div>
+ <div id='acq-lit-li-details' class='hidden'>
+ <h2>Copies</h2>
+ <table id='acq-lit-li-details-table'>
+ <thead>
+ <tr>
+ <th>Owning Branch</th>
+ <th>Shelving Location</th>
+ <th>Fund</th>
+ <th>Barcode</th>
+ <th>Callnumber</th>
+ <th style='text-align:right;width:30%'>
+ Add items to order:
+ <input dojoType='dijit.form.NumberTextBox' jsId='acqLitCopyCountInput'
+ constraints="{min:1,max:1000,places:0}" style='width:40px' value='1'></input>
+ <div dojoType='dijit.form.Button' jsId='acqLitAddCopyCount'>Go</div>
+ </th>
+ </tr>
+ </thead>
+ <tbody id='acq-lit-li-details-tbody'>
+ <tr id='acq-lit-li-details-row'>
+ <td><div name='owning_lib'/></td>
+ <td><div name='location'/></td>
+ <td><div name='fund'/></td>
+ <td><input type='text' name='barcode'/></td>
+ <td><input type='text' name='cn_label'/></td>
+ <td/>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
</div>
More information about the open-ils-commits
mailing list