Changeset 1165

Show
Ignore:
Timestamp:
07/16/08 06:00:28
Author:
liebster
Message:

fixed path action

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/RSS2.pt

    r1152 r1165  
    44     xmlns:metal="http://xml.zope.org/namespaces/metal"   
    55     xmlns:content="http://purl.org/rss/1.0/modules/content/" 
     6     xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" 
    67     tal:define="results python:here.getSyndicatableContent();" 
    78     tal:on-error="nothing"> 
    8 <tal:x define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml')" /> 
    9     <channel> 
    10  
     9<tal:x define="dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml');" /> 
     10    <channel tal:define="author python:here.getObjectCreator(here.Creator()); 
     11                         author_email python:author and author.getProperty('email','') or ''; 
     12                         author_fullname python:author and author.getProperty('fullname','') or ''; 
     13                         syInfo python:here.getSynProp(); 
     14                         itunesEnabled python: syInfo['enable_itunes']"> 
    1115        <title tal:define="portal_title here/portal_properties/title; 
    1216            here_title here/title_or_id; 
     
    1519            tal:content="string:$portal_title - $here_title">Title of page</title> 
    1620        <link tal:content="here/absolute_url"></link> 
    17         <description tal:content="here/Description"> 
    18         </description> 
     21        <description tal:content="here/Description"></description> 
    1922        <language>en-us</language> 
    20         <generator>Plone 2.0</generator> 
     23        <generator>Plone CMS</generator> 
     24        <author tal:condition="author_fullname"  
     25                tal:content="author_fullname"></author> 
     26 
     27        <tal:block condition="itunesEnabled"> 
     28        <ttl>240</ttl> 
     29        <itunes:author tal:condition="author_fullname" tal:content="author_fullname"></itunes:author> 
     30        <itunes:explicit tal:content="python:test(syInfo['itunes_explicit'],'yes','no')"></itunes:explicit> 
     31        <itunes:owner tal:condition="author"> 
     32           <itunes:name tal:condition="author_fullname" tal:content="author_fullname"></itunes:name> 
     33           <itunes:email tal:condition="author_email" tal:content="author_email"></itunes:email> 
     34        </itunes:owner> 
     35        <itunes:image href=""  
     36                      tal:condition="python:syInfo['itunes_image_url']" 
     37                      tal:attributes="href python:syInfo['itunes_image_url']"  /> 
     38        <itunes:subtitle tal:condition="here/longDescription" tal:content="here/Description"></itunes:subtitle> 
     39        <itunes:summary tal:condition="here/longDescription|nothing" tal:content="here/longDescription"></itunes:summary> 
     40        </tal:block> 
    2141 
    2242        <tal:block repeat="res results"> 
    2343            <tal:block define="macros nocall: python:here.getItemMacros(res.portal_type);  
    2444                               item_path python: res.absolute_url(); 
    25                                item_path python: res.portal_type=='ATAudio' and item_path+'/file_download/'+res.getId() or item_path;"> 
     45                               item_creator python:here.getObjectCreator(res.Creator()); 
     46                               item_creator python:item_creator and '%s (%s)' % (item_creator.getProperty('fullname',''),item_creator.getProperty('email','')) or ''"> 
    2647                  <item> 
    2748                      <title tal:content="res/title_or_id"></title> 
     
    2950                      <description tal:content="res/Description"> 
    3051                      </description> 
    31                       <author tal:content="res/Creator"></author> 
     52                      <tal:block condition="itunesEnabled"> 
     53                        <itunes:subtitle tal:condition="res/longDescription|nothing" tal:content="res/Description"></itunes:subtitle> 
     54                        <itunes:summary tal:condition="res/longDescription|nothing" tal:content="res/longDescription"></itunes:summary> 
     55                      </tal:block> 
     56                      <author tal:condition="item_creator" 
     57                              tal:content="item_creator"></author> 
    3258                      <tal:repeat repeat="subj res/Subject"> 
    3359                          <category tal:content="subj"> 
     
    3763                      <metal:block use-macro="macros"/> 
    3864                  </item> 
    39  
    4065            </tal:block> 
    41                  
    4266        </tal:block> 
    43  
    44  
    4567    </channel> 
    46  
    4768</rss> 
    4869 
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/ataudio_item.pt

    r1152 r1165  
    22<rss version="2.0"  
    33     xmlns:tal="http://xml.zope.org/namespaces/tal" 
    4      xmlns:metal="http://xml.zope.org/namespaces/metal" > 
     4     xmlns:metal="http://xml.zope.org/namespaces/metal" 
     5     xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" > 
    56<metal:block define-macro="item"> 
    6    <tal:define define="file res/getFile; 
    7                        item_size file/get_size | python: file and len(file) or 0; 
    8                        content_type  python:here.getFileFieldContentType(res); 
    9                        "> 
     7   <tal:define define="item_size res/getFileSize | python: 0; 
     8                       content_type  res/getMimeType;"> 
    109           <enclosure  
    1110               tal:attributes="type content_type; 
    1211                               url item_path; 
    1312                               length item_size"/> 
     13          <tal:block condition="itunesEnabled"> 
     14               <itunes:duration tal:content="res/getLengthString"></itunes:duration> 
     15          </tal:block> 
    1416  </tal:define> 
    1517</metal:block> 
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/blogentry_item.pt

    r1152 r1165  
    77     <tal:repeat repeat="tag res/EntryTag"> 
    88        <category tal:content="tag"></category> 
    9      </tal:repeat> 
    10       <content:encoded> 
    11         <tal:x replace="structure python:'&lt;![CDATA['+res.getBody()+']]&gt;'"/> 
    12       </content:encoded> 
     9     </tal:repeat>         
     10        <content:encoded tal:content="structure res/render_body">  </content:encoded> 
    1311     <tal:x tal:on-error="string:" 
    1412           define="files python:res.objectValues('ATAudio'); 
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSynProp.py

    r1152 r1165  
    1 ## Script (Python) "getAudioFiles
     1## Script (Python) "getSynProp
    22##bind container=container 
    33##bind context=context 
     
    55##bind script=script 
    66##bind subpath=traverse_subpath 
    7 ##parameters= object=None 
     7##parameters=object=None 
    88##title= 
    99## 
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSyndicatableContent.py

    r1152 r1165  
    1212   obj = context 
    1313if hasattr(context,'synContentValues') or context.portal_type=='Topic': 
    14    count = int(context.portal_syndication.getMaxItems(obj)) 
     14   count = context.portal_syndication.getMaxItems(obj)  
    1515   res = context.portal_syndication.getSyndicatableContent(obj) 
    1616   # has to check and cut number of items to be displayed  
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/save_rss2_setup.cpy

    r1152 r1165  
    66##bind state=state 
    77##bind subpath=traverse_subpath 
    8 ##parameters= rss2_types=(),only_published=0,include_subfolders=0, articles_number=20,REQUEST=None 
     8##parameters= rss2_types=(),only_published=0,include_subfolders=0, articles_number=20, enable_itunes=0, itunes_image_url='', itunes_explicit=0, REQUEST=None 
    99##title= 
    1010## 
    1111if REQUEST: 
    1212  from Products.qRSS2Syndication.utils import setupRSS2Types 
    13   status,message=setupRSS2Types(context,rss2_types,only_published,include_subfolders,articles_number,REQUEST) 
     13  status,message=setupRSS2Types(context,rss2_types,only_published,include_subfolders,articles_number,enable_itunes,itunes_image_url,itunes_explicit,REQUEST) 
    1414return state.set(status=status, portal_status_message=message) 
    1515     
  • qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/setup_rss2.cpt

    r1152 r1165  
    1919            method="post" 
    2020            enctype="multipart/form-data" 
    21             tal:attributes="action string:${here/getId}/${template/getId}" > 
     21            tal:attributes="action template_id" > 
    2222 
    2323        <fieldset> 
     
    4949              </metal:block> 
    5050                 
    51             </select> 
     51                       </select> 
    5252          </div> 
    5353 
     
    7575          </div> 
    7676 
    77             
    7877          <div class="field" 
    7978               tal:define="error errors/articles_number|nothing;" 
     
    9291          </div> 
    9392 
    94  
    95  
     93                  <fieldset> 
     94                         <legend i18n:translate="legend_itunes">iTunes</legend> 
     95                  <div class="field"> 
     96                    <input type="checkbox"  
     97                           name="enable_itunes"  
     98                           value="0" 
     99                           tal:define="checked python:sy_info['enable_itunes'] and 'checked'" 
     100                           tal:attributes="checked checked"/> 
     101                    <label for="enable_itunes" i18n:translate="label_enable_itunes">Enable support for iTunes Music Store (good for Podcasts/Vodcasts)</label> 
     102                  </div> 
     103         
     104                  <div class="field"> 
     105                    <input type="checkbox"  
     106                           name="itunes_explicit"  
     107                           value="0" 
     108                           tal:define="checked python:sy_info['itunes_explicit'] and 'checked'" 
     109                           tal:attributes="checked checked"/> 
     110                    <label for="itunes_explicit" i18n:translate="label_itunes_explicit">This channel contains explicit content, strong language, sexuality, ...</label> 
     111                  </div> 
     112         
     113                  <div class="field"> 
     114                    <label for="itunes_image_url" i18n:translate="label_itunes_image_url">Artwork for this Channel</label> 
     115                    <div class="formHelp" i18n:translate="help_itunes_image_url"> 
     116                      Please enter a url to a image for the artwork of this channel. Should be in JPEG or PNG format and 300x300 pixels. 
     117                    </div> 
     118                    <input type="text"  
     119                           name="itunes_image_url"  
     120                           value="" 
     121                                          size="60" 
     122                           tal:define="itunes_image_url python:request.get('itunes_image_url',None) or sy_info['itunes_image_url'] or ''" 
     123                           tal:attributes="value itunes_image_url"/> 
     124                  </div> 
     125                  </fieldset> 
    96126          <div class="formControls"> 
    97127         
  • qRSS2Syndication/branches/Plone3.1/utils.py

    r1152 r1165  
    88                    include_subfolders = 0, 
    99                    articles_number = 20, 
     10                    enable_itunes = 0, 
     11                    itunes_image_url = '', 
     12                    itunes_explicit = 0, 
    1013                    REQUEST = None): 
    11     """ Save all needed RSS2 properties into 'syndication_information' """ 
    12     import pdb;pdb.set_trace() 
     14    """ Save all needed RSS2 properties into 'syndication_information' """       
    1315    obj=aq_base(context) 
    1416    status = 'success' 
     
    2022        message = 'Syndication is Disabled' 
    2123        status = 'failed' 
    22     syInfo.rss2_types = list(rss2_types) 
    23     syInfo.only_published = only_published 
    24     syInfo.include_subfolders = include_subfolders 
    25     syInfo.max_items = int(articles_number) 
     24    else: 
     25        syInfo.rss2_types = list(rss2_types) 
     26        syInfo.only_published = only_published 
     27        syInfo.include_subfolders = include_subfolders 
     28        syInfo.max_items = articles_number 
     29        syInfo.enable_itunes = enable_itunes 
     30        syInfo.itunes_image_url = itunes_image_url 
     31        syInfo.itunes_explicit = itunes_explicit 
    2632    return status, message 
    2733 
    2834def getRSS2Properties(context): 
    29     """ Return directory of RSS2 properties from 'syndication_information' """ 
    30     obj=aq_base(context) 
    31      
    32     syInfo = getattr(obj, 'syndication_information', None) 
    33     syPropeties={} 
    34     syPropeties['rss2_types'] = getattr(syInfo,'rss2_types',[]) 
    35     syPropeties['only_published'] = getattr(syInfo,'only_published',0) 
    36     syPropeties['include_subfolders'] = getattr(syInfo,'include_subfolders',0) 
    37     syPropeties['articles_number'] =int(getattr(syInfo,'max_items',20)) 
    38     return  syPropeties 
     35     """ Return directory of RSS2 properties from 'syndication_information' """ 
     36     obj=aq_base(context) 
     37     syInfo = getattr(obj, 'syndication_information', None) 
     38     syPropeties={} 
     39     syPropeties['rss2_types'] = getattr(syInfo,'rss2_types',[]) 
     40     syPropeties['only_published'] = getattr(syInfo,'only_published',0) 
     41     syPropeties['include_subfolders'] = getattr(syInfo,'include_subfolders',0) 
     42     syPropeties['articles_number'] =int(getattr(syInfo,'max_items',20)) 
     43     syPropeties['enable_itunes'] = getattr(syInfo,'enable_itunes',0) 
     44     syPropeties['itunes_image_url'] = getattr(syInfo,'itunes_image_url','') 
     45     syPropeties['itunes_explicit'] = getattr(syInfo,'itunes_explicit',0) 
     46     return  syPropeties 
    3947 
    4048 
     
    4755    res = [] 
    4856    ps = getToolByName(context,'portal_syndication') 
     57    cpath = '/'.join(context.getPhysicalPath()) 
     58    syProperties = getRSS2Properties(context) 
     59    include_subfolders = 0 
     60    path_length=len(cpath)+1 
     61    res1=[] 
    4962    if ps.isSyndicationAllowed(context): 
    50         cpath = '/'.join(context.getPhysicalPath()) 
    51         syProperties = getRSS2Properties(context) 
    5263        types = syProperties['rss2_types'] 
    5364        only_published = syProperties['only_published'] 
     
    5667 
    5768        catalog = getToolByName(context,'portal_catalog') 
    58         args = {'portal_type':types, 
    59                 'path':cpath, 
     69        args = {'portal_type':types,  
     70              'path':cpath, 
    6071                'sort_on':'effective', 
    6172                'sort_order':'reverse',} 
     73 
    6274        if only_published: 
    6375            args['review_state'] = 'published' 
    6476        if include_subfolders == 0: 
    65             path_length=len(cpath)+1 
    66             for i in catalog.searchResults(args): 
    67                 if i.getPath()[path_length:].find('/')<0: 
    68                     res.append(i) 
    69             res = res[:articles_number] 
    70         else: 
    7177            args['sort_limit'] = articles_number 
    7278            res=catalog.searchResults(args) 
    73         res = [r.getObject() for r in res] 
     79            for i in res : 
     80                if i.getPath()[path_length:].find('/')<0: 
     81                    res1.append(i) 
     82            res = res1[:articles_number] 
     83    res = [r.getObject() for r in res] 
    7484    return res 
    7585