wire up util.hide in the item attribute editor
authorJason Etheridge <jason@esilibrary.com>
Thu, 15 Mar 2012 17:52:20 +0000 (13:52 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 2 Apr 2012 11:47:38 +0000 (07:47 -0400)
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@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/cat/copy_editor.xul

index 7acd10d..29e809c 100644 (file)
 <!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:">
index 800c727..2d1579c 100644 (file)
@@ -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'); }
index 5105ec1..b72d537 100644 (file)
         </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">