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

Last change on this file since 30526 was 29384, checked in by kjdon, 10 years ago

added in code to have an optional deposit link in the home help prefs global links bar

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