1 # Create your views here.
3 from django.core.context_processors import csrf
4 from django.template import RequestContext
5 from django.template.loader import render_to_string
6 from django.shortcuts import render_to_response
8 from django.contrib.auth.decorators import login_required
10 from engine.pluginset import PluginSet
11 from engine.manifoldquery import ManifoldQuery
13 from plugins.simplelist import SimpleList
16 from myslice.viewutils import topmenu_items, the_user
17 # from myslice.viewutils import hard_wired_slice_names, hard_wired_list, lorem_p, lorem, quickfilter_criterias
20 def dashboard_view (request):
22 pluginset = PluginSet()
24 slices_query = ManifoldQuery (action='get',
28 # xxx filter : should filter on the slices the logged user can see
29 # we don't have the user's hrn yet
30 # in addition this currently returns all slices anyways
32 pluginset.enqueue_query (slices_query)
34 main_plugin = SimpleList ( # setting visible attributes first
36 title='Asynchroneous SimpleList',
40 # this is required for the javascript code
46 # variables that will get passed to the view-plugin.html template
49 # define 'content_main' to the template engine
50 template_env [ 'content_main' ] = main_plugin.render(request)
52 # ########## add another plugin with the same request, on the RHS pane
53 # # lacks a/href to /slice/%s
54 # related_plugin = SliceList (title='SliceList plugin',domid='slicelist1',
55 # with_datatables='yes',
56 # list=hard_wired_slice_names,
58 # # likewise but on the side view
59 # template_env [ 'content_related' ] = related_plugin.render (request)
61 # more general variables expected in the template
62 template_env [ 'title' ] = 'Test view for a full request cycle'
63 # the menu items on the top
64 template_env [ 'topmenu_items' ] = topmenu_items('dashboard', request)
65 # so we can sho who is logged
66 template_env [ 'username' ] = the_user (request)
68 pluginset.exec_queue_asynchroneously ()
70 # the prelude object in pluginset contains a summary of the requirements() for all plugins
71 # define {js,css}_{files,chunks}
72 prelude_env = pluginset.template_env()
73 template_env.update(prelude_env)
74 return render_to_response ('view-plugin.html',template_env,
75 context_instance=RequestContext(request))