[open-ils-commits] r18005 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/cat xul/staff_client/server/locale/en-US (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Sep 26 06:02:44 EDT 2010
Author: phasefx
Date: 2010-09-26 06:02:38 -0400 (Sun, 26 Sep 2010)
New Revision: 18005
Modified:
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul
trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
Log:
make the MARC editor optional with Z39.50
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2010-09-26 09:23:43 UTC (rev 18004)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2010-09-26 10:02:38 UTC (rev 18005)
@@ -2751,9 +2751,11 @@
<!ENTITY staff.cat.z3950.menuitem.save_columns.label "Save List Configuration">
<!ENTITY staff.cat.z3950.marc_view.label "MARC View">
<!ENTITY staff.cat.z3950.marc_view.accesskey "V">
-<!ENTITY staff.cat.z3950.marc_import_overlay.label "MARC Editor for Overlay">
+<!ENTITY staff.cat.z3950.marc_editor.label "MARC Editor">
+<!ENTITY staff.cat.z3950.marc_editor.accesskey "E">
+<!ENTITY staff.cat.z3950.marc_import_overlay.label "Overlay">
<!ENTITY staff.cat.z3950.marc_import_overlay.accesskey "O">
-<!ENTITY staff.cat.z3950.result_message.marc_import.label "MARC Editor for Import">
+<!ENTITY staff.cat.z3950.result_message.marc_import.label "Import">
<!ENTITY staff.cat.z3950.result_message.marc_import.accesskey "I">
<!ENTITY staff.pat.barcode_entry.retrieve_patron.label "Retrieve Patron">
<!ENTITY staff.pat.barcode_entry.barcode.label "Barcode:">
Modified: trunk/Open-ILS/xul/staff_client/server/cat/z3950.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2010-09-26 09:23:43 UTC (rev 18004)
+++ trunk/Open-ILS/xul/staff_client/server/cat/z3950.js 2010-09-26 10:02:38 UTC (rev 18005)
@@ -718,119 +718,126 @@
'spawn_marc_editor' : function(my_marcxml,biblio_source) {
var obj = this;
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_MARC_EDIT),
- { 'tab_name' : 'MARC Editor' },
- {
- 'record' : { 'marc' : my_marcxml, "rtype": "bre" },
- '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) {
- try {
- var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]);
- if (typeof r.ilsevent != 'undefined') {
- switch(Number(r.ilsevent)) {
- case 1704 /* TCN_EXISTS */ :
- var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.same_tcn', [r.payload.tcn]);
- var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.title');
- var btn1 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn1_overlay');
- var btn2 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.btn2_import', [r.payload.new_tcn]);
- if (btn2) {
- obj.data.init({'via':'stash'});
- var robj = obj.network.simple_request(
- 'PERM_CHECK',[
- ses(),
- obj.data.list.au[0].id(),
- obj.data.list.au[0].ws_ou(),
- [ 'ALLOW_ALT_TCN' ]
- ]
- );
- if (typeof robj.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.permission_error'),E);
+
+ function save_marc (new_marcxml) {
+ try {
+ var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]);
+ if (typeof r.ilsevent != 'undefined') {
+ switch(Number(r.ilsevent)) {
+ case 1704 /* TCN_EXISTS */ :
+ var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.same_tcn', [r.payload.tcn]);
+ var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.title');
+ var btn1 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn1_overlay');
+ var btn2 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor.btn2_import', [r.payload.new_tcn]);
+ if (btn2) {
+ obj.data.init({'via':'stash'});
+ var robj = obj.network.simple_request(
+ 'PERM_CHECK',[
+ ses(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
+ [ 'ALLOW_ALT_TCN' ]
+ ]
+ );
+ if (typeof robj.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.permission_error'),E);
+ }
+ if (robj.length != 0) btn2 = null;
+ }
+ var btn3 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn3_cancel_import');
+ var p = obj.error.yns_alert(msg,title,btn1,btn2,btn3,$("catStrings").getString('staff.cat.z3950.spawn_marc_editor.confirm_action'));
+ obj.error.sdump('D_ERROR','option ' + p + 'chosen');
+ switch(p) {
+ case 0:
+ var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]);
+ if (typeof r3.ilsevent != 'undefined') {
+ throw(r3);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_overlay'));
+ return {
+ 'id' : r3.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r3.id());
+ } catch(E) {
+ alert(E);
+ }
}
- if (robj.length != 0) btn2 = null;
- }
- var btn3 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.btn3_cancel_import');
- var p = obj.error.yns_alert(msg,title,btn1,btn2,btn3,$("catStrings").getString('staff.cat.z3950.spawn_marc_editor.confirm_action'));
- obj.error.sdump('D_ERROR','option ' + p + 'chosen');
- switch(p) {
- case 0:
- var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]);
- if (typeof r3.ilsevent != 'undefined') {
- throw(r3);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_overlay'));
- return {
- 'id' : r3.id(),
- 'on_complete' : function() {
- try {
- obj.replace_tab_with_opac(r3.id());
- } catch(E) {
- alert(E);
- }
- }
- };
+ };
+ }
+ break;
+ case 1:
+ var r2 = obj.network.request(
+ api.MARC_XML_RECORD_IMPORT.app,
+ api.MARC_XML_RECORD_IMPORT.method + '.override',
+ [ ses(), new_marcxml, biblio_source ]
+ );
+ if (typeof r2.ilsevent != 'undefined') {
+ throw(r2);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import_with_new_tcn'));
+ return {
+ 'id' : r2.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r2.id());
+ } catch(E) {
+ alert(E);
}
- break;
- case 1:
- var r2 = obj.network.request(
- api.MARC_XML_RECORD_IMPORT.app,
- api.MARC_XML_RECORD_IMPORT.method + '.override',
- [ ses(), new_marcxml, biblio_source ]
- );
- if (typeof r2.ilsevent != 'undefined') {
- throw(r2);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import_with_new_tcn'));
- return {
- 'id' : r2.id(),
- 'on_complete' : function() {
- try {
- obj.replace_tab_with_opac(r2.id());
- } catch(E) {
- alert(E);
- }
- }
- };
- }
- break;
- case 2:
- default:
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_cancelled'));
- break;
- }
- break;
- default:
- throw(r);
- break;
- }
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import'));
- return {
- 'id' : r.id(),
- 'on_complete' : function() {
- try {
- obj.replace_tab_with_opac(r.id());
- } catch(E) {
- alert(E);
- }
+ }
+ };
}
- };
+ break;
+ case 2:
+ default:
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_cancelled'));
+ break;
}
+ break;
+ default:
+ throw(r);
+ break;
+ }
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.successful_import'));
+ 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);
+ }
+ };
+
+ if ( $('marc_editor').checked ) {
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_MARC_EDIT),
+ { 'tab_name' : 'MARC Editor' },
+ {
+ 'record' : { 'marc' : my_marcxml, "rtype": "bre" },
+ '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) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor.import_error'),E);
+ alert(E);
}
+ },
+ 'save' : {
+ 'label' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor.save_button_label'),
+ 'func' : save_marc
}
- }
- }
- );
+ }
+ );
+ } else {
+ save_marc(my_marcxml);
+ }
},
'confirm_overlay' : function(record_ids) {
@@ -878,100 +885,106 @@
return;
}
- xulG.new_tab(
- xulG.url_prefix(urls.XUL_MARC_EDIT),
- { '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) {
- try {
- if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; }
- var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]);
- if (typeof r.ilsevent != 'undefined') {
- switch(Number(r.ilsevent)) {
- case 1704 /* TCN_EXISTS */ :
- var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.same_tcn', [r.payload.tcn]);
- var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.import_collision');
- var btn1 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn1_overlay', [r.payload.new_tcn]);
- if (btn1) {
- var robj = obj.network.simple_request(
- 'PERM_CHECK',[
- ses(),
- obj.data.list.au[0].id(),
- obj.data.list.au[0].ws_ou(),
- [ 'ALLOW_ALT_TCN' ]
- ]
- );
- if (typeof robj.ilsevent != 'undefined') {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.permission_error'),E);
+ function overlay_marc (new_marcxml) {
+ try {
+ if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; }
+ var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]);
+ if (typeof r.ilsevent != 'undefined') {
+ switch(Number(r.ilsevent)) {
+ case 1704 /* TCN_EXISTS */ :
+ var msg = $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.same_tcn', [r.payload.tcn]);
+ var title = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.import_collision');
+ var btn1 = typeof r.payload.new_tcn == 'undefined' ? null : $("catStrings").getFormattedString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn1_overlay', [r.payload.new_tcn]);
+ if (btn1) {
+ var robj = obj.network.simple_request(
+ 'PERM_CHECK',[
+ ses(),
+ obj.data.list.au[0].id(),
+ obj.data.list.au[0].ws_ou(),
+ [ 'ALLOW_ALT_TCN' ]
+ ]
+ );
+ if (typeof robj.ilsevent != 'undefined') {
+ obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.permission_error'),E);
+ }
+ if (robj.length != 0) btn1 = null;
+ }
+ var btn2 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn2_cancel');
+ var p = obj.error.yns_alert(msg,title,btn1,btn2,null, $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.confirm_action'));
+ obj.error.sdump('D_ERROR','option ' + p + 'chosen');
+ switch(p) {
+ case 0:
+ var r2 = obj.network.request(
+ api.MARC_XML_RECORD_REPLACE.app,
+ api.MARC_XML_RECORD_REPLACE.method + '.override',
+ [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]
+ );
+ if (typeof r2.ilsevent != 'undefined') {
+ throw(r2);
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.successful_overlay_with_new_TCN'));
+ return {
+ 'id' : r2.id(),
+ 'on_complete' : function() {
+ try {
+ obj.replace_tab_with_opac(r2.id());
+ } catch(E) {
+ alert(E);
+ }
}
- if (robj.length != 0) btn1 = null;
- }
- var btn2 = $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.btn2_cancel');
- var p = obj.error.yns_alert(msg,title,btn1,btn2,null, $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.confirm_action'));
- obj.error.sdump('D_ERROR','option ' + p + 'chosen');
- switch(p) {
- case 0:
- var r2 = obj.network.request(
- api.MARC_XML_RECORD_REPLACE.app,
- api.MARC_XML_RECORD_REPLACE.method + '.override',
- [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]
- );
- if (typeof r2.ilsevent != 'undefined') {
- throw(r2);
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.successful_overlay_with_new_TCN'));
- return {
- 'id' : r2.id(),
- 'on_complete' : function() {
- try {
- obj.replace_tab_with_opac(r2.id());
- } catch(E) {
- alert(E);
- }
- }
- };
- }
- break;
- case 1:
- default:
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.cancelled_overlay'));
- break;
- }
- break;
- default:
- throw(r);
- break;
- }
- } else {
- alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.success_overlay'));
- return {
- 'id' : r.id(),
- 'on_complete' : function() {
- try {
- obj.replace_tab_with_opac(r.id());
- } catch(E) {
- alert(E);
- }
+ };
}
- };
+ break;
+ case 1:
+ default:
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.cancelled_overlay'));
+ break;
}
+ break;
+ default:
+ throw(r);
+ break;
+ }
+ } else {
+ alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.success_overlay'));
+ 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);
+ }
+ }
+
+ if ( $('marc_editor').checked ) {
+ xulG.new_tab(
+ xulG.url_prefix(urls.XUL_MARC_EDIT),
+ { '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) {
- obj.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_error'),E);
+ alert(E);
}
+ },
+ 'save' : {
+ 'label' : $("catStrings").getString('staff.cat.z3950.spawn_marc_editor_for_overlay.overlay_record_label'),
+ 'func' : overlay_marc
}
- }
- }
- );
+ }
+ );
+ } else {
+ overlay_marc(my_marcxml);
+ }
},
Modified: trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul 2010-09-26 09:23:43 UTC (rev 18004)
+++ trunk/Open-ILS/xul/staff_client/server/cat/z3950.xul 2010-09-26 10:02:38 UTC (rev 18005)
@@ -183,6 +183,7 @@
</button>
<spacer flex="1"/>
<button id="marc_view_btn" command="marc_view" disabled="true"/>
+ <checkbox id="marc_editor" label="&staff.cat.z3950.marc_editor.label;" accesskey="&staff.cat.z3950.marc_editor.accesskey;" oils_persist="checked" checked="true"/>
<button id="marc_import_overlay" label="&staff.cat.z3950.marc_import_overlay.label;" accesskey="&staff.cat.z3950.marc_import_overlay.accesskey;" disabled="true"/>
<button id="marc_import" label="&staff.cat.z3950.result_message.marc_import.label;" accesskey="&staff.cat.z3950.result_message.marc_import.accesskey;" disabled="true"/>
<button id="toggle_form_btn" command="toggle_form"/>
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties 2010-09-26 09:23:43 UTC (rev 18004)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties 2010-09-26 10:02:38 UTC (rev 18005)
@@ -458,6 +458,7 @@
staff.cat.z3950.handle_results.result_error=Error retrieving results.
staff.cat.z3950.handle_results.search_result_error=Failure during search result handling.
staff.cat.z3950.replace_tab_with_opac.tab_name=Retrieving title...
+staff.cat.z3950.spawn_marc_editor.save_button_label=Import Record
staff.cat.z3950.spawn_marc_editor.same_tcn=A record with TCN %1$s already exists.\nFIXME: add record summary here
staff.cat.z3950.spawn_marc_editor.title=Import Collision
staff.cat.z3950.spawn_marc_editor.btn1_overlay=Overlay
More information about the open-ils-commits
mailing list