예제 #1
0
 def testModificationTimeDuringInlineImageMigration(self):
     foo = self.folder[self.folder.invokeFactory('Image', id='foo')]
     foo.schema['image'] = ImageField('image', storage=AnnotationStorage())
     foo.schema['image'].set(foo, getImage())
     # record the modification date before migration
     mod = foo.modified()
     # migrate using inline migrator
     migrate(self.portal, portal_type='Image', meta_type='ATBlob')
     # the modification date isn't changed by migration
     self.assertEqual(mod, foo.modified())
     # cleanup
     del foo.schema['image']
예제 #2
0
 def testOldScalesRemovedDuringInlineImageMigration(self):
     gif = getImage()
     foo = self.folder[self.folder.invokeFactory('Image', id='foo',
         title='an image', image=gif)]
     # fake an old ImageField in the class schema,
     # and store scales in AnnotationStorage
     foo.schema['image'] = ImageField('image', storage=AnnotationStorage())
     foo.schema['image'].set(foo, gif)
     isimage = lambda i: isinstance(i, Image)
     self.assertTrue(filter(isimage, IAnnotations(foo).values()))
     # migrate using inline migrator
     migrate(self.portal, portal_type='Image', meta_type='ATBlob')
     # make sure all scale annotations were removed
     self.assertFalse(filter(isimage, IAnnotations(foo).values()))
     # cleanup
     del foo.schema['image']
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))
         description='',
         label=_(u'label_body_text', u'Body Text'),
         rows=25,
         allow_file_upload=zconf.ATDocument.allow_document_upload)),
 ImageField(
     'image',
     required=False,
     storage=AnnotationStorage(migrate=True),
     languageIndependent=True,
     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='',
예제 #5
0
     required=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
    MaxSizeValidator('checkImageMaxSize', maxsize=zconf.ATImage.max_file_size))

ATImageSchema = ATContentTypeSchema.copy() + Schema(
    (ImageField(
        'image',
        required=True,
        primary=True,
        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={
            '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,
예제 #7
0
GroupSpecialistSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    LinesField(
        '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()
예제 #8
0
         label='Usages',
         label_msgid='PloneMeeting_label_usages',
         i18n_domain='PloneMeeting',
     ),
     enforceVocabulary=True,
     multiValued=1,
     vocabulary='listUsages',
     write_permission="PloneMeeting: Write risky config",
 ),
 ImageField(
     name='signatureImage',
     widget=ImageField._properties['widget'](
         description="MeetingUserSignatureImage",
         description_msgid="meeting_user_signature_image_descr",
         condition="python: here.isManager()",
         label='Signatureimage',
         label_msgid='PloneMeeting_label_signatureImage',
         i18n_domain='PloneMeeting',
     ),
     storage=AttributeStorage(),
     write_permission="PloneMeeting: Write risky config",
 ),
 BooleanField(
     name='signatureIsDefault',
     default=False,
     widget=BooleanField._properties['widget'](
         description="MeetingUserSignatureIsDefault",
         description_msgid="meeting_user_signature_is_default",
         condition="python: here.isManager()",
         label='Signatureisdefault',
         label_msgid='PloneMeeting_label_signatureIsDefault',
            "List what the room contents for working materials, one per line.",
            label=_(u'Room Contents', default=u'Room Contents'))),
    TextField(
        '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()
예제 #10
0
        'proxyRequired',
        required=True,
        searchable=False,
        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()
예제 #11
0
from Products.validation import V_REQUIRED

validation.register(MaxSizeValidator('checkImageMaxSize',
                                     maxsize=zconf.ATImage.max_file_size))

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(