Changeset 5999


Ignore:
Timestamp:
11/11/09 15:50:34 (10 years ago)
Author:
pnorton
Message:

A first attempt at adding further info links to the wmsviz page.

Location:
cowsclient/trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • cowsclient/trunk/cowsclient/controllers/wmsviz.py

    r5993 r5999  
    102102        statusBuilder = StatusBuilder() 
    103103         
    104         status = statusBuilder.getCurrentStatus() 
     104        status = statusBuilder.getCurrentStatus('wmsviz') 
    105105 
    106106        initialSetup = self._buildInitialSetup(self.inputs.get('ENDPOINT')) 
     
    157157        c.initialStatus = utils.toJSON(status) 
    158158         
     159         
     160 
     161         
    159162        log.debug("finished wmsviz controller index action") 
    160163         
  • cowsclient/trunk/cowsclient/lib/status_builder.py

    r5821 r5999  
    88from cowsclient.lib.base import config 
    99import cowsclient.lib.utils as utils 
     10from cowsclient.lib.further_info_config_parser import FurtherInfoConfigParser 
    1011 
    1112class StatusBuilder(object): 
     
    2021        Constructor 
    2122        ''' 
    22         pass 
     23        self.fiparser = FurtherInfoConfigParser(config.get('furtherInfo',None)) 
    2324     
    2425     
    25     def getCurrentStatus(self): 
     26    def getCurrentStatus(self, sectionName=None): 
    2627         
    2728        status = {} 
     
    3435                 
    3536        status['OutlineSettings'] = self._getOutlineSettings() 
     37         
     38        status['FurtherInfoLinks'] = self._getFurtherInfoLinks(sectionName) 
    3639     
    3740        return status 
     
    6871        return baseLayerSettings 
    6972     
     73    def _getFurtherInfoLinks(self, sectionName): 
     74        return self.fiparser.buildFurtherInfoList('wmsviz') 
     75     
    7076""" 
    7177initialStatusObject (made of primatives so it can be transformed into json 
  • cowsclient/trunk/cowsclient/public/js/layerInformation.js

    r5993 r5999  
    2222 * @constructor 
    2323 */ 
    24 var LayerInfo = function (layerInfoContainerId, eventsManager) { 
     24var LayerInfo = function (layerInfoContainerId, eventsManager, furtherInfoLinks) { 
     25     
     26    if (furtherInfoLinks === undefined) { 
     27        this.furtherInfoLinks = []; 
     28    } 
     29    else { 
     30        this.furtherInfoLinks = furtherInfoLinks; 
     31    } 
    2532     
    2633    this._container = document.getElementById(layerInfoContainerId); 
     
    5966        div.appendChild(this._buildInfoItem('Layer Abstract', wmcLayer.getAbstract())); 
    6067         
     68        var infoHTML = ""; 
     69         
     70        for (i = 0; i < this.furtherInfoLinks.length; i++) { 
     71            var link = this.furtherInfoLinks[i]; 
     72             
     73            if (link.match(olLayer.url)) { 
     74                infoHTML = infoHTML + link.getHTML() + ", "; 
     75            } 
     76        } 
     77         
     78        if (infoHTML.length > 0) { 
     79            infoHTML = infoHTML.slice(0, infoHTML.length -2); // get rid of the last ',' 
     80            div.appendChild(this._buildInfoItem('Further Info', infoHTML)); 
     81        } 
     82         
    6183        this._clearInfo(); 
    6284        this._container.appendChild(div); 
  • cowsclient/trunk/cowsclient/public/js/layerParameters.js

    r5993 r5999  
    1818 */ 
    1919var LayerParameters = function (propertiesDivId, selectionFormId, wmcRetriever,  
    20                                 hideDisplayOptions, eventsManager) { 
     20                                hideDisplayOptions, eventsManager, furhterInfoLinks) { 
    2121     
    2222    this.eventsManager = eventsManager; 
     
    2828    this.wmcRetriever = wmcRetriever; 
    2929     
    30     this.layerInfo = new LayerInfo('layer_info_container', this.eventsManager); 
     30    this.layerInfo = new LayerInfo('layer_info_container', this.eventsManager, furhterInfoLinks); 
    3131    this.layerDims = new LayerDimensions('WMSC_dimForm', this.eventsManager); 
    3232    this.layerDisplay = new LayerDisplayOpts(selectionFormId, hideDisplayOptions, this.eventsManager); 
  • cowsclient/trunk/cowsclient/public/js/utils.js

    r5993 r5999  
    570570     
    571571}; 
     572 
     573Utils.getObjString = function (obj) { 
     574    var str = "{"; 
     575     
     576    for(p in obj) { 
     577        str += "'" + p + "':" + obj[p] +","; 
     578    } 
     579     
     580    return str; 
     581     
     582}; 
     583 
     584Utils.buildObjectList = function (klass, objList) { 
     585    var retList = []; 
     586     
     587    for (i = 0; i < objList.length; i++) { 
     588        retList.push(new klass(objList[i])); 
     589    } 
     590     
     591    return retList; 
     592}; 
     593 
     594Utils.hasAttr = function (obj, attr) { 
     595     
     596    for (p in obj) { 
     597        if (p === attr) { 
     598            return true; 
     599        } 
     600    } 
     601     
     602    return false; 
     603}; 
  • cowsclient/trunk/cowsclient/templates/wmsviz.html

    r5993 r5999  
    107107<script type="text/javascript" src="$g.server/js/wcs.js"></script> 
    108108 
     109<script type="text/javascript" src="$g.server/js/furtherInfoLink.js"></script> 
    109110<script type="text/javascript" src="$g.server/js/displayOptionsRetriever.js"></script> 
    110111<script type="text/javascript" src="$g.server/js/json2.js"></script> 
     
    162163 
    163164    var initialSetupJSON = "${c.initialSetupJSON}"; 
     165    var layerInfoList = "${c.layerInfoList}"; 
    164166 
    165167    var wmcRetriever = new WMCRetriever(); 
     
    171173     
    172174    var allEvents = []; 
     175 
     176    var furtherInfoLinks = Utils.buildObjectList(FurtherInfoLink, initialStatus['FurtherInfoLinks']); 
    173177 
    174178    allEvents = allEvents.concat(LayerList.prototype.EVENTS_RAISED, 
     
    184188              
    185189        layerList = new LayerList('layer_list', 'chk_outline_on_top', eventsManager);    
    186     layerParameters = new LayerParameters('layer_properties', 'selection_form', wmcRetriever, initialStatus.HiddenDisplayOptions, eventsManager); 
     190    layerParameters = new LayerParameters('layer_properties', 'selection_form', wmcRetriever, initialStatus.HiddenDisplayOptions, eventsManager, furtherInfoLinks); 
    187191     
    188192    var legendContainer = new LegendContainer('legend', eventsManager); 
     
    191195     
    192196    var figBuilder = new FigureBuilder('composite_figure_container', makeFigureURL, initialBounds, eventsManager)  
    193         //new FigureBuilder('figureForm','make_figure_btn', initialBounds, eventsManager); 
     197         
    194198    var outlineControl = new OutlineControl('add_outline', eventsManager, initialStatus.OutlineSettings); 
    195199    var boundsControl = new WMSC.BoundsControl('dims', initialBounds, eventsManager); 
     
    304308                  
    305309                <tr class="controlHeadings"> 
    306                 <th>Dataset  <span py:replace="helpIcon('dataset_help')"/>  
     310                <th>Dataset <span py:replace="helpIcon('dataset_help')"/>  
    307311                </th>  
    308312                <th> Layer <span py:replace="helpIcon('layer_help')"/></th> 
  • cowsclient/trunk/development.ini

    r5759 r5999  
    3636# Add a list of pre-defined endpoints to the UI 
    3737#endpointList = %(here)s/endpoints.txt 
     38 
     39# Add a list of further info links for the endpoints 
     40#furtherInfo = %(here)s/further_info.ini 
    3841 
    3942# Set some of the display options rules 
  • cowsclient/trunk/endpoints_local.txt

    r5818 r5999  
    11[COWS] 
     2http://localhost:5000/ 
    23 
    34[WMS] 
    4 http://localhost:5000/clim_10/wms 
    5 http://localhost:5000/clim_30/wms 
    6 http://localhost:5000/cru_tmc/wms 
    7 http://localhost:5000/ccip/wms 
    8 http://localhost:5000/coastwms 
    9 http://localhost:5000/globalpop/wms 
    10 http://localhost:5000/modis/wms 
    11 http://localhost:5000/islscp_soil/wms 
    12 http://localhost:5000/landtype/wms3 
    135http://labs.metacarta.com/wms/vmap0 
    146http://ndg3beta.badc.rl.ac.uk/cows/demo_hadcm3/wms 
    157 
    168[WCS] 
    17 http://localhost:5000/clim_10/wcs 
    18 http://localhost:5000/clim_30/wcs 
    19 http://localhost:5000/cru_tmc/wcs 
    20 http://localhost:5000/ccip/wcs 
    219http://motherlode.ucar.edu:8080/thredds/wcs/fmrc/NCEP/NAM/CONUS_40km/conduit/NCEP-NAM-CONUS_40km-conduit_best.ncd 
Note: See TracChangeset for help on using the changeset viewer.