Ejemplo n.º 1
0
Archivo: fieldset.py Proyecto: vwc/fv
    def manage_afterAdd(self, item, container):
        # XXX TODO: when we're done with 2.1.x, implement this via event subscription

        ATFolder.manage_afterAdd(self, item, container)

        id = self.getId()        
        if self.fsStartField.__name__ != id:
            self.fsStartField.__name__ = id
Ejemplo n.º 2
0
    def manage_afterAdd(self, item, container):
        # XXX TODO: when we're done with 2.1.x, implement this via event subscription

        ATFolder.manage_afterAdd(self, item, container)

        id = self.getId()
        if self.fsStartField.__name__ != id:
            self.fsStartField.__name__ = id
Ejemplo n.º 3
0
    def setId(self, value):
        """Sets the object id. Changes both object and field id.
        """

        badIds = (
            'language',
            'form',
            'form_submit',
            'fieldset',
            'last_referer',
            'add_reference',
        )

        if value in badIds:
            raise BadRequest, 'The id "%s" is reserved.' % value

        ATFolder.setId(self, value)
        self.fsStartField.__name__ = self.getId()
Ejemplo n.º 4
0
Archivo: fieldset.py Proyecto: vwc/fv
    def setId(self, value):
        """Sets the object id. Changes both object and field id.
        """

        badIds = (
            'language',
            'form',
            'form_submit',
            'fieldset',
            'last_referer',
            'add_reference',
            )

        if value in badIds:
            raise BadRequest, 'The id "%s" is reserved.' % value

        ATFolder.setId(self, value)
        self.fsStartField.__name__ = self.getId()
Ejemplo n.º 5
0
Archivo: fieldset.py Proyecto: vwc/fv
    def __init__(self, oid, **kwargs):
        """ initialize class """

        ATFolder.__init__(self, oid, **kwargs)
        
        self.fsStartField = StringField('FieldSetStart',
            searchable=0,
            required=0,
            write_permission = View,
            widget=FieldsetStartWidget(),
            )
        

        self.fsEndField = StringField('FieldSetEnd',
            searchable=0,
            required=0,
            write_permission = View,
            widget=FieldsetEndWidget(),
            )
Ejemplo n.º 6
0
    def __init__(self, oid, **kwargs):
        """ initialize class """

        ATFolder.__init__(self, oid, **kwargs)

        self.fsStartField = StringField(
            'FieldSetStart',
            searchable=0,
            required=0,
            write_permission=View,
            widget=FieldsetStartWidget(),
        )

        self.fsEndField = StringField(
            'FieldSetEnd',
            searchable=0,
            required=0,
            write_permission=View,
            widget=FieldsetEndWidget(),
        )
Ejemplo n.º 7
0
Archivo: form.py Proyecto: vwc/fv
    def checkIdAvailable(self, id):
        """ Expands on ATFolder by checking for ids known to cause problems.
            This includes ids of objects in all fieldsets.
        """

        result = ATFolder.checkIdAvailable(self, id)
        if result:
            result = id not in BAD_IDS
            if result:
                # check the fieldsets
                fieldsets = self.objectValues('FieldsetFolder')
                for fs in fieldsets:
                    if id in fs.objectIds():
                        return False

        return result
Ejemplo n.º 8
0
Archivo: form.py Proyecto: vwc/fv
    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'