move debug_platform over into to-be-integrated
[myslice.git] / to-be-integrated / debug_platform / views.py
1 # -*- coding: utf-8 -*-
2 #
3 # portal/views.py: views for the portal application
4 # This file is part of the Manifold project.
5 #
6 # Authors:
7 #   Jordan AugĂ© <jordan.auge@lip6.fr>
8 #   Mohammed Yasin Rahman <mohammed-yasin.rahman@lip6.fr>
9 # Copyright 2013, UPMC Sorbonne UniversitĂ©s / LIP6
10 #
11 # This program is free software; you can redistribute it and/or modify it under
12 # the terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 3, or (at your option) any later version.
14
15 # This program is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18 # details.
19
20 # You should have received a copy of the GNU General Public License along with
21 # this program; see the file COPYING.  If not, write to the Free Software
22 # Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 from django.conf                 import settings
25 from django.contrib.sites.models import Site, RequestSite
26 from django.contrib              import messages
27 from django.views.generic        import View
28 from django.views.generic.base   import TemplateView
29 from django.shortcuts            import render
30 from manifold.core.query         import Query
31 from unfold.page                 import Page
32 from ui.topmenu                  import topmenu_items, the_user
33 from django.http                 import HttpResponseRedirect
34 from plugins.debug_platform      import DebugPlatform
35
36 class PlatformView(TemplateView):
37     template_name = "view-unfold1.html"
38
39     def get_context_data(self, **kwargs):
40
41         page = Page(self.request)
42
43         debug_platform = DebugPlatform(page = page)
44
45         context = super(PlatformView, self).get_context_data(**kwargs)
46
47         context['ALL_STATIC'] = "all_static"
48         context['unfold_main'] = debug_platform.render(self.request)
49
50         # XXX This is repeated in all pages
51         # more general variables expected in the template
52         context['title'] = 'Test view that combines various plugins'
53         # the menu items on the top
54         context['topmenu_items'] = topmenu_items('Dashboard', self.request) 
55         # so we can sho who is logged
56         context['username'] = the_user(self.request) 
57
58         prelude_env = page.prelude_env()
59         context.update(prelude_env)
60
61         return context
62