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

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

Adding an Ajax Synchronous Post method to gsajaxapi.js which is then used by the setMetadataArray() that is called from document.dm. Also corrected a variable misspelling in baseaction (authenication changed to authentication) so that locating perl code that deals with authentication may become easier.

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