From 130e8efbcd37cfe0fc536b94ce74e2412c2ad613 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 31 Jul 2006 22:37:00 +0000 Subject: [PATCH] default alert message in copy editor git-svn-id: svn://svn.open-ils.org/ILS/trunk@5205 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/cat/copy_editor.js | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 0919a4515c..fe27fd4941 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -342,8 +342,29 @@ g.apply_stat_cat = function(sc_id,entry_id) { copy.stat_cat_entries( temp ); } catch(E) { - alert(E); + g.error.standard_unexpected_error_alert('apply_stat_cat',E); + } + } +} + +/******************************************************************************************************/ +/* This concats and uniques all the alert messages for use as the default value for a new alert message */ + +g.populate_alert_message_input = function(tb) { + try { + var seen = {}; var s = ''; + for (var i = 0; i < g.copies.length; i++) { + var msg = g.copies[i].alert_message(); + if (msg) { + if (typeof seen[msg] == 'undefined') { + s += msg + '\n'; + seen[msg] = true; + } + } } + tb.setAttribute('value',s); + } catch(E) { + g.error.standard_unexpected_error_alert('populate_alert_message_input',E); } } @@ -558,7 +579,7 @@ g.panes_and_field_names = { "Alert Message", { render: 'fm.alert_message() == null ? "" : fm.alert_message()', - input: 'c = function(v){ g.apply("alert_message",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', + input: 'c = function(v){ g.apply("alert_message",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("multiline",true); g.populate_alert_message_input(x); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', } ], -- 2.11.0