def __init__(self, context, request): self.context = aq_inner(context) self.request = request self.language = get_language(context) data = url_quote('{0} - {1}'.format(safe_unicode(self.context.title), self.context.absolute_url())) self.whatsappurl = 'whatsapp://send?text={0}'.format(data)
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) if self.sheet: self.typebutton = self.sheet.getProperty('typebutton', '') self.twittvia = self.sheet.getProperty('twittvia', '') self.urlnoscript = ( u'http://twitter.com/home?status=' + url_quote(u'{0} - {1} via {2}'.format( safe_unicode(self.context.title), self.context.absolute_url(), self.twittvia) ) )
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.title = context.title self.description = context.Description() self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = facebook_language(get_language(context), self.language) self.sheet = getattr(pp, 'sc_social_likes_properties', None) self.image = get_content_image(context, width=1200, height=630) if self.sheet: self.fbaction = self.sheet.getProperty("fbaction", "") self.fbapp_id = self.sheet.getProperty("fbapp_id", "") self.fbadmins = self.sheet.getProperty("fbadmins", "") self.button = self.typebutton if self.fbaction == 'share': self.fbclass = 'fb-share-button' else: self.fbclass = 'fb-like'
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.title = context.title self.description = context.Description() self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = facebook_language(get_language(context), self.language) self.sheet = getattr(pp, 'sc_social_likes_properties', None) self.image = get_content_image(context, width=1200, height=630) if self.sheet: self.fbaction = self.sheet.getProperty('fbaction', '') self.fbapp_id = self.sheet.getProperty('fbapp_id', '') self.fbadmins = self.sheet.getProperty('fbadmins', '') self.fbshow_like = 'Like' in self.sheet.getProperty( 'fbbuttons', []) self.fbshow_share = 'Share' in self.sheet.getProperty( 'fbbuttons', []) self.button = self.typebutton
def __init__(self, context, request): self.context = aq_inner(context) self.request = request self.language = get_language(context) data = url_quote(u'{0} - {1}'.format( safe_unicode(self.context.title), self.context.absolute_url())) self.whatsappurl = u'whatsapp://send?text={0}'.format(data)
def _setup(self): self.portal_state = getMultiAdapter( (self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = self.context.absolute_url() self.language = get_language(self.context) data = url_quote(self.context.absolute_url()) self.telegramurl = u'https://telegram.me/share/url?url={0}'.format(data)
def update(self): registry = getUtility(IRegistry) self.settings = registry.forInterface(ISocialLikeSettings, check=False) self.helper = getMultiAdapter((self.context, self.request), name=u'sl_helper') self.title = self.context.Title() self.description = self.context.Description() portal = api.portal.get() self.site_name = portal.Title() self.language = facebook_language(get_language(self.context), 'en_US') self.image = get_content_image(self.context)
def fbjs(self): language = facebook_language(get_language(self.context), 'en_US') return """ (function() {{ var po = document.createElement('script'); po.async = true; po.src = document.location.protocol + '//connect.facebook.net/{0}/all.js#xfbml=1'; var head = document.getElementsByTagName('head')[0]; head.appendChild(po); }}()); """.format(language)
def _setup(self): self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = self.context.absolute_url() self.language = get_language(self.context) data = url_quote(self.context.absolute_url()) self.telegramurl = u'https://telegram.me/share/url?url={0}'.format( data)
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context)
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None)
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) data = url_quote(u'{0} - {1}'.format(safe_unicode(self.context.title), self.context.absolute_url())) self.whatsappurl = u'whatsapp://send?text={0}'.format(data)
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.portal_state = getMultiAdapter( (self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) data = url_quote(u'{0} - {1}'.format( safe_unicode(self.context.title), self.context.absolute_url())) self.whatsappurl = u'whatsapp://send?text={0}'.format(data)
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.urlnoscript = (u'http://twitter.com/home?status=' + url_quote( u'{0} - {1} via {2}'.format(safe_unicode( self.context.title), self.context.absolute_url(), self.via)))
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.title = context.title self.description = context.Description() self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = facebook_language(get_language(context), self.language) self.image = get_content_image(context, width=1200, height=630) self.typebutton # XXX: needed to initialize self.width
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) self.whatsappurl = ( u'whatsapp://send?text=' + url_quote(u'{0} - {1}'.format(safe_unicode(self.context.title), self.context.absolute_url())))
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) if self.sheet.getProperty("show_my_counts", 0): self.annotation = 'bubble' else: self.annotation = 'none'
def __init__(self, context, request): self.context = context self.request = request # FIXME: the following could rise unexpected exceptions # move it to a new setup() method # see: http://docs.plone.org/develop/plone/views/browserviews.html#creating-a-view self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.urlnoscript = ( u'http://twitter.com/home?status=' + url_quote(u'{0} - {1} via {2}'.format( safe_unicode(self.context.title), self.context.absolute_url(), self.via) ) )
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) if self.sheet: self.typebutton = self.sheet.getProperty('typebutton', '') self.twittvia = self.sheet.getProperty('twittvia', '') self.urlnoscript = (u'http://twitter.com/home?status=' + url_quote(u'{0} - {1} via {2}'.format( safe_unicode(self.context.title), self.context.absolute_url(), self.twittvia)))
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter((self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) if self.sheet: self.typebutton = self.sheet.getProperty("typebutton", "") self.twittvia = self.sheet.getProperty("twittvia", "") self.urlnoscript = ('http://twitter.com/home?status=' + url_quote('%s - %s via %s' % (self.context.Title(), self.context.absolute_url(), self.twittvia)))
def __init__(self, context, request): super(PluginView, self).__init__(context, request) pp = getToolByName(context, 'portal_properties') self.context = context self.request = request self.portal_state = getMultiAdapter( (self.context, self.request), name=u'plone_portal_state') self.portal = self.portal_state.portal() self.site_url = self.portal_state.portal_url() self.portal_title = self.portal_state.portal_title() self.url = context.absolute_url() self.language = get_language(context) self.sheet = getattr(pp, 'sc_social_likes_properties', None) self.whatsappurl = ( u'whatsapp://send?text=' + url_quote( u'{0} - {1}'.format( safe_unicode(self.context.title), self.context.absolute_url() ) ) )
def language(self): # XXX: future use return get_language(self.context)
def language(self): return get_language(self.context)