Changeset 2688


Ignore:
Timestamp:
03/07/07 10:45:01 (12 years ago)
Author:
lawrence
Message:

Beginning to add the framework for an openlayer map,
but it's very incomplete ...

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
54 added
16 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/ndgMiddleware.py

    r2672 r2688  
    2727        self.globals.LeftLogo=cf.get('layout','HdrLeftLogo') 
    2828        self.globals.pageLogo="bodcHdr" 
     29        self.globals.icons_xml=cf.get('layout','Xicon') 
     30        self.globals.icons_prn=cf.get('layout','printer') 
     31        self.globals.icons_A=cf.get('NDG_A_SERVICE','icon') 
     32        self.globals.icons_B=cf.get('NDG_B_SERVICE','icon') 
    2933         
    3034        self.globals.discoveryURL=cf.get('SEARCH','discoveryURL') 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/retrieve.py

    r2675 r2688  
    66from ows_server.lib import mailer 
    77 
     8from xml.parsers.expat import ExpatError 
    89#from ows_server.models import ndgRetrieve 
    910 
     
    3536        ''' Returns the document unadorned in anyway, i.e. the raw xml''' 
    3637        status=self.__setup(uri) 
    37         if status: return Response(status) 
     38        if status: 
     39            c.xml='<p>%s</p>'%status 
     40            return render_response('error') 
    3841        status,x=ndgRetrieve.ndgRetrieve( 
    3942                self.uri,self.cf,logger=self.logger,requestor=self.requestor,format=self.format) 
     
    4144        if status: 
    4245            #(the return object x is an xmlHandler object) 
    43             xml=x.tohtml() 
    44             return Response(xml) 
     46            c.xml=x.tohtml() 
     47            return Response(c.xml) 
    4548        else: 
    4649            return Response(x)  
     
    4952        ''' Returns either an html marked up version of the xml, or a properly laid 
    5053        out version of the document ''' 
     54        c.doc=None 
    5155        status=self.__setup(uri) 
    52         if status: return Response(status) 
     56        if status: 
     57            c.xml='<p>%s</p>'%status  
     58            return render_response('error') 
    5359        if 'ndgSec' in session: 
    5460            securityTokens=session['ndgSec'] 
     
    5965                securityTokens=securityTokens) 
    6066        c.title='Viewing [%s]'%self.uri 
    61         c.icons_xml=self.cf.get('layout','Xicon') 
    62         c.icons_prn=self.cf.get('layout','printer') 
     67        
    6368         
    6469        if status: 
     
    9297                    c.xml=x.tohtml() 
    9398                    r='content' 
    94             f=file('debug.xml','w') 
    95             f.write(x.tohtml()) 
    96             f.close() 
    97             g=file('debug2.xml','w') 
    98             g.write(str(x)) 
    99             g.close()        
     99            #f=file('debug.xml','w') 
     100            #f.write(x.tohtml()) 
     101            #f.close() 
     102            #g=file('debug2.xml','w') 
     103            #g.write(str(x)) 
     104            #g.close()        
    100105        else:  
    101106            c.xml='<div class="error">%s</div>'%x 
    102             r='content' 
     107            r='error' 
    103108             
    104109        if status and 'ndgSec' in session: 
     
    115120            session.save() 
    116121        
    117         return render_response(r) 
     122        if r=='content': 
     123            #we're showing an xml document ... but it could go wrong if 
     124            #we have crap content ... 
     125            try: 
     126                resp=render_response(r) 
     127            except ExpatError,e: 
     128                c.xml='<p> XML content is not well formed </p>' 
     129                c.doc=str(x) 
     130                resp=render_response('error') 
     131        else: 
     132            resp=render_response(r) 
     133        return resp 
    118134     
    119135    def askCorrect(self,uri): 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/People2.py

    r2672 r2688  
    9292        ''' Return hyperlink to centre '''  
    9393        if self['url']<>'': 
     94                if self['url'][0:4]<>'http': self['url']='http://%s'%sef['url'] 
    9495                u=hyperlink(self['sname'],self['url']) 
    9596        else: u=self['sname'] 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/ndgObject.py

    r2681 r2688  
    4444        if not ok: 
    4545            # after all that, we don't think it's an NDG URI ... 
    46             raise ValueError,'URI [%s] is not a valid NDG style URI'%uri 
     46            raise ValueError,'The identifier [%s] is not a valid NDG style URI'%uri 
    4747        else: 
    4848            # yes, it is an NDG URI ... 
     
    5858            # This NDG object may itself be a discovery record, which makes life easy, but 
    5959            # it might not be, in which case we have to build up all the possible views upon it. 
    60             discoveryBASE='%s/view/%s__%s__%s'%( 
    61                 self.config.get('DISCOVERY','default'),self.repository,self.schema,self.localID) 
     60            server=self.config.get('DISCOVERY','default') 
     61            discoveryBASE='%s/view/%s__%s__%s'%(server,self.repository,self.schema,self.localID) 
    6262            fmt=self.config.get('DISCOVERY','formatDefault','DIF') 
    6363            # We'll build the following even if it can't be used (as would be the case for 
    6464            # a non data entity B record or an A record) because it's a useful template. 
    6565            self.discoveryURL=discoveryBASE 
     66            servicehost=self.config.get('NDG_B_SERVICE',self.repository,'unknown') 
    6667            # If this record is itself a discovery record, then we don't have much more to do 
    6768            if self.schema in ['DIF','DC','MDIP','ISO19139']: 
     
    7576                # understood by the ndg exist interface 
    7677                blank=self.config.get('NDG_B_SERVICE','instance') 
    77                 servicehost=self.config.get('NDG_B_SERVICE',self.repository,'unknown') 
    7878                url=blank.replace('SERVICEHOST',servicehost) 
    7979                url=url.replace('URI',self.uri) 
     
    9090        if self.schema!='NumSim' and self.gettable<>-1: 
    9191            self.BURL=self.URL.replace(self.schema,'NDG-B1') 
     92            self.BURL=self.BURL.replace(server,servicehost) 
    9293        else: 
    9394            self.BURL=None 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/stubB.py

    r2654 r2688  
    123123        plist=wrapGetText(self.elem,'dgDataSummary/dgParameterSummary/ParameterName',multiple=1) 
    124124        self.parameters=collapse2(plist,split='/') 
    125         print self.parameters 
     125         
    126126         
    127127    def getGranules(self): 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/xmlHandler2.py

    r2672 r2688  
    3636         
    3737        if xmlf is None:  
    38             xmlf=StringIO.StringIO(self.xmls.encode('utf-8')) 
     38            xmlf=StringIO.StringIO(self.xmls) # StringIO is supposed to be unicode! .encode('utf-8')) 
    3939        
    4040        try: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/layout/ndg2.css

    r2680 r2688  
    6060#contentsRight  {border-left: 1px solid #3c78b5; margin-left:250px;} 
    6161 
    62  
     62.error {display:block;text-align:center;font-size:150%;background-color:red; padding:10px;} 
    6363 
    6464/* The following is the css associated with pretty printing xml */ 
     
    110110.cellhead { font-size: 100%; font-weight: bold;}  
    111111 
    112  
     112#map {width:400px; height:250px; border: 1px solid black;} 
     113/* .map {width:300px;height:250px;border:0;padding:0;margin:0;overflow:hidden;}*/ 
    113114/* NumSim */ 
    114115 
     
    139140.SearchSource {padding:0 0 0 60px;} 
    140141.SearchSubmit {padding:30px 0 20px 60px;} 
    141 .map {width:300px;height:250px;border:0;padding:0;margin:0;overflow:hidden;} 
    142 .helptxt {font-size:smaller; } 
     142 
     143.helptxt {font-size:smaller; background-color:yellow;} 
    143144 
    144145/* And now the footer */ 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/advanced.kid

    r2672 r2688  
    11<html py:extends="'ndgPage.kid'" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22    <!-- provides the main introduction and "advanced" search page --> 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(1)"/> 
    44    <body> 
    55    <div id="entirepage"> 
     
    99        <div class="outer"> 
    1010            <div class="inner"> 
    11                 <form action="$c.discoveryURL"> 
     11                <form action="$c.discoveryURL" name="discoForm"> 
    1212                <div class="float-wrap"> 
    1313                    <div id="AdvContent">  
     
    6969                        <tr> 
    7070                        <td colspan="3"> 
     71                        <div id="map"></div> 
     72                            <script type="text/javascript"> 
     73                                var app=null; 
     74                                function init(){ 
     75                                    app=new OLMapBox('map','discoForm','selectionForm','/control') 
     76                                    } 
     77                            </script> 
     78                            <!--<script defer="defer" type="text/javascript"> 
     79                                var map = new OpenLayers.Map('map'); 
     80                                var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
     81                                    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 
     82                                map.addLayer(wms); 
     83                                map.zoomToMaxExtent(); 
     84                            </script>--> 
     85                            <!--                      
    7186                            <iframe src="http://grid.bodc.nerc.ac.uk/maps/data/ndg_portal/geosearch/viewer.htm"  
    7287                                id="map" width="450" height="375" name='NDG_SEARCH' scrolling='no'> 
    73                             </iframe><br/>&nbsp; 
     88                            </iframe><br/>&nbsp;--> 
    7489                            <div id="spacov_help" class="hidden helptxt"> 
    7590                                <p> All datasets which have some data within the bounding box will be returned </p> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/content.kid

    r2672 r2688  
    11<html py:extends="'ndgPage.kid'" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(0)"/> 
    44    <body> 
    55    <div id="entirepage"> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/csml.kid

    r2643 r2688  
    11<html py:extends="'ndgPage.kid'" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(0)"/> 
    44    <body> 
    55    <div id="entirepage"> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/dif.kid

    r2680 r2688  
    11<html py:extends="ndgPage.kid,meta.kid" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(0)"/> 
    44    <body> 
    55    <div id="entirepage"> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/meta.kid

    r2680 r2688  
    2828            --> 
    2929            <tr py:if="c.doc.ndgObject is not None"> 
    30             <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,c.icons_xml,'[XML]')"/></td> 
     30            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.xmlURL,g.icons_xml,'[XML]')"/></td> 
    3131            <td>Downloadable XML version of this record 
    3232            <span py:if="c.doc.ndgObject.gettable==1"> 
    33             (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&amp;original=1',c.icons_xml,'[XML]')"/>) 
     33            (Original <span py:replace="linkimage(c.doc.ndgObject.xmlURL+'&amp;original=1',g.icons_xml,'[XML]')"/>) 
    3434            </span></td></tr> 
    3535            <tr py:if="c.doc.ndgObject is not None"> 
    36             <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,c.icons_prn,'[HTML]')"/></td> 
     36            <td width="20%"><span py:replace="linkimage(c.doc.ndgObject.printableURL,g.icons_prn,'[HTML]')"/></td> 
    3737            <td>Viewable XML version of this record 
    3838             <span py:if="c.doc.ndgObject.gettable==1"> 
    39             (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&amp;original=1',c.icons_prn,'[HTML]')"/>) 
     39            (Original <span py:replace="linkimage(c.doc.ndgObject.printableURL+'&amp;original=1',g.icons_prn,'[HTML]')"/>) 
    4040            </span></td></tr> 
    41             <tr py:if="c.doc.ndgObject.gettable==1"><td></td><td>(Original records are the raw material harvested from data providers)</td></tr> 
     41            <span py:if="c.doc.ndgObject.gettable==1"> 
     42                <tr><td></td><td>(Original records are the raw material harvested from data providers)</td></tr> 
     43                <tr><td><span py:replace="linkimage(c.doc.ndgObject.BURL,g.icons_B,'[NDG-BROWSE]')"/> 
     44                </td><td> NERC DataGrid Browse Metadata Record (should provide more information)</td></tr> 
     45            </span> 
    4246        </tbody></table> 
    4347    </div> <!-- ServiceList --> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/ndgPage.kid

    r2675 r2688  
    44    <!-- HTML Header and Document header follow --> 
    55     
    6     <head py:def="pagehead()"> 
     6    <head py:def="pagehead(ol)"> 
    77        <title py:content="c.title">title</title> 
    88        <!--! The following includes the javascript, note that the XML 
    99        function is needed to avoid escaping the < character --> 
    1010        ${XML(h.javascript_include_tag(builtins=True))} 
    11         <script type="text/javascript" src="/layout/toggleDiv.js"></script> 
     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"/> 
    1215        <link media="all, screen" href="/layout/ndg2.css" type="text/css" rel="stylesheet"/> 
    1316    </head> 
     
    3538            </select> 
    3639            <input type="submit" value="Search"/> 
    37             </form></td><td/><td align="right"><span py:if="'ndgSec' in session" id="loginBar"> 
     40            </form></td><td/><td align="right"> 
     41 
     42            <span py:if="'ndgSec' in session" id="loginBar"> 
    3843            <span py:replace="logOut()"/></span> 
    3944            <span py:if="'ndgSec' not in session" id="loginBar"> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/numsim.kid

    r2654 r2688  
    11<html py:extends="'ndgPage.kid',NSfunctions.kid" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(0)"/> 
    44    <body> 
    55        <div py:replace="header()"/> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/stubB.kid

    r2675 r2688  
    11<html py:extends="ndgPage.kid,meta.kid" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22 
    3     <head py:replace="pagehead()"/> 
     3    <head py:replace="pagehead(0)"/> 
    44    <body> 
    55    <div id="entirepage"> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/wayf.kid

    r2639 r2688  
    11<html py:extends="'ndgPage.kid'" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    2     <head py:replace="pagehead()"/> 
     2    <head py:replace="pagehead(0)"/> 
    33    <body> 
    44        <div py:replace="header()"/> 
Note: See TracChangeset for help on using the changeset viewer.