Ejemplo n.º 1
0
class MailToAuthorSchema(interface.Interface):
    inquirerfirstname = schema.TextLine(
        title=_(safe_unicode('Your First Name')),
        description=_(safe_unicode('Please fill in your first name(s)')),
    )

    inquirerfamilyname = schema.TextLine(
        title=_(safe_unicode('Your Family Name')),
        description=_(safe_unicode('Please fill in your familiy name')),
    )

    inquireremailaddress = schema.TextLine(
        title=_(safe_unicode('Your Email Address')),
        description=_(safe_unicode('Please fill in your email address.')),
        constraint=validateemail)

    projectname = schema.TextLine(
        title=_(safe_unicode('Project Name')),
        description=_(
            safe_unicode('The name of the project, to which author '
                         'you want to send feedback.')),
        constraint=validateprojectname)

    inquiry = schema.Text(title=_(safe_unicode('Your Message To The Author')),
                          description=_(
                              safe_unicode(
                                  'What is your message to the author of '
                                  'the project? Your message is limited '
                                  'to 1000 characters.')),
                          max_length=1000)
Ejemplo n.º 2
0
    def handleApply(self, action):
        data, errors = self.extractData()
        captcha = getMultiAdapter(
            (aq_inner(self.context), self.request),
            name='recaptcha'
        )

        if errors:
            self.status = self.formErrorsMessage
            return

        elif captcha.verify():
            logger.info('ReCaptcha validation passed.')
        else:
            logger.info(
                "Please validate the recaptcha field before sending the form."
            )
            IStatusMessage(self.request).addStatusMessage(
                _(u"Please validate the recaptcha field before sending "
                  u"the form."), "error"
            )
            return

        catalog = api.portal.get_tool('portal_catalog')
        project = catalog(
                      portal_type=('tdf.templateuploadcenter.tupproject',
                         'tdf.templateuploadcenter.tupsmallproject'),
                      Title=data['projectname']
        )

        for brain in project[:1]:
            if brain.getObject().contactAddress is not None:
                projectemail = brain.getObject().contactAddress

            else:
                projectemail = '*****@*****.**'

        mailrecipient=(u"{}").format(projectemail)
        api.portal.send_email(
            recipient=mailrecipient,
            sender=(u"{} {} <{}>").format(data['inquirerfirstname'],
                                            data['inquirerfamilyname'],
                                            data['inquireremailaddress']),
            subject=(u"Your Project: {}").format(data['projectname']),
            body=(u"{}").format(data['inquiry'])


        )

        # Redirect back to the front page with a status message

        IStatusMessage(self.request).addStatusMessage(
                _(u"We send your message to the author of the project. It's "
                  u"on his choice, if he'll get back to you."),
                "info"
            )

        contextURL = self.context.absolute_url()
        self.request.response.redirect(contextURL)
Ejemplo n.º 3
0
 def noOSChosen(data):
     if data.file is not None and data.platform_choice == []:
         raise Invalid(
             _(
                 safe_unicode(
                     "Please choose a compatible platform for the uploaded file."
                 )))
Ejemplo n.º 4
0
 def testingvalue(data):
     if data.source_code_inside is not 1 and data.link_to_source is None:
         raise Invalid(_(
             u"You answered the question, whether the source code is "
             u"inside your template with no (default answer). If this is "
             u"the correct answer, please fill in the Link (URL) "
             u"to the Source Code."))
Ejemplo n.º 5
0
    def validate(self, value):
        # Perform the standard validation first
        super(ValidateTUpReleaseUniqueness, self).validate(value)

        if value is not None:
            if ITUpRelease.providedBy(self.context):
                # The release number is the same as the previous value stored
                # in the object
                if self.context.releasenumber == value:
                    return None

            catalog = api.portal.get_tool(name='portal_catalog')
            # Differentiate between possible contexts (on creation or editing)
            # on creation the context is the container
            # on editing the context is already the object
            if ITUpRelease.providedBy(self.context):
                query = '/'.join(self.context.aq_parent.getPhysicalPath())
            else:
                query = '/'.join(self.context.getPhysicalPath())

            result = catalog({
                'path': {'query': query, 'depth': 1},
                'portal_type': ['tdf.templateuploadcenter.tuprelease',
                                'tdf.templateuploadcenter.tupreleaselink'],
                'release_number': value})

            if len(result) > 0:
                raise Invalid(_(
                    u"The release number is already in use. Please choose "
                    u"another one."))
Ejemplo n.º 6
0
    def validate(self, value):
        # Perform the standard validation first
        super(ValidateTUpReleaseLinkUniqueness, self).validate(value)

        if value is not None:
            if ITUpReleaseLink.providedBy(self.context):
                # The release number is the same as the previous value stored
                # in the object
                if self.context.releasenumber == value:
                    return None

            catalog = api.portal.get_tool(name='portal_catalog')
            # Differentiate between possible contexts (on creation or editing)
            # on creation the context is the container
            # on editing the context is already the object
            if ITUpReleaseLink.providedBy(self.context):
                query = '/'.join(self.context.aq_parent.getPhysicalPath())
            else:
                query = '/'.join(self.context.getPhysicalPath())

            result = catalog({
                'path': {'query': query, 'depth': 1},
                'portal_type': ['tdf.templateuploadcenter.tuprelease',
                                'tdf.templateuploadcenter.tupreleaselink'],
                'release_number': value})

            if len(result) > 0:
                raise Invalid(_(safe_unicode(
                    "The release number is already in use. Please choose "
                    "another one.")))
Ejemplo n.º 7
0
 def testingvalue(data):
     if data.source_code_inside != 1 and data.link_to_source is None:
         raise Invalid(_(safe_unicode(
             "You answered the question, whether the source code is "
             "inside your template with no (default answer). If this is "
             "the correct answer, please fill in the Link (URL) "
             "to the Source Code.")))
Ejemplo n.º 8
0
 def compatibilitynotchoosen(data):
     if not data.compatibility_choice:
         raise Invalid(
             _(
                 safe_unicode(
                     "Please choose one or more compatible product versions for "
                     "your release")))
Ejemplo n.º 9
0
def validateprojectname(value):
    catalog = api.portal.get_tool('portal_catalog')
    project = catalog(
        portal_type=('tdf.templateuploadcenter.tupproject',
                     'tdf.templateuploadcenter.tupsmallproject'),
        Title=value
    )

    for brain in project[:1]:
        if brain.Title is None:
            raise Invalid(_(u"Not a valid project name. Please retry."))
        return True
Ejemplo n.º 10
0
def validateprojectname(value):
    catalog = api.portal.get_tool('portal_catalog')
    project = catalog(portal_type=('tdf.templateuploadcenter.tupproject',
                                   'tdf.templateuploadcenter.tupsmallproject'),
                      Title=value)

    for brain in project[:1]:
        if brain.Title is None:
            raise Invalid(
                _(safe_unicode('Not a valid project name. Please '
                               'retry.')))
        return True
    def validate(self, value):
        # Perform the standard validation first
        super(ValidateTUpProjectUniqueness, self).validate(value)

        if value is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            results = catalog({'Title': value,
                               'object_provides': ITUpProject.__identifier__})

            contextUUID = IUUID(self.context, None)
            for result in results:
                if result.UID != contextUUID:
                    raise Invalid(_(u"The project title is already in use"))
    def validate(self, value):
        # Perform the standard validation first
        super(ValidateTUpReleaseUniqueness, self).validate(value)

        if value is not None:
            catalog = api.portal.get_tool(name="portal_catalog")
            results = catalog(
                {"Title": value, "object_provides": (ITUpRelease.__identifier__, ITUpReleaseLink.__identifier__)}
            )

            contextUUID = IUUID(self.context, None)
            for result in results:
                if result.UID != contextUUID:
                    raise Invalid(_(u"The release number is already in use. Please choose another one."))
    def validate(self, value):
        # Perform the standard validation first
        super(ValidateTUpReleaseLinkUniqueness, self).validate(value)

        if value is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            results = catalog({'Title': value,
                               'portal_type': ('tdf.templateuploadcenter.tuprelease',
                                               'tdf.templateuploadcenter.tupreleaselink'), })

            contextUUID = IUUID(self.context, None)
            for result in results:
                if result.UID != contextUUID:
                    raise Invalid(_(u"The release number is already in use. "
                                    u"Please choose another one."))
Ejemplo n.º 14
0
    def validate(self, value):
        # Perform the standard validation first
        from tdf.templateuploadcenter.tupproject import ITUpProject

        super(ValidateTUpSmallProjectUniqueness, self).validate(value)
        if value is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            results1 = catalog({'Title': quote_chars(value),
                                'object_provides':
                                    ITUpProject.__identifier__, })
            results2 = catalog({'Title': quote_chars(value),
                                'object_provides':
                                    ITUpSmallProject.__identifier__, })
            results = results1 + results2

            contextUUID = IUUID(self.context, None)
            for result in results:
                if result.UID != contextUUID:
                    raise Invalid(_(safe_unicode("The project title is already in use.")))
Ejemplo n.º 15
0
    def validate(self, value):
        # Perform the standard validation first
        from tdf.templateuploadcenter.tupproject import ITUpProject

        super(ValidateTUpSmallProjectUniqueness, self).validate(value)
        if value is not None:
            catalog = api.portal.get_tool(name='portal_catalog')
            results1 = catalog({'Title': quote_chars(value),
                                'object_provides':
                                    ITUpProject.__identifier__, })
            results2 = catalog({'Title': quote_chars(value),
                                'object_provides':
                                    ITUpSmallProject.__identifier__, })
            results = results1 + results2

            contextUUID = IUUID(self.context, None)
            for result in results:
                if result.UID != contextUUID:
                    raise Invalid(_(u"The project title is already in use."))
Ejemplo n.º 16
0
    def handleApply(self, action):
        data, errors = self.extractData()
        captcha = getMultiAdapter(
            (aq_inner(self.context), self.request),
            name='recaptcha',
        )

        if errors:
            self.status = self.formErrorsMessage
            return

        elif captcha.verify():
            logger.info('ReCaptcha validation passed.')
        else:
            logger.info(
                'Please validate the recaptcha field before sending the form.')
            api.portal.show_message(message=_(
                safe_unicode('Please validate the recaptcha field before '
                             'sending the form.')),
                                    request=self.request,
                                    type='error')
            return

        if api.portal.get_registry_record('plone.email_from_address') \
                is not None:
            contactaddress = api.portal.get_registry_record(
                'plone.email_from_address')

        catalog = api.portal.get_tool('portal_catalog')
        project = catalog(
            portal_type=('tdf.templateuploadcenter.tupproject',
                         'tdf.templateuploadcenter.tupsmallproject'),
            Title=data['projectname'])

        for brain in project[:1]:
            if brain.getObject().contactAddress is not None:
                projectemail = brain.getObject().contactAddress

            else:
                projectemail = '*****@*****.**'

        mailrecipient = (safe_unicode('{0}')).format(projectemail)
        api.portal.send_email(
            recipient=mailrecipient,
            sender=(safe_unicode('{0} {1} <{2}>')).format(
                data['inquirerfirstname'], data['inquirerfamilyname'],
                data['inquireremailaddress']),
            subject=(safe_unicode('Your Project: {0}')).format(
                data['projectname']),
            body=(safe_unicode('{0}')).format(data['inquiry']),
        )

        # Redirect back to the front page with a status message

        api.portal.show_message(message=_(
            safe_unicode('We send your message to the author '
                         "of the project. It's on her / his choice, "
                         "if she'll / he'll get back to you.")),
                                request=self.request,
                                type='info')

        contextURL = self.context.absolute_url()
        self.request.response.redirect(contextURL)
Ejemplo n.º 17
0
class MailToAuthorForm(AutoExtensibleForm, form.Form):
    schema = MailToAuthorSchema
    form_name = 'authormail_form'

    label = _(safe_unicode('Mail To The Project Author'))
    description = _(
        safe_unicode('Contact the project author and send '
                     'your feedback'))

    fields = field.Fields(MailToAuthorSchema, IReCaptchaForm)
    fields['captcha'].widgetFactory = ReCaptchaFieldWidget

    def update(self):
        # disable Plone's editable border
        self.request.set('disable_border', True)

        # call the base class version - this is very important!
        super(MailToAuthorForm, self).update()

    @button.buttonAndHandler(_(u'Send Email'))
    def handleApply(self, action):
        data, errors = self.extractData()
        captcha = getMultiAdapter(
            (aq_inner(self.context), self.request),
            name='recaptcha',
        )

        if errors:
            self.status = self.formErrorsMessage
            return

        elif captcha.verify():
            logger.info('ReCaptcha validation passed.')
        else:
            logger.info(
                'Please validate the recaptcha field before sending the form.')
            api.portal.show_message(message=_(
                safe_unicode('Please validate the recaptcha field before '
                             'sending the form.')),
                                    request=self.request,
                                    type='error')
            return

        if api.portal.get_registry_record('plone.email_from_address') \
                is not None:
            contactaddress = api.portal.get_registry_record(
                'plone.email_from_address')

        catalog = api.portal.get_tool('portal_catalog')
        project = catalog(
            portal_type=('tdf.templateuploadcenter.tupproject',
                         'tdf.templateuploadcenter.tupsmallproject'),
            Title=data['projectname'])

        for brain in project[:1]:
            if brain.getObject().contactAddress is not None:
                projectemail = brain.getObject().contactAddress

            else:
                projectemail = '*****@*****.**'

        mailrecipient = (safe_unicode('{0}')).format(projectemail)
        api.portal.send_email(
            recipient=mailrecipient,
            sender=(safe_unicode('{0} {1} <{2}>')).format(
                data['inquirerfirstname'], data['inquirerfamilyname'],
                data['inquireremailaddress']),
            subject=(safe_unicode('Your Project: {0}')).format(
                data['projectname']),
            body=(safe_unicode('{0}')).format(data['inquiry']),
        )

        # Redirect back to the front page with a status message

        api.portal.show_message(message=_(
            safe_unicode('We send your message to the author '
                         "of the project. It's on her / his choice, "
                         "if she'll / he'll get back to you.")),
                                request=self.request,
                                type='info')

        contextURL = self.context.absolute_url()
        self.request.response.redirect(contextURL)

    @button.buttonAndHandler(_(safe_unicode('Cancel')))
    def handleCancel(self, action):
        """User cancelled. Redirect back to the front page.
            """
        contextURL = self.context.absolute_url()
        self.request.response.redirect(contextURL)
Ejemplo n.º 18
0
 def missingScreenshotOrLogo(data):
     if not data.screenshot and not data.project_logo:
         raise ProvideScreenshotLogo(_(
             u'Please add a screenshot or a logo to your project page. '
             u'You will find the appropriate fields below on this page.'))
Ejemplo n.º 19
0
class ITUpCenter(model.Schema):
    """ An Template Upload Center for LibreOffice templates.
    """

    title = schema.TextLine(title=_(
        safe_unicode("Name of the Template Center")), )

    description = schema.Text(title=_(
        safe_unicode('Descirption Of The Template Center')), )

    product_description = schema.Text(
        title=_(safe_unicode("Description Of The Features Of Templates")))

    product_title = schema.TextLine(
        title=_(safe_unicode("Template Product Name")),
        description=_(
            safe_unicode("Name of the Template product, e.g. only Templates "
                         "or LibreOffice Templates")),
    )

    model.fieldset('categories_et_all',
                   label=safe_unicode("Categories et all"),
                   fields=[
                       'available_category', 'available_licenses',
                       'available_versions', 'available_platforms'
                   ])

    available_category = schema.List(title=_(
        safe_unicode("Available Categories")),
                                     default=[
                                         'Accounting',
                                         'Agenda',
                                         'Arts',
                                         'Book',
                                         'Brochure / Pamphlet',
                                         'Budget',
                                         'Business',
                                         'Business POS',
                                         'Business Shipping',
                                         'Calendar',
                                         'Cards',
                                         'Curriculum Vitae',
                                         'CD / DVD|CD',
                                         'Certificate',
                                         'Checkbook',
                                         'Christmas',
                                         'Computer',
                                         'Conference',
                                         'E-book',
                                         'Education',
                                         'Academia',
                                         'Elementary/Secondary '
                                         'school panels',
                                         'Envelope'
                                         'Fax',
                                         'Genealogy',
                                         'Grocery',
                                         'Invoice',
                                         'Labels',
                                         'LibreLogo',
                                         'Letter',
                                         'Magazine',
                                         'Media',
                                         'Medical',
                                         'Memo',
                                         'Music',
                                         'Newsletter',
                                         'Notes',
                                         'Paper',
                                         'Presentation',
                                         'Recipe',
                                         'Science',
                                         'Sports',
                                         'Timeline',
                                         'Timesheet',
                                         'Trades',
                                         'To Do List',
                                         'Writer',
                                     ],
                                     value_type=schema.TextLine())

    available_licenses = schema.List(
        title=_(safe_unicode("Available Licenses")),
        default=[
            'GNU-GPL-v2 (GNU General Public '
            'License Version 2)', 'GNU-GPL-v3+ (General Public License '
            'Version 3 and later)', 'LGPL-v2.1 (GNU Lesser General '
            'Public License Version 2.1)',
            'LGPL-v3+ (GNU Lesser General Public '
            'License Version 3 and later)', 'BSD (BSD License (revised))',
            'MPL-v1.1 (Mozilla Public License '
            'Version 1.1)', 'MPL-v2.0+ (Mozilla Public License '
            'Version 2.0 or later)', 'CC-by-sa-v3 (Creative Commons '
            'Attribution-ShareAlike 3.0)', 'CC-BY-SA-v4 (Creative Commons '
            'Attribution-ShareAlike 4.0 '
            'International)', 'AL-v2 (Apache License Version 2.0)',
            'Public Domain', 'OSI (Other OSI Approved)'
        ],
        value_type=schema.TextLine())

    available_versions = schema.List(
        title=_(safe_unicode("Available Versions")),
        default=[
            'LibreOffice 3.3', 'LibreOffice 3.4', 'LibreOffice 3.5',
            'LibreOffice 3.6', 'LibreOffice 4.0', 'LibreOffice 4.1',
            'LibreOffice 4.2', 'LibreOffice 4.3', 'LibreOffice 4.4',
            'LibreOffice 5.0', 'LibreOffice 5.1', 'LibreOffice 5.2',
            'LibreOffice 5.3', 'LibreOffice 5.4', 'LibreOffice 6.0',
            'LibreOffice 6.1', 'LibreOffice 6.2', 'LibreOffice 6.3',
            'LibreOffice 6.4'
        ],
        value_type=schema.TextLine())

    available_platforms = schema.List(
        title=_(safe_unicode("Available Platforms")),
        default=[
            'All platforms', 'Linux', 'Linux-x64', 'Mac OS X', 'Windows',
            'BSD', 'UNIX (other)'
        ],
        value_type=schema.TextLine())

    model.fieldset(
        'Allowed File Extensions',
        label=safe_unicode('Allowed file extensions'),
        fields=['allowed_templatefileextension', 'allowed_imagefileextension'])

    allowed_templatefileextension = schema.TextLine(
        title=_(safe_unicode('Allowed Template File Extensions')),
        description=_(
            safe_unicode('Fill in the allowed template file extensions, '
                         'seperated by a pipe \'|\'.')),
    )

    allowed_imagefileextension = schema.TextLine(
        title=_(safe_unicode('Allowed Image File Extensions')),
        description=_(
            safe_unicode('Fill in the allowed image file extensions, '
                         'seperated by a pipe \'|\'.')),
    )

    model.fieldset('instructions',
                   label=u'Instructions',
                   fields=[
                       'install_instructions',
                       'reporting_bugs',
                   ])

    primary('install_instructions')
    install_instructions = RichText(
        title=_(safe_unicode("Template Installation Instructions")),
        description=_(safe_unicode("Please fill in the install instructions")),
        required=False)

    primary('reporting_bugs')
    reporting_bugs = RichText(title=_(
        safe_unicode("Instruction how to report Bugs")),
                              required=False)

    model.fieldset('disclaimer',
                   label=safe_unicode('Legal Disclaimer'),
                   fields=[
                       'title_legaldisclaimer', 'legal_disclaimer',
                       'title_legaldownloaddisclaimer',
                       'legal_downloaddisclaimer'
                   ])

    title_legaldisclaimer = schema.TextLine(
        title=_(safe_unicode("Title for Legal Disclaimer and Limitations")),
        default=_(safe_unicode("Legal Disclaimer and Limitations")),
        required=False)

    legal_disclaimer = schema.Text(
        title=_(safe_unicode("Text of the Legal Disclaimer and Limitations")),
        description=_(
            safe_unicode(
                "Enter the text of the legal disclaimer and limitations that "
                "should be displayed to the project creator and should be "
                "accepted by the owner of the project.")),
        default=_(
            safe_unicode(
                "Fill in the legal disclaimer, that had to be accepted by the "
                "project owner")),
        required=False)

    title_legaldownloaddisclaimer = schema.TextLine(
        title=_(
            safe_unicode(
                "Title of the Legal Disclaimer and Limitations for Downloads")
        ),
        default=_(
            safe_unicode("Legal Disclaimer and Limitations for Downloads")),
        required=False)

    primary('legal_downloaddisclaimer')
    legal_downloaddisclaimer = RichText(
        title=_(
            safe_unicode(
                "Text of the Legal Disclaimer and Limitations for Downlaods")),
        description=_(
            safe_unicode(
                "Enter any legal disclaimer and limitations for downloads that "
                "should appear on each page for dowloadable files.")),
        default=_(
            safe_unicode(
                "Fill in the text for the legal download disclaimer")),
        required=False)

    primary('information_oldversions')
    information_oldversions = RichText(
        title=_(
            safe_unicode(
                "Information About Search For Old LibreOffice Versions")),
        description=_(
            safe_unicode("Enter an information about the search for older "
                         "versions of LibreOffice, if they are not on the "
                         "versions list (compatibility) anymore.")),
        required=False)

    model.fieldset('contactadresses',
                   label=safe_unicode('Special Email Adresses'),
                   fields=['contactForCenter'])

    contactForCenter = schema.ASCIILine(
        title=_(
            safe_unicode(
                "EMail address for communication with the template center "
                "manager and reviewer")),
        description=_(
            safe_unicode(
                "Enter an email address for the communication with template "
                "center manager and reviewer")),
        default='*****@*****.**',
        constraint=validateEmail)
 def missingScreenshotOrLogo(data):
     if not data.screenshot and not data.project_logo:
         raise ProvideScreenshotLogo(_(u'Please add a Screenshot or a Logo to your project page'))
Ejemplo n.º 21
0
class MissingCategory(Invalid):
    __doc__ = _(safe_unicode("You have not chosen a category for the project"))
Ejemplo n.º 22
0
class ITUpRelease(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(
            safe_unicode(
                "This Dialog to create a new release consists of different "
                "register. Please go through this register and fill in the "
                "appropriate data for your release. This register 'Default' "
                "provide fields for general information of your release. The "
                "next register 'compatibility' is the place to submit "
                "information about the versions with which your release file(s) "
                "is / are compatible. The following register asks for some "
                "legal informations. The next register File Upload' provide a "
                "field to upload your release file. The further register are "
                "optional. There is the opportunity to upload further release "
                "files (for different platforms).")))

    directives.mode(projecttitle='hidden')
    projecttitle = schema.TextLine(
        title=_(safe_unicode("The Computed Project Title")),
        description=_(
            safe_unicode(
                "The release title will be computed from the parent project "
                "title")),
        defaultFactory=getContainerTitle)

    releasenumber = schema.TextLine(
        title=_(safe_unicode("Release Number")),
        description=_(safe_unicode("Release Number (up to twelf chars)")),
        default=_(safe_unicode("1.0")),
        max_length=12)

    description = schema.Text(title=_(safe_unicode("Release Summary")), )

    primary('details')
    details = RichText(title=_(safe_unicode("Full Release Description")),
                       required=False)

    primary('changelog')
    changelog = RichText(
        title=_(safe_unicode("Changelog")),
        description=_(
            safe_unicode(
                "A detailed log of what has changed since the previous release."
            )),
        required=False,
    )

    model.fieldset('compatibility',
                   label=safe_unicode("Compatibility"),
                   fields=['compatibility_choice'])

    model.fieldset('legal',
                   label=safe_unicode("Legal"),
                   fields=[
                       'licenses_choice', 'title_declaration_legal',
                       'declaration_legal', 'accept_legal_declaration',
                       'source_code_inside', 'link_to_source'
                   ])

    directives.widget(licenses_choice=CheckBoxFieldWidget)
    licenses_choice = schema.List(
        title=_(safe_unicode('License of the uploaded file')),
        description=_(
            safe_unicode(
                "Please mark one or more licenses you publish your release.")),
        value_type=schema.Choice(source=vocabAvailLicenses),
        required=True,
    )

    directives.widget(compatibility_choice=CheckBoxFieldWidget)
    compatibility_choice = schema.List(
        title=_(safe_unicode("Compatible with versions of LibreOffice")),
        description=_(
            safe_unicode(
                "Please mark one or more program versions with which this "
                "release is compatible with.")),
        value_type=schema.Choice(source=vocabAvailVersions),
        required=True,
        default=[])

    directives.mode(title_declaration_legal='display')
    title_declaration_legal = schema.TextLine(
        title=_(safe_unicode("")),
        required=False,
        defaultFactory=legal_declaration_title)

    directives.mode(declaration_legal='display')
    declaration_legal = schema.Text(title=_(safe_unicode("")),
                                    required=False,
                                    defaultFactory=legal_declaration_text)

    accept_legal_declaration = schema.Bool(
        title=_(safe_unicode("Accept the above legal disclaimer")),
        description=_(
            safe_unicode(
                "Please declare that you accept the above legal disclaimer")),
        required=True)

    contact_address2 = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        required=False,
        defaultFactory=contactinfoDefault)

    source_code_inside = schema.Choice(title=_(
        safe_unicode("Is the source code inside the template?")),
                                       vocabulary=yesnochoice,
                                       required=True)

    link_to_source = schema.URI(title=_(
        safe_unicode("Please fill in the Link (URL) to the Source Code")),
                                required=False)

    model.fieldset('fileupload',
                   label=safe_unicode("Fileupload"),
                   fields=[
                       'tucfileextension', 'file', 'platform_choice',
                       'information_further_file_uploads'
                   ])

    directives.mode(tucfileextension='display')
    tucfileextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file = NamedBlobFile(
        title=_(safe_unicode("The first file you want to upload")),
        description=_(safe_unicode("Please upload your file.")),
        required=True,
        constraint=validatetemplatefileextension)

    directives.widget(platform_choice=CheckBoxFieldWidget)
    platform_choice = schema.List(
        title=_(
            safe_unicode(
                "First uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=True,
    )

    directives.mode(information_further_file_uploads='display')
    primary('information_further_file_uploads')
    information_further_file_uploads = RichText(
        title=_(safe_unicode("Further File Uploads for this Release")),
        description=_(
            safe_unicode(
                "If you want to upload more files for this release, e.g. "
                "because there are files for other operating systems, you'll "
                "find the upload fields on the register 'Further Uploads' and "
                "'Further More Uploads'.")),
        required=False)

    model.fieldset('fileset1',
                   label=safe_unicode("Further Uploads"),
                   fields=[
                       'tucfileextension1', 'file1', 'platform_choice1',
                       'tucfileextension2', 'file2', 'platform_choice2',
                       'tucfileextension3', 'file3', 'platform_choice3'
                   ])

    directives.mode(tucfileextension1='display')
    tucfileextension1 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file1 = NamedBlobFile(title=_(
        safe_unicode("The second file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice1=CheckBoxFieldWidget)
    platform_choice1 = schema.List(
        title=_(
            safe_unicode(
                "Second uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension2='display')
    tucfileextension2 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file2 = NamedBlobFile(title=_(
        safe_unicode("The third file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice2=CheckBoxFieldWidget)
    platform_choice2 = schema.List(
        title=_(
            safe_unicode(
                "Third uploaded file is compatible with the Platform(s))")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension3='display')
    tucfileextension3 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file3 = NamedBlobFile(title=_(
        safe_unicode("The fourth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice3=CheckBoxFieldWidget)
    platform_choice3 = schema.List(
        title=_(
            safe_unicode(
                "Fourth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    model.fieldset('fileset2',
                   label=safe_unicode("Further More Uploads"),
                   fields=[
                       'tucfileextension4', 'file4', 'platform_choice4',
                       'tucfileextension5', 'file5', 'platform_choice5'
                   ])

    directives.mode(tucfileextension4='display')
    tucfileextension4 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file4 = NamedBlobFile(title=_(
        safe_unicode("The fifth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice4=CheckBoxFieldWidget)
    platform_choice4 = schema.List(
        title=_(
            safe_unicode(
                "Fifth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension5='display')
    tucfileextension5 = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for template '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file5 = NamedBlobFile(title=_(
        safe_unicode("The sixth file you want to upload (this is optional)")),
                          description=_(
                              safe_unicode("Please upload your file.")),
                          required=False,
                          constraint=validatetemplatefileextension)

    directives.widget(platform_choice5=CheckBoxFieldWidget)
    platform_choice5 = schema.List(
        title=_(
            safe_unicode(
                "Sixth uploaded file is compatible with the Platform(s)")),
        description=_(
            safe_unicode(
                "Please mark one or more platforms with which the uploaded file "
                "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    @invariant
    def licensenotchoosen(value):
        if not value.licenses_choice:
            raise Invalid(
                _(safe_unicode("Please choose a license for your release.")))

    @invariant
    def compatibilitynotchoosen(data):
        if not data.compatibility_choice:
            raise Invalid(
                _(
                    safe_unicode(
                        "Please choose one or more compatible product versions for "
                        "your release")))

    @invariant
    def legaldeclarationaccepted(data):
        if data.accept_legal_declaration is not True:
            raise AcceptLegalDeclaration(
                _(
                    safe_unicode("Please accept the Legal Declaration about "
                                 "your Release and your Uploaded File")))

    @invariant
    def testingvalue(data):
        if data.source_code_inside != 1 and data.link_to_source is None:
            raise Invalid(
                _(
                    safe_unicode(
                        "You answered the question, whether the source code is "
                        "inside your template with no (default answer). If this is "
                        "the correct answer, please fill in the Link (URL) "
                        "to the Source Code.")))

    @invariant
    def noOSChosen(data):
        if data.file is not None and data.platform_choice == []:
            raise Invalid(
                _(
                    safe_unicode(
                        "Please choose a compatible platform for the uploaded file."
                    )))
Ejemplo n.º 23
0
def validateEmail(value):
    if not checkEmail(value):
        raise Invalid(_(safe_unicode("Invalid email address")))
    return True
Ejemplo n.º 24
0
    """ pick up the list of platforms from parent """

    platforms_list = getattr(context.__parent__, 'available_platforms', [])
    terms = []
    for value in platforms_list:
        terms.append(
            SimpleTerm(value,
                       token=value.encode('unicode_escape'),
                       title=value))
    return SimpleVocabulary(terms)


directlyProvides(vocabAvailPlatforms, IContextSourceBinder)

yesnochoice = SimpleVocabulary([
    SimpleTerm(value=0, title=_(u'No')),
    SimpleTerm(value=1, title=_(u'Yes')),
])


@provider(IContextAwareDefaultFactory)
def getContainerTitle(self):
    return (self.aq_inner.title)


@provider(IContextAwareDefaultFactory)
def contactinfoDefault(context):
    return context.contactAddress


@provider(IContextAwareDefaultFactory)
Ejemplo n.º 25
0
    platforms_list = []
    if context is not None and context.available_platforms:
        platforms_list = context.available_platforms
    terms = []
    for value in platforms_list:
        terms.append(SimpleTerm(value, token=value.encode('unicode_escape'),
                                title=value))
    return SimpleVocabulary(terms)


directlyProvides(vocabAvailPlatforms, IContextSourceBinder)


yesnochoice = SimpleVocabulary(
    [SimpleTerm(value=0, title=_(safe_unicode('No'))),
     SimpleTerm(value=1, title=_(safe_unicode('Yes'))), ]
)


@provider(IContextAwareDefaultFactory)
def legal_declaration_title(context):
    return context.title_legaldisclaimer


@provider(IContextAwareDefaultFactory)
def legal_declaration_text(context):
    return context.legal_disclaimer


@provider(IContextAwareDefaultFactory)
Ejemplo n.º 26
0
class AcceptLegalDeclaration(Invalid):
    __doc__ = _(
        safe_unicode("It is necessary that you accept the Legal Declaration"))
Ejemplo n.º 27
0
 def legaldeclarationaccepted(data):
     if data.accept_legal_declaration is not True:
         raise AcceptLegalDeclaration(
             _(
                 safe_unicode("Please accept the Legal Declaration about "
                              "your Release and your Uploaded File")))
Ejemplo n.º 28
0
def validateemail(value):
    if not checkemail(value):
        raise Invalid(_(u"Invalid email address"))
    return True
Ejemplo n.º 29
0
class ProvideScreenshotLogo(Invalid):
    __doc__ = _(
        safe_unicode(
            "Please add a Screenshot or a Logo to your project. You find the "
            "appropriate fields below "
            "on this page."))
Ejemplo n.º 30
0
 def licensenotchoosen(value):
     if not value.licenses_choice:
         raise Invalid(_(u"Please choose a license for your release."))
Ejemplo n.º 31
0
 def licensenotchoosen(value):
     if not value.licenses_choice:
         raise Invalid(
             _(safe_unicode("Please choose a license for your release.")))
Ejemplo n.º 32
0
 def legaldeclarationaccepted(data):
     if data.accept_legal_declaration is not True:
         raise AcceptLegalDeclaration(
             _(
                 u"Please accept the Legal Declaration about your Release "
                 u"and your Uploaded File"))
Ejemplo n.º 33
0
class ITUpSmallProject(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(safe_unicode(
            "The Dialog to create a new project consists of different "
            "register. Please go through this register and fill in the "
            "appropriate data for your project or choose one of the "
            "options that are provided. You could upload one or more files "
            "to your project on the register 'File Upload' and "
            "'Optional Further File Upload'."))
    )

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(safe_unicode("Title")),
        description=_(safe_unicode(
            'Project Title - minimum 5 and maximum 50 characters')),
        min_length=5,
        max_length=50
    )

    dexteritytextindexer.searchable('description')
    description = schema.Text(
        title=_(safe_unicode("Project Summary")),
    )

    dexteritytextindexer.searchable('details')
    primary('details')
    details = RichText(
        title=_(safe_unicode("Full Project Description")),
        required=False
    )
    model.fieldset('category_compatibility',
                   label=safe_unicode("Categories / Compatibility"),
                   fields=['category_choice', 'compatibility_choice']
                   )

    model.fieldset('legal',
                   label=safe_unicode("Legal"),
                   fields=['licenses_choice', 'title_declaration_legal',
                           'declaration_legal',
                           'accept_legal_declaration']
                   )

    directives.widget(licenses_choice=CheckBoxFieldWidget)
    licenses_choice = schema.List(
        title=_(safe_unicode('License of the uploaded file')),
        description=_(safe_unicode(
            "Please mark one or more licenses you publish your release.")),
        value_type=schema.Choice(source=vocabAvailLicenses),
        required=True,
    )

    directives.mode(title_declaration_legal='display')
    title_declaration_legal = schema.TextLine(
        title=_(safe_unicode("")),
        required=False,
        defaultFactory=legal_declaration_title
    )

    directives.mode(declaration_legal='display')
    declaration_legal = schema.Text(
        title=_(safe_unicode("")),
        required=False,
        defaultFactory=legal_declaration_text
    )

    accept_legal_declaration = schema.Bool(
        title=_(safe_unicode("Accept the above legal disclaimer")),
        description=_(safe_unicode(
            "Please declare that you accept the above legal disclaimer.")),
        required=True
    )

    dexteritytextindexer.searchable('category_choice')
    directives.widget(category_choice=CheckBoxFieldWidget)
    category_choice = schema.List(
        title=_(safe_unicode("Choose your categories")),
        description=_(safe_unicode(
            "Please select the appropriate categories (one or more) for "
            "your project.")),
        value_type=schema.Choice(source=vocabCategories),
        constraint=isNotEmptyCategory,
        required=True
    )

    contactAddress = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        constraint=validateEmail
    )

    directives.mode(tucimageextension='display')
    tucimageextension = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for screenshot '
            'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimagefileextensions,
    )

    screenshot = NamedBlobImage(
        title=_(safe_unicode("Screenshot of the Tempate")),
        description=_(safe_unicode(
            "Add a screenshot by clicking the 'Browse' button. You could "
            "provide an image of the file format 'png', 'gif' or 'jpg'.")),
        required=True,
        constraint=validateimagefileextension
    )

    releasenumber = schema.TextLine(
        title=_(safe_unicode("Versions Number")),
        description=_(safe_unicode(
            "Version Number of the Template File (up to twelf chars) "
            "which you upload in this project.")),
        default=_(safe_unicode("1.0")),
        max_length=12,
    )

    directives.widget(compatibility_choice=CheckBoxFieldWidget)
    compatibility_choice = schema.List(
        title=_(safe_unicode("Compatible with versions of LibreOffice")),
        description=_(safe_unicode(
            "Please mark one or more program versions with which this "
            "release is compatible with.")),
        value_type=schema.Choice(source=vocabAvailVersions),
        required=True,
        default=[]
    )

    directives.mode(tucfileextension='display')
    tucfileextension = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for template '
            'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file = NamedBlobFile(
        title=_(safe_unicode("The first file you want to upload.")),
        description=_(safe_unicode("Please upload your file.")),
        required=True,
        constraint=validatetemplatefileextension,
    )

    directives.widget(platform_choice=CheckBoxFieldWidget)
    platform_choice = schema.List(
        title=_(safe_unicode(
            "First uploaded file is compatible with the Platform(s)")),
        description=_(safe_unicode(
            "Please mark one or more platforms with which the uploaded file "
            "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=True,
    )

    model.fieldset('fileset1',
                   label=safe_unicode("File Upload"),
                   fields=['filetitlefield', 'platform_choice',
                           'tucfileextension', 'file', ]
                   )

    directives.mode(filetitlefield='display')
    filetitlefield = schema.TextLine(
        title=_(safe_unicode("The First File You Want To Upload")),
        description=_(safe_unicode(
            "You need only to upload one file to your project. There are "
            "options for further two file uploads if you want to provide "
            "files for different platforms.")),
    )

    model.fieldset('fileset2',
                   label=safe_unicode("Optional Further File Upload"),
                   fields=['filetitlefield1', 'platform_choice1',
                           'tucfileextension1', 'file1',
                           'filetitlefield2', 'platform_choice2',
                           'tucfileextension2', 'file2']
                   )

    directives.mode(filetitlefield1='display')
    filetitlefield1 = schema.TextLine(
        title=_(safe_unicode("Second Release File")),
        description=_(safe_unicode(
            "Here you could add an optional second file to your project, if "
            "the files support different platforms."))
    )

    directives.widget(platform_choice1=CheckBoxFieldWidget)
    platform_choice1 = schema.List(
        title=_(safe_unicode(
            "Second uploaded file is compatible with the Platform(s)")),
        description=_(safe_unicode(
            "Please mark one or more platforms with which the uploaded file "
            "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension1='display')
    tucfileextension1 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for template '
            'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file1 = NamedBlobFile(
        title=_(safe_unicode(
            "The second file you want to upload (this is optional)")),
        description=_(safe_unicode("Please upload your file.")),
        required=False,
        constraint=validatetemplatefileextension,
    )

    directives.mode(filetitlefield2='display')
    filetitlefield2 = schema.TextLine(
        title=_(safe_unicode("Third Release File")),
        description=_(safe_unicode(
            "Here you could add an optional third file to your project, if "
            "the files support different platforms.")),
    )

    directives.widget(platform_choice2=CheckBoxFieldWidget)
    platform_choice2 = schema.List(
        title=_(safe_unicode(
            "Third uploaded file is compatible with the Platform(s))")),
        description=_(safe_unicode(
            "Please mark one or more platforms with which the uploaded file "
            "is compatible.")),
        value_type=schema.Choice(source=vocabAvailPlatforms),
        required=False,
    )

    directives.mode(tucfileextension2='display')
    tucfileextension2 = schema.TextLine(
        title=_(safe_unicode(
            'The following file extensions are allowed for template '
            'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedtemplatefileextensions,
    )

    file2 = NamedBlobFile(
        title=_(safe_unicode(
            "The third file you want to upload (this is optional)")),
        description=_(safe_unicode("Please upload your file.")),
        required=False,
        constraint=validatetemplatefileextension,
    )

    @invariant
    def licensenotchoosen(value):
        if not value.licenses_choice:
            raise Invalid(_(safe_unicode(
                "Please choose a license for your release.")))

    @invariant
    def compatibilitynotchoosen(data):
        if not data.compatibility_choice:
            raise Invalid(_(safe_unicode(
                "Please choose one or more compatible product versions for "
                "your release.")))

    @invariant
    def legaldeclarationaccepted(data):
        if data.accept_legal_declaration is not True:
            raise AcceptLegalDeclaration(
                _(safe_unicode(
                    "Please accept the Legal Declaration about your Release "
                    "and your Uploaded File")))

    @invariant
    def noOSChosen(data):
        if data.file is not None and data.platform_choice == []:
            raise Invalid(_(safe_unicode(
                "Please choose a compatible platform for the uploaded file.")))
Ejemplo n.º 34
0

directlyProvides(vocabAvailPlatforms, IContextSourceBinder)


def validateextensionfileextension(value):
    if not checkfileextension(value.filename):
        raise Invalid(
            u'You could only upload LibreOffice extension files with a proper '
            u'file extension.\n'
            u'LibreOffice extensions have an \'oxt\' file extension.')
    return True


yesnochoice = SimpleVocabulary(
    [SimpleTerm(value=0, title=_(u'No')),
     SimpleTerm(value=1, title=_(u'Yes')), ]
)


@provider(IContextAwareDefaultFactory)
def legal_declaration_title(context):
    return context.title_legaldisclaimer


@provider(IContextAwareDefaultFactory)
def legal_declaration_text(context):
    return context.legal_disclaimer


class AcceptLegalDeclaration(Invalid):
 def testingvalue(data):
     if data.source_code_inside is not 1 and data.link_to_source is None:
         raise Invalid(_(u"Please fill in the Link (URL) to the Source Code."))
Ejemplo n.º 36
0
 def compatibilitynotchoosen(data):
     if not data.compatibility_choice:
         raise Invalid(_(
             u"Please choose one or more compatible product versions for "
             u"your release."))
Ejemplo n.º 37
0
class ITUpProject(model.Schema):
    directives.mode(information="display")
    information = schema.Text(
        title=_(safe_unicode("Information")),
        description=_(
            safe_unicode(
                "The Dialog to create a new project consists of different "
                "register. Please go through these register and fill in the "
                "appropriate data for your project.")))

    dexteritytextindexer.searchable('title')
    title = schema.TextLine(
        title=_(safe_unicode("Title")),
        description=_(
            safe_unicode(
                "Project Title - minimum 5 and maximum 50 characters")),
        min_length=5,
        max_length=50)

    dexteritytextindexer.searchable('description')
    description = schema.Text(title=_(safe_unicode("Project Summary")), )

    dexteritytextindexer.searchable('details')
    primary('details')
    details = RichText(title=_(safe_unicode("Full Project Description")),
                       required=False)

    model.fieldset('Categories',
                   label='Category / Categories',
                   fields=['category_choice'])
    model.fieldset('logo_screenshot',
                   label='Logo / Screenshot',
                   fields=[
                       'tucimageextension', 'project_logo',
                       'tucimageextension1', 'screenshot'
                   ])

    dexteritytextindexer.searchable('category_choice')
    directives.widget(category_choice=CheckBoxFieldWidget)
    category_choice = schema.List(
        title=_(safe_unicode("Choose your categories")),
        description=_(
            safe_unicode(
                "Please select the appropriate categories (one or more) for "
                "your project.")),
        value_type=schema.Choice(source=vocabCategories),
        constraint=isNotEmptyCategory,
        required=True)

    contactAddress = schema.TextLine(
        title=_(safe_unicode("Contact email-address")),
        description=_(safe_unicode("Contact email-address for the project.")),
        constraint=validateEmail)

    homepage = schema.URI(
        title=_(safe_unicode("Homepage")),
        description=_(
            safe_unicode(
                "If the project has an external home page, enter its URL "
                "(example: 'http://www.mysite.org').")),
        required=False)

    documentation_link = schema.URI(
        title=_(safe_unicode("URL of documentation repository ")),
        description=_(
            safe_unicode(
                "If the project has externally hosted documentation, enter its "
                "URL (example: 'http://www.mysite.org').")),
        required=False)

    directives.mode(tucimageextension='display')
    tucimageextension = schema.TextLine(
        title=_(
            safe_unicode(
                'The following file extensions are allowed for screenshot '
                'files (upper case and lower case and mix of both):')),
        defaultFactory=allowedimagefileextensions,
    )

    project_logo = NamedBlobImage(
        title=_(safe_unicode("Logo")),
        description=_(
            safe_unicode(
                "Add a logo for the project (or organization/company) by "
                "clicking the 'Browse' button. You could provide an image of "
                "the file format 'png', 'gif' or 'jpg'.")),
        required=False,
        constraint=validateimagefileextension)

    directives.mode(tucimageextension1='display')
    tucimageextension1 = schema.TextLine(
        title=_(u'The following file extensions are allowed for screenshot '
                u'files (upper case and lower case and mix of both):'),
        defaultFactory=allowedimagefileextensions,
    )

    screenshot = NamedBlobImage(
        title=_(safe_unicode("Screenshot of the Template")),
        description=_(
            safe_unicode(
                "Add a screenshot by clicking the 'Browse' button. You could "
                "provide an image of the file format 'png', 'gif' or 'jpg'. ")
        ),
        required=False,
        constraint=validateimagefileextension)

    @invariant
    def missingScreenshotOrLogo(data):
        if not data.screenshot and not data.project_logo:
            raise ProvideScreenshotLogo(
                _(u'Please add a screenshot or a logo to your project page. '
                  u'You will find the appropriate fields below on this page.'))
Ejemplo n.º 38
0
 def noOSChosen(data):
     if data.file is not None and data.platform_choice == []:
         raise Invalid(_(
             u"Please choose a compatible platform for the uploaded file."))
Ejemplo n.º 39
0
 def missingScreenshotOrLogo(data):
     if not data.screenshot and not data.project_logo:
         raise ProvideScreenshotLogo(
             _(u'Please add a screenshot or a logo to your project page. '
               u'You will find the appropriate fields below on this page.'))
Ejemplo n.º 40
0
def validateEmail(value):
    if not checkEmail(value):
        raise Invalid(_(u"Invalid email address"))
    return True

def vocabAvailPlatforms(context):
    """ pick up the list of platforms from parent """

    platforms_list = getattr(context.__parent__, "available_platforms", [])
    terms = []
    for value in platforms_list:
        terms.append(SimpleTerm(value, token=value.encode("unicode_escape"), title=value))
    return SimpleVocabulary(terms)


directlyProvides(vocabAvailPlatforms, IContextSourceBinder)


yesnochoice = SimpleVocabulary([SimpleTerm(value=0, title=_(u"No")), SimpleTerm(value=1, title=_(u"Yes"))])


@provider(IContextAwareDefaultFactory)
def getContainerTitle(self):
    return self.aq_inner.title


@provider(IContextAwareDefaultFactory)
def contactinfoDefault(context):
    return context.contactAddress


@provider(IContextAwareDefaultFactory)
def legal_declaration_title(context):
    context = context.aq_inner.aq_parent