From 893dfd7e46bfe50824b0a6c13b35842ed9f7b078 Mon Sep 17 00:00:00 2001 From: senator Date: Fri, 11 Jun 2010 21:36:42 +0000 Subject: [PATCH] Repair abuse of dojo translatable string bundle for Booking. These should be JSON only, no code. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@16692 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/booking/nls/reservation.js | 157 ++++++++------------- Open-ILS/web/js/ui/default/booking/reservation.js | 40 ++++-- 2 files changed, 86 insertions(+), 111 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/booking/nls/reservation.js b/Open-ILS/web/js/dojo/openils/booking/nls/reservation.js index 2f61781f0b..8c39198f5e 100644 --- a/Open-ILS/web/js/dojo/openils/booking/nls/reservation.js +++ b/Open-ILS/web/js/dojo/openils/booking/nls/reservation.js @@ -1,107 +1,60 @@ { - 'NO_BRT_RESULTS': "There are no bookable resource types registered.", - 'NO_TARG_DIV': "Could not find target div", - 'NO_BRA_RESULTS': "Couldn't retrieve booking resource attributes.", - 'SELECT_A_BRSRC_THEN': - "You have clicked 'Reserve Selected', but nothing is selected!\n\n" + - "You must select a resource from the large box above.\n\n" + - "*** If resources that you would select are highlighted in RED, ***\n"+ - "these items are not available during the requested time; if\n" + - "possible, choose another resource or change the reservation time.", - 'CREATE_BRESV_LOCAL_ERROR': "Exception trying to create reservation: ", - 'CREATE_BRESV_SERVER_ERROR': "Server error trying to create reservation: ", - 'CREATE_BRESV_SERVER_NO_RESPONSE': - "No response from server after trying to create reservation.", - /* FIXME: Users aren't likely to be able to do anything with the following - * message. Figure out a way to do something more helpful. - */ - 'CREATE_BRESV_OK_MISSING_TARGET': function(n, m, d, c) { - var s = "Created " + n + " reservation(s), but " + m + " of these " + - "could not target any resources.\n\n"; - var t; - if (d && d.length) { - var gram = d.length == 1 ? - ["A circulation blocks", ""] : ["Circulations block", "s"]; - t = s + gram[0] + " the desired reservation(s), " + - "with due date" + gram[1] + ":\n"; - - for (var k in d) { t += "\t" + d[k] + "\n"; } - } else { - t = s + - "This means that it won't be possible to fulfill some of these\n" + - "reservations until a suitable resource becomes available."; - } - if (c) { - t +="\n\nSince the requested resource could not be targeted, " + - "this\nreservation will now be canceled."; - } - return t; - }, - 'CREATE_BRESV_OK': function(n) { - return "Created " + n + " reservation" + (n == 1 ? "" : "s") + "."; - }, - 'WHERES_THE_BARCODE': "Enter a patron's barcode to make a reservation.", - 'ACTOR_CARD_NOT_FOUND': "Patron barcode not found. Please try again.", - 'GET_BRESV_LIST_ERR': "Error while retrieving reservation list: ", - 'GET_BRESV_LIST_NO_RESULT': - "No results from server retrieving reservation list.", - 'OUTSTANDING_BRESV': "Outstanding reservations for patron", - 'UNTARGETED': "None targeted", - 'GET_PATRON_NO_RESULT': - "No server response after attempting to look up patron by barcode.", - 'HERE_ARE_EXISTING_BRESV': "Existing reservations for", - 'NO_EXISTING_BRESV': "This user has no existing reservations at this time.", - 'NO_USABLE_BRSRC': - "No reservable resources. Adjust start and end time\n" + - "until a resource is available for reservation.", - 'CXL_BRESV_SUCCESS': function(n) { - return ("Canceled " + n + " reservation" + (n == 1 ? "" : "s") + "."); - }, - 'CXL_BRESV_FAILURE': "Error canceling reservations; server silent.", - 'CXL_BRESV_FAILURE2': "Error canceling reservations:\n", - 'CXL_BRESV_SELECT_SOMETHING': + "NO_BRT_RESULTS": "There are no bookable resource types registered.", + "NO_TARG_DIV": "Could not find target div", + "NO_BRA_RESULTS": "Couldn't retrieve booking resource attributes.", + "SELECT_A_BRSRC_THEN": "You have clicked 'Reserve Selected', but nothing is selected!\n\nYou must select a resource from the large box above.\n\n*** If resources that you would select are highlighted in RED, ***\nthese items are not available during the requested time; if\npossible, choose another resource or change the reservation time.", + "CREATE_BRESV_LOCAL_ERROR": "Exception trying to create reservation: ", + "CREATE_BRESV_SERVER_ERROR": "Server error trying to create reservation: ", + "CREATE_BRESV_SERVER_NO_RESPONSE": "No response from server after trying to create reservation.", + "CREATE_BRESV_OK_MISSING_TARGET": "Created ${0} reservation(s), but ${1} of these could not target any resources.\n\nThis means that it won't be possible to fulfill some of these\nreservations until a suitable resource becomes available.", + "CREATE_BRESV_OK_MISSING_TARGET_BLOCKED_BY_CIRC": "The desired reservation(s) are blocked by circulation(s) with the following due date(s):\n${0}", + "CREATE_BRESV_OK_MISSING_TARGET_WILL_CANCEL": "Since the requested resource could not be targeted, this\nreservation will now be canceled.", + "CREATE_BRESV_OK": "Created ${0} reservation(s)", + "WHERES_THE_BARCODE": "Enter a patron's barcode to make a reservation.", + "ACTOR_CARD_NOT_FOUND": "Patron barcode not found. Please try again.", + "GET_BRESV_LIST_ERR": "Error while retrieving reservation list: ", + "GET_BRESV_LIST_NO_RESULT": "No results from server retrieving reservation list.", + "OUTSTANDING_BRESV": "Outstanding reservations for patron", + "UNTARGETED": "None targeted", + "GET_PATRON_NO_RESULT": "No server response after attempting to look up patron by barcode.", + "HERE_ARE_EXISTING_BRESV": "Existing reservations for", + "NO_EXISTING_BRESV": "This user has no existing reservations at this time.", + "NO_USABLE_BRSRC": "No reservable resources. Adjust start and end time\nuntil a resource is available for reservation.", + "CXL_BRESV_SUCCESS": "Canceled ${0} reservation(s)", + "CXL_BRESV_FAILURE": "Error canceling reservations; server silent.", + "CXL_BRESV_FAILURE2": "Error canceling reservations:\n", + "CXL_BRESV_SELECT_SOMETHING": "You have not selected any reservations to cancel.", - 'NEED_EXACTLY_ONE_BRT_PASSED_IN': - "Can't book multiple resource types at once", - 'COULD_NOT_RETRIEVE_BRT_PASSED_IN': - "Error retrieving booking resource type", - 'INVALID_TS_RANGE': - "You must choose a valid start and end time for the reservation.", - 'BRSRC_NOT_FOUND': "Could not locate that resource.", - 'BRSRC_RETRIVE_ERROR': "Error retrieving resource: ", - 'ON_FLY_NO_RESPONSE': + "NEED_EXACTLY_ONE_BRT_PASSED_IN": "Can't book multiple resource types at once", + "COULD_NOT_RETRIEVE_BRT_PASSED_IN": "Error retrieving booking resource type", + "INVALID_TS_RANGE": "You must choose a valid start and end time for the reservation.", + "BRSRC_NOT_FOUND": "Could not locate that resource.", + "BRSRC_RETRIVE_ERROR": "Error retrieving resource: ", + "ON_FLY_NO_RESPONSE": "No response from server attempting to make item a bookable resource.", - 'ON_FLY_ERROR': + "ON_FLY_ERROR": "Error attempting to make item a bookable resource:", - 'ANY': "ANY", - 'ERROR_FETCHING_AOUS': - "Could not retrieve organizational unit settings.\n" + - "This is a non-fatal error, but you may wish to\n" + - "contact your system administrator.", - - 'AUTO_choose_a_brt': "Choose a Bookable Resource Type", - 'AUTO_i_need_this_resource': "I need this resource...", - 'AUTO_starting_at': "Between", - 'AUTO_ending_at': "and", - 'AUTO_with_these_attr': "With these attributes:", - 'AUTO_patron_barcode': "Reserve to patron barcode:", - 'AUTO_ATTR_VALUE_next': "Next", - 'AUTO_ATTR_VALUE_reserve_brsrc': "Reserve Selected", - 'AUTO_ATTR_VALUE_reserve_brt': "Reserve Any", - 'AUTO_ATTR_VALUE_button_edit_existing': "Edit selected", - 'AUTO_ATTR_VALUE_button_cancel_existing': "Cancel selected", - 'AUTO_bresv_grid_type': "Type", - 'AUTO_bresv_grid_resource': "Resource", - 'AUTO_bresv_grid_start_time': "Start time", - 'AUTO_bresv_grid_end_time': "End time", - 'AUTO_brt_noncat_only': "Show only non-cataloged bookable resource types", - 'AUTO_arbitrary_resource': - "Enter the barcode of a cataloged, bookable resource:", - 'AUTO_explain_bookable': - "To reserve an item that is not yet registered as a bookable " + - "resource, find it in the catalog or under Display Item, and "+ - "select Make Item Bookable or Book Item Now there.", - 'AUTO_pickup_lib_selector': - "Choose the pickup library for this reservation:", - 'AUTO_or': '- Or -' + "ANY": "ANY", + "ERROR_FETCHING_AOUS": + "Could not retrieve organizational unit settings.\nThis is a non-fatal error, but you may wish to\ncontact your system administrator.", + "AUTO_choose_a_brt": "Choose a Bookable Resource Type", + "AUTO_i_need_this_resource": "I need this resource...", + "AUTO_starting_at": "Between", + "AUTO_ending_at": "and", + "AUTO_with_these_attr": "With these attributes:", + "AUTO_patron_barcode": "Reserve to patron barcode:", + "AUTO_ATTR_VALUE_next": "Next", + "AUTO_ATTR_VALUE_reserve_brsrc": "Reserve Selected", + "AUTO_ATTR_VALUE_reserve_brt": "Reserve Any", + "AUTO_ATTR_VALUE_button_edit_existing": "Edit selected", + "AUTO_ATTR_VALUE_button_cancel_existing": "Cancel selected", + "AUTO_bresv_grid_type": "Type", + "AUTO_bresv_grid_resource": "Resource", + "AUTO_bresv_grid_start_time": "Start time", + "AUTO_bresv_grid_end_time": "End time", + "AUTO_brt_noncat_only": "Show only non-cataloged bookable resource types", + "AUTO_arbitrary_resource": "Enter the barcode of a cataloged, bookable resource:", + "AUTO_explain_bookable": "To reserve an item that is not yet registered as a bookable resource, find it in the catalog or under Display Item, and select Make Item Bookable or Book Item Now there.", + "AUTO_pickup_lib_selector": "Choose the pickup library for this reservation:", + "AUTO_or": "- Or -" } diff --git a/Open-ILS/web/js/ui/default/booking/reservation.js b/Open-ILS/web/js/ui/default/booking/reservation.js index 3515f2ee8a..7c2e242d65 100644 --- a/Open-ILS/web/js/ui/default/booking/reservation.js +++ b/Open-ILS/web/js/ui/default/booking/reservation.js @@ -324,10 +324,17 @@ function create_bresv(resource_list) { var targeting = check_bresv_targeting(results); if (targeting.missing) { if (aous_cache["booking.require_successful_targeting"]) { - alert(localeStrings.CREATE_BRESV_OK_MISSING_TARGET( - results.length, targeting.missing, targeting.due_dates, - true /* will cancel */ - )); + alert( + dojo.string.substitute( + localeStrings.CREATE_BRESV_OK_MISSING_TARGET, + [results.length, targeting.missing] + ) + "\n\n" + + dojo.string.substitute( + localeStrings.CREATE_BRESV_OK_MISSING_TARGET_BLOCKED_BY_CIRC, + [targeting.due_dates] + ) + "\n\n" + + localeStrings.CREATE_BRESV_OK_MISSING_TARGET_WILL_CANCEL + ); cancel_reservations( results.map( function(o) { return o.bresv; }, @@ -335,12 +342,23 @@ function create_bresv(resource_list) { ) ); } else { - alert(localeStrings.CREATE_BRESV_OK_MISSING_TARGET( - results.length, targeting.missing, targeting.due_dates - )); + alert( + dojo.string.substitute( + localeStrings.CREATE_BRESV_OK_MISSING_TARGET, + [results.length, targeting.missing] + ) + "\n\n" + + dojo.string.substitute( + localeStrings.CREATE_BRESV_OK_MISSING_TARGET_BLOCKED_BY_CIRC, + [targeting.due_dates] + ) + ); } } else { - alert(localeStrings.CREATE_BRESV_OK(results.length)); + alert( + dojo.string.substitute( + localeStrings.CREATE_BRESV_OK, [results.length] + ) + ); } update_brsrc_list(); update_bresv_grid(); @@ -475,7 +493,11 @@ function cancel_reservations(bresv_id_list, skip_update) { } else if (is_ils_event(result)) { alert(my_ils_error(localeStrings.CXL_BRESV_FAILURE2, result)); } else { - alert(localeStrings.CXL_BRESV_SUCCESS(result.length)); + alert( + dojo.string.substitute( + localeStrings.CXL_BRESV_SUCCESS, [result.length] + ) + ); } } -- 2.11.0