Changeset 3842 for TI05-delivery


Ignore:
Timestamp:
01/05/08 16:57:51 (11 years ago)
Author:
spascoe
Message:

Various changes needed for compatibility with proxy configurations.

The URL encoding of selectItems/addSelectedItems has been overhalled
because it didn't work behind a proxy and had bugs anyway. Relative paths
in kid files have had $g.server added where appropriate.

Location:
TI05-delivery/ows_framework/trunk/ows_server
Files:
9 edited

Legend:

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

    r3417 r3842  
    1111# the following is the server on which this browse/discovery instance runs! 
    1212#server:         http://localhost 
    13 server:         http://localhost:8080 
     13#server:       http://superglue.badc.rl.ac.uk:8083 
     14## This is the proxied server root 
     15server: http://superglue.badc.rl.ac.uk/ndg-test 
    1416 
    1517# 
     
    2224# this is the physical file location of the layout directory on this machine  
    2325#  
    24 layoutdir:      /home/bnl/sandboxes/ndg/TI07-MOLES/trunk/PythonCode/wsgi/ 
     26layoutdir:      /usr/local/ows_server_deployment/layout 
    2527# 
    2628# this should never be changed 
    2729# 
    28 layout:         /layout/ 
    29 icondir:        /layout/icons/ 
    30 # 
    31 mailserver:       outbox.rl.ac.uk 
     30##!NOTE: These are changed to  reflect the proxy prefix 
     31layout:         /ndg-test/layout/ 
     32icondir:        /ndg-test/layout/icons/ 
     33# 
     34mailserver:       xxxoutbox.rl.ac.uk 
    3235metadataMaintainer: b.n.lawrence@rl.ac.uk 
    33 repository:       http://localhost:8080 
     36repository:        %(server)s 
    3437tbrecipient:      b.n.lawrence@rl.ac.uk 
    3538 
     
    4851[layout] 
    4952###### user customisable: 
    50 localLink:      http://ndg.nerc.ac.uk/ 
     53localLink:      http://superglue.badc.rl.ac.uk/ndg-test/ 
    5154localImage:     %(layout)sndg_logo_circle.gif 
    5255localAlt:       visit badc 
    5356###### ought to be the end of the customisations 
    54 ndgLink:        http://ndg.nerc.ac.uk/ 
     57ndgLink:        http://superglue.badc.rl.ac.uk/ndg-test/ 
    5558ndgImage:       %(layout)sndg_logo_circle.gif 
    5659ndgAlt:         visit ndg 
     
    136139# This is an application certificate ... (which may be a machine certificate) 
    137140# X.509 certificate sent with outbound signed messages 
    138 wssCertFilePath: secpem/Junk-cert.pem 
     141wssCertFilePath: ./certs/Junk-cert.pem 
    139142 
    140143# Private key used to sign messages 
    141144# This is an application certificate ... (which may be a machine certificate) 
    142 wssKeyFilePath: secpem/Junk-key.pem 
     145wssKeyFilePath: ./certs/Junk-key.pem 
    143146 
    144147# Password for private key - comment out if the file is not password protected 
     
    147150# Space separated list of CA cert. files to validate certs against when 
    148151# verifying responses 
    149 wssCACertFilePathList: secpem/cacert.pem 
     152wssCACertFilePathList: ./certs/cacert.pem 
    150153 
    151154# SSL Connections 
     
    154157# must verify against at least one of these otherwise the connection is  
    155158# dropped. 
    156 sslCACertFilePathList: secpem/cacert.pem 
     159sslCACertFilePathList: ./certs/cacert.pem 
    157160 
    158161# Set an alternate CommonName to match with peer cert for SSL 
     
    168171 
    169172# verification of X.509 cert back to CA 
    170 acCACertFilePathList: secpem/cacert.pem 
     173acCACertFilePathList: ./secpem/cacert.pem 
    171174 
    172175[RELATED] 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/config/routing.py

    r3659 r3842  
    4747    map.connect('viewItems',controller='viewItems',action='index') 
    4848    map.connect('removeViewItem',controller='viewItems',action='index') 
    49     map.connect('addSelectedItem/:entryid/:kmlurl/:wmcurl/:title/:divid', 
    50                 controller='selectedItems',action='addSelectedItem',kmlurl='',wmcurl='') 
     49    map.connect('addSelectedItem/:entryid/:divid', 
     50                controller='selectedItems',action='addSelectedItem') 
    5151    map.connect('unSelectItem/:entryid/:divid', controller='selectedItems',action='unSelectItem') 
    5252    map.connect('removeSelectedItem/:entryid',controller='selectedItems',action='removeSelectedItem') 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/selectedItems.py

    r3701 r3842  
    1919import copy 
    2020import urllib 
     21 
     22import logging 
     23log = logging.getLogger(__name__) 
    2124 
    2225class SelecteditemsController(BaseController): 
     
    5558                wmcURLs = [] 
    5659                for item in session['selectedItems']: 
     60                    log.debug('SelectedItem: kmlList = %s, wmcList = %s' % ( 
     61                        `item.kmlList`, `item.wmcList`)) 
     62 
    5763                    if (item.wmcURL): 
    5864                        wmcURLs.append(item.wmcURL) 
     
    130136         
    131137     
    132     def addSelectedItem(self,entryid,kmlurl,wmcurl,title,divid): 
     138    def addSelectedItem(self,entryid,divid): 
    133139        """ 
    134140        Add a selected item to the session 
    135141        - if this is the first item, then display the selections tab 
    136142        @param entryid: Entry ID of related DIF record 
    137         @param kmlurl: Endpoint of KML doc relating to selected item, if it exists 
    138         @param wmcurl: WMC Endpoint of selected item, if it exists 
    139         @param title: Title of selected item 
    140143        @param divid: The div ID relating to the selected item in the results tab      
    141144        """ 
    142          
     145 
     146        # URLs are unsafe to be added to the URL path_info so get them from the query_string 
     147        kmlurl = request.params['kmlurl'] 
     148        wmcurl = request.params['wmcurl'] 
     149        title = request.params['title'] 
     150 
     151        log.debug('addSelectedItem(%s, %s, %s, %s, %s)' % ( 
     152            `entryid`, `kmlurl`, `wmcurl`, `title`, `divid`)) 
     153 
    143154        item = selectedItem.SelectedItem(entryid, title, kmlurl, wmcurl) 
     155 
     156        log.debug('SelectedItem: kmlList = %s, wmcList = %s' % ( 
     157            `item.kmlList`, `item.wmcList`)) 
    144158         
    145159        selections = [item,] 
     
    225239                                               action="addSelectedItem", 
    226240                                               entryid=deletedItem.entryID, 
    227                                                kmlurl=urllib.quote(str(deletedItem.kmlURL),''), 
    228                                                wmcurl=urllib.quote(str(deletedItem.wmcURL),''), 
     241                                               kmlurl=deletedItem.kmlURL, 
     242                                               wmcurl=deletedItem.wmcURL, 
    229243                                               title=deletedItem.title, 
    230244                                               divid=divid))) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/DIF.py

    r3661 r3842  
    188188            # via AJAX  
    189189            if contentType.find('KML') > 0: 
    190                 # NB, adding the '' to quote forces forward slashes to be replaced 
    191                 # with unicode equivalent 
    192                 self.kmlURL.append(urllib.quote(serviceURL,'')) 
     190                # NB, adding the '%' to quote forces forward slashes to be replaced 
     191                # with unicode equivalent but doesn't escape escape sequences. 
     192                self.kmlURL.append(urllib.quote(serviceURL,'%')) 
    193193            elif contentType.find('WEB MAP CONTEXT') > 0: 
    194                 self.wmcURL.append(urllib.quote(serviceURL,'')) 
     194                self.wmcURL.append(urllib.quote(serviceURL,'%')) 
    195195                 
    196196        if self.ndgObject is None: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/Utilities.py

    r3605 r3842  
    129129 
    130130def EnumerateString(string): 
    131     ''' Takes a string, and if it's got a number on the end, increments it, 
     131    """ Takes a string, and if it's got a number on the end, increments it, 
    132132    otherwise adds a number on the end, used to differentiate strings which 
    133     would otherwise be identical ''' 
     133    would otherwise be identical """ 
    134134    def addNum(matchObj): 
    135135        s=matchObj.group() 
     
    200200         
    201201 
     202def urlListEncode(urlList): 
     203    """ 
     204    Encode a list of URLs so that they can be embedded in another URL 
     205    """ 
     206    return '|'.join(urllib.quote(x, '%') for x in urlList) 
     207 
     208def urlListDecode(string): 
     209    """ 
     210    Decode an encoded list of URLs. 
     211    """ 
     212    return [urllib.unquote(x) for x in string.split('|')] 
     213 
     214     
    202215         
    203216import unittest 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/selectedItem.py

    r3701 r3842  
    1111 
    1212from ows_server.models import Utilities 
     13import logging 
    1314 
     15log = logging.getLogger(__name__) 
    1416            
    1517class SelectedItem: 
     
    2325        @param wmcURL: WMC Endpoint of selected item, if it exists     
    2426        """ 
     27         
    2528        self.entryID = entryID 
    2629        self.title = title 
    2730        self.kmlURL = kmlURL 
    2831        self.wmcURL = wmcURL 
    29         self.kmlList = Utilities.recreateListFromUnicode(kmlURL) 
    30         self.wmcList = Utilities.recreateListFromUnicode(wmcURL) 
    31              
     32        #self.kmlList = Utilities.recreateListFromUnicode(kmlURL) 
     33        #self.wmcList = Utilities.recreateListFromUnicode(wmcURL) 
     34        if kmlURL: 
     35            self.kmlList = Utilities.urlListDecode(kmlURL) 
     36        else: 
     37            self.kmlList = [] 
     38        if wmcURL: 
     39            self.wmcList = Utilities.urlListDecode(wmcURL) 
     40        else: 
     41            self.wmcList = [] 
     42 
     43 
     44        log.debug('SelectedItem: kmlURL = %s, wmcURL = %s, kmlList = %s, wmcList = %s' % 
     45                  tuple(repr(x) for x in (self.kmlURL, self.wmcURL, self.kmlList, self.wmcList))) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/layout/ndg2.css

    r3700 r3842  
    2121/* Top Banner Div */ 
    2222 
     23/* 
     24 * !WARNING: the background image needs setting to match any proxy configuration. 
     25 */ 
     26 
    2327#header { 
    2428 height: 100px; 
     
    2731 border: solid #333333; 
    2832 border-width: 0 0 2px 0; 
    29  background-image:url(/layout/header_image.jpg);background-position:right;background-repeat:repeat-x;} 
     33 background-image:url(/ndg-test/layout/header_image.jpg);background-position:right;background-repeat:repeat-x;} 
    3034 
    3135#logo{ 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/meta.kid

    r3644 r3842  
    11<!-- This is a bunch of named functions for using when displaying metadata --> 
     2<?python 
     3 
     4from ows_server.models.Utilities import urlListEncode 
     5 
     6?> 
     7 
    28<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    39 
     
    200206            </td> 
    201207            <!-- check if the DIF has already been selected --> 
    202                         <?python  
     208            <?python  
    203209                selected=False 
    204210                select_td_id='select_td_id_%s'%d.entryID  
     
    207213                        if item.entryID == d.entryID: 
    208214                                        selected=True 
     215                select_url = h.url_for(controller="selectedItems", 
     216                                       action="addSelectedItem", 
     217                                       entryid=d.entryID, 
     218                                       divid=select_td_id, 
     219                                       kmlurl = urlListEncode(d.kmlURL), 
     220                                       wmcurl = urlListEncode(d.wmcURL), 
     221                                       title = d.name) 
     222 
    209223            ?> 
    210224                         
     
    222236                        ${XML(h.link_to_remote("Select", 
    223237                                        dict(update=select_td_id, 
    224                                                  url=h.url_for(controller="selectedItems", 
    225                                                                    action="addSelectedItem", 
    226                                                                    entryid=d.entryID, 
    227                                                                    kmlurl=d.kmlURL, 
    228                                                                    wmcurl=d.wmcURL, 
    229                                                                    title=d.name, 
    230                                                                    divid=select_td_id))))} 
     238                                             url=select_url 
     239                                             )))} 
    231240                </span> 
    232241            </td> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/viewItems.kid

    r3700 r3842  
    11<html py:extends="'ndgPage.kid','meta.kid'" xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 
    22<head> 
    3 <link type="text/css" rel="stylesheet" href="/layout/ddc_style.css"/> 
    4 <link type="text/css" rel="stylesheet" href="/layout/ddc_vis.css"/> 
     3<link type="text/css" rel="stylesheet" href="$g.server/layout/ddc_style.css"/> 
     4<link type="text/css" rel="stylesheet" href="$g.server/layout/ddc_vis.css"/> 
    55 
    66<!-- BEGIN: Yahoo Interface Library --> 
    77<link type="text/css" rel="stylesheet" 
    8         href="/js/yui/treeview/assets/skins/sam/treeview.css"/>  
     8        href="$g.server/js/yui/treeview/assets/skins/sam/treeview.css"/>  
    99          
    1010<!-- Dependency source files -->   
    11 <script src = "js/yui/yahoo/yahoo-min.js" ></script>  
    12 <script src = "js/yui/event/event-min.js" ></script>  
     11<script src = "$g.server/js/yui/yahoo/yahoo-min.js" ></script>  
     12<script src = "$g.server/js/yui/event/event-min.js" ></script>  
    1313   
    1414<!-- TreeView source file -->   
    15 <script src = "js/yui/treeview/treeview-min.js" ></script>  
     15<script src = "$g.server/js/yui/treeview/treeview-min.js" ></script>  
    1616 
    1717<!-- TreeView Menu Style --> 
    18 <link rel="stylesheet" type="text/css" href="/js/yui/treeview/assets/treeview-menu.css"/>  
     18<link rel="stylesheet" type="text/css" href="$g.server/js/yui/treeview/assets/treeview-menu.css"/>  
    1919 
    20 <link rel="stylesheet" type="text/css" href="/js/yui/fonts/fonts-min.css?_yuiversion=2.5.0" /> 
    21 <script type="text/javascript" src="/js/yui/utilities/utilities.js?_yuiversion=2.5.0"></script> 
     20<link rel="stylesheet" type="text/css" href="$g.server/js/yui/fonts/fonts-min.css?_yuiversion=2.5.0" /> 
     21<script type="text/javascript" src="$g.server/js/yui/utilities/utilities.js?_yuiversion=2.5.0"></script> 
    2222 
    23 <script type="text/javascript" src="/js/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>  
    24 <script type="text/javascript" src="/js/yui/dragdrop/dragdrop-min.js" ></script> 
    25 <link type="text/css" rel="stylesheet" href="/layout/drag_drop_style.css"/> 
    26 <script src = "js/dragAndDrop.js" ></script>  
    27  
     23<script type="text/javascript" src="$g.server/js/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>  
     24<script type="text/javascript" src="$g.server/js/yui/dragdrop/dragdrop-min.js" ></script> 
     25<link type="text/css" rel="stylesheet" href="$g.server/layout/drag_drop_style.css"/> 
     26<script src = "$g.server/js/dragAndDrop.js" ></script>  
    2827 
    2928<!-- END: Yahoo Interface Library --> 
    3029 
    3130<!-- BEGIN: WMSC library --> 
    32 <link type="text/css" rel="stylesheet" href="/layout/control.css"/> 
     31<link type="text/css" rel="stylesheet" href="$g.server/layout/control.css"/> 
    3332 
    3433<script src="$g.server/js/wmsc.js"></script> 
    3534<script src="$g.server/js/prototype.js"></script> 
    36 <script src="http://www.openlayers.org/api/OpenLayers.js"></script> 
     35<script src="http://www.openlayers.org/api/2.4/OpenLayers.js"></script> 
    3736<script src="$g.server/js/openlayers-x.js"/> 
    3837<script src="$g.server/js/dimensionControl.js"/> 
     
    5453    <for py:for="i in session['viewItems']" class="dataset" py:strip="True"> 
    5554        <span py:if="i.wmcURL" py:strip="True"> 
    56                 layerControl.addWebMapContext('${i.wmcURL}'); 
     55                layerControl.addWebMapContext("${i.wmcURL}"); 
    5756            </span> 
    5857    </for> 
     
    142141                        Select a dataset to expand it and make its map layers visible; these can then be selected to add to the 'Layer' 
    143142                        panel for visualisation.<br/>   
    144                         Remove datasets from the display by clicking their <img src="js/img/close.gif" /> icon. 
     143                        Remove datasets from the display by clicking their <img src="$g.server/js/img/close.gif" /> icon. 
    145144        </div> 
    146145    </div> 
     
    152151                to the bottom.<br/> 
    153152                NB, if the topmost layer (i.e. the bottom layer in the below list) has legend data available then this will be displayed under the completed map.<br/> 
    154                 Remove layers from the displayed map by clicking their <img src="js/img/close.gif" /> icon. 
     153                Remove layers from the displayed map by clicking their <img src="$g.server/js/img/close.gif" /> icon. 
    155154        </div> 
    156155    </div> 
Note: See TracChangeset for help on using the changeset viewer.