diff options
Diffstat (limited to 'activity/action/StartActivity.py')
-rw-r--r-- | activity/action/StartActivity.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/activity/action/StartActivity.py b/activity/action/StartActivity.py new file mode 100644 index 0000000..34b3873 --- /dev/null +++ b/activity/action/StartActivity.py | |||
@@ -0,0 +1,50 @@ | |||
1 | from MoinMoin import wikiutil | ||
2 | from .._activitybase import ActivityAction, FormattedDateTime | ||
3 | |||
4 | |||
5 | TEMPLATE = ''' | ||
6 | <table> | ||
7 | <tr> | ||
8 | <td class="label"><label>%(comment_label)s</label></td> | ||
9 | <td class="content"> | ||
10 | <input type="text" name="activity" size="80" maxlength="200"> | ||
11 | </td> | ||
12 | </tr> | ||
13 | <tr> | ||
14 | <td></td> | ||
15 | <td class="buttons"> | ||
16 | %(buttons_html)s | ||
17 | </td> | ||
18 | </tr> | ||
19 | </table> | ||
20 | ''' | ||
21 | |||
22 | |||
23 | class StartActivity(ActivityAction): | ||
24 | |||
25 | def __init__(self, pagename, request): | ||
26 | ActivityAction.__init__(self, pagename, request) | ||
27 | |||
28 | self.form_trigger = 'start_activity' | ||
29 | self.form_trigger_label = self._('Start Activity') | ||
30 | |||
31 | def check_condition(self): | ||
32 | if not self.can_use_activity: | ||
33 | return 'This page does not support activities.' | ||
34 | else: | ||
35 | return None | ||
36 | |||
37 | def do_action(self): | ||
38 | description = wikiutil.clean_input(self.form.get('activity', u'')) | ||
39 | return True, self.start_activity(description) | ||
40 | |||
41 | def get_form_html(self, buttons_html): | ||
42 | return TEMPLATE % { | ||
43 | 'pagename': self.pagename, | ||
44 | 'comment_label': self._("Activity to start"), | ||
45 | 'buttons_html': buttons_html, | ||
46 | } | ||
47 | |||
48 | |||
49 | def execute(pagename, request): | ||
50 | StartActivity(pagename, request).render() | ||