class ImageBlobAttachment(object):
    adapts(IImageAttachment)
    implements(ISchemaExtender)

    fields = [
        ImageField(
            'image',
            required=True,
            primary=True,
            accessor='getImage',
            mutator='setImage',
            sizes=None,
            languageIndependent=True,
            storage=AnnotationStorage(migrate=True),
            swallowResizeExceptions=zconf.swallowImageResizeExceptions.enable,
            pil_quality=zconf.pil_config.quality,
            pil_resize_algo=zconf.pil_config.resize_algo,
            original_size=None,
            max_size=zconf.ATImage.max_image_dimension,
            default_content_type='image/png',
            allowable_content_types=('image/gif', 'image/jpeg', 'image/png'),
            validators=(('isNonEmptyFile', V_REQUIRED), ('checkImageMaxSize',
                                                         V_REQUIRED)),
            widget=ImageWidget(
                label=_('label_image', default='Image'),
                description=_(''),
                show_content_type=False,
            )),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
def get_image_field():
    return ImageField(
        'image',
        required=True,
        primary=True,
        languageIndependent=True,
        storage=AnnotationStorage(migrate=True),
        max_size=10.0,
        maxsize=10.0,  # The validator is searching on field for maxsize
        sizes={
            'large': (768, 768),
            'preview': (400, 400),
            'mini': (200, 200),
            'thumb': (128, 128),
            'tile': (64, 64),
            'icon': (32, 32),
            'listing': (16, 16),
        },
        validators=(('isNonEmptyFile', V_REQUIRED), ('checkImageMaxSize',
                                                     V_REQUIRED)),
        widget=ImageWidget(description='',
                           label=u'Image',
                           show_content_type=False))
示例#3
0
    ImageField('image',
               required=False,
               languageIndependent=True,
               storage=AnnotationStorage(migrate=True),
               swallowResizeExceptions= \
                   zconf.swallowImageResizeExceptions.enable,
               pil_quality=zconf.pil_config.quality,
               pil_resize_algo=zconf.pil_config.resize_algo,
               max_size=zconf.ATImage.max_image_dimension,
               sizes=None,
               validators=(('isNonEmptyFile', V_REQUIRED),
                           ('imageMinSize', V_REQUIRED)),
               widget=ImageWidget(
                   description='High-res preview image ' \
                               '(at least FHD 1920x1080). ' \
                               'If the image is removed, a new image will ' \
                               'automatically be created after saving',
                   label='Preview image',
                   show_content_type=False, )
               ),

    TextField(
        name='body',
        searchable=True,
        required_for_published=False,
        required=False,
        allowable_content_types=('text/html',),
        default_content_type="text/html",
        default_output_type="text/x-html-safe",
        widget=RichWidget(
            label="More information",
            max_size=zconf.ATNewsItem.max_image_dimension,
            sizes={
                'large': (768, 768),
                'preview': (400, 400),
                'mini': (200, 200),
                'thumb': (128, 128),
                'tile': (64, 64),
                'icon': (32, 32),
                'listing': (16, 16),
            },
            validators=(('isNonEmptyFile', V_REQUIRED),
                        ('checkNewsImageMaxSize', V_REQUIRED)),
            widget=ImageWidget(description=_(
                u'help_news_image',
                default=
                u'Will be shown in the news listing, and in the news item itself. Image will be scaled to a sensible size.'
            ),
                               label=_(u'label_news_image', default=u'Image'),
                               show_content_type=False)),
        StringField('imageCaption',
                    required=False,
                    searchable=True,
                    widget=StringWidget(description='',
                                        label=_(u'label_image_caption',
                                                default=u'Image Caption'),
                                        size=40)),
    ),
    marshall=RFC822Marshaller())

ATNewsItemSchema['description'].widget.label = \
    _(u'label_summary', default=u'Summary')
示例#5
0
        widget=SelectionWidget(
            format='select',
            label=_("Instrument Location"),
            label_msgid="instrument_location",
            description=_(
                "The room and location where the instrument is installed"),
            description_msgid="help_instrument_location",
            visible={
                'view': 'invisible',
                'edit': 'visible'
            })),
    ImageField(
        'Photo',
        schemata='Additional info.',
        widget=ImageWidget(
            label=_("Photo image file"),
            description=_("Photo of the instrument"),
        ),
    ),
    DateTimeField('InstallationDate',
                  schemata='Additional info.',
                  widget=DateTimeWidget(
                      label=_("InstallationDate"),
                      description=_("The date the instrument was installed"),
                  )),
    BlobFileField('InstallationCertificate',
                  schemata='Additional info.',
                  widget=FileWidget(
                      label=_("Installation Certificate"),
                      description=_("Installation certificate upload"),
                  )),
))
示例#6
0
        pil_resize_algo=zconf.pil_config.resize_algo,
        max_size=zconf.ATImage.max_image_dimension,
        sizes={
            'large': (768, 768),
            'preview': (400, 400),
            'mini': (200, 200),
            'thumb': (128, 128),
            'tile': (64, 64),
            'icon': (32, 32),
            'listing': (16, 16),
        },
        validators=(('isNonEmptyFile', V_REQUIRED),
                    ('checkImageMaxSize', V_REQUIRED)),
        widget=ImageWidget(
            description='',
            label=_(u'label_image', default=u'Image'),
            show_content_type=False,
        )), ),
    marshall=PrimaryFieldMarshaller())

# Title is pulled from the file name if we don't specify anything,
# so it's not strictly required, unlike in the rest of ATCT.
ATImageSchema['title'].required = False

finalizeATCTSchema(ATImageSchema)


@implementer(IATImage)
class ATImage(ATCTFileContent, ATCTImageTransform):
    """An image, which can be referenced in documents.
               pil_quality=zconf.pil_config.quality,
               pil_resize_algo=zconf.pil_config.resize_algo,
               max_size=zconf.ATImage.max_image_dimension,
               sizes={'large': (768, 768),
                      'preview': (400, 400),
                      'mini': (200, 200),
                      'thumb': (128, 128),
                      'tile': (64, 64),
                      'icon': (32, 32),
                      'listing': (16, 16),
                      },
               validators=(('isNonEmptyFile', V_REQUIRED),
                           ('imageMinSize', V_REQUIRED)),
               widget=ImageWidget(
                   description='High-res preview image'
                               ' (at least 1024px width)',
                   label='Preview image',
                   show_content_type=False, )
               ),

    TextField(
        name='body',
        allowable_content_types=('text/html',),
        widget=RichWidget(
            label="More information",
            description=("Description of methodology "
                         "and calculations behind this."),
            label_msgid='EEAContentTypes_label_body',
            i18n_domain='eea',
            ),
        default_content_type="text/html",
示例#8
0
        'listUsers',
        required=True,
        searchable=False,
        default="",
        widget=LinesWidget(
            description=
            "Add specialists UWO email address (MUST BE UWO EMAIL, Example: [email protected])  If you have over 50 specialist, please make another Group Specialist.",
            label=_(u'List of Specialists', default=u'List of Specialists'))),
    ImageField('imageReference',
               required=False,
               searchable=False,
               default="",
               validators=(),
               widget=ImageWidget(
                   size=100,
                   description='Upload a Specialist Image Icon',
                   label=_(u'Specialist Image Icon',
                           default=u'Specialist Image Icon'),
               )),
))

GroupSpecialistSchema['title'].widget.label = 'Group Specialist Title'
GroupSpecialistSchema[
    'title'].widget.description = 'Group Specialists can be any group who specializes in helping.  (Tutors, Graduate Students, Writing Center Experts, etc...)'
GroupSpecialistSchema[
    'description'].widget.description = 'This is shown as a ToolTip over the Image.'

GroupSpecialistSchema['title'].storage = atapi.AnnotationStorage()
GroupSpecialistSchema['description'].storage = atapi.AnnotationStorage()
GroupSpecialistSchema['listUsers'].storage = atapi.AnnotationStorage()
GroupSpecialistSchema['imageReference'].storage = atapi.AnnotationStorage()
示例#9
0
     sizes={
         'large': (768, 768),
         'preview': (400, 400),
         'mini': (200, 200),
         'thumb': (128, 128),
         'tile': (64, 64),
         'icon': (32, 32),
         'listing': (16, 16),
     },
     validators=(('isNonEmptyFile', V_REQUIRED),
                 ('checkImageMaxSize', V_REQUIRED)),
     widget=ImageWidget(
         description='',
         label=_(u'label_image', default=u'Image'),
         show_content_type=False,
         visible={
             'view': 'visible',
             'edit': 'visible'
         },
     )),
 atapi.DateTimeField(
     'DatetimeCreated',
     default_method=DateTime,
     widget=atapi.CalendarWidget(
         label='Date/Time Creation',
         description=
         'Select the date and time the photo of the biospecimen is taken.',
         ampm=1,
         visible={
             'view': 'visible',
             'edit': 'visible'
示例#10
0
from Products.EEAContentTypes.content.interfaces import ICloudVideo
from Products.EEAContentTypes.content.ThemeTaggable import (
    ThemeTaggable,
    ThemeTaggable_schema,
)
from eea.forms.fields.ManagementPlanField import ManagementPlanField
from eea.forms.widgets.ManagementPlanWidget import ManagementPlanWidget

schema = Schema((
    ImageField('image',
               required=False,
               storage=public.AnnotationStorage(migrate=True),
               languageIndependent=True,
               widget=ImageWidget(
                   label='Image',
                   label_msgid='EEAContentTypes_label_image',
                   description_msgid='EEAContentTypes_help_image',
                   i18n_domain='eea',
                   show_content_type=False)),
    TextField('cloudUrl',
              languageIndependent=True,
              required=True,
              schemata='default',
              storage=AnnotationStorage(migrate=True),
              default_content_type='text/plain',
              validators=('videoCloudUrlValidator', ),
              allowable_content_types=('text/plain', ),
              default_output_type='text/plain',
              widget=TextAreaWidget(
                  description='The embedding code for the video from'
                  ' external sites eg. Vimeo or Youtube',
                  description_msgid="EEAContentTypes_help_quotationtext",
        'extraNotes',
        required=False,
        searchable=False,
        default="",
        widget=TextAreaWidget(
            description=
            "This note is displayed with area as a extra snippet of information.",
            label=_(u'Extra Note', default=u'Extra Note'))),
    ImageField('imageReference',
               required=False,
               searchable=False,
               default="",
               validators=(),
               widget=ImageWidget(
                   size=100,
                   description='Upload a image of the location.',
                   label=_(u'Location Image', default=u'Location Image'),
               )),
))

GroupLocationSchema['title'].widget.label = 'Location Name'
GroupLocationSchema[
    'description'].widget.label = "Description of what the Location Name means"

GroupLocationSchema['title'].storage = atapi.AnnotationStorage()
GroupLocationSchema['description'].storage = atapi.AnnotationStorage()
GroupLocationSchema['building'].storage = atapi.AnnotationStorage()
GroupLocationSchema['extraNotes'].storage = atapi.AnnotationStorage()
GroupLocationSchema['keyRequired'].storage = atapi.AnnotationStorage()
GroupLocationSchema['maxGroups'].storage = atapi.AnnotationStorage()
GroupLocationSchema['capacity'].storage = atapi.AnnotationStorage()
示例#12
0
        default="0",
        validators=(),
        vocabulary=[("0", "No"), ("1", "Yes")],
        widget=SelectionWidget(
            format='select',
            description='Does this link need to go through a proxy server?',
            label=_(u'Proxy Connection?', default=u'Proxy Connection?'),
        )),
    ImageField('imageReference',
               required=False,
               searchable=False,
               default="",
               validators=(),
               widget=ImageWidget(
                   size=100,
                   description='Image associated with Link.',
                   label=_(u'Upload Image', default=u'Upload Image'),
               )),
))

LibraryLinkSchema['title'].storage = atapi.AnnotationStorage()
LibraryLinkSchema['description'].storage = atapi.AnnotationStorage()

LibraryLinkSchema['title'].widget.label = "Library Advanced Links"
LibraryLinkSchema[
    'description'].widget.description = "Give a description of the Link."
LibraryLinkSchema['description'].required = False

LibraryLinkSchema['videoEmbed'].storage = atapi.AnnotationStorage()
LibraryLinkSchema['proxyRequired'].storage = atapi.AnnotationStorage()
LibraryLinkSchema['imageReference'].storage = atapi.AnnotationStorage()
示例#13
0
SlideshowItemSchema = link.ATLinkSchema.copy() + atapi.Schema((

    ImageField('image',
        required=True,
        storage=atapi.AnnotationStorage(),
        languageIndependent=True,
        max_size=zconf.ATNewsItem.max_image_dimension,
        sizes={'large': (768, 768),
               'preview': (400, 400),
              },
        validators=(('isNonEmptyFile', V_REQUIRED),
                    ('checkNewsImageMaxSize', V_REQUIRED)),
        widget=ImageWidget(
            description=_(u'help_slideshow_image',
            default=u'Please provide an image with ratio 2:1, and at least 2000px wide'),
            label=_(u'label_slideshow_image',
            default=u'Slideshow Image'),
            show_content_type=False)
        ),

    StringField(
        'detailtext',
        required=True,
        default=_(u'View Detail'),
        storage=atapi.AnnotationStorage(),
        widget=StringWidget(
            label=_(u'view_detail_button_label',
                default=u'View Details Label'),
            description=_(u'help_detail_button_descr',
                default=u'Set Text for Detail View Button'))
        ),