Changeset 556

Show
Ignore:
Timestamp:
09/29/06 12:02:22
Author:
mylan
Message:

Update to rev. [555] (svn merge -r 191:555 http://svn.quintagroup.com/products/SimpleBlog/branches/plone-2.1-Blogging-APIs)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • SimpleBlog/trunk/Blog.py

    r555 r556  
    66import Permissions 
    77from Products.CMFCore.utils import getToolByName 
     8 
     9import MetaWeblogAPI 
     10import BloggerAPI 
     11import MovableTypeAPI 
     12 
    813 
    914schema = BaseFolderSchema +  Schema(( 
     
    8489                                       description_msgid="help_allow_trackback",), 
    8590               ), 
     91    # used to be new trackbaks notification email address 
    8692    StringField('adminEmail', 
    8793                accessor = 'getAdminEmail', 
     
    9399                                    description_msgid="help_adminEmail", 
    94100                                    i18n_domain="SimpleBlog", 
    95                                                     condition="python:0", 
     101                                                    condition="python:0", # this line have to be removed in order to be visible/editable 
    96102                                    description="Enter administrator's email for receaving notification about blog's activity"), 
    97                ) 
     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                ), 
    98144    #BooleanField('allowComments', 
    99145    #              default = 1, 
     
    122168    global_allow=1 
    123169    schema=schema 
     170 
     171    blogger = None 
     172    metaWeblog = None 
    124173     
    125174    content_icon='simpleblog_icon.gif' 
     
    140189          'visible':0}) 
    141190 
     191    def initializeArchetype(self, **kwargs): 
     192        BaseFolder.initializeArchetype(self, **kwargs) 
     193        RPCAuth = self.simpleblog_tool.findRPCAuth(self) 
     194 
     195        # Setup the MetaWeblog API 
     196        self.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) 
     197        self.metaWeblog.setupRPCAuth(RPCAuth) 
     198         
     199        # Setup the Blogger API 
     200        self.blogger = BloggerAPI.BloggerAPI().__of__(self) 
     201        self.blogger.setupRPCAuth(RPCAuth) 
     202 
     203        # Setup the MovableTypeAPI API 
     204        self.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) 
     205        self.mt.setupRPCAuth(RPCAuth)     
     206 
    142207    def manage_afterAdd(self, item, container): 
    143208        BaseFolder.manage_afterAdd(self, item, container) 
     
    170235        return val 
    171236 
     237    def listCategories(self): 
     238        cats=self.getCategories() 
     239            
     240        # add the global categories 
     241        for c in self.simpleblog_tool.getGlobalCategories(): 
     242            if not c in cats: 
     243                cats.append(c)            
     244        cats = list(cats) 
     245        cats.sort() 
     246        return tuple(cats)                 
     247 
    172248registerType(Blog) 
    173249 
  • SimpleBlog/trunk/BlogEntry.py

    r555 r556  
    1616import sys 
    1717from util import * 
     18from config import DIGG_TOPICS 
    1819 
    1920schema  =  BaseFolderSchema +  Schema(( 
     
    9798                           i18n_domain = "SimpleBlog", 
    9899                           description = 'Controls if the Entry (when published) shown as the first Entry. If not checked, the effective date is used.')), 
    99  
    100100    LinesField('sendTrackBackURLs', 
    101101               languageIndependent = True, 
     
    107107                                  i18n_domain = "plone")), 
    108108 
    109  
     109    BooleanField('enableTopAdsence', 
     110                 widget = BooleanWidget(format = 'select',  
     111                           label_msgid = "label_enable_top_adsence", 
     112                           description_msgid = "help_enable_top_adsence", 
     113                           i18n_domain = "SimpleBlog", 
     114                           label = 'Enable top Adsence block', 
     115                           description = None)), 
     116    StringField('topAdsence', 
     117                vocabulary = 'listAdesnceTemplates', 
     118                widget = SelectionWidget(format = 'select',  
     119                        label_msgid = "label_top_adsence", 
     120                        description_msgid = "help_top_adsence", 
     121                        i18n_domain = "SimpleBlog", 
     122                        label = 'Top Adsence', 
     123                        description = None)), 
     124    BooleanField('enableBottomAdsence', 
     125                 widget = BooleanWidget(format = 'select',  
     126                           label_msgid = "label_enable_bottom_adsence", 
     127                           description_msgid = "help_enable_bottom_adsence", 
     128                           i18n_domain = "SimpleBlog", 
     129                           label = 'Enable bottom Adsence block', 
     130                           description = None)), 
     131    StringField('bottomAdsence', 
     132                vocabulary = 'listAdesnceTemplates', 
     133                widget = SelectionWidget(format = 'select',  
     134                        label_msgid = "label_bottom_adsence", 
     135                        description_msgid = "help_bottom_adsence", 
     136                        i18n_domain = "SimpleBlog", 
     137                        label = 'Bottom Adsence', 
     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.')), 
    110147    )) 
    111148 
     
    251288        parent = self.aq_parent 
    252289        portal = self.portal_url.getPortalObject() 
    253          
    254290        while parent != portal: 
    255291           if parent.portal_type == 'Blog': 
     
    259295        return tuple(tags) 
    260296 
     297    def listAdesnceTemplates(self): 
     298        """ return list of available adsence blocks """ 
     299        pp = getToolByName(self, 'portal_properties') 
     300        templates = () 
     301        try: 
     302            templates = pp.simpleblog_properties.getProperty('adsence_templates',()) 
     303        except: 
     304            pass 
     305        return templates 
     306 
    261307registerType(BlogEntry) 
  • SimpleBlog/trunk/Extensions/Install.py

    r555 r556  
    66 
    77from Products.SimpleBlog.config import * 
     8 
     9from Products.SimpleBlog import MetaWeblogAPI 
     10from Products.SimpleBlog import BloggerAPI 
     11from Products.SimpleBlog import MovableTypeAPI 
    812 
    913portlets=['here/portlet_simpleblog/macros/portletBlogFull_local',  
     
    3741        site_props._updateProperty('use_folder_tabs', tuple(use_folder_tabs) + ('Blog','BlogFolder','BlogEntry')) 
    3842     
     43    if not portal.hasProperty('trackback_notification_email'): 
     44        portal.manage_addProperty('trackback_notification_email', '', 'string') 
     45     
    3946    # check for property use_folder_contents. This property seems not to be always there: 
    4047    if not site_props.hasProperty('use_folder_contents'): 
    4148        site_props.manage_addProperty('use_folder_contents', '', 'lines') 
    42          
     49 
    4350    use_folder_contents = site_props.getProperty('use_folder_contents') 
    4451    if not 'Blog' in use_folder_contents: 
    4552        site_props._updateProperty('use_folder_contents', tuple(use_folder_contents) + ('Blog','BlogFolder', 'BlogEntry')) 
    46          
     53  
    4754    # discussion enabled by default for BlogEntries 
    4855    getToolByName(self, 'portal_types').BlogEntry.allow_discussion=1 
     
    7077     
    7178    add_workflow(self, 'simpleblog_workflow', 'simpleblog_workflow (Workflow for Blog Entries)', ('BlogEntry',), out) 
    72     wf_tool.setChainForPortalTypes(('Blog','BlogFolder'), 'folder_workflow')         
     79    wf_tool.setChainForPortalTypes(('Blog','BlogFolder'), 'folder_workflow') 
    7380 
    7481    from Products.SimpleBlog import TrackbackWorkflow 
     
    7784    add_workflow(self, 'trackback_workflow', 'trackback_workflow (TrackBack Workflow)', ('TrackBack',), out) 
    7885    wf_tool.setChainForPortalTypes( ('TrackBack'), 'trackback_workflow')  
    79          
     86 
     87    # Create an RPCAuth if there is not one already 
     88    installRPCAuth(self)     
     89    RPCAuth = self.simpleblog_tool.findRPCAuth(self) 
     90     
     91    # add the blogger object to the portal's root 
     92    # Setup the MetaWeblog API 
     93    portal.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) 
     94    portal.metaWeblog.setupRPCAuth(RPCAuth) 
     95     
     96    # Setup the Blogger API 
     97    portal.blogger = BloggerAPI.BloggerAPI().__of__(self) 
     98    portal.blogger.setupRPCAuth(RPCAuth)     
     99     
     100    # Setup the MovableTypeAPI API 
     101    portal.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) 
     102    portal.mt.setupRPCAuth(RPCAuth)     
     103     
    80104    print >> out, "Successfully installed %s." % PROJECTNAME 
    81105    return out.getvalue() 
     
    93117        wf_tool.setChainForPortalTypes(types, wf_id) 
    94118    out.write('Added workflow "%s"\n'%wf_id) 
     119 
     120def installRPCAuth(self): 
     121    if not hasattr(self, 'RPCAuth'): 
     122        try: 
     123            self.manage_addProduct['RPCAuth'].manage_addRPCAuth('RPCAuth') 
     124        except: 
     125            raise "An RPCAuth instance could not be created.  Please make sure RPCAuth is installed correctly." 
    95126 
    96127 
  • SimpleBlog/trunk/Extensions/utils.py

    r555 r556  
    2929            pass 
    3030 
     31 
     32from Products.SimpleBlog import MetaWeblogAPI 
     33from Products.SimpleBlog import BloggerAPI 
     34from Products.SimpleBlog import MovableTypeAPI 
     35 
     36def migrateToAPIs(self): 
     37    """ migrate existing SimpleBlog instance to support BloggingAPIs """ 
     38    RPCAuth = self.simpleblog_tool.findRPCAuth(self) 
     39    # Setup the MetaWeblog API 
     40    self.metaWeblog = MetaWeblogAPI.MetaWeblogAPI().__of__(self) 
     41    self.metaWeblog.setupRPCAuth(RPCAuth) 
     42    # Setup the Blogger API 
     43    self.blogger = BloggerAPI.BloggerAPI().__of__(self) 
     44    self.blogger.setupRPCAuth(RPCAuth) 
     45    # Setup the MovableTypeAPI API 
     46    self.mt = MovableTypeAPI.MovableTypeAPI().__of__(self) 
     47    self.mt.setupRPCAuth(RPCAuth)     
  • SimpleBlog/trunk/SimpleBlogTool.py

    r555 r556  
    66from Products.CMFCore import CMFCorePermissions 
    77import zLOG,os 
    8  
     8from Products.CMFCore.utils import getToolByName 
     9import re 
    910import calendar 
    1011calendar.setfirstweekday(6) #start day  Mon(0)-Sun(6) 
     
    3233        self.manage_addProperty('showIcons', 1,'boolean') 
    3334 
     35    security.declarePublic('getByUID') 
     36    def getByUID(self, uid): 
     37        "Shortcut method for the [Blogger,MetaWeblog]API code" 
     38 
     39        uid_catalog = getToolByName(self, 'uid_catalog') 
     40        lazy_cat = uid_catalog(UID=uid) 
     41        o = lazy_cat[0].getObject() 
     42        return o 
     43 
     44    security.declarePublic('findRPCAuth') 
     45    def findRPCAuth(self, parent): 
     46        while hasattr(parent,'aq_parent'): 
     47            RPCAuths = parent.objectValues('RPC Auth') 
     48            for RPCAuth in RPCAuths: 
     49                return RPCAuth 
     50            parent = parent.aq_parent 
     51        return None     
     52     
     53    security.declarePublic('idFromTitle') 
     54    def idFromTitle(self, title): 
     55        id = re.sub('[^A-Za-z0-9_]', '', re.sub(' ', '_', title)).lower() 
     56        return id         
    3457 
    3558    def _getState(self): 
  • SimpleBlog/trunk/TrackbackWorkflow.py

    r555 r556  
    117117    tdef = wf.transitions['retract'] 
    118118    tdef.setProperties(title="""Member retracts published item""", 
    119                        new_state_id="""draft""", 
     119                       new_state_id="""pending""", 
    120120                       trigger_type=1, 
    121121                       script_name="""""", 
  • SimpleBlog/trunk/__init__.py

    r555 r556  
    1010from Globals import InitializeClass 
    1111 
     12import xmlrpcMonkeyPatch 
    1213 
    1314registerDirectory(SKINS_DIR, GLOBALS) 
     
    1819    from AccessControl import ModuleSecurityInfo, allow_module 
    1920    ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('addTrackBack') 
     21    ModuleSecurityInfo('Products.SimpleBlog.util').declarePublic('encodeURLData') 
    2022 
    2123    #allow_module('Products.SimpleBlog.Extensions.utils') 
  • SimpleBlog/trunk/config.py

    r555 r556  
    1111    ('descriptionOnly', 'Description only', 'display_description_only'),  
    1212    ('titleOnly', 'Title only', 'display_title_only') )) 
     13 
     14DIGG_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/trunk/skins/SimpleBlog/SimpleBlog_macros.pt

    r555 r556  
    44<body> 
    55 
     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 
    618<div metal:define-macro="full" tal:define="showReadMore python:0" class="simpleBlogEntry"> 
     19    <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 
    720    <div tal:define="size headerSize | python:1;title obj/title_or_id; 
    8                          showIcons obj/simpleblog_tool/getShowIcons"  
     21                    showIcons fp/simpleblog_tool/getShowIcons"  
    922             class="simpleBlogTitle"> 
    1023                <tal:x replace='structure string:<h${size} class="noMargin">'/> 
     
    2538 
    2639<div metal:define-macro="descriptionOnly"  tal:define="showReadMore python:1" class="simpleBlogEntry"> 
     40    <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 
    2741    <div tal:define="size headerSize | python:1;title obj/title_or_id; 
    28                          showIcons obj/simpleblog_tool/getShowIcons"  
     42                    showIcons fp/simpleblog_tool/getShowIcons"  
    2943             class="simpleBlogTitle"> 
    3044                <tal:x replace='structure string:<h${size} class="noMargin">'/> 
     
    4458 
    4559<div metal:define-macro="titleOnly" tal:define="showReadMore python:1" class="simpleBlogTitle"> 
     60    <div metal:use-macro="obj/SimpleBlog_macros/macros/blogGlobals"/> 
    4661    <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"> 
    4863                <tal:x replace='structure string:<h${size} class="noMargin">'/> 
    4964            <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;"> 
     
    5873</div> 
    5974 
    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);"> 
    6177     <span i18n:translate="blog_by_line"> 
    6278    Submitted by  
     
    7187                <strong><a href="#"  
    7288                           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}" 
    7490                           title="category"><span  tal:omit-tag="" tal:content="cat"/></a></strong> 
    7591           </tal:categories> 
     
    7995 
    8096<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" 
    83100     tal:omit-tag=""> 
    84101     _____<br/> 
     
    97114    <tal:x define="allowed python:obj.portal_discussion.isDiscussionAllowedFor(obj); 
    98115                   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)"> 
    101119         <span i18n:translate="blog_by_line"> 
    102120         <span tal:define="edate python:obj.simpleblog_tool.getEntryDate(obj)" 
     
    111129                    <strong><a href="#"  
    112130                               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}" 
    114132                               title="category"><span  tal:omit-tag="" tal:content="cat"/></a></strong> 
    115133               </tal:categories> 
     
    128146         <div tal:condition="tballowed"> trackback URL: &nbsp; 
    129147               <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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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> 
    130201         </div> 
    131202 
     
    195266 
    196267<!-- macro used by the portlets to compile a list of available categories --> 
    197 <div metal:define-macro="portletCategories" tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here)" tal:omit-tag=""> 
     268<div metal:define-macro="portletCategories"  
     269     tal:define="cats python:here.simpleblog_tool.getAvailableCategories(here)"  
     270     tal:omit-tag=""> 
    198271    <tal:toggle tal:define="global toggle python:toggle or 0"/> 
     272    <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 
     273        <strong i18n:translate="blog_categories">Categories:</strong> 
     274        <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     275    </dd> 
    199276    <tal:cats tal:repeat="cat python:here.simpleblog_tool.getSortedKeys(cats)"> 
    200         <div tal:define="oddrow repeat/cat/odd" tal:condition="repeat/cat/start" tal:attributes="class python:test(toggle, 'portletContent content odd','portletContent content even')"> 
    201             <strong i18n:translate="blog_categories">Categories:</strong> 
    202         </div> 
    203         <div tal:define="oddrow repeat/cat/odd; 
    204                          pss modules/Products.PythonScripts.standard; 
    205                          quotedCat python:pss.url_quote(cat)" 
    206             tal:attributes="class python:test(toggle, 'portletContent content even','portletContent content odd')"> 
    207             <a tal:condition="python:cats[cat]>0"  href="#"  
    208                            tal:attributes="href string:${here/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}; 
    209                                            title cat"  
    210                            title="category"><span tal:content="cat"/></a> 
    211                         <span tal:condition="python:cats[cat]==0" tal:content="cat"/>  
    212                         (<span tal:content="python:cats[cat]"/>) 
    213         </div> 
    214         <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     277        <dd tal:define="pss modules/Products.PythonScripts.standard; 
     278                        fp nocall:fp | python:here.simpleblog_tool.getFrontPage(here); 
     279                        quotedCat python:pss.url_quote(cat); 
     280                        category python:'%s (%s)' %(cat,cats[cat])" 
     281            tal:condition="python:cats[cat]>0" 
     282            tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 
     283            <a href="#"  
     284               tal:attributes="href string:${fp/absolute_url}/SimpleBlogCatSearch?category=${quotedCat}; 
     285                               title cat"><span tal:content="category"/></a> 
     286            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     287        </dd> 
    215288    </tal:cats> 
    216289</div> 
    217290 
    218291<!-- macro used by the portlets to compile a list of recent additions --> 
    219 <div metal:define-macro="portletRecent" tal:define="recent python:here.simpleblog_tool.searchForEntries(here)"> 
    220     <tal:toggle tal:define="global toggle python:0"/> 
     292<div metal:define-macro="portletRecent"  
     293     tal:define="recent python:here.simpleblog_tool.searchForEntries(here)" 
     294     tal:omit-tag=""> 
     295     <tal:toggle tal:define="global toggle python:toggle or 0"/> 
     296     <tal:block tal:condition="recent"> 
     297        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 
     298            <strong i18n:translate="recent_additions">Recent entries:</strong> 
     299            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     300        </dd> 
    221301        <tal:entries tal:repeat="entry recent"> 
    222         <div tal:define="oddrow repeat/entry/odd"  
    223                      tal:condition="repeat/entry/start"  
    224                      tal:attributes="class python:test(toggle, 'portletContent content odd','portletContent content even')"> 
    225                       
    226                       
    227             <tal:frontpage tal:define="fp python:here.simpleblog_tool.getFrontPage(here)"> 
    228                 <a tal:condition="python:fp!=None" href="#" tal:attributes="href fp/absolute_url;title fp/title_or_id" title=""><strong><span tal:replace="fp/title_or_id"/>:</strong></a> 
    229                 <strong tal:condition="python:fp==None" i18n:translate="recent_additions">Recent additions:</strong> 
    230             </tal:frontpage> 
    231         </div> 
    232         <div tal:define="oddrow repeat/entry/odd"  
    233                  tal:attributes="class python:test(toggle, 'portletContent content even','portletContent content odd')"> 
     302        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')"> 
    234303            <a href="#"  
    235304                           tal:attributes="href entry/getURL;"  
     
    238307                           <span tal:content="python:entry.Title or entry.getId"/> 
    239308                        </a> 
    240         </div> 
    241         <div tal:define="oddrow repeat/entry/odd"  
    242                      tal:condition="repeat/entry/end"  
    243                      tal:attributes="class python:test(toggle, 'portletMore portletContent content odd','portletMore portletContent content even')"> 
    244             <a href="#" tal:attributes="href string:${here/absolute_url}/SimpleBlogFullSearch"  
    245                            title="more..." 
    246                            i18n:attributes="title box_morelink" 
    247                            i18n:translate="box_morelink" 
    248                            i18n:domain="plone">More...</a> 
    249         </div> 
     309            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     310        </dd> 
     311        </tal:entries> 
     312        <dd tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')" 
     313            style="text-align:right;"> 
     314            <a title="More..." 
     315               tal:attributes="href string:${here/absolute_url}/SimpleBlogFullSearch"  
     316               i18n:attributes="title box_morelink" 
     317               i18n:translate="box_morelink" 
     318               i18n:domain="plone">More...</a> 
     319            <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
     320        </dd> 
     321    </tal:block> 
     322    <dd tal:condition="not: recent" 
     323        tal:attributes="class python:test(toggle, 'portletItem even', 'portletItem odd')">         
     324        <span i18n:translate="no_published_blog_entries">No blog entries are published.</span> 
    250325        <tal:toggle tal:define="global toggle python:test(toggle==1,0,1)"/> 
    251     </tal:entries> 
    252     <div class="portletContent content even" tal:condition="not: recent"> 
    253                 <strong i18n:translate="recent_additions">Recent additions:</strong> 
    254     </div> 
    255     <div class="portletContent content odd" tal:condition="not: recent"> 
    256         <span i18n:translate="no_published_blog_entries">No blog entries are published.</span> 
    257         <tal:toggle tal:define="global toggle python:0"/> 
    258     </div> 
     326    </dd> 
    259327</div> 
    260328 
     
    263331     tal:define="DateTime python:modules['DateTime'].DateTime; 
    264332                 current python:DateTime(); 
    265                  month python:request.get('month', DateTime().month()); 
    266                  year python:request.get('year', DateTime().year()); 
     333                 anchor_url request/anchor_url | here_url; 
     334                 anchor_method request/anchor_method | template/getId; 
     335                 yearmonth here/getYearAndMonthToDisplay; 
     336                 nextYearMax python: current+365; 
     337                 prevYearMin python: current-365; 
     338                 year python:yearmonth[0]; 
     339                 month python:yearmonth[1]; 
    267340                 prevMonthTime python:here.getPreviousMonth(month, year); 
    268341                 nextMonthTime python:here.getNextMonth(month, year); 
    269342                 weeks python:here.simpleblog_tool.getEventsForCalendar(month=month, year=year, context=here); 
    270                  anchor_url request/anchor_url | here_url; 
    271                  anchor_method request/anchor_method | template/getId; 
     343                 translation_service nocall:here/translation_service; 
     344                 day_msgid nocall:translation_service/day_msgid; 
     345                 weekday_english nocall:translation_service/weekday_english; 
     346                 utranslate nocall:here/utranslate; 
     347                 toLocalizedTime nocall:here/toLocalizedTime; 
    272348                 published_state python:here.simpleblog_tool.getPublishedState()" 
    273349    i18n:domain="plone"> 
     
    278354            <tr> 
    279355                <th id="calendar-previous"> 
    280                     <a href="#" tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, prevMonthTime.month(),prevMonthTime.year())">&laquo;</a> 
     356                    <a href="#" rel="nofollow" 
     357                       title="Previous month" 
     358                       tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, prevMonthTime.month(),prevMonthTime.year())" 
     359                       tal:condition="python: yearmonth > (prevYearMin.year(), prevYearMin.month())" 
     360                       i18n:attributes="title title_previous_month;">&laquo;</a> 
    281361                </th> 
    282                 <th colspan="5" 
    283                     tal:define="date string:$month/1/$year;"> 
     362                <th colspan="5"> 
    284363                    <span i18n:translate="" tal:omit-tag=""> 
    285                         <span i18n:name="monthname"> 
    286                             <span i18n:translate="" 
    287                                   tal:define="monthstring python:DateTime(date).strftime('%B').capitalize();" 
    288                                   tal:attributes="id string:calendar-month-$monthstring" 
    289                                   tal:content="string:$monthstring" 
    290                                   id="calendar-month-month">&nbsp;</span> 
    291                         </span> 
     364                        <span i18n:name="monthname" 
     365                              tal:define="month_english python:translation_service.month_english(month);" 
     366                              tal:attributes="id string:calendar-month-$month_english" 
     367                              tal:content="python: utranslate(translation_service.month_msgid(month), default=month_english)" 
     368                              tal:omit-tag="" 
     369                              id="calendar-month-month">monthname</span> 
    292370                        <span i18n:name="year" 
    293                               tal:define="year python:DateTime(date).year()" 
    294371                              tal:content="string:$year" 
    295372                              tal:attributes="id string:calendar-year-$year;" 
    296                               id="calendar-year">&nbsp;</span> 
     373                              tal:omit-tag="" 
     374                              id="calendar-year">year</span> 
    297375                    </span> 
    298                  </th> 
    299                 <th id="calendar-next" tal:on-error="string:"> 
    300                     <a href="#" tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, nextMonthTime.month(),nextMonthTime.year())">&raquo;</a> 
     376                </th> 
     377                <th id="calendar-next"> 
     378                    <a href="#" rel="nofollow" 
     379                       title="Next month" 
     380                       tal:attributes="href python:'%s/%s?month:int=%d&amp;year:int=%d' % (anchor_url, anchor_method, nextMonthTime.month(),nextMonthTime.year())" 
     381                       tal:condition="python: yearmonth &lt; (nextYearMax.year(), nextYearMax.month())" 
     382                       i18n:attributes="title title_next_month;">&raquo;</a> 
    301383                </th> 
    302384            </tr> 
    303             <tr tal:define="weekdays here/portal_calendar/getDays" class="weekdays"> 
    304                 <tal:block repeat="weekday weekdays"> 
    305                 <td i18n:translate="" tal:content="weekday">Su</td> 
    306                </tal:block> 
     385            <tr tal:define="weekdaynumbers here/portal_calendar/getDayNumbers" class="weekdays"> 
     386                <tal:data tal:repeat="daynumber weekdaynumbers"> 
     387                    <td tal:define="weekday_english python:weekday_english(daynumber,format='a');" 
     388                        tal:content="python: utranslate(day_msgid(daynumber, format='s'), default=weekday_english)">Su</td> 
     389                </tal:data> 
    307390            </tr> 
    308391        </thead> 
  • SimpleBlog/trunk/skins/SimpleBlog/blogentry_view.pt

    r555 r556  
    1515        <tal:block tal:define="obj python:here"> 
    1616 
    17                  
    18                <div metal:define-macro="full" tal:define="showReadMore python:0"> 
    19                  
    20                        </