]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/bib_brief.xul
c79da31c207e59396ac256f0f924a92e33db8bcf
[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(); } 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                                 g.cgi = new CGI();
49                                 docid = g.cgi.param('docid');
50
51                                 JSAN.use('util.network'); g.network = new util.network();
52                                 JSAN.use('util.date');
53
54                                 document.getElementById('caption').setAttribute('tooltiptext','Record ID = ' + docid);
55
56                                 if (docid > -1) {
57
58                                         JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
59                                         data.last_record = docid; data.stash('last_record');
60
61                                         g.network.request(
62                                                 api.MODS_SLIM_RECORD_RETRIEVE.app,
63                                                 api.MODS_SLIM_RECORD_RETRIEVE.method,
64                                                 [ docid ],
65                                                 function (req) {
66                                                         var mods = req.getResultObject();
67                                                         
68                                                         if (mods.title()) document.getElementById('title').appendChild(
69                                                                 document.createTextNode(mods.title().substr(0,50))
70                                                         );
71                                                         if (mods.author()) document.getElementById('author').appendChild(
72                                                                 document.createTextNode(mods.author())
73                                                         );
74                                                         if (mods.edition()) document.getElementById('edition').appendChild(
75                                                                 document.createTextNode(mods.edition())
76                                                         );
77                                                         if (mods.pubdate()) document.getElementById('pubdate').appendChild(
78                                                                 document.createTextNode(mods.pubdate())
79                                                         );
80                                                         if (mods.tcn()) document.getElementById('tcn').appendChild(
81                                                                 document.createTextNode(mods.tcn())
82                                                         );
83         
84                                                         if (window.xulG && typeof window.xulG.set_tab_name == 'function') {
85                                                                 try {
86                                                                         window.xulG.set_tab_name(mods.tcn());
87                                                                 } catch(E) {
88                                                                         g.error.sdump('D_ERROR','bib_brief.xul, set_tab: ' + E);
89                                                                 }
90                                                         }
91         
92                                                         g.network.request(
93                                                                 api.FM_BRE_RETRIEVE_VIA_ID.app,
94                                                                 api.FM_BRE_RETRIEVE_VIA_ID.method,
95                                                                 [ ses(), [ docid ] ],
96                                                                 function (req) {
97                                                                         try {
98                                                                                 var meta = req.getResultObject();
99                                                                                 if (typeof meta.ilsevent != 'undefined') throw(meta);
100                                                                                 meta = meta[0];
101                                                                                 document.getElementById('creator').appendChild(
102                                                                                         document.createTextNode(meta.creator().usrname())
103                                                                                 );
104                                                                                 document.getElementById('editor').appendChild(
105                                                                                         document.createTextNode(meta.editor().usrname())
106                                                                                 );
107                                                                                 document.getElementById('edit_date').appendChild(
108                                                                                         document.createTextNode(
109                                                                                                 util.date.formatted_date(meta.edit_date(),"%D")
110                                                                                         )
111                                                                                 );
112                                                                                 var t = document.getElementById('caption').getAttribute('label');
113                                                                                 if (get_bool( meta.deleted() )) { 
114                                                                                         t += ' (Deleted) '; 
115                                                                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
116                                                                                 }
117                                                                                 if ( ! get_bool( meta.active() ) ) { 
118                                                                                         t += ' (Inactive) '; 
119                                                                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
120                                                                                 }
121                                                                                 document.getElementById('caption').setAttribute('label',t);
122                                                                         } catch(E) {
123                                                                                 g.error.standard_unexpected_error_alert('meta retrieve',E);
124                                                                         }
125                                                                 }
126                                                         );
127                                                 }
128                                         );
129
130                                 } else {
131                                         var t = document.getElementById('caption').getAttribute('label');
132                                         t += ' (Not Cataloged) '; 
133                                         document.getElementById('caption').setAttribute('style','background: red; color: white;');
134                                         document.getElementById('caption').setAttribute('label',t);
135                                 }
136
137                         } catch(E) {
138                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
139                                         "system administrator or software developer the following:\ncat/bib_brief.xul\n" + E + '\n';
140                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
141                                 alert(err_msg);
142                         }
143                 }
144
145                 function view_marc() {
146                         JSAN.use('util.window'); var win = new util.window();
147                         if (docid < 0) {
148                                 alert('Item not cataloged.');
149                         } else {
150                                 win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
151                         }
152                 }
153
154         ]]>
155         </script>
156
157         <groupbox id="groupbox" flex="1" style="overflow: auto; min-height: 100px;">
158                 <caption label="Record Summary" id="caption"/>
159                         <html:table width="90%">
160                                 <html:tr valign="top">
161                                         <html:td colspan="3">
162                                                 <html:span style="font-weight: bold;">Title: </html:span><html:span id="title" />
163                                         </html:td>
164                                         <html:td>
165                                                 (<html:a href="javascript:view_marc();" style="text-decoration: underline; color: blue;">View MARC</html:a>)
166                                         </html:td>
167                                 </html:tr>
168                                 <html:tr valign="top">
169                                         <html:td colspan="2">
170                                                 <html:span style="font-weight: bold;">Author: </html:span><html:span id="author" />
171                                         </html:td>
172                                         <html:td>
173                                                 <html:span style="font-weight: bold;">Edition: </html:span><html:span id="edition" />
174                                         </html:td>
175                                         <html:td>
176                                                 <html:span style="font-weight: bold;">Pub Date: </html:span><html:span id="pubdate" />
177                                         </html:td>
178                                 </html:tr>
179                                 <html:tr valign="top">
180                                         <html:td>
181                                                 <html:span style="font-weight: bold;">TCN: </html:span><html:span id="tcn" style="text-decoration: underline; color: blue;" onclick="copy_to_clipboard(event)"/>
182                                         </html:td>
183                                         <html:td>
184                                                 <html:span style="font-weight: bold;">Created By: </html:span><html:span id="creator" />
185                                         </html:td>
186                                         <html:td>
187                                                 <html:span style="font-weight: bold;">Last Edited By: </html:span><html:span id="editor" />
188                                         </html:td>
189                                         <html:td>
190                                                 <html:span style="font-weight: bold;">Last Edited On: </html:span><html:span id="edit_date" />
191                                         </html:td>
192                                 </html:tr>
193                         </html:table>
194         </groupbox>
195
196 </window>
197