コード例 #1
0
ファイル: portlet.py プロジェクト: scallens/redturtle.video
class EditForm(base.EditForm):
    form_fields = form.Fields(IRTVideoPortlet)
    form_fields['target'].custom_widget = UberSelectionWidget

    label = _(u"label_edit_video_portlet", default=u"Edit Video Portlet")
    description = _(u"help_edit_video_portlet",
                    default=u"This portlet display a video gallery.")
コード例 #2
0
ファイル: portlet.py プロジェクト: scallens/redturtle.video
class AddForm(base.AddForm):
    form_fields = form.Fields(IRTVideoPortlet)
    form_fields['target'].custom_widget = UberSelectionWidget

    label = _(u"label_add_video_portlet", default=u"Add Video Portlet")
    description = _(u"help_add_video_portlet",
                    default=u"This portlet display a video gallery.")

    def create(self, data):
        return Assignment(**data)
コード例 #3
0
 def actionMigrate(self, action, data):
     output = migrateFlowplayerToRedTurtleVideo(self.context)
     if output:
         for o in output:
             IStatusMessage(self.request).addStatusMessage(o, type='info')
     else:
         IStatusMessage(self.request).addStatusMessage(_(u'Nothing to migrate'), type='info')
     return self.request.response.redirect(self.context.absolute_url())
コード例 #4
0
 def actionMigrate(self, action, data):
     output = migrateFlowplayerToRedTurtleVideo(self.context)
     if output:
         for o in output:
             IStatusMessage(self.request).addStatusMessage(o, type='info')
     else:
         IStatusMessage(self.request).addStatusMessage(
             _(u'Nothing to migrate'), type='info')
     return self.request.response.redirect(self.context.absolute_url())
コード例 #5
0
class MigrateFlowplayerFile(formbase.PageForm):
    form_fields = form.FormFields(IMigrateFlowplayerSchema)
    label = u'Video files migration'
    description = u'Migrate basic Flowplayer video files to RedTurtle Video'

    @form.action(_(u'Migrate Flowplayer video files'))
    def actionMigrate(self, action, data):
        output = migrateFlowplayerToRedTurtleVideo(self.context)
        if output:
            for o in output:
                IStatusMessage(self.request).addStatusMessage(o, type='info')
        else:
            IStatusMessage(self.request).addStatusMessage(
                _(u'Nothing to migrate'), type='info')
        return self.request.response.redirect(self.context.absolute_url())

    @form.action(_(u'Cancel'))
    def actionCancel(self, action, data):
        return self.request.response.redirect(self.context.absolute_url())
コード例 #6
0
 def actionMigrate(self, action, data):
     if MIGRATION_MODULE:
         output = migrateRTInternalVideo(self.context)
         IStatusMessage(self.request).addStatusMessage(output, type='info')
         return self.request.response.redirect(self.context.absolute_url())
     else:
         output = _(u'migration_error_msg',
                    default=u'You need to install "Products.contentmigration" product for perform the task')
         IStatusMessage(self.request).addStatusMessage(output, type='error')
         return self.request.response.redirect(self.context.absolute_url()+'/@@migrateblobs')
コード例 #7
0
class MigrateBlobs(formbase.PageForm):
    form_fields = form.FormFields(IMigrateBlobsSchema)
    label = u'Blobs Migration'
    description = u'Migrate video, making it use plone.app.blob'

    @form.action(_(u'Migrate Internal video'))
    def actionMigrate(self, action, data):
        if MIGRATION_MODULE:
            output = migrateRTInternalVideo(self.context)
            IStatusMessage(self.request).addStatusMessage(output, type='info')
            return self.request.response.redirect(self.context.absolute_url())
        else:
            output = _(u'migration_error_msg',
                       default=u'You need to install "Products.contentmigration" product for perform the task')
            IStatusMessage(self.request).addStatusMessage(output, type='error')
            return self.request.response.redirect(self.context.absolute_url()+'/@@migrateblobs')
        

    @form.action(_(u'Cancel'))
    def actionCancel(self, action, data):
        return self.request.response.redirect(self.context.absolute_url())
コード例 #8
0
ファイル: install.py プロジェクト: RedTurtle/redturtle.video
def uninstall(portal, reinstall=False):
    if not reinstall:
        # Don't want to delete all registry values if a Manager simply reinstall the product from ZMI
        setup_tool = portal.portal_setup
        setup_tool.runAllImportStepsFromProfile('profile-redturtle.video:uninstall')
        logger.info("Uninstall done")
        if WM_FOUND:
            logger.warn("You have wildcard.media available. Have you migrated RedTurtle Video types to it?")
            portal.plone_utils.addPortalMessage(_('wildacrdmedia_support_warning',
                                                  default=u"It seems you have wildcard.media product available.\n"
                                                  u"Have you migrated RedTurtle Video types to it?\n"
                                                  u"You can run the \"RedTurtle Video: migrate to wildcard.media\" "
                                                  u"Generic Setup profile."),
                                                type="warning")
コード例 #9
0
def uninstall(portal, reinstall=False):
    if not reinstall:
        # Don't want to delete all registry values if a Manager simply reinstall the product from ZMI
        setup_tool = portal.portal_setup
        setup_tool.runAllImportStepsFromProfile(
            'profile-redturtle.video:uninstall')
        logger.info("Uninstall done")
        if WM_FOUND:
            logger.warn(
                "You have wildcard.media available. Have you migrated RedTurtle Video types to it?"
            )
            portal.plone_utils.addPortalMessage(_(
                'wildacrdmedia_support_warning',
                default=u"It seems you have wildcard.media product available.\n"
                u"Have you migrated RedTurtle Video types to it?\n"
                u"You can run the \"RedTurtle Video: migrate to wildcard.media\" "
                u"Generic Setup profile."),
                                                type="warning")
コード例 #10
0
ファイル: portlet.py プロジェクト: scallens/redturtle.video
class IRTVideoPortlet(IPortletDataProvider):
    """A portlet which can display video gallery"""

    header = schema.TextLine(title=_(u"label_portlet_header",
                                     default=u"Portlet header"),
                             description=_(
                                 u"help_portlet_header",
                                 default=u"Title of the rendered portlet"),
                             required=False)

    target = schema.Choice(title = _(u"label_target_object",
                                        default = u"Target object"),
                           description = _(u"help_target_object",
                                        default = u"This can be a file "\
                                            "containing an video content, "\
                                            "or a folder or collection "\
                                            "containing videos"),
                           required = True,
                           source = SearchableTextSourceBinder(
                                      {'object_provides': [IATTopic.__identifier__,
                                            IATFolder.__identifier__,
                                            IRTVideo.__identifier__]},
                                      default_query = 'path:'))

    limit = schema.Int(title = _(u"label_number_of_videos_to_show",
                            default = u"Number of videos to show"),
                       description = _(u"help_number_of_videos_to_show",
                            default = u"Enter a number greater than 0 "\
                                    "to limit the number of items displayed"),
                       required = False,
                       default = 0)

    show_more = schema.Bool(title = _(u"label_show_more_link",
                                default=u'Show "more..." link'),
                       description = _(u"help_show_more_link",
                                    default = u"If enabled, a more... "\
                                        "link will appear in the footer of "\
                                        "the portlet, "
                                    "linking to the underlying data."),
                       required = True,
                       default = True)
コード例 #11
0
RTInternalVideoSchema = ATFileSchema.copy() + VIDEO_SCHEMA.copy()

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

RTInternalVideoSchema['title'].storage = atapi.AnnotationStorage()
RTInternalVideoSchema['title'].required = True
RTInternalVideoSchema['description'].storage = atapi.AnnotationStorage()
RTInternalVideoSchema['file'].searchable = False
#RTInternalVideoSchema['file'].index_method = '_at_accessor'

imageField = ATImageSchema['image'].copy()
imageField.required = False
imageField.primary = False
imageField.widget.description = _(
    u'help_video_image',
    default=u'Can be used to provide splash image when needed')
imageField.validators = None
imageField.sizes = None

RTInternalVideoSchema.addField(imageField)
RTInternalVideoSchema.moveField('image', after='file')

fileField = RTInternalVideoSchema['file']
fileField.widget.label = _(u'label_video_file', default=u'Video file')
fileField.widget.description = _(
    u'help_video_file',
    default=u'Put there the video file in a compatible format')

schemata.finalizeATCTSchema(RTInternalVideoSchema, moveDiscussion=False)
コード例 #12
0
        (
            # -*- Your Archetypes field definitions here ... -*-
        )
    )
)

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

RTRemoteVideoSchema["title"].storage = atapi.AnnotationStorage()
RTRemoteVideoSchema["description"].storage = atapi.AnnotationStorage()

imageField = ATImageSchema["image"].copy()
imageField.required = False
imageField.primary = False
imageField.widget.description = _(u"help_video_image", default=u"Can be used to provide splash image when needed")
imageField.validators = None
imageField.sizes = None

RTRemoteVideoSchema.addField(imageField)
RTRemoteVideoSchema.moveField("image", after="remoteUrl")
RTRemoteVideoSchema["remoteUrl"].widget.size = 60

schemata.finalizeATCTSchema(RTRemoteVideoSchema, moveDiscussion=False)


class RTRemoteVideo(ATLink, ATCTImageTransform, DefaultVideo):
    """A link to a video with screenshot"""

    implements(IRTRemoteVideo)
コード例 #13
0
ファイル: portlet.py プロジェクト: scallens/redturtle.video
 def title(self):
     if self.header:
         return _(u"Video gallery") + ': ' + self.header
     return _(u"Video gallery")
コード例 #14
0
from Products.Archetypes import atapi
from redturtle.video import videoMessageFactory as _

VIDEO_SCHEMA=atapi.Schema((

    atapi.StringField('year',
                widget = atapi.StringWidget(
                    label = _(u'label_year', default=u'Year'),
                    size=4,
                    maxlength=4,
                    description = '',
                    )),

    atapi.StringField('duration',
                widget = atapi.StringWidget(
                    label = _(u'label_duration', default=u'Duration'),
                    description = '',
                    )),

    atapi.BooleanField('useSplashScreen',
                default=False,
                schemata="look",
                widget = atapi.BooleanWidget(
                    label = _(u'label_use_imge', default=u'Use image as splash screen?'),
                    description = _(u'help_use_imge',
                                    default=u"Check for use splash screen image not only in the product's portlet "
                                            u"but also in the video view."),
                    )),

    atapi.TextField('text',
              required=False,
コード例 #15
0
RTRemoteVideoSchema = ATLinkSchema.copy() + VIDEO_SCHEMA.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

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

imageField = ATImageSchema['image'].copy()
imageField.required = False
imageField.primary = False
imageField.widget.description = _(u'help_video_image',
                                  default = u'Can be used to provide splash image when needed')
imageField.validators = None
imageField.sizes = None

RTRemoteVideoSchema.addField(imageField)
RTRemoteVideoSchema.moveField('image', after = 'remoteUrl')
RTRemoteVideoSchema['remoteUrl'].widget.size = 60
RTRemoteVideoSchema['remoteUrl'].accessor = 'getRemoteVideoURL'

schemata.finalizeATCTSchema(RTRemoteVideoSchema, moveDiscussion = False)


class RTRemoteVideo(ATCTContent, ATCTImageTransform, DefaultVideo):
    """A link to a video with screenshot"""
    implements(IRTRemoteVideo)
コード例 #16
0
RTRemoteVideoSchema = ATLinkSchema.copy() + VIDEO_SCHEMA.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

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

imageField = ATImageSchema['image'].copy()
imageField.required = False
imageField.primary = False
imageField.widget.description = _(u'help_video_image',
                                  default = u'Can be used to provide splash image when needed')
imageField.validators = None
imageField.sizes = None

RTRemoteVideoSchema.addField(imageField)
RTRemoteVideoSchema.moveField('image', after = 'remoteUrl')
RTRemoteVideoSchema['remoteUrl'].widget.size = 60

schemata.finalizeATCTSchema(RTRemoteVideoSchema, moveDiscussion = False)


class RTRemoteVideo(ATLink, ATCTImageTransform, DefaultVideo):
    """A link to a video with screenshot"""
    implements(IRTRemoteVideo)

    meta_type = "RTRemoteVideo"
コード例 #17
0
ファイル: portlet.py プロジェクト: RedTurtle/redturtle.video
 def title(self):
     if self.header:
         return _(u"Video gallery")+': ' + self.header
     return _(u"Video gallery")
コード例 #18
0
RTInternalVideoSchema = ATFileSchema.copy() + VIDEO_SCHEMA.copy()

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

RTInternalVideoSchema['title'].storage = atapi.AnnotationStorage()
RTInternalVideoSchema['title'].required = True
RTInternalVideoSchema['description'].storage = atapi.AnnotationStorage()
RTInternalVideoSchema['file'].searchable = False
#RTInternalVideoSchema['file'].index_method = '_at_accessor'

imageField = ATImageSchema['image'].copy()
imageField.required = False
imageField.primary = False
imageField.widget.description = _(u'help_video_image',
                                  default=u'Can be used to provide splash image when needed')
imageField.validators = None
imageField.sizes = None

RTInternalVideoSchema.addField(imageField)
RTInternalVideoSchema.moveField('image', after='file')

fileField = RTInternalVideoSchema['file']
fileField.widget.label = _(u'label_video_file',
                          default=u'Video file')
fileField.widget.description = _(u'help_video_file',
                                default=u'Put there the video file in a compatible format')

schemata.finalizeATCTSchema(RTInternalVideoSchema, moveDiscussion=False)