[open-ils-commits] r12535 - in trunk/Open-ILS/web: css/skin/default js/ui/default/acq/picklist templates/default/acq/picklist (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 16 09:51:31 EDT 2009
Author: erickson
Date: 2009-03-16 09:51:30 -0400 (Mon, 16 Mar 2009)
New Revision: 12535
Modified:
trunk/Open-ILS/web/css/skin/default/acq.css
trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js
trunk/Open-ILS/web/templates/default/acq/picklist/bib_search.tt2
Log:
more cleanup, plugged in get-selected operation, so back to original functionality
Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css 2009-03-16 13:21:59 UTC (rev 12534)
+++ trunk/Open-ILS/web/css/skin/default/acq.css 2009-03-16 13:51:30 UTC (rev 12535)
@@ -11,8 +11,8 @@
/* bib search */
#oils-acq-search-container { width:100%; }
-#oils-acq-search-sources-block { width:32%; vertical-align: top; float: left; margin-right: 10px;}
-#oils-acq-search-form-block { width:63%; vertical-align: top; float:right; }
+#oils-acq-search-sources-block { vertical-align: top; margin-top: 20px;}
+#oils-acq-search-form-block { vertical-align: top; margin-top: 20px;}
#oils-acq-search-sources-selector { padding: 2px; }
#oils-acq-search-sources-selector option { margin-bottom: 2px; }
.oils-acq-search-form-row { width: 100%; }
@@ -25,7 +25,8 @@
.oils-acq-search-subsources-label { margin-top: 5px; }
#oils-acq-search-sources-label { margin-bottom: 10px; }
#oils-acq-search-fields-label { margin-bottom: 10px; }
-#oils-acq-search-fields-submit-block { margin: 5px; text-align: center;}
+/*#oils-acq-search-fields-submit-block { margin: 5px; text-align: center;}*/
+#oils-acq-search-fields-submit-block { margin: 5px; }
#oils-acq-search-progress {width: 100%; text-align: center;}
#oils-acq-search-source-select option {padding: 5px;}
#oils-acq-search-fields-tbody td {padding: 3px;}
@@ -92,5 +93,5 @@
#oila-acq-picklist-result-table {width:100%}
-#oila-acq-picklist-result-table th {font-weight: bold; border-bottom:1px solid #888;}
-#oila-acq-picklist-result-table td {padding:6px; border-bottom:1px solid #888;}
+#oila-acq-picklist-result-table th {padding:5px; font-weight: bold; border-bottom:1px solid #888;}
+#oila-acq-picklist-result-table td {padding:5px; border-bottom:1px solid #888; height:3em;}
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-16 13:21:59 UTC (rev 12534)
+++ trunk/Open-ILS/web/js/ui/default/acq/picklist/bib_search.js 2009-03-16 13:51:30 UTC (rev 12535)
@@ -78,9 +78,15 @@
}
}
+var resultRow;
function doSearch(values) {
- dojo.style('oils-acq-pl-loading', 'visibility', 'visible');
+ showDiv('oils-acq-pl-loading');
+ var tbody = dojo.byId('plist-tbody');
+ if(!resultRow)
+ resultRow = tbody.removeChild(dojo.byId('plist-row'));
+ while(tbody.childNodes[0]) tbody.removeChild(tbody.childNodes[0]);
+
search = {
service : [],
username : [],
@@ -116,37 +122,60 @@
);
}
-function setRowAttr(row, liWrapper, field) {
+var selectState = false;
+function toggleSelect() {
+ var inputs = dojo.query('[name=selectbox]', dojo.byId('plist-tbody'));
+ if(selectState)
+ dojo.forEach(inputs, function(i){i.checked = false});
+ else
+ dojo.forEach(inputs, function(i){i.checked = true});
+ selectState = !selectState;
+}
+
+function getSelected() {
+ var inputs = dojo.query('[name=selectbox]', dojo.byId('plist-tbody'));
+ var selected = [];
+ dojo.forEach(inputs, function(i) {
+ if(i.checked)
+ selected.push(liCache[i.parentNode.parentNode.getAttribute('li')]);
+ });
+ return selected;
+}
+
+function setRowAttr(td, liWrapper, field) {
var val = liWrapper.findAttr(field, 'lineitem_marc_attr_definition') || '';
- dojo.query('[name='+field+']', row)[0].appendChild(document.createTextNode(val));
+ td.appendChild(document.createTextNode(val));
}
-var resultRow;
function handleResult(r) {
var result = openils.Util.readResponse(r);
dojo.style('oils-acq-pl-search-results', 'display', 'block');
- dojo.style('oils-acq-search-block', 'display', 'none');
-
var tbody = dojo.byId('plist-tbody');
- if(!resultRow)
- resultRow = tbody.removeChild(dojo.byId('plist-row'));
if(result.lineitem) {
var li = result.lineitem;
liCache[li.id()] = li;
var liWrapper = new openils.acq.Lineitem({lineitem:li});
var row = resultRow.cloneNode(true);
- var tds = dojo.query('[name]', row);
- dojo.forEach(tds, function(td) {setRowAttr(row, liWrapper, td.getAttribute('name'));});
+ row.setAttribute('li', li.id());
+ var tds = dojo.query('[attr]', row);
+ dojo.forEach(tds, function(td) {setRowAttr(td, liWrapper, td.getAttribute('attr'));});
+ dojo.query('[name=source_label]', row)[0].appendChild(document.createTextNode(li.source_label()));
tbody.appendChild(row);
}
+
+ if(result.complete) // hide the loading image
+ showDiv('oils-acq-pl-search-results');
}
-function showPlForm() {
- dojo.style('oils-acq-pl-search-results', 'display', 'none');
- dojo.style('oils-acq-search-block', 'display', 'block');
- dojo.style('oils-acq-pl-loading', 'visibility', 'hidden');
+function showDiv(div) {
+ var divs = [
+ 'oils-acq-pl-search-results',
+ 'oils-acq-search-block',
+ 'oils-acq-pl-loading' ];
+ dojo.forEach(divs, function(d) {dojo.style(d,'display', 'none')});
+ dojo.style(div, 'display', 'block');
}
function loadPLSelect() {
@@ -173,20 +202,8 @@
function saveResults(values) {
selectedLIs = resultLIs;
- if(values.which == 'selected') {
- selectedLIs = [];
- var selected = plResultGrid.selection.getSelected();
- for(var idx = 0; idx < selected.length; idx++) {
- var rowIdx = selected[idx];
- var id = plResultGrid.model.getRow(rowIdx).id;
- for(var i = 0; i < resultLIs.length; i++) {
- var pl = resultLIs[i];
- if(pl.id() == id) {
- selectedLIs.push(pl);
- }
- }
- }
- }
+ if(values.which == 'selected')
+ selectedLIs = getSelected();
if(values.new_name && values.new_name != '') {
// save selected lineitems to a new picklist
Modified: trunk/Open-ILS/web/templates/default/acq/picklist/bib_search.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/picklist/bib_search.tt2 2009-03-16 13:21:59 UTC (rev 12534)
+++ trunk/Open-ILS/web/templates/default/acq/picklist/bib_search.tt2 2009-03-16 13:51:30 UTC (rev 12535)
@@ -19,7 +19,7 @@
<div id='oils-acq-search-sources-label'>Search Sources</div>
<select style='overflow-y:auto;' id='oils-acq-search-source-select'
multiple='true' jsId="bibSourceSelect" dojoType="dojox.form.CheckedMultiSelect">
- <option value='native-evergreen-catalog'>Evergreen Catalog</option>
+ <option selected='selected' value='native-evergreen-catalog'>Evergreen Catalog</option>
</select>
</div>
<div id='oils-acq-search-form-block'>
@@ -40,27 +40,21 @@
value='10'></input>
</td>
</tr>
+ <tr id='oils-acq-search-fields-submit-block'>
+ <td><div dojoType='dijit.form.Button' type='submit'>Submit</div></td>
+ <td><div dojoType='dijit.form.Button' onclick='clearSearchForm()'>Clear Form</div></td>
+ </tr>
</tbody>
</table>
- <div id='oils-acq-search-fields-submit-block'>
- <div dojoType='dijit.form.Button' type='submit'>Submit</div>
-
- <div dojoType='dijit.form.Button' onclick='clearSearchForm()'>Clear Form</div>
- </div>
</div>
</form>
-
- <div id='oils-acq-pl-loading' style='visibility:hidden'>
- <img src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif'/>
- </div>
</div>
-
<div id='oils-acq-pl-search-results'>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
<div>Search Results</div>
<div>
- <div dojoType='dijit.form.Button' onClick='showPlForm'>New Search</div>
+ <div dojoType='dijit.form.Button' onClick='showDiv("oils-acq-search-block");'>New Search</div>
<div dojoType="dijit.form.DropDownButton">
<span>Save Results</span>
<div dojoType="dijit.TooltipDialog" execute="saveResults(arguments[0]);">
@@ -102,24 +96,33 @@
<table id='oila-acq-picklist-result-table'>
<thead>
<tr>
- <th>Select</th><th>Title</th><th>Author</th><th>ISBN</th><th>ISSN</th><th>Edition</th><th>Pubdate</th><th>Publisher</th>
+ <th><a href='javascript:toggleSelect();'>Select</a></th>
+ <th>Title</th><th>Author</th><th>ISBN</th>
+ <th>ISSN</th><th>Edition</th><th>Pubdate</th>
+ <th>Publisher</th><th>Source</th>
</tr>
</thead>
<tbody id='plist-tbody'>
<tr id='plist-row'>
<td name='selector'><input type='checkbox' name='selectbox'/></td>
- <td name='title'/>
- <td name='author'/>
- <td name='isbn'/>
- <td name='issn'/>
- <td name='edition'/>
- <td name='pubdate'/>
- <td name='publisher'/>
+ <td attr='title'/>
+ <td attr='author'/>
+ <td attr='isbn'/>
+ <td attr='issn'/>
+ <td attr='edition'/>
+ <td attr='pubdate'/>
+ <td attr='publisher'/>
+ <td name='source_label'/>
</tr>
</tbody>
</table>
</div>
</div>
+
+<div id='oils-acq-pl-loading' style='width:100%;margin-top:100px;display:none;text-align:center'>
+ <img src='[% ctx.media_prefix %]/opac/images/progressbar_green.gif'/>
+</div>
+
<script>dojo.style('oils-acq-pl-search-results', 'display', 'none');</script>
[% END %]
More information about the open-ils-commits
mailing list