Ignore:
Timestamp:
29/11/07 14:42:59 (12 years ago)
Author:
lawrence
Message:

Support for viewing xhtml description sections within stub-B

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

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/DocumentRetrieve.py

    r3070 r3073  
    9999                      
    100100            xquery=queryReplace(xquery,repository,localID,targetCollection) 
    101             
    102101            try: 
    103102                id,summary=self.executeQuery(xquery) 
     
    116115            # now let's get it and return it  
    117116            r=self.retrieve(id,0,{}) 
    118  
    119117        else: 
    120118            raise TypeError('Unknown Schema "%s" in URI'%schema) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/geoUtilities.py

    r2970 r3073  
    88    else: 
    99        return float(x) 
     10     
     11def moveBox(w,e): 
     12    ''' Take a 0,360 bounding box and force into -180,180 ''' 
     13    ww,ee=float(w),float(e) 
     14    if ww<180.0 and ee>180.0: 
     15        return ww-180.0,ee-180.0 
     16    else: 
     17       if ww>180.0: 
     18           return ww-360.,ee-360. 
     19       else: return ww,ee 
    1020 
    1121class Bounding: 
     
    7181    def __getitem__(self,i): 
    7282        return self.data[i] 
     83     
     84import unittest 
     85 
     86class TestCase(unittest.TestCase): 
     87     
     88    def testMoveBox(self): 
     89        w,e=1,359 
     90        w,e=moveBox(w,e) 
     91        self.assertEqual((w,e),(-179.,179.)) 
     92        w,e=190,200 
     93        w,e=moveBox(w,e) 
     94        self.assertEqual((w,e),(-170.,-160.)) 
     95        w,e=10,20 
     96        w,e=moveBox(w,e) 
     97        self.assertEqual((w,e),(10.,20.)) 
     98     
     99if __name__=="__main__": 
     100 
     101    unittest.main() 
    73102         
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/ndgObject.py

    r2967 r3073  
    6060            # This NDG object may itself be a discovery record, which makes life easy, but 
    6161            # it might not be, in which case we have to build up all the possible views upon it. 
     62            # But remember only data entity b records have discovery records ... 
    6263            server=self.config.get('DISCOVERY','default') 
    6364            self.viewService='%s/view/'%server 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/ndgRetrieve.py

    r3069 r3073  
    8383    try: 
    8484        x=xmlHandler2.xmlHandler(r,string=1) 
     85        
    8586        return 1,x 
    8687    except Exception,e: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/stubB.py

    r3015 r3073  
    99 
    1010from Utilities import * 
     11from BeautifulSoup import BeautifulSoup 
    1112from AccessControl import AccessControl 
    1213from geoUtilities import Bounding 
     
    169170        self.onlineRefs=[] 
    170171        for e in helper.findall(elem,'descriptionSection'): 
    171             self.texts.append((helper.getText(e,'dgDescriptionText'),helper.getText(e,'contentType'))) 
     172            textElem=helper.find(e,'dgDescriptionText') 
     173            if textElem is not None: 
     174                text=textElem.text 
     175                tail='' 
     176                for i in textElem:  
     177                    text+=ET.tostring(i) 
     178                    tail=i.tail 
     179                text+=tail 
     180                ctype=helper.getText(e,'contentType') 
     181                if ctype in ['','text/html']: 
     182                    soup=BeautifulSoup(text) 
     183                    text=soup.prettify() 
     184                self.texts.append((text,ctype)) 
    172185        online=helper.findall(elem,'descriptionSection/descriptionOnlineReference/dgSimpleLink') 
    173186        for o in online: 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/layout/ndg2.css

    r3017 r3073  
    191191#SemanticSearchBox{margin: 0px 0px 0px 0px; border:0}  
    192192#SemanticSearchResults { margin: 5px 10px 5px 10px; border:0; color:#571512;}  
     193 
    193194.resultsBar {text-align:right; margin: 2px 10px 2px 10px; border:0;} 
    194195.resultsBar .hidden {display:none;} 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/NSfunctions10.kid

    r2982 r3073  
    167167             py:replace="Experiment(xmlh.tree[0],xmlh._distributens)"/> 
    168168        <?python dc=(xmlh.tree.findall('{http://purl.org/dc/elements/1.1/dc}*') or [])?> 
    169         <table py:if="dc !=[]"><tr py:for="e in dc"> 
    170             <td>${e.tag}</td><td>${e.text}</td></tr> 
    171         </table>--> 
     169        <table py:if="dc !=[]"> 
     170            <tr py:for="e in dc"> 
     171                <!-- Following expression can't seem to be collapsed into an inline evaluation ... kid-bug? --> 
     172                <?python tag=e.tag[e.tag.find('}')+1:] ?> 
     173                <td>${tag}</td><td>${(e.text or '')}</td> 
     174            </tr> 
     175        </table> 
    172176    </div> 
    173177 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/semantic.kid

    r3070 r3073  
    22    <body> 
    33        <div id="SemanticSearchResults"> 
    4             <span py:if="c.semAvailable">You could also try - </span> 
    5             <span py:if="c.synonyms !=[]">  
    6                 synonym(s): <span py:for="i,url in c.synonyms"><a href="$url">$i</a>&nbsp;</span> 
    7                 <span py:if="c.narrower!=[] or c.broader!=[]">;</span> 
     4            <span py:if="c.semAvailable">You could also try - 
     5                <span py:if="c.synonyms !=[]">  
     6                    synonym(s): <span py:for="i,url in c.synonyms"><a href="$url">$i</a>&nbsp;</span> 
     7                    <span py:if="c.narrower!=[] or c.broader!=[]">;</span> 
     8                </span> 
     9                <span py:if="c.narrower !=[]">  
     10                    narrower search(s): <span py:for="i,url in c.narrower"><a href="$url">$i</a>&nbsp;</span> 
     11                    <span py:if="c.broader!=[]">;</span> 
     12                </span> 
     13                <span py:if="c.broader !=[]">  
     14                    broader search(s): <span py:for="i,url in c.broader"><a href="$url">$i</a>&nbsp;</span> 
     15                </span>. 
    816            </span> 
    9             <span py:if="c.narrower !=[]">  
    10                 narrower search(s): <span py:for="i,url in c.narrower"><a href="$url">$i</a>&nbsp;</span> 
    11                 <span py:if="c.broader!=[]">;</span> 
    12             </span> 
    13             <span py:if="c.broader !=[]">  
    14                 broader search(s): <span py:for="i,url in c.broader"><a href="$url">$i</a>&nbsp;</span> 
    15             </span>. 
    16             <span py:if="not c.semAvailable">No alternatives available</span> 
     17            <span py:if="not c.semAvailable">No alternatives available.</span> 
    1718        </div> 
    1819    </body> 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/stubB.kid

    r3015 r3073  
    3131                            >$c.doc.citation</span></p> 
    3232                    <div py:for="d in c.doc.description.texts"> 
    33                         <div py:if="d[1] in ['','text/plain']" class="description"> 
    34                             <p>${d[0]}</p> 
     33                        <!-- Note that the content of the descriptions should have been sanitised before it gets here --> 
     34                        <div py:if="d[1] in ['','text/html']" class="description"> 
     35                            ${XML(d[0])} 
    3536                        </div> 
    36                         <div py:if="d[1] == 'text/html'" class="description"> 
    37                             ${XML(d[0])} 
     37                        <div py:if="d[1] in ['text/plain']" class="description"> 
     38                            ${d[0]} 
    3839                        </div> 
    3940                        <div py:if="d[1] not in ['','text/plain','text/html']" class="description"> 
Note: See TracChangeset for help on using the changeset viewer.