source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ndgPage.kid @ 2865

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ndgPage.kid@2865
Revision 2865, 9.3 KB checked in by spascoe, 12 years ago (diff)

First glimpse of visualise working.

It's not connected to the selection control yet. You need to explicitly
give it a granuleURI, featureId and time point. The form is populated with
an example.

Update is controlled from the ndgPage.kid:updateVis() function
which calls VisMapBox?.js:VisApp.updateVisLayer().

Note it won't work unless the data is visible at the location in the CSML (/badc/ipcc-ddc/... in the example).

I can see the WMS isn't drawing tiles correctly at high longitudes. (New Zealand gets a raw deal again :-) ).

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(ol)">
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="/js/toggleDiv.js"/>
12        <script py:if="ol==1" src="/js/OpenLayers.js"/>
13        <script py:if="ol==1" src="/js/openlayers-x.js"/>
14        <script py:if="ol==1" src="/js/OLMapBox.js"/>
15
16        <!--! At some stage we should put this as a separate option -->
17        <script py:if="ol==1" src="/js/VisMapBox.js"/>
18
19        <link media="all, screen" href="/layout/ndg2.css" type="text/css" rel="stylesheet"/>
20
21        <script type="text/javascript">
22          var app = null;
23          function initOLMapBox() {
24            app = new OLMapBoxApp('map','discoForm', 440, 10);
25          }
26
27          function initVisMapBox() {
28            app = new VisApp('visMap', 'visForm', 600, 10);
29          }
30
31          function updateVis(formId) {
32              var form = $(formId);
33              form.granuleURI.value, form.featureId.value, form.time.value
34              var wmsURL = "${h.url_for(controller='csml_wms', uri='')}" + form.granuleURI.value;
35              app.updateVisLayer(wmsURL, form.featureId.value, form.time.value);
36          }
37
38        </script>
39
40
41    </head>
42
43    <div py:def="header1(searchBox)">
44        <div id="header"/>
45        <div id="logo"><img src="$g.LeftLogo" alt="$g.LeftAlt" /></div>
46    </div>
47   
48    <div py:def="header()">
49        <div id="header"/>
50        <div id="logo"><img src="$g.LeftLogo" alt="$g.LeftAlt" /></div>
51    </div>
52   
53    <!-- One line search box for top of many pages follows -->
54   
55    <div py:def="searchOneLine()" class="searchBar">
56        <table width="100%"><tr><td align="left">
57        <form action="$g.discoveryURL">
58            New Text Search<span py:replace="helpIcon('nts_help')"/>&nbsp;
59            <input type="text" size="25" name="searchString"/>
60            <select name="textTarget">
61            <option value="Authors">Authors</option>
62            <option value="All" selected="selected">All</option>
63            <option value="Params">Parameters</option>
64            </select>
65            <input type="submit" value="Search"/>
66         </form>
67         </td><!--<td align="right">
68         <form action="$g.discoveryURL">
69            <input type="submit" value="New Search"/>
70            <span py:replace="helpIcon('ns_help')"/>
71         </form>
72         </td>--><td align="right">
73            <span py:if="'ndgSec' in session" id="loginBar">
74            <span py:replace="logOut()"/></span>
75            <span py:if="'ndgSec' not in session" id="loginBar">
76            <span py:replace="logIn()"/></span>
77        </td></tr></table>
78          <div id="nts_help" class="hidden">
79            <div class="helptxt"><p> This will do a completely new text search with no constraints beyond the target of the
80            text search from the drop down list (All, Authors, Parameters) </p></div>
81          </div>
82          <div id="ns_help" class="hidden">
83            <div class="helptxt"><p> This will return you to the new search page</p></div>
84          </div>
85    </div>
86   
87    <div py:def="PageTabs(tabv)" id="PageTabs">
88        <div id="PageTabRow">
89            <ul>
90                <span py:for="tab in c.pageTabs">
91                    <?python
92                    linkto=True
93                    if tab[0] == tabv:
94                        status='current'
95                        linkto=False
96                    else: status='hidden'
97                    ?>
98                    <li class="$status"><span class="pagetab">
99                        ${XML(h.link_to_if(linkto,tab[0],tab[1]))}
100                    </span></li>
101                 </span>
102                <!--<li py:for="i in enumerate()" class="${status[i[0]]}">
103                    <span class="pagetab">${i[1]}</span>
104                </li>-->
105                <!--    <li class="${status[i[0]]}">
106                        <span class="pagetab"> ${i[1]}</span>
107                    </li>
108                    <li> $i </li>
109                </span>-->
110            </ul>
111        </div>
112        <div class="line"/>
113        <div class="clear"/>
114    </div>
115    <py if="c.UpdatePageTabs" py:replace="PageTabs(c.current)"/>
116
117    <!-- History and Shopping Cart follow -->
118
119    <div py:def="leftpanel()" id="Left">
120            <div py:if="session['panelView']=='History'">
121                <div class="tabhdr">
122                    <ul>
123                        <li class="current"> <span class="tabhdri">History</span></li>
124                        <li class="hidden"><span class="tabhdri">${XML(h.link_to_remote("Selected",dict(update="Left", url=h.url_for(controller="tabs", action="update",value="Selection"))))}</span></li>
125                    </ul>
126                </div>
127                <div class="tabcontent">
128                   <p> Dataset History </p> 
129                   <ul py:if="'history' in session">
130                        <li py:for="item in session['history']">
131                        ${XML(h.link_to(item[0],item[1]))}</li>
132                   </ul>
133                </div>
134            </div>
135            <div py:if="session['panelView']=='Selection'">
136                <div class="tabhdr">
137                    <ul>
138                    <li class="hidden"><span class="tabhdri">${XML(h.link_to_remote("History",dict(update="Left", url=h.url_for(controller="tabs", action="update",value="History"))))}</span></li>
139                    <li class="current"><span class="tabhdri">Selection</span></li>
140                    </ul>
141                </div>
142                <div class="tabcontent">
143                    <p> Selected Datasets </p> 
144                    <ul py:if="'selection' in session">
145                        <li py:for="item in session['selection']">
146                        ${XML(h.link_to(item[1],item[0]))}</li>
147                    </ul>
148                    ${XML(h.link_to_remote("Clear",dict(update="Left", url=h.url_for(controller="tabs", action="clear",value="Selection"))))}
149                </div>
150            </div>
151    </div>
152   
153    <!-- Page Footer follows -->
154
155    <div py:def="footer()" id="Footer">
156        <center><table><tbody>
157            <tr>
158                <td align="center" width="60%">
159                    <table><tbody>
160                    <tr><td><span py:replace="linkimage(g.ndgLink,g.ndgImage,'NDG')"/></td>
161                    <td> This portal is a product of the <a href="http://ndg.nerc.ac.uk"> NERC DataGrid</a>
162                    Not all functionality is completely implemented, bugs and problems are expected </td>
163                    </tr>
164                    </tbody></table>
165                </td>
166                <td width="40%" align="center">
167                    <div id="loginStatus">
168                        <!--! now we choose one of the next two (logged in or not) -->
169                        <div py:if="'ndgSec' in session"><table><tbody><tr><td> User [${session['ndgSec']['u']}] logged in
170                        at [${session['ndgSec']['h']}] with roles [${len(session['ndgSec']['roles'])==1 and session['ndgSec']['roles'][0] or ', '.join(session['ndgSec']['roles'])}]</td><td>
171                        &nbsp;<span py:replace="logOut()"/></td></tr></tbody></table></div>
172                        <div py:if="'ndgSec' not in session">Further services maybe available if you can
173                            <span py:replace="logIn()"/></div>
174                    </div>
175                </td>
176                <td><span py:replace="linkimage(g.stfcLink,g.stfcImage,'Hosted by the STFC CEDA')"/></td>
177            </tr>
178        </tbody></table></center>
179    </div>
180   
181    <!-- Utility Functions follow -->
182   
183    <!-- hyperlinked image -->
184    <span py:def="linkimage(linkref,imageref,alttext)">
185        <a href="$linkref"><image src="$imageref" alt="$alttext" title="$alttext"/></a>
186    </span>
187   
188    <!-- Help Icons -->
189    <span py:def="helpIcon(value)">
190        <span>
191            <a href="javascript:;" title="Toggle help" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;">
192            <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a>
193     
194        </span>
195    </span>
196   
197    <!-- Login and out buttons -->   
198    <span py:def="logOut()" class="logOut">
199            <?python
200            # Encode the return URL to avoid problems parsing URLs with multiple
201            # ?'s - for example one in the URL and one in the value for 'r'
202            from base64 import urlsafe_b64encode
203            b64encRequestURL = urlsafe_b64encode(c.requestURL)
204            ?>
205        <form action="$g.logout">
206            <input type="hidden" name="r" value="${b64encRequestURL}"/>
207            <input type="submit" value="Logout"/>
208        </form>
209    </span>
210   
211    <span py:def="logIn()" class="logIn">
212            <?python
213            # Encode the return URL to avoid problems parsing URLs with multiple
214            # ?'s - for example one in the URL and one in the value for 'r'
215            from base64 import urlsafe_b64encode
216            b64encRequestURL = urlsafe_b64encode(c.requestURL)
217            ?>
218        <form action="$g.wayfuri">
219            <input type="hidden" name="r" value="${b64encRequestURL}"/>
220            <input type="submit" value="Login"/>
221        </form>
222    </span>
223   
224   
225   
226</html>
Note: See TracBrowser for help on using the repository browser.