diff --git a/composer/schema/browser/common.py b/composer/schema/browser/common.py index 795f57f..eea8de0 100644 --- a/composer/schema/browser/common.py +++ b/composer/schema/browser/common.py @@ -124,6 +124,13 @@ class BaseView(object): submit=getCheckoutView, ) + def getButtonAction(self): + form = self.request.form + for bn in self.buttonActions: + if bn in form: + return bn + return None + @Lazy def nextUrl(self): return self.getNextUrl() @@ -132,11 +139,9 @@ class BaseView(object): #viewName = 'thankyou.html' viewName = '' url = '' - form = self.request.form - for bn in self.buttonActions: - if bn in form: - url = self.buttonActions[bn](self) - break + bn = self.getButtonAction() + if bn: + url = self.buttonActions[bn](self) return '%s?id=%s' % (url, self.clientName) #return '%s/%s?id=%s' % (self.url, viewName, self.clientName) diff --git a/composer/schema/browser/schema.py b/composer/schema/browser/schema.py index 5495cbf..f0afd7a 100644 --- a/composer/schema/browser/schema.py +++ b/composer/schema/browser/schema.py @@ -89,8 +89,10 @@ class SchemaView(BaseView): newClient = True instance = component.getAdapter(client, IInstance, name='editor') instance.template = self.context - self.formState = formState = instance.applyTemplate(form) - if formState.severity > 0: + ignoreValidation = (self.getButtonAction() == 'submit_previous') + self.formState = formState = instance.applyTemplate(form, + ignoreValidation=ignoreValidation) + if formState.severity > 0 and not ignoreValidation: # show form again; do not add client to manager return True if newClient: diff --git a/composer/schema/instance.py b/composer/schema/instance.py index ec4303b..8926b49 100644 --- a/composer/schema/instance.py +++ b/composer/schema/instance.py @@ -69,12 +69,13 @@ class Editor(BaseInstance): def applyTemplate(self, data={}, *args, **kw): fieldHandlers = kw.get('fieldHandlers', {}) + ignoreValidation = kw.get('ignoreValidation', False) template = self.template context = self.context formState = self.validate(data) if template is None: return formState - if formState.severity > 0: + if formState.severity > 0 and not ignoreValidation: # don't do anything if there is an error return formState for f in template.components: @@ -169,8 +170,9 @@ class ClientInstanceEditor(ClientInstance): template = self.template if template is None: return FormState() + ignoreValidation = kw.get('ignoreValidation', False) formState = self.validate(data) - if formState.severity > 0: + if formState.severity > 0 and not ignoreValidation: # don't do anything if there is an error return formState attrs = getattr(self.context, self.attrsName, None) @@ -185,6 +187,8 @@ class ClientInstanceEditor(ClientInstance): continue if name in data: fi = formState.fieldInstances[name] + if fi.severity > 0: # never store faulty field input + continue value = fi.unmarshall(data.get(name)) oldValue = values.get(name) if value != oldValue: diff --git a/composer/schema/interfaces.py b/composer/schema/interfaces.py index 878a183..7e8ed7a 100644 --- a/composer/schema/interfaces.py +++ b/composer/schema/interfaces.py @@ -91,6 +91,7 @@ fieldTypes = SimpleVocabulary(( instanceName='fileupload'), #FieldType('checkbox', 'checkbox', u'Checkbox'), FieldType('dropdown', 'dropdown', u'Drop-down selection'), + #FieldType('listbox', 'listbox', u'List box (multiple selection)'), FieldType('calculated', 'display', u'Calculated Value', instanceName='calculated'), FieldType('spacer', 'spacer', u'Spacer', diff --git a/organize/browser/service.py b/organize/browser/service.py index df66260..ab67c4d 100644 --- a/organize/browser/service.py +++ b/organize/browser/service.py @@ -206,6 +206,7 @@ class CheckoutView(ServiceManagerView): service = reg.service result.append(dict(service=service.title, fromTo=self.getFromTo(service), + location=service.location, number=reg.number, serviceObject=service)) return result @@ -222,9 +223,9 @@ class CheckoutView(ServiceManagerView): def listRegistrationsText(self): result = [] for info in self.getRegistrationsInfo(): - line = '%s\n%s\n' % (info['service'], info['fromTo']) + line = '\n'.join((info['service'], info['fromTo'], info['location'])) if info['serviceObject'].allowRegWithNumber: - line += 'Teilnehmer: %s\n' % info['number'] + line += '\nTeilnehmer: %s\n' % info['number'] result.append(line) return '\n'.join(result) @@ -234,6 +235,7 @@ class CheckoutView(ServiceManagerView):