[open-ils-commits] [GIT] Evergreen ILS branch master updated. 7cef76169d6c6f6f4ae3e6ea165d672783b34139

Evergreen Git git at git.evergreen-ils.org
Mon Apr 2 07:44:12 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  7cef76169d6c6f6f4ae3e6ea165d672783b34139 (commit)
       via  64c9debfa75be900e34fd51bb0fec1fe7c06f8fa (commit)
       via  681a966c45610f34971e9f8dcc7b4a730695c873 (commit)
       via  092c4579ad6d40680d471dfca8bd952da6c859b0 (commit)
       via  131ad24c1c3dfba1c94731defb10318e62975751 (commit)
       via  92e20a4348c30d4361a81f5a03a9a8efa499992e (commit)
      from  c7c418a87d2284423f58a0d3e1a418c32a8b4ab6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7cef76169d6c6f6f4ae3e6ea165d672783b34139
Author: Mike Rylander <mrylander at gmail.com>
Date:   Mon Apr 2 07:50:40 2012 -0400

    Stamping upgrade script for Copy Editor Field Hiding
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 1c62469..eaf0e9f 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps
     BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
     FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
 
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0698', :eg_version); -- tsbere
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0699', :eg_version); -- phasefx/miker
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql b/Open-ILS/src/sql/Pg/upgrade/0699.data.org-setting-ui.hide_copy_editor_fields.sql
similarity index 66%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql
rename to Open-ILS/src/sql/Pg/upgrade/0699.data.org-setting-ui.hide_copy_editor_fields.sql
index df06384..5d95f89 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0699.data.org-setting-ui.hide_copy_editor_fields.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0699', :eg_version);
 
 INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, grp )
     VALUES (
@@ -23,6 +23,5 @@ INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, g
         'gui'
     );
 
--- DELETE FROM actor.org_unit_setting WHERE name = 'ui.hide_copy_editor_fields'; DELETE FROM config.org_unit_setting_type_log WHERE field_name = 'ui.hide_copy_editor_fields'; DELETE FROM config.org_unit_setting_type WHERE name = 'ui.hide_copy_editor_fields'; DELETE FROM config.upgrade_log WHERE version = 'XXXX';
 
 COMMIT;
diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql
index 617b206..2236318 100644
--- a/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql
+++ b/Open-ILS/src/sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql
@@ -15074,4 +15074,29 @@ INSERT into config.org_unit_setting_type
     'bool', null)
 ;		
 
+
+SELECT evergreen.upgrade_deps_block_check('0699', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, grp )
+    VALUES (
+        'ui.hide_copy_editor_fields',
+        oils_i18n_gettext(
+            'ui.hide_copy_editor_fields',
+            'GUI: Hide these fields within the Item Attribute Editor',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.hide_copy_editor_fields',
+            'This setting may be best maintained with the dedicated configuration'
+            || ' interface within the Item Attribute Editor.  However, here it'
+            || ' shows up as comma separated list of field identifiers to hide.',
+            'coust',
+            'description'
+        ),
+        'array',
+        'gui'
+    );
+
+
 COMMIT;

commit 64c9debfa75be900e34fd51bb0fec1fe7c06f8fa
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Fri Mar 16 15:54:59 2012 -0400

    prevent templates from changing unsafe fields
    
    in the Item Attribute Editor, for any of the fields are hidden via util.hide,
    and for statuses which shouldn't be changed (like from Checked Out to something else)
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 2d1579c..f4af660 100644
--- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js
+++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
@@ -324,6 +324,19 @@ g._apply_template = function(name,apply_volume_editor_template_changes) {
         if (g.templates[ name ] != 'undefined') {
             var template = g.templates[ name ];
             for (var i in template) {
+                if (g.is_field_hidden(i)) {
+                    alert($('catStrings').getFormattedString(
+                        'staff.cat.copy_editor.apply_unsafe_field',
+                        [i]
+                    ));
+                    continue;
+                }
+                if (template[i].field == 'status') {
+                    if (!g.safe_to_edit_copy_status()) {
+                        alert($('catStrings').getFormattedString('staff.cat.copy_editor.apply_unsafe_field',[i]));
+                        continue;
+                    }
+                }
                 g.changed[ i ] = template[ i ];
                 switch( template[i].type ) {
                     case 'attribute' :
@@ -653,6 +666,23 @@ g.safe_to_edit_copy_status = function() {
 }
 
 /******************************************************************************************************/
+/* This returns true if the field has been hidden via util.hide */
+
+g.is_field_hidden = function(field) {
+    try {
+        g.data.stash_retrieve();
+        if (g.data.hash.aous['ui.hide_copy_editor_fields']
+            && g.data.hash.aous['ui.hide_copy_editor_fields'].indexOf(field) > -1) {
+            return true;
+        }
+    } catch(E) {
+        g.error.standard_unexpected_error_alert('is_field_hidden?',E);
+        return false;
+    }
+}
+
+
+/******************************************************************************************************/
 /* 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) {
@@ -1293,6 +1323,7 @@ g.render = function() {
         }
     }
 
+    util.hide.generate_css('ui.hide_copy_editor_fields');
 }
 
 /******************************************************************************************************/
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
index f8ac40c..edff8b0 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
@@ -150,6 +150,7 @@ staff.cat.copy_editor.import_templates.save.success=All templates saved.
 staff.cat.copy_editor.import_templates.save.error=Error saving templates
 staff.cat.copy_editor.import_templates.note=Note: These imported templates will get saved along with any new template you try to create, but if that does not happen, then these templates will disappear with the next invocation of the item attribute editor.
 staff.cat.copy_editor.import_templates.error=Error importing templates
+staff.cat.copy_editor.apply_unsafe_field=Template tried to change field '%1$s', which is not allowed currently.
 staff.cat.copy_editor.apply_owning_lib.undefined_volume.error=Error retrieving Volume information for copy %1$s.  The owning library for this copy will not be changed.
 staff.cat.copy_editor.apply_owning_lib.call_number.error=Error changing owning library for copy %1$s.  The owning library for this copy will not be changed.
 staff.cat.copy_editor.copy_count=1 copy

commit 681a966c45610f34971e9f8dcc7b4a730695c873
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Thu Mar 15 13:52:20 2012 -0400

    wire up util.hide in the item attribute editor
    
    Currently, hidden elements may still be affected through templates.
    
    Thanks goes to MassLNC for this one.  Based on SC-D3 at
    http://www.esilibrary.com/esi/docs/?p=841, with some implementation
    simplifications.
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index 7acd10d..29e809c 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -2768,6 +2768,8 @@
 <!ENTITY staff.cat.copy_editor.save.accesskey "M">
 <!ENTITY staff.cat.copy_editor.cancel.label "Close">
 <!ENTITY staff.cat.copy_editor.cancel.accesskey "C">
+<!ENTITY staff.cat.copy_editor.hide_fields.label "Hide Fields">
+<!ENTITY staff.cat.copy_editor.hide_fields.accesskey "">
 <!ENTITY staff.cat.copy_summary.label "Item Summary">
 <!ENTITY staff.cat.copy_summary.barcode.label "Barcode:">
 <!ENTITY staff.cat.copy_summary.location.label "Location:">
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 800c727..2d1579c 100644
--- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js
+++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
@@ -224,6 +224,9 @@ function my_init() {
             g.hide_copy_notes_button();
         }
 
+        JSAN.use('util.hide');
+        util.hide.generate_css('ui.hide_copy_editor_fields');
+
     } catch(E) {
         var err_msg = $("commonStrings").getFormattedString('common.exception', ['cat/copy_editor.js', E]);
         try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); dump(js2JSON(E)); }
@@ -1209,6 +1212,7 @@ g.render = function() {
             try {
                 var f = g.panes_and_field_names[h][i]; var fn = f[0]; var attr = f[1].attr;
                 groupbox = document.createElement('groupbox'); document.getElementById(h).appendChild(groupbox);
+                groupbox.setAttribute('hideable',fn);
                 if (attr) {
                     for (var a in attr) {
                         groupbox.setAttribute(a,attr[a]);
@@ -1217,6 +1221,7 @@ g.render = function() {
                 caption = document.createElement('caption'); groupbox.appendChild(caption);
                 caption.setAttribute('label',fn);
                 caption.setAttribute('id','caption_'+fn); // used for focus/keyboard navigation
+                caption.setAttribute('hideable',fn);
                 vbox = document.createElement('vbox'); groupbox.appendChild(vbox); // main display widget goes here
                 if (typeof g.changed[fn] != 'undefined') { addCSSClass(vbox,'copy_editor_field_changed'); }
                 if (typeof g.required[fn] != 'undefined') { addCSSClass(vbox,'copy_editor_field_required'); }
diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.xul b/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
index 5105ec1..b72d537 100644
--- a/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
+++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.xul
@@ -85,6 +85,11 @@
         </hbox>
 
         <hbox id="nav">
+            <button
+                label="&staff.cat.copy_editor.hide_fields.label;"
+                accesskey="&staff.cat.copy_editor.hide_fields.accesskey;"
+                oncommand="util.hide.generate_dialog('ui.hide_copy_editor_fields')"
+            />
             <spacer flex="1"/>
             <button id="copy_notes" label="&staff.cat.copy_editor.copy_notes.label;" accesskey="&staff.cat.copy_editor.copy_notes.accesskey;" oncommand="g.copy_notes();"/>
             <hbox id="non_unified_buttons">

commit 092c4579ad6d40680d471dfca8bd952da6c859b0
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Thu Mar 15 00:58:05 2012 -0400

    util.hide library
    
    Provides util.hide.generate_dialog and util.hide.generate_css.
    
    util.hide.generate_css takes one parameter, an org unit setting name for a
    setting of type array. It tests this setting and for every value in the array
    it looks for DOM elements with 'hideable' attributes containing those values.
    It adds the CSS classname 'hideme' to such elements, and removes 'hideme' from
    any non-matched elements that also have 'hideable' attributes.
    
    util.hide.generate_dialog takes the same setting parameter as generate_css, and
    an optional context org parameter (defaults to the workstation library). It pops
    up a dialog with a checkbox for every 'hideable' DOM element. Clicking 'OK' will
    update the org unit setting with every checked element, and it then calls
    generate_css to update the interface being affected.
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql
new file mode 100644
index 0000000..df06384
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.org-setting-ui.hide_copy_editor_fields.sql
@@ -0,0 +1,28 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype, grp )
+    VALUES (
+        'ui.hide_copy_editor_fields',
+        oils_i18n_gettext(
+            'ui.hide_copy_editor_fields',
+            'GUI: Hide these fields within the Item Attribute Editor',
+            'coust',
+            'label'
+        ),
+        oils_i18n_gettext(
+            'ui.hide_copy_editor_fields',
+            'This setting may be best maintained with the dedicated configuration'
+            || ' interface within the Item Attribute Editor.  However, here it'
+            || ' shows up as comma separated list of field identifiers to hide.',
+            'coust',
+            'description'
+        ),
+        'array',
+        'gui'
+    );
+
+-- DELETE FROM actor.org_unit_setting WHERE name = 'ui.hide_copy_editor_fields'; DELETE FROM config.org_unit_setting_type_log WHERE field_name = 'ui.hide_copy_editor_fields'; DELETE FROM config.org_unit_setting_type WHERE name = 'ui.hide_copy_editor_fields'; DELETE FROM config.upgrade_log WHERE version = 'XXXX';
+
+COMMIT;
diff --git a/Open-ILS/xul/staff_client/chrome/content/util/hide.js b/Open-ILS/xul/staff_client/chrome/content/util/hide.js
new file mode 100644
index 0000000..e67a64b
--- /dev/null
+++ b/Open-ILS/xul/staff_client/chrome/content/util/hide.js
@@ -0,0 +1,189 @@
+dump('entering util/hide.js\n');
+
+if (typeof util == 'undefined') var util = {};
+util.hide = {};
+
+util.hide.EXPORT_OK    = [
+    'generate_dialog',
+    'generate_css'
+];
+util.hide.EXPORT_TAGS    = { ':all' : util.hide.EXPORT_OK };
+
+util.hide.generate_dialog = function(setting,org) {
+    JSAN.use('util.network'); JSAN.use('OpenILS.data');
+    var data = new OpenILS.data(); data.stash_retrieve();
+    var network = new util.network();
+
+    // gather the hideable elements and determine how we might best label them
+    var nl = document.getElementsByAttribute('hideable','*');
+    var hideable = {};
+    for (var i = 0; i < nl.length; i++) {
+        var hname = nl[i].getAttribute('hideable');
+        var value = nl[i].getAttribute('value');
+        var label = nl[i].getAttribute('label');
+
+        if (typeof hideable[hname] == 'undefined') {
+            hideable[hname] = hname;
+        }
+
+        if (nl[i].nodeName == 'label' && value) {
+            hideable[hname] = value;
+        }
+
+        if (label) {
+            hideable[hname] = label;
+        }
+    }
+
+    // put them into a sorted array
+    var elements = [];
+    for (var hname in hideable) {
+        elements.push( { 'hname' : hname, 'label' : hideable[hname] } );
+    }
+    elements = elements.sort(
+        function(a,b) {
+            if (a.label < b.label) return -1;
+            if (a.label > b.label) return 1;
+            return 0;
+        }
+    );
+
+    // create our dialog
+    JSAN.use('util.widgets');
+    var vbox = document.createElement('vbox');
+    var menu_box = document.createElement('hbox');
+    vbox.appendChild(menu_box);
+    var perm = 'STAFF_LOGIN'; // let's be less restrictive up front, since
+    // staff may want to configure and then call over a manager for a perm
+    // override
+    var menu = util.widgets.render_perm_org_menu(perm,ses('ws_ou'));
+    if (!menu) {
+        alert(
+            $('offlineStrings').getFormattedString(
+                'util.hide_elements.missing_permission',
+                [ perm ]
+            )
+        );
+        return false;
+    }
+    menu_box.appendChild(menu);
+
+    var already_hidden = {};
+    var aous_req = network.simple_request(
+        'FM_AOUS_SPECIFIC_RETRIEVE',
+        [
+            org || ses('ws_ou'),
+            setting,
+            ses()
+        ]
+    );
+    if (aous_req) {
+        var desc = document.createElement('description');
+        vbox.appendChild(desc);
+        var msg = $('offlineStrings').getFormattedString(
+            'util.hide_elements.current_setting_preamble',
+            [ ses('ws_ou_shortname'), data.hash.aou[ aous_req.org ].shortname() ]
+        );
+        desc.appendChild( document.createTextNode( msg ) );
+
+        for (var i in aous_req.value) {
+            already_hidden[aous_req.value[i]] = true;
+        }
+
+        /* update data.hash.aous while we have fresh data */
+        data.hash.aous[setting] = aous_req.value;
+        data.stash('hash');
+
+    } else {
+        var desc = document.createElement('description');
+        vbox.appendChild(desc);
+        var msg = $('offlineStrings').getFormattedString(
+            'util.hide_elements.current_setting_nonexistent',
+            [ ses('ws_ou_shortname') ]
+        );
+        desc.appendChild( document.createTextNode( msg ) );
+
+        data.hash.aous[setting] = null;
+        data.stash('hash');
+    }
+
+    for (var i = 0; i < elements.length; i++) {
+        var checkbox = document.createElement('checkbox');
+        checkbox.setAttribute('label',elements[i].label);
+        checkbox.setAttribute('value',elements[i].hname);
+        if (already_hidden[elements[i].hname]) {
+            checkbox.setAttribute('checked','true');
+        }
+        vbox.appendChild(checkbox);
+    }
+
+
+    var results = widget_prompt(
+        vbox,
+        {
+            'title' : $('offlineStrings').getString('util.hide_elements.title'),
+            'desc' : $('offlineStrings').getString('util.hide_elements.desc'),
+            'access' : 'method',
+            'method' : function() {
+                var hide_these = [];
+                for (var i = 0; i < vbox.childNodes.length; i++) {
+                    var checkbox = vbox.childNodes[i];
+                    if (checkbox.checked) {
+                        hide_these.push( checkbox.getAttribute('value') );
+                    }
+                }
+                return { 'org' : menu.value, 'elements' : hide_these };
+            }
+        }
+    );
+    if (!results) { return; }
+
+    var params = {};
+    params[setting] = results.elements.length > 0
+        ? results.elements
+        : null; // delete the setting so we can inherit from higher orgs
+    var result = network.simple_request(
+        'FM_AOUS_UPDATE',
+        [
+            ses(),
+            results.org,
+            params
+        ]
+    );
+    if (result == 1) {
+
+        if (results.elements.length > 0) {
+            alert($('offlineStrings').getString('util.hide_elements.update_setting.update_success'));
+        } else {
+            alert($('offlineStrings').getString('util.hide_elements.update_setting.delete_success'));
+        }
+        data.hash.aous[setting] = params[setting];
+        data.stash('hash');
+
+        util.hide.generate_css(setting);
+
+    } else {
+        alert($('offlineStrings').getString('util.hide_elements.update_setting.failure'));
+    }
+}
+
+util.hide.generate_css = function(setting) {
+    JSAN.use('OpenILS.data');
+    var data = new OpenILS.data(); data.stash_retrieve();
+    var hidden = {};
+    for (var i in data.hash.aous[setting]) {
+        hidden[data.hash.aous[setting][i]] = true;
+    }
+ 
+    var nl = document.getElementsByAttribute('hideable','*');
+    for (var i = 0; i < nl.length; i++) {
+        var hname = nl[i].getAttribute('hideable');
+        if (hidden[hname]) {
+            addCSSClass(nl[i],'hideme');
+        } else {
+            removeCSSClass(nl[i],'hideme');
+        }
+    }
+}
+
+dump('exiting util/hide.js\n');
diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
index af40f08..961ad06 100644
--- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
+++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
@@ -317,3 +317,11 @@ barcode_choice.asset_label=Item : %1$s
 barcode_choice.serial_label=Serial : %1$s
 barcode_choice.booking_label=Booking : %1$s
 staff.main.button_bar.none=None
+util.hide_elements.title=Hide UI Elements
+util.hide_elements.desc=This is a list of hideable elements for this interface.  Check the ones that you want hidden and the library (and descendants) you want to affect:
+util.hide_elements.current_setting_preamble=Workstation library %1$s is currently hiding these elements based on a setting inherited from %2$s:
+util.hide_elements.current_setting_nonexistent=Workstation library %1$s is not currently hiding any of these elements.
+util.hide_elements.update_setting.update_success=Successfully updated the setting.
+util.hide_elements.update_setting.delete_success=Successfully deleted the setting.
+util.hide_elements.update_setting.failure=Setting not changed.
+util.hide_elements.missing_permission=Missing permission %1$s
diff --git a/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul b/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
index f185b79..323971f 100644
--- a/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
+++ b/Open-ILS/xul/staff_client/server/OpenILS/util_overlay.xul
@@ -60,6 +60,7 @@
         <script type="text/javascript" src="/xul/server/util/sound.js" />
         <script type="text/javascript" src="/xul/server/util/text.js" />
         <script type="text/javascript" src="/xul/server/util/widgets.js" />
+        <script type="text/javascript" src="/xul/server/util/hide.js" />
         <script type="text/javascript" src="/xul/server/util/window.js" />
         <script type="text/javascript" src="/xul/server/circ/util.js" />
         <script type="text/javascript" src="/xul/server/cat/util.js" />

commit 131ad24c1c3dfba1c94731defb10318e62975751
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Thu Mar 15 13:16:24 2012 -0400

    move .hideme css to global.css
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/xul/staff_client/server/skin/global.css b/Open-ILS/xul/staff_client/server/skin/global.css
index ee08b6c..9d7829b 100644
--- a/Open-ILS/xul/staff_client/server/skin/global.css
+++ b/Open-ILS/xul/staff_client/server/skin/global.css
@@ -10,6 +10,8 @@ messagecatalog { -moz-binding: url('/xul/server/main/bindings.xml#messagecatalog
 
 window:not([active="true"]) menubar > menu { color: menutext !important }
 
+.hideme { display: none; }
+
 treechildren::-moz-tree-checkbox(checked) {
     /* css for checked cells */
     list-style-image: url("chrome://global/skin/checkbox/cbox-check.gif");
diff --git a/Open-ILS/xul/staff_client/server/skin/patron_display.css b/Open-ILS/xul/staff_client/server/skin/patron_display.css
index 3356c18..5a0adbd 100644
--- a/Open-ILS/xul/staff_client/server/skin/patron_display.css
+++ b/Open-ILS/xul/staff_client/server/skin/patron_display.css
@@ -3,8 +3,6 @@
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); 
 @namespace html url("http://www.w3.org/TR/REC-html40"); 
 
-.hideme { display: none; }
-
 .change_to_credit { text-decoration: line-through; }
 
 hbox#PatronNotNavBar { border-top: solid thin black; }
diff --git a/Open-ILS/xul/staff_client/server/skin/serial.css b/Open-ILS/xul/staff_client/server/skin/serial.css
index 3f4abab..0414871 100644
--- a/Open-ILS/xul/staff_client/server/skin/serial.css
+++ b/Open-ILS/xul/staff_client/server/skin/serial.css
@@ -8,7 +8,6 @@ caption.top {
     text-align: center;
 }
 label.receiving { width: 20em; text-align: right; }
-.hideme { display: none; }
 #batch_receive_entry { padding-top: 10px; }
 #entry_submitter { padding: 20px 0; }
 menulist.cn { width: 12em; }

commit 92e20a4348c30d4361a81f5a03a9a8efa499992e
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Thu Mar 15 02:30:31 2012 -0400

    liberate this perm-cognizant lib menu generator
    
    for re-use in other interfaces
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
index 4867256..bf8b644 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
@@ -27,7 +27,8 @@ util.widgets.EXPORT_OK    = [
     'set_text',
     'save_attributes',
     'load_attributes',
-    'find_descendants_by_name'
+    'find_descendants_by_name',
+    'render_perm_org_menu'
 ];
 util.widgets.EXPORT_TAGS    = { ':all' : util.widgets.EXPORT_OK };
 
@@ -475,4 +476,56 @@ util.widgets.find_descendants_by_name = function(top_node,name) {
     return top_node.getElementsByAttribute('name',name);
 }
 
+util.widgets.render_perm_org_menu = function (perm,org) {
+    try {
+        JSAN.use('util.functional'); JSAN.use('util.fm_utils');
+        JSAN.use('OpenILS.data'); JSAN.use('util.network');
+        var data = new OpenILS.data(); data.stash_retrieve();
+        var network = new util.network();
+
+        var work_ous = network.simple_request(
+            'PERM_RETRIEVE_WORK_OU',
+            [ ses(), perm]
+        );
+        if (work_ous.length == 0) {
+            return 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 default_lib = org || my_libs[0].id();
+
+        var ml = util.widgets.make_menulist(
+            util.functional.map_list(
+                my_libs,
+                function(obj) {
+                    return [
+                        obj.shortname() + ' : ' + obj.name(),
+                        obj.id(),
+                        false,
+                        ( data.hash.aout[ obj.ou_type() ].depth() )
+                    ];
+                }
+            ),
+            default_lib
+        );
+
+        return ml;
+
+    } catch(E) {
+        alert('Error in util.widgets.render_perm_org_menu(): ' + E);
+    }
+}
 dump('exiting util/widgets.js\n');
diff --git a/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js b/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js
index e1eaea0..461b09f 100644
--- a/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js
+++ b/Open-ILS/xul/staff_client/server/admin/do_not_auto_attempt_print_setting.js
@@ -28,7 +28,14 @@ function my_init() {
             false
         );
 
-        render_lib_menu();
+        var ml = util.widgets.render_perm_org_menu('ADMIN_ORG_UNIT_SETTING_TYPE');
+        if (ml) {
+            document.getElementById('apply').disabled = false;
+            ml.setAttribute('id','lib_menulist');
+            var x = document.getElementById('menu');
+            util.widgets.remove_children(x);
+            x.appendChild(ml);
+        }
 
     } catch(E) {
         try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
@@ -105,57 +112,4 @@ function render_current_setting() {
 }
 
 
-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);
-    }
-}

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 ...data.org-setting-ui.hide_copy_editor_fields.sql |   27 +++
 .../sql/Pg/version-upgrade/2.1-2.2-upgrade-db.sql  |   25 +++
 Open-ILS/web/opac/locale/en-US/lang.dtd            |    2 +
 .../xul/staff_client/chrome/content/util/hide.js   |  189 ++++++++++++++++++++
 .../staff_client/chrome/content/util/widgets.js    |   55 ++++++-
 .../chrome/locale/en-US/offline.properties         |    8 +
 .../staff_client/server/OpenILS/util_overlay.xul   |    1 +
 .../admin/do_not_auto_attempt_print_setting.js     |   62 +------
 .../xul/staff_client/server/cat/copy_editor.js     |   36 ++++
 .../xul/staff_client/server/cat/copy_editor.xul    |    5 +
 .../server/locale/en-US/cat.properties             |    1 +
 Open-ILS/xul/staff_client/server/skin/global.css   |    2 +
 .../staff_client/server/skin/patron_display.css    |    2 -
 Open-ILS/xul/staff_client/server/skin/serial.css   |    1 -
 15 files changed, 359 insertions(+), 59 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0699.data.org-setting-ui.hide_copy_editor_fields.sql
 create mode 100644 Open-ILS/xul/staff_client/chrome/content/util/hide.js


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list