fix imports.
[Plinn.git] / skins / custom_generic / reconfig_form.py
1 ##parameters=change='', ajax=''
2 ##
3 from Products.CMFCore.utils import getUtilityByInterfaceName
4 from Products.CMFCore.utils import getToolByName
5
6 atool = getToolByName(script, 'portal_actions')
7 ptool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IPropertiesTool')
8
9 form = context.REQUEST.form
10 if change and \
11 context.portal_config_control(**form) and \
12 context.setRedirect(atool, 'global/configPortal', ajax=ajax):
13 return
14
15
16 options = {}
17
18 target = atool.getActionInfo('global/configPortal')['url']
19 buttons = []
20 buttons.append( {'name': 'change', 'value': 'Change'} )
21
22 ajax_config = ptool.getProperty('ajax_config')
23 options['form'] = { 'action': target,
24 'email_from_name': ptool.getProperty('email_from_name'),
25 'email_from_address': ptool.getProperty('email_from_address'),
26 'smtp_server': ptool.smtp_server(),
27 'title': ptool.title(),
28 'description': ptool.getProperty('description'),
29 'keywords': '\n'.join(ptool.getProperty('keywords', [])),
30 'copyright_notice': ptool.getProperty('copyright_notice'),
31 'validate_email': ptool.getProperty('validate_email'),
32 'default_charset': ptool.getProperty('default_charset', ''),
33 'slide_size' : ptool.getProperty('slide_size', ''),
34 'listButtonInfos': tuple(buttons),
35 'ajax_rootClickHandler' : ajax_config & 1 == 1,
36 'ajax_autoFormManager' : ajax_config & 2 == 2 }
37
38 return context.reconfig_template(**options)