SimpleList No Result optional warning msg
[myslice.git] / plugins / lists / staticlist.py
1 from unfold.plugin import Plugin
2
3 class StaticList (Plugin) :
4
5     """ StaticList allows you to display an html list 
6     that you provide the contents for in the 'list' input argument
7     It is static in the sense that no query is going to be used to
8     manage this contents
9     """
10
11     # only deal with our own stuff here and let Plugin handle the rest
12     def __init__ (self, list=[], with_datatables=False, **settings):
13         Plugin.__init__ (self, **settings)
14         self.list=list
15         self.with_datatables = with_datatables
16
17     # SimpleList is useless per se anyways
18     def template_file (self): 
19         return "staticlist.html"
20     
21     def template_env (self, request):
22         env={}
23         # would need some cleaner means to set a header here
24         header=getattr(self,'header',None)
25         if header: env['header']=header
26         env['list']=self.list
27         env['with_datatables']= "yes" if self.with_datatables else ""
28         return env
29
30     def requirements (self):
31         reqs = { 'js_files' : [ ] ,
32                  'css_files': [ "css/staticlist.css" ],
33                  }
34         if self.with_datatables:
35             reqs['js_files'].append ("js/dataTables.js")
36             reqs['js_files'].append ("js/with-datatables.js")
37         return reqs