Changeset 583

Show
Ignore:
Timestamp:
10/19/06 09:35:41
Author:
chervol
Message:

blog tool merged APIs added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • SimpleBlog/branches/plone-2.5/SimpleBlogTool.py

    r582 r583  
    3131        self.manage_addProperty('createPortletOnBlogCreation', 1,'boolean') 
    3232 
     33    security.declarePublic('getByUID') 
     34    def getByUID(self, uid): 
     35        "Shortcut method for the [Blogger,MetaWeblog]API code" 
     36 
     37        uid_catalog = getToolByName(self, 'uid_catalog') 
     38        lazy_cat = uid_catalog(UID=uid) 
     39        o = lazy_cat[0].getObject() 
     40        return o 
     41 
     42    security.declarePublic('findRPCAuth') 
     43    def findRPCAuth(self, parent): 
     44        while hasattr(parent,'aq_parent'): 
     45            RPCAuths = parent.objectValues('RPC Auth') 
     46            for RPCAuth in RPCAuths: 
     47                return RPCAuth 
     48            parent = parent.aq_parent 
     49        return None 
     50 
    3351 
    3452    security.declarePublic('idFromTitle') 
    3553    def idFromTitle(self, title): 
    3654        id = re.sub('[^A-Za-z0-9_]', '', re.sub(' ', '_', title)).lower() 
    37         return id         
    38      
     55        return id 
     56 
    3957    def _getState(self): 
    4058        try: 
  • SimpleBlog/branches/plone-2.5/skins/SimpleBlog/SimpleBlog_macros.pt

    r582 r583  
    55 
    66<div metal:define-macro="full" class="simpleBlogFull"> 
    7  
    8     <h2 class="noMargin" tal:define="item_type obj/portal_type; 
    9                                                                     item_type_class python:'contenttype-' + normalizeString(item_type);"> 
     7    <h2 class="noMargin"  
     8        tal:define="item_type obj/portal_type; 
     9                    item_type_class python:'contenttype-' + normalizeString(item_type);"> 
    1010        <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;"> 
    1111            <span tal:attributes="class string:simpleBlogIcons ${item_type_class}" tal:content="obj/title"/> 
    1212        </a> 
    1313    </h2> 
    14                   
    1514    <tal:byline metal:use-macro="obj/simpleblog_byline/macros/byline"/> 
    16         <p class="simpleBlogDescription" 
    17            tal:content="structure python:obj.Description()" 
    18            tal:condition="obj/Description"> 
    19                 Description 
    20         </p> 
    21  
     15    <p class="simpleBlogDescription" 
     16       tal:content="structure python:obj.Description()" 
     17       tal:condition="obj/Description">Description</p> 
    2218    <div tal:replace="structure python:obj.getBody()" class="simpleBlogBody"/> 
    2319</div> 
    2420 
    2521<div metal:define-macro="descriptionOnly" class="simpleBlogDescriptionOnly"> 
    26     <h2 class="noMargin" tal:define="item_type obj/portal_type; 
    27                                                                      item_type_class python:'contenttype-' + normalizeString(item_type);"> 
     22    <h2 class="noMargin"  
     23        tal:define="item_type obj/portal_type; 
     24                    item_type_class python:'contenttype-' + normalizeString(item_type);"> 
    2825        <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;"> 
    29                        <span tal:attributes="class string:simpleBlogIcons ${item_type_class}" tal:content="obj/title"/> 
     26           <span tal:attributes="class string:simpleBlogIcons ${item_type_class}" tal:content="obj/title"/> 
    3027        </a> 
    3128    </h2> 
    3229    <tal:byline metal:use-macro="obj/simpleblog_byline/macros/byline"/> 
    33         <p class="simpleBlogDescription" 
    34            tal:content="structure python:obj.Description()" 
    35            tal:condition="obj/Description"> 
    36                 Description 
    37         </p> 
     30    <p class="simpleBlogDescription" 
     31       tal:content="structure python:obj.Description()" 
     32       tal:condition="obj/Description">Description</p> 
    3833</div> 
    3934 
    4035<div metal:define-macro="titleOnly" class="simpleBlogTitleOnly"> 
    41     <h2 class="noMargin" tal:define="item_type obj/portal_type; 
    42                                                                      item_type_class python:'contenttype-' + normalizeString(item_type);"> 
     36    <h2 class="noMargin"  
     37        tal:define="item_type obj/portal_type; 
     38                    item_type_class python:'contenttype-' + normalizeString(item_type);"> 
    4339        <a href="" tal:attributes="href obj/absolute_url" style="cursor:pointer;"> 
    44                        <span tal:attributes="class string:simpleBlogIcons ${item_type_class}" tal:content="obj/title"/> 
     40           <span tal:attributes="class string:simpleBlogIcons ${item_type_class}" tal:content="obj/title"/> 
    4541        </a> 
    4642    </h2> 
  • SimpleBlog/branches/plone-2.5/skins/SimpleBlog/blogentry_view.pt

    r582 r583  
    33      metal:use-macro="here/main_template/macros/master" 
    44      i18n:domain="SimpleBlog"> 
    5  
    65<body> 
    76<div metal:fill-slot="main"> 
    87    <tal:main-macro metal:define-macro="main"> 
    98        <tal:block tal:define="obj python:here"> 
    10  
    11                  
    12                 <div metal:define-macro="full" tal:define="showReadMore python:0"> 
    13  
    14                         <div metal:use-macro="here/document_actions/macros/document_actions"> 
    15                                 Document actions (print, sendto etc) 
    16                         </div> 
    17          
    18                         <h1 tal:content="object_title" class="documentFirstHeading"> 
    19                           Title or id 
    20                         </h1> 
    21                          
    22                         <tal:byline metal:use-macro="obj/simpleblog_byline/macros/byline-long"/> 
    23  
    24                         <p class="documentDescription" 
    25                            tal:content="structure here/Description" 
    26                            tal:condition="here/Description"> 
    27                                 Description 
    28                         </p> 
    29  
    30                         <div tal:replace="structure python:obj.getBody()" /> 
    31                          
    32                         <tal:foreign tal:define="crossPosts here/getCrossPosts|nothing" tal:condition="crossPosts"> 
    33                             <h3> 
    34                                         This entry is cross-posted in the following blogs: 
    35                                 </h3> 
    36                                 <p> 
    37                                 <tal:block tal:repeat="blog crossPosts"> 
    38                                     <img src="simpleblog_icon.gif" /> 
    39                                     <a href="" 
    40                                            tal:attributes="href blog/absolute_url; 
    41                                                                title blog/Title;" 
    42                                            tal:content="blog/Title" /> 
    43                                     <br /> 
    44                                 </tal:block> 
    45                                 </p> 
    46                         </tal:foreign> 
    47                 </div> 
    48  
     9        <div metal:define-macro="full" tal:define="showReadMore python:0"> 
     10            <div metal:use-macro="here/document_actions/macros/document_actions"> 
     11                Document actions (print, sendto etc) 
     12            </div> 
     13            <h1 tal:content="object_title" class="documentFirstHeading"> 
     14              Title or id 
     15            </h1> 
     16            <tal:byline metal:use-macro="obj/simpleblog_byline/macros/byline-long"/> 
     17            <p class="documentDescription" 
     18               tal:content="structure here/Description" 
     19               tal:condition="here/Description"> 
     20                Description 
     21            </p> 
     22            <div tal:replace="structure python:obj.getBody()" /> 
     23        </div> 
    4924        </tal:block> 
    50  
    51     </tal:main-macro>             
     25    </tal:main-macro> 
    5226</div> 
    53  
    5427</body> 
    55  
    5628</html> 
  • SimpleBlog/branches/plone-2.5/skins/SimpleBlog/blogfolder_view.pt

    r582 r583  
    66 
    77<body> 
    8  
    98<div metal:fill-slot="main"> 
    109    <tal:main-macro metal:define-macro="main"> 
    11                      
    1210        <h1  class="documentFirstHeading"> 
    1311            <img  id="pagetype_icon" src="#" tal:attributes="src string:${here/portal_url}/${here/getIcon};alt here/title" /> 
    1412            <span tal:replace="here/title_or_id"/> 
    1513        </h1> 
    16  
    1714        <p>This template is no longer used. Please reinstall SimpleBlog to make use of the new display mechanism or ask 
    1815           your administrator to do so. 
  • SimpleBlog/branches/plone-2.5/skins/SimpleBlog/simpleblog_view.pt

    r582 r583  
    33      metal:use-macro="here/main_template/macros/master" 
    44      i18n:domain="SimpleBlog"> 
    5  
    6  
    75<body> 
    86<div metal:fill-slot="main"> 
    97    <tal:main-macro metal:define-macro="main" 
    108      tal:define="displayItems python:here.getDisplayItems(); 
    11                         warnForUnpublishedEntries python:here.getWarnForUnpublishedEntries();  
    12                         displayMode displayMode | python:here.getDisplayMode();                         
    13                         results python:here.getEntries(maxResults=0, sort=1, join=1, addCrossPostInfo=1); 
    14                         b_size python:displayItems; 
    15                         b_start python:0; 
    16                         b_start request/b_start | b_start; 
    17                         Batch python:modules['Products.CMFPlone'].Batch;"> 
    18                                                  
     9                  displayMode displayMode | python:here.getDisplayMode(); 
     10                  results python:here.getEntries(maxResults=0, sort=1, join=1, addCrossPostInfo=1); 
     11                  b_size python:displayItems; 
     12                  b_start python:0; 
     13                  b_start request/b_start | b_start; 
     14                  Batch python:modules['Products.CMFPlone'].Batch;"> 
    1915        <div metal:use-macro="here/document_actions/macros/document_actions"> 
    2016            Document actions (print, sendto etc) 
    2117        </div> 
    22  
    2318        <h1 tal:content="object_title" class="documentFirstHeading"> 
    2419          Title or id 
    2520        </h1> 
    26      
    2721        <div metal:use-macro="here/document_byline/macros/byline"> 
    2822          Get the byline - contains details about author and modification date. 
    2923        </div> 
    30                  
    31                 <tal:warning tal:condition="here/getWarnForUnpublishedEntries"> 
    32                     <tal:block tal:define="unpublishedEntries python:here.simpleblog_tool.getUnpublishedEntries(here);"> 
    33                                 <div class="portalMessage simpleBlogUnpublishedWarningbox" tal:condition="unpublishedEntries"> 
    34                                         There are <span tal:content="python:len(unpublishedEntries)" /> unpublished entries in this blog.  
    35                                         To see and manage all the existing entries 
    36                                         in this blog, click <a href="folder_contents">here</a>. 
    37                                 </div> 
    38                         </tal:block> 
    39                 </tal:warning>         
    40  
    41  
     24        <tal:warning tal:condition="here/getWarnForUnpublishedEntries"> 
     25            <tal:block tal:define="unpublishedEntries python:here.simpleblog_tool.getUnpublishedEntries(here);"> 
     26            <div class="portalMessage simpleBlogUnpublishedWarningbox" tal:condition="unpublishedEntries"> 
     27                There are <span tal:content="python:len(unpublishedEntries)" /> unpublished entries in this blog. To see and manage all the existing entries in this blog, click <a href="folder_contents">here</a> 
     28            </div> 
     29            </tal:block> 
     30        </tal:warning> 
    4231        <p class="documentDescription" 
    4332           tal:content="here/Description" 
     
    4534            Description 
    4635        </p> 
    47  
    4836        <div tal:condition="results" tal:define="batch python:Batch(results, b_size, int(b_start), orphan=1);"> 
    4937            <tal:block tal:repeat="entry batch"> 
    5038                <tal:entry tal:define="obj python:entry[0]; 
    51                                           isCrossPost python:entry[1];"> 
     39                                       isCrossPost python:entry[1];"> 
    5240                    <div metal:use-macro="here/SimpleBlog_macros/macros/?displayMode"/> 
    5341                </tal:entry> 
     
    5543            <div metal:use-macro="here/batch_macros/macros/navigation" /> 
    5644        </div> 
    57          
    5845        <tal:info tal:condition="not: results"> 
    5946            <tal:block tal:define="hasEntries python:here.simpleblog_tool.blogHasEntries(here);"> 
     
    7259    </tal:main-macro> 
    7360</div> 
    74  
    7561</body> 
    7662