1 # -*- coding: utf-8 -*-
3 # portal/views.py: views for the portal application
4 # This file is part of the Manifold project.
7 # Jordan Augé <jordan.auge@lip6.fr>
8 # Mohammed Yasin Rahman <mohammed-yasin.rahman@lip6.fr>
9 # Copyright 2013, UPMC Sorbonne Universités / LIP6
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.
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
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.
26 from django.http import HttpResponseRedirect, HttpResponse
27 from django.shortcuts import render
28 from django.template.loader import render_to_string
30 from unfold.loginrequired import FreeAccessView
31 from ui.topmenu import topmenu_items, the_user
33 from unfold.page import Page
35 from plugins.myplugin import MyPlugin
38 # initially all the portal views were defined in this single file
39 # all the other ones have now migrated into separate classes/files for more convenience
40 # I'm leaving these ones here for now as I could not exactly figure what the purpose was
41 # (i.e. what the correct name should be, as presviewview was a bit cryptic)
42 class MyPluginView(FreeAccessView):
43 template_name = "view-unfold1.html"
45 def get_context_data(self, **kwargs):
47 page = Page(self.request)
49 # pres_view = PresView(page = page)
50 plugin = MyPlugin(page = page, html="<h1>PresView needs to be integrated</h1>")
52 context = super(MyPluginView, self).get_context_data(**kwargs)
54 context['unfold_main'] = plugin.render(self.request)
56 # more general variables expected in the template
57 context['title'] = 'Sandbox for MyPlugin plugin'
58 # the menu items on the top
59 context['topmenu_items'] = topmenu_items('PresView', self.request)
60 # so we can sho who is logged
61 context['username'] = the_user(self.request)
63 prelude_env = page.prelude_env()
64 context.update(prelude_env)