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

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

A large number of small modifications to browse
dealing with a range of bugs ...

RevLine 
[1023]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         
[828]19def renderPage(contentHTML,historyHTML,selectHTML,name,config):
[813]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 ...
[814]26        #following should come from a config file
[828]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)
[1023]34        selImage=config.get('layout','selectI',None)
[993]35       
36        #set up search box form ...
37        searchBox='''
[1023]38            <form name="SEARCH" action="browse.py" method="get">
[1006]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"/>
[993]45            <table border="0" cellspacing="0" cellpadding="1">
46            <tbody>
[1020]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>
[993]50            </tbody>
51            </table>
[1006]52            </form>'''
[813]53       
54        #set up html header
[1006]55        html='''<?xml version="1.0" encoding="iso-8859-1"?>
[825]56                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
[1006]57                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
[993]58                <head>
[1006]59                  <meta http-equiv="Content-Type" content="text/xhtml; charset=iso-8859-1"/>
[993]60                  <title>Browse: %s</title>
[1006]61                  <link media="all, screen" href="/layout/style.css" type="text/css" rel="stylesheet"/>
[993]62                </head>'''%name
[813]63                       
[993]64        #now get the banner section
[814]65        #note we have to escape the % ...
[1182]66       
67        banner='''   
[993]68            <table cellpadding="0" cellspacing="0" width="100%%">
[1006]69            <tbody><tr>
70            <td width="10%%" align="center" valign="middle">
71              <a href="%s"> <img src="%s" alt="%s"/> </a> </td>
72            <td width="80%%" align="center" valign="middle" >
73              <p>Browse Datasets</p></td>
74            <td width="10%%" align="center" valign="middle">
75              <a href="%s"> <img src="%s" alt="%s"/> </a> </td>
[993]76            </tr>
[1182]77            </tbody></table>'''%(ndgLink,ndgImage,ndgAlt,localLink,localImage,localAlt)
78        html+='<body><div class="ndgHeader">%s</div>'%banner
79        #html+='<body>'+fancybox(banner)               
[1023]80       
81        gotoA=image(selImage,'DataService')
82        #left column content
83        leftcol='''<div id="ndgSearchBox">%s</div>
84               <div id="HistoryBox"><h4>Browse History</h4>%s</div>
85               <div id="HistoryBox"><h4>%s Selected Items</h4>%s<br/></div>'''%(searchBox,historyHTML,gotoA,selectHTML)
86                       
87        #now layout the main parts of the page (importing relevant HTML)
[813]88        html+='''
[1006]89          <div id="Main">
90            <div id="LeftColumn">
[1023]91            %s
92            </div>
[1006]93            <div id="Content">
[1182]94               <div style="CLEAR: none; LEFT: 0px; WIDTH: 100%%; TOP: 0px">
95               <div style="CLEAR: none; WIDTH: 100%%">
[1023]96                %s
[1006]97                </div>
98                </div> 
99              </div>
[1140]100              <div id="Footer">
101              <p> This portal is a pre-alpha release of NDG software. We expect bugs, and things
102              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
103              to this page when the interface is slightly more stable.</p> </div>
[1006]104            </div>     
[993]105            </body>
[1023]106            </html>'''%(fancybox(leftcol),fancybox(contentHTML))
[813]107               
108        return html
109               
110               
Note: See TracBrowser for help on using the repository browser.