Ejemplo n.º 1
0
 def initializeArchetype(self, **kwargs):
     """Pre-populate the press room folder with its basic folders.
     """
     ATFolder.initializeArchetype(self,**kwargs)
     
     # create sub-folders
     self._createSubFolders()
 def initializeArchetype(self, **kwargs):
     """ Create initial SignupSheet configuration
     """
     ATFolder.initializeArchetype(self, **kwargs)
     pm = getToolByName(self, 'portal_membership')
     portal_factory = getToolByName(self, 'portal_factory')
     if not pm.isAnonymousUser() and not portal_factory.isTemporary(self):
         ISignupSheetInitializer(self).form_initializer(**kwargs)
     else:
         logger.debug("Anonymous user: not allowed to create fields")
 def initializeArchetype(self, **kwargs):
     """ Create initial SignupSheet configuration
     """
     ATFolder.initializeArchetype(self, **kwargs)
     pm = getToolByName(self, 'portal_membership')
     portal_factory = getToolByName(self, 'portal_factory')
     if not pm.isAnonymousUser() and not portal_factory.isTemporary(self):
         ISignupSheetInitializer(self).form_initializer(**kwargs)
     else:
         logger.debug("Anonymous user: not allowed to create fields")
Ejemplo n.º 4
0
    def initializeArchetype(self, **kwargs):
        """ Create sample content that may help folks
            figure out how this gadget works.
        """

        ATFolder.initializeArchetype(self, **kwargs)

        self.setSubmitLabel(zope.i18n.translate(_(u'pfg_formfolder_submit', u'Submit'), context=self.REQUEST))
        self.setResetLabel(zope.i18n.translate(_(u'pfg_formfolder_reset', u'Reset'), context=self.REQUEST))

        oids = self.objectIds()

        # if we have *any* content already, we don't need
        # the sample content
        if not oids:

            haveMailer = False
            # create a mail action
            try:
                self.invokeFactory('FormMailerAdapter', 'mailer')
                mailer = self['mailer']

                mailer.setTitle(zope.i18n.translate(
                  _(u'pfg_mailer_title', u'Mailer'),
                  context=self.REQUEST))
                mailer.setDescription(
                  zope.i18n.translate(
                    _(u'pfg_mailer_description',
                      u'E-Mails Form Input'),
                    context=self.REQUEST))

                self._pfFixup(mailer)

                self.actionAdapter = ('mailer', )
                haveMailer = True
            except Unauthorized:
                logger.warn('User not authorized to create mail adapters. Form Folder created with no action adapter.')

            # create a replyto field
            self.invokeFactory('FormStringField', 'replyto')
            obj = self['replyto']
            obj.fgField.__name__ = 'replyto'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_replytofield_title', u'Your E-Mail Address'),
              context=self.REQUEST))

            obj.fgField.required = True
            obj.setFgStringValidator('isEmail')
            obj.setFgTDefault('here/memberEmail')
            obj.setFgDefault('dynamically overridden')

            self._pfFixup(obj)

            if haveMailer:
                mailer.replyto_field = 'replyto'

            # create a subject field
            self.invokeFactory('FormStringField', 'topic')
            obj = self['topic']
            obj.fgField.__name__ = 'topic'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_topicfield_title', u'Subject'),
              context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)

            if haveMailer:
                mailer.subject_field = 'topic'

            # create a comments field
            self.invokeFactory('FormTextField', 'comments')
            obj = self['comments']
            obj.fgField.__name__ = 'comments'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_commentsfield_title', u'Comments'),
              context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)


            # create a thanks page
            self.invokeFactory('FormThanksPage', 'thank-you')
            obj = self['thank-you']

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_thankyou_title', u'Thank You'), context=self.REQUEST))
            obj.setDescription(zope.i18n.translate(
              _(u'pfg_thankyou_description', u'Thanks for your input.'),
              context=self.REQUEST))

            self._pfFixup(obj)

            self.thanksPage = 'thank-you'
Ejemplo n.º 5
0
    def initializeArchetype(self, **kwargs):
        """ Create sample content that may help folks
            figure out how this gadget works.
        """

        ATFolder.initializeArchetype(self, **kwargs)

        self.setSubmitLabel(
            zope.i18n.translate(_(u'pfg_formfolder_submit', u'Submit'),
                                context=self.REQUEST))
        self.setResetLabel(
            zope.i18n.translate(_(u'pfg_formfolder_reset', u'Reset'),
                                context=self.REQUEST))

        oids = self.objectIds()

        # if we have *any* content already, we don't need
        # the sample content
        if not oids:

            haveMailer = False
            # create a mail action
            try:
                self.invokeFactory('FormMailerAdapter', 'mailer')
                mailer = self['mailer']

                mailer.setTitle(
                    zope.i18n.translate(_(u'pfg_mailer_title', u'Mailer'),
                                        context=self.REQUEST))
                mailer.setDescription(
                    zope.i18n.translate(_(u'pfg_mailer_description',
                                          u'E-Mails Form Input'),
                                        context=self.REQUEST))

                self._pfFixup(mailer)

                self.actionAdapter = ('mailer', )
                haveMailer = True
            except Unauthorized:
                logger.warn(
                    'User not authorized to create mail adapters. Form Folder created with no action adapter.'
                )

            # create a replyto field
            self.invokeFactory('FormStringField', 'replyto')
            obj = self['replyto']
            obj.fgField.__name__ = 'replyto'

            obj.setTitle(
                zope.i18n.translate(_(u'pfg_replytofield_title',
                                      u'Your E-Mail Address'),
                                    context=self.REQUEST))

            obj.fgField.required = True
            obj.setFgStringValidator('isEmail')
            obj.setFgTDefault('here/memberEmail')
            obj.setFgDefault('dynamically overridden')

            self._pfFixup(obj)

            if haveMailer:
                mailer.replyto_field = 'replyto'

            # create a subject field
            self.invokeFactory('FormStringField', 'topic')
            obj = self['topic']
            obj.fgField.__name__ = 'topic'

            obj.setTitle(
                zope.i18n.translate(_(u'pfg_topicfield_title', u'Subject'),
                                    context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)

            if haveMailer:
                mailer.subject_field = 'topic'

            # create a comments field
            self.invokeFactory('FormTextField', 'comments')
            obj = self['comments']
            obj.fgField.__name__ = 'comments'

            obj.setTitle(
                zope.i18n.translate(_(u'pfg_commentsfield_title', u'Comments'),
                                    context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)

            # create a thanks page
            self.invokeFactory('FormThanksPage', 'thank-you')
            obj = self['thank-you']

            obj.setTitle(
                zope.i18n.translate(_(u'pfg_thankyou_title', u'Thank You'),
                                    context=self.REQUEST))
            obj.setDescription(
                zope.i18n.translate(_(u'pfg_thankyou_description',
                                      u'Thanks for your input.'),
                                    context=self.REQUEST))

            self._pfFixup(obj)

            self.thanksPage = 'thank-you'