Esempio n. 1
0
class IFileSchema(Interface):

    """Schema for file views.
    """

    title = TextLine(
        title=_(u'Title'),
        required=False,
        missing_value=u'')

    language = TextLine(
        title=_(u'Language'),
        required=False,
        missing_value=u'',
        max_length=2)

    description = Text(
        title=_(u'Description'),
        required=False,
        missing_value=u'')

    format = ASCIILine(
        title=_(u'Content type'),
        readonly=True)

    file = FileUpload(
        title=_(u'Upload'),
        required=False)
Esempio n. 2
0
class FileAddView(ContentAddFormBase):

    """Add view for IMutableFile.
    """

    form_fields = (
        form.FormFields(IFileSchema).select('title', 'description') +
        form.FormFields(FileUpload(__name__='file', title=_(u'Upload')))
        )

    def setUpWidgets(self, ignore_request=False):
        super(FileAddView,
              self).setUpWidgets(ignore_request=ignore_request)
        self.widgets['description'].height = 3
        self.widgets['file'].displayWidth = 60

    def create(self, data):
        obj = super(FileAddView,
                    self).create(dict(id=data['file'].filename))
        adapted = IFileSchema(obj)
        adapted.title = data['title']
        adapted.language = u''
        adapted.description = data['description']
        adapted.file = data['file']
        return obj
Esempio n. 3
0
class ICustomUserDataSchema(Interface):

    fullname = schema.TextLine(title=_(u'label_full_name',
                                       default=u'Full Name'),
                               description=u'',
                               required=False)

    email = schema.ASCIILine(title=_(u'label_email', default=u'E-mail'),
                             description=u'',
                             required=True,
                             constraint=checkEmailAddress)

    phone = schema.ASCIILine(title=_(u'label_phone', default=u'Phone'),
                             description=u'',
                             required=False)

    mobile = schema.ASCIILine(title=_(u'label_mobile',
                                      default=u'Mobile phone'),
                              description=u'',
                              required=False)

    description = schema.Text(
        title=_(u'label_biography', default=u'Biography'),
        description=_(u'help_biography',
                      default=u"A short overview of who you are and what you "
                      "do. Will be displayed on your profile page"),
        required=False)

    position = schema.TextLine(title=_(u'label_position', default=u'Position'),
                               description=u'',
                               required=False)

    department = schema.TextLine(title=_(u'label_department',
                                         default=u'Department'),
                                 description=u'',
                                 required=False)

    location = schema.TextLine(title=_(u'label_location', default=u'Location'),
                               description=u'',
                               required=False)

    portrait = FileUpload(
        title=_(u'label_portrait', default=u'Portrait'),
        description=_(u'help_portrait',
                      default=u'To add or change the portrait: click the '
                      '"Browse" button; select a picture of yourself. '
                      'We recommend to upload a square image not smaller '
                      'than 300px wide by 300px tall.'),
        required=False)

    pdelete = schema.Bool(title=_(u'label_delete_portrait',
                                  default=u'Delete Portrait'),
                          description=u'',
                          required=False)
Esempio n. 4
0
class IUserDataSchema(Interface):
    """
    """

    fullname = schema.TextLine(
        title=_(u'label_full_name', default=u'Full Name'),
        description=_(u'help_full_name_creation',
                      default=u"Enter full name, e.g. John Smith."),
        required=False)

    email = schema.ASCIILine(
        title=_(u'label_email', default=u'E-mail'),
        description=u'',
        required=True,
        constraint=checkEmailAddress)

    home_page = schema.TextLine(
        title=_(u'label_homepage', default=u'Home page'),
        description=_(u'help_homepage',
                      default=u"The URL for your external home page, "
                      "if you have one."),
        required=False)

    description = schema.Text(
        title=_(u'label_biography', default=u'Biography'),
        description=_(u'help_biography',
                      default=u"A short overview of who you are and what you "
                      "do. Will be displayed on your author page, linked "
                      "from the items you create."),
        required=False)

    location = schema.TextLine(
        title=_(u'label_location', default=u'Location'),
        description=_(u'help_location',
                      default=u"Your location - either city and "
                      "country - or in a company setting, where "
                      "your office is located."),
        required=False)

    portrait = FileUpload(title=_(u'label_portrait', default=u'Portrait'),
        description=_(u'help_portrait',
                      default=u'To add or change the portrait: click the '
                      '"Browse" button; select a picture of yourself. '
                      'Recommended image size is 75 pixels wide by 100 '
                      'pixels tall.'),
        required=False)

    pdelete = schema.Bool(
        title=_(u'label_delete_portrait', default=u'Delete Portrait'),
        description=u'',
        required=False)