Changeset 1165
- Timestamp:
- 07/16/08 06:00:28
- Files:
-
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/RSS2.pt (modified) (4 diffs)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/ataudio_item.pt (modified) (1 diff)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/atvideo_item.pt (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/bittorrentfile_item.pt (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/blogentry_item.pt (modified) (1 diff)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getFileFieldContentType.py (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getItemMacros.py (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSynProp.py (modified) (2 diffs)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSyndicatableContent.py (modified) (1 diff)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/mediacoopaudio_item.pt (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/mediacoopimage_item.pt (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/mediacoopvideo_item.pt (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/save_rss2_setup.cpy (modified) (1 diff)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/setup_rss2.cpt (modified) (4 diffs)
- qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/validate_rss2_setup.vpy (modified) (previous)
- qRSS2Syndication/branches/Plone3.1/utils.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/RSS2.pt
r1152 r1165 4 4 xmlns:metal="http://xml.zope.org/namespaces/metal" 5 5 xmlns:content="http://purl.org/rss/1.0/modules/content/" 6 xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" 6 7 tal:define="results python:here.getSyndicatableContent();" 7 8 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']"> 11 15 <title tal:define="portal_title here/portal_properties/title; 12 16 here_title here/title_or_id; … … 15 19 tal:content="string:$portal_title - $here_title">Title of page</title> 16 20 <link tal:content="here/absolute_url"></link> 17 <description tal:content="here/Description"> 18 </description> 21 <description tal:content="here/Description"></description> 19 22 <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> 21 41 22 42 <tal:block repeat="res results"> 23 43 <tal:block define="macros nocall: python:here.getItemMacros(res.portal_type); 24 44 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 ''"> 26 47 <item> 27 48 <title tal:content="res/title_or_id"></title> … … 29 50 <description tal:content="res/Description"> 30 51 </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> 32 58 <tal:repeat repeat="subj res/Subject"> 33 59 <category tal:content="subj"> … … 37 63 <metal:block use-macro="macros"/> 38 64 </item> 39 40 65 </tal:block> 41 42 66 </tal:block> 43 44 45 67 </channel> 46 47 68 </rss> 48 69 qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/ataudio_item.pt
r1152 r1165 2 2 <rss version="2.0" 3 3 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" > 5 6 <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;"> 10 9 <enclosure 11 10 tal:attributes="type content_type; 12 11 url item_path; 13 12 length item_size"/> 13 <tal:block condition="itunesEnabled"> 14 <itunes:duration tal:content="res/getLengthString"></itunes:duration> 15 </tal:block> 14 16 </tal:define> 15 17 </metal:block> qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/blogentry_item.pt
r1152 r1165 7 7 <tal:repeat repeat="tag res/EntryTag"> 8 8 <category tal:content="tag"></category> 9 </tal:repeat> 10 <content:encoded> 11 <tal:x replace="structure python:'<![CDATA['+res.getBody()+']]>'"/> 12 </content:encoded> 9 </tal:repeat> 10 <content:encoded tal:content="structure res/render_body"> </content:encoded> 13 11 <tal:x tal:on-error="string:" 14 12 define="files python:res.objectValues('ATAudio'); qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSynProp.py
r1152 r1165 1 ## Script (Python) "get AudioFiles"1 ## Script (Python) "getSynProp" 2 2 ##bind container=container 3 3 ##bind context=context … … 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= object=None7 ##parameters=object=None 8 8 ##title= 9 9 ## qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/getSyndicatableContent.py
r1152 r1165 12 12 obj = context 13 13 if hasattr(context,'synContentValues') or context.portal_type=='Topic': 14 count = int(context.portal_syndication.getMaxItems(obj))14 count = context.portal_syndication.getMaxItems(obj) 15 15 res = context.portal_syndication.getSyndicatableContent(obj) 16 16 # has to check and cut number of items to be displayed qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/save_rss2_setup.cpy
r1152 r1165 6 6 ##bind state=state 7 7 ##bind subpath=traverse_subpath 8 ##parameters= rss2_types=(),only_published=0,include_subfolders=0, articles_number=20, REQUEST=None8 ##parameters= rss2_types=(),only_published=0,include_subfolders=0, articles_number=20, enable_itunes=0, itunes_image_url='', itunes_explicit=0, REQUEST=None 9 9 ##title= 10 10 ## 11 11 if REQUEST: 12 12 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) 14 14 return state.set(status=status, portal_status_message=message) 15 15 qRSS2Syndication/branches/Plone3.1/skins/qrss2syndication/setup_rss2.cpt
r1152 r1165 19 19 method="post" 20 20 enctype="multipart/form-data" 21 tal:attributes="action string:${here/getId}/${template/getId}" >21 tal:attributes="action template_id" > 22 22 23 23 <fieldset> … … 49 49 </metal:block> 50 50 51 </select>51 </select> 52 52 </div> 53 53 … … 75 75 </div> 76 76 77 78 77 <div class="field" 79 78 tal:define="error errors/articles_number|nothing;" … … 92 91 </div> 93 92 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> 96 126 <div class="formControls"> 97 127 qRSS2Syndication/branches/Plone3.1/utils.py
r1152 r1165 8 8 include_subfolders = 0, 9 9 articles_number = 20, 10 enable_itunes = 0, 11 itunes_image_url = '', 12 itunes_explicit = 0, 10 13 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' """ 13 15 obj=aq_base(context) 14 16 status = 'success' … … 20 22 message = 'Syndication is Disabled' 21 23 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 26 32 return status, message 27 33 28 34 def 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 39 47 40 48 … … 47 55 res = [] 48 56 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=[] 49 62 if ps.isSyndicationAllowed(context): 50 cpath = '/'.join(context.getPhysicalPath())51 syProperties = getRSS2Properties(context)52 63 types = syProperties['rss2_types'] 53 64 only_published = syProperties['only_published'] … … 56 67 57 68 catalog = getToolByName(context,'portal_catalog') 58 args = {'portal_type':types, 59 'path':cpath,69 args = {'portal_type':types, 70 'path':cpath, 60 71 'sort_on':'effective', 61 72 'sort_order':'reverse',} 73 62 74 if only_published: 63 75 args['review_state'] = 'published' 64 76 if include_subfolders == 0: 65 path_length=len(cpath)+166 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:71 77 args['sort_limit'] = articles_number 72 78 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] 74 84 return res 75 85
