Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / widgets / edit_event.py @ 25892058

History | View | Annotate | Download (2.8 KB)

1
# -*- coding: utf-8 -*-
2
# vim:set expandtab tabstop=4 shiftwidth=4:
3
################################################################################
4
#
5
# Copyright (C) 2007-2013 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
"""Le formulaire d'édition d'un événement."""
22

    
23
from pylons.i18n import lazy_ugettext as l_
24
from tw.api import WidgetsList
25
from tw.forms import TableForm, SingleSelectField, TextField, \
26
                        HiddenField, Label
27

    
28
__all__ = (
29
    'edit_event_status_options',
30
    'EditEventForm',
31
)
32

    
33
edit_event_status_options = [
34
    ['NoChange', l_('No change')],
35
    ['None', l_('Change to None')],
36
    ['Acknowledged', l_('Change to Acknowledged')],
37
    ['AAClosed', l_('Change to Closed')],
38
    ['Forced', l_('Force to Closed')],
39
]
40

    
41
# Énumère les valeurs possibles pour le champ "type_action"
42
# dans la base de données et les marque comme nécessitant une traduction.
43
valid_action_types = {
44
    u'Ticket change': l_('Ticket change'),
45
    u'Forced change state': l_('Forced change state'),
46
    u'Acknowledgement change state': l_('Acknowledgement change state'),
47
    u'Ticket change notification': l_('Ticket change notification'),
48
    u'New occurrence': l_('New occurrence'),
49
    u'Nagios update state': l_('Nagios update state'),
50
}
51

    
52
# Gère le cas où un événement est clos de force.
53
l_('Forced')
54

    
55

    
56
class EditEventForm(TableForm):
57
    """
58
    Formulaire d'édition d'événement
59

60
    Affiche une zone de texte pour le Trouble Ticket et une
61
    liste déroulante pour le nouveau status
62

63
    Ce widget permet de répondre aux exigences suivantes :
64
        - VIGILO_EXIG_VIGILO_BAC_0060
65
        - VIGILO_EXIG_VIGILO_BAC_0110
66
    """
67

    
68
    class fields(WidgetsList):
69
        """
70
        Champs du formulaire d'édition des événements.
71
        """
72
        id = HiddenField('id')
73
        trouble_ticket = TextField(label_text=l_('Trouble Ticket'))
74
        warning = Label(suppress_label=True, text=l_('Warning: changing '
75
                        'the ticket will affect all selected events.'))
76
        ack = SingleSelectField(label_text=l_('Acknowledgement Status'),
77
                                options=edit_event_status_options)
78
        last_modification = HiddenField()