class IURL2Embed(interface.Interface): """To extend oembed experience we add a new kind of service: get the embed code directly from the URL. For example we can do that with picasaweb service. Pros: * no need to request external service Cons: * we can't get external information like title, description, ... """ embed_html_template = schema.ASCII(title=_(u"embed_html_template")) url_schemes = schema.List(title=_(u"url schemes")) def break_url(url): """utility which return proto, host, path, query, fragments """ def get_embed(url, maxwidth=None, maxheight=None): """Return the embed html code build from embed_html_template using get_params_from_url""" def request(url): """Return a dict contains all needed params in embed_html_template
class IOEmbedSettings(interface.Interface): """Client server side is named consumer""" embedly_apikey = schema.ASCIILine(title=_(u'embedlykey'), required=False) activate_jqueryoembed_integration = schema.Bool( title=i18n.jqueryoembed_integration, description=i18n.jqueryoembed_integration_desc, default=True) #configuration for jquery.oembed javascript embedMethod = schema.Choice(title=_(u'embedMethod'), description=_(u'embedMethod_description'), vocabulary=vocabulary.embedMethods, default=u'replace') defaultOEmbedProvider = schema.ASCIILine(title=_(u'defaultOEmbedProvider'), default="plone") allowedProviders = schema.List( title=_(u'allowedProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False) disallowedProviders = schema.List( title=_(u'disallowedProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False) customProviders = schema.List( title=_(u'customProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False)
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from collective.oembed.i18n import messageFactory as _ embedMethods = SimpleVocabulary( [SimpleTerm(value=u'append', title=_(u'append')), SimpleTerm(value=u'fill', title=_(u'fill')), SimpleTerm(value=u'replace', title=_(u'replace')), SimpleTerm(value=u'auto', title=_(u'auto'))] )
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from collective.oembed.i18n import messageFactory as _ embedMethods = SimpleVocabulary([ SimpleTerm(value=u'append', title=_(u'append')), SimpleTerm(value=u'fill', title=_(u'fill')), SimpleTerm(value=u'replace', title=_(u'replace')), SimpleTerm(value=u'auto', title=_(u'auto')) ])
class IOEmbedSettings(interface.Interface): """Client server side is named consumer""" embedly_apikey = schema.ASCIILine(title=_(u'embedlykey'), required=False) activate_jqueryoembed_integration = schema.Bool( title=_(u"Activate jquery.oembed integration"), description= _(u"If you have installed a jquery.oembed plugin, you can activate integration" ), default=False) #configuration for jquery.oembed javascript embedMethod = schema.Choice(title=_(u'embedMethod'), description=_(u'embedMethod_description'), vocabulary=vocabulary.embedMethods, default=u'auto') defaultOEmbedProvider = schema.ASCIILine(title=_(u'defaultOEmbedProvider'), default="embed.ly") allowedProviders = schema.List( title=_(u'allowedProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False) disallowedProviders = schema.List( title=_(u'disallowedProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False) customProviders = schema.List( title=_(u'customProviders'), value_type=schema.ASCIILine(title=_(u'provider')), default=[], required=False)