0001-backoffice-include-associated-user-in-submission-sid.patch
tests/test_backoffice_pages.py | ||
---|---|---|
3364 | 3364 |
resp = resp.follow() # redirect to created draft |
3365 | 3365 |
resp = resp.follow() # redirect to ?mt= |
3366 | 3366 | |
3367 |
# check user is mentioned in sidebar |
|
3368 |
assert '<h3>Associated User</h3>' in resp |
|
3369 |
assert '<p>%s</p>' % local_user.get_display_name() in resp |
|
3370 | ||
3367 | 3371 |
assert resp.form['f1'].value == local_user.email # prefill with form_user_email |
3368 | 3372 |
resp.form['f2'] = 'baz' |
3369 | 3373 |
resp.form['f3'] = 'C' |
wcs/backoffice/submission.py | ||
---|---|---|
26 | 26 |
from ..qommon.backoffice.menu import html_top |
27 | 27 |
from ..qommon.form import * |
28 | 28 |
from ..qommon.storage import Equal, NotEqual |
29 |
from ..qommon.template import Template |
|
29 | 30 |
from ..qommon import errors, misc |
30 | 31 | |
31 | 32 |
from wcs.formdata import FormData |
... | ... | |
186 | 187 |
else: |
187 | 188 |
r += htmltext('<p>-</p>') |
188 | 189 | |
190 |
if formdata and formdata.user_id and formdata.get_user(): |
|
191 |
r += htmltext('<div class="extra-context">') |
|
192 |
r += htmltext('<h3>%s</h3>') % _('Associated User') |
|
193 |
users_cfg = misc.get_cfg('users', {}) |
|
194 |
sidebar_user_template = users_cfg.get('sidebar_template') |
|
195 |
if sidebar_user_template: |
|
196 |
variables = get_publisher().substitutions.get_context_variables(mode='lazy') |
|
197 |
sidebar_user = Template(sidebar_user_template).render(variables) |
|
198 |
if not sidebar_user.startswith('<'): |
|
199 |
sidebar_user = htmltext('<p>%s</p>' % sidebar_user) |
|
200 |
r += sidebar_user |
|
201 |
else: |
|
202 |
r += htmltext('<p>%s</p>') % formdata.get_user().display_name |
|
203 |
r += htmltext('</div>') |
|
204 | ||
189 | 205 |
welco_url = get_publisher().get_site_option('welco_url', 'options') |
190 | 206 |
if formdata and formdata.submission_context: |
191 | 207 |
from .management import FormBackOfficeStatusPage |
192 |
- |