Changeset 1037 in products for quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.py
- Timestamp:
- Apr 16, 2009 8:45:25 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.portlet.cumulus/trunk/quintagroup/portlet/cumulus/cumulusportlet.py
r1036 r1037 7 7 from plone.portlets.interfaces import IPortletDataProvider 8 8 from plone.app.portlets.portlets import base 9 from plone.memoize.instance import memoize 9 10 10 11 from zope import schema … … 35 36 description=_(u'This and next 3 fields should be 6 character hex color values without the # prefix (000000 for black, ffffff for white).'), 36 37 required=True, 37 default=u' ffffff')38 default=u'5391d0') 38 39 39 40 tcolor2 = schema.TextLine( … … 41 42 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.'), 42 43 required=False, 43 default=u' ffffff')44 default=u'333333') 44 45 45 46 hicolor = schema.TextLine( … … 47 48 description=_(u'Color of the tag when mouse is over it.'), 48 49 required=False, 49 default=u' ffffff')50 default=u'578308') 50 51 51 52 bgcolor = schema.TextLine( … … 53 54 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.'), 54 55 required=True, 55 default=u' 333333')56 default=u'ffffff') 56 57 57 58 trans = schema.Bool( … … 109 110 width = 550; 110 111 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' 115 116 speed = 100 116 117 trans = False … … 131 132 "manage portlets" screen. 132 133 """ 133 return _(" Cumulus portlet")134 return _("Tag Cloud (cumulus)") 134 135 135 136 … … 145 146 self.portal_url = portal_state.portal_url() 146 147 148 @property 149 def title(self): 150 return _("Tag Cloud") 151 147 152 def getScript(self): 148 153 params = { 149 154 'url': self.portal_url + '/++resource++tagcloud.swf', 150 'tagcloud': self.getTagCloud(),155 'tagcloud': urllib.quote('<tags>%s</tags>' % self.getTagAnchors()), 151 156 'width': self.data.width, 152 157 'height': self.data.height, … … 173 178 </script>""" % params 174 179 175 def getTagCloud(self): 176 tags = '<tags>' 180 @memoize 181 def getTagAnchors(self): 182 tags = '' 177 183 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' % \ 179 185 (tag['url'], tag['number_of_entries'], tag['size'], self.data.unit, tag['name']) 180 tags += '</tags>' 181 return urllib.quote(tags) 186 return tags 182 187 183 188 def getTags(self):
Note: See TracChangeset
for help on using the changeset viewer.