0001-backoffice-add-a-secret-formdata-inspector-page-6099.patch
tests/test_backoffice_pages.py | ||
---|---|---|
1955 | 1955 |
formdata.store() |
1956 | 1956 |
resp = app.get(formdata.get_url(backoffice=True)) |
1957 | 1957 |
assert 'Criticality Level: red' in resp.body |
1958 | ||
1959 |
def test_inspect_page(pub): |
|
1960 |
user = create_user(pub) |
|
1961 |
create_environment(pub) |
|
1962 | ||
1963 |
formdef = FormDef.get_by_urlname('form-title') |
|
1964 |
formdata = [x for x in formdef.data_class().select() if x.status == 'wf-new'][0] |
|
1965 | ||
1966 |
resp = login(get_app(pub)).get('%sinspect' % formdata.get_url(backoffice=True), status=403) |
|
1967 | ||
1968 |
user = create_user(pub, is_admin=True) |
|
1969 |
resp = login(get_app(pub)).get('%sinspect' % formdata.get_url(backoffice=True), status=200) |
wcs/backoffice/management.py | ||
---|---|---|
19 | 19 |
import datetime |
20 | 20 |
import json |
21 | 21 |
import time |
22 |
import types |
|
22 | 23 | |
23 | 24 |
try: |
24 | 25 |
import xlwt |
... | ... | |
1620 | 1621 | |
1621 | 1622 | |
1622 | 1623 |
class FormBackOfficeStatusPage(FormStatusPage): |
1623 |
_q_exports = ['', 'download', 'json', 'action'] |
|
1624 |
_q_exports = ['', 'download', 'json', 'action', 'inspect']
|
|
1624 | 1625 |
form_page_class = FormFillPage |
1625 | 1626 | |
1626 | 1627 |
def html_top(self, title = None): |
... | ... | |
1798 | 1799 | |
1799 | 1800 |
return r.getvalue() |
1800 | 1801 | |
1802 |
def inspect(self): |
|
1803 |
if not get_publisher().get_backoffice_root().is_accessible('forms'): |
|
1804 |
raise errors.AccessForbiddenError() |
|
1805 |
get_response().breadcrumb.append(('inspect', _('Form Inspector'))) |
|
1806 |
self.html_top(self.formdef.name) |
|
1807 |
r = TemplateIO(html=True) |
|
1808 |
r += htmltext('<div class="bo-block">') |
|
1809 |
r += htmltext('<h2>%s</h2>') % _('Form Inspector') |
|
1810 |
r += htmltext('<ul class="biglist form-inspector">') |
|
1811 |
r += htmltext(' <li><h3>%s</h3></li>') % _('Substitution variables') |
|
1812 |
for k, v in sorted(self.filled.get_substitution_variables().items()): |
|
1813 |
r += htmltext('<li><code>%s</code>') % k |
|
1814 |
r += htmltext(' <div class="value"><span>%s</span>') % v |
|
1815 |
if not isinstance(v, basestring): |
|
1816 |
r += htmltext(' <span class="type">(%s)</span>') % type(v) |
|
1817 |
r += htmltext('</div>') |
|
1818 |
r += htmltext('</ul>') |
|
1819 |
return r.getvalue() |
|
1820 | ||
1801 | 1821 | |
1802 | 1822 |
class FakeField(object): |
1803 | 1823 |
def __init__(self, id, type_, label): |
wcs/qommon/static/css/dc2/admin.css | ||
---|---|---|
1285 | 1285 |
.c-360-user-view li > span { |
1286 | 1286 |
padding-left: 1ex; |
1287 | 1287 |
} |
1288 | ||
1289 |
ul.form-inspector li code { |
|
1290 |
padding: 0 1ex; |
|
1291 |
float: left; |
|
1292 |
width: 25%; |
|
1293 |
} |
|
1294 | ||
1295 |
ul.form-inspector li div.value { |
|
1296 |
display: block; |
|
1297 |
padding: 0 0 0.5ex 1em; |
|
1298 |
float: right; |
|
1299 |
width: 70%; |
|
1300 |
} |
|
1301 | ||
1302 |
ul.form-inspector li div.value span.type { |
|
1303 |
font-size: 80%; |
|
1304 |
color: #aaa; |
|
1305 |
} |
|
1288 |
- |