Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / vigiboard / widgets / edit_event.py @ 89fe9e96

History | View | Annotate | Download (1.4 KB)

1
# -*- coding: utf-8 -*-
2
# vim:set expandtab tabstop=4 shiftwidth=4:
3
"""Le formulaire d'édition d'un événement."""
4

    
5
from pylons.i18n import lazy_ugettext as l_
6
from tw.forms import TableForm, SingleSelectField, TextField, \
7
                        HiddenField, SubmitButton
8
from tw.api import WidgetsList
9

    
10
__all__ = ('EditEventForm', 'edit_event_status_options')
11

    
12
edit_event_status_options = [
13
    ['NoChange', l_('No change')],
14
    ['None', l_('Change to None')],
15
    ['Acknowledged', l_('Change to Acknowledged')],
16
    ['AAClosed', l_('Change to Closed')],
17
]
18

    
19
class EditEventForm(TableForm):
20
    """
21
    Formulaire d'édition d'événement
22

23
    Affiche une zone de texte pour le Trouble Ticket et une
24
    liste déroulante pour le nouveau status
25
    """
26

    
27
    submit_text = None
28
    fields = [
29
        HiddenField('id'),
30
        TextField('trouble_ticket', label_text=l_('Trouble Ticket')),
31
        SingleSelectField('ack', label_text=l_('Status'), 
32
                                            options=edit_event_status_options)
33
    ]
34
    
35
    def __init__(self, id, last_modification, *args, **kwargs):
36
        super(TableForm, self).__init__(id, *args, **kwargs)
37

    
38
        self.children.append(HiddenField('last_modification',
39
                                         attrs={'value': last_modification}))
40
        self.children.append(SubmitButton('submit', 
41
                                          attrs={'value': l_('Apply')}))
42