Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / controllers / plugins / test.py @ a2744508

History | View | Annotate | Download (1.92 KB)

1
# -*- coding: utf-8 -*-
2
# vim:set expandtab tabstop=4 shiftwidth=4:
3
################################################################################
4
#
5
# Copyright (C) 2007-2012 CS-SI
6
#
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
"""
22
Ce fichier contient un exemple de plugin pour l'interface
23
de VigiBoard. Il s'accompagne d'un template contenu dans
24
les thèmes, dans le répertoire suivant :
25
vigilo/themes/templates/vigiboard/plugins/test.html
26
"""
27
from vigiboard.controllers.plugins import VigiboardRequestPlugin
28

    
29
class PluginTest(VigiboardRequestPlugin):
30
    """
31
    Un plugin de démonstration qui se contente d'afficher
32
    "Hello world" pour chaque événement du tableau.
33
    """
34

    
35
    def get_bulk_data(self, events_ids):
36
        """
37
        Cette méthode est appelée par le L{RootController} de VigiBoard.
38
        Elle renvoie les données à afficher pour chaque évènement.
39

40
        @param events_ids: Liste des identifiants des événements corrélés
41
            à afficher.
42
        @type  events_ids: C{int}
43
        @return: Un dictionnaire associant à chaque identifiant d'évènement
44
            un texte statique.
45
        @rtype:  C{dict}
46
        """
47
        plugin_data = {}
48
        for event in events_ids:
49
            plugin_data[event] = 'Hello world'
50

    
51
        return plugin_data
52