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.slicelist import SliceList
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(request)
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
33 pluginset.enqueue_query (slices_query)
35 main_plugin = SliceList ( # setting visible attributes first
37 title='Asynchroneous SliceList',
41 # this is required for the javascript code
47 # variables that will get passed to the view-plugin.html template
50 # define 'content_main' to the template engine
51 template_env [ 'content_main' ] = main_plugin.render(request)
53 # ########## add another plugin with the same request, on the RHS pane
54 # # lacks a/href to /slice/%s
55 # related_plugin = SliceList (title='SliceList plugin',domid='slicelist1',
56 # with_datatables='yes',
57 # list=hard_wired_slice_names,
59 # # likewise but on the side view
60 # template_env [ 'content_related' ] = related_plugin.render (request)
62 # more general variables expected in the template
63 template_env [ 'title' ] = 'Test view for a full request cycle'
64 # the menu items on the top
65 template_env [ 'topmenu_items' ] = topmenu_items('dashboard', request)
66 # so we can sho who is logged
67 template_env [ 'username' ] = the_user (request)
69 pluginset.exec_queue_asynchroneously ()
71 # the prelude object in pluginset contains a summary of the requirements() for all plugins
72 # define {js,css}_{files,chunks}
73 prelude_env = pluginset.template_env()
74 template_env.update(prelude_env)
75 return render_to_response ('view-plugin.html',template_env,
76 context_instance=RequestContext(request))