source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/utils.html @ 4315

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/utils.html@4315
Revision 4315, 1.6 KB checked in by cbyrom, 11 years ago (diff)

Add new template and controller code for adding and editing parameters +
fix data entities so they can properly associate granules and deployments with
them + add new form module to handle all the form validations and implement
basics for the create atom form.

Line 
1<?python
2 def et2string(x):
3     #use this to strip namespaces for children within text elements
4     cb=x.tag.find('}')
5     if cb!=-1:
6        x.tag=x.tag[cb+1:]
7     txt=(x.text or '')
8     s='<%s>%s'%(x.tag,txt)
9     # recurse through tree, if necessary
10     for a in x:
11         s+=et2string(a)
12     s+='</%s>%s'%(x.tag,(x.tail or ''))
13     return s
14     ?>
15 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://genshi.edgewall.org/"
16        py:strip="">
17
18    <span py:def="Text(elem)" py:strip="">
19        <!--! Note that we have to expect the possibility of xhtml in these elements and we won't
20        want the parent attributes, or the namespaces -->
21        <span py:if="elem is not None" py:strip="">
22                <span py:if="hasattr(elem, 'text')" py:strip="">
23                        ${elem.text.strip()}
24                </span>
25                <!--! output any child elements  -->
26                    <span py:with="s = ''" py:strip="">
27                    <?python
28                    for a in elem:
29                        s+=et2string(a)
30                        ?>
31                        <span py:if="s" py:strip="">
32                                ${Markup(s).strip()}
33                            </span>
34                        </span>
35        </span>
36    </span>
37
38       
39    <!--! hyperlinked image -->
40    <span py:def="linkimage(linkref,imageref,alttext)">
41        <a href="$linkref"><image src="$imageref" alt="$alttext" title="$alttext"/></a>
42    </span>
43   
44    <!--! Help Icons -->
45    <span py:def="helpIcon(value)">
46        <span>
47            <a href="javascript:;" title="Toggle help" onclick="toggleDiv(1,'$value','shown','hidden','div'); return false;">
48            <img src="$g.helpIcon" alt="Toggle help" class="helpicon"/></a>
49     
50        </span>
51    </span>
52</html>
Note: See TracBrowser for help on using the repository browser.