source: MILK/trunk/milk_server/milk_server/templates/ndgPage.kid @ 5845

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/MILK/trunk/milk_server/milk_server/templates/ndgPage.kid@5845
Revision 5845, 10.3 KB checked in by sdonegan, 10 years ago (diff)

Updated paging numbering

Line 
1<!-- This is a bunch of named templates for use in pages -->
2<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#">
3   
4    <!-- HTML Header and Document header follow -->
5   
6    <head py:def="pagehead()" py:strip="True">
7        <title py:content="c.title">title</title>
8        <!--! The following includes the javascript, note that the XML
9        function is needed to avoid escaping the < character -->
10        ${XML(h.javascript_include_tag(builtins=True))}
11        <script type="text/javascript" src="$g.server/js/toggleDiv.js"/>
12
13        <link media="all, screen" href="$g.server/layout/style/ndg2.css" type="text/css" rel="stylesheet"/>
14    </head>
15   
16    <div py:def="header()">
17        <div py:if="g.browseEnabled and not g.discoveryEnabled and not g.atomEditorEnabled" id="browseheader"/>
18        <div py:if="not (g.browseEnabled and not g.discoveryEnabled and not g.atomEditorEnabled)" id="editorheader"/>
19        <div id="logo"><img src="$g.LeftLogo" alt="$g.LeftAlt" /></div>
20    </div>
21
22
23    <div py:def="semanticSearch()" id="context">
24    <!-- NB, to use this method, you need to add the queueDeployments script to the calling
25    page - see queueDeployments.js for more details -->
26    <table>
27    <tr>
28    <td width="15%">Alternative searches<span py:replace="helpIcon('semser_help')"/>:</td>
29    <td>
30                <div id="altSearchPlaceholder" />
31        </td>
32        </tr>
33        </table>
34    <div id="semser_help" class="hidden">
35        <div class="helptxt"><p>
36        The semantic search option allows you to see how many hits a search using your current parameters would return if you
37        used a slightly different vocabulary in your search term.
38        </p></div>
39    </div>
40        </div>
41
42    <div py:def="pageControl(state, discoveryURL)" class="resultsBar">
43    <!-- NB, can only have one main page control on the page since it has a form and
44    help div associated with it - for the main control, set the discoveryURL to a valid
45    value, otherwise set to None
46    -->
47            <div>
48                <?python
49                formID = "xyz"
50                if discoveryURL:
51                        formID = "orderByForm"
52                ?>
53                <!-- Make sure that paging works for number of items less than paging -->             
54                <?python
55               
56                if state.hits<10:
57                 
58                  state.pager.upperRange=state.hits
59               
60                ?>
61                <form action="$discoveryURL" name="$formID">
62                <input type="hidden" name="constraints" value="${state.urlformattedconstraints}"/>
63                <a href="${state.constrainedurl}"> Refine search</a><span py:replace="helpIcon('refser_help')"/>
64                <span py:if="state.hits != 0" py:strip="">
65                        <span py:if="discoveryURL" py:strip="">
66                           
67                            |Order By ${XML(h.select('orderBy',option_tags = c.orderByList, onchange="orderByForm.submit()"))}
68                        ${XML(h.select('orderDirection',option_tags = c.orderDirection, onchange="orderByForm.submit()"))}
69                    </span>
70                        | Found ${state.hits}
71                    <span py:if="state.pager.previousPageURL"> | <a href="$state.pager.startPageURL"> &lt;&lt; </a>
72                    | <a href="$state.pager.previousPageURL"> Previous ${state.pager.previousNumber}</a> </span>
73                   
74                                | Showing ${state.pager.lowerRange}-${state.pager.upperRange}
75                               
76                               
77                                 <!--Showing ${state.pager.lowerRange} -->
78                    <span py:if="state.pager.nextPageURL"> | <a href="$state.pager.nextPageURL"> Next ${state.pager.nextNumber}</a>
79                    | <a href="$state.pager.lastPageURL"> &gt;&gt; </a></span>
80                 </span>
81                </form>
82            </div>
83            <div py:if="discoveryURL" id="refser_help" class="hidden">
84                <div class="helptxt"><p>
85                The refined search option allows you to constrain your search by returning you to the advanced search page, but retaining your current search parameters
86                </p></div>
87            </div>
88        </div>
89   
90    <!-- One line search box for top of many pages follows -->
91    <div py:def="searchOneLine(targets=0)" class="searchBar">
92        <table width="100%"><tr><td align="left">
93        <form action="$g.discoveryURL">
94            New text search<span py:replace="helpIcon('nts_help')"/>&nbsp;
95            <input type="text" size="25" name="searchString"/>
96            <select name="textTarget">
97            <option value="Authors">Authors</option>
98            <option value="All" selected="selected">All</option>
99            <option value="Params">Parameters</option>
100            </select>
101            <span py:if="targets"> in
102            <?python
103            sel=[['Discovery','Discovery'],['Browse','Browse'],['Simulation','NumSim']]
104            ?>
105            <select name="searchTarget">
106                ${XML(h.options_for_select(sel,targets))}
107            </select>
108            </span>
109            <input type="submit" value="Search"/>
110         </form>
111         </td><!--<td align="right">
112         <form action="$g.discoveryURL">
113            <input type="submit" value="New Search"/>
114            <span py:replace="helpIcon('ns_help')"/>
115         </form>
116         </td>--><td py:if="not g.standalone" align="right">
117            <span py:if="'ndgSec' in session" id="loginBar">
118            <span py:replace="logOut()"/></span>
119            <span py:if="'ndgSec' not in session" id="loginBar">
120            <span py:replace="logIn()"/></span>
121        </td></tr></table>
122          <div id="nts_help" class="hidden">
123            <div class="helptxt"><p> This will do a completely new text search with no constraints beyond the target of the
124            text search from the drop down list (All, Authors, Parameters) </p></div>
125          </div>
126          <div id="ns_help" class="hidden">
127            <div class="helptxt"><p> This will return you to the new search page</p></div>
128          </div>
129    </div>
130   
131    <div py:def="PageTabs(tabv)" id="PageTabs">
132        <div id="PageTabRow">
133            <ul>
134                <span py:for="tab in c.pageTabs">
135                    <?python
136                    linkto=True
137                    if tab[0] == tabv:
138                        status='current'
139                        linkto=False
140                    else: status='hidden'
141                    ?>
142                    <li class="$status"><span class="pagetab">
143                        ${XML(h.link_to_if(linkto,tab[0],tab[1]))}
144                    </span></li>
145                 </span>
146            </ul>
147        </div>
148        <div class="line"/>
149        <div class="clear"/>
150    </div>
151    <py if="c.UpdatePageTabs" py:replace="PageTabs(c.current)"/>
152
153    <!-- Page Footer follows -->
154    <div py:def="footer()" id="Footer">
155        <center><table><tbody>
156            <tr>
157                <td align="left" width="20%">
158                    <table><tbody>
159                    <tr><td><span py:replace="linkimage(g.ndgLink,g.ndgImage,'NDG')"/></td>
160                    <td> This portal is a product of the <a href="http://ndg.nerc.ac.uk"> NERC DataGrid</a>
161                    ${g.disclaimer} </td>
162                    </tr>
163                    </tbody></table>
164                </td>
165                <td width="20%" align="center">
166                DDS News
167                <a href="$g.server/getFeed/discovery"><img border="0" src="$g.feedIcon" alt="Atom feed for discovery service" title="Atom feed for discovery service"/></a>
168                </td>
169                <td width="20%" align="center">
170                    <a href="mailto:$c.helpEmail?subject=NERC Data Discovery Service enquiry">Report problems</a>
171                </td>
172                <td width="20%" align="center">
173                    <a href="$c.oaiPage">Data Providers Login</a>
174                </td>               
175                <td width="20%" align="center">
176                    <div py:if="not g.standalone" id="loginStatus">
177                        <!--! now we choose one of the next two (logged in or not) -->
178                        <div py:if="'ndgSec' in session"><table><tbody><tr><td>
179                        User [${session['ndgSec']['u']}] logged in at
180                        ${session['ndgSec']['org']} with roles
181                        [${len(session['ndgSec']['roles'])==1 and session['ndgSec']['roles'][0] or ', '.join(session['ndgSec']['roles'])}]</td><td>
182                        &nbsp;<span py:replace="logOut()"/></td></tr></tbody></table></div>
183                        <div py:if="'ndgSec' not in session">Further services may be available if you can
184                            <span py:replace="logIn()"/></div>
185                    </div>
186                </td>
187                <td align="right"><span py:replace="linkimage(g.stfcLink,g.stfcImage,'Hosted by the STFC CEDA')"/></td>
188            </tr>
189        </tbody></table></center>
190    </div>
191   
192    <!-- Utility Functions follow -->
193   
194    <!-- hyperlinked image -->
195    <span py:def="linkimage(linkref,imageref,alttext)">
196        <a href="$linkref"><image src="$imageref" alt="$alttext" title="$alttext"/></a>
197    </span>
198   
199    <!-- Help Icons -->
200    <span py:def="helpIcon(value)">
201        <span>
202            <a href="javascript:;" title="Toggle help" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;">
203            <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a>
204     
205        </span>
206    </span>
207   
208    <!-- Login jogin and out buttons --> 
209    <span py:def="logOut()" class="logOut">
210            <?python
211            from base64 import urlsafe_b64encode
212           
213            # Base 64 encode to enable passing around in 'r' argument of query
214            # string for use with login/logout
215            g.ndg.security.common.sso.state.returnToURL = str(c.requestURL)
216            g.ndg.security.common.sso.state.b64encReturnToURL = urlsafe_b64encode(c.requestURL)
217            ?>
218        <form action="$g.logout">
219            <input type="hidden" name="r" value="${g.ndg.security.common.sso.state.b64encReturnToURL}"/>
220            <input type="submit" value="Logout"/>
221        </form>
222    </span>
223   
224    <span py:def="logIn()" class="logIn">
225            <?python
226            from base64 import urlsafe_b64encode
227           
228            # Base 64 encode to enable passing around in 'r' argument of query
229            # string for use with login/logout
230            g.ndg.security.common.sso.state.returnToURL = str(c.requestURL)
231            g.ndg.security.common.sso.state.b64encReturnToURL = urlsafe_b64encode(c.requestURL)
232            ?>
233        <form action="$g.wayfuri">
234            <input type="hidden" name="r" value="${g.ndg.security.common.sso.state.b64encReturnToURL}"/>
235            <input type="submit" value="Login"/>
236        </form>
237    </span>
238   
239   
240   
241</html>
Note: See TracBrowser for help on using the repository browser.