Changeset 555
- Timestamp:
- 09/29/06 10:53:51
- Files:
-
- SimpleBlog/branches/plone-2.1-Blogging-APIs/Blog.py (modified) (1 diff)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/BlogEntry.py (modified) (2 diffs)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/__init__.py (modified) (1 diff)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/config.py (modified) (1 diff)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/SimpleBlog_macros.pt (modified) (10 diffs)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/delicious.gif (added)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/digg.gif (added)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/google.gif (added)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/spurl.gif (added)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/yahoo.gif (added)
- SimpleBlog/branches/plone-2.1-Blogging-APIs/util.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
SimpleBlog/branches/plone-2.1-Blogging-APIs/Blog.py
r554 r555 101 101 condition="python:0", # this line have to be removed in order to be visible/editable 102 102 description="Enter administrator's email for receaving notification about blog's activity"), 103 ) 103 ), 104 BooleanField('allowDelicious', 105 default = 1, 106 accessor = 'isDeliciousEnabled', 107 schemata = 'interface', 108 widget=BooleanWidget(label="Turn Delicious bookmarklet", 109 label_msgid="label_allow_delicious", 110 description_msgid="help_allow_delicious"), 111 ), 112 BooleanField('allowDigg', 113 default = 1, 114 accessor = 'isDiggEnabled', 115 schemata = 'interface', 116 widget=BooleanWidget(label="Turn Digg bookmarklet", 117 label_msgid="label_allow_digg", 118 description_msgid="help_allow_digg"), 119 ), 120 BooleanField('allowYahoo', 121 default = 1, 122 accessor = 'isYahooEnabled', 123 schemata = 'interface', 124 widget=BooleanWidget(label="Turn Yahoo bookmarklet", 125 label_msgid="label_allow_yahoo", 126 description_msgid="help_allow_yahoo"), 127 ), 128 BooleanField('allowGoogle', 129 default = 1, 130 accessor = 'isGoogleEnabled', 131 schemata = 'interface', 132 widget=BooleanWidget(label="Turn Google bookmarklet", 133 label_msgid="label_allow_google", 134 description_msgid="help_allow_google"), 135 ), 136 BooleanField('allowSpurl', 137 default = 1, 138 accessor = 'isSpurlEnabled', 139 schemata = 'interface', 140 widget=BooleanWidget(label="Turn Spurl bookmarklet", 141 label_msgid="label_allow_spurl", 142 description_msgid="help_allow_spurl"), 143 ), 104 144 #BooleanField('allowComments', 105 145 # default = 1, SimpleBlog/branches/plone-2.1-Blogging-APIs/BlogEntry.py
r554 r555 16 16 import sys 17 17 from util import * 18 from config import DIGG_TOPICS 18 19 19 20 schema = BaseFolderSchema + Schema(( … … 136 137 label = 'Bottom Adsence', 137 138 description = None)), 139 StringField('diggTopic', 140 default='offbeat_news', 141 vocabulary=DIGG_TOPICS, 142 widget=SelectionWidget(label='Digg topic', 143 label_msgid="label_digg_topic", 144 description_msgid="help_digg_topic", 145 i18n_domain="SimpleBlog", 146 description='Choose the digg topic.')), 138 147 )) 139 148 SimpleBlog/branches/plone-2.1-Blogging-APIs/__init__.py
r554 r555 19 19 from AccessControl import ModuleSecurityInfo, allow_module 20 20 ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('addTrackBack') 21 ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('encodeURLData') 21 22 22 23 #allow_module('Products.SimpleBlog.Extensions.utils') SimpleBlog/branches/plone-2.1-Blogging-APIs/config.py
r554 r555 11 11 ('descriptionOnly', 'Description only', 'display_description_only'), 12 12 ('titleOnly', 'Title only', 'display_title_only') )) 13 14 DIGG_TOPICS = DisplayList(( \ 15 ('apple', 'Technology:Apple') \ 16 ,('design', 'Technology:Design') \ 17 ,('gadgets', 'Technology:Gadgets') \ 18 ,('hardware', 'Technology:Hardware') \ 19 ,('tech_news', 'Technology:Industry News') \ 20 ,('linux_unix', 'Technology:Linux/Unix') \ 21 ,('mods', 'Technology:Mods') \ 22 ,('programming', 'Technology:Programming') \ 23 ,('security', 'Technology:Security') \ 24 ,('software', 'Technology:Software') \ 25 ,('tech_deals', 'Technology:Tech Deals') \ 26 ,('space', 'Science:Space') \ 27 ,('environment', 'Science:Environment') \ 28 ,('health', 'Science:Health') \ 29 ,('general_sciences', 'Science:General Sciences') \ 30 ,('business_finance', 'World & Business:Business Finance') \ 31 ,('politics', 'World & Business:Political News') \ 32 ,('political_opinion', 'World & Business:Political Opinion') \ 33 ,('world_news', 'World & Business:World News') \ 34 ,('offbeat_news', 'World & Business:Offbeat News') \ 35 ,('baseball', 'Sports:Baseball') \ 36 ,('basketball', 'Sports:Basketball') \ 37 ,('extreme_sports', 'Sports:Extreme Sports') \ 38 ,('football', 'Sports:Football - US/Canada') \ 39 ,('golf', 'Sports:Golf') \ 40 ,('hockey', 'Sports:Hockey') \ 41 ,('motorsport', 'Sports:Motorsport') \ 42 ,('soccer', 'Sports:Soccer') \ 43 ,('tennis', 'Sports:Tennis') \ 44 ,('other_sports', 'Sports:Other Sports') \ 45 ,('videos_animation', 'Videos:Animation') \ 46 ,('videos_comedy', 'Videos:Comedy') \ 47 ,('videos_educational', 'Videos:Educational') \ 48 ,('videos_gaming', 'Videos:Gaming') \ 49 ,('videos_music', 'Videos:Music') \ 50 ,('videos_people', 'Videos:People') \ 51 ,('videos_sports', 'Videos:Sports') \ 52 ,('celebrity', 'Entertainment:Celebrity') \ 53 ,('movies', 'Entertainment:Movies') \ 54 ,('music', 'Entertainment:Music') \ 55 ,('television', 'Entertainment:Television') \ 56 ,('gaming_news', 'Gaming:Gaming News') \ 57 ,('playable_web_games', 'Gaming:Playable Web Games') \ 58 )).sortedByValue() SimpleBlog/branches/plone-2.1-Blogging-APIs/skins/SimpleBlog/SimpleBlog_macros.pt
r554 r555 4 4 <body> 5 5 6 <div metal:define-macro="blogGlobals" 7 tal:define="global fp python:here.simpleblog_tool.getFrontPage(here); 8 global isDeliciousEnaled fp/isDeliciousEnabled; 9 global isDiggEnabled fp/isDiggEnabled; 10 global isYahooEnabled fp/isYahooEnabled; 11 global isGoogleEnabled fp/isGoogleEnabled; 12 global isSpurlEnabled fp/isSpurlEnabled; 13 global isTagsEnabled fp/isTagsEnabled; 14 global isAllowTrackback fp/getAllowTrackback" 15 tal:omit-tag=""> 16 </div> 17 6 18 <div metal:define-macro="full" tal:define="showReadMore python:0" class="simpleBlogEntry"> 19 <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 7 20 <div tal:define="size headerSize | python:1;title obj/title_or_id; 8 showIcons obj/simpleblog_tool/getShowIcons"21 showIcons fp/simpleblog_tool/getShowIcons" 9 22 class="simpleBlogTitle"> 10 23 <tal:x replace='structure string:<h${size} class="noMargin">'/> … … 25 38 26 39 <div metal:define-macro="descriptionOnly" tal:define="showReadMore python:1" class="simpleBlogEntry"> 40 <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 27 41 <div tal:define="size headerSize | python:1;title obj/title_or_id; 28 showIcons obj/simpleblog_tool/getShowIcons"42 showIcons fp/simpleblog_tool/getShowIcons" 29 43 class="simpleBlogTitle"> 30 44 <tal:x replace='structure string:<h${size} class="noMargin">'/> … … 44 58 45 59 <div metal:define-macro="titleOnly" tal:define="showReadMore python:1" class="simpleBlogTitle"> 60 <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 46 61 <tal:block tal:define="size headerSize | python:1;title obj/title_or_id; 47 showIcons obj/simpleblog_tool/getShowIcons">62 showIcons fp/simpleblog_tool/getShowIcons"> 48 63 <tal:x replace='structure string:<h${size} class="noMargin">'/> 49 64 <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;"> … … 58 73 </div> 59 74 60 <div metal:define-macro="ByLine" class="BlogByLine"> 75 <div metal:define-macro="ByLine" class="BlogByLine" 76 tal:define="fp nocall:fp | python:here.simpleblog_tool.getFrontPage(here);"> 61 77 <span i18n:translate="blog_by_line"> 62 78 Submitted by … … 71 87 <strong><a href="#" 72 88 tal:define="quotedCat python:pss.url_quote(cat)" 73 tal:attributes="href string:${ here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}"89 tal:attributes="href string:${fp/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}" 74 90 title="category"><span tal:omit-tag="" tal:content="cat"/></a></strong> 75 91 </tal:categories> … … 79 95 80 96 <div metal:define-macro="technoratiTags" 81 tal:define="cats python:obj.EntryTag();" 82 tal:condition="python:here.isTagsEnabled() and cats" 97 tal:define="cats python:obj.EntryTag(); 98 isTagsEnabled isTagsEnabled | here/isTagsEnabled" 99 tal:condition="python:isTagsEnabled and cats" 83 100 tal:omit-tag=""> 84 101 _____<br/> … … 97 114 <tal:x define="allowed python:obj.portal_discussion.isDiscussionAllowedFor(obj); 98 115 ccount python:allowed and obj.portal_discussion.getDiscussionFor(obj).replyCount(obj); 99 tballowed python:here.getAllowTrackback(); 100 tbcount python:len(obj.getTrackbacks())"> 116 tballowed isAllowTrackback | here/getAllowTrackback; 117 tbcount python:len(obj.getTrackbacks()); 118 fp nocall:fp | python:here.simpleblog_tool.getFrontPage(here)"> 101 119 <span i18n:translate="blog_by_line"> 102 120 <span tal:define="edate python:obj.simpleblog_tool.getEntryDate(obj)" … … 111 129 <strong><a href="#" 112 130 tal:define="quotedCat python:pss.url_quote(cat)" 113 tal:attributes="href string:${ here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}"131 tal:attributes="href string:${fp/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}" 114 132 title="category"><span tal:omit-tag="" tal:content="cat"/></a></strong> 115 133 </tal:categories> … … 128 146 <div tal:condition="tballowed"> trackback URL: 129 147 <tal:x replace="string:${obj/absolute_url}/sbtrackback"/> 148 </div> 149 <div tal:define="entryURL obj/absolute_url; 150 entryTitle obj/Title; 151 entryDescription obj/Description; 152 entryDiggTopic obj/getDiggTopic; 153 encodeURLData python:modules['Products.SimpleBlog.util'].encodeURLData;" 154 tal:omit-tag=""> 155 <span tal:condition="isDeliciousEnaled | obj/isDeliciousEnabled"> 156 <a href="" 157 title="" 158 tal:define="url_data python:encodeURLData({'url':entryURL,'title':entryTitle});" 159 tal:attributes="href string:http://del.icio.us/post?${url_data}; 160 title string:del.icio.us: ${entryTitle}"> 161 <img src="" 162 alt="del.icio.us" 163 tal:attributes="src string:$portal_url/delicious.gif;" /></a> 164 </span> <span tal:condition="isDiggEnabled | obj/isDiggEnabled"> 165 <a href="" 166 title="" 167 tal:define="url_data python:encodeURLData({'phase':'2','url':entryURL,'title':entryTitle,'bodytext':entryDescription,'topic':entryDiggTopic});" 168 tal:attributes="href string:http://digg.com/submit?${url_data}; 169 title string:Digg: ${entryTitle}"> 170 <img src="" 171 alt="Digg" 172 tal:attributes="src string:$portal_url/digg.gif;" /></a> 173 </span> <span tal:condition="isYahooEnabled | obj/isYahooEnabled"> 174 <a href="" 175 title="" 176 tal:define="url_data python:encodeURLData({'u':entryURL,'t':entryTitle});" 177 tal:attributes="href string:http://myweb2.search.yahoo.com/myresults/bookmarklet?${url_data}; 178 title string:Yahoo: ${entryTitle}"> 179 <img src="" 180 alt="Yahoo" 181 tal:attributes="src string:$portal_url/yahoo.gif;" /></a> 182 </span> <span tal:condition="isGoogleEnabled | obj/isGoogleEnabled"> 183 <a href="" 184 title="" 185 tal:define="url_data python:encodeURLData({'op':'edit','output':'popup','bkmk':entryURL,'title':entryTitle});" 186 tal:attributes="href string:http://www.google.com/bookmarks/mark?${url_data}; 187 title string:Google: ${entryTitle}"> 188 <img src="" 189 alt="Google" 190 tal:attributes="src string:$portal_url/google.gif;" /></a> 191 </span> <span tal:condition="isSpurlEnabled | obj/isSpurlEnabled"> 192 <a href="" 193 title="" 194 tal:define="url_data python:encodeURLData({'url':entryURL,'title':entryTitle});" 195 tal:attributes="href string:http://www.spurl.net/spurl.php?${url_data}; 196 title string:Spurl: ${entryTitle}"> 197 <img src="" 198 alt="Spurl" 199 tal:attributes="src string:$portal_url/spurl.gif;" /></a> 200 </span> 130 201 </div> 131 202 … … 205 276 <tal:cats tal:repeat="cat python:here.simpleblog_tool.getSortedKeys(cats)"> 206 277 <dd tal:define="pss modules/Products.PythonScripts.standard; 278 fp nocall:fp | python:here.simpleblog_tool.getFrontPage(here); 207 279 quotedCat python:pss.url_quote(cat); 208 280 category python:'%s (%s)' %(cat,cats[cat])" 281 tal:condition="python:cats[cat]>0" 209 282 tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 210 <a tal:condition="python:cats[cat]>0" href="#" 211 tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}; 212 title cat"><span tal:content="category"/></a> 213 <span tal:condition="python:cats[cat]==0" tal:content="category"/> 283 <a href="#" 284 tal:attributes="href string:${fp/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}; 285 title cat"><span tal:content="category"/></a> 214 286 <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 215 287 </dd> SimpleBlog/branches/plone-2.1-Blogging-APIs/util.py
r554 r555 61 61 blog_name = blog_name, 62 62 excerpt = excerpt) 63 64 def encodeURLData(data_dict): 65 """ encode URL data """ 66 return urllib.urlencode(data_dict)
