remove unused debug feature
[unfold.git] / portal / platformview.py
1 from manifold.core.query         import Query
2 from unfold.page                 import Page
3
4 from unfold.loginrequired        import FreeAccessView
5 from ui.topmenu                  import topmenu_items, the_user
6
7 from plugins.querytable          import QueryTable
8
9 # View for 1 platform and its details
10 class PlatformView(FreeAccessView):
11     template_name = "platform.html"
12
13     def get_context_data(self, **kwargs):
14         page = Page(self.request)
15         page.add_js_files  ( [ "js/common.functions.js" ] )
16         for key, value in kwargs.iteritems():
17             print "%s = %s" % (key, value)       
18             if key == "platformname":
19                 platformname=value
20                 
21         network_query  = Query().get('local:platform')\
22             .filter_by('platform', '==', platformname)\
23             .select('platform','platform_longname','gateway_type')
24         page.enqueue_query(network_query)
25
26         page.expose_js_metadata()
27         page.expose_queries()
28         networklist = QueryTable(
29             page  = page,
30             title = 'List',
31             domid = 'checkboxes',
32             # this is the query at the core of the slice list
33             query = network_query,
34             query_all = network_query,
35             checkboxes = False,
36             datatables_options = {
37             'iDisplayLength' : 25,
38             'bLengthChange'  : True,
39             },
40         )
41 #
42 #        networklist = SimpleList(
43 #            title = None,
44 #            page  = page,
45 #            key   = 'platform',
46 #            query = network_query,
47 #        )
48
49         context = super(PlatformView, self).get_context_data(**kwargs)
50         context['person']   = self.request.user
51         context['networks'] = networklist.render(self.request)
52
53         # XXX This is repeated in all pages
54         # more general variables expected in the template
55         context['title'] = 'Platforms connected to MySlice'
56         # the menu items on the top
57         context['topmenu_items'] = topmenu_items('Platforms', self.request)
58         # so we can sho who is logged
59         context['username'] = the_user(self.request)
60
61         context.update(page.prelude_env())
62
63         return context