Example #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)
Example #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)
            )
        )
Example #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'
Example #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
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)))
Example #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
Example #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())))
Example #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'
Example #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)
         )
     )
Example #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)))
Example #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)))
Example #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()
                )
            )
        )
Example #25
0
 def language(self):
     # XXX: future use
     return get_language(self.context)
Example #26
0
 def language(self):
     return get_language(self.context)
Example #27
0
 def language(self):
     # XXX: future use
     return get_language(self.context)