source: main/trunk/greenstone2/macros/nav_css.dm@ 28751

Last change on this file since 28751 was 27785, checked in by kjdon, 11 years ago

img tags need alt attribute to be valid html

  • Property svn:keywords set to Author Date Id Revision
File size: 5.6 KB
Line 
1# this file must be UTF-8 encoded
2
3# This macro file contains the definitions required for making the
4# navigation bar presentation controlled by the CSS file.
5
6#######################################################################
7# GLOBAL MACROS
8#######################################################################
9
10package Global
11
12#######################################################################
13# global navigation links
14#######################################################################
15
16_globallinks_ {_If_("_cgiargu_" ne "1",_homelink_) _helplink_ _preflink__optloginlink_ _optrsslink_}
17_homelink_ {_navtaborig_(_httppagehome_,_linktextHOME_,_textdescrhome_)}
18_helplink_ {_navtaborig_(_httppagehelp_,_linktextHELP_,_textdescrhelp_)}
19_preflink_ {_navtaborig_(_httppagepref_,_linktextPREFERENCES_,_textdescrpref_)}
20
21_optloginlink_ {
22 _If_("_activateweb20_" >= "1",_If_("x_cgiargun__cgiarguan_" ne "x1",_loginlink_))
23}
24
25_loginlink_ {
26
27 _If_(_cgiargun_,
28 _navtablogoutorig_(_linktextLOGOUT_,_textdescrlogout_) _linktextLOGGEDIN_
29 <script type="text/javascript">
30 appendUsernameArgs("logout","uan=&un=")
31 </script>
32 ,
33 _navtabloginorig_(_linktextLOGIN_,_textdescrlogin_)
34 <script type="text/javascript">
35 appendUsernameArgs("login","uan=1")
36 </script>
37 )
38}
39
40
41# if a collection should have an rss link,
42# set _optrsslink_ for that collection's global package to contain _rsslink_
43_optrsslink_ {}
44
45# RSS link and default RSS icon for embedding in the link
46# RSS icon from http://webneel.com/post/freedownload/web-design/icon-design/25-web-rss-icons
47# e.g. rss link: http://localhost:8283/greenstone/cgi-bin/library.cgi?site=localhost&a=rss&c=demo&l=en&w=utf-8&hostname=localhost:8283
48# And the javascript that's used for appending "&hostname=host:port" to the link to the RSS feed
49# The script is activated on loading the rss icon <img>, since onLoad doesn't work on <a>
50# The rsslink that embeds rssicon are two macros defined in base.dm
51# To use this script, define pagescriptextra macro to contain the domainscript macro
52# Can do so at collectionlevel in a collection's extra.dm (try to add it to package about)
53
54_rssicon_ {<img class="icon" src="_httpimages_/rssicon.png" alt="_collectionname_ RSS feed" title="_collectionname_ RSS feed" onLoad="addDomainToRSSAnchor(this)">}
55
56_rsslink_ {<a id="rss" href="_gwcgi_?site=localhost&amp;a=rss&amp;c=_cgiargc_&amp;l=_cgiargl_&amp;w=_cgiargw_">_rssicon_</a>
57<script type="text/javascript">
58function addDomainToRSSAnchor (imgtag)
59 \{
60 parent = imgtag.parentNode;
61 if (parent && parent.href)
62 \{
63 parent.href += "&hostname="+location.hostname;
64 if(location.port) \{
65 parent.href += ":"+location.port;
66 \}
67 \}
68 \}
69</script>
70}
71
72
73# The following is useful if collection specific macro. Override
74# _optnavigationbar_ to be empty if you don't want the navigation bar to
75# appear in the standard place, and then specify _navigationbar_ elsewhere
76# in a collection specific macro file(s) to be where you do want it.
77_optnavigationbar_{
78<div class="navbar">
79<p class="navbar">
80_navigationbar_
81</p>
82</div>
83}
84
85_starthighlight_ {<span class="highlight">}
86_endhighlight_ {</span>}
87
88# parameters are:
89# 1. the url to go to when clicked
90# 2. the name of the tab
91# 3. alt/title explanatory text
92# 4. optional "selected" or not if it is the current tab
93_navtaborig_ {<a _If_("_4_" eq "selected",class="navlink_sel">_2_,class="navlink" href="_1_" title="_3_">_2_)</a>}
94
95# same sa above, but without _1_ as there is no hyperlink to go to (want to say on the same page)
96_navtabloginorig_ {<a _If_("_3_" eq "selected",class="navlink_sel postit">_1_,class="navlink postit" id="login" href="" title="_2_">_1_)</a>}
97
98# same sa above, but without _1_ as there is no hyperlink to go to (want to say on the same page)
99_navtablogoutorig_ {<a _If_("_3_" eq "selected",class="navlink_sel postit">_1_,class="navlink postit" id="logout" href="" title="_2_">_1_)</a>}
100
101# parameters are
102# 1. The url to go to when clicked
103# 2. The metadata name - this gets used to determine the title and alt text
104# 3. optional "selected" if it is the current tab
105_navtab_ {<a _If_("_3_" eq "selected",class="navlink_sel">_navlinktitle_(_2_),class="navlink" href="_1_" title="_navlinkalt_(_2_)">_navlinktitle_(_2_))</a>}
106
107
108#######################################################################
109# navigation bar images
110#
111#######################################################################
112
113# the spacer image - the width of this is calculated and set from server.
114#
115# Its height is now explicity set to 1 to avoid width x height "scaling
116# problem". Given that spacer.gif's natural dimensions are 40x4 pixels,
117# left uncontrolled, when the image is stretched through _widthtspace_ to
118# a width of say 400 (as happens when there are only two items in the
119# navigation bar) then its height becomes 40 pixels, making the navbar
120# twice as high as the text in it, and quite ugly looking
121
122_navbarspacer_ {<img src="_httpimg_/spacer.gif" alt="" height="1" width="_widthtspace_" />}
123
124_navbarspacer_[v=1] {<br>
125}
126
127# cgiargu means "static page", so no search link should be shown
128_navtabsearch_ {_If_("_cgiargu_" ne "1",_navtab_(_httpquery_,Search,_1_))}
129
130package about
131
132_imagethispage_ {_titleabout_}
133
134package query
135
136_imagethispage_ {_labelSearch_}
137
138
139package Style
140
141_imagescript_ {}
142
143#_bannertitle_ {_If_(_imagethispage_,<p class="bannertitle"><span class="bannertitle">_imagethispage_</span></p>)}
144
145_bannertitle_ {_If_(_imagethispage_,<p class="bannertitle">_imagethispage_</p>)}
146
147#<span class="bannertitlebackground">i</span>
148
149package home
150
151_preflink_ {_navtaborig_(_home:httppagehomepref_,_linktextPREFERENCES_,_textdescrpref_)}
152
Note: See TracBrowser for help on using the repository browser.