KMAIN-1828 Full Patron Messages
authorDan Reuther <dreuther@catalystitservices.com>
Wed, 28 Oct 2015 20:07:30 +0000 (16:07 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Add new action on messages: "View Penalty/Message."

Add new xul window to display full note of message in
larger font than displayed on main messages page.

Add localization for new content.

Signed-off-by: Kyle Huckins <khuckins@catalystdevworks.com>
modified:   Open-ILS/web/opac/locale/en-US/lang.dtd
modified:   Open-ILS/xul/staff_client/chrome/content/main/constants.js
modified:   Open-ILS/xul/staff_client/server/patron/standing_penalties.js
modified:   Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
new file:   Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js
new file:   Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Open-ILS/xul/staff_client/server/patron/standing_penalties.xul
Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul [new file with mode: 0644]

index 166dc44..032339e 100644 (file)
 <!ENTITY staff.patron_display.penalty.menu.actions.accesskey "P">
 <!ENTITY staff.patron_display.penalty.menu.apply.label "Apply Standing Penalty/Message">
 <!ENTITY staff.patron_display.penalty.menu.apply.accesskey "S">
+<!ENTITY staff.patron_display.penalty.menu.actions.view.label "View Penalty/Message">
 <!ENTITY staff.patron_display.penalty.menu.actions.remove.label "Remove Penalty/Message">
 <!ENTITY staff.patron_display.penalty.menu.actions.remove.accesskey "R">
 <!ENTITY staff.patron_display.penalty.menu.actions.edit.label "Modify Penalty/Message">
 <!ENTITY staff.patron_display.apply_penalty_dialog.apply_btn.accesskey "A">
 <!ENTITY staff.patron_display.apply_penalty_dialog.initials_entry.label "Initials">
 <!ENTITY staff.patron_display.apply_penalty_dialog.initials_entry.accesskey "I">
+<!ENTITY staff.patron_display.view_penalty_dialog.title "View Standing Penalty/Message">
+<!ENTITY staff.patron_display.view_penalty_dialog.header "View Standing Penalty/Message">
+<!ENTITY staff.patron_display.view_penalty_dialog.close_btn.label "Close">
+<!ENTITY staff.patron_display.view_penalty_dialog.close_btn.accesskey "C">
 <!ENTITY staff.patron_display.edit_penalty_dialog.title "Modify Standing Penalty/Message">
 <!ENTITY staff.patron_display.edit_penalty_dialog.header "Modify Standing Penalty/Message">
 <!ENTITY staff.patron_display.edit_penalty_dialog.description "Notes, Alerts, Blocks">
index eb0b9b3..b2e0864 100644 (file)
@@ -498,6 +498,7 @@ var urls = {
     'XUL_STANDING_PENALTIES' : 'oils://remote/xul/server/patron/standing_penalties.xul',
     'XUL_NEW_STANDING_PENALTY' : 'oils://remote/xul/server/patron/new_standing_penalty.xul',
     'XUL_EDIT_STANDING_PENALTY' : 'oils://remote/xul/server/patron/edit_standing_penalty.xul',
+    'XUL_VIEW_STANDING_PENALTY' : 'oils://remote/xul/server/patron/view_standing_penalty.xul',
     'XUL_SCAN_ITEM_AS_MISSING_PIECES' : 'oils://remote/xul/server/circ/missing_pieces.xul',
     'XUL_STAT_CAT_EDIT' : 'oils://remote/xul/server/admin/stat_cat_editor.xhtml',
     'XUL_SURVEY_WIZARD' : 'chrome://open_ils_staff_client/content/admin/survey_wizard.xul',
index 15100f9..de2f3a0 100644 (file)
@@ -30,6 +30,7 @@ function penalty_init() {
         init_archived_list();
         window.standing_penalties_event_listeners = new EventListenerList();
         document.getElementById('date1').year = document.getElementById('date1').year - 1;
+        window.standing_penalties_event_listeners.add(document.getElementById('cmd_view_message'), 'command', handle_view_message, false);
         window.standing_penalties_event_listeners.add(document.getElementById('cmd_apply_penalty'), 'command', handle_apply_penalty, false);
         window.standing_penalties_event_listeners.add(document.getElementById('cmd_remove_penalty'), 'command', handle_remove_penalty, false);
         window.standing_penalties_event_listeners.add(document.getElementById('cmd_edit_penalty'), 'command', handle_edit_penalty, false);
@@ -106,10 +107,12 @@ function generate_handle_selection(which_list) {
         var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
         if (which_list == list) { // top list
             if (ids.length > 0) {
+                document.getElementById('cmd_view_message').setAttribute('disabled','false');
                 document.getElementById('cmd_remove_penalty').setAttribute('disabled','false');
                 document.getElementById('cmd_edit_penalty').setAttribute('disabled','false');
                 document.getElementById('cmd_archive_penalty').setAttribute('disabled','false');
             } else {
+                document.getElementById('cmd_view_message').setAttribute('disabled','true');
                 document.getElementById('cmd_remove_penalty').setAttribute('disabled','true');
                 document.getElementById('cmd_edit_penalty').setAttribute('disabled','true');
                 document.getElementById('cmd_archive_penalty').setAttribute('disabled','true');
@@ -146,6 +149,34 @@ function populate_list() {
     }
 }
 
+function handle_view_message(ev) {
+    try {
+        JSAN.use('util.window');
+        var win = new util.window();
+
+        var sel = list.retrieve_selection();
+        var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
+        if (ids.length > 0) {
+            for (var i = 0; i < ids.length; i++) {
+                var penalty = util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.id() == ids[i]; } );
+                var my_xulG = win.open(
+                    urls.XUL_VIEW_STANDING_PENALTY,
+                    'new_standing_penalty',
+                    'chrome,resizable,modal',
+                    { 
+                        'id' : typeof penalty.standing_penalty() == 'object' ? penalty.standing_penalty().id() : penalty.standing_penalty(), 
+                        'note' : penalty.note() 
+                    }
+                );
+            } 
+        }
+
+    } catch(E) {
+        var err_prefix = 'standing_penalties.js -> handle_view_penalty() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+}
+
 function handle_apply_penalty(ev) {
     try {
         JSAN.use('util.window');
index 5571298..9476116 100644 (file)
@@ -32,6 +32,7 @@
     <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
 
     <commandset id="penalty_cmds">
+        <command id="cmd_view_message" disabled="true"/>
         <command id="cmd_apply_penalty" />
         <command id="cmd_remove_penalty" disabled="true"/>
         <command id="cmd_edit_penalty" disabled="true"/>
@@ -74,6 +75,7 @@
                             type="menu" style="-moz-user-focus: normal" 
                             oncommand="this.focus(); this.firstChild.showPopup()">
                             <menupopup>
+                                <menuitem command="cmd_view_message" label="&staff.patron_display.penalty.menu.actions.view.label;"/>
                                 <menuitem command="cmd_remove_penalty" label="&staff.patron_display.penalty.menu.actions.remove.label;" accesskey="&staff.patron_display.menu.actions.remove.accesskey;"/>
                                 <menuitem command="cmd_edit_penalty" label="&staff.patron_display.penalty.menu.actions.edit.label;" accesskey="&staff.patron_display.menu.actions.edit.accesskey;"/>
                                 <menuitem command="cmd_archive_penalty" label="&staff.patron_display.penalty.menu.actions.archive.label;" accesskey="&staff.patron_display.menu.actions.archive.accesskey;"/>
 
     <popupset id="csp_popupset">
         <menupopup id="ausp_actions" position="at_pointer">
+            <menuitem command="cmd_view_message" label="&staff.patron_display.penalty.menu.actions.view.label;"/>
             <menuitem command="cmd_remove_penalty" label="&staff.patron_display.penalty.menu.actions.remove.label;" accesskey="&staff.patron_display.menu.actions.remove.accesskey;"/>
             <menuitem command="cmd_edit_penalty" label="&staff.patron_display.penalty.menu.actions.edit.label;" accesskey="&staff.patron_display.menu.actions.edit.accesskey;"/>
             <menuitem command="cmd_archive_penalty" label="&staff.patron_display.penalty.menu.actions.archive.label;" accesskey="&staff.patron_display.menu.actions.archive.accesskey;"/>
diff --git a/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.js
new file mode 100644 (file)
index 0000000..381cde2
--- /dev/null
@@ -0,0 +1,51 @@
+var data; var error; 
+
+function default_focus() { document.getElementById('note_tb').focus(); } // parent interfaces often call this
+
+function view_penalty_init() {
+    try {
+
+        commonStrings = document.getElementById('commonStrings');
+        patronStrings = document.getElementById('patronStrings');
+
+        if (typeof JSAN == 'undefined') {
+            throw(
+                commonStrings.getString('common.jsan.missing')
+            );
+        }
+
+        JSAN.errorLevel = "die"; // none, warn, or die
+        JSAN.addRepository('..');
+
+        JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+
+        JSAN.use('util.error'); error = new util.error();
+        JSAN.use('util.widgets');
+
+        /* set widget values */
+        document.getElementById('note_tb').value = xul_param('note');
+
+        /* set widget behavior */
+        window.view_standing_penalty_event_listeners = new EventListenerList();
+
+
+        window.view_standing_penalty_event_listeners.add(document.getElementById('close_btn'), 
+            'command', function() { window.close(); }, false
+        );
+        
+    } catch(E) {
+        var err_prefix = 'standing_penalties.js -> penalty_init() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+
+}
+
+function view_penalty_cleanup() {
+    try {
+        window.view_standing_penalty_event_listeners.removeAll();
+    } catch(E) {
+        var err_prefix = 'standing_penalties.js -> penalty_cleanup() : ';
+        if (error) error.standard_unexpected_error_alert(err_prefix,E); else alert(err_prefix + E);
+    }
+
+}
\ No newline at end of file
diff --git a/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul b/Open-ILS/xul/staff_client/server/patron/view_standing_penalty.xul
new file mode 100644 (file)
index 0000000..be0a4fe
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Dialog: view Standing Penalty to Patron -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- PRESENTATION -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="view_penalty_win" 
+    onload="try { view_penalty_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+    onunload="try { view_penalty_cleanup(); persist_helper_cleanup(); } catch(E) { alert(E); }"
+    oils_persist="height width sizemode"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    title="&staff.patron_display.view_penalty_dialog.title;">
+
+    <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+    <!-- BEHAVIOR -->
+    <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;</script>
+    <scripts id="openils_util_scripts"/>
+
+    <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+    <script type="text/javascript" src="view_standing_penalty.js"/>
+
+    <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties" />
+
+    <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+    <!-- CONTENT -->
+    <dialogheader title="&staff.patron_display.view_penalty_dialog.header;" description="&staff.patron_display.view_penalty_dialog.description;" />
+    <textbox id="note_tb" class="ALL_FONTS_LARGE" flex="1" multiline="true" readonly="true" rows="3" onoverflow="this.rows = this.inputField.scrollHeight;"/>
+    <hbox>
+        <spacer flex="1"/>
+        <button id="close_btn" label="&staff.patron_display.view_penalty_dialog.close_btn.label;" accesskey="&staff.patron_display.close_penalty_dialog.close_btn.accesskey;" />
+    </hbox>
+</window>
+