Ignore:
Timestamp:
Apr 16, 2009 8:45:25 AM (15 years ago)
Author:
koval
Message:

changed default tag cloud colors, tags are now accessible by search engines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.py

    r1036 r1037  
    77from plone.portlets.interfaces import IPortletDataProvider 
    88from plone.app.portlets.portlets import base 
     9from plone.memoize.instance import memoize 
    910 
    1011from zope import schema 
     
    3536        description=_(u'This and next 3 fields should be 6 character hex color values without the # prefix (000000 for black, ffffff for white).'), 
    3637        required=True, 
    37         default=u'ffffff') 
     38        default=u'5391d0') 
    3839 
    3940    tcolor2 = schema.TextLine( 
     
    4142        description=_(u'When this color is available, each tag\'s color will be from a gradient between the two. This allows you to create a multi-colored tag cloud.'), 
    4243        required=False, 
    43         default=u'ffffff') 
     44        default=u'333333') 
    4445 
    4546    hicolor = schema.TextLine( 
     
    4748        description=_(u'Color of the tag when mouse is over it.'), 
    4849        required=False, 
    49         default=u'ffffff') 
     50        default=u'578308') 
    5051 
    5152    bgcolor = schema.TextLine( 
     
    5354        description=_(u'The hex value for the background color you\'d like to use. This options has no effect when \'Use transparent mode\' is selected.'), 
    5455        required=True, 
    55         default=u'333333') 
     56        default=u'ffffff') 
    5657 
    5758    trans = schema.Bool( 
     
    109110    width    = 550; 
    110111    height   = 375; 
    111     tcolor   = u'ffffff' 
    112     tcolor2  = u'ffffff' 
    113     hicolor  = u'ffffff' 
    114     bgcolor  = u'333333' 
     112    tcolor   = u'5391d0' 
     113    tcolor2  = u'333333' 
     114    hicolor  = u'578308' 
     115    bgcolor  = u'ffffff' 
    115116    speed    = 100 
    116117    trans    = False 
     
    131132        "manage portlets" screen. 
    132133        """ 
    133         return _("Cumulus portlet") 
     134        return _("Tag Cloud (cumulus)") 
    134135 
    135136 
     
    145146        self.portal_url = portal_state.portal_url() 
    146147 
     148    @property 
     149    def title(self): 
     150        return _("Tag Cloud") 
     151 
    147152    def getScript(self): 
    148153        params = { 
    149154            'url': self.portal_url + '/++resource++tagcloud.swf', 
    150             'tagcloud': self.getTagCloud(), 
     155            'tagcloud': urllib.quote('<tags>%s</tags>' % self.getTagAnchors()), 
    151156            'width': self.data.width, 
    152157            'height': self.data.height, 
     
    173178        </script>""" % params 
    174179 
    175     def getTagCloud(self): 
    176         tags = '<tags>' 
     180    @memoize 
     181    def getTagAnchors(self): 
     182        tags = '' 
    177183        for tag in self.getTags(): 
    178             tags += '<a href="%s" title="%s entries" style="font-size: %.1f%s;">%s</a>' % \ 
     184            tags += '<a href="%s" title="%s entries" rel="tag" style="font-size: %.1f%s;">%s</a>\n' % \ 
    179185                (tag['url'], tag['number_of_entries'], tag['size'], self.data.unit, tag['name']) 
    180         tags += '</tags>' 
    181         return urllib.quote(tags) 
     186        return tags 
    182187 
    183188    def getTags(self): 
Note: See TracChangeset for help on using the changeset viewer.