From: dbs Date: Tue, 25 Jan 2011 04:44:39 +0000 (+0000) Subject: Replace a few hardcoded strings in the serials JavaScript X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1e381e898f976625bae2e28ee6f491449940b2de;p=evergreen%2Ftadl.git Replace a few hardcoded strings in the serials JavaScript There is, unfortunately, an awful lot of this left to fix. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19279 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties index aa1758de40..4acf41316a 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties @@ -107,3 +107,24 @@ pattern_wizard.weeks=Every.First.Second.Third.Fourth.Fifth.Third from last.Secon pattern_wizard.seasons=Spring Summer Autumn Winter pattern_wizard.week=week pattern_wizard.remove_sub_row=Remove sub-row +serial.editor_base.unset= +serail.manage_dists.streams=Streams +serial.manage_dists.stream_num=Stream : # %1$s +serial.manage_dists.sbsum=Basic Summary +serial.manage_dists.sssum=Supplement Summary +serial.manage_dists.sisum=Index Summary +serial.manage_dists.library_label=%1$s : %2$s +serial.manage_dists.distributions=Distributions +serial.common.default=Default +serial.manage_subs.predict.alert=You must select a subscription before predicting issuances. +serial.manage_subs.predict.prompt=How many items (per active pattern) would you like to predict? +serial.manage_subs.predict.prompt.text=Number of Predicted Items +serial.manage_subs.invalid_number=Invalid number entered! +serial.manage_subs.predict_success=Successfully predicted %1$s issuance(s) for subscription # %2$s. +serial.manage_subs.distributions=Distributions +serial.manage_subs.issuances=Issuances +serial.manage_subs.captions_patterns=Captions/Patterns +serial.manage_subs.tree_location=Location +serial.manage_subs.scap_id=Caption / Pattern : # %1$s +serial.manage_subs.ssub_id=Subscription : # %1$s +serial.manage_subs.subscriptions=Subscriptions diff --git a/Open-ILS/xul/staff_client/server/serial/editor_base.js b/Open-ILS/xul/staff_client/server/serial/editor_base.js index 13f17361a4..9e35e4d996 100644 --- a/Open-ILS/xul/staff_client/server/serial/editor_base.js +++ b/Open-ILS/xul/staff_client/server/serial/editor_base.js @@ -1,5 +1,5 @@ dump('entering serial/editor_base.js\n'); -// vim:noet:sw=4:ts=4: +// vim:et:sw=4:ts=4: if (typeof serial == 'undefined') serial = {}; @@ -294,7 +294,7 @@ serial.editor_base = { obj.editor_values[value_key] = value; } if (value == "") { - value = ""; + value = $('serialStrings').getString('serial.editor_base.unset'); } } catch(E) { obj.error.sdump('D_ERROR','Attempted ' + cmd + '\n' + E + '\n'); diff --git a/Open-ILS/xul/staff_client/server/serial/manage_dists.js b/Open-ILS/xul/staff_client/server/serial/manage_dists.js index 2adcd4a72e..e23bd05f62 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_dists.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_dists.js @@ -1,5 +1,5 @@ dump('entering serial/manage_dists.js\n'); -// vim:noet:sw=4:ts=4: +// vim:et:sw=4:ts=4: if (typeof serial == 'undefined') serial = {}; serial.manage_dists = function (params) { @@ -1106,7 +1106,7 @@ serial.manage_dists.prototype = { var sstr_group_node_data = { 'row' : { 'my' : { - 'label' : 'Streams', + 'label' : dojo.byId('serialStrings').getString('serial.manage_dists.streams'), } }, 'retrieve_id' : 'sstr-group_' + sdist_tree.id(), @@ -1185,11 +1185,20 @@ serial.manage_dists.prototype = { 'id' : 'tree_location', 'label' : 'Location', 'flex' : 1, 'primary' : true, 'hidden' : false, - 'render' : function(my) { return my.label ? my.label : my.sstr ? 'Stream : #' + my.sstr.id() : my.sbsum ? 'Basic Summary' : my.sssum ? 'Supplement Summary' : my.sisum ? 'Index Summary' : my.sdist ? my.sdist.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"; }, + 'render' : function(my) { + if (my.label) { return my.label; } + if (my.sstr) { return $('serialStrings').getFormattedString('serial.manage_dists.stream_num', [my.sstr.id()]); } + if (my.sbsum) { return $('serialStrings').getString('serial.manage_dists.sbsum'); } + if (my.sssum) { return $('serialStrings').getString('serial.manage_dists.sssum'); } + if (my.sisum) { return $('serialStrings').getString('serial.manage_dists.sisum'); } + if (my.sdist) { return my.sdist.label(); } + if (my.aou) { return $('serialStrings').getFormattedString('serial.manage_dists.stream_num', [my.aou.shortname(), my.aou.name()]); } + return "???"; + }, }, { 'id' : 'distribution_count', - 'label' : 'Distributions', + 'label' : $('serialStrings').getString('serial.manage_dists.distributions'), 'flex' : 0, 'primary' : false, 'hidden' : false, 'render' : function(my) { return my.distribution_count; }, } diff --git a/Open-ILS/xul/staff_client/server/serial/manage_subs.js b/Open-ILS/xul/staff_client/server/serial/manage_subs.js index 97cc07ccc1..2ce4184457 100644 --- a/Open-ILS/xul/staff_client/server/serial/manage_subs.js +++ b/Open-ILS/xul/staff_client/server/serial/manage_subs.js @@ -1,5 +1,5 @@ dump('entering serial/manage_subs.js\n'); -// vim:noet:sw=4:ts=4: +// vim:et:sw=4:ts=4: if (typeof serial == 'undefined') serial = {}; serial.manage_subs = function (params) { @@ -289,7 +289,7 @@ serial.manage_subs.prototype = { var new_sdist = new sdist(); new_sdist.subscription(list[0]);//TODO: add multiple at once support? new_sdist.holding_lib(obj.map_ssub['ssub_' + list[0]].owning_lib());//default to sub owning lib - new_sdist.label('Default'); + new_sdist.label($('serialStrings').getString('serial.common.default')); new_sdist.isnew(1); var params = {}; params.sdists = [new_sdist]; @@ -615,16 +615,16 @@ serial.manage_subs.prototype = { try { var list = obj.ids_from_sel_list('ssub'); if (list.length == 0) { - alert('You must select a subscription before predicting issuances.'); //TODO: better error + alert($('serialStrings').getString('serial.manage_subs.predict.alert')); //TODO: better error return; } - var num_to_predict = prompt('How many items (per active pattern) would you like to predict?', + var num_to_predict = prompt($('serialStrings').getString('serial.manage_subs.predict.prompt'), '12', - 'Number of Predicted Items'); + $('serialStrings').getString('serial.manage_subs.predict.prompt.text')); num_to_predict = String( num_to_predict ).replace(/\D/g,''); if (num_to_predict == '') { - alert('Invalid number entered!'); //TODO: better error + alert($('serialStrings').getString('serial.manage_subs.invalid_number')); //TODO: better error return; } @@ -634,7 +634,7 @@ serial.manage_subs.prototype = { 'open-ils.serial.make_predictions', [ ses(), {"ssub_id":list[i], "num_to_predict":num_to_predict}] ); - alert('Successfully predicted ' + robj.length + ' issuance(s) for subscription #' + list[i] + '.'); + alert($('serialStrings').getFormattedString('serial.manage_subs.predict_success', [robj.length, list[i]])); } obj.refresh_list(); @@ -1438,7 +1438,7 @@ serial.manage_subs.prototype = { var sdist_group_node_data = { 'row' : { 'my' : { - 'label' : 'Distributions', + 'label' : $('serialStrings').getString('serial.manage_subs.distributions'), } }, 'retrieve_id' : 'sdist-group_' + ssub_tree.id(), @@ -1452,7 +1452,7 @@ serial.manage_subs.prototype = { var siss_group_node_data = { 'row' : { 'my' : { - 'label' : 'Issuances', + 'label' : $('serialStrings').getString('serial.manage_subs.issuances'), } }, 'retrieve_id' : 'siss-group_' + ssub_tree.id(), @@ -1466,7 +1466,7 @@ serial.manage_subs.prototype = { var scap_group_node_data = { 'row' : { 'my' : { - 'label' : 'Captions/Patterns', + 'label' : $('serialStrings').getString('serial.manage_subs.captions_patterns'), } }, 'retrieve_id' : 'scap-group_' + ssub_tree.id(), @@ -1536,13 +1536,22 @@ serial.manage_subs.prototype = { var columns = [ { 'id' : 'tree_location', - 'label' : 'Location', + 'label' : $('serialStrings').getString('serial.manage_subs.tree_location'), 'flex' : 1, 'primary' : true, 'hidden' : false, - 'render' : function(my) { return my.sdist ? my.sdist.label() : my.siss ? my.siss.label() : my.scap ? 'C/P : #' + my.scap.id() : my.ssub ? 'Subscription : #' + my.ssub.id() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : my.label ? my.label : "???"; }, + 'render' : function(my) { + if (my.sdist) { return my.sdist.label(); } + if (my.siss) { return my.siss.label(); } + if (my.scap) { return $('serialStrings').getFormattedString('serial.manage_subs.scap_id', [my.scap.id()]); } + if (my.ssub) { return $('serialStrings').getFormattedString('serial.manage_subs.ssub_id', [my.ssub.id()]); } + if (my.aou) { return $('serialStrings').getFormattedString('serial.manage_dists.library_label', [my.aou.shortname(), my.aou.name()]); } + if (my.label) { return my.label; } + /* If all else fails... */ + return "???"; + }, }, { 'id' : 'subscription_count', - 'label' : 'Subscriptions', + 'label' : $('serialStrings').getString('serial.manage_subs.subscriptions'), 'flex' : 0, 'primary' : false, 'hidden' : false, 'render' : function(my) { return my.subscription_count; }, },