0001-backoffice-don-t-let-new-forms-be-created-when-welco.patch
wcs/backoffice/submission.py | ||
---|---|---|
195 | 195 |
misc_cat.formdefs = [x for x in list_forms if not x.category] |
196 | 196 |
cats.append(misc_cat) |
197 | 197 | |
198 |
welco_url = get_publisher().get_site_option('welco_url', 'variables') |
|
199 | ||
198 | 200 |
r = TemplateIO(html=True) |
199 |
for mode in ['empty', 'create', 'existing']: |
|
201 |
modes = ['empty', 'create', 'existing'] |
|
202 |
if welco_url: |
|
203 |
modes.remove('create') |
|
204 |
empty = True |
|
205 |
for mode in modes: |
|
200 | 206 |
list_content = TemplateIO() |
201 | 207 |
for cat in cats: |
202 | 208 |
if not cat.formdefs: |
... | ... | |
204 | 210 |
list_content += self.form_list(cat.formdefs, title=cat.name, mode=mode) |
205 | 211 |
if not list_content.getvalue().strip(): |
206 | 212 |
continue |
213 |
empty = False |
|
207 | 214 |
r += htmltext('<div class="bo-block">') |
208 | 215 |
r += htmltext('<h2>%s</h2>') % { |
209 | 216 |
'create': _('Submission'), |
... | ... | |
215 | 222 |
r += htmltext('</ul>') |
216 | 223 |
r += htmltext('</div>') |
217 | 224 | |
225 |
if empty and welco_url: |
|
226 |
return redirect(welco_url) |
|
227 | ||
218 | 228 |
return r.getvalue() |
219 | 229 | |
220 | 230 |
def form_list(self, formdefs, title=None, mode='create'): |
221 |
- |