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

Last change on this file since 32220 was 28898, checked in by ak19, 10 years ago
  1. The cgiargq query variable is now no longer escaped in the 3 simply or large forms that use it. fqv and other js escaped fields are unchanged, since the jssafe now ensures that backslashes are escaped for macro files, so these resolve correctly in query.dm. 2. securitytools.cpp and .h updated to additionally escape back slashes for macro files when javascript escaping. This is done by default, since jssafe variants of cgiargs are all that are used, and they're used in macro files. 3. Encoded versions of decodedcompressedoptions are now used in all macro files. They're always used in attributes, so the attrsafe version which is set in receptionist.cpp is used.
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 27.9 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=_cgiargsrnUrlsafe_">_textnextsearchresult_</a></li>)}
38
39_prevsearchresult_ {_If_("_cgiargsrp_" ne "0",<li id="prevresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrpUrlsafe_">_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_prevarrow_
108</td><td align=right valign=top>
109_nextarrow_
110</td></tr></table>
111</center>
112}
113
114_prevarrow_ {_If_(_httpprevarrow_,<a href="_httpprevarrow_">_iconprev_</a>)}
115_nextarrow_ {_If_(_httpnextarrow_,<a href="_httpnextarrow_">_iconnext_</a>)}
116
117_navarrows_ [v=1] {<p>
118_prevarrow_<br>
119_nextarrow_
120}
121
122#######################################################################
123# section for adding user comments: consists of form and its javascript
124#######################################################################
125
126# The div that loads the user comments that were already submitted
127# associated javascript function loadUserComments is in style.dm's _globalscripts_ macro
128_usercomments_ {
129_If_(_cgiargd_,
130<div id="usercomments"></div>
131)
132}
133
134# Display the add-user-comment form on actual document pages and not when browsing/searching
135# This means the form should only be displayed on pages where the _cgiargd_ (the docid) is set
136
137# If the user's logged in, show the comment form, else show the link to the login page
138_addusercomment_ {
139_If_(_cgiargd_,
140_If_(_cgiargun_,_usercommentform_,_loginlink_)
141)
142}
143
144_docurl_ {_gwcgi_?e=_compressedoptions_&amp;a=_cgiargaUrlsafe_&amp;c=_cgiargcUrlsafe_&amp;cl=_cgiargclUrlsafe_&amp;d=_cgiargdUrlsafe_}
145
146_loginlink_ {
147<div id="usercommentlink"><a href="_docurl_&amp;uan=1">_textaddusercomment_</a></div>
148}
149
150# For getting the submitbutton to make Ajax calls, see
151# http://stackoverflow.com/questions/4264091/input-type-submit-instead-of-input-type-button-with-ajax
152# http://stackoverflow.com/questions/8869341/ajax-form-submit-with-submit-button
153
154_usercommentform_ {
155<form name="AddUserCommentForm" id="usercommentform">
156<!--<p>_textcommentusername_ <input type="text" name="username"></p>-->
157<input type=hidden name="username" value="_cgiargunAttrsafe_">
158<p>
159_textaddusercomment_
160<textarea name="comment" rows="10" cols="70"></textarea>
161<input type=hidden name="d" value="_cgiargdAttrsafe_">
162</p>
163
164<input type="submit" value="_textaddcomment_" onclick="addUserComment(document.AddUserCommentForm.username.value, document.AddUserCommentForm.comment.value, document.AddUserCommentForm.d.value, document); return false;">
165<label id="usercommentfeedback"></label>
166
167<div id="usercommentlogoutlink"><a href="_docurl_&amp;un=">_textusercommentlogout_</a></div>
168</form>
169
170
171<script type="text/javascript">
172
173 // Unused. Replaced in favour of call to escape() in setMetaArray function that calls urlPostSync
174 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery
175 function safeHTML(str) \{
176 return str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"',"&quot;").replace("'","&#x27;").replace("/", "&#x2F;"); //"\\""
177 \}
178
179
180 function addUserComment(_username, _comment, _docid, doc) \{
181
182 // don't add empty strings for name/comment
183
184 // http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript
185 //var trimmed_username=_username.replace(/^\s+|\s+$/g, '');
186 var trimmed_comment = _comment.replace(/^\s+|\s+$/g, '');
187
188 if(!trimmed_comment) \{ // || !trimmed_username
189 doc.AddUserCommentForm.comment.value = "";
190 //doc.AddUserCommentForm.username.value = "";
191 doc.getElementById("usercommentfeedback").innerHTML = "_textisempty_";
192 return;
193 \}
194
195 // Need to the add user comment meta of username, timestamp and comment to the
196 // topmost section of the document. So only get the docId up to any period mark:
197 var period = _docid.indexOf(".");
198 if(period != -1) \{
199 _docid = _docid.substring(0, period);
200 \}
201
202
203 // Want to store username, timestamp and comment in import/metadata.xml, archives/doc.xml
204 // and index/col.gdb.
205
206 // For getting the current time, see
207 // http://stackoverflow.com/questions/3830244/get-current-date-time-in-seconds
208 var _timestamp = new Date().getTime(); // div by 1000 to get seconds. valueOf() may return string
209
210 //alert("username:" + _username
211 //+ "\\ncomment: " + _comment
212 //+ "\\ncollection: " + collection
213 //+ "\\ndocid: " + _docid
214 //+ "\\ntimestamp: " + _timestamp);
215
216
217 // Entity encode the values before storing (at least <, >, /. And single and double quote, ampersand)
218 // http://stackoverflow.com/questions/6020714/escape-html-using-jquery
219 // setMetadataArray escapes the entire JSON, is that better than escaping individually here?
220 //_docid = escape(_docid);
221 //_timestamp = escape(_timestamp);
222 //_username = escape(_username); //safeHTML(_username);
223 //_comment = escape(_comment); //safeHTML(_comment);
224
225 // Use this if making individual api calls to set username meta, then timestamp then comment meta
226 // GSAPI already knows the collection
227 //gsapi.setMetadata(_docid, "username", null, _username, "accumulate", "import|archives|index");
228 //gsapi.setMetadata(_docid, "usertimestamp", null, _timestamp, "accumulate", "import|archives|index");
229 //gsapi.setMetadata(_docid, "usercomment", null, _comment, "accumulate", "import|archives|index");
230
231
232 // Use the new JSON metatable format to set username, timestamp and comment meta for docid in one go
233
234 // For creating the JSON object that gets turned into a string, see
235 // http://msdn.microsoft.com/en-us/library/ie/cc836459%28v=vs.94%29.aspx
236 // http://jsfiddle.net/qmacro/W54hy/
237
238 var username_rec = \{
239 metaname: "username",
240 metavals: [_username]
241 \};
242
243 var timestamp_rec = \{
244 metaname: "usertimestamp",
245 metavals: [_timestamp]
246 \};
247
248 var comment_rec = \{
249 metaname: "usercomment",
250 metavals: [_comment]
251 \};
252
253 var doc_rec = \{
254 docid: _docid,
255 metatable: [username_rec, timestamp_rec, comment_rec],
256 metamode: "accumulate"
257 \};
258
259 var docArray = [doc_rec];
260
261 //alert(JSON.stringify(docArray));
262
263 // GSAPI already knows the collection
264 var result = gsapi.setMetadataArray(docArray, "accumulate", "import|archives|index");
265
266 // clear the comment field as it has now been submitted, but not the username field
267 // as the user is logged in, so they should be able to commit again under their username.
268 doc.AddUserCommentForm.comment.value = "";
269
270 // check for locked collection error
271 var errorIndex = result.indexOf("ERROR");
272 if(errorIndex != -1) \{
273 var endIndex = result.indexOf("\\n");
274 var error = result.substring(errorIndex,endIndex);
275 errormessage="Unable to add comment. " + error;
276 doc.getElementById("usercommentfeedback").innerHTML = errormessage;
277 //alert("Result: " + result);
278 \} else \{
279 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_";
280
281 // update display of existing user comments to show the newly added comment
282 var usercommentdiv = document.getElementById("usercomments");
283 if(usercommentdiv != undefined) \{
284 displayInUserCommentList(usercommentdiv, _username, _timestamp, _comment);
285 \}
286 \}
287 \}
288</script>
289}
290
291
292#######################################################################
293# the goto form
294#######################################################################
295
296_gotoform_ {
297<form name="GotoForm" method="get" action="_gwcgi_">
298<input type=hidden name="e" value="_decodedcompressedoptionsAttrsafe_">
299<input type=hidden name="d" value="_cgiargdAttrsafe_">
300<input type=hidden name="cl" value="_cgiargclAttrsafe_">
301<input type="text" name="gp" size="3" maxlength="4">
302<input type="submit" value="_textgoto_">
303</form>
304}
305
306_textnumpages_ {&nbsp;<i>(_1_ _pages_)</i>}
307_parentarrow_ {}
308_prevtitle_ {}
309_nexttitle_ {}
310
311#######################################################################
312# the phind applet
313#
314# The phind applet is only required on phind classifier pages.
315# Consequently, the _phindclassifier_ macro is not usually set. On screens
316# where it is required, _phindclassifier_ resolves to _phindapplet_, and
317# the following macro is loaded into the web page.
318#######################################################################
319
320_phindapplet_ {
321<APPLET CODEBASE="_httpjava_" CODE="org.nzdl.gsdl.Phind.Phind.class" ARCHIVE="Phind.jar" WIDTH=500 HEIGHT=400>
322 <PARAM NAME=library VALUE="_gwcgi_?e=_compressedoptions_">
323 <PARAM NAME=phindcgi VALUE="_gwcgi_?a=phind">
324 <PARAM NAME=collection VALUE="_cgiargcAttrsafe_">
325 <PARAM NAME=classifier VALUE="_phindnumber_">
326
327 <PARAM NAME=orientation VALUE="vertical">
328 <PARAM NAME=depth VALUE="2">
329 <PARAM NAME=resultorder VALUE="L,l,E,e,D,d">
330 <PARAM NAME=textorientation VALUE="_textorientation_">
331 <PARAM NAME=backdrop VALUE="_httpimg_/phindbg1.jpg">
332 <PARAM NAME=fontsize VALUE="10">
333 <PARAM NAME=blocksize VALUE="10">
334
335 The Phind java applet.
336</APPLET>
337}
338
339_collageapplet_ {
340 <applet CODEBASE="_httpjava_"
341 code="org.nzdl.gsdl.GsdlCollageApplet.GsdlCollageApplet.class"
342 archive="GsdlCollageApplet.jar"
343 width="_collagexdim_" height="_collageydim_">
344
345 <param name="gwcgi" value="_gwcgi_">
346 <param name="collection" value="_cgiargcAttrsafe_">
347 <param name="classifier" value="_cgiargclAttrsafe_.1">
348
349 <param name="hrefMustHave" value="cl=_cgiargclAttrsafe_.1">
350 <param name="imageMustNotHave" value="hl=\%x=\%gt=\%gc=\%.pr">
351
352 <param name="imageType" value="_collageimageType_">
353 <param name="verbosity" value="_collageverbosity_">
354 <param name="maxDepth" value="_collagemaxDepth_">
355 <param name="maxDisplay" value="_collagemaxDisplay_">
356 <param name="refreshDelay" value="_collagerefreshDelay_">
357 <param name="isJava2" value="_collageisJava2_">
358 <param name="bgcolor" value="_collagebgcolor_">
359 <param name="documentroot" value="_httpimg_">
360 </applet>
361
362<center>
363_collagecaption_
364</center>
365}
366
367
368_flashbook_ {
369 <div id="bookdiv">
370 </div>
371
372 <script type="text/javascript">
373 var myWidth = "100%";
374 myHeight = 800;
375
376 var img_cover = '_httpassocdir_/_thisOID_/cover.jpg';
377 var doc_url = document.URL;
378 doc_url = doc_url.replace(/(&|\\?)book=[a-z]+/gi,'');
379 doc_url += '&book=flashxml';
380
381 var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;//get windows or not
382 //Only for Windows computers because Greenstone webserver doesn't allow us to pass parameters to Flash.
383 //These methods is called by the Flash program to get all the necessary parameters for the book
384 //However, it will only work for IE 5.0 and later, Firefox 1.0 and later, Mozilla 1.7.5 and later
385 //Netscape 8.0 and later, Safari 1.3 and later
386 function getDocURL() \{ return doc_url; \}
387 function getImgCover() \{ return img_cover; \}
388 function getStageW() \{ return -1; \}
389 function getStageH() \{ return -1; \}
390
391
392 var flash_plug_html = "";
393 flash_plug_html += '<OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \\n';
394 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \\n';
395 flash_plug_html += ' height="';
396 flash_plug_html += myHeight + '" id="Book" swLiveConnect="true" align="middle"\\n';
397 flash_plug_html += ' width="';
398 flash_plug_html += myWidth + '">\\n';
399
400 flash_plug_html += ' <PARAM name="allowScriptAccess" value="always" />\\n';
401 flash_plug_html += ' <PARAM name="movie" value="_httpflash_/Book.swf';
402 if (isWin == false)
403 \{
404 flash_plug_html += '?src_image=' + escape(img_cover);
405 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
406 \}
407 flash_plug_html += '" />\\n';
408 flash_plug_html += ' <PARAM name="quality" value="high" />\\n';
409 flash_plug_html += ' <PARAM name="bgcolor" value="#FFFFFF" />\\n';
410 flash_plug_html += ' <EMBED align="middle" \\n';
411 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \\n';
412 flash_plug_html += ' bgcolor="#FFFFFF" height="';
413 flash_plug_html += myHeight + '" name="Book" \\n';
414 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \\n';
415 flash_plug_html += ' quality="high" \\n';
416 flash_plug_html += ' src=\\'_httpflash_/Book.swf';
417 if (isWin == false)
418 \{
419 flash_plug_html += '?src_image=' + escape(img_cover);
420 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
421 \}
422 flash_plug_html += '\\'\\n';
423 flash_plug_html += ' type="application/x-shockwave-flash" width="';
424 flash_plug_html += myWidth + '" />\\n';
425 flash_plug_html += '</OBJECT>\\n';
426
427 var flash_div = document.getElementById("bookdiv");
428 flash_div.innerHTML = flash_plug_html;
429 </script>
430}
431
432#######################################################################
433# icons
434#######################################################################
435
436_iconsmalltext_ {<img src="_httpiconsmtext_" class="icon" width=_widthsmtext_ height=_heightsmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
437_iconsmalltext_ [v=1] {<small><b>_texticonsmalltext2_</b></small>}
438
439_iconarrowsmalltext_ {<img src="_httpiconasmtext_" class="icon" width=_widthasmtext_ height=_heightasmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
440_iconarrowsmalltext_ [v=1] {<small><b>->_texticonsmalltext2_</b></small>}
441
442_iconclosedfolder_ {<img src="_httpiconclsdfldr_" class="icon" width=_widthclsdfldr_ height=_heightclsdfldr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
443_iconclosedfolder_ [v=1] {<small><b>_texticonclosedfolder2_</b></small>}
444
445_iconarrowclosedfolder_ {<img src=_httpiconaclsdfdr_" class="icon" width=_widthaclsdfdr_ height=_heightaclsdfdr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
446_iconarrowclosedfolder_ [v=1] {<small><b>->_texticonclosedfolder2_</b></small>}
447
448_iconopenfolder_ {<img src="_httpiconopenfldr_" class="icon" width=_widthopenfldr_ height=_heightopenfldr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
449_iconopenfolder_ [v=1] {<small><b>_texticonopenfolder2_</b></small>}
450
451_iconarrowopenfolder_ {<img src="_httpiconaopenfdr_" class="icon" width=_widthaopenfdr_ height=_heightaopenfdr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
452_iconarrowopenfolder_ [v=1] {<small><b>->_texticonopenfolder2_</b></small>}
453
454_iconarrowclosedbook_ {<img src="_httpiconabook_" width=_widthabook_ height=_heightabook_ class="icon" alt="_texticonclosedbook_" title="_texticonclosedbook_">}
455_iconarrowclosedbook_ [v=1] {<small><b>->_texticonclosedbook_: </b></small>}
456
457_iconopenbook_ {<img src="_httpiconopenbook_" width=_widthopenbook_ height=_heightopenbook_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
458_iconopenbook_ [v=1] {<small><b>_texticonopenbook_: </b></small>}
459
460_iconarrowopenbook_ {<img src="_httpiconaopenbk_" width=_widthaopenbk_ height=_heightaopenbk_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
461_iconarrowopenbook_ [v=1] {<small><b>->_texticonopenbook_: </b></small>}
462
463_iconopenbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
464_iconopenbookshelf_ [v=1] {<small><b>_texticonopenbookshelf_: </b></small>}
465
466_iconarrowopenbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
467_iconarrowopenbookshelf_ [v=1] {<small><b>->_texticonopenbookshelf_: </b></small>}
468
469_iconclosedbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
470_iconclosedbookshelf_ [v=1] {<small><b>_texticonclosedbookshelf_: </b></small>}
471
472_iconarrowclosedbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
473_iconarrowclosedbookshelf_ [v=1] {<small><b>->_texticonclosedbookshelf_: </b></small>}
474
475_iconpointer_ {<img src="_httpiconarrrght_" class="icon" width=_widtharrrght_ height=_heightarrrght_>}
476_iconpointer_ [v=1] {<small><b>_texticonpointer_-> </b></small>}
477
478_iconwarning_ {<img src="_httpiconwarning_" width="_widthwarning_" height="_heightwarning_" class="icon" align="left">}
479_iconwarning_ [v=1] {_texticonwarning_}
480
481
482#######################################################################
483# images
484#######################################################################
485
486_coverimage_ {<img alt="Cover Image" onError="src='_httpimg_/blank.gif'" src="_httpassocdir_/_thisOID_/cover.jpg">}
487
488_docbutton_ {<div class="button"><span class="button" title="_3_"><a href="_1_">_2_</a></span></div>
489}
490
491# can't use _docbutton_ macro for detach button as we need to include target
492_imagedetach_ {<div class="button"><span class="button"><a href="_httpcurrentdocument_&amp;x=1" target="\_blank" title="_texticondetach_">_textDETACH_</a></span></div>}
493
494_imageprint_{<div class="button"><span class="button"><a href="javascript:print_preview()">_textPRINT_</a></span></div>}
495
496
497_imagehighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=1&amp;gc=_cgiarggcUrlsafe_&amp;gt=_cgiarggtUrlsafe_,_textHIGHLIGHT_,_texticonhighlight_)}
498
499_imagenohighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=0&amp;gc=_cgiarggcUrlsafe_&amp;gt=_cgiarggtUrlsafe_,_document:textNOHIGHLIGHT_,_document:texticonnohighlight_)}
500
501_imagecontracttoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=0,_textCONTRACTCONTENTS_,_texticoncontracttoc_)}
502
503_imageexpandtoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=1,_textEXPANDCONTENTS_,_texticonexpandtoc_)}
504
505_imagecontracttext_ {_docbutton_(_httpcurrentdocument_&amp;gt=0,_textCONTRACT_,_texticoncontracttext_)}
506
507_imageexpandtext_ {_docbutton_(_httpcurrentdocument_&amp;gt=1,_textEXPANDTEXT_,_texticonexpandtext_)}
508
509_imagecont_ {_docbutton_(_httpcurrentdocument_&amp;gt=2,_textCONTINUE_,_texticoncont_)}
510
511
512#######################################################################
513# print preview script
514#######################################################################
515
516
517_pagescriptextra_{
518
519 var style_display_old;
520 var show = true;
521 var toc_top;
522
523 function has_toc(){
524 var div_nodes = document.getElementsByTagName("div");
525 for (var i=0;i < div_nodes.length ; i++ )\{
526 var div_node = div_nodes[i];
527 if (div_node.className =="toc" && div_node.childNodes.length > 1)
528 \{
529 return true;
530 \}
531 \}
532
533 return false;
534 \}
535
536 function hide_toc()\{
537 var div_nodes = document.getElementsByTagName("div");
538 for (var i=0;i < div_nodes.length ; i++ )\{
539 var div_node = div_nodes[i];
540 if (div_node.className =="toc")
541 \{
542 style_display_old = div_node.style.display;
543 toc_top = document.getElementById("toc_top");
544 if (toc_top)
545 div_node.parentNode.insertBefore(toc_top,div_node);
546 div_node.style.display = "none";
547 \};
548 \}
549
550 \}
551
552
553 function show_toc()\{
554
555 var div_nodes = document.getElementsByTagName("div");
556 for (var i=0;i < div_nodes.length ; i++ )\{
557 var div_node = div_nodes[i];
558 if (div_node.className =="toc")
559 \{
560 div_node.style.display = style_display_old;
561 if (toc_top)
562 div_node.insertBefore(toc_top,div_node.firstChild);
563 \};
564 \}
565
566 \}
567
568
569 function switch_toc()\{
570 var toc_link = document.getElementById("toc_link");
571 while (toc_link.hasChildNodes()) \{
572 toc_link.removeChild(toc_link.firstChild);
573 \}
574 if (show)\{
575 toc_link.appendChild(document.createTextNode('_textshowcontents_'));
576 show = false;
577 hide_toc();
578 \}
579 else\{
580 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
581 show = true;
582 show_toc();
583 \}
584
585 \}
586
587 function print_preview() \{
588 // Switch the stylesheet
589 setActiveStyleSheet("Preview Document");
590 add_print_message();
591 \}
592
593 function add_print_message()\{
594 if (document.getElementById)\{
595 var print_message = document.createElement('ul');
596 print_message.id = 'print-message';
597 print_message.className = "printmessage";
598
599 var cancel_print_link = document.createElement('li');
600 cancel_print_link.className = "cancelprint"
601 cancel_print_link.onclick = function()\{ cancel_print(); return false;\};
602 cancel_print_link.appendChild(document.createTextNode('_textreturnoriginal_'));
603 print_message.appendChild(cancel_print_link);
604
605
606 var print_link = document.createElement('li');
607 print_link.onclick = function()\{ window.print(); return false;\};
608 print_link.appendChild(document.createTextNode('_textprintpage_'));
609 print_message.appendChild(print_link);
610
611 if (has_toc())\{
612 var toc_link = document.createElement('li');
613 toc_link.id = "toc_link";
614 toc_link.onclick = function()\{ switch_toc(); return false;\};
615 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
616 print_message.appendChild(toc_link);
617 \}
618
619 //insert the print message node
620 var div_nodes = document.getElementsByTagName("div");
621 for (var i=0;i < div_nodes.length ; i++ )\{
622 var div_node = div_nodes[i];
623 if (div_node.className =="document")\{
624 var parent = div_node.parentNode;
625 parent.insertBefore(print_message,div_node);
626 \}
627 \}
628 \}
629
630 \}
631
632
633 function cancel_print() \{
634 // Destroy the preview message
635 var print_message = document.getElementById('print-message');
636 var parent = print_message.parentNode;
637 parent.removeChild(print_message);
638
639 show_toc();
640 // Switch back stylesheet
641 setActiveStyleSheet("default");
642 \}
643
644 function setActiveStyleSheet(title) \{
645 var i, a, main;
646 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) \{
647 if(a.getAttribute("rel").indexOf("style") != -1
648 && a.getAttribute("title")) \{
649 a.disabled = true;
650 if(a.getAttribute("title") == title) a.disabled = false;
651 \}
652 \}
653 \}
654
655}
656
657
658#######################################################################
659# headers/footers
660#######################################################################
661
662
663# header overridden for text pages
664_textheader_ {_cgihead_
665_htmlhead_
666_startspacer_
667
668<!-- document:textheader -->
669<div id="banner">
670<div class="pageinfo"><p class="bannerlinks">_globallinks_</p></div>
671<div class="collectimage">_imagecollection_</div>
672</div>
673<div class="bannerextra">_pagebannerextra_</div>
674}
675
676_textheader_ [v=1] {_cgihead_
677_htmlhead_
678_globallinks_
679}
680
681_footer_ {
682</div> <!-- document:footer -->
683
684_If_("_document:allowusercomments_" eq "1",
685<center>
686<table width=_pagewidth_ cellpadding=0 cellspacing=0 border=0>
687<tr><td align=left valign=top>
688<div class="commentssection">
689_usercomments_
690_addusercomment_
691</div>
692</td></tr></table>
693</center>)
694
695<div class="navarrowsbottom">
696_navarrowsbottom_
697</div>
698
699
700_endspacer__htmlfooter_
701}
702
703
704
705
706package Global
707
708# Social network support
709# Defined here in document, as the most likely place this will be used in
710# within a document view, however its package is 'Global' because you
711# might equally want this in a search or browse list
712
713# _1_ = e.g. title
714# _2_ = [srclink] or left empty. If left empty, then it will share the internal GS document
715
716_sharemescript_ {
717 <script type="text/javascript">
718 var a2a_config = a2a_config || \{ \};
719 a2a_config.linkname = "_1_";
720
721 _If_(_2_,
722 var srclink = \'_2_\';
723
724 //If metadata value is a valid URL that starts with xxx://
725 // (e.g. any protocol\, http, https\, ftp ...) then that will be the link to share
726 if (srclink.match(/^[^:]+:\\\/\\\//i)) \{
727 a2a_config.linkurl = srclink;
728 \}
729 else \{
730 //if metadata value is [srclink] then we have to cut off the 'href' tag label
731 var href = srclink.match(/href=\"([^\"]*)\"/);
732 a2a_config.linkurl = gsapi.fullDomainURL(href[1]);
733 \}
734 ,
735 //if no metadata was passed as link\, then the GS version of the document will be used.
736 // Use jssafe variants of the args in the following and then urlencode it from javascript
737 // http://stackoverflow.com/questions/332872/how-to-encode-a-url-in-javascript
738 // http://stackoverflow.com/questions/75980/best-practice-escape-or-encodeuri-encodeuricomponent
739 //a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=cgiargc&a=d&d=cgiargd";
740 a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=" + encodeURIComponent(_cgiargcJssafe_) + "&a=d&d=" + encodeURIComponent(_cgiargdJssafe_);
741)
742
743 </script>
744}
745
746_shareme_ {
747
748<div style=\'padding-left:50px;\' class=\'a2a_kit a2a_default_style\'>
749 _sharemescript_(_1_,_2_)
750 <center>
751 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
752 <span class=\"a2a_divider\"></span>
753 <a class=\'a2a_button_facebook\'></a>
754 <a class=\'a2a_button_twitter\'></a>
755 <a class=\'a2a_button_email\'></a>
756 <a class=\'a2a_button_linkedin\'></a>
757 </center>
758 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
759</div>
760
761}
762
763_sharemesmall_ {
764
765<span style=\'padding-left:8px;\' class=\'a2a_kit a2a_default_style\'>
766 _sharemescript_(_1_,_2_)
767 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
768 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
769</span>
770
771}
Note: See TracBrowser for help on using the repository browser.