[open-ils-commits] r16368 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/main xul/staff_client/chrome/locale/en-US xul/staff_client/server/admin xul/staff_client/server/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat May 1 04:33:56 EDT 2010


Author: phasefx
Date: 2010-05-01 04:33:51 -0400 (Sat, 01 May 2010)
New Revision: 16368

Added:
   trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js
   trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul
Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/admin.properties
Log:
Dedicated interface for circ.staff_client.do_not_auto_attempt_print org unit setting (given that the generic one does not handle settings of type array very well--particularly enumeration of allowed array values)

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-05-01 08:33:51 UTC (rev 16368)
@@ -1545,6 +1545,15 @@
 <!ENTITY staff.z39_50.search_class.tcn "Accession #">
 <!ENTITY staff.z39_50.search_class.title "Title">
 <!ENTITY staff.z39_50_import_interface_label "Z39.50 Import">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.current_inherited_setting.caption "Current/Inherited Setting">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.new_setting.caption "New Setting">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.receipt_slip_type.prompt "Disable auto-print attempts for these receipt/slip types:">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.library_selector.prompt "For this library and descendants:">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.checkout "Checkout Receipt">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.bill_pay "Bill Pay Receipt">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.hold_slip "Hold Slip">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.transit_slip "Transit Slip">
+<!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.hold_transit_slip "Hold/Transit Slip">
 <!ENTITY staff.server.admin.org_unit_settings.title "Organization Unit Settings">
 <!ENTITY staff.server.admin.org_unit_settings.context "Context Location">
 <!ENTITY staff.server.admin.org_unit_settings.uninherited " * Indicates the setting is not inherited from the parent org unit at run time">
@@ -1757,6 +1766,8 @@
 <!ENTITY staff.server.admin.index.maintenance_reports "Maintenance Reports">
 <!ENTITY staff.server.admin.index.fonts_and_sounds "Global Font and Sound Settings">
 <!ENTITY staff.server.admin.index.printer "Printer Settings Editor">
+<!ENTITY staff.server.admin.index.do_not_auto_attempt_print_setting.label "'Do Not Attempt Auto-Print' Setting">
+<!ENTITY staff.server.admin.index.do_not_auto_attempt_print_setting.accesskey "">
 <!ENTITY staff.server.admin.index.closed_dates "Closed Dates Editor">
 <!ENTITY staff.server.admin.index.copy_locations "Copy Locations Editor">
 <!ENTITY staff.server.admin.index.library_settings "Library Settings Editor">

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-05-01 08:33:51 UTC (rev 16368)
@@ -152,6 +152,7 @@
     'FM_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.actor.org_unit.retrieve_by_title.authoritative', 'secure' : false },
     'FM_AOUS_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit_setting.values.ranged.retrieve' },
     'FM_AOUS_SPECIFIC_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.ou_setting.ancestor_default' },
+    'FM_AOUS_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.settings.update' },
     'FM_AOUT_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_types.retrieve', 'secure' : false },
     'FM_ASC_BATCH_RETRIEVE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.batch', 'secure' : false },
     'FM_ASC_RETRIEVE_VIA_AOU' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.stat_cat.asset.retrieve.all', 'secure' : false },
@@ -345,6 +346,7 @@
     'XUL_DEBUG_FILTER_CONSOLE' : '/xul/server/util/filter_console.xul',
     'XUL_DEBUG_SHELL' : '/xul/server/util/shell.html',
     'XUL_DEBUG_XULEDITOR' : '/xul/server/util/xuledit.xul',
+    'XUL_DO_NOT_AUTO_ATTEMPT_PRINT_SETTING' : '/xul/server/admin/do_not_auto_attempt_print_setting.xul',
     'XUL_FANCY_PROMPT' : '/xul/server/util/fancy_prompt.xul',
     'XUL_HOLD_CAPTURE' : '/xul/server/circ/hold_capture.xul',
     /*'XUL_HOLD_PULL_LIST' : '/xul/server/admin/hold_pull_list.xhtml',*/

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-05-01 08:33:51 UTC (rev 16368)
@@ -564,6 +564,12 @@
                 ['oncommand'],
                 function() { open_admin_page('printer_settings.html', 'menu.cmd_local_admin_printer.tab', true); }
             ],
+            'cmd_local_admin_do_not_auto_attempt_print_setting' : [
+                ['oncommand'],
+                function() { 
+                    obj.set_tab(obj.url_prefix(urls.XUL_DO_NOT_AUTO_ATTEMPT_PRINT_SETTING),{'tab_name':offlineStrings.getString('menu.cmd_local_admin_do_not_auto_attempt_print_setting.tab')},{});
+                }
+            ],
             'cmd_local_admin_closed_dates' : [
                 ['oncommand'],
                 function() { open_admin_page('closed_dates.xhtml', 'menu.cmd_local_admin_closed_dates.tab', true); }

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-05-01 08:33:51 UTC (rev 16368)
@@ -105,6 +105,9 @@
     <!-- local admin menu commands -->
     <command id="cmd_local_admin_fonts_and_sounds"/>
     <command id="cmd_local_admin_printer"/>
+    <command id="cmd_local_admin_do_not_auto_attempt_print_setting"
+        label="&staff.server.admin.index.do_not_auto_attempt_print_setting.label;" 
+        accesskey="&staff.server.admin.index.do_not_auto_attempt_print_setting.accesskey;"/>
     <command id="cmd_local_admin_closed_dates"/>
     <command id="cmd_local_admin_copy_locations"/>
     <command id="cmd_local_admin_lib_settings"/>
@@ -344,6 +347,7 @@
                 <menuitem label="&staff.main.menu.admin.local_admin.patrons_due_refunds.label;" accesskey="&staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey;" command="cmd_local_admin_patrons_due_refunds"/>
                 <menuitem label="&staff.server.admin.index.printer;" command="cmd_local_admin_printer"/>
                 <menuitem label="&staff.main.menu.admin.template_edit.label;" accesskey="&staff.main.menu.admin.template_edit.accesskey;" command="cmd_print_list_template_edit"/>
+                <menuitem command="cmd_local_admin_do_not_auto_attempt_print_setting"/>
                 <menuitem label="&staff.server.admin.index.reports;" command="cmd_local_admin_reports"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.standing_penalty.label;" command="cmd_local_admin_standing_penalty"/>
                 <menuitem label="&staff.server.admin.index.statistical_categories;" command="cmd_local_admin_stat_cats"/>

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-01 08:33:51 UTC (rev 16368)
@@ -214,6 +214,7 @@
 menu.cmd_survey_wizard.inadequate_perm=You are lacking the CREATE_SURVEY permission and/or working locations.
 menu.cmd_local_admin_fonts_and_sounds.tab=Global Font and Sound Settings
 menu.cmd_local_admin_printer.tab=Printer Settings Editor
+menu.cmd_local_admin_do_not_auto_attempt_print_setting.tab='Do Not Attempt Auto-Print' Setting
 menu.cmd_local_admin_closed_dates.tab=Closed Dates Editor
 menu.cmd_local_admin_copy_locations.tab=Copy Locations Editor
 menu.cmd_local_admin_lib_settings.tab=Library Settings Editor

Added: trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js	2010-05-01 08:33:51 UTC (rev 16368)
@@ -0,0 +1,161 @@
+var error;
+var network;
+var data;
+var coust_obj;
+
+function my_init() {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+        JSAN.errorLevel = "die"; // none, warn, or die
+        JSAN.addRepository('/xul/server/');
+        JSAN.use('util.error'); error = new util.error();
+        error.sdump('D_TRACE','my_init() for main_test.xul');
+        JSAN.use('util.network'); network = new util.network();
+        JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
+
+        dojo.require('openils.PermaCrud');
+        coust_obj = new openils.PermaCrud({authtoken:ses()}).search('coust',{'name':'circ.staff_client.do_not_auto_attempt_print'})[0];
+        document.getElementById('caption').setAttribute('label',coust_obj.label());
+        document.getElementById('caption').setAttribute('tooltiptext',coust_obj.name());
+        append_to_vbox('desc',coust_obj.description());
+
+        render_current_setting();
+
+        document.getElementById('apply').addEventListener(
+            'command',
+            apply_setting,
+            false
+        );
+
+        render_lib_menu();
+
+    } catch(E) {
+        try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
+    }
+}
+
+function append_to_vbox(id,node) {
+    if (typeof node == 'string') { var text = document.createTextNode(node); node = document.createElement('description'); node.appendChild(text); }
+    document.getElementById(id).appendChild(node);
+}
+
+function admin_string(s,p) {
+    var mc = document.getElementById('adminStrings');
+    if (p) {
+        return mc.getFormattedString(s,p);
+    } else {
+        return mc.getString(s);
+    }
+}
+
+function apply_setting(ev) {
+    var values = [];
+    if (document.getElementById('checkout').checked) { values.push('Checkout'); }
+    if (document.getElementById('bill_pay').checked) { values.push('Bill Pay'); }
+    if (document.getElementById('hold_slip').checked) { values.push('Hold Slip'); }
+    if (document.getElementById('transit_slip').checked) { values.push('Transit Slip'); }
+    if (document.getElementById('hold_transit_slip').checked) { values.push('Hold/Transit Slip'); }
+    var org = document.getElementById('lib_menulist').value;
+    var result = network.simple_request('FM_AOUS_UPDATE',[ ses(), org, { 'circ.staff_client.do_not_auto_attempt_print' : values } ]);
+    if (result == 1) {
+        alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_success'));
+        render_current_setting();
+    } else {
+        error.standard_unexpected_error_alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_failure'),result);
+    }
+}
+
+function render_current_setting() {
+    JSAN.use('util.widgets');
+
+    util.widgets.remove_children('current');
+
+    /* FIXME: would be good to have an .authoritative version of FM_AOUS_SPECIFIC_RETRIEVE */
+    var aous_req = network.simple_request('FM_AOUS_SPECIFIC_RETRIEVE',[ ses('ws_ou'), 'circ.staff_client.do_not_auto_attempt_print', ses() ]);
+    if (aous_req) {
+        append_to_vbox(
+            'current',
+            admin_string(
+                'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_preamble',
+                [ ses('ws_ou_shortname'), data.hash.aou[ aous_req.org ].shortname() ]
+            )
+        );
+
+        for (var i in aous_req.value) {
+            var label = document.createElement('label');
+            label.setAttribute('value', '   ' + aous_req.value[i]);
+            append_to_vbox('current',label);
+        }
+
+        /* update data.hash.aous while we have fresh data */
+
+        data.hash.aous['circ.staff_client.do_not_auto_attempt_print'] = aous_req.value;
+        data.stash('hash');
+
+    } else {
+        append_to_vbox(
+            'current',
+            admin_string(
+                'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_nonexistent',
+                [ ses('ws_ou_shortname') ]
+            )
+        );
+    }
+}
+
+
+function render_lib_menu() {
+    try {
+        JSAN.use('util.functional'); JSAN.use('util.fm_utils'); JSAN.use('util.widgets');
+
+        var work_ous = network.simple_request(
+            'PERM_RETRIEVE_WORK_OU',
+            [ ses(), 'ADMIN_ORG_UNIT_SETTING_TYPE']
+        );
+        if (work_ous.length == 0) {
+            return;
+        } else {
+            document.getElementById('apply').disabled = false;
+        }
+
+        var my_libs = [];
+        for (var i = 0; i < work_ous.length; i++ ) {
+            var perm_depth = data.hash.aout[ data.hash.aou[ work_ous[i] ].ou_type() ].depth();
+
+            var my_libs_tree = network.simple_request(
+                'FM_AOU_DESCENDANTS_RETRIEVE',
+                [ work_ous[i], perm_depth ]
+            );
+            if (!instanceOf(my_libs_tree,aou)) { /* FIXME - workaround for weird descendants call result */
+                my_libs_tree = my_libs_tree[0];
+            }
+            my_libs = my_libs.concat( util.fm_utils.flatten_ou_branch( my_libs_tree ) );
+        }
+
+        var x = document.getElementById('menu');
+        util.widgets.remove_children( x );
+
+        var default_lib = my_libs[0].id();
+
+        var ml = util.widgets.make_menulist(
+            util.functional.map_list(
+                my_libs,
+                function(obj) {
+                    return [
+                        obj.shortname(),
+                        obj.id(),
+                        false,
+                        ( data.hash.aout[ obj.ou_type() ].depth() )
+                    ];
+                }
+            ),
+            default_lib
+        );
+        ml.setAttribute('id','lib_menulist');
+
+        x.appendChild( ml );
+    } catch(E) {
+        alert('Error in do_not_auto_attempt_print_setting.js, render_lib_menu(): ' + E);
+    }
+}

Added: trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul	                        (rev 0)
+++ trunk/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.xul	2010-05-01 08:33:51 UTC (rev 16368)
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Example Template for remote xul -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?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="main_test_win" 
+    onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+    <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+    <!-- BEHAVIOR -->
+    <script type="text/javascript">
+        var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;
+    </script>
+    <scripts id="openils_util_scripts"/>
+
+    <messagecatalog id="adminStrings" src='/xul/server/locale/<!--#echo var="locale"-->/admin.properties'/>
+
+    <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+    <script type="text/javascript" src="do_not_auto_attempt_print_setting.js"/>
+
+    <groupbox flex="0">
+        <caption id="caption"/>
+        <vbox id="desc"/>
+    </groupbox>
+    <groupbox flex="0">
+        <caption label="&staff.server.admin.do_not_auto_attempt_print_setting.current_inherited_setting.caption;"/>
+        <vbox id="current"/>
+    </groupbox>
+    <groupbox flex="0">
+        <caption label="&staff.server.admin.do_not_auto_attempt_print_setting.new_setting.caption;"/>
+        <label value="&staff.server.admin.do_not_auto_attempt_print_setting.receipt_slip_type.prompt;"/>
+        <vbox>
+            <checkbox id="checkout" label="&staff.server.admin.do_not_auto_attempt_print_setting.checkout;" />
+            <checkbox id="bill_pay" label="&staff.server.admin.do_not_auto_attempt_print_setting.bill_pay;" />
+            <checkbox id="hold_slip" label="&staff.server.admin.do_not_auto_attempt_print_setting.hold_slip;" />
+            <checkbox id="transit_slip" label="&staff.server.admin.do_not_auto_attempt_print_setting.transit_slip;" />
+            <checkbox id="hold_transit_slip" label="&staff.server.admin.do_not_auto_attempt_print_setting.hold_transit_slip;" />
+        </vbox>
+        <label value="&staff.server.admin.do_not_auto_attempt_print_setting.library_selector.prompt;"/>
+        <hbox id="menu"/>
+        <hbox><spacer flex="1"/><button id="apply" disabled="true" label="&staff.server.admin.org_unit_settings.update_setting;" accesskey=""/></hbox>
+    </groupbox>
+
+</window>
+

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/admin.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/admin.properties	2010-05-01 08:33:50 UTC (rev 16367)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/admin.properties	2010-05-01 08:33:51 UTC (rev 16368)
@@ -98,3 +98,9 @@
 staff.admin.offline_manage_xacts.completed=Completed
 staff.admin.offline_manage_xacts.no=No
 staff.admin.offline_manage_xacts.yes=Yes
+staff.admin.staff.do_not_auto_attempt_print_setting.update_success=Setting updated
+staff.admin.staff.do_not_auto_attempt_print_setting.update_failure=Setting not updated due to error
+# 1 - workstation library shortname   2 - setting library shortname
+staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_preamble=Workstation library %1$s is currently suppressing auto-print for these receipt/slip types based on a setting inherited from %2$s:
+# 1 - workstation library shortname
+staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_nonexistent=Workstation library %1$s is not currently suppressing auto-print for any receipt/slip types.



More information about the open-ils-commits mailing list