source: TI07-MOLES/trunk/StubB/XSLT/browse/portal/cgi/renderPage.py @ 1140

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI07-MOLES/trunk/StubB/XSLT/browse/portal/cgi/renderPage.py@1140
Revision 1140, 4.5 KB checked in by lawrence, 14 years ago (diff)

Browse now supports incoming security cookies correctly
(I think)

Line 
1from htmlUtilities import *
2def fancybox(content):
3    ''' Provides a round cornered box '''
4    html='''<table cellSpacing="0" cellPadding="0" width="100%%" border="0">
5                  <tbody>
6                    <tr>
7                      <td>
8                        <div id="RecordCornersTop">
9                        <img height="11" alt="" src="/layout/record_top_right_corner.gif" width="11" align="right"/></div>
10                        <div id="RecordBox"><br/>%s</div>
11                        <div id="RecordCornersBot">
12                        <img height="11" alt="" src="/layout/record_bottom_right_corner.gif" width="11" align="right"/></div>
13                      </td>
14                    </tr>
15                  </tbody>
16                  </table>'''%content
17    return html
18         
19def renderPage(contentHTML,historyHTML,selectHTML,name,config):
20       
21        ''' Renders the content of a browse page, using information from the entity
22        and history rendering, and the config file. This routine has all the installation
23        dependent layout '''
24       
25        #Note layout images and stylesheets should be in the layout directory ...
26        #following should come from a config file
27        localLink=config.get('layout','localLink',None)
28        localImage=config.get('layout','localImage',None)
29        localAlt=config.get('layout','localAlt','Visit Local Site')
30        ndgLink=config.get('layout','ndgLink','http://ndg.nerc.ac.uk')
31        ndgImage=config.get('layout','ndgImage',None)
32        ndgAlt=config.get('layout','ndgAlt','Visit NDG')
33        PageLogo=config.get('layout','pageLogo',None)
34        selImage=config.get('layout','selectI',None)
35       
36        #set up search box form ...
37        searchBox='''
38            <form name="SEARCH" action="browse.py" method="get">
39            <input type="hidden" name="task" value="discovery"/>
40            <input type="hidden" name="dispSum" value="false"/>
41            <input type="hidden" name="search" value="text"/>
42            <input type="hidden" name="start" value="1"/>
43            <input type="hidden" name="orderInit" value=""/>
44            <input type="hidden" name="howmany" value="10"/>
45            <table border="0" cellspacing="0" cellpadding="1">
46            <tbody>
47              <tr><td align="center"><b>Discovery Search</b></td></tr>
48              <tr><td align="center"><input class="text" size="18" name="SEARCHSTRING"/></td></tr>
49              <tr><td align="center"><input class="Button" type="submit" value="GO" name="Submit"/></td></tr>
50            </tbody>
51            </table>
52            </form>'''
53       
54        #set up html header
55        html='''<?xml version="1.0" encoding="iso-8859-1"?>
56                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
57                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
58                <head>
59                  <meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1"/>
60                  <title>Browse: %s</title>
61                  <link media="all, screen" href="/layout/style.css" type="text/css" rel="stylesheet"/>
62                </head>'''%name
63                       
64        #now get the banner section
65        #note we have to escape the % ...
66        html+='''<body><div class="ndgHeader">
67            <table cellpadding="0" cellspacing="0" width="100%%">
68            <tbody><tr>
69            <td width="10%%" align="center" valign="middle">
70              <a href="%s"> <img src="%s" alt="%s"/> </a> </td>
71            <td width="80%%" align="center" valign="middle" >
72              <p>Browse Datasets</p></td>
73            <td width="10%%" align="center" valign="middle">
74              <a href="%s"> <img src="%s" alt="%s"/> </a> </td>
75            </tr>
76            </tbody></table></div>'''%(ndgLink,ndgImage,ndgAlt,localLink,localImage,localAlt)
77                       
78       
79        gotoA=image(selImage,'DataService')
80        #left column content
81        leftcol='''<div id="ndgSearchBox">%s</div>
82               <div id="HistoryBox"><h4>Browse History</h4>%s</div>
83               <div id="HistoryBox"><h4>%s Selected Items</h4>%s<br/></div>'''%(searchBox,historyHTML,gotoA,selectHTML)
84                       
85        #now layout the main parts of the page (importing relevant HTML)
86        html+='''
87          <div id="Main">
88            <div id="LeftColumn">
89            %s
90            </div>
91            <div id="Content">
92               <div style="CLEAR: none; LEFT: 0px; WIDTH: 98%%; TOP: 0px">
93               <div style="CLEAR: none; WIDTH: 98%%">
94                %s
95                </div>
96                </div> 
97              </div>
98              <div id="Footer">
99              <p> This portal is a pre-alpha release of NDG software. We expect bugs, and things
100              not to work, so please let us know about such problems (please email badc@rl.ac.uk, and include "NDG problem" in the subject line). We will be adding a help link
101              to this page when the interface is slightly more stable.</p> </div>
102            </div>     
103            </body>
104            </html>'''%(fancybox(leftcol),fancybox(contentHTML))
105               
106        return html
107               
108               
Note: See TracBrowser for help on using the repository browser.