[open-ils-commits] r12485 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/cat xul/staff_client/server/cat (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Mar 10 12:46:14 EDT 2009
Author: phasefx
Date: 2009-03-10 12:46:11 -0400 (Tue, 10 Mar 2009)
New Revision: 12485
Modified:
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
trunk/Open-ILS/xul/staff_client/server/cat/marc_new.xul
trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
trunk/Open-ILS/xul/staff_client/server/cat/marcedit.xul
trunk/Open-ILS/xul/staff_client/server/cat/util.js
trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
Log:
Fast single item add from within marc editor. Good for home users, but all catalogers might like this too. Only working in z39.50 and New MARC interfaces, though I want to enable it when editing
existing bib records (code placement issues with JSAN and remote vs chrome, bleh :)
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-03-10 16:46:11 UTC (rev 12485)
@@ -2044,6 +2044,12 @@
<!ENTITY staff.cat.marcedit.options.label "Options">
<!ENTITY staff.cat.marcedit.stackSubfields.label "Stack subfields">
<!ENTITY staff.cat.marcedit.stackSubfields.accesskey "s">
+<!ENTITY staff.cat.marcedit.fastItemAdd.label "Fast Item Add">
+<!ENTITY staff.cat.marcedit.fastItemAdd.accesskey "A">
+<!ENTITY staff.cat.marcedit.fastItemAdd_callnumber.label "Call Number">
+<!ENTITY staff.cat.marcedit.fastItemAdd_callnumber.accesskey "C">
+<!ENTITY staff.cat.marcedit.fastItemAdd_barcode.label "Item Barcode">
+<!ENTITY staff.cat.marcedit.fastItemAdd_barcode.accesskey "B">
<!ENTITY staff.cat.marcedit.validate.label "Validate">
<!ENTITY staff.cat.marcedit.validate.accesskey "V">
<!ENTITY staff.cat.marcedit.save-button.accesskey "d">
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/cat/opac.js 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/cat/opac.js 2009-03-10 16:46:11 UTC (rev 12485)
@@ -19,6 +19,9 @@
JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
XML_HTTP_SERVER = g.data.server_unadorned;
+ //JSAN.addRepository('http://' + g.data.server_unadorned + '/xul/server/');
+ //JSAN._loadJSFromUrl('http://' + g.data.server_unadorned + '/xul/server/cat/util.js');
+
JSAN.use('util.network'); g.network = new util.network();
g.cgi = new CGI();
@@ -73,6 +76,15 @@
var b = {};
var c = {
'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid },
+ /* // FIXME - disable this until we find a good way of pulling remote JSAN libraries into chrome
+ 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
+ try {
+ JSAN.use('cat.util'); return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
+ } catch(E) {
+ alert(E);
+ }
+ },
+ */
'save' : {
'label' : document.getElementById('offlineStrings').getString('cat.save_record'),
'func' : function (new_marcxml) {
@@ -85,6 +97,10 @@
throw(r);
} else {
alert(document.getElementById('offlineStrings').getString("cat.save.success"));
+ return {
+ 'id' : r.id(),
+ 'oncomplete' : function() {}
+ };
}
} catch(E) {
g.error.standard_unexpected_error_alert(document.getElementById('offlineStrings').getString("cat.save.failure"), E);
Modified: trunk/Open-ILS/xul/staff_client/server/cat/marc_new.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marc_new.xul 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marc_new.xul 2009-03-10 16:46:11 UTC (rev 12485)
@@ -91,6 +91,13 @@
var url = urls.XUL_MARC_EDIT;
var params = {
'record' : { 'marc' : marc },
+ 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
+ try {
+ JSAN.use('cat.util'); return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
+ } catch(E) {
+ alert(E);
+ }
+ },
'save' : {
'label' : catStrings.getString('staff.cat.marc_new.create_record.label'),
'func' : function(new_marcxml) {
@@ -110,11 +117,20 @@
'authtime' : ses('authtime'),
'opac_url' : opac_url
};
- xulG.set_tab(
- xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
- {'tab_name': catStrings.getString('staff.cat.marc_new.retrieving.label')},
- content_params
- );
+ return {
+ 'id' : robj.id(),
+ 'on_complete' : function() {
+ try {
+ xulG.set_tab(
+ xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+ {'tab_name': catStrings.getString('staff.cat.marc_new.retrieving.label')},
+ content_params
+ );
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
} catch(E) {
g.error.standard_unexpected_error_alert(
Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js 2009-03-10 16:46:11 UTC (rev 12485)
@@ -109,7 +109,7 @@
document.getElementById('save-button').setAttribute('oncommand',
'mangle_005(); ' +
'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' +
- 'window.xulG.save.func( xml_string ); ' +
+ 'save_attempt( xml_string ); ' +
'loadRecord(xml_record);'
);
@@ -242,6 +242,11 @@
loadRecord(xml_record);
+ if (! xulG.fast_add_item) {
+ document.getElementById('fastItemAdd_checkbox').hidden = true;
+ }
+ document.getElementById('fastItemAdd_textboxes').hidden = document.getElementById('fastItemAdd_checkbox').hidden || !document.getElementById('fastItemAdd_checkbox').checked;
+
} catch(E) {
alert('FIXME, MARC Editor, my_init: ' + E);
}
@@ -1229,13 +1234,48 @@
var list = document.getElementsByAttribute('name','sf_box');
var o = 'vertical';
- if (!checkbox.checked /* this property gets changed after the oncommand handler, so we're testing for the opposite value */) o = 'horizontal';
+ if (!checkbox.checked) o = 'horizontal';
for (var i = 0; i < list.length; i++) {
if (list[i]) list[i].setAttribute('orient',o);
}
}
+function fastItemAdd_toggle(checkbox) {
+ var x = document.getElementById('fastItemAdd_textboxes');
+ if (checkbox.checked) {
+ x.hidden = false;
+ document.getElementById('fastItemAdd_callnumber').focus();
+ document.getElementById('fastItemAdd_callnumber').select();
+ } else {
+ x.hidden = true;
+ }
+}
+
+function fastItemAdd_attempt(doc_id) {
+ try {
+ if (typeof window.xulG.fast_add_item != 'function') { return; }
+ if (!document.getElementById('fastItemAdd_checkbox').checked) { return; }
+ if (!document.getElementById('fastItemAdd_callnumber').value) { return; }
+ if (!document.getElementById('fastItemAdd_barcode').value) { return; }
+ window.xulG.fast_add_item( doc_id, document.getElementById('fastItemAdd_callnumber').value, document.getElementById('fastItemAdd_barcode').value );
+ } catch(E) {
+ alert('fastItemAdd_attempt: ' + E);
+ }
+}
+
+function save_attempt(xml_string) {
+ try {
+ var result = window.xulG.save.func( xml_string );
+ if (result) {
+ if (result.id) fastItemAdd_attempt(result.id);
+ if (typeof result.on_complete == 'function') result.on_complete();
+ }
+ } catch(E) {
+ alert('save_attempt: ' + E);
+ }
+}
+
function marcDatafield (field) {
var row = createRow(
{ class : 'marcDatafieldRow' },
Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.xul 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.xul 2009-03-10 16:46:11 UTC (rev 12485)
@@ -24,7 +24,14 @@
<groupbox flex="0">
<caption label="&staff.cat.marcedit.options.label;"/>
<hbox flex="1">
- <checkbox persist="checked" accesskey='&staff.cat.marcedit.stackSubfields.accesskey;' label="&staff.cat.marcedit.stackSubfields.label;" oncommand="stackSubfields(this);" checked="false" id="stackSubfields"/>
+ <checkbox persist="checked" accesskey="&staff.cat.marcedit.stackSubfields.accesskey;" label="&staff.cat.marcedit.stackSubfields.label;" oncommand="stackSubfields(this);" checked="false" id="stackSubfields"/>
+ <checkbox persist="checked" accesskey="&staff.cat.marcedit.fastItemAdd.accesskey;" label="&staff.cat.marcedit.fastItemAdd.label;" oncommand="fastItemAdd_toggle(this);" checked="false" id="fastItemAdd_checkbox"/>
+ <hbox id="fastItemAdd_textboxes">
+ <label control="fastItemAdd_callnumber" accesskey="&staff.cat.marcedit.fastItemAdd_callnumber.accesskey;" value="&staff.cat.marcedit.fastItemAdd_callnumber.label;" />
+ <textbox id="fastItemAdd_callnumber" persist="value" onchange="this.setAttribute('value',this.value);"/>
+ <label control="fastItemAdd_barcode" accesskey="&staff.cat.marcedit.fastItemAdd_barcode.accesskey;" value="&staff.cat.marcedit.fastItemAdd_barcode.label;" />
+ <textbox id="fastItemAdd_barcode"/>
+ </hbox>
<button label="&staff.cat.marcedit.validate.label;" accesskey="&staff.cat.marcedit.validate.accesskey;" oncommand="validateAuthority(this);"/>
<button id="save-button" accesskey="&staff.cat.marcedit.save-button.accesskey;"/>
<button label="&staff.cat.marcedit.help.label;" accesskey="&staff.cat.marcedit.help.accesskey;"
Modified: trunk/Open-ILS/xul/staff_client/server/cat/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/util.js 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/server/cat/util.js 2009-03-10 16:46:11 UTC (rev 12485)
@@ -7,7 +7,7 @@
cat.util.EXPORT_OK = [
'spawn_copy_editor', 'add_copies_to_bucket', 'show_in_opac', 'spawn_spine_editor', 'transfer_copies',
- 'mark_item_missing', 'mark_item_damaged', 'replace_barcode',
+ 'mark_item_missing', 'mark_item_damaged', 'replace_barcode', 'fast_item_add'
];
cat.util.EXPORT_TAGS = { ':all' : cat.util.EXPORT_OK };
@@ -443,5 +443,48 @@
}
}
+cat.util.fast_item_add = function(doc_id,cn_label,cp_barcode) {
+ var error;
+ try {
+ JSAN.use('util.error'); error = new util.error();
+ JSAN.use('util.network'); var network = new util.network();
+
+ var acn_id = network.simple_request(
+ 'FM_ACN_FIND_OR_CREATE',
+ [ ses(), cn_label, doc_id, ses('ws_ou') ]
+ );
+
+ if (typeof acn_id.ilsevent != 'undefined') {
+ error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.volume_copy_creator.stash_and_close.problem_with_volume', [cn]), acn_id);
+ return;
+ }
+
+ var copy_obj = new acp();
+ copy_obj.id( -1 );
+ copy_obj.isnew('1');
+ copy_obj.barcode( cp_barcode );
+ copy_obj.call_number( acn_id );
+ copy_obj.circ_lib( ses('ws_ou') );
+ /* FIXME -- use constants */
+ copy_obj.deposit(0);
+ copy_obj.price(0);
+ copy_obj.deposit_amount(0);
+ copy_obj.fine_level(2);
+ copy_obj.loan_duration(2);
+ copy_obj.location(1);
+ copy_obj.status(0);
+ copy_obj.circulate(get_db_true());
+ copy_obj.holdable(get_db_true());
+ copy_obj.opac_visible(get_db_true());
+ copy_obj.ref(get_db_false());
+
+ JSAN.use('util.window'); var win = new util.window();
+ JSAN.use('cat.util');
+ return cat.util.spawn_copy_editor( { 'handle_update' : 1, 'edit' : 1, 'docid' : doc_id, 'copies' : [ copy_obj ] });
+
+ } catch(E) {
+ if (error) error.standard_unexpected_error_alert('cat.util.fast_item_add',E); else alert('FIXME: ' + E);
+ }
+}
dump('exiting cat/util.js\n');
Modified: trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2009-03-10 16:05:20 UTC (rev 12484)
+++ trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2009-03-10 16:46:11 UTC (rev 12485)
@@ -595,6 +595,13 @@
{ 'tab_name' : 'MARC Editor' },
{
'record' : { 'marc' : my_marcxml },
+ 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
+ try {
+ JSAN.use('cat.util'); return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
+ } catch(E) {
+ alert(E);
+ }
+ },
'save' : {
'label' : 'Import Record',
'func' : function (new_marcxml) {
@@ -632,7 +639,16 @@
throw(r3);
} else {
alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_overlay'));
- obj.replace_tab_with_opac(r3.id());
+ return {
+ 'id' : r3.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r3.id());
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
}
break;
case 1:
@@ -645,7 +661,16 @@
throw(r2);
} else {
alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import_with_new_tcn'));
- obj.replace_tab_with_opac(r2.id());
+ return {
+ 'id' : r2.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r2.id());
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
}
break;
case 2:
@@ -660,7 +685,16 @@
}
} else {
alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import'));
- obj.replace_tab_with_opac(r.id());
+ return {
+ 'id' : r.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r.id());
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
}
} catch(E) {
obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_error'),E);
@@ -722,6 +756,13 @@
{ 'tab_name' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.tab_name') },
{
'record' : { 'marc' : my_marcxml },
+ 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
+ try {
+ JSAN.use('cat.util'); cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
+ } catch(E) {
+ alert(E);
+ }
+ },
'save' : {
'label' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_record_label'),
'func' : function (new_marcxml) {
@@ -762,7 +803,16 @@
throw(r2);
} else {
alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.successful_overlay_with_new_TCN'));
- obj.replace_tab_with_opac(r2.id());
+ return {
+ 'id' : r2.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r2.id());
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
}
break;
case 1:
@@ -777,7 +827,16 @@
}
} else {
alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.success_overlay'));
- obj.replace_tab_with_opac(r.id());
+ return {
+ 'id' : r.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r.id());
+ } catch(E) {
+ alert(E);
+ }
+ }
+ };
}
} catch(E) {
obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_error'),E);
More information about the open-ils-commits
mailing list