source: trunk/gsdl/macros/document.dm@ 13427

Last change on this file since 13427 was 13427, checked in by shaoqun, 17 years ago

added javascript and new macros for printing a document page

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 15.7 KB
Line 
1# this file must be UTF-8 encoded
2
3package document
4
5#######################################################################
6# macros set from within the server
7#######################################################################
8
9_imagethispage_ {}
10_httpprevarrow_ {}
11_httpnextarrow_ {}
12_pagetitle_ {}
13_phindclassifier_ {}
14_collageclassifier_ {}
15
16# custom header for individual document
17_documentheader_ {}
18
19#custom css links for individual document
20_csslink_{
21 <link rel="stylesheet" href="_cssfilelink_" type="text/css"
22 charset="UTF-8" _linktagend_
23 <link rel="alternate stylesheet" href="_httpimg_/preview-document.css" type="text/css"
24 title="Preview Document" charset="UTF-8" media="screen" _linktagend_
25 <link rel="stylesheet" href="_httpimg_/print-document.css" type="text/css"
26 charset="UTF-8" media="print" _linktagend_
27}
28
29#######################################################################
30# page content
31#######################################################################
32
33_nextsearchresult_ {_If_("_cgiargsrn_" ne "0" ,<div class="nextresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrn_">_textnextsearchresult_</a></div>,)}
34
35_prevsearchresult_ {_If_("_cgiargsrp_" ne "0" ,<div class="prevresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrp_">_textprevsearchresult_</a></div>,) }
36
37_content_ {
38_optnavigationbar_
39
40_If_(_phindclassifier__collageclassifier_,
41<p style="text-align: center;">
42_phindclassifier_
43_collageclassifier_
44</p>
45)
46
47<div class="searchresults">
48_prevsearchresult_
49_nextsearchresult_
50</div>
51
52<div class="document">
53
54
55}
56
57# Dublin Core Metadata Element Set, Version 1.1
58_textTitlepage_ {_texticonhtitle_}
59_textCreatorpage_ {_texticonhcreat_}
60_textSubjectpage_ {_texticonhsubj_}
61_textDescriptionpage_ {_texticonhdesc_}
62_textPublisherpage_ {_texticonhpubl_}
63_textContributorpage_ {_texticonhcontr_}
64_textDatepage_ {_texticonhdate_}
65_textTypepage_ {_texticonhtype_}
66_textFormatpage_ {_texticonhform_}
67_textIdentifierpage_ {_texticonhident_}
68_textSourcepage_ {_texticonhsrc_}
69_textLanguagepage_ {_texticonhlang_}
70_textRelationpage_ {_texticonhrel_}
71_textCoveragepage_ {_texticonhcover_}
72_textRightspage_ {_texticonhright_}
73
74_textTopage_ {_texticonhto_}
75_textFrompage_ {_texticonhfrom_}
76_textSeriespage_ {_texticonhser_}
77_textHowtopage_ {_texticonhhow_}
78_textOrganizationpage_ {_texticonhorg_}
79_textBrowsepage_ {_texticonhbrwse_}
80_textCollagepage_ {_texticonhcoll_}
81_textPeoplepage_ {_texticonhpeople_}
82_textAcronympage_ {_texticonhacronym_}
83_textPhrasepage_ {_texticonhphrases_}
84_textArtistpage_ {_texticonhartist_}
85_textKeywordpage_ {_texticonhkw_}
86_textVolumepage_ {_texticonhvol_}
87_textCaptionspage_ {_texticonhcapt_}
88_textCountriespage_ {_texticonhcount_}
89
90#######################################################################
91# navigation arrows
92#
93#######################################################################
94
95# these two may be reset to "" by the server
96_navarrowsbottom_ {_navarrows_}
97_navarrowstop_ {_navarrows_}
98
99_navarrows_ {<center>
100<table width=_pagewidth_ cellpadding=0 cellspacing=0 border=0>
101<tr><td align=left valign=top>
102_prevarrow_
103</td><td align=right valign=top>
104_nextarrow_
105</td></tr></table>
106</center>
107}
108
109_prevarrow_ {_If_(_httpprevarrow_,<a href="_httpprevarrow_">_iconprev_</a>)}
110_nextarrow_ {_If_(_httpnextarrow_,<a href="_httpnextarrow_">_iconnext_</a>)}
111
112_navarrows_ [v=1] {<p>
113_prevarrow_<br>
114_nextarrow_
115}
116
117#######################################################################
118# the goto form
119#######################################################################
120
121_gotoform_ {
122<form name="GotoForm" method="get" action="_gwcgi_">
123<input type=hidden name="e" value="_decodedcompressedoptions_">
124<input type=hidden name="d" value="_cgiargd_">
125<input type=hidden name="cl" value="_cgiargcl_">
126<input type="text" name="gp" size="3" maxlength="4">
127<input type="submit" value="_textgoto_">
128</form>
129}
130
131_textnumpages_ {&nbsp;<i>(_1_ _pages_)</i>}
132_parentarrow_ {}
133
134
135#######################################################################
136# the phind applet
137#
138# The phind applet is only required on phind classifier pages.
139# Consequently, the _phindclassifier_ macro is not usually set. On screens
140# where it is required, _phindclassifier_ resolves to _phindapplet_, and
141# the following macro is loaded into the web page.
142#######################################################################
143
144_phindapplet_ {
145<APPLET CODEBASE="_httpprefix_/bin/java" CODE="org.nzdl.gsdl.Phind.Phind.class" ARCHIVE="Phind.jar" WIDTH=500 HEIGHT=400>
146 <PARAM NAME=library VALUE="_gwcgi_?e=_compressedoptions_">
147 <PARAM NAME=phindcgi VALUE="_gwcgi_?a=phind">
148 <PARAM NAME=collection VALUE="_cgiargc_">
149 <PARAM NAME=classifier VALUE="_phindnumber_">
150
151 <PARAM NAME=orientation VALUE="vertical">
152 <PARAM NAME=depth VALUE="2">
153 <PARAM NAME=resultorder VALUE="L,l,E,e,D,d">
154
155 <PARAM NAME=backdrop VALUE="_httpimg_/phindbg1.jpg">
156 <PARAM NAME=fontsize VALUE="10">
157 <PARAM NAME=blocksize VALUE="10">
158
159 The Phind java applet.
160</APPLET>
161}
162
163_collageapplet_ {
164 <applet CODEBASE="_httpprefix_/bin/java"
165 code="org.nzdl.gsdl.GsdlCollageApplet.GsdlCollageApplet.class"
166 archive="GsdlCollageApplet.jar"
167 width="_collagexdim_" height="_collageydim_">
168
169 <param name="gwcgi" value="_gwcgi_">
170 <param name="collection" value="_cgiargc_">
171 <param name="classifier" value="_cgiargcl_.1">
172
173 <param name="hrefMustHave" value="cl=_cgiargcl_.1">
174 <param name="imageMustNotHave" value="hl=\%x=\%gt=\%gc=\%.pr">
175
176 <param name="imageType" value="_collageimageType_">
177 <param name="verbosity" value="_collageverbosity_">
178 <param name="maxDepth" value="_collagemaxDepth_">
179 <param name="maxDisplay" value="_collagemaxDisplay_">
180 <param name="refreshDelay" value="_collagerefreshDelay_">
181 <param name="isJava2" value="_collageisJava2_">
182 <param name="bgcolor" value="_collagebgcolor_">
183 <param name="documentroot" value="_httpimg_">
184 </applet>
185
186<center>
187_collagecaption_
188</center>
189
190}
191
192
193#######################################################################
194# icons
195#######################################################################
196
197_iconsmalltext_ {<img src="_httpiconsmtext_" class="icon" width=_widthsmtext_ height=_heightsmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
198_iconsmalltext_ [v=1] {<small><b>_texticonsmalltext2_</b></small>}
199
200_iconarrowsmalltext_ {<img src="_httpiconasmtext_" class="icon" width=_widthasmtext_ height=_heightasmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
201_iconarrowsmalltext_ [v=1] {<small><b>->_texticonsmalltext2_</b></small>}
202
203_iconclosedfolder_ {<img src="_httpiconclsdfldr_" class="icon" width=_widthclsdfldr_ height=_heightclsdfldr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
204_iconclosedfolder_ [v=1] {<small><b>_texticonclosedfolder2_</b></small>}
205
206_iconarrowclosedfolder_ {<img src=_httpiconaclsdfdr_" class="icon" width=_widthaclsdfdr_ height=_heightaclsdfdr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
207_iconarrowclosedfolder_ [v=1] {<small><b>->_texticonclosedfolder2_</b></small>}
208
209_iconopenfolder_ {<img src="_httpiconopenfldr_" class="icon" width=_widthopenfldr_ height=_heightopenfldr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
210_iconopenfolder_ [v=1] {<small><b>_texticonopenfolder2_</b></small>}
211
212_iconarrowopenfolder_ {<img src="_httpiconaopenfdr_" class="icon" width=_widthaopenfdr_ height=_heightaopenfdr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
213_iconarrowopenfolder_ [v=1] {<small><b>->_texticonopenfolder2_</b></small>}
214
215_iconarrowclosedbook_ {<img src="_httpiconabook_" width=_widthabook_ height=_heightabook_ class="icon" alt="_texticonclosedbook_" title="_texticonclosedbook_">}
216_iconarrowclosedbook_ [v=1] {<small><b>->_texticonclosedbook_: </b></small>}
217
218_iconopenbook_ {<img src="_httpiconopenbook_" width=_widthopenbook_ height=_heightopenbook_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
219_iconopenbook_ [v=1] {<small><b>_texticonopenbook_: </b></small>}
220
221_iconarrowopenbook_ {<img src="_httpiconaopenbk_" width=_widthaopenbk_ height=_heightaopenbk_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
222_iconarrowopenbook_ [v=1] {<small><b>->_texticonopenbook_: </b></small>}
223
224_iconopenbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
225_iconopenbookshelf_ [v=1] {<small><b>_texticonopenbookshelf_: </b></small>}
226
227_iconarrowopenbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
228_iconarrowopenbookshelf_ [v=1] {<small><b>->_texticonopenbookshelf_: </b></small>}
229
230_iconclosedbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
231_iconclosedbookshelf_ [v=1] {<small><b>_texticonclosedbookshelf_: </b></small>}
232
233_iconarrowclosedbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
234_iconarrowclosedbookshelf_ [v=1] {<small><b>->_texticonclosedbookshelf_: </b></small>}
235
236_iconpointer_ {<img src="_httpiconarrrght_" class="icon" width=_widtharrrght_ height=_heightarrrght_>}
237_iconpointer_ [v=1] {<small><b>_texticonpointer_-> </b></small>}
238
239_iconwarning_ {<img src="_httpiconwarning_" width="_widthwarning_" height="_heightwarning_" class="icon" align="left">}
240_iconwarning_ [v=1] {_texticonwarning_}
241
242
243#######################################################################
244# images
245#######################################################################
246
247_docbutton_ {<div class="button"><span class="button" title="_3_"><a href="_1_">_2_</a></span></div>
248}
249
250# can't use _docbutton_ macro for detach button as we need to include target
251_imagedetach_ {<div class="button"><span class="button"><a href="_httpcurrentdocument_&amp;x=1" target="\_blank" title="_texticondetach_">_textDETACH_</a></span></div>}
252
253_imageprint_{<div class="button"><span class="button"><a href="javascript:print_preview()">_textPRINT_</a></span></div>}
254
255
256_imagehighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=1&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_textHIGHLIGHT_,_texticonhighlight_)}
257
258_imagenohighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=0&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_document:textNOHIGHLIGHT_,_document:texticonnohighlight_)}
259
260_imagecontracttoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=0,_textCONTRACTCONTENTS_,_texticoncontracttoc_)}
261
262_imageexpandtoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=1,_textEXPANDCONTENTS_,_texticonexpandtoc_)}
263
264_imagecontracttext_ {_docbutton_(_httpcurrentdocument_&amp;gt=0,_textCONTRACT_,_texticoncontracttext_)}
265
266_imageexpandtext_ {_docbutton_(_httpcurrentdocument_&amp;gt=1,_textEXPANDTEXT_,_texticonexpandtext_)}
267
268_imagecont_ {_docbutton_(_httpcurrentdocument_&amp;gt=2,_textCONTINUE_,_texticoncont_)}
269
270
271#######################################################################
272# print preview script
273#######################################################################
274
275
276_pagescriptextra_{
277
278 var style_display_old;
279 var show = true;
280
281 function has_toc(){
282 var div_nodes = document.getElementsByTagName("div");
283 for (var i=0;i < div_nodes.length ; i++ )\{
284 var div_node = div_nodes[i];
285 if (div_node.className =="toc" && div_node.childNodes.length > 1)
286 \{
287 return true;
288 \}
289 \}
290
291 return false;
292 \}
293
294 function hide_toc()\{
295 var div_nodes = document.getElementsByTagName("div");
296 for (var i=0;i < div_nodes.length ; i++ )\{
297 var div_node = div_nodes[i];
298 if (div_node.className =="toc")
299 \{
300 style_display_old = div_node.style.display;
301 div_node.style.display = "none";
302 \};
303 \}
304
305 \}
306
307
308 function show_toc()\{
309
310 var div_nodes = document.getElementsByTagName("div");
311 for (var i=0;i < div_nodes.length ; i++ )\{
312 var div_node = div_nodes[i];
313 if (div_node.className =="toc")
314 \{
315 div_node.style.display = style_display_old;
316
317 \};
318 \}
319
320 \}
321
322
323 function switch_toc()\{
324 var toc_link = document.getElementById("toc_link");
325 while (toc_link.hasChildNodes()) \{
326 toc_link.removeChild(toc_link.firstChild);
327 \}
328 if (show)\{
329 toc_link.appendChild(document.createTextNode('Show the table of content'));
330 show = false;
331 hide_toc();
332 \}
333 else\{
334 toc_link.appendChild(document.createTextNode('Hide the table of content'));
335 show = true;
336 show_toc();
337 \}
338
339 \}
340
341 function print_preview() \{
342 // Switch the stylesheet
343 setActiveStyleSheet("Preview Document");
344 add_print_message();
345 \}
346
347 function add_print_message()\{
348 if (document.getElementById)\{
349 var print_message = document.createElement('ul');
350 print_message.id = 'print-message';
351 print_message.className = "printmessage";
352
353 var cancel_print_link = document.createElement('li');
354 cancel_print_link.className = "cancelprint"
355 cancel_print_link.onclick = function()\{ cancel_print(); return false;\};
356 cancel_print_link.appendChild(document.createTextNode('Return to the original page'));
357 print_message.appendChild(cancel_print_link);
358
359
360 var print_link = document.createElement('li');
361 print_link.onclick = function()\{ window.print(); return false;\};
362 print_link.appendChild(document.createTextNode('Print this page'));
363 print_message.appendChild(print_link);
364
365 if (has_toc())\{
366 var toc_link = document.createElement('li');
367 toc_link.id = "toc_link";
368 toc_link.onclick = function()\{ switch_toc(); return false;\};
369 toc_link.appendChild(document.createTextNode('Hide the table of content'));
370 print_message.appendChild(toc_link);
371 \}
372
373 //insert the print message node
374 var div_nodes = document.getElementsByTagName("div");
375 for (var i=0;i < div_nodes.length ; i++ )\{
376 var div_node = div_nodes[i];
377 if (div_node.className =="document")\{
378 var parent = div_node.parentNode;
379 parent.insertBefore(print_message,div_node);
380 \}
381 \}
382 \}
383
384 \}
385
386
387 function cancel_print() \{
388 // Destroy the preview message
389 var print_message = document.getElementById('print-message');
390 var parent = print_message.parentNode;
391 parent.removeChild(print_message);
392
393 show_toc();
394 // Switch back stylesheet
395 setActiveStyleSheet("default");
396 \}
397
398 function setActiveStyleSheet(title) \{
399 var i, a, main;
400 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) \{
401 if(a.getAttribute("rel").indexOf("style") != -1
402 && a.getAttribute("title")) \{
403 a.disabled = true;
404 if(a.getAttribute("title") == title) a.disabled = false;
405 \}
406 \ }
407 \}
408
409}
410
411
412#######################################################################
413# headers/footers
414#######################################################################
415
416
417# header overridden for text pages
418_textheader_ {_cgihead_
419_htmlhead_
420_startspacer_
421
422<!-- document:textheader -->
423<div id="banner">
424<div class="pageinfo"><p class="bannerlinks">_globallinks_</p></div>
425<div class="collectimage">_imagecollection_</div>
426</div>
427<div class="bannerextra">_pagebannerextra_</div>
428}
429
430_textheader_ [v=1] {_cgihead_
431_htmlhead_
432_globallinks_
433}
434
435_footer_ {
436</div> <!-- document:footer -->
437
438<div class="navarrowsbottom">
439_navarrowsbottom_
440</div>
441_endspacer__htmlfooter_
442}
Note: See TracBrowser for help on using the repository browser.