示例#1
0
 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)
示例#2
0
    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)
            )
        )
示例#3
0
    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'
示例#4
0
    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
示例#5
0
 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)
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
    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)
示例#14
0
    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)
示例#15
0
 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)
示例#16
0
 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)
示例#17
0
 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)))
示例#18
0
 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
示例#19
0
    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())))
示例#20
0
    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'
示例#21
0
 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)
         )
     )
示例#22
0
    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)))
示例#23
0
    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)))
示例#24
0
    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()
                )
            )
        )
示例#25
0
 def language(self):
     # XXX: future use
     return get_language(self.context)
示例#26
0
 def language(self):
     return get_language(self.context)
示例#27
0
 def language(self):
     # XXX: future use
     return get_language(self.context)