source: main/trunk/greenstone2/macros/document.dm@ 27260

Last change on this file since 27260 was 27260, checked in by ak19, 11 years ago

Minor change to usercomment metaname timestamp. It has now been changed to usertimestamp, to sort with username and usercomment.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 24.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="_httpstyle_/preview-document.css"
24 type="text/css"
25 title="Preview Document" charset="UTF-8" media="screen" _linktagend_
26 <link rel="stylesheet" href="_httpstyle_/print-document.css" type="text/css"
27 charset="UTF-8" media="print" _linktagend_
28}
29
30#######################################################################
31# page content
32#######################################################################
33
34_tocopen_ {<div class="top" _tocopenextra_>}
35_tocclose_ {</div>}
36
37_nextsearchresult_ {_If_("_cgiargsrn_" ne "0",<li id="nextresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrn_">_textnextsearchresult_</a></li>)}
38
39_prevsearchresult_ {_If_("_cgiargsrp_" ne "0",<li id="prevresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrp_">_textprevsearchresult_</a></li>)}
40
41_content_ {
42_optnavigationbar_
43
44_If_(_phindclassifier__collageclassifier_,
45<p style="text-align: center;">
46_phindclassifier_
47_collageclassifier_
48</p>
49)
50
51_If_("_cgiargcl_" eq "search",
52<ul id="searchresults">
53_prevsearchresult_
54_nextsearchresult_
55</ul>)
56
57<div class="document">
58
59
60}
61
62# Dublin Core Metadata Element Set, Version 1.1
63_textTitlepage_ {_texticonhtitle_}
64_textCreatorpage_ {_texticonhcreat_}
65_textSubjectpage_ {_texticonhsubj_}
66_textDescriptionpage_ {_texticonhdesc_}
67_textPublisherpage_ {_texticonhpubl_}
68_textContributorpage_ {_texticonhcontr_}
69_textDatepage_ {_texticonhdate_}
70_textTypepage_ {_texticonhtype_}
71_textFormatpage_ {_texticonhform_}
72_textIdentifierpage_ {_texticonhident_}
73_textSourcepage_ {_texticonhsrc_}
74_textLanguagepage_ {_texticonhlang_}
75_textRelationpage_ {_texticonhrel_}
76_textCoveragepage_ {_texticonhcover_}
77_textRightspage_ {_texticonhright_}
78
79_textTopage_ {_texticonhto_}
80_textFrompage_ {_texticonhfrom_}
81_textSeriespage_ {_texticonhser_}
82_textHowtopage_ {_texticonhhow_}
83_textOrganizationpage_ {_texticonhorg_}
84_textBrowsepage_ {_texticonhbrwse_}
85_textCollagepage_ {_texticonhcoll_}
86_textPeoplepage_ {_texticonhpeople_}
87_textAcronympage_ {_texticonhacronym_}
88_textPhrasepage_ {_texticonhphrases_}
89_textArtistpage_ {_texticonhartist_}
90_textKeywordpage_ {_texticonhkw_}
91_textVolumepage_ {_texticonhvol_}
92_textCaptionspage_ {_texticonhcapt_}
93_textCountriespage_ {_texticonhcount_}
94
95#######################################################################
96# navigation arrows
97#
98#######################################################################
99
100# these two may be reset to "" by the server
101_navarrowsbottom_ {_navarrows_}
102_navarrowstop_ {_navarrows_}
103
104_navarrows_ {<center>
105<table width=_pagewidth_ cellpadding=0 cellspacing=0 border=0>
106<tr><td align=left valign=top>
107_usercomment_
108_prevarrow_
109</td><td align=right valign=top>
110_nextarrow_
111</td></tr></table>
112</center>
113}
114
115_prevarrow_ {_If_(_httpprevarrow_,<a href="_httpprevarrow_">_iconprev_</a>)}
116_nextarrow_ {_If_(_httpnextarrow_,<a href="_httpnextarrow_">_iconnext_</a>)}
117
118_navarrows_ [v=1] {<p>
119_prevarrow_<br>
120_nextarrow_
121}
122
123#######################################################################
124# section for adding user comments: consists of form and its javascript
125#######################################################################
126
127# Display the add-user-comment form on actual document pages and not when browsing/searching
128# This means the form should only be displayed on pages where the _cgiargd_ (the docid) is set
129
130# For getting the submitbutton to make Ajax calls, see
131# http://stackoverflow.com/questions/4264091/input-type-submit-instead-of-input-type-button-with-ajax
132# http://stackoverflow.com/questions/8869341/ajax-form-submit-with-submit-button
133
134_usercomment_ {
135
136_If_(_cgiargd_,
137
138<form name="AddUserCommentForm">
139<p>_textcommentusername_ <input type="text" name="username"></p>
140<p>
141_textaddusercomment_
142<textarea name="comment" rows="10" cols="70"></textarea>
143<input type=hidden name="d" value="_cgiargd_">
144</p>
145
146<input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value, document); return false;">
147<label id="usercommentfeedback"></label>
148</form>
149)
150
151<script type="text/javascript">
152
153 // http://stackoverflow.com/questions/3830244/get-current-date-time-in-seconds
154 function safeHTML(str) \{
155 return str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"',"&quot;").replace("'","&#x27;").replace("/", "&#x2F;"); //"\\""
156 \}
157
158 function addUserComment(_username, _comment, _docid, doc) \{
159 // Need to the add user comment meta of username, timestamp and comment to the
160 // topmost section of the document. So only get the docId up to any period mark:
161 var period = _docid.indexOf(".");
162 if(period != -1) \{
163 _docid = _docid.substring(0, period);
164 \}
165
166 // Entity encode the values before storing (at least <, >, /. And single and double quote, ampersand)
167 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery
168 _username = safeHTML(_username);
169 _comment = safeHTML(_comment);
170
171 // Want to store username, timestamp and comment in import/metadata.xml, archives/doc.xml
172 // and index/col.gdb.
173
174 // For getting the current time, see
175 // http://stackoverflow.com/questions/3830244/get-current-date-time-in-seconds
176 var _timestamp = new Date().getTime(); // div by 1000 to get seconds. valueOf() may return string
177
178 //alert("username:" + _username
179 //+ "\\ncomment: " + _comment
180 //+ "\\ncollection: " + collection
181 //+ "\\ndocid: " + _docid
182 //+ "\\ntimestamp: " + _timestamp);
183
184
185 // To make individual api calls to set username meta, then timestamp then comment meta:
186 // GSAPI already knows the collection
187 //gsapi.setMetadata(_docid, "username", null, _username, "accumulate", "import|archives|index");
188 //gsapi.setMetadata(_docid, "usertimestamp", null, _timestamp, "accumulate", "import|archives|index");
189 //gsapi.setMetadata(_docid, "usercomment", null, _comment, "accumulate", "import|archives|index");
190
191
192 // Use the new JSON metatable format to set username, timestamp and comment meta for docid in one go
193
194 // For creating the JSON object that gets turned into a string, see
195 // http://msdn.microsoft.com/en-us/library/ie/cc836459%28v=vs.94%29.aspx
196 // http://jsfiddle.net/qmacro/W54hy/
197
198 var username_rec = \{
199 metaname: "username",
200 metavals: [_username]
201 \};
202
203 var timestamp_rec = \{
204 metaname: "usertimestamp",
205 metavals: [_timestamp]
206 \};
207
208 var comment_rec = \{
209 metaname: "usercomment",
210 metavals: [_comment]
211 \};
212
213 var doc_rec = \{
214 docid: _docid,
215 metatable: [username_rec, timestamp_rec, comment_rec],
216 metamode: "accumulate"
217 \};
218
219 var docArray = [doc_rec];
220
221 //alert(JSON.stringify(docArray));
222
223 // GSAPI already knows the collection
224 gsapi.setMetadataArray(docArray, "accumulate","import|archives|index");
225 //doc.AddUserCommentForm.comment.value = "submitted";
226 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_"; //"submitted"; // <p id="feedback"></p>
227 \}
228</script>
229}
230
231
232#######################################################################
233# the goto form
234#######################################################################
235
236_gotoform_ {
237<form name="GotoForm" method="get" action="_gwcgi_">
238<input type=hidden name="e" value="_decodedcompressedoptions_">
239<input type=hidden name="d" value="_cgiargd_">
240<input type=hidden name="cl" value="_cgiargcl_">
241<input type="text" name="gp" size="3" maxlength="4">
242<input type="submit" value="_textgoto_">
243</form>
244}
245
246_textnumpages_ {&nbsp;<i>(_1_ _pages_)</i>}
247_parentarrow_ {}
248_prevtitle_ {}
249_nexttitle_ {}
250
251#######################################################################
252# the phind applet
253#
254# The phind applet is only required on phind classifier pages.
255# Consequently, the _phindclassifier_ macro is not usually set. On screens
256# where it is required, _phindclassifier_ resolves to _phindapplet_, and
257# the following macro is loaded into the web page.
258#######################################################################
259
260_phindapplet_ {
261<APPLET CODEBASE="_httpjava_" CODE="org.nzdl.gsdl.Phind.Phind.class" ARCHIVE="Phind.jar" WIDTH=500 HEIGHT=400>
262 <PARAM NAME=library VALUE="_gwcgi_?e=_compressedoptions_">
263 <PARAM NAME=phindcgi VALUE="_gwcgi_?a=phind">
264 <PARAM NAME=collection VALUE="_cgiargc_">
265 <PARAM NAME=classifier VALUE="_phindnumber_">
266
267 <PARAM NAME=orientation VALUE="vertical">
268 <PARAM NAME=depth VALUE="2">
269 <PARAM NAME=resultorder VALUE="L,l,E,e,D,d">
270 <PARAM NAME=textorientation VALUE="_textorientation_">
271 <PARAM NAME=backdrop VALUE="_httpimg_/phindbg1.jpg">
272 <PARAM NAME=fontsize VALUE="10">
273 <PARAM NAME=blocksize VALUE="10">
274
275 The Phind java applet.
276</APPLET>
277}
278
279_collageapplet_ {
280 <applet CODEBASE="_httpjava_"
281 code="org.nzdl.gsdl.GsdlCollageApplet.GsdlCollageApplet.class"
282 archive="GsdlCollageApplet.jar"
283 width="_collagexdim_" height="_collageydim_">
284
285 <param name="gwcgi" value="_gwcgi_">
286 <param name="collection" value="_cgiargc_">
287 <param name="classifier" value="_cgiargcl_.1">
288
289 <param name="hrefMustHave" value="cl=_cgiargcl_.1">
290 <param name="imageMustNotHave" value="hl=\%x=\%gt=\%gc=\%.pr">
291
292 <param name="imageType" value="_collageimageType_">
293 <param name="verbosity" value="_collageverbosity_">
294 <param name="maxDepth" value="_collagemaxDepth_">
295 <param name="maxDisplay" value="_collagemaxDisplay_">
296 <param name="refreshDelay" value="_collagerefreshDelay_">
297 <param name="isJava2" value="_collageisJava2_">
298 <param name="bgcolor" value="_collagebgcolor_">
299 <param name="documentroot" value="_httpimg_">
300 </applet>
301
302<center>
303_collagecaption_
304</center>
305}
306
307
308_flashbook_ {
309 <div id="bookdiv">
310 </div>
311
312 <script type="text/javascript">
313 var myWidth = "100%";
314 myHeight = 800;
315
316 var img_cover = '_httpassocdir_/_thisOID_/cover.jpg';
317 var doc_url = document.URL;
318 doc_url = doc_url.replace(/(&|\\?)book=[a-z]+/gi,'');
319 doc_url += '&book=flashxml';
320
321 var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;//get windows or not
322 //Only for Windows computers because Greenstone webserver doesn't allow us to pass parameters to Flash.
323 //These methods is called by the Flash program to get all the necessary parameters for the book
324 //However, it will only work for IE 5.0 and later, Firefox 1.0 and later, Mozilla 1.7.5 and later
325 //Netscape 8.0 and later, Safari 1.3 and later
326 function getDocURL() \{ return doc_url; \}
327 function getImgCover() \{ return img_cover; \}
328 function getStageW() \{ return -1; \}
329 function getStageH() \{ return -1; \}
330
331
332 var flash_plug_html = "";
333 flash_plug_html += '<OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \\n';
334 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \\n';
335 flash_plug_html += ' height="';
336 flash_plug_html += myHeight + '" id="Book" swLiveConnect="true" align="middle"\\n';
337 flash_plug_html += ' width="';
338 flash_plug_html += myWidth + '">\\n';
339
340 flash_plug_html += ' <PARAM name="allowScriptAccess" value="always" />\\n';
341 flash_plug_html += ' <PARAM name="movie" value="_httpflash_/Book.swf';
342 if (isWin == false)
343 \{
344 flash_plug_html += '?src_image=' + escape(img_cover);
345 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
346 \}
347 flash_plug_html += '" />\\n';
348 flash_plug_html += ' <PARAM name="quality" value="high" />\\n';
349 flash_plug_html += ' <PARAM name="bgcolor" value="#FFFFFF" />\\n';
350 flash_plug_html += ' <EMBED align="middle" \\n';
351 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \\n';
352 flash_plug_html += ' bgcolor="#FFFFFF" height="';
353 flash_plug_html += myHeight + '" name="Book" \\n';
354 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \\n';
355 flash_plug_html += ' quality="high" \\n';
356 flash_plug_html += ' src=\\'_httpflash_/Book.swf';
357 if (isWin == false)
358 \{
359 flash_plug_html += '?src_image=' + escape(img_cover);
360 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
361 \}
362 flash_plug_html += '\\'\\n';
363 flash_plug_html += ' type="application/x-shockwave-flash" width="';
364 flash_plug_html += myWidth + '" />\\n';
365 flash_plug_html += '</OBJECT>\\n';
366
367 var flash_div = document.getElementById("bookdiv");
368 flash_div.innerHTML = flash_plug_html;
369 </script>
370}
371
372#######################################################################
373# icons
374#######################################################################
375
376_iconsmalltext_ {<img src="_httpiconsmtext_" class="icon" width=_widthsmtext_ height=_heightsmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
377_iconsmalltext_ [v=1] {<small><b>_texticonsmalltext2_</b></small>}
378
379_iconarrowsmalltext_ {<img src="_httpiconasmtext_" class="icon" width=_widthasmtext_ height=_heightasmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
380_iconarrowsmalltext_ [v=1] {<small><b>->_texticonsmalltext2_</b></small>}
381
382_iconclosedfolder_ {<img src="_httpiconclsdfldr_" class="icon" width=_widthclsdfldr_ height=_heightclsdfldr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
383_iconclosedfolder_ [v=1] {<small><b>_texticonclosedfolder2_</b></small>}
384
385_iconarrowclosedfolder_ {<img src=_httpiconaclsdfdr_" class="icon" width=_widthaclsdfdr_ height=_heightaclsdfdr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
386_iconarrowclosedfolder_ [v=1] {<small><b>->_texticonclosedfolder2_</b></small>}
387
388_iconopenfolder_ {<img src="_httpiconopenfldr_" class="icon" width=_widthopenfldr_ height=_heightopenfldr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
389_iconopenfolder_ [v=1] {<small><b>_texticonopenfolder2_</b></small>}
390
391_iconarrowopenfolder_ {<img src="_httpiconaopenfdr_" class="icon" width=_widthaopenfdr_ height=_heightaopenfdr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
392_iconarrowopenfolder_ [v=1] {<small><b>->_texticonopenfolder2_</b></small>}
393
394_iconarrowclosedbook_ {<img src="_httpiconabook_" width=_widthabook_ height=_heightabook_ class="icon" alt="_texticonclosedbook_" title="_texticonclosedbook_">}
395_iconarrowclosedbook_ [v=1] {<small><b>->_texticonclosedbook_: </b></small>}
396
397_iconopenbook_ {<img src="_httpiconopenbook_" width=_widthopenbook_ height=_heightopenbook_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
398_iconopenbook_ [v=1] {<small><b>_texticonopenbook_: </b></small>}
399
400_iconarrowopenbook_ {<img src="_httpiconaopenbk_" width=_widthaopenbk_ height=_heightaopenbk_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
401_iconarrowopenbook_ [v=1] {<small><b>->_texticonopenbook_: </b></small>}
402
403_iconopenbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
404_iconopenbookshelf_ [v=1] {<small><b>_texticonopenbookshelf_: </b></small>}
405
406_iconarrowopenbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
407_iconarrowopenbookshelf_ [v=1] {<small><b>->_texticonopenbookshelf_: </b></small>}
408
409_iconclosedbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
410_iconclosedbookshelf_ [v=1] {<small><b>_texticonclosedbookshelf_: </b></small>}
411
412_iconarrowclosedbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
413_iconarrowclosedbookshelf_ [v=1] {<small><b>->_texticonclosedbookshelf_: </b></small>}
414
415_iconpointer_ {<img src="_httpiconarrrght_" class="icon" width=_widtharrrght_ height=_heightarrrght_>}
416_iconpointer_ [v=1] {<small><b>_texticonpointer_-> </b></small>}
417
418_iconwarning_ {<img src="_httpiconwarning_" width="_widthwarning_" height="_heightwarning_" class="icon" align="left">}
419_iconwarning_ [v=1] {_texticonwarning_}
420
421
422#######################################################################
423# images
424#######################################################################
425
426_coverimage_ {<img alt="Cover Image" onError="src='_httpimg_/blank.gif'" src="_httpassocdir_/_thisOID_/cover.jpg">}
427
428_docbutton_ {<div class="button"><span class="button" title="_3_"><a href="_1_">_2_</a></span></div>
429}
430
431# can't use _docbutton_ macro for detach button as we need to include target
432_imagedetach_ {<div class="button"><span class="button"><a href="_httpcurrentdocument_&amp;x=1" target="\_blank" title="_texticondetach_">_textDETACH_</a></span></div>}
433
434_imageprint_{<div class="button"><span class="button"><a href="javascript:print_preview()">_textPRINT_</a></span></div>}
435
436
437_imagehighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=1&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_textHIGHLIGHT_,_texticonhighlight_)}
438
439_imagenohighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=0&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_document:textNOHIGHLIGHT_,_document:texticonnohighlight_)}
440
441_imagecontracttoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=0,_textCONTRACTCONTENTS_,_texticoncontracttoc_)}
442
443_imageexpandtoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=1,_textEXPANDCONTENTS_,_texticonexpandtoc_)}
444
445_imagecontracttext_ {_docbutton_(_httpcurrentdocument_&amp;gt=0,_textCONTRACT_,_texticoncontracttext_)}
446
447_imageexpandtext_ {_docbutton_(_httpcurrentdocument_&amp;gt=1,_textEXPANDTEXT_,_texticonexpandtext_)}
448
449_imagecont_ {_docbutton_(_httpcurrentdocument_&amp;gt=2,_textCONTINUE_,_texticoncont_)}
450
451
452#######################################################################
453# print preview script
454#######################################################################
455
456
457_pagescriptextra_{
458
459 var style_display_old;
460 var show = true;
461 var toc_top;
462
463 function has_toc(){
464 var div_nodes = document.getElementsByTagName("div");
465 for (var i=0;i < div_nodes.length ; i++ )\{
466 var div_node = div_nodes[i];
467 if (div_node.className =="toc" && div_node.childNodes.length > 1)
468 \{
469 return true;
470 \}
471 \}
472
473 return false;
474 \}
475
476 function hide_toc()\{
477 var div_nodes = document.getElementsByTagName("div");
478 for (var i=0;i < div_nodes.length ; i++ )\{
479 var div_node = div_nodes[i];
480 if (div_node.className =="toc")
481 \{
482 style_display_old = div_node.style.display;
483 toc_top = document.getElementById("toc_top");
484 if (toc_top)
485 div_node.parentNode.insertBefore(toc_top,div_node);
486 div_node.style.display = "none";
487 \};
488 \}
489
490 \}
491
492
493 function show_toc()\{
494
495 var div_nodes = document.getElementsByTagName("div");
496 for (var i=0;i < div_nodes.length ; i++ )\{
497 var div_node = div_nodes[i];
498 if (div_node.className =="toc")
499 \{
500 div_node.style.display = style_display_old;
501 if (toc_top)
502 div_node.insertBefore(toc_top,div_node.firstChild);
503 \};
504 \}
505
506 \}
507
508
509 function switch_toc()\{
510 var toc_link = document.getElementById("toc_link");
511 while (toc_link.hasChildNodes()) \{
512 toc_link.removeChild(toc_link.firstChild);
513 \}
514 if (show)\{
515 toc_link.appendChild(document.createTextNode('_textshowcontents_'));
516 show = false;
517 hide_toc();
518 \}
519 else\{
520 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
521 show = true;
522 show_toc();
523 \}
524
525 \}
526
527 function print_preview() \{
528 // Switch the stylesheet
529 setActiveStyleSheet("Preview Document");
530 add_print_message();
531 \}
532
533 function add_print_message()\{
534 if (document.getElementById)\{
535 var print_message = document.createElement('ul');
536 print_message.id = 'print-message';
537 print_message.className = "printmessage";
538
539 var cancel_print_link = document.createElement('li');
540 cancel_print_link.className = "cancelprint"
541 cancel_print_link.onclick = function()\{ cancel_print(); return false;\};
542 cancel_print_link.appendChild(document.createTextNode('_textreturnoriginal_'));
543 print_message.appendChild(cancel_print_link);
544
545
546 var print_link = document.createElement('li');
547 print_link.onclick = function()\{ window.print(); return false;\};
548 print_link.appendChild(document.createTextNode('_textprintpage_'));
549 print_message.appendChild(print_link);
550
551 if (has_toc())\{
552 var toc_link = document.createElement('li');
553 toc_link.id = "toc_link";
554 toc_link.onclick = function()\{ switch_toc(); return false;\};
555 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
556 print_message.appendChild(toc_link);
557 \}
558
559 //insert the print message node
560 var div_nodes = document.getElementsByTagName("div");
561 for (var i=0;i < div_nodes.length ; i++ )\{
562 var div_node = div_nodes[i];
563 if (div_node.className =="document")\{
564 var parent = div_node.parentNode;
565 parent.insertBefore(print_message,div_node);
566 \}
567 \}
568 \}
569
570 \}
571
572
573 function cancel_print() \{
574 // Destroy the preview message
575 var print_message = document.getElementById('print-message');
576 var parent = print_message.parentNode;
577 parent.removeChild(print_message);
578
579 show_toc();
580 // Switch back stylesheet
581 setActiveStyleSheet("default");
582 \}
583
584 function setActiveStyleSheet(title) \{
585 var i, a, main;
586 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) \{
587 if(a.getAttribute("rel").indexOf("style") != -1
588 && a.getAttribute("title")) \{
589 a.disabled = true;
590 if(a.getAttribute("title") == title) a.disabled = false;
591 \}
592 \}
593 \}
594
595}
596
597
598#######################################################################
599# headers/footers
600#######################################################################
601
602
603# header overridden for text pages
604_textheader_ {_cgihead_
605_htmlhead_
606_startspacer_
607
608<!-- document:textheader -->
609<div id="banner">
610<div class="pageinfo"><p class="bannerlinks">_globallinks_</p></div>
611<div class="collectimage">_imagecollection_</div>
612</div>
613<div class="bannerextra">_pagebannerextra_</div>
614}
615
616_textheader_ [v=1] {_cgihead_
617_htmlhead_
618_globallinks_
619}
620
621_footer_ {
622</div> <!-- document:footer -->
623
624<div class="navarrowsbottom">
625_navarrowsbottom_
626</div>
627_endspacer__htmlfooter_
628}
629
630
631
632
633package Global
634
635# Social network support
636# Defined here in document, as the most likely place this will be used in
637# within a document view, however its package is 'Global' because you
638# might equally want this in a search or browse list
639
640# _1_ = e.g. title
641# _2_ = [srclink] or left empty. If left empty, then it will share the internal GS document
642
643_sharemescript_ {
644 <script type="text/javascript">
645 var a2a_config = a2a_config || \{ \};
646 a2a_config.linkname = "_1_";
647
648 _If_(_2_,
649 var srclink = \'_2_\';
650
651 //If metadata value is a valid URL that starts with xxx://
652 // (e.g. any protocol\, http, https\, ftp ...) then that will be the link to share
653 if (srclink.match(/^[^:]+:\\\/\\\//i)) \{
654 a2a_config.linkurl = srclink;
655 \}
656 else \{
657 //if metadata value is [srclink] then we have to cut off the 'href' tag label
658 var href = srclink.match(/href=\"([^\"]*)\"/);
659 a2a_config.linkurl = gsapi.fullDomainURL(href[1]);
660 \}
661 ,
662 //if no metadata was passed as link\, then the GS version of the document will be used.
663 a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=_cgiargc_&a=d&d=_cgiargd_";
664)
665
666 </script>
667}
668
669_shareme_ {
670
671<div style=\'padding-left:50px;\' class=\'a2a_kit a2a_default_style\'>
672 _sharemescript_(_1_,_2_)
673 <center>
674 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
675 <span class=\"a2a_divider\"></span>
676 <a class=\'a2a_button_facebook\'></a>
677 <a class=\'a2a_button_twitter\'></a>
678 <a class=\'a2a_button_email\'></a>
679 <a class=\'a2a_button_linkedin\'></a>
680 </center>
681 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
682</div>
683
684}
685
686_sharemesmall_ {
687
688<span style=\'padding-left:8px;\' class=\'a2a_kit a2a_default_style\'>
689 _sharemescript_(_1_,_2_)
690 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
691 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
692</span>
693
694}
Note: See TracBrowser for help on using the repository browser.