source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/tabs.py @ 2853

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/tabs.py@2853
Revision 2853, 1.5 KB checked in by lawrence, 12 years ago (diff)

This a complete fix for ticket:863 (I hope) which includes logic
for handling the pagetabs as a consequence.

Line 
1from ows_server.lib.base import *
2from ows_server.models import Utilities
3
4class TabsController(BaseController):
5   
6    def index(self):
7        # Return a rendered template
8        #   return render_response('/some/template.html')
9        # or, Return a response object
10        return Response('Hello World')
11   
12    def update(self,value):
13       
14        session['panelView']=value
15        session.save()
16        return render_response('cart',fragment=True) 
17   
18    def addSelection(self,uri,name):
19        if 'selection' not in session:
20            newtabs=1
21            session['selection']=[(uri,name),]
22        else:
23            newtabs=0
24            rb=Utilities.RingBuffer(10)
25            for i in session['selection']: rb.append(i)
26            if (uri,name) in rb: rb.remove((uri,name))
27            rb.append((uri,name))
28            session['selection']=rb.tolist()
29        session.save()
30        if newtabs:
31            c.UpdatePageTabs=1
32            c.current='Display'
33            c.pageTabs.append(('Selections',h.url_for(controller='selection',action='index')))
34            c.pageTabs.append(('Visualise','Blah'))
35            c.pageTabs.append(('Download','Blah'))
36        return render_response('ndgPage',fragment=True)
37           
38    def clear(self,value):
39       
40        if value=='History':
41            session['history']=[]
42        elif value=='Selection':
43            session['selection']=[]
44        session.save()
45        return render_response('cart',fragment=True)
Note: See TracBrowser for help on using the repository browser.