From 21d3bc02dbe78b5ca3fef51e36f28b9fcaaf0eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 11 Jan 2016 12:41:47 +0100 Subject: [PATCH] backoffice: don't let new forms be created when welco is deployed (#9500) --- wcs/backoffice/submission.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wcs/backoffice/submission.py b/wcs/backoffice/submission.py index b4b89ad..f505e41 100644 --- a/wcs/backoffice/submission.py +++ b/wcs/backoffice/submission.py @@ -195,8 +195,14 @@ class SubmissionDirectory(Directory): misc_cat.formdefs = [x for x in list_forms if not x.category] cats.append(misc_cat) + welco_url = get_publisher().get_site_option('welco_url', 'variables') + r = TemplateIO(html=True) - for mode in ['empty', 'create', 'existing']: + modes = ['empty', 'create', 'existing'] + if welco_url: + modes.remove('create') + empty = True + for mode in modes: list_content = TemplateIO() for cat in cats: if not cat.formdefs: @@ -204,6 +210,7 @@ class SubmissionDirectory(Directory): list_content += self.form_list(cat.formdefs, title=cat.name, mode=mode) if not list_content.getvalue().strip(): continue + empty = False r += htmltext('
') r += htmltext('

%s

') % { 'create': _('Submission'), @@ -215,6 +222,9 @@ class SubmissionDirectory(Directory): r += htmltext('') r += htmltext('
') + if empty and welco_url: + return redirect(welco_url) + return r.getvalue() def form_list(self, formdefs, title=None, mode='create'): -- 2.7.0.rc3