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

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

Updates to deal with problems of changing bbox params for global search

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                <form action="$discoveryURL" name="$formID">
54                <input type="hidden" name="constraints" value="${state.urlformattedconstraints}"/>
55                <a href="${state.constrainedurl}"> Refine search</a><span py:replace="helpIcon('refser_help')"/>
56                <span py:if="state.hits != 0" py:strip="">
57                        <span py:if="discoveryURL" py:strip="">
58                            | Order By ${XML(h.select('orderBy',option_tags = c.orderByList, onchange="orderByForm.submit()"))}
59                        ${XML(h.select('orderDirection',option_tags = c.orderDirection, onchange="orderByForm.submit()"))}
60                    </span>
61                        | Found ${state.hits}
62                    <span py:if="state.pager.previousPageURL"> | <a href="$state.pager.startPageURL"> &lt;&lt; </a>
63                    | <a href="$state.pager.previousPageURL"> Previous ${state.pager.previousNumber}</a> </span>
64                                | Showing ${state.pager.lowerRange}-${state.pager.upperRange}
65                    <span py:if="state.pager.nextPageURL"> | <a href="$state.pager.nextPageURL"> Next ${state.pager.nextNumber}</a>
66                    | <a href="$state.pager.lastPageURL"> &gt;&gt; </a></span>
67                 </span>
68                </form>
69            </div>
70            <div py:if="discoveryURL" id="refser_help" class="hidden">
71                <div class="helptxt"><p>
72                The refined search option allows you to constrain your search by returning you to the advanced search page, but retaining your current search parameters
73                </p></div>
74            </div>
75        </div>
76   
77    <!-- One line search box for top of many pages follows -->
78    <div py:def="searchOneLine(targets=0)" class="searchBar">
79        <table width="100%"><tr><td align="left">
80        <form action="$g.discoveryURL">
81            New text search<span py:replace="helpIcon('nts_help')"/>&nbsp;
82            <input type="text" size="25" name="searchString"/>
83            <select name="textTarget">
84            <option value="Authors">Authors</option>
85            <option value="All" selected="selected">All</option>
86            <option value="Params">Parameters</option>
87            </select>
88            <span py:if="targets"> in
89            <?python
90            sel=[['Discovery','Discovery'],['Browse','Browse'],['Simulation','NumSim']]
91            ?>
92            <select name="searchTarget">
93                ${XML(h.options_for_select(sel,targets))}
94            </select>
95            </span>
96            <input type="submit" value="Search"/>
97         </form>
98         </td><!--<td align="right">
99         <form action="$g.discoveryURL">
100            <input type="submit" value="New Search"/>
101            <span py:replace="helpIcon('ns_help')"/>
102         </form>
103         </td>--><td py:if="not g.standalone" align="right">
104            <span py:if="'ndgSec' in session" id="loginBar">
105            <span py:replace="logOut()"/></span>
106            <span py:if="'ndgSec' not in session" id="loginBar">
107            <span py:replace="logIn()"/></span>
108        </td></tr></table>
109          <div id="nts_help" class="hidden">
110            <div class="helptxt"><p> This will do a completely new text search with no constraints beyond the target of the
111            text search from the drop down list (All, Authors, Parameters) </p></div>
112          </div>
113          <div id="ns_help" class="hidden">
114            <div class="helptxt"><p> This will return you to the new search page</p></div>
115          </div>
116    </div>
117   
118    <div py:def="PageTabs(tabv)" id="PageTabs">
119        <div id="PageTabRow">
120            <ul>
121                <span py:for="tab in c.pageTabs">
122                    <?python
123                    linkto=True
124                    if tab[0] == tabv:
125                        status='current'
126                        linkto=False
127                    else: status='hidden'
128                    ?>
129                    <li class="$status"><span class="pagetab">
130                        ${XML(h.link_to_if(linkto,tab[0],tab[1]))}
131                    </span></li>
132                 </span>
133            </ul>
134        </div>
135        <div class="line"/>
136        <div class="clear"/>
137    </div>
138    <py if="c.UpdatePageTabs" py:replace="PageTabs(c.current)"/>
139
140    <!-- Page Footer follows -->
141    <div py:def="footer()" id="Footer">
142        <center><table><tbody>
143            <tr>
144                <td align="left" width="60%">
145                    <table><tbody>
146                    <tr><td><span py:replace="linkimage(g.ndgLink,g.ndgImage,'NDG')"/></td>
147                    <td> This portal is a product of the <a href="http://ndg.nerc.ac.uk"> NERC DataGrid</a>
148                    ${g.disclaimer} </td>
149                    </tr>
150                    </tbody></table>
151                </td>
152                <td>  This is where the RSS icon should go! </td>
153                <td width="40%" align="center">
154                    <div py:if="not g.standalone" id="loginStatus">
155                        <!--! now we choose one of the next two (logged in or not) -->
156                        <div py:if="'ndgSec' in session"><table><tbody><tr><td>
157                        User [${session['ndgSec']['u']}] logged in at
158                        ${session['ndgSec']['org']} with roles
159                        [${len(session['ndgSec']['roles'])==1 and session['ndgSec']['roles'][0] or ', '.join(session['ndgSec']['roles'])}]</td><td>
160                        &nbsp;<span py:replace="logOut()"/></td></tr></tbody></table></div>
161                        <div py:if="'ndgSec' not in session">Further services may be available if you can
162                            <span py:replace="logIn()"/></div>
163                    </div>
164                </td>
165                <td align="right"><span py:replace="linkimage(g.stfcLink,g.stfcImage,'Hosted by the STFC CEDA')"/></td>
166            </tr>
167        </tbody></table></center>
168    </div>
169   
170    <!-- Utility Functions follow -->
171   
172    <!-- hyperlinked image -->
173    <span py:def="linkimage(linkref,imageref,alttext)">
174        <a href="$linkref"><image src="$imageref" alt="$alttext" title="$alttext"/></a>
175    </span>
176   
177    <!-- Help Icons -->
178    <span py:def="helpIcon(value)">
179        <span>
180            <a href="javascript:;" title="Toggle help" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;">
181            <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a>
182     
183        </span>
184    </span>
185   
186    <!-- Login and out buttons --> 
187    <span py:def="logOut()" class="logOut">
188            <?python
189            from base64 import urlsafe_b64encode
190           
191            # Base 64 encode to enable passing around in 'r' argument of query
192            # string for use with login/logout
193            g.ndg.security.common.sso.state.returnToURL = str(c.requestURL)
194            g.ndg.security.common.sso.state.b64encReturnToURL = urlsafe_b64encode(c.requestURL)
195            ?>
196        <form action="$g.logout">
197            <input type="hidden" name="r" value="${g.ndg.security.common.sso.state.b64encReturnToURL}"/>
198            <input type="submit" value="Logout"/>
199        </form>
200    </span>
201   
202    <span py:def="logIn()" class="logIn">
203            <?python
204            from base64 import urlsafe_b64encode
205           
206            # Base 64 encode to enable passing around in 'r' argument of query
207            # string for use with login/logout
208            g.ndg.security.common.sso.state.returnToURL = str(c.requestURL)
209            g.ndg.security.common.sso.state.b64encReturnToURL = urlsafe_b64encode(c.requestURL)
210            ?>
211        <form action="$g.wayfuri">
212            <input type="hidden" name="r" value="${g.ndg.security.common.sso.state.b64encReturnToURL}"/>
213            <input type="submit" value="Login"/>
214        </form>
215    </span>
216   
217   
218   
219</html>
Note: See TracBrowser for help on using the repository browser.