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,
|
submit=getCheckoutView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def getButtonAction(self):
|
||||||
|
form = self.request.form
|
||||||
|
for bn in self.buttonActions:
|
||||||
|
if bn in form:
|
||||||
|
return bn
|
||||||
|
return None
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def nextUrl(self):
|
def nextUrl(self):
|
||||||
return self.getNextUrl()
|
return self.getNextUrl()
|
||||||
|
@ -132,11 +139,9 @@ class BaseView(object):
|
||||||
#viewName = 'thankyou.html'
|
#viewName = 'thankyou.html'
|
||||||
viewName = ''
|
viewName = ''
|
||||||
url = ''
|
url = ''
|
||||||
form = self.request.form
|
bn = self.getButtonAction()
|
||||||
for bn in self.buttonActions:
|
if bn:
|
||||||
if bn in form:
|
url = self.buttonActions[bn](self)
|
||||||
url = self.buttonActions[bn](self)
|
|
||||||
break
|
|
||||||
return '%s?id=%s' % (url, self.clientName)
|
return '%s?id=%s' % (url, self.clientName)
|
||||||
#return '%s/%s?id=%s' % (self.url, viewName, self.clientName)
|
#return '%s/%s?id=%s' % (self.url, viewName, self.clientName)
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,10 @@ class SchemaView(BaseView):
|
||||||
newClient = True
|
newClient = True
|
||||||
instance = component.getAdapter(client, IInstance, name='editor')
|
instance = component.getAdapter(client, IInstance, name='editor')
|
||||||
instance.template = self.context
|
instance.template = self.context
|
||||||
self.formState = formState = instance.applyTemplate(form)
|
ignoreValidation = (self.getButtonAction() == 'submit_previous')
|
||||||
if formState.severity > 0:
|
self.formState = formState = instance.applyTemplate(form,
|
||||||
|
ignoreValidation=ignoreValidation)
|
||||||
|
if formState.severity > 0 and not ignoreValidation:
|
||||||
# show form again; do not add client to manager
|
# show form again; do not add client to manager
|
||||||
return True
|
return True
|
||||||
if newClient:
|
if newClient:
|
||||||
|
|
|
@ -69,12 +69,13 @@ class Editor(BaseInstance):
|
||||||
|
|
||||||
def applyTemplate(self, data={}, *args, **kw):
|
def applyTemplate(self, data={}, *args, **kw):
|
||||||
fieldHandlers = kw.get('fieldHandlers', {})
|
fieldHandlers = kw.get('fieldHandlers', {})
|
||||||
|
ignoreValidation = kw.get('ignoreValidation', False)
|
||||||
template = self.template
|
template = self.template
|
||||||
context = self.context
|
context = self.context
|
||||||
formState = self.validate(data)
|
formState = self.validate(data)
|
||||||
if template is None:
|
if template is None:
|
||||||
return formState
|
return formState
|
||||||
if formState.severity > 0:
|
if formState.severity > 0 and not ignoreValidation:
|
||||||
# don't do anything if there is an error
|
# don't do anything if there is an error
|
||||||
return formState
|
return formState
|
||||||
for f in template.components:
|
for f in template.components:
|
||||||
|
@ -169,8 +170,9 @@ class ClientInstanceEditor(ClientInstance):
|
||||||
template = self.template
|
template = self.template
|
||||||
if template is None:
|
if template is None:
|
||||||
return FormState()
|
return FormState()
|
||||||
|
ignoreValidation = kw.get('ignoreValidation', False)
|
||||||
formState = self.validate(data)
|
formState = self.validate(data)
|
||||||
if formState.severity > 0:
|
if formState.severity > 0 and not ignoreValidation:
|
||||||
# don't do anything if there is an error
|
# don't do anything if there is an error
|
||||||
return formState
|
return formState
|
||||||
attrs = getattr(self.context, self.attrsName, None)
|
attrs = getattr(self.context, self.attrsName, None)
|
||||||
|
@ -185,6 +187,8 @@ class ClientInstanceEditor(ClientInstance):
|
||||||
continue
|
continue
|
||||||
if name in data:
|
if name in data:
|
||||||
fi = formState.fieldInstances[name]
|
fi = formState.fieldInstances[name]
|
||||||
|
if fi.severity > 0: # never store faulty field input
|
||||||
|
continue
|
||||||
value = fi.unmarshall(data.get(name))
|
value = fi.unmarshall(data.get(name))
|
||||||
oldValue = values.get(name)
|
oldValue = values.get(name)
|
||||||
if value != oldValue:
|
if value != oldValue:
|
||||||
|
|
|
@ -91,6 +91,7 @@ fieldTypes = SimpleVocabulary((
|
||||||
instanceName='fileupload'),
|
instanceName='fileupload'),
|
||||||
#FieldType('checkbox', 'checkbox', u'Checkbox'),
|
#FieldType('checkbox', 'checkbox', u'Checkbox'),
|
||||||
FieldType('dropdown', 'dropdown', u'Drop-down selection'),
|
FieldType('dropdown', 'dropdown', u'Drop-down selection'),
|
||||||
|
#FieldType('listbox', 'listbox', u'List box (multiple selection)'),
|
||||||
FieldType('calculated', 'display', u'Calculated Value',
|
FieldType('calculated', 'display', u'Calculated Value',
|
||||||
instanceName='calculated'),
|
instanceName='calculated'),
|
||||||
FieldType('spacer', 'spacer', u'Spacer',
|
FieldType('spacer', 'spacer', u'Spacer',
|
||||||
|
|
|
@ -206,6 +206,7 @@ class CheckoutView(ServiceManagerView):
|
||||||
service = reg.service
|
service = reg.service
|
||||||
result.append(dict(service=service.title,
|
result.append(dict(service=service.title,
|
||||||
fromTo=self.getFromTo(service),
|
fromTo=self.getFromTo(service),
|
||||||
|
location=service.location,
|
||||||
number=reg.number,
|
number=reg.number,
|
||||||
serviceObject=service))
|
serviceObject=service))
|
||||||
return result
|
return result
|
||||||
|
@ -222,9 +223,9 @@ class CheckoutView(ServiceManagerView):
|
||||||
def listRegistrationsText(self):
|
def listRegistrationsText(self):
|
||||||
result = []
|
result = []
|
||||||
for info in self.getRegistrationsInfo():
|
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:
|
if info['serviceObject'].allowRegWithNumber:
|
||||||
line += 'Teilnehmer: %s\n' % info['number']
|
line += '\nTeilnehmer: %s\n' % info['number']
|
||||||
result.append(line)
|
result.append(line)
|
||||||
return '\n'.join(result)
|
return '\n'.join(result)
|
||||||
|
|
||||||
|
@ -234,6 +235,7 @@ class CheckoutView(ServiceManagerView):
|
||||||
<th width="5%%">Teilnehmer</th>
|
<th width="5%%">Teilnehmer</th>
|
||||||
<th>Angebot</th>
|
<th>Angebot</th>
|
||||||
<th>Datum/Uhrzeit</th>
|
<th>Datum/Uhrzeit</th>
|
||||||
|
<th>Ort</th>
|
||||||
</tr>
|
</tr>
|
||||||
%s
|
%s
|
||||||
</table>
|
</table>
|
||||||
|
@ -243,13 +245,15 @@ class CheckoutView(ServiceManagerView):
|
||||||
<td width="5%%">%i</td>
|
<td width="5%%">%i</td>
|
||||||
<td>%s</td>
|
<td>%s</td>
|
||||||
<td style="white-space: nowrap">%s</td>
|
<td style="white-space: nowrap">%s</td>
|
||||||
|
<td>%s</td>
|
||||||
</tr>
|
</tr>
|
||||||
'''
|
'''
|
||||||
def listRegistrationsHtml(self):
|
def listRegistrationsHtml(self):
|
||||||
result = []
|
result = []
|
||||||
for info in self.getRegistrationsInfo():
|
for info in self.getRegistrationsInfo():
|
||||||
line = self.row % (info['number'], info['service'],
|
line = self.row % (info['number'], info['service'],
|
||||||
info['fromTo'].replace(' ', ' '))
|
info['fromTo'].replace(' ', ' '),
|
||||||
|
info['location'])
|
||||||
result.append(line)
|
result.append(line)
|
||||||
return self.html % '\n'.join(result)
|
return self.html % '\n'.join(result)
|
||||||
|
|
||||||
|
|
|
@ -237,7 +237,7 @@ class IService(Interface):
|
||||||
'waiting list.'),
|
'waiting list.'),
|
||||||
required=False,)
|
required=False,)
|
||||||
location = schema.TextLine(
|
location = schema.TextLine(
|
||||||
title=_(u'Location Information'),
|
title=_(u'Location information'),
|
||||||
description=_(u'Basic location information or '
|
description=_(u'Basic location information or '
|
||||||
'start point for transport services.'),
|
'start point for transport services.'),
|
||||||
required=False,)
|
required=False,)
|
||||||
|
@ -247,7 +247,7 @@ class IService(Interface):
|
||||||
'about the location.'),
|
'about the location.'),
|
||||||
required=False,)
|
required=False,)
|
||||||
location2 = schema.TextLine(
|
location2 = schema.TextLine(
|
||||||
title=_(u'Location Information (2)'),
|
title=_(u'Location information (2)'),
|
||||||
description=_(u'Additional location information or '
|
description=_(u'Additional location information or '
|
||||||
'end point for transport services.'),
|
'end point for transport services.'),
|
||||||
required=False,)
|
required=False,)
|
||||||
|
@ -261,6 +261,11 @@ class IService(Interface):
|
||||||
description=_(u'Web address (URL) for more information '
|
description=_(u'Web address (URL) for more information '
|
||||||
'about the service.'),
|
'about the service.'),
|
||||||
required=False,)
|
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 '
|
availableCapacity = Attribute('Available capacity, i.e. number of seats '
|
||||||
'still available; a negative number means: '
|
'still available; a negative number means: '
|
||||||
|
|
Loading…
Add table
Reference in a new issue