root/main/trunk/greenstone2/macros/style.dm @ 24004

Revision 24004, 7.8 KB (checked in by davidb, 9 years ago)

Added capability to save-as draft.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1# this file must be UTF-8 encoded
2#######################################################################
3# PAGE STYLES
4#######################################################################
5
6package Style
7
8# to use this style system output
9# _header_
10# all your page content, then
11# _footer_
12
13# use the page parameter 'style' to choose the appropriate style
14
15# Current values: "html" and "xhtml"
16_compliance_ {html}
17
18# the style system uses
19# _pagetitle_  - what gets displayed at the top of the browser window
20# _pagescriptextra_ - any extra javascript you want included in the header
21# _pagebannerextra_ - anything extra you want displayed in the page banner
22# _pagefooterextra_ - anything extra you want displayed in the footer
23
24# defaults for the above macros
25_pagetitle_ {_collectionname_}
26_pagescriptfileextra_ {}
27_pagescriptextra_ {}
28_pagebannerextra_ {}
29_pagefooterextra_ {}
30
31# collection specific style and script may be set in collection's extra.dm
32# using the following macros
33_collectionspecificstyle_ {}
34_collectionspecificscript_ {}
35
36# it also relies on lots of Globals, the most important of these are:
37# _cookie_ - put in the cgi header
38# _globalscripts_ - javascript stuff
39# _imagecollection_
40# _imagehome_
41# _imagehelp_
42# _imagepref_
43# _imagethispage_ (this is now not an image, but text. should be renamed?)
44# _linkotherversion_
45
46# _httpiconchalk_ - the image down the left of the page - is now done
47# by the style sheet.
48
49_header_ {_cgihead_
50_htmlhead_(class="bgimage")_startspacer__pagebanner_
51}
52
53_header_[v=1] {_cgihead_
54_htmlhead__pagebanner_
55}
56
57# _cgihead_ {Content-type: text/html
58# _cookie_
59#
60# }
61_cgihead_{}
62
63
64# any declarations relating to CSS that should go in the html head part.
65# declarations containing images are done here so the path is correct
66# at runtime.
67
68_csslink_{
69  <link rel="stylesheet" href="_cssfilelink_" type="text/css"
70   title="Greenstone Style" charset="UTF-8" _linktagend_
71  <link rel="alternate stylesheet" href="_httpstyle_/style-print.css"
72   type="text/css" title="Printer" charset="UTF-8" media="print, screen" _linktagend_
73  <link rel="stylesheet" href="_httpstyle_/style-print.css" type="text/css"
74   title="Printer" charset="UTF-8" media="print" _linktagend_
75}
76
77_cssheader_ {
78_csslink_
79<style type="text/css">
80body.bgimage \{ background: url("_httpimages_/chalk.gif") scroll repeat-y left top; \}
81div.navbar \{ background-image: url("_httpimages_/bg_green.png"); \}
82div.divbar \{ background-image: url("_httpimages_/bg_green.png"); \}
83a.navlink \{ background-image: url("_httpimages_/bg_off.png"); \}
84a.navlink_sel \{ background-image: url("_httpimages_/bg_green.png"); \}
85a.navlink:hover \{ background-image: url("_httpimages_/bg_on.png"); \}
86p.bannertitle \{background-image: url("_httpimages_/banner_bg.png"); \}
87p.collectiontitle \{background-image: url("_httpimages_/banner_bg.png"); \}
88</style>
89_collectionspecificstyle_
90
91}
92
93# separate macro so it can be easily overridden for customised collections
94_cssfilelink_ {_httpstyle_/style.css}
95
96# Languages that should be displayed right-to-left
97_htmlextra_ [l=ar] { dir=rtl }
98_htmlextra_ [l=fa] { dir=rtl }
99_htmlextra_ [l=he] { dir=rtl }
100_htmlextra_ [l=ur] { dir=rtl }
101_htmlextra_ [l=ps] { dir=rtl }
102_htmlextra_ [l=prs] { dir=rtl }
103
104# htmlhead uses:
105# _1_ - extra parameters for the body tag
106# _pagetitle_
107# _globalscripts_
108_htmlhead_ {<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
109"http://www.w3.org/TR/html4/loose.dtd">
110
111<html_htmlextra_>
112<head>
113<title>_pagetitle_</title>
114<meta name="_status:textversion_" content="_versionnum_" _metatagend_
115_globalscripts_
116_cssheader_
117_document:documentheader_
118</head>
119
120<body _1_>
121}
122
123# Link and meta tags must be closed differently for HTML/XHTML validation
124_linktagend_ {_If_("_compliance_" eq "xhtml",/>,>)}
125_metatagend_ {_If_("_compliance_" eq "xhtml",/>,>)}
126
127_spacerwidth_ {65}
128
129# _startspacer_ is a spacer that gives pages a left-hand margin.
130# It must eventually be closed by _endspacer_.
131_startspacer_ {
132<div id="page">
133}
134
135# If you want to move the home/help/pref buttons, override this to be empty
136# and then explicitly include _globallinks_ somewhere else
137# on the page
138_optgloballinks_ {_globallinks_}
139
140# _bannertitle_ is defined in nav_css/ns4.dm, and is either text or
141# a banner image
142_pagebanner_ {
143<!-- page banner (\_style:pagebanner\_) -->
144<div id="banner">
145<div class="pageinfo"> 
146<p class="bannerlinks">_optgloballinks_</p>
147_bannertitle_
148</div>
149<div class="collectimage">_imagecollection_</div>
150</div>
151<div class="bannerextra">_pagebannerextra_</div>
152<!-- end of page banner -->
153_If_("_activateweb20_" eq "2",
154  _If_("_activatetalkback_" eq "1",_talkback:uploadForm_)
155)
156}
157
158_pagebanner_[v=1] {
159<!-- page banner - text version [v=1] (\_style:pagebanner\_) -->
160<center><h2><b><u>_imagecollection_</u></b></h2></center><p>
161_optgloballinks_
162_pagebannerextra_
163<p>
164<!-- end of page banner -->
165_If_("_activateweb20_" eq "2",
166  _If_("_activatetalkback_" eq "1",_talkback:uploadForm_)
167)
168}
169
170# note we no longer close off one of the startspacer tables here!!
171_footer_ {
172_If_("_cgiargtalkback_" eq "1",_talkback:monitorUpload_)
173<!-- page footer (\_style:footer\_) -->
174_pagefooterextra__endspacer__htmlfooter_
175}
176
177# v=1 footer: not using startspacer in the header, so dont put it in the footer
178_footer_ [v=1]{
179_If_("_cgiargtalkback_" eq "1",_talkback:monitorUpload_)
180<!-- page footer [v=1] (\_style:footer\_) -->
181_pagefooterextra_
182_htmlfooter_
183}
184
185# close off anything opened by startspacer
186_endspacer_ {   
187</div> <!-- id=page -->
188}   
189
190
191_htmlfooter_ {
192</body>
193</html>
194}
195
196_loginscript_ {
197   function appendUsernameArgs(id,addOn)
198   \{
199     var a=document.getElementById(id);
200     var url = a.getAttribute("href");
201     if (url == "") \{
202       url = document.location.toString();
203     \}
204
205     //alert("url before = " + url);
206
207     // clear out any earlier user name/authentication values
208     url = url.replace(/(&|\\\\?)uan=\\d\{0,1\}/g,"");
209     url = url.replace(/(&|\\\\?)un=[a-z0-9:\\-]*/g,"");
210     url = url.replace(/(&|\\\\?)pw=[a-z0-9:\\-]*/g,"");
211
212     //alert("url after = " + url);
213
214     var gwcgi = "_gwcgi_";
215
216     var tailUrl = url.substr(url.length-gwcgi.length);
217
218     url += (tailUrl == "_gwcgi_") ? "?" : "&";
219     url += addOn;
220
221     //alert("url with add on = " + url);
222
223     a.setAttribute("href",url);
224   \}
225}
226
227
228# imagescript only used in nav_ns4.dm
229_globalscripts_{
230  <script type="text/javascript" src="_httpscript_/gsajaxapi.js"></script>
231
232  <script language="javascript" type="text/javascript">
233    function gsdefined(val)
234    \{
235       return (typeof(val) != "undefined");
236    \}
237
238    var gsapi = new GSAjaxAPI("_gwcgi_","_cgiargc_");
239  </script>
240
241_If_("_activatejquery_" eq "1",_jqueryScriptAndStyle_)
242
243_If_("_activateweb20_" eq "2",
244  _If_("_activateseaweed_" eq "1",_seaweedscript_)
245  _If_("_activatetalkback_" eq "1",_talkbackscript_)
246)
247_If_(_pagescriptfileextra_,_pagescriptfileextra_)
248<script language="javascript" type="text/javascript">
249_loginscript_
250_If_(_pagescriptextra_,_pagescriptextra_)
251_collectionspecificscript_
252_imagescript_
253</script>
254
255}
256
257_globalscripts_ [v=1] {
258
259_If_("_activatejquery_" eq "1",_jqueryScriptAndStyle_)
260
261_If_("_activateweb20_" eq "2",
262  <script type="text/javascript" src="_httpscript_/gsajaxapi.js"></script>
263  _If_("_activateseaweed_" eq "1",_seaweedscript_)
264  _If_("_activatetalkback_" eq "1",_talkbackscript_)
265)
266_If_(_pagescriptfileextra_,_pagescriptfileextra_)
267<script language="javascript" type="text/javascript">
268<!--
269_loginscript_
270_If_(_cgiargx_,_scriptdetach_)
271_If_(_pagescriptextra_,_pagescriptextra_)
272_collectionspecificscript_
273// -->
274</script>
275}
276
277_scriptdetach_ {
278    function close\_detach() \{
279    close();
280    \}
281}
282
283
284_jqueryScriptAndStyle_ {
285<link type="text/css" href="_httpstyle_/max-video/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
286<script type="text/javascript" src="_httpscript_/jquery-1.4.2.min.js"></script>
287<script type="text/javascript" src="_httpscript_/jquery-ui-1.8.4.custom.min.js"></script>
288}
289
Note: See TracBrowser for help on using the browser.