remove XUL @persist from list column definitions
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / cat / copy_summary.xul
index e373f41..f9e6f48 100644 (file)
@@ -21,7 +21,7 @@
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
 
 <window id="cat_copy_summary_win" 
-    onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
+    onload="try { font_helper(); persist_helper(); my_init(); } catch(E) { alert(E); }"
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
@@ -40,7 +40,6 @@
 
         function my_init() {
             try {
-                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                 if (typeof JSAN == 'undefined') { 
                     throw( $("commonStrings").getString('common.jsan.missing') );
                 }
@@ -73,7 +72,7 @@
                 ).concat(
                     {
                         'id' : 'total_circs', 'label' : $('catStrings').getString('staff.cat.copy_summary.total_circs.label'), 'flex' : 1,
-                        'primary' : false, 'hidden' : false, 'persist' : 'hidden width ordinal',
+                        'primary' : false, 'hidden' : false,
                         'render' : 'v = obj.network.simple_request("FM_CIRC_COUNT_RETRIEVE_VIA_COPY",[ my.acp.id() ]).total.count; v;' 
                     }
                 );
                 g.list.init(
                     {
                         'columns' : columns,
-                        'map_row_to_columns' : circ.util.std_map_row_to_columns(),
                     }
                 );
-    
+                $('list_actions').appendChild( g.list.render_list_actions() );
+                g.list.set_list_actions();
                 function acp_callback(req) {
                     try {
                         var copy = req.getResultObject();
 
                         function acn_callback(rreq) {
                             try {
-                                $w('barcode',copy.barcode());    
-                                $w('ref',get_bool(copy.ref()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
-                                $w('opac_visible',get_bool(copy.opac_visible()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
-                                $w('circulate',get_bool(copy.circulate()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
-                                $w('holdable',get_bool(copy.holdable()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
-                                $w('age_protect',copy.age_protect() == null ? $('staff.cat.copy_summary.unset') : ( typeof copy.age_protect() == 'object' ? copy.age_protect().name() : g.data.hash.crahp[ copy.age_protect() ].name() ) );    
-                                $w('location',typeof copy.location() == 'object' ? copy.location().name() : g.data.lookup('acpl',copy.location()).name() );    
-                                $w('create_date',util.date.formatted_date(copy.create_date(),'%F'));
-                                $w('edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
-                                $w('status',typeof copy.status() == 'object' ? copy.status().name() : g.data.hash.ccs[ copy.status() ].name() );    
+                                $w('copy_summary_barcode',copy.barcode());    
+                                $w('copy_summary_ref',get_bool(copy.ref()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
+                                $w('copy_summary_opac_visible',get_bool(copy.opac_visible()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
+                                $w('copy_summary_circulate',get_bool(copy.circulate()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
+                                $w('copy_summary_holdable',get_bool(copy.holdable()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
+                                $w('copy_summary_age_protect',copy.age_protect() == null ? $('staff.cat.copy_summary.unset') : ( typeof copy.age_protect() == 'object' ? copy.age_protect().name() : g.data.hash.crahp[ copy.age_protect() ].name() ) );    
+                                $w('copy_summary_location',typeof copy.location() == 'object' ? copy.location().name() : g.data.lookup('acpl',copy.location()).name() );    
+                                $w('copy_summary_create_date',util.date.formatted_date(copy.create_date(),'%F'));
+                                $w('copy_summary_edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
+                                $w('copy_summary_status',typeof copy.status() == 'object' ? copy.status().name() : g.data.hash.ccs[ copy.status() ].name() );    
                             } catch(E) {
                                 g.error.standard_unexpected_error_alert('rendering copy',E);
                             }
                                 if (typeof cn.ilsevent != 'undefined') {
                                     switch(Number(cn.ilsevent)) {
                                         case 1508 /* ASSET_CALL_NUMBER_NOT_FOUND */ :
-                                            $w('callnumber', $('catStrings').getString('staff.cat.copy_summary.not_cataloged'));    
+                                            $w('copy_summary_callnumber', $('catStrings').getString('staff.cat.copy_summary.not_cataloged'));    
                                         break;
                                         default:
                                             throw(cn);
                                         break;
                                     }
                                 } else {
-                                    $w('callnumber',cn.label());    
+                                    $w('copy_summary_callnumber',cn.label());    
+                                }
+                                g.list.append({'row':{'my':{'acp':copy,'acn':cn,'circ':xulG.circ}}});
+                                g.barcode = copy.barcode(); g.doc_id = cn.record();
+                                if (g.doc_id > -1) {
+                                    $('show_in_opac').hidden = false;
                                 }
-                                g.list.append({'row':{'my':{'acp':copy,'acn':cn}}});
                             } catch(E) {
                                 g.error.standard_unexpected_error_alert('retrieving volume',E);
                             }
                     try {
                         var robj = req.getResultObject();
                         if (typeof robj.ilsevent != 'undefined') throw(robj);
-                        $w('total_circs',robj.total.count);
+                        $w('copy_summary_total_circs',robj.total.count);
                     } catch(E) {
                         g.error.standard_unexpected_error_alert('retrieving circ total',E);
                     }
                 });
 
-                toggle_deck(); toggle_deck(); /* quick hack */
+                if ( $('alternate_view').checked ) {
+                    toggle_deck();
+                }
 
             } catch(E) {
                 try { g.error.standard_unexpected_error_alert('copy_summary.xul',E); } catch(F) { alert(E + '\n' + F); }
             try {
                 if ($('item_deck').selectedIndex == 0) {
                     $('item_deck').selectedIndex = 1; /* change to grid */
-                    $('save_columns').hidden = true;
-                    $('sel_clip').hidden = true;
                 } else {
                     $('item_deck').selectedIndex = 0; /* change to tree */
-                    $('save_columns').hidden = false;
-                    $('sel_clip').hidden = false;
                 }
             } catch(E) {
             }
                 <rows>
                     <row>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.barcode.label;"/>
-                        <label id="barcode" style="color: blue; text-decoration: underline; -moz-user-focus: normal;" onclick="copy_to_clipboard(event);"/>
+                        <label id="copy_summary_barcode" style="color: blue; text-decoration: underline; -moz-user-focus: normal;" onclick="copy_to_clipboard(event);"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.location.label;"/>
-                        <label id="location"/>
+                        <label id="copy_summary_location"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.call_number.label;"/>
-                        <label id="callnumber"/>
+                        <label id="copy_summary_callnumber"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.status.label;"/>
-                        <label id="status"/>
+                        <label id="copy_summary_status"/>
                     </row>
                     <row>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.circulate.label;"/>
-                        <label id="circulate"/>
+                        <label id="copy_summary_circulate"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.reference.label;"/>
-                        <label id="ref"/>
+                        <label id="copy_summary_ref"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.holdable.label;"/>
-                        <label id="holdable"/>
+                        <label id="copy_summary_holdable"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.opac_visible.label;"/>
-                        <label id="opac_visible"/>
+                        <label id="copy_summary_opac_visible"/>
                     </row>
                     <row>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.created.label;"/>
-                        <label id="create_date"/>
+                        <label id="copy_summary_create_date"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.edited.label;"/>
-                        <label id="edit_date"/>
+                        <label id="copy_summary_edit_date"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.age_protect.label;"/>
-                        <label id="age_protect"/>
+                        <label id="copy_summary_age_protect"/>
                         <label style="font-weight: bold" value="&staff.cat.copy_summary.total_circs.label;"/>
-                        <label id="total_circs"/>
+                        <label id="copy_summary_total_circs"/>
                     </row>
                 </rows>
             </grid>
         </deck>
         <hbox>
-            <button label="&staff.cat.copy_summary.alternate_view.label;" oncommand="toggle_deck()"/>
-            <button id="save_columns" label="&staff.cat.copy_summary.save_columns.label;" oncommand="try { g.list.save_columns(); } catch(E) { alert(E); }"/>
-            <button id="sel_clip" label="&staff.cat.copy_summary.sel_clip.label;" oncommand="try { g.list.node.view.selection.selectAll(); g.list.clipboard(); } catch(E) { alert(E); }"/>
-            <button id="print_export" label="&staff.cat.copy_summary.print_export.label;" oncommand="try { g.list.on_all_fleshed = function() { JSAN.use('util.print'); var p = new util.print(); p.simple( g.list.dump_csv(), { 'content_type' : 'text/plain' } ); setTimeout( function() { g.list.on_all_fleshed = null; }, 0); }; g.list.full_retrieve(); } catch(E) { alert(E); }"/>
+            <hbox id="list_actions"/>
+            <button id="show_in_opac" hidden="true" label="&staff.cat.copy_summary.show_in_opac.label;" accesskey="&staff.cat.copy_summary.show_in_opac.accesskey;"
+                oncommand="JSAN.use('cat.util'); cat.util.show_in_opac([{barcode:g.barcode,doc_id:g.doc_id}]);"/>
+            <checkbox id="alternate_view" label="&staff.cat.copy_summary.alternate_view.label;" accesskey="&staff.cat.copy_summary.alternate_view.accesskey;" 
+                oils_persist="checked" oils_persist_no_poke="true"
+                oncommand="toggle_deck()"/>
         </hbox>
     </groupbox>