0001-workflows-sort-workflow-actions-in-categories-3405.patch
tests/test_admin_pages.py | ||
---|---|---|
1681 | 1681 | |
1682 | 1682 |
# create a new action |
1683 | 1683 |
resp = resp.click('new status') |
1684 |
resp.forms[0]['type'] = 'Display message'
|
|
1684 |
resp.forms[0]['action-interaction'] = 'Top Message'
|
|
1685 | 1685 |
resp = resp.forms[0].submit() |
1686 | 1686 |
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/' |
1687 | 1687 |
resp = resp.follow() |
1688 | 1688 |
assert 'Use drag and drop' in resp.body |
1689 | 1689 | |
1690 | 1690 |
# fill action |
1691 |
resp = resp.click('Display message')
|
|
1691 |
resp = resp.click('Top Message')
|
|
1692 | 1692 |
resp.forms[0]['message'] = 'bla bla bla' |
1693 | 1693 |
resp = resp.forms[0].submit('submit') |
1694 | 1694 |
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/items/' |
... | ... | |
1953 | 1953 |
resp = app.get('/backoffice/workflows/1/') |
1954 | 1954 |
resp = resp.click('baz') |
1955 | 1955 | |
1956 |
for action in [x[0] for x in resp.forms[0]['type'].options]: |
|
1957 |
resp.forms[0]['type'] = action |
|
1958 |
resp = resp.forms[0].submit() |
|
1959 |
resp = resp.follow() |
|
1960 | ||
1961 |
for i in range(len(resp.forms[0]['type'].options)): |
|
1962 |
resp = resp.click('Edit', href='items/%d/' % (i+1), index=0) |
|
1963 |
resp = resp.forms[0].submit('cancel') |
|
1964 |
resp = resp.follow() # redirect to items/ |
|
1965 |
resp = resp.follow() # redirect to ./ |
|
1956 |
for category in ('status-change', 'interaction', 'formdata-action', 'user-action'): |
|
1957 |
for action in [x[0] for x in resp.forms[0]['action-%s' % category].options if x[0]]: |
|
1958 |
resp.forms[0]['action-%s' % category] = action |
|
1959 |
resp = resp.forms[0].submit() |
|
1960 |
resp = resp.follow() |
|
1961 | ||
1962 |
i = 1 |
|
1963 |
for category in ('status-change', 'interaction', 'formdata-action', 'user-action'): |
|
1964 |
for action in [x[0] for x in resp.forms[0]['action-%s' % category].options if x[0]]: |
|
1965 |
resp = resp.click('Edit', href='items/%d/' % i, index=0) |
|
1966 |
resp = resp.forms[0].submit('cancel') |
|
1967 |
resp = resp.follow() # redirect to items/ |
|
1968 |
resp = resp.follow() # redirect to ./ |
|
1969 |
i += 1 |
|
1966 | 1970 | |
1967 | 1971 |
def test_workflows_check_available_actions(pub): |
1968 | 1972 |
create_superuser(pub) |
... | ... | |
1976 | 1980 |
resp = app.get('/backoffice/workflows/1/') |
1977 | 1981 |
resp = resp.click('baz') |
1978 | 1982 | |
1979 |
assert not 'Modify Criticality' in [x[0] for x in resp.forms[0]['type'].options]
|
|
1980 |
assert not 'Send SMS' in [x[0] for x in resp.forms[0]['type'].options]
|
|
1983 |
assert not 'Criticality Levels' in [x[0] for x in resp.forms[0]['action-formdata-action'].options]
|
|
1984 |
assert not 'SMS' in [x[0] for x in resp.forms[0]['action-interaction'].options]
|
|
1981 | 1985 | |
1982 | 1986 |
pub.cfg['sms'] = {'mode': 'foobar'} |
1983 | 1987 |
pub.write_cfg() |
... | ... | |
1985 | 1989 |
workflow.store() |
1986 | 1990 |
resp = app.get('/backoffice/workflows/1/') |
1987 | 1991 |
resp = resp.click('baz') |
1988 |
assert 'Modify Criticality' in [x[0] for x in resp.forms[0]['type'].options]
|
|
1989 |
assert 'Send SMS' in [x[0] for x in resp.forms[0]['type'].options]
|
|
1992 |
assert 'Criticality Levels' in [x[0] for x in resp.forms[0]['action-formdata-action'].options]
|
|
1993 |
assert 'SMS' in [x[0] for x in resp.forms[0]['action-interaction'].options]
|
|
1990 | 1994 | |
1991 | 1995 |
def test_workflows_edit_dispatch_action(pub): |
1992 | 1996 |
create_superuser(pub) |
... | ... | |
2000 | 2004 |
resp = app.get('/backoffice/workflows/1/') |
2001 | 2005 |
resp = resp.click('baz') |
2002 | 2006 | |
2003 |
resp.forms[0]['type'] = 'Assign a Function'
|
|
2007 |
resp.forms[0]['action-formdata-action'] = 'Function/Role Linking'
|
|
2004 | 2008 |
resp = resp.forms[0].submit() |
2005 | 2009 |
resp = resp.follow() |
2006 | 2010 | |
2007 |
resp = resp.click('Assign a Function')
|
|
2011 |
resp = resp.click('Function/Role Linking')
|
|
2008 | 2012 |
resp.form['rules$element0$value'].value = 'FOOBAR' |
2009 | 2013 |
resp.form['rules$element0$role_id'].value = str(role.id) |
2010 | 2014 |
resp = resp.form.submit('submit') |
2011 | 2015 |
resp = resp.follow() |
2012 | 2016 |
resp = resp.follow() |
2013 | 2017 | |
2014 |
resp = resp.click('Assign a Function')
|
|
2018 |
resp = resp.click('Function/Role Linking')
|
|
2015 | 2019 |
assert resp.form['rules$element0$value'].value == 'FOOBAR' |
2016 | 2020 |
resp.form['rules$element1$value'].value = 'BARFOO' |
2017 | 2021 |
resp.form['rules$element1$role_id'].value = str(role.id) |
... | ... | |
2033 | 2037 |
resp = app.get('/backoffice/workflows/1/') |
2034 | 2038 |
resp = resp.click('baz') |
2035 | 2039 | |
2036 |
resp.forms[0]['type'] = 'Send mail'
|
|
2040 |
resp.forms[0]['action-interaction'] = 'Email'
|
|
2037 | 2041 |
resp = resp.forms[0].submit() |
2038 | 2042 |
resp = resp.follow() |
2039 | 2043 | |
2040 |
resp = resp.click('Send mail')
|
|
2044 |
resp = resp.click('Email')
|
|
2041 | 2045 |
item_url = resp.request.url |
2042 | 2046 | |
2043 | 2047 |
ok_strings = [ |
... | ... | |
2211 | 2215 |
resp = app.get('/backoffice/workflows/1/') |
2212 | 2216 |
resp = resp.click('baz') |
2213 | 2217 | |
2214 |
resp.form['type'] = 'Send SMS'
|
|
2218 |
resp.form['action-interaction'] = 'SMS'
|
|
2215 | 2219 |
resp = resp.form.submit().follow() |
2216 | 2220 | |
2217 |
resp = resp.click('Send SMS')
|
|
2221 |
resp = resp.click('SMS') |
|
2218 | 2222 |
resp = resp.form.submit() |
2219 | 2223 | |
2220 | 2224 |
def test_workflows_edit_display_form_action(pub): |
... | ... | |
2229 | 2233 |
resp = app.get('/backoffice/workflows/1/') |
2230 | 2234 |
resp = resp.click('baz') |
2231 | 2235 | |
2232 |
resp.forms[0]['type'] = 'Display a form'
|
|
2236 |
resp.forms[0]['action-interaction'] = 'Form'
|
|
2233 | 2237 |
resp = resp.forms[0].submit() |
2234 | 2238 |
resp = resp.follow() |
2235 | 2239 | |
2236 |
resp = resp.click('Display a form')
|
|
2240 |
resp = resp.click(re.compile('^Form$'))
|
|
2237 | 2241 |
resp = resp.click('Edit Fields') |
2238 | 2242 | |
2239 | 2243 |
resp.form['label'] = 'foobar' |
... | ... | |
2257 | 2261 |
resp = app.get('/backoffice/workflows/1/') |
2258 | 2262 |
resp = resp.click('baz') |
2259 | 2263 | |
2260 |
resp.forms[0]['type'] = 'Change Status'
|
|
2264 |
resp.forms[0]['action-status-change'] = 'Manual Jump'
|
|
2261 | 2265 |
resp = resp.forms[0].submit() |
2262 | 2266 |
resp = resp.follow() |
2263 | 2267 | |
... | ... | |
2349 | 2353 |
resp = app.get('/backoffice/workflows/1/') |
2350 | 2354 |
resp = resp.click('baz') |
2351 | 2355 | |
2352 |
resp.forms[0]['type'] = 'Send mail'
|
|
2356 |
resp.forms[0]['action-interaction'] = 'Email'
|
|
2353 | 2357 |
resp = resp.forms[0].submit() |
2354 | 2358 |
resp = resp.follow() |
2355 |
assert 'Send mail' in resp.body
|
|
2359 |
assert 'Email' in resp.body
|
|
2356 | 2360 | |
2357 | 2361 |
resp = resp.click(href='items/1/delete') |
2358 | 2362 |
resp = resp.form.submit('cancel') |
... | ... | |
2493 | 2497 |
# check the "set backoffice fields" action is now available |
2494 | 2498 |
resp = app.get('/backoffice/workflows/1/') |
2495 | 2499 |
resp = resp.click('baz') |
2496 |
resp.forms[0]['type'] = 'Set Backoffice Fields'
|
|
2500 |
resp.forms[0]['action-formdata-action'] = 'Backoffice Data'
|
|
2497 | 2501 |
resp = resp.forms[0].submit() |
2498 | 2502 |
resp = resp.follow() |
2499 | 2503 | |
... | ... | |
2528 | 2532 |
# check backoffice fields are available in set backoffice fields action |
2529 | 2533 |
resp = app.get('/backoffice/workflows/1/') |
2530 | 2534 |
resp = resp.click('baz') # status |
2531 |
resp = resp.click('Set Backoffice Fields')
|
|
2535 |
resp = resp.click('Backoffice Data')
|
|
2532 | 2536 |
options = [x[2] for x in resp.form['fields$element0$field_id'].options] |
2533 | 2537 |
assert '' in options |
2534 | 2538 |
assert 'foobar' in options |
... | ... | |
2680 | 2684 |
resp = resp.follow() |
2681 | 2685 | |
2682 | 2686 |
# test adding all actions |
2683 |
for action in [x[0] for x in resp.forms[0]['type'].options]: |
|
2684 |
resp.forms[0]['type'] = action |
|
2685 |
resp = resp.forms[0].submit() |
|
2686 |
resp = resp.follow() |
|
2687 |
for category in ('status-change', 'interaction', 'formdata-action', 'user-action'): |
|
2688 |
for action in [x[0] for x in resp.forms[0]['action-%s' % category].options if x[0]]: |
|
2689 |
resp.forms[0]['action-%s' % category] = action |
|
2690 |
resp = resp.forms[0].submit() |
|
2691 |
resp = resp.follow() |
|
2687 | 2692 | |
2688 | 2693 |
# test visiting |
2689 | 2694 |
action_id = Workflow.get(workflow.id).global_actions[0].id |
... | ... | |
2833 | 2838 | |
2834 | 2839 |
app = login(get_app(pub)) |
2835 | 2840 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (workflow.id, baz_status.id)) |
2836 |
assert 'Webservice Call' in resp.body
|
|
2837 |
assert 'Webservice Call "' not in resp.body
|
|
2841 |
assert 'Webservice' in resp.body |
|
2842 |
assert 'Webservice (' not in resp.body
|
|
2838 | 2843 | |
2839 | 2844 |
wscall.label = 'foowscallbar' |
2840 | 2845 |
workflow.store() |
2841 | 2846 |
resp = app.get('/backoffice/workflows/%s/status/%s/' % (workflow.id, baz_status.id)) |
2842 |
assert 'Webservice Call "foowscallbar"' in resp.body
|
|
2847 |
assert 'Webservice (foowscallbar)' in resp.body
|
|
2843 | 2848 | |
2844 | 2849 |
def test_workflows_inspect_view(pub): |
2845 | 2850 |
from wcs.workflows import WorkflowVariablesFieldsFormDef |
tests/test_workflows.py | ||
---|---|---|
3034 | 3034 |
formdata.data = {'1': 'bar'} |
3035 | 3035 | |
3036 | 3036 |
item = RedirectToUrlWorkflowStatusItem() |
3037 |
assert item.render_as_line() == 'Redirect to URL (not configured)'
|
|
3037 |
assert item.render_as_line() == 'Web Redirection (not configured)'
|
|
3038 | 3038 |
item.url = 'https://www.example.net/?foo=[form_var_foo]' |
3039 |
assert item.render_as_line() == 'Redirect to URL "https://www.example.net/?foo=[form_var_foo]"'
|
|
3039 |
assert item.render_as_line() == 'Web Redirection (to https://www.example.net/?foo=[form_var_foo])'
|
|
3040 | 3040 |
pub.substitutions.feed(formdata) |
3041 | 3041 |
assert item.perform(formdata) == 'https://www.example.net/?foo=bar' |
3042 | 3042 | |
3043 | 3043 |
item.url = 'https://www.example.net/?django={{ form_var_foo }}' |
3044 |
assert item.render_as_line() == 'Redirect to URL "https://www.example.net/?django={{ form_var_foo }}"'
|
|
3044 |
assert item.render_as_line() == 'Web Redirection (to https://www.example.net/?django={{ form_var_foo }})'
|
|
3045 | 3045 |
pub.substitutions.feed(formdata) |
3046 | 3046 |
assert item.perform(formdata) == 'https://www.example.net/?django=bar' |
3047 | 3047 |
wcs/admin/workflows.py | ||
---|---|---|
496 | 496 |
r += htmltext('<li><a href="delete" rel="popup">%s</a></li>') % _('Delete') |
497 | 497 |
r += htmltext('</ul>') |
498 | 498 |
r += htmltext('<div id="new-field">') |
499 |
r += htmltext('<h3>%s</h3>') % _('New Item')
|
|
499 |
r += htmltext('<h3>%s</h3>') % _('New Action')
|
|
500 | 500 |
r += self.get_new_item_form().render() |
501 | 501 |
r += htmltext('</div>') |
502 | 502 |
return r.getvalue() |
... | ... | |
505 | 505 |
return item.is_available(workflow=self.workflow) |
506 | 506 | |
507 | 507 |
def get_new_item_form(self): |
508 |
form = Form(enctype='multipart/form-data', action = 'newitem') |
|
508 |
form = Form(enctype='multipart/form-data', action='newitem', |
|
509 |
id='new-action-form') |
|
510 |
categories = [ |
|
511 |
('status-change', _('Change Status')), |
|
512 |
('interaction', _('Interact')), |
|
513 |
('formdata-action', _('Act on Form')), |
|
514 |
('user-action', _('Act on User')), |
|
515 |
] |
|
509 | 516 |
available_items = [x for x in item_classes if self.is_item_available(x)] |
510 |
def cmp_items(x, y): |
|
511 |
t = cmp(x.category and x.category[0], y.category and y.category[0]) |
|
512 |
if t: |
|
513 |
return t |
|
514 |
return cmp(_(x.description), _(y.description)) |
|
515 | ||
516 |
available_items.sort(cmp_items) |
|
517 |
options = [(x.key, _(x.description)) for x in available_items] |
|
518 |
form.add(SingleSelectWidget, 'type', title = _('Type'), |
|
519 |
required=True, options = options) |
|
517 |
available_items.sort(key=lambda x: _(x.description)) |
|
518 | ||
519 |
for category, category_label in categories: |
|
520 |
options = [(x.key, _(x.description)) for x in available_items |
|
521 |
if x.category == category] |
|
522 |
form.add(SingleSelectWidget, 'action-%s' % category, title=category_label, |
|
523 |
required=False, options=[(None, '')] + options) |
|
520 | 524 |
form.add_submit('submit', _('Add')) |
521 | 525 |
return form |
522 | 526 | |
... | ... | |
534 | 538 |
get_session().message = ('error', _('Submitted form was not filled properly.')) |
535 | 539 |
return redirect('.') |
536 | 540 | |
537 |
if form.get_widget('type').parse(): |
|
538 |
self.status.append_item(form.get_widget('type').parse()) |
|
539 |
else: |
|
540 |
get_session().message = ('error', _('Submitted form was not filled properly.')) |
|
541 |
return redirect('.') |
|
542 | ||
543 |
self.workflow.store() |
|
541 |
for category in ('status-change', 'interaction', 'formdata-action', 'user-action'): |
|
542 |
action_type = form.get_widget('action-%s' % category).parse() |
|
543 |
if action_type: |
|
544 |
self.status.append_item(action_type) |
|
545 |
self.workflow.store() |
|
546 |
return redirect('.') |
|
544 | 547 | |
548 |
get_session().message = ('error', _('Submitted form was not filled properly.')) |
|
545 | 549 |
return redirect('.') |
546 | 550 | |
551 | ||
547 | 552 |
def delete(self): |
548 | 553 |
form = Form(enctype="multipart/form-data") |
549 | 554 |
form.widgets.append(HtmlWidget('<p>%s</p>' % _( |
wcs/qommon/static/css/dc2/admin.css | ||
---|---|---|
1626 | 1626 |
background: #f0f0f0; |
1627 | 1627 |
} |
1628 | 1628 | |
1629 |
#new-action-form select[disabled] { |
|
1630 |
background: #f0f0f0; |
|
1631 |
} |
|
1632 | ||
1629 | 1633 |
table div.file-field img { |
1630 | 1634 |
display: none; |
1631 | 1635 |
} |
wcs/qommon/static/js/qommon.admin.js | ||
---|---|---|
87 | 87 |
$('input[type=hidden][name=submission_channel]').val($(this).val()); |
88 | 88 |
}); |
89 | 89 | |
90 |
/* new action form */ |
|
91 |
$('#new-action-form select').on('change', function() { |
|
92 |
if ($(this).val() == '') { |
|
93 |
$('#new-action-form select').prop('disabled', null) |
|
94 |
} else { |
|
95 |
$('#new-action-form select').prop('disabled', 'disabled') |
|
96 |
$(this).prop('disabled', null) |
|
97 |
} |
|
98 |
return false; |
|
99 |
}); |
|
100 | ||
90 | 101 |
/* possibility to toggle the sidebar */ |
91 | 102 |
if ($('#sidebar').length) { |
92 | 103 |
$('#main-content').after($('<span id="sidebar-toggle">⁞</span>')); |
wcs/wf/aggregation_email.py | ||
---|---|---|
27 | 27 |
from wcs.roles import Role |
28 | 28 | |
29 | 29 |
class AggregationEmailWorkflowStatusItem(WorkflowStatusItem): |
30 |
description = N_('Aggregate to summary email')
|
|
30 |
description = N_('Daily Summary Email')
|
|
31 | 31 |
key = 'aggregationemail' |
32 |
category = 'interaction' |
|
32 | 33 |
ok_in_global_action = False |
33 | 34 | |
34 | 35 |
to = [] |
35 | 36 | |
36 |
def render_as_line(self):
|
|
37 |
def get_line_details(self):
|
|
37 | 38 |
if self.to: |
38 |
return _('Aggregate for summary email to %s') % self.render_list_of_roles(self.to)
|
|
39 |
return _('to %s') % self.render_list_of_roles(self.to) |
|
39 | 40 |
else: |
40 |
return _('Aggregate for summary email (not completed)')
|
|
41 |
return _('not completed')
|
|
41 | 42 | |
42 | 43 |
def add_parameters_widgets(self, form, parameters, prefix='', formdef=None): |
43 | 44 |
if 'to' in parameters: |
wcs/wf/anonymise.py | ||
---|---|---|
17 | 17 |
from wcs.workflows import WorkflowStatusItem, register_item_class |
18 | 18 | |
19 | 19 |
class AnonymiseWorkflowStatusItem(WorkflowStatusItem): |
20 |
description = N_('Anonymise')
|
|
20 |
description = N_('Anonymisation')
|
|
21 | 21 |
key = 'anonymise' |
22 |
category = 'formdata-action' |
|
22 | 23 | |
23 | 24 |
def perform(self, formdata): |
24 | 25 |
formdata.anonymise() |
wcs/wf/attachment.py | ||
---|---|---|
66 | 66 | |
67 | 67 | |
68 | 68 |
class AddAttachmentWorkflowStatusItem(WorkflowStatusItem): |
69 |
description = N_('Allow Joining a File')
|
|
69 |
description = N_('Attachment')
|
|
70 | 70 |
key = 'addattachment' |
71 |
category = 'interaction' |
|
71 | 72 |
endpoint = False |
72 | 73 |
waitpoint = True |
73 | 74 |
ok_in_global_action = False |
... | ... | |
91 | 92 |
FileDirectory._lookup_methods.append('lookup_wf_attachment') |
92 | 93 |
FileDirectory.lookup_wf_attachment = lookup_wf_attachment |
93 | 94 | |
94 |
def render_as_line(self):
|
|
95 |
def get_line_details(self):
|
|
95 | 96 |
if self.by: |
96 |
return _('Allow Joining a File, by %s') % self.render_list_of_roles(self.by)
|
|
97 |
return _('by %s') % self.render_list_of_roles(self.by) |
|
97 | 98 |
else: |
98 |
return _('Allow Joining a File (not completed)')
|
|
99 |
return _('not completed')
|
|
99 | 100 | |
100 | 101 |
def fill_form(self, form, formdata, user): |
101 | 102 |
if self.display_title: |
wcs/wf/backoffice_fields.py | ||
---|---|---|
65 | 65 | |
66 | 66 | |
67 | 67 |
class SetBackofficeFieldsWorkflowStatusItem(WorkflowStatusItem): |
68 |
description = N_('Set Backoffice Fields')
|
|
68 |
description = N_('Backoffice Data')
|
|
69 | 69 |
key = 'set-backoffice-fields' |
70 |
category = 'formdata-action' |
|
70 | 71 | |
71 | 72 |
fields = None |
72 | 73 |
wcs/wf/criticality.py | ||
---|---|---|
25 | 25 |
MODE_SET = '3' |
26 | 26 | |
27 | 27 |
class ModifyCriticalityWorkflowStatusItem(WorkflowStatusItem): |
28 |
description = N_('Modify Criticality')
|
|
28 |
description = N_('Criticality Levels')
|
|
29 | 29 |
key = 'modify_criticality' |
30 |
category = 'formdata-action' |
|
30 | 31 | |
31 | 32 |
mode = MODE_INC |
32 | 33 |
absolute_value = None |
wcs/wf/dispatch.py | ||
---|---|---|
78 | 78 | |
79 | 79 | |
80 | 80 |
class DispatchWorkflowStatusItem(WorkflowStatusItem): |
81 |
description = N_('Assign a Function')
|
|
81 |
description = N_('Function/Role Linking')
|
|
82 | 82 |
key = 'dispatch' |
83 |
category = 'formdata-action' |
|
83 | 84 | |
84 | 85 |
role_id = None |
85 | 86 |
role_key = None |
... | ... | |
121 | 122 |
if rules: |
122 | 123 |
self.rules = rules |
123 | 124 | |
124 |
def render_as_line(self):
|
|
125 |
def get_line_details(self):
|
|
125 | 126 |
if self.role_key: |
126 | 127 |
function_label = self.parent.parent.roles.get(self.role_key, '?') |
127 |
return _('Assign a Function (%s)') % function_label
|
|
128 |
return _('Assign a Function')
|
|
128 |
return function_label |
|
129 |
return None
|
|
129 | 130 | |
130 | 131 |
def add_parameters_widgets(self, form, parameters, prefix='', formdef=None): |
131 | 132 |
if 'role_key' in parameters: |
wcs/wf/export_to_model.py | ||
---|---|---|
194 | 194 | |
195 | 195 | |
196 | 196 |
class ExportToModel(WorkflowStatusItem): |
197 |
description = N_('Create Document')
|
|
197 |
description = N_('Document Creation')
|
|
198 | 198 |
key = 'export_to_model' |
199 |
category = 'formdata-action' |
|
199 | 200 |
support_substitution_variables = True |
200 | 201 |
ok_in_global_action = False |
201 | 202 | |
... | ... | |
214 | 215 |
method = 'interactive' |
215 | 216 |
backoffice_filefield_id = None |
216 | 217 | |
217 |
def render_as_line(self):
|
|
218 |
def get_line_details(self):
|
|
218 | 219 |
if self.model_file: |
219 |
model = _('with model named %(file_name)s of %(size)s bytes') % {
|
|
220 |
return _('with model named %(file_name)s of %(size)s bytes') % {
|
|
220 | 221 |
'file_name': self.model_file.base_filename, |
221 | 222 |
'size': self.model_file.size} |
222 | 223 |
else: |
223 |
model = _('no model set') |
|
224 |
return _('Create document %(model)s') % {'model': model} |
|
224 |
return _('no model set') |
|
225 | 225 | |
226 | 226 |
def fill_form(self, form, formdata, user): |
227 | 227 |
if not self.method == 'interactive': |
wcs/wf/form.py | ||
---|---|---|
69 | 69 | |
70 | 70 | |
71 | 71 |
class FormWorkflowStatusItem(WorkflowStatusItem): |
72 |
description = N_('Display a form')
|
|
72 |
description = N_('Form')
|
|
73 | 73 |
key = 'form' |
74 |
category = 'interaction' |
|
74 | 75 |
ok_in_global_action = False |
75 | 76 |
endpoint = False |
76 | 77 |
waitpoint = True |
wcs/wf/geolocate.py | ||
---|---|---|
33 | 33 |
from wcs.workflows import WorkflowStatusItem, register_item_class |
34 | 34 | |
35 | 35 |
class GeolocateWorkflowStatusItem(WorkflowStatusItem): |
36 |
description = N_('Geolocate')
|
|
36 |
description = N_('Geolocation')
|
|
37 | 37 |
key = 'geolocate' |
38 |
category = 'formdata-action' |
|
38 | 39 | |
39 | 40 |
method = 'address_string' |
40 | 41 |
address_string = None |
wcs/wf/jump.py | ||
---|---|---|
95 | 95 | |
96 | 96 | |
97 | 97 |
class JumpWorkflowStatusItem(WorkflowStatusJumpItem): |
98 |
description = N_('Change Status Automatically')
|
|
98 |
description = N_('Automatic Jump')
|
|
99 | 99 |
key = 'jump' |
100 | 100 | |
101 | 101 |
by = [] |
... | ... | |
123 | 123 |
return True |
124 | 124 |
return False |
125 | 125 | |
126 |
def render_as_line(self):
|
|
126 |
def get_line_details(self):
|
|
127 | 127 |
if not self.status: |
128 |
return _('Change Status Automatically (not completed)')
|
|
128 |
return _('not completed')
|
|
129 | 129 |
wf_status = self.get_target_status() |
130 | 130 |
if not wf_status: |
131 |
return _('Change Status Automatically (broken)')
|
|
131 |
return _('broken')
|
|
132 | 132 |
reasons = [] |
133 | 133 |
if self.condition: |
134 | 134 |
reasons.append(_('condition')) |
... | ... | |
138 | 138 |
reasons.append(_('timeout')) |
139 | 139 | |
140 | 140 |
if reasons: |
141 |
return _('Change Status Automatically (to %(name)s) (%(reasons)s)') % {
|
|
141 |
return _('to %(name)s, %(reasons)s') % {
|
|
142 | 142 |
'name': wf_status[0].name, |
143 | 143 |
'reasons': ', '.join(reasons)} |
144 | 144 |
else: |
145 |
return _('Change Status Automatically (to %s)') % wf_status[0].name
|
|
145 |
return wf_status[0].name |
|
146 | 146 | |
147 | 147 |
def get_parameters(self): |
148 | 148 |
return ('status', 'set_marker_on_status', 'condition', 'trigger', 'by', 'timeout') |
wcs/wf/profile.py | ||
---|---|---|
99 | 99 | |
100 | 100 | |
101 | 101 |
class UpdateUserProfileStatusItem(WorkflowStatusItem): |
102 |
description = N_('Update User Profile')
|
|
102 |
description = N_('User Profile Update')
|
|
103 | 103 |
key = 'update_user_profile' |
104 |
category = 'user-action' |
|
104 | 105 | |
105 | 106 |
fields = None |
106 | 107 |
wcs/wf/redirect_to_url.py | ||
---|---|---|
20 | 20 | |
21 | 21 | |
22 | 22 |
class RedirectToUrlWorkflowStatusItem(WorkflowStatusItem): |
23 |
description = N_('Redirect to URL')
|
|
23 |
description = N_('Web Redirection')
|
|
24 | 24 |
key = 'redirect_to_url' |
25 |
category = 'formdata-action' |
|
25 | 26 |
endpoint = False |
26 | 27 |
support_substitution_variables = True |
27 | 28 | |
28 | 29 |
url = None |
29 | 30 | |
30 |
def render_as_line(self):
|
|
31 |
def get_line_details(self):
|
|
31 | 32 |
if self.url: |
32 |
return _('Redirect to URL "%s"') % self.url
|
|
33 |
return _('to %s') % self.url
|
|
33 | 34 |
else: |
34 |
return _('Redirect to URL (not configured)')
|
|
35 |
return _('not configured')
|
|
35 | 36 | |
36 | 37 |
def get_parameters(self): |
37 | 38 |
return ('url',) |
wcs/wf/register_comment.py | ||
---|---|---|
73 | 73 | |
74 | 74 | |
75 | 75 |
class RegisterCommenterWorkflowStatusItem(WorkflowStatusItem): |
76 |
description = N_('Record in Log')
|
|
76 |
description = N_('History Message')
|
|
77 | 77 |
key = 'register-comment' |
78 |
category = 'interaction' |
|
78 | 79 | |
79 | 80 |
comment = None |
80 | 81 |
wcs/wf/remove.py | ||
---|---|---|
19 | 19 |
from wcs.workflows import WorkflowStatusItem, register_item_class |
20 | 20 | |
21 | 21 |
class RemoveWorkflowStatusItem(WorkflowStatusItem): |
22 |
description = N_('Remove')
|
|
22 |
description = N_('Deletion')
|
|
23 | 23 |
key = 'remove' |
24 |
category = 'formdata-action' |
|
24 | 25 | |
25 | 26 |
def perform(self, formdata): |
26 | 27 |
formdata.remove_self() |
wcs/wf/resubmit.py | ||
---|---|---|
24 | 24 | |
25 | 25 | |
26 | 26 |
class ResubmitWorkflowStatusItem(WorkflowStatusItem): |
27 |
description = N_('Resubmit')
|
|
27 |
description = N_('Resubmission')
|
|
28 | 28 |
key = 'resubmit' |
29 |
category = 'formdata-action' |
|
29 | 30 |
endpoint = False |
30 | 31 |
waitpoint = True |
31 | 32 |
ok_in_global_action = False |
... | ... | |
39 | 40 |
def is_available(cls, workflow=None): |
40 | 41 |
return get_publisher().has_site_option('workflow-resubmit-action') |
41 | 42 | |
42 |
def render_as_line(self):
|
|
43 |
def get_line_details(self):
|
|
43 | 44 |
if self.by: |
44 |
return _('Allow resubmit by %s') % self.render_list_of_roles(self.by)
|
|
45 |
return _('by %s') % self.render_list_of_roles(self.by) |
|
45 | 46 |
else: |
46 |
return _('Allow resubmit (not completed)')
|
|
47 |
return _('not completed')
|
|
47 | 48 | |
48 | 49 |
def fill_form(self, form, formdata, user): |
49 | 50 |
label = self.label |
wcs/wf/roles.py | ||
---|---|---|
42 | 42 | |
43 | 43 | |
44 | 44 |
class AddRoleWorkflowStatusItem(WorkflowStatusItem): |
45 |
description = N_('Add Role to User')
|
|
45 |
description = N_('Role Addition')
|
|
46 | 46 |
key = 'add_role' |
47 |
category = 'user-action' |
|
47 | 48 | |
48 | 49 |
role_id = None |
49 | 50 | |
... | ... | |
110 | 111 | |
111 | 112 | |
112 | 113 |
class RemoveRoleWorkflowStatusItem(WorkflowStatusItem): |
113 |
description = N_('Remove Role from User')
|
|
114 |
description = N_('Role Removal')
|
|
114 | 115 |
key = 'remove_role' |
116 |
category = 'user-action' |
|
115 | 117 | |
116 | 118 |
role_id = None |
117 | 119 |
wcs/wf/wscall.py | ||
---|---|---|
92 | 92 | |
93 | 93 | |
94 | 94 |
class WebserviceCallStatusItem(WorkflowStatusItem): |
95 |
description = N_('Webservice Call')
|
|
95 |
description = N_('Webservice') |
|
96 | 96 |
key = 'webservice_call' |
97 |
category = 'interaction' |
|
97 | 98 |
support_substitution_variables = True |
98 | 99 | |
99 | 100 |
label = None |
... | ... | |
135 | 136 |
def method(self, value): |
136 | 137 |
self._method = value |
137 | 138 | |
138 |
def render_as_line(self):
|
|
139 |
def get_line_details(self):
|
|
139 | 140 |
if self.label: |
140 |
return _('Webservice Call "%s"') % self.label
|
|
141 |
return self.label |
|
141 | 142 |
else: |
142 |
return _('Webservice Call')
|
|
143 |
return None
|
|
143 | 144 | |
144 | 145 |
def get_parameters(self): |
145 | 146 |
return ('url', 'post', 'varname', 'request_signature_key', 'post_data', |
wcs/workflows.py | ||
---|---|---|
1510 | 1510 |
return changed |
1511 | 1511 | |
1512 | 1512 |
def render_as_line(self): |
1513 |
details = self.get_line_details() |
|
1514 |
if details: |
|
1515 |
return _(self.description) + ' (%s)' % details |
|
1513 | 1516 |
return _(self.description) |
1514 | 1517 | |
1518 |
def get_line_details(self): |
|
1519 |
return None |
|
1520 | ||
1515 | 1521 |
def render_list_of_roles(self, roles): |
1516 | 1522 |
return self.parent.parent.render_list_of_roles(roles) |
1517 | 1523 | |
... | ... | |
1725 | 1731 |
status = None |
1726 | 1732 |
endpoint = False |
1727 | 1733 |
set_marker_on_status = False |
1734 |
category = 'status-change' |
|
1728 | 1735 | |
1729 | 1736 |
def add_parameters_widgets(self, form, parameters, prefix='', formdef=None): |
1730 | 1737 |
if 'status' in parameters: |
... | ... | |
1811 | 1818 | |
1812 | 1819 | |
1813 | 1820 |
class CommentableWorkflowStatusItem(WorkflowStatusItem): |
1814 |
description = N_('Allow Comment')
|
|
1821 |
description = N_('Comment') |
|
1815 | 1822 |
key = 'commentable' |
1823 |
category = 'interaction' |
|
1816 | 1824 |
endpoint = False |
1817 | 1825 |
waitpoint = True |
1818 | 1826 |
ok_in_global_action = False |
... | ... | |
1824 | 1832 |
by = [] |
1825 | 1833 |
backoffice_info_text = None |
1826 | 1834 | |
1827 |
def render_as_line(self):
|
|
1835 |
def get_line_details(self):
|
|
1828 | 1836 |
if self.by: |
1829 |
return _('Allow Comment by %s') % self.render_list_of_roles(self.by)
|
|
1837 |
return _('by %s') % self.render_list_of_roles(self.by) |
|
1830 | 1838 |
else: |
1831 |
return _('Allow Comment (not completed)')
|
|
1839 |
return _('not completed')
|
|
1832 | 1840 | |
1833 | 1841 |
def fill_form(self, form, formdata, user): |
1834 | 1842 |
if not 'comment' in [x.name for x in form.widgets]: |
... | ... | |
1927 | 1935 | |
1928 | 1936 | |
1929 | 1937 |
class ChoiceWorkflowStatusItem(WorkflowStatusJumpItem): |
1930 |
description = N_('Change Status')
|
|
1938 |
description = N_('Manual Jump')
|
|
1931 | 1939 |
key = 'choice' |
1932 | 1940 |
endpoint = False |
1933 | 1941 |
waitpoint = True |
... | ... | |
1938 | 1946 |
backoffice_info_text = None |
1939 | 1947 |
require_confirmation = False |
1940 | 1948 | |
1941 |
def render_as_line(self):
|
|
1949 |
def get_line_details(self):
|
|
1942 | 1950 |
if self.label: |
1943 | 1951 |
more = '' |
1944 | 1952 |
if self.set_marker_on_status: |
1945 | 1953 |
more += ' ' + _('(and set marker)') |
1946 | 1954 |
if self.by: |
1947 |
return _('Change Status "%(label)s" by %(by)s%(more)s') % {
|
|
1955 |
return _('"%(label)s" by %(by)s%(more)s') % {
|
|
1948 | 1956 |
'label' : self.label, |
1949 | 1957 |
'by' : self.render_list_of_roles(self.by), |
1950 | 1958 |
'more': more |
1951 | 1959 |
} |
1952 | 1960 |
else: |
1953 |
return _('Change Status "%(label)s"%(more)s') % {
|
|
1961 |
return _('"%(label)s"%(more)s') % { |
|
1954 | 1962 |
'label': self.label, |
1955 | 1963 |
'more': more |
1956 | 1964 |
} |
1957 | 1965 |
else: |
1958 |
return _('Change Status (not completed)')
|
|
1966 |
return _('not completed')
|
|
1959 | 1967 | |
1960 | 1968 |
def fill_form(self, form, formdata, user): |
1961 | 1969 |
label = self.compute(self.label) |
... | ... | |
2005 | 2013 | |
2006 | 2014 | |
2007 | 2015 |
class JumpOnSubmitWorkflowStatusItem(WorkflowStatusJumpItem): |
2008 |
description = N_('Change Status on Submit')
|
|
2016 |
description = N_('On Submit Jump')
|
|
2009 | 2017 |
key = 'jumponsubmit' |
2010 | 2018 |
ok_in_global_action = False |
2011 | 2019 | |
2012 |
def render_as_line(self):
|
|
2020 |
def get_line_details(self):
|
|
2013 | 2021 |
if self.status: |
2014 | 2022 |
if self.get_target_status(): |
2015 |
return _('Change Status on Submit (to %s)') % self.get_target_status()[0].name
|
|
2023 |
return _('to %s') % self.get_target_status()[0].name
|
|
2016 | 2024 |
else: |
2017 |
return _('Change Status on Submit (broken)')
|
|
2025 |
return _('broken')
|
|
2018 | 2026 |
else: |
2019 |
return _('Change Status on Submit (not completed)')
|
|
2027 |
return _('not completed')
|
|
2020 | 2028 | |
2021 | 2029 |
def submit_form(self, form, formdata, user, evo): |
2022 | 2030 |
if form.is_submitted() and not form.has_errors(): |
... | ... | |
2031 | 2039 | |
2032 | 2040 | |
2033 | 2041 |
class SendmailWorkflowStatusItem(WorkflowStatusItem): |
2034 |
description = N_('Send mail')
|
|
2042 |
description = N_('Email')
|
|
2035 | 2043 |
key = 'sendmail' |
2044 |
category = 'interaction' |
|
2036 | 2045 |
support_substitution_variables = True |
2037 | 2046 | |
2038 | 2047 |
to = [] |
... | ... | |
2077 | 2086 |
def get_to_parameter_view_value(self): |
2078 | 2087 |
return self.render_list_of_roles_or_emails(self.to) |
2079 | 2088 | |
2080 |
def render_as_line(self):
|
|
2089 |
def get_line_details(self):
|
|
2081 | 2090 |
if self.to: |
2082 |
return _('Send mail to %s') % self.render_list_of_roles_or_emails(self.to)
|
|
2091 |
return _('to %s') % self.render_list_of_roles_or_emails(self.to) |
|
2083 | 2092 |
else: |
2084 |
return _('Send mail (not completed)')
|
|
2093 |
return _('not completed')
|
|
2085 | 2094 | |
2086 | 2095 |
def get_parameters(self): |
2087 | 2096 |
return ('to', 'subject', 'body', 'attachments', 'custom_from') |
... | ... | |
2313 | 2322 | |
2314 | 2323 | |
2315 | 2324 |
class SendSMSWorkflowStatusItem(WorkflowStatusItem): |
2316 |
description = N_('Send SMS')
|
|
2325 |
description = N_('SMS') |
|
2317 | 2326 |
key = 'sendsms' |
2327 |
category = 'interaction' |
|
2318 | 2328 |
support_substitution_variables = True |
2319 | 2329 | |
2320 | 2330 |
to = [] |
... | ... | |
2329 | 2339 |
sms_mode = get_cfg('sms', {}).get('mode') or 'none' |
2330 | 2340 |
return sms_mode != 'none' |
2331 | 2341 | |
2332 |
def render_as_line(self): |
|
2333 |
return _('Send SMS') |
|
2334 | ||
2335 | 2342 |
def fill_admin_form(self, form): |
2336 | 2343 |
self.add_parameters_widgets(form, self.get_parameters()) |
2337 | 2344 | |
... | ... | |
2383 | 2390 | |
2384 | 2391 | |
2385 | 2392 |
class DisplayMessageWorkflowStatusItem(WorkflowStatusItem): |
2386 |
description = N_('Display message')
|
|
2393 |
description = N_('Top Message')
|
|
2387 | 2394 |
key = 'displaymsg' |
2395 |
category = 'interaction' |
|
2388 | 2396 |
support_substitution_variables = True |
2389 | 2397 |
ok_in_global_action = False |
2390 | 2398 | |
... | ... | |
2392 | 2400 | |
2393 | 2401 |
message = None |
2394 | 2402 | |
2395 |
def render_as_line(self):
|
|
2403 |
def get_line_details(self):
|
|
2396 | 2404 |
if self.to: |
2397 |
return _('Display message to %s') % self.render_list_of_roles(self.to)
|
|
2405 |
return _('to %s') % self.render_list_of_roles(self.to) |
|
2398 | 2406 |
else: |
2399 |
return _('Display message')
|
|
2407 |
return None
|
|
2400 | 2408 | |
2401 | 2409 |
def get_message(self, filled): |
2402 | 2410 |
if not self.message: |
... | ... | |
2455 | 2463 | |
2456 | 2464 | |
2457 | 2465 |
class RedirectToStatusWorkflowStatusItem(WorkflowStatusItem): |
2458 |
description = N_('Redirect to Status Page')
|
|
2466 |
description = N_('Status Page Redirection')
|
|
2459 | 2467 |
key = 'redirectstatus' |
2460 | 2468 |
ok_in_global_action = False |
2461 | 2469 | |
... | ... | |
2478 | 2486 | |
2479 | 2487 | |
2480 | 2488 |
class EditableWorkflowStatusItem(WorkflowStatusItem): |
2481 |
description = N_('Allow Edition')
|
|
2489 |
description = N_('Edition') |
|
2482 | 2490 |
key = 'editable' |
2491 |
category = 'formdata-action' |
|
2483 | 2492 |
endpoint = False |
2484 | 2493 |
waitpoint = True |
2485 | 2494 |
ok_in_global_action = False |
... | ... | |
2489 | 2498 |
label = None |
2490 | 2499 |
backoffice_info_text = None |
2491 | 2500 | |
2492 |
def render_as_line(self):
|
|
2501 |
def get_line_details(self):
|
|
2493 | 2502 |
if self.by: |
2494 |
return _('Allow Edition by %s') % self.render_list_of_roles(self.by)
|
|
2503 |
return _('by %s') % self.render_list_of_roles(self.by) |
|
2495 | 2504 |
else: |
2496 |
return _('Allow Edition (not completed)')
|
|
2505 |
return _('not completed')
|
|
2497 | 2506 | |
2498 | 2507 |
def fill_form(self, form, formdata, user): |
2499 | 2508 |
label = self.label |
2500 |
- |