vigiboard / vigiboard / controllers / plugins / __init__.py @ cf3c2494
History | View | Annotate | Download (3.18 KB)
1 | 19e88cb8 | Thomas ANDREJAK | # -*- coding: utf-8 -*-
|
---|---|---|---|
2 | a77de887 | Francois POIROTTE | # vim:set expandtab tabstop=4 shiftwidth=4:
|
3 | ################################################################################
|
||
4 | #
|
||
5 | 3b537383 | Francois POIROTTE | # Copyright (C) 2007-2011 CS-SI
|
6 | a77de887 | Francois POIROTTE | #
|
7 | # This program is free software; you can redistribute it and/or modify
|
||
8 | # it under the terms of the GNU General Public License version 2 as
|
||
9 | # published by the Free Software Foundation.
|
||
10 | #
|
||
11 | # This program is distributed in the hope that it will be useful,
|
||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
14 | # GNU General Public License for more details.
|
||
15 | #
|
||
16 | # You should have received a copy of the GNU General Public License
|
||
17 | # along with this program; if not, write to the Free Software
|
||
18 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||
19 | ################################################################################
|
||
20 | |||
21 | b8500d1a | Thomas ANDREJAK | """
|
22 | 4dd2035e | Francois POIROTTE | Module complémentaire générique.
|
23 | b8500d1a | Thomas ANDREJAK | """
|
24 | |||
25 | from pylons.i18n import ugettext as _ |
||
26 | 19e88cb8 | Thomas ANDREJAK | |
27 | class VigiboardRequestPlugin(object): |
||
28 | """
|
||
29 | 4dd2035e | Francois POIROTTE | Classe que les plugins de VigiBoard doivent étendre.
|
30 | 19e88cb8 | Thomas ANDREJAK | """
|
31 | |||
32 | def __init__ (self, table = None, join = None, outerjoin = None, |
||
33 | filters = None, groupby = None, orderby = None, name = '', |
||
34 | 8ad24667 | Thomas ANDREJAK | style = None, object_name = ""): |
35 | 19e88cb8 | Thomas ANDREJAK | self.table = table
|
36 | self.join = join
|
||
37 | self.outerjoin = outerjoin
|
||
38 | self.filter = filters
|
||
39 | self.orderby = orderby
|
||
40 | self.name = name
|
||
41 | self.groupby = groupby
|
||
42 | self.style = style
|
||
43 | 8ad24667 | Thomas ANDREJAK | self.object_name = object_name
|
44 | 19e88cb8 | Thomas ANDREJAK | |
45 | cf3c2494 | Vincent QUEMENER | def get_bulk_data(self, events_ids): |
46 | 19e88cb8 | Thomas ANDREJAK | """
|
47 | cf3c2494 | Vincent QUEMENER | Cette méthode est appelée par le L{RootController} : elle
|
48 | retourne toutes les données affichées par le plugin dans le
|
||
49 | tableau des évènements de la page principale de VigiBoard.
|
||
50 | 19e88cb8 | Thomas ANDREJAK |
|
51 | 15b98053 | Francois POIROTTE | Cette méthode DEVRAIT être surchargée dans les classes dérivées.
|
52 | 19e88cb8 | Thomas ANDREJAK |
|
53 | cf3c2494 | Vincent QUEMENER | @param event_ids: Liste des identifiants des C{CorrEvent} affichés
|
54 | sur la page.
|
||
55 | @type events_id: C{List} of C{int}
|
||
56 | @return: Dictionnaire associant à chaque identifiant
|
||
57 | d'évènement les données à afficher par le plugin.
|
||
58 | @rtype: C{dict}
|
||
59 | """
|
||
60 | pass
|
||
61 | |||
62 | def get_json_data(self, idcorrevent, *args, **kwargs): |
||
63 | """
|
||
64 | Cette méthode est appelée par le template du plugin via
|
||
65 | la méthode get_plugin_json_data du L{RootController} de VigiBoard.
|
||
66 |
|
||
67 | Cette méthode DEVRAIT être surchargée dans les classes dérivées
|
||
68 | si le plugin en question doit avoir recours à une requête JSON.
|
||
69 |
|
||
70 | e181e86c | Francois POIROTTE | @param idcorrevent: Identifiant du C{CorrEvent} à interroger.
|
71 | cf3c2494 | Vincent QUEMENER | @type idcorrevent: C{int}
|
72 | df25ac35 | Francois POIROTTE | @return: Dictionnaire contenant la ou les valeur(s) correspondantes.
|
73 | cf3c2494 | Vincent QUEMENER | @rtype: C{dict}
|
74 | 8ad24667 | Thomas ANDREJAK | """
|
75 | pass
|
||
76 | 07b62a01 | Francois POIROTTE | |
77 | def get_generated_columns_count(self): |
||
78 | """
|
||
79 | Cette méthode renvoie le nombre de colonnes ajoutées dans le tableau
|
||
80 | des événements par ce plugin. Par défaut, on suppose que chaque plugin
|
||
81 | n'ajoute qu'une seule colonne au tableau.
|
||
82 |
|
||
83 | Cette méthode PEUT être surchargée dans les classes dérivées.
|
||
84 |
|
||
85 | @return: Nombre de colonnes ajoutées par ce plugin.
|
||
86 | @rtype: C{int}
|
||
87 | """
|
||
88 | return 1 |