]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/bib_brief.xul
rethinking record bucket interface
[Evergreen.git] / Open-ILS / xul / staff_client / server / cat / bib_brief.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Brief Bib Display -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- STYLESHEETS -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
10
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!-- LOCALIZATION -->
13 <!DOCTYPE window PUBLIC "" ""[
14         <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
15 ]>
16
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <!-- OVERLAYS -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20
21 <window id="cat_bib_brief_win" 
22         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
23         xmlns:html="http://www.w3.org/1999/xhtml"
24         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
25
26         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
27         <!-- BEHAVIOR -->
28         <script type="text/javascript">
29                 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
30         </script>
31         <scripts id="openils_util_scripts"/>
32
33         <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
34         <script>
35         <![CDATA[
36
37                 var docid;
38
39                 function my_init() {
40                         try {
41                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
42                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
43                                 JSAN.errorLevel = "die"; // none, warn, or die
44                                 JSAN.addRepository('/xul/server/');
45                                 JSAN.use('util.error'); g.error = new util.error();
46                                 g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
47
48                                 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
49
50                                 docid = xul_param('docid');
51
52                                 var key = location.pathname + location.search + location.hash;
53                                 if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
54                                         var xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
55                                         if (typeof xulG == 'object') {
56                                                 docid = xulG.docid;
57                                         }
58                                 }
59
60                                 JSAN.use('util.network'); g.network = new util.network();
61                                 JSAN.use('util.date');
62
63                                 document.getElementById('caption').setAttribute('tooltiptext','Record ID = ' + docid);
64
65                                 if (docid > -1) {
66
67                                         data.last_record = docid; data.stash('last_record');
68
69                                         g.network.simple_request(
70                                                 'MODS_SLIM_RECORD_RETRIEVE.authoritative',
71                                                 [ docid ],
72                                                 function (req) {
73                                                         var mods = req.getResultObject();
74                                                         
75                                                         if (mods.title()) document.getElementById('title').appendChild(
76                                                                 document.createTextNode(String(mods.title()).substr(0,50))
77                                                         );
78                                                         if (mods.author()) document.getElementById('author').appendChild(
79                                                                 document.createTextNode(mods.author())
80                                                         );
81                                                         if (mods.edition()) document.getElementById('edition').appendChild(
82                                                                 document.createTextNode(mods.edition())
83                                                         );
84                                                         if (mods.pubdate()) document.getElementById('pubdate').appendChild(
85                                                                 document.createTextNode(mods.pubdate())
86                                                         );
87                                                         if (mods.tcn()) document.getElementById('tcn').appendChild(
88                                                                 document.createTextNode(mods.tcn())
89                                                         );
90         
91                                                         if (window.xulG && typeof window.xulG.set_tab_name == 'function') {
92                                                                 try {
93                                                                         window.xulG.set_tab_name(mods.tcn());
94                                                                 } catch(E) {
95                                                                         g.error.sdump('D_ERROR','bib_brief.xul, set_tab: ' + E);
96                                                                 }
97                                                         }
98         
99                                                         g.network.simple_request(
100                                                                 'FM_BRE_RETRIEVE_VIA_ID.authoritative',
101                                                                 [ ses(), [ docid ] ],
102                                                                 function (req) {
103                                                                         try {
104                                                                                 var meta = req.getResultObject();
105                                                                                 if (typeof meta.ilsevent != 'undefined') throw(meta);
106                                                                                 meta = meta[0];
107                                                                                 document.getElementById('tcn_source').appendChild(
108                                                                                         document.createTextNode(meta.tcn_source())
109                                                                                 );
110                                                                                 g.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),meta.creator().id()],
111                                                                                         function(rreq) {
112                                                                                                 var creator_au = rreq.getResultObject();
113                                                                                                 document.getElementById('creator_bc').appendChild(
114                                                                                                         document.createTextNode(creator_au.card().barcode())
115                                                                                                 );
116                                                                                         }
117                                                                                 );
118                                                                                 g.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),meta.editor().id()],
119                                                                                         function(rreq) {
120                                                                                                 var editor_au = rreq.getResultObject();
121                                                                                                 document.getElementById('editor_bc').appendChild(
122                                                                                                         document.createTextNode(editor_au.card().barcode())
123                                                                                                 );
124                                                                                         }
125                                                                                 );
126                                                                                 document.getElementById('creator').appendChild(
127                                                                                         document.createTextNode('('+data.hash.aou[meta.creator().home_ou()].shortname()+') ')
128                                                                                 );
129                                                                                 document.getElementById('creator_bc').setAttribute('au_id',meta.creator().id());
130                                                                                 document.getElementById('editor').appendChild(
131                                                                                         document.createTextNode('('+data.hash.aou[meta.editor().home_ou()].shortname()+') ')
132                                                                                 );
133                                                                                 document.getElementById('editor_bc').setAttribute('au_id',meta.editor().id());
134                                                                                 document.getElementById('edit_date').appendChild(
135                                                                                         document.createTextNode(
136                                                                                                 util.date.formatted_date(meta.edit_date(),"%D")
137                                                                                         )
138                                                                                 );
139                                                                                 var t = document.getElementById('caption').getAttribute('label');
140                                                                                 if (get_bool( meta.deleted() )) { 
141                                                                                         t += ' (Deleted) '; 
142                                                                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
143                                                                                 }
144                                                                                 if ( ! get_bool( meta.active() ) ) { 
145                                                                                         t += ' (Inactive) '; 
146                                                                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
147                                                                                 }
148                                                                                 document.getElementById('caption').setAttribute('label',t);
149                                                                         } catch(E) {
150                                                                                 g.error.standard_unexpected_error_alert('meta retrieve',E);
151                                                                         }
152                                                                 }
153                                                         );
154                                                 }
155                                         );
156
157                                 } else {
158                                         var t = document.getElementById('caption').getAttribute('label');
159                                         t += ' (Not Cataloged) '; 
160                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
161                                         document.getElementById('caption').setAttribute('label',t);
162                                 }
163
164                         } catch(E) {
165                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
166                                         "system administrator or software developer the following:\ncat/bib_brief.xul\n" + E + '\n';
167                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
168                                 alert(err_msg);
169                         }
170                 }
171
172                 function view_marc() {
173                         try {
174                                 JSAN.use('util.window'); var win = new util.window();
175                                 if (docid < 0) {
176                                         alert('Item not cataloged.');
177                                 } else {
178                                         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
179                                         //win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
180                                         win.open( urls.XUL_MARC_VIEW, 'marc_view', 'chrome,resizable,modal,width=400,height=400',{'noprint':1,'docid':docid});
181                                 }
182                         } catch(E) {
183                 g.error.standard_unexpected_error_alert('spawning marc display',E);
184                         }
185                 }
186
187                 function spawn_patron(span) {
188             try {
189                 var loc = urls.XUL_PATRON_DISPLAY; // + '?barcode=' + window.escape(barcode);
190
191                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab == 'function') {
192                     window.xulG.set_tab( loc, {}, { 'id' : span.getAttribute('au_id') } );
193                 } else {
194                                         copy_to_clipboard( span.textContent );
195                                 }
196             } catch(E) {
197                 g.error.standard_unexpected_error_alert('spawning patron display',E);
198             }
199                 }
200
201         ]]>
202         </script>
203
204         <groupbox id="groupbox" flex="1" style="overflow: auto; min-height: 100px;">
205                 <caption label="Record Summary" id="caption"/>
206                         <html:table width="90%">
207                                 <html:tr valign="top">
208                                         <html:td colspan="3">
209                                                 <html:span style="font-weight: bold;">Title: </html:span><html:span id="title" />
210                                         </html:td>
211                                         <html:td>
212                                                 (<html:a href="javascript:view_marc();" style="text-decoration: underline; color: blue;">View MARC</html:a>)
213                                         </html:td>
214                                 </html:tr>
215                                 <html:tr valign="top">
216                                         <html:td colspan="2">
217                                                 <html:span style="font-weight: bold;">Author: </html:span><html:span id="author" />
218                                         </html:td>
219                                         <html:td>
220                                                 <html:span style="font-weight: bold;">Edition: </html:span><html:span id="edition" />
221                                         </html:td>
222                                         <html:td>
223                                                 <html:span style="font-weight: bold;">Pub Date: </html:span><html:span id="pubdate" />
224                                         </html:td>
225                                 </html:tr>
226                                 <html:tr valign="top">
227                                         <html:td>
228                                                 <html:span style="font-weight: bold;">TCN: (</html:span><html:span id="tcn_source"/><html:span style="font-weight: bold;">) </html:span><html:span id="tcn" style="text-decoration: underline; color: blue;" onclick="copy_to_clipboard(event)"/>
229                                         </html:td>
230                                         <html:td>
231                                                 <html:span style="font-weight: bold;">Created By: </html:span><html:span id="creator" />
232                                                 <html:span id="creator_bc" style="text-decoration: underline; color: blue;" onclick="try{spawn_patron(this);}catch(E){alert(E);}"/>
233                                         </html:td>
234                                         <html:td>
235                                                 <html:span style="font-weight: bold;">Last Edited By: </html:span><html:span id="editor" />
236                                                 <html:span id="editor_bc" style="text-decoration: underline; color: blue;" onclick="try{spawn_patron(this);}catch(E){alert(E);}"/>
237                                         </html:td>
238                                         <html:td>
239                                                 <html:span style="font-weight: bold;">Last Edited On: </html:span><html:span id="edit_date" />
240                                         </html:td>
241                                 </html:tr>
242                         </html:table>
243         </groupbox>
244
245 </window>
246