prio 1 changes, see notes 2007-11-26
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2197 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
a41f3615d9
commit
aa4ce1bbf5
6 changed files with 35 additions and 14 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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):
|
|||
<th width="5%%">Teilnehmer</th>
|
||||
<th>Angebot</th>
|
||||
<th>Datum/Uhrzeit</th>
|
||||
<th>Ort</th>
|
||||
</tr>
|
||||
%s
|
||||
</table>
|
||||
|
@ -243,13 +245,15 @@ class CheckoutView(ServiceManagerView):
|
|||
<td width="5%%">%i</td>
|
||||
<td>%s</td>
|
||||
<td style="white-space: nowrap">%s</td>
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
'''
|
||||
def listRegistrationsHtml(self):
|
||||
result = []
|
||||
for info in self.getRegistrationsInfo():
|
||||
line = self.row % (info['number'], info['service'],
|
||||
info['fromTo'].replace(' ', ' '))
|
||||
info['fromTo'].replace(' ', ' '),
|
||||
info['location'])
|
||||
result.append(line)
|
||||
return self.html % '\n'.join(result)
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ class IService(Interface):
|
|||
'waiting list.'),
|
||||
required=False,)
|
||||
location = schema.TextLine(
|
||||
title=_(u'Location Information'),
|
||||
title=_(u'Location information'),
|
||||
description=_(u'Basic location information or '
|
||||
'start point for transport services.'),
|
||||
required=False,)
|
||||
|
@ -247,7 +247,7 @@ class IService(Interface):
|
|||
'about the location.'),
|
||||
required=False,)
|
||||
location2 = schema.TextLine(
|
||||
title=_(u'Location Information (2)'),
|
||||
title=_(u'Location information (2)'),
|
||||
description=_(u'Additional location information or '
|
||||
'end point for transport services.'),
|
||||
required=False,)
|
||||
|
@ -261,6 +261,11 @@ class IService(Interface):
|
|||
description=_(u'Web address (URL) for more information '
|
||||
'about the service.'),
|
||||
required=False,)
|
||||
infoUrl = schema.TextLine(
|
||||
title=_(u'Additional information'),
|
||||
description=_(u'Web address (URL) of a document that '
|
||||
'offers additional information.'),
|
||||
required=False,)
|
||||
|
||||
availableCapacity = Attribute('Available capacity, i.e. number of seats '
|
||||
'still available; a negative number means: '
|
||||
|
|
Loading…
Add table
Reference in a new issue