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