Back to index

plone3  3.1.7
__init__.py
Go to the documentation of this file.
00001 from Products.Five.browser import pagetemplatefile
00002 from plone.app.form._named import named_template_adapter
00003 from zope.formlib import namedtemplate, interfaces
00004 from zope import i18n
00005 
00006 from plone.app.form import _patches
00007 _patches.apply_patches()
00008 
00009 @namedtemplate.implementation(interfaces.IAction)
00010 def render_submit_button(self):
00011     """A custom version of the submit button that uses plone's context class"""
00012     if not self.available():
00013         return ''
00014     label = self.label
00015     if isinstance(label, i18n.Message):
00016         label = i18n.translate(self.label, context=self.form.request)
00017     return ('<input type="submit" id="%s" name="%s" value="%s"'
00018             ' class="context" />' %
00019             (self.__name__, self.__name__, label)
00020             )
00021 
00022 __all__ = ('named_template_adapter', 'default_named_template')
00023 
00024 _template = pagetemplatefile.ViewPageTemplateFile('pageform.pt')
00025 default_named_template_adapter = named_template_adapter(_template)
00026 
00027 _subpage_template = pagetemplatefile.ViewPageTemplateFile('subpageform.pt')
00028 default_subpage_template = named_template_adapter(_subpage_template)
00029 
00030 _template = pagetemplatefile.ViewPageTemplateFile('addingpageform.pt')
00031 adding_named_template_adapter = named_template_adapter(_template)