diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getAuthorName.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getAuthorName.xml index a2c3b20b7d65f6ef8964396f1440bbdda25438df..790850ea8009aed1aaeb98a9b97d2c1d45624653 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getAuthorName.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getAuthorName.xml @@ -53,25 +53,13 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>#request = container.REQUEST\n -#RESPONSE = request.RESPONSE\n -\n -#context.pdb_trace(context.getObject())\n + <value> <string>"""\n + This simple script returns the author name of the current context.\n +"""\n \n document = context.getObject()\n -#user_name = document.getOwnerInfo()[\'id\']\n -return (document.getSourceValue() is not None and document.getSourceValue().getTitle() or "User unknown")\n -\n -#portal = context.getPortalObject()\n -#found_user_list = portal.portal_catalog(portal_type=\'Person\', reference=user_name)\n -#found_user_count = len(found_user_list)\n -#if found_user_count != 1:\n -# person_name = user_name\n -#else:\n -# person = found_user_list[0].getObject()\n -# person_name = person.getName()\n -\n -#return person_name\n +source = document.getSourceValue()\n +return (source is not None and source.getTitle() or "User unknown")\n </string> </value> </item> <item> @@ -119,6 +107,7 @@ return (document.getSourceValue() is not None and document.getSourceValue().getT <string>_getattr_</string> <string>context</string> <string>document</string> + <string>source</string> <string>None</string> </tuple> </value> diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPermanentLink.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getBlogReference.xml similarity index 89% rename from bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPermanentLink.xml rename to bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getBlogReference.xml index 0fb6a2ef712dabb2338505216981dcce97fe9b89..d4d2b62963d8cf200bbd24070cde1c7802af3253 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPermanentLink.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getBlogReference.xml @@ -53,11 +53,11 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string># Import a standard function, and get the HTML request and response objects.\n -request = container.REQUEST\n -RESPONSE = request.RESPONSE\n + <value> <string>"""\n + This script returns a valid reference to the blog post in context.\n +"""\n \n -return "%s/%s" % (context.absolute_url(), context.getReference())\n +return "%s/WebPage_viewAsBlog" % context.getReference()\n </string> </value> </item> <item> @@ -95,9 +95,6 @@ return "%s/%s" % (context.absolute_url(), context.getReference())\n <value> <tuple> <string>_getattr_</string> - <string>container</string> - <string>request</string> - <string>RESPONSE</string> <string>context</string> </tuple> </value> @@ -115,7 +112,7 @@ return "%s/%s" % (context.absolute_url(), context.getReference())\n </item> <item> <key> <string>id</string> </key> - <value> <string>WebSection_getPermanentLink</string> </value> + <value> <string>WebSection_getBlogReference</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getCategoryList.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getCategoryList.xml index a096db24483158fe3f9a4256019cbcda596a5e20..6f63f1c87d28e5fc39cf080e5ef2e835c6ca08bf 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getCategoryList.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getCategoryList.xml @@ -53,20 +53,31 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>current_section = context.getWebSectionValue()\n + <value> <string>"""\n + This script returns the list of category (or tags) that are available in the current web section.\n + It returns a python list of Category object. A Category object is really simple, as it has just \n + one property with a getter and a setter : title.\n +"""\n +\n +\n +## First step : retrieve the raw list\n +current_section = context.getWebSectionValue()\n subject_list = []\n +\n for item in current_section.WebSection_getDocumentValueList():\n - subject_list.extend(item.getSubjectList())\n + subject_list.extend([x for x in item.getSubjectList() if not x in subject_list])\n \n +##Â Now, build the object list so that a Listbox can be used to display the results of this script.\n result = []\n -class FakeObject:\n +\n +class Category:\n def setTitle(self, title):\n self.title = title\n def getTitle(self):\n return self.title\n \n for item in subject_list:\n - obj = FakeObject()\n + obj = Category()\n obj.setTitle(item)\n result.append(obj)\n \n @@ -114,8 +125,11 @@ return result\n <string>subject_list</string> <string>_getiter_</string> <string>item</string> + <string>append</string> + <string>$append0</string> + <string>x</string> <string>result</string> - <string>FakeObject</string> + <string>Category</string> <string>obj</string> </tuple> </value> diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml index 2d0c26654f32382bf732bfe5ae7c042e0dba4746..ea321704b03a091fd10def593729e4cd9521d48a 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getFirstParagraph.xml @@ -55,13 +55,15 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ -request = container.REQUEST\n -RESPONSE = request.RESPONSE\n -\n +"""\n + This simple script returns the first paragraph of an HTML or raw text.\n + In the case of a raw text, the first line is returned, splitted by \\n.\n +"""\n content = context.getTextContent()\n -print content.split("</p>")[0] + "</p>"\n -\n -return printed\n +if "</p>" in content:\n + return content.split("</p>")[0] + "</p>"\n +else:\n + return content.split("\\n")[0]\n ]]></string> </value> @@ -100,12 +102,7 @@ return printed\n <key> <string>co_varnames</string> </key> <value> <tuple> - <string>_print_</string> - <string>_print</string> <string>_getattr_</string> - <string>container</string> - <string>request</string> - <string>RESPONSE</string> <string>context</string> <string>content</string> <string>_getitem_</string> diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPostList.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPostList.xml index 8ee8891fbc70521b9d4944610563377ec3177c5b..e988e256254c492f19318160671b6771ef7fcf44 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPostList.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_getPostList.xml @@ -53,7 +53,13 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>request = container.REQUEST\n + <value> <string>"""\n + This script returns the blog post that must be displayed in the current section.\n + The blog post are filtered through the tag parameter that is retrieved through\n + the GET parameters.\n +"""\n +\n +request = container.REQUEST\n \n requested_tag = request.get(\'tag\')\n current_section = context.getWebSectionValue()\n diff --git a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml index 6844461b88e2cc4f1986ff6c0944be311c6bddad..e5dd061f478a05f91b1d96b8060ab41753b79db5 100644 --- a/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml +++ b/bt5/erp5_web_blog/SkinTemplateItem/portal_skins/erp5_web_blog/WebSection_viewBlogFrontPage/listbox.xml @@ -373,7 +373,7 @@ <string>Categories</string> </tuple> <tuple> - <string>reference</string> + <string>WebSection_getBlogReference</string> <string>Reference</string> </tuple> <tuple> @@ -381,7 +381,7 @@ <string>Summary</string> </tuple> <tuple> - <string>Discussion_getCommentCount</string> + <string>DiscussionThread_getContextPostCount</string> <string>Comment Count</string> </tuple> </list> diff --git a/bt5/erp5_web_blog/bt/revision b/bt5/erp5_web_blog/bt/revision index dec2bf5d6199c7cd0d84f3dc1e76a73ccc336302..b39356075901abfb43d27aef2ae5b76b6aee19c4 100644 --- a/bt5/erp5_web_blog/bt/revision +++ b/bt5/erp5_web_blog/bt/revision @@ -1 +1 @@ -19 \ No newline at end of file +23 \ No newline at end of file