16 |
16 |
|
17 |
17 |
from quixote import get_publisher
|
18 |
18 |
|
19 |
|
from wcs.qommon import _
|
20 |
|
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget
|
|
19 |
from wcs.qommon import _, N_
|
|
20 |
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget, RadiobuttonsWidget
|
21 |
21 |
|
22 |
22 |
from wcs.workflows import WorkflowStatusItem, perform_items, register_item_class
|
23 |
23 |
from wcs.workflows import WorkflowGlobalActionWebserviceTrigger, Workflow
|
... | ... | |
30 |
30 |
description = _('External workflow')
|
31 |
31 |
key = 'external_workflow_global_action'
|
32 |
32 |
category = 'formdata-action'
|
|
33 |
automatic_targetting = N_('Action on linked cards/forms')
|
|
34 |
manual_targetting = N_('Specify the identifier of the card/form on which the action will be applied')
|
33 |
35 |
|
34 |
36 |
slug = None
|
35 |
37 |
target_mode = None
|
... | ... | |
94 |
96 |
)
|
95 |
97 |
|
96 |
98 |
if 'target_mode' in parameters:
|
97 |
|
target_modes = [('all', _('Automatic'), 'all'), ('manual', _('Manual'), 'manual')]
|
|
99 |
target_modes = [
|
|
100 |
('all', _(self.automatic_targetting), 'all'),
|
|
101 |
('manual', _(self.manual_targetting), 'manual'),
|
|
102 |
]
|
98 |
103 |
form.add(
|
99 |
|
SingleSelectWidget,
|
|
104 |
RadiobuttonsWidget,
|
100 |
105 |
'%starget_mode' % prefix,
|
101 |
106 |
title=_('Targeting'),
|
102 |
107 |
value=self.target_mode or 'all',
|
... | ... | |
184 |
189 |
yield from formdata.iter_target_datas(objectdef=objectdef, object_type=self.slug, status_item=self)
|
185 |
190 |
|
186 |
191 |
def get_parameters(self):
|
187 |
|
return ('slug', 'target_mode', 'target_id', 'trigger_id', 'condition')
|
|
192 |
return ('slug', 'trigger_id', 'target_mode', 'target_id', 'condition')
|
188 |
193 |
|
189 |
194 |
def perform(self, formdata):
|
190 |
195 |
objectdef = self.get_object_def()
|
191 |
|
-
|