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

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

If you add in the line 'format AllowUserComments true' into a collection's collect.cfg, you can now control whether the User Comments section appears on a document page or not. The runtime-src/src/recpt/documentaction.cpp defines an internal macro for the document package called allowusercomments and this is then checked for in macros/document.dm.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 26.9 KB
RevLine 
[7343]1# this file must be UTF-8 encoded
2
[258]3package document
4
5#######################################################################
6# macros set from within the server
7#######################################################################
8
9_imagethispage_ {}
10_httpprevarrow_ {}
11_httpnextarrow_ {}
[283]12_pagetitle_ {}
[1804]13_phindclassifier_ {}
[6813]14_collageclassifier_ {}
[13427]15
[12944]16# custom header for individual document
17_documentheader_ {}
[13370]18
[13427]19#custom css links for individual document
20_csslink_{
21 <link rel="stylesheet" href="_cssfilelink_" type="text/css"
22 charset="UTF-8" _linktagend_
[19129]23 <link rel="alternate stylesheet" href="_httpstyle_/preview-document.css"
[13450]24 type="text/css"
[13427]25 title="Preview Document" charset="UTF-8" media="screen" _linktagend_
[19129]26 <link rel="stylesheet" href="_httpstyle_/print-document.css" type="text/css"
[13427]27 charset="UTF-8" media="print" _linktagend_
28}
[13370]29
[258]30#######################################################################
31# page content
32#######################################################################
33
[14181]34_tocopen_ {<div class="top" _tocopenextra_>}
35_tocclose_ {</div>}
36
[13534]37_nextsearchresult_ {_If_("_cgiargsrn_" ne "0",<li id="nextresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrn_">_textnextsearchresult_</a></li>)}
[12944]38
[13534]39_prevsearchresult_ {_If_("_cgiargsrp_" ne "0",<li id="prevresult"><a href="_httpquery_&amp;ifl=1&amp;ifln=_cgiargsrp_">_textprevsearchresult_</a></li>)}
[13370]40
[258]41_content_ {
[7503]42_optnavigationbar_
[11094]43
[10872]44_If_(_phindclassifier__collageclassifier_,
45<p style="text-align: center;">
[1804]46_phindclassifier_
[6813]47_collageclassifier_
[10872]48</p>
49)
[13370]50
[13528]51_If_("_cgiargcl_" eq "search",
[13534]52<ul id="searchresults">
[13528]53_prevsearchresult_
54_nextsearchresult_
[14776]55</ul>)
[13370]56
[10872]57<div class="document">
[13370]58
59
[258]60}
61
[8106]62# Dublin Core Metadata Element Set, Version 1.1
[2802]63_textTitlepage_ {_texticonhtitle_}
[8106]64_textCreatorpage_ {_texticonhcreat_}
[2802]65_textSubjectpage_ {_texticonhsubj_}
[8106]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
[2802]79_textTopage_ {_texticonhto_}
80_textFrompage_ {_texticonhfrom_}
81_textSeriespage_ {_texticonhser_}
82_textHowtopage_ {_texticonhhow_}
83_textOrganizationpage_ {_texticonhorg_}
84_textBrowsepage_ {_texticonhbrwse_}
[6813]85_textCollagepage_ {_texticonhcoll_}
[2802]86_textPeoplepage_ {_texticonhpeople_}
87_textAcronympage_ {_texticonhacronym_}
88_textPhrasepage_ {_texticonhphrases_}
89_textArtistpage_ {_texticonhartist_}
[3105]90_textKeywordpage_ {_texticonhkw_}
[3534]91_textVolumepage_ {_texticonhvol_}
[5622]92_textCaptionspage_ {_texticonhcapt_}
[5517]93_textCountriespage_ {_texticonhcount_}
[2802]94
[258]95#######################################################################
96# navigation arrows
97#
98#######################################################################
99
[4868]100# these two may be reset to "" by the server
101_navarrowsbottom_ {_navarrows_}
102_navarrowstop_ {_navarrows_}
103
[258]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
[548]117_navarrows_ [v=1] {<p>
[258]118_prevarrow_<br>
119_nextarrow_
120}
121
122#######################################################################
[27257]123# section for adding user comments: consists of form and its javascript
124#######################################################################
125
[27294]126# The div that loads the user comments that were already submitted
[27281]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
[27258]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
[27294]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_doc-url_ {_gwcgi_?e=_compressedoptions_&amp;a=_cgiarga_&amp;c=_cgiargc_&amp;cl=_cgiargcl_&amp;d=_cgiargd_}
145
146_loginlink_ {
147<div id="usercommentlink"><a href="_doc-url_&amp;uan=1">_textaddusercomment_</a></div>
148}
149
[27258]150# For getting the submitbutton to make Ajax calls, see
[27257]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
[27294]154_usercommentform_ {
[27347]155<form name="AddUserCommentForm" id="usercommentform">
[27294]156<!--<p>_textcommentusername_ <input type="text" name="username"></p>-->
157<input type=hidden name="username" value="_cgiargun_">
[27257]158<p>
159_textaddusercomment_
160<textarea name="comment" rows="10" cols="70"></textarea>
161<input type=hidden name="d" value="_cgiargd_">
162</p>
163
[27259]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>
[27297]166
[27307]167<div id="usercommentlogoutlink"><a href="_doc-url_&amp;un=">_text-usercomment-logout_</a></div>
[27257]168</form>
[27259]169
[27294]170
[27257]171<script type="text/javascript">
[27259]172
[27277]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
[27259]175 function safeHTML(str) \{
176 return str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace('"',"&quot;").replace("'","&#x27;").replace("/", "&#x2F;"); //"\\""
177 \}
178
[27277]179
[27259]180 function addUserComment(_username, _comment, _docid, doc) \{
[27293]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_username || !trimmed_comment) \{
189 doc.AddUserCommentForm.comment.value = "";
190 doc.AddUserCommentForm.username.value = "";
191 doc.getElementById("usercommentfeedback").innerHTML = "_text-is-empty_";
192 return;
193 \}
194
[27258]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 \}
[27257]201
[27277]202
[27257]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
[27277]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
[27257]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 = \{
[27260]244 metaname: "usertimestamp",
[27257]245 metavals: [_timestamp]
246 \};
247
248 var comment_rec = \{
[27258]249 metaname: "usercomment",
[27257]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
[27297]264 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 = "";
[27277]269 doc.getElementById("usercommentfeedback").innerHTML = "_textcommentsubmitted_";
[27281]270
271 // update display of existing user comments to show the newly added comment
[27293]272 var usercommentdiv = document.getElementById("usercomments");
273 if(usercommentdiv != undefined) \{
274 displayInUserCommentList(usercommentdiv, _username, _timestamp, _comment);
275 \}
[27257]276 \}
277</script>
278}
279
[27258]280
[27257]281#######################################################################
[258]282# the goto form
283#######################################################################
284
285_gotoform_ {
286<form name="GotoForm" method="get" action="_gwcgi_">
[876]287<input type=hidden name="e" value="_decodedcompressedoptions_">
[258]288<input type=hidden name="d" value="_cgiargd_">
289<input type=hidden name="cl" value="_cgiargcl_">
[666]290<input type="text" name="gp" size="3" maxlength="4">
[944]291<input type="submit" value="_textgoto_">
[258]292</form>
293}
294
[944]295_textnumpages_ {&nbsp;<i>(_1_ _pages_)</i>}
[666]296_parentarrow_ {}
[19048]297_prevtitle_ {}
298_nexttitle_ {}
[666]299
[258]300#######################################################################
[1804]301# the phind applet
302#
303# The phind applet is only required on phind classifier pages.
304# Consequently, the _phindclassifier_ macro is not usually set. On screens
305# where it is required, _phindclassifier_ resolves to _phindapplet_, and
306# the following macro is loaded into the web page.
307#######################################################################
308
309_phindapplet_ {
[19149]310<APPLET CODEBASE="_httpjava_" CODE="org.nzdl.gsdl.Phind.Phind.class" ARCHIVE="Phind.jar" WIDTH=500 HEIGHT=400>
[3084]311 <PARAM NAME=library VALUE="_gwcgi_?e=_compressedoptions_">
[2487]312 <PARAM NAME=phindcgi VALUE="_gwcgi_?a=phind">
[1804]313 <PARAM NAME=collection VALUE="_cgiargc_">
[2021]314 <PARAM NAME=classifier VALUE="_phindnumber_">
315
[1804]316 <PARAM NAME=orientation VALUE="vertical">
317 <PARAM NAME=depth VALUE="2">
[2021]318 <PARAM NAME=resultorder VALUE="L,l,E,e,D,d">
[22383]319 <PARAM NAME=textorientation VALUE="_textorientation_">
[2021]320 <PARAM NAME=backdrop VALUE="_httpimg_/phindbg1.jpg">
321 <PARAM NAME=fontsize VALUE="10">
[1804]322 <PARAM NAME=blocksize VALUE="10">
[2021]323
[1804]324 The Phind java applet.
325</APPLET>
326}
327
[6813]328_collageapplet_ {
[19149]329 <applet CODEBASE="_httpjava_"
[7332]330 code="org.nzdl.gsdl.GsdlCollageApplet.GsdlCollageApplet.class"
331 archive="GsdlCollageApplet.jar"
332 width="_collagexdim_" height="_collageydim_">
[1804]333
[7332]334 <param name="gwcgi" value="_gwcgi_">
335 <param name="collection" value="_cgiargc_">
336 <param name="classifier" value="_cgiargcl_.1">
[6813]337
[7332]338 <param name="hrefMustHave" value="cl=_cgiargcl_.1">
339 <param name="imageMustNotHave" value="hl=\%x=\%gt=\%gc=\%.pr">
340
341 <param name="imageType" value="_collageimageType_">
342 <param name="verbosity" value="_collageverbosity_">
343 <param name="maxDepth" value="_collagemaxDepth_">
344 <param name="maxDisplay" value="_collagemaxDisplay_">
345 <param name="refreshDelay" value="_collagerefreshDelay_">
346 <param name="isJava2" value="_collageisJava2_">
347 <param name="bgcolor" value="_collagebgcolor_">
[11421]348 <param name="documentroot" value="_httpimg_">
[6813]349 </applet>
[7332]350
351<center>
352_collagecaption_
353</center>
[13971]354}
[7332]355
[13971]356
357_flashbook_ {
358 <div id="bookdiv">
359 </div>
360
361 <script type="text/javascript">
[14082]362 var myWidth = "100%";
363 myHeight = 800;
364
[19149]365 var img_cover = '_httpassocdir_/_thisOID_/cover.jpg';
[13971]366 var doc_url = document.URL;
367 doc_url = doc_url.replace(/(&|\\?)book=[a-z]+/gi,'');
[14082]368 doc_url += '&book=flashxml';
[18168]369
370 var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;//get windows or not
371 //Only for Windows computers because Greenstone webserver doesn't allow us to pass parameters to Flash.
372 //These methods is called by the Flash program to get all the necessary parameters for the book
373 //However, it will only work for IE 5.0 and later, Firefox 1.0 and later, Mozilla 1.7.5 and later
374 //Netscape 8.0 and later, Safari 1.3 and later
375 function getDocURL() \{ return doc_url; \}
376 function getImgCover() \{ return img_cover; \}
377 function getStageW() \{ return -1; \}
378 function getStageH() \{ return -1; \}
379
380
[13971]381 var flash_plug_html = "";
382 flash_plug_html += '<OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \\n';
383 flash_plug_html += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \\n';
384 flash_plug_html += ' height="';
[18168]385 flash_plug_html += myHeight + '" id="Book" swLiveConnect="true" align="middle"\\n';
[13971]386 flash_plug_html += ' width="';
387 flash_plug_html += myWidth + '">\\n';
[18168]388
[13971]389 flash_plug_html += ' <PARAM name="allowScriptAccess" value="always" />\\n';
[19130]390 flash_plug_html += ' <PARAM name="movie" value="_httpflash_/Book.swf';
[18168]391 if (isWin == false)
392 \{
393 flash_plug_html += '?src_image=' + escape(img_cover);
394 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
395 \}
[13971]396 flash_plug_html += '" />\\n';
397 flash_plug_html += ' <PARAM name="quality" value="high" />\\n';
398 flash_plug_html += ' <PARAM name="bgcolor" value="#FFFFFF" />\\n';
399 flash_plug_html += ' <EMBED align="middle" \\n';
400 flash_plug_html += ' allowScriptAccess="always" swLiveConnect="true" \\n';
401 flash_plug_html += ' bgcolor="#FFFFFF" height="';
402 flash_plug_html += myHeight + '" name="Book" \\n';
403 flash_plug_html += ' pluginspage="http://www.macromedia.com/go/getflashplayer" \\n';
404 flash_plug_html += ' quality="high" \\n';
[19130]405 flash_plug_html += ' src=\\'_httpflash_/Book.swf';
[18168]406 if (isWin == false)
407 \{
408 flash_plug_html += '?src_image=' + escape(img_cover);
409 flash_plug_html += '&amp;doc_url=' + escape(doc_url);
410 \}
411 flash_plug_html += '\\'\\n';
[13971]412 flash_plug_html += ' type="application/x-shockwave-flash" width="';
413 flash_plug_html += myWidth + '" />\\n';
414 flash_plug_html += '</OBJECT>\\n';
415
416 var flash_div = document.getElementById("bookdiv");
417 flash_div.innerHTML = flash_plug_html;
418 </script>
[6813]419}
420
[1804]421#######################################################################
[283]422# icons
[258]423#######################################################################
424
[10872]425_iconsmalltext_ {<img src="_httpiconsmtext_" class="icon" width=_widthsmtext_ height=_heightsmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
[548]426_iconsmalltext_ [v=1] {<small><b>_texticonsmalltext2_</b></small>}
[283]427
[10872]428_iconarrowsmalltext_ {<img src="_httpiconasmtext_" class="icon" width=_widthasmtext_ height=_heightasmtext_ alt="_texticonsmalltext_" title="_texticonsmalltext_">}
[548]429_iconarrowsmalltext_ [v=1] {<small><b>->_texticonsmalltext2_</b></small>}
[454]430
[10872]431_iconclosedfolder_ {<img src="_httpiconclsdfldr_" class="icon" width=_widthclsdfldr_ height=_heightclsdfldr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
[548]432_iconclosedfolder_ [v=1] {<small><b>_texticonclosedfolder2_</b></small>}
[283]433
[10872]434_iconarrowclosedfolder_ {<img src=_httpiconaclsdfdr_" class="icon" width=_widthaclsdfdr_ height=_heightaclsdfdr_ alt="_texticonclosedfolder_" title="_texticonclosedfolder_">}
[548]435_iconarrowclosedfolder_ [v=1] {<small><b>->_texticonclosedfolder2_</b></small>}
[454]436
[10872]437_iconopenfolder_ {<img src="_httpiconopenfldr_" class="icon" width=_widthopenfldr_ height=_heightopenfldr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
[548]438_iconopenfolder_ [v=1] {<small><b>_texticonopenfolder2_</b></small>}
[283]439
[10872]440_iconarrowopenfolder_ {<img src="_httpiconaopenfdr_" class="icon" width=_widthaopenfdr_ height=_heightaopenfdr_ alt="_texticonopenfolder_" title="_texticonopenfolder_">}
[548]441_iconarrowopenfolder_ [v=1] {<small><b>->_texticonopenfolder2_</b></small>}
[454]442
[10872]443_iconarrowclosedbook_ {<img src="_httpiconabook_" width=_widthabook_ height=_heightabook_ class="icon" alt="_texticonclosedbook_" title="_texticonclosedbook_">}
[548]444_iconarrowclosedbook_ [v=1] {<small><b>->_texticonclosedbook_: </b></small>}
[454]445
[10872]446_iconopenbook_ {<img src="_httpiconopenbook_" width=_widthopenbook_ height=_heightopenbook_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
[548]447_iconopenbook_ [v=1] {<small><b>_texticonopenbook_: </b></small>}
[283]448
[10872]449_iconarrowopenbook_ {<img src="_httpiconaopenbk_" width=_widthaopenbk_ height=_heightaopenbk_ class="icon" alt="_texticonopenbook_" title="_texticonopenbook_">}
[548]450_iconarrowopenbook_ [v=1] {<small><b>->_texticonopenbook_: </b></small>}
[454]451
[10872]452_iconopenbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
[548]453_iconopenbookshelf_ [v=1] {<small><b>_texticonopenbookshelf_: </b></small>}
[283]454
[10872]455_iconarrowopenbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonopenbookshelf_" title="_texticonopenbookshelf_">}
[548]456_iconarrowopenbookshelf_ [v=1] {<small><b>->_texticonopenbookshelf_: </b></small>}
[454]457
[10872]458_iconclosedbookshelf_ {<img src="_httpiconbshelf_" class="icon" width=_widthbshelf_ height=_heightbshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
[548]459_iconclosedbookshelf_ [v=1] {<small><b>_texticonclosedbookshelf_: </b></small>}
[283]460
[10872]461_iconarrowclosedbookshelf_ {<img src="_httpiconabshelf_" class="icon" width=_widthabshelf_ height=_heightabshelf_ alt="_texticonclosedbookshelf_" title="_texticonclosedbookshelf_">}
[548]462_iconarrowclosedbookshelf_ [v=1] {<small><b>->_texticonclosedbookshelf_: </b></small>}
[454]463
[10872]464_iconpointer_ {<img src="_httpiconarrrght_" class="icon" width=_widtharrrght_ height=_heightarrrght_>}
[548]465_iconpointer_ [v=1] {<small><b>_texticonpointer_-> </b></small>}
[283]466
[11132]467_iconwarning_ {<img src="_httpiconwarning_" width="_widthwarning_" height="_heightwarning_" class="icon" align="left">}
[548]468_iconwarning_ [v=1] {_texticonwarning_}
[283]469
470
[258]471#######################################################################
[283]472# images
473#######################################################################
474
[19149]475_coverimage_ {<img alt="Cover Image" onError="src='_httpimg_/blank.gif'" src="_httpassocdir_/_thisOID_/cover.jpg">}
[14072]476
[11132]477_docbutton_ {<div class="button"><span class="button" title="_3_"><a href="_1_">_2_</a></span></div>
478}
[283]479
[11132]480# can't use _docbutton_ macro for detach button as we need to include target
481_imagedetach_ {<div class="button"><span class="button"><a href="_httpcurrentdocument_&amp;x=1" target="\_blank" title="_texticondetach_">_textDETACH_</a></span></div>}
[283]482
[13427]483_imageprint_{<div class="button"><span class="button"><a href="javascript:print_preview()">_textPRINT_</a></span></div>}
484
485
[11132]486_imagehighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=1&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_textHIGHLIGHT_,_texticonhighlight_)}
[283]487
[11132]488_imagenohighlight_ {_docbutton_(_httpcurrentdocument_&amp;hl=0&amp;gc=_cgiarggc_&amp;gt=_cgiarggt_,_document:textNOHIGHLIGHT_,_document:texticonnohighlight_)}
[283]489
[11132]490_imagecontracttoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=0,_textCONTRACTCONTENTS_,_texticoncontracttoc_)}
[283]491
[11132]492_imageexpandtoc_ {_docbutton_(_httpcurrentdocument_&amp;gc=1,_textEXPANDCONTENTS_,_texticonexpandtoc_)}
[283]493
[11132]494_imagecontracttext_ {_docbutton_(_httpcurrentdocument_&amp;gt=0,_textCONTRACT_,_texticoncontracttext_)}
[283]495
[11132]496_imageexpandtext_ {_docbutton_(_httpcurrentdocument_&amp;gt=1,_textEXPANDTEXT_,_texticonexpandtext_)}
[283]497
[11132]498_imagecont_ {_docbutton_(_httpcurrentdocument_&amp;gt=2,_textCONTINUE_,_texticoncont_)}
[283]499
[11132]500
[13427]501#######################################################################
502# print preview script
503#######################################################################
[11132]504
[13427]505
506_pagescriptextra_{
507
508 var style_display_old;
509 var show = true;
[13452]510 var toc_top;
[13427]511
512 function has_toc(){
513 var div_nodes = document.getElementsByTagName("div");
514 for (var i=0;i < div_nodes.length ; i++ )\{
515 var div_node = div_nodes[i];
516 if (div_node.className =="toc" && div_node.childNodes.length > 1)
517 \{
518 return true;
519 \}
520 \}
521
522 return false;
523 \}
524
525 function hide_toc()\{
526 var div_nodes = document.getElementsByTagName("div");
527 for (var i=0;i < div_nodes.length ; i++ )\{
528 var div_node = div_nodes[i];
529 if (div_node.className =="toc")
530 \{
531 style_display_old = div_node.style.display;
[13452]532 toc_top = document.getElementById("toc_top");
533 if (toc_top)
534 div_node.parentNode.insertBefore(toc_top,div_node);
535 div_node.style.display = "none";
[13427]536 \};
537 \}
538
539 \}
540
[13452]541
[13427]542 function show_toc()\{
543
544 var div_nodes = document.getElementsByTagName("div");
545 for (var i=0;i < div_nodes.length ; i++ )\{
546 var div_node = div_nodes[i];
547 if (div_node.className =="toc")
548 \{
549 div_node.style.display = style_display_old;
[13452]550 if (toc_top)
551 div_node.insertBefore(toc_top,div_node.firstChild);
552 \};
[13427]553 \}
554
555 \}
556
557
558 function switch_toc()\{
559 var toc_link = document.getElementById("toc_link");
560 while (toc_link.hasChildNodes()) \{
561 toc_link.removeChild(toc_link.firstChild);
562 \}
563 if (show)\{
[13450]564 toc_link.appendChild(document.createTextNode('_textshowcontents_'));
[13427]565 show = false;
566 hide_toc();
567 \}
568 else\{
[13450]569 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
[13427]570 show = true;
571 show_toc();
572 \}
573
574 \}
575
576 function print_preview() \{
577 // Switch the stylesheet
578 setActiveStyleSheet("Preview Document");
579 add_print_message();
580 \}
581
582 function add_print_message()\{
583 if (document.getElementById)\{
584 var print_message = document.createElement('ul');
585 print_message.id = 'print-message';
586 print_message.className = "printmessage";
587
588 var cancel_print_link = document.createElement('li');
589 cancel_print_link.className = "cancelprint"
590 cancel_print_link.onclick = function()\{ cancel_print(); return false;\};
[13450]591 cancel_print_link.appendChild(document.createTextNode('_textreturnoriginal_'));
[13427]592 print_message.appendChild(cancel_print_link);
593
594
595 var print_link = document.createElement('li');
596 print_link.onclick = function()\{ window.print(); return false;\};
[13450]597 print_link.appendChild(document.createTextNode('_textprintpage_'));
[13427]598 print_message.appendChild(print_link);
599
600 if (has_toc())\{
601 var toc_link = document.createElement('li');
602 toc_link.id = "toc_link";
603 toc_link.onclick = function()\{ switch_toc(); return false;\};
[13450]604 toc_link.appendChild(document.createTextNode('_texthidecontents_'));
[13427]605 print_message.appendChild(toc_link);
606 \}
607
608 //insert the print message node
609 var div_nodes = document.getElementsByTagName("div");
610 for (var i=0;i < div_nodes.length ; i++ )\{
611 var div_node = div_nodes[i];
612 if (div_node.className =="document")\{
613 var parent = div_node.parentNode;
614 parent.insertBefore(print_message,div_node);
615 \}
616 \}
617 \}
618
619 \}
620
621
622 function cancel_print() \{
623 // Destroy the preview message
624 var print_message = document.getElementById('print-message');
625 var parent = print_message.parentNode;
626 parent.removeChild(print_message);
627
628 show_toc();
629 // Switch back stylesheet
630 setActiveStyleSheet("default");
631 \}
632
633 function setActiveStyleSheet(title) \{
634 var i, a, main;
635 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) \{
636 if(a.getAttribute("rel").indexOf("style") != -1
637 && a.getAttribute("title")) \{
638 a.disabled = true;
639 if(a.getAttribute("title") == title) a.disabled = false;
640 \}
[25396]641 \}
[13427]642 \}
643
644}
645
646
[283]647#######################################################################
[258]648# headers/footers
649#######################################################################
650
651
652# header overridden for text pages
653_textheader_ {_cgihead_
[454]654_htmlhead_
[10872]655_startspacer_
656
657<!-- document:textheader -->
658<div id="banner">
659<div class="pageinfo"><p class="bannerlinks">_globallinks_</p></div>
660<div class="collectimage">_imagecollection_</div>
661</div>
[11779]662<div class="bannerextra">_pagebannerextra_</div>
[258]663}
[10872]664
[548]665_textheader_ [v=1] {_cgihead_
666_htmlhead_
[10872]667_globallinks_
[548]668}
[258]669
670_footer_ {
[10872]671</div> <!-- document:footer -->
672
[27363]673_If_("_document:allowusercomments_" eq "1",
[27281]674<center>
675<table width=_pagewidth_ cellpadding=0 cellspacing=0 border=0>
676<tr><td align=left valign=top>
677<div class="commentssection">
678_usercomments_
679_addusercomment_
680</div>
681</td></tr></table>
[27363]682</center>)
[27281]683
[27294]684<div class="navarrowsbottom">
685_navarrowsbottom_
686</div>
687
688
[258]689_endspacer__htmlfooter_
[23804]690}
691
692
[23812]693
694
[23804]695package Global
[23812]696
[23804]697# Social network support
698# Defined here in document, as the most likely place this will be used in
699# within a document view, however its package is 'Global' because you
700# might equally want this in a search or browse list
701
702# _1_ = e.g. title
703# _2_ = [srclink] or left empty. If left empty, then it will share the internal GS document
704
705_sharemescript_ {
706 <script type="text/javascript">
707 var a2a_config = a2a_config || \{ \};
708 a2a_config.linkname = "_1_";
[23812]709
710 _If_(_2_,
[23804]711 var srclink = \'_2_\';
[23812]712
713 //If metadata value is a valid URL that starts with xxx://
714 // (e.g. any protocol\, http, https\, ftp ...) then that will be the link to share
715 if (srclink.match(/^[^:]+:\\\/\\\//i)) \{
716 a2a_config.linkurl = srclink;
717 \}
718 else \{
719 //if metadata value is [srclink] then we have to cut off the 'href' tag label
720 var href = srclink.match(/href=\"([^\"]*)\"/);
721 a2a_config.linkurl = gsapi.fullDomainURL(href[1]);
722 \}
723 ,
724 //if no metadata was passed as link\, then the GS version of the document will be used.
[23804]725 a2a_config.linkurl = gsapi.fullDomainURL("_gwcgi_")+ "?c=_cgiargc_&a=d&d=_cgiargd_";
726)
727
728 </script>
729}
730
731_shareme_ {
732
733<div style=\'padding-left:50px;\' class=\'a2a_kit a2a_default_style\'>
734 _sharemescript_(_1_,_2_)
735 <center>
736 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
737 <span class=\"a2a_divider\"></span>
738 <a class=\'a2a_button_facebook\'></a>
739 <a class=\'a2a_button_twitter\'></a>
740 <a class=\'a2a_button_email\'></a>
741 <a class=\'a2a_button_linkedin\'></a>
742 </center>
743 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
744</div>
745
746}
747
748_sharemesmall_ {
749
750<span style=\'padding-left:8px;\' class=\'a2a_kit a2a_default_style\'>
751 _sharemescript_(_1_,_2_)
752 <a class=\'a2a_dd\' href=\'http://www.addtoany.com/share_save\'>Share</a>
753 <script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>
754</span>
755
756}
Note: See TracBrowser for help on using the repository browser.