From 1076168460b81b338f99ff26dd4b0b06298f8dd2 Mon Sep 17 00:00:00 2001
From: Ivan Tyagov <ivan@nexedi.com>
Date: Fri, 17 Feb 2012 10:52:28 +0200
Subject: [PATCH] In some cases a Box can override Gadget default way of
 rendering (usefull in cases when we care for SEO for anonymous users). Make
 RSS feed more visible.

---
 .../property_sheet_list.xml                   |  3 +++
 .../portal_types/Knowledge%20Box.xml          | 20 +++++++++++++++++--
 .../erp5_gadget/RssFeed_getSummaryAsHTML.xml  |  7 ++++++-
 .../KnowledgePad_viewColumnWidget.xml         |  2 +-
 .../erp5_knowledge_box.css.xml                |  9 +++++++--
 bt5/erp5_knowledge_pad/bt/revision            |  2 +-
 .../template_portal_type_property_sheet_list  |  3 ++-
 7 files changed, 38 insertions(+), 8 deletions(-)

diff --git a/bt5/erp5_knowledge_pad/PortalTypePropertySheetTemplateItem/property_sheet_list.xml b/bt5/erp5_knowledge_pad/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
index dfae23e098..53823aefa2 100644
--- a/bt5/erp5_knowledge_pad/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
+++ b/bt5/erp5_knowledge_pad/PortalTypePropertySheetTemplateItem/property_sheet_list.xml
@@ -6,4 +6,7 @@
   <item>DefaultImage</item>
   <item>Gadget</item>
  </portal_type>
+ <portal_type id="Knowledge Box">
+  <item>Gadget</item>
+ </portal_type>
 </property_sheet_list>
\ No newline at end of file
diff --git a/bt5/erp5_knowledge_pad/PortalTypeTemplateItem/portal_types/Knowledge%20Box.xml b/bt5/erp5_knowledge_pad/PortalTypeTemplateItem/portal_types/Knowledge%20Box.xml
index fb174d65f9..b7fdeca750 100644
--- a/bt5/erp5_knowledge_pad/PortalTypeTemplateItem/portal_types/Knowledge%20Box.xml
+++ b/bt5/erp5_knowledge_pad/PortalTypeTemplateItem/portal_types/Knowledge%20Box.xml
@@ -179,11 +179,15 @@
         </item>
         <item>
             <key> <string>init_script</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <none/>
+            </value>
         </item>
         <item>
             <key> <string>permission</string> </key>
-            <value> <string></string> </value>
+            <value>
+              <none/>
+            </value>
         </item>
         <item>
             <key> <string>title</string> </key>
@@ -193,6 +197,18 @@
             <key> <string>type_class</string> </key>
             <value> <string>XMLObject</string> </value>
         </item>
+        <item>
+            <key> <string>type_interface</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>type_mixin</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
       </dictionary>
     </pickle>
   </record>
diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/RssFeed_getSummaryAsHTML.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/RssFeed_getSummaryAsHTML.xml
index af5b1abcf7..addfb67fd7 100644
--- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/RssFeed_getSummaryAsHTML.xml
+++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/RssFeed_getSummaryAsHTML.xml
@@ -54,11 +54,16 @@
   <div class="document-gadget-quick-preview">\n
 \n
     <div class="teaser"\n
+         tal:define="is_external_rss_image_available python: image not in ((), None, [])"\n
          tal:attributes="class python: test(is_read, \'teaser read\', \'teaser unread\');\n
                          onclick string:if(this.className!=\'teaser read\'){this.className=\'teaser read\';;$.get(\'Base_setRssItemReadInSelection\', {\'selection_name\':\'${selection_name}\',\'item\':\'${md5}\'})};;$(\'#${dom_id}\').toggle();">\n
       <img class="thumbnail-image"\n
-           tal:condition="python: image not in ((), None, [])"\n
+           tal:condition="is_external_rss_image_available"\n
            tal:attributes="src python: image[0]" alt="Thumbnail"/>\n
+\n
+      <img tal:condition="not: is_external_rss_image_available"\n
+           src="web_page.png"/>\n
+\n
       <span class="document-title"\n
             tal:content="title"/> - \n
       <span class="modification-date"\n
diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml
index 2d3a09dbef..459f54b360 100644
--- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml
+++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/KnowledgePad_viewColumnWidget.xml
@@ -65,7 +65,7 @@
                     dummy python: request.form.update(dict(box_relative_url=box_relative_url));\n
                     edit_form_id gadget/getEditFormId;\n
                     view_form_id gadget/getViewFormId;\n
-                    render_type gadget/getRenderType;\n
+                    render_type python: test(box.getRenderType() is not None, box.getRenderType(), gadget.getRenderType());\n
                     is_asynchronous_gadget python: render_type == \'asynchronous\';\n
                     is_gadget_visible python: gadget is not None and gadget_state!=\'invisible\';">\n
 \n
diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.css.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.css.xml
index b87bdce04d..f1d411785c 100644
--- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.css.xml
+++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/erp5_knowledge_box.css.xml
@@ -12,7 +12,7 @@
         </item>
         <item>
             <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts23095087.4</string> </value>
+            <value> <string>ts29466233.61</string> </value>
         </item>
         <item>
             <key> <string>__name__</string> </key>
@@ -406,6 +406,11 @@ div.block div.worklist_list ul li a:hover{\n
 /* Some gadgets share same Document_getSummaryAsHTML or RssFeed_getSummaryAsHTML */\n
 div.document-gadget-quick-preview div.teaser{\n
   cursor: pointer;\n
+  margin-bottom: 3px;\n
+}\n
+\n
+div.document-gadget-quick-preview div.teaser img{\n
+  vertical-align:top;\n
 }\n
 \n
 div.document-gadget-quick-preview span.document-title,\n
@@ -496,7 +501,7 @@ div.gadget-rss-reader .body {\n
         </item>
         <item>
             <key> <string>size</string> </key>
-            <value> <int>8240</int> </value>
+            <value> <int>8337</int> </value>
         </item>
         <item>
             <key> <string>title</string> </key>
diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision
index 4a533e3dd9..64a0b71f19 100644
--- a/bt5/erp5_knowledge_pad/bt/revision
+++ b/bt5/erp5_knowledge_pad/bt/revision
@@ -1 +1 @@
-745
\ No newline at end of file
+746
\ No newline at end of file
diff --git a/bt5/erp5_knowledge_pad/bt/template_portal_type_property_sheet_list b/bt5/erp5_knowledge_pad/bt/template_portal_type_property_sheet_list
index ac3a1b5f6a..72c01a8bf8 100644
--- a/bt5/erp5_knowledge_pad/bt/template_portal_type_property_sheet_list
+++ b/bt5/erp5_knowledge_pad/bt/template_portal_type_property_sheet_list
@@ -1,3 +1,4 @@
 Gadget Type | DefaultImage
 Gadget Type | Gadget
-Gadget | Gadget
\ No newline at end of file
+Gadget | Gadget
+Knowledge Box | Gadget
\ No newline at end of file
-- 
2.30.9