d8a6ca0f89789e033df16a93fdc6603d73da66db
[myslice.git] / plugins / hazelnut / hazelnut.py
1 from unfold.plugin import Plugin
2
3 class Hazelnut (Plugin):
4
5     def __init__ (self, query, checkboxes=False, **settings):
6         Plugin.__init__ (self, **settings)
7         self.query=query
8         self.checkboxes=checkboxes
9
10     def template_file (self):
11         return "hazelnut.html"
12
13     def template_env (self, request):
14         env={}
15         env.update(self.__dict__)
16         # xxx need to retrieve metadata
17 # $subject_keys = Plugins::get_default_fields($query->subject, $is_unique);
18 # $fields = Plugins::metadata_get_fields($query->subject);
19 # for now I am hard-coding the ones from haze.py
20         env['subject_fields']=[ 'network', 'type', 'hostname', 'hrn' ]
21         return env
22
23     def requirements (self):
24         reqs = {
25             'js_files' : [ "js/hazelnut.js", 
26                            "js/manifold.js", "js/manifold-query.js", 
27                            "js/dataTables.js", "js/with-datatables.js",
28                            "js/spin.presets.js", "js/spin.min.js", "js/jquery.spin.js", 
29                            "js/unfold-helper.js",
30                            ] ,
31             'css_files': [ "css/hazelnut.css" , "css/demo_table.css", "css/demo_table_jui.css", ],
32             }
33         return reqs
34
35     # the list of things passed to the js plugin
36     def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes']