[Erp5-report] r36801 ivan - in /erp5/trunk/bt5/erp5_km: SkinTemplateItem/portal_skins/erp5_...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 2 12:46:28 CEST 2010


Author: ivan
Date: Fri Jul  2 12:46:22 2010
New Revision: 36801

URL: http://svn.erp5.org?rev=36801&view=rev
Log:
Allow in download widget to select from all possible convert to formats (incl. original).
Use explicitly MochiKit prefix in all KM JavaScript code.

Added:
    erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/old/Document_viewDownloadWidget.xml
    erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml
Modified:
    erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/download_widget.xml
    erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml
    erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
    erp5/trunk/bt5/erp5_km/bt/revision

Added: erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/old/Document_viewDownloadWidget.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/old/Document_viewDownloadWidget.xml?rev=36801&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/old/Document_viewDownloadWidget.xml (added)
+++ erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km/old/Document_viewDownloadWidget.xml [utf8] Fri Jul  2 12:46:22 2010
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+"""\n
+  This script creates a button with links to PDF or printable\n
+  formats of the current page.\n
+\n
+  TODO:\n
+    - support more portal types\n
+    - produce PDF from HTML\n
+    - add a button to make a page printage (this is another widget)\n
+    - make sure everything is well translated (ex. Format word)\n
+"""\n
+\n
+request = context.REQUEST\n
+portal_path = request.get(\'current_web_site_url\', context.getPortalObject().absolute_url())\n
+object_url = context.absolute_url()\n
+title = context.getShortTitle()\n
+if not title:\n
+  title = context.getReference()\n
+\n
+# Select the download format\n
+portal_type = context.getPortalType()\n
+if portal_type == \'Web Page\':\n
+  format = \'text\'\n
+elif portal_type == \'Presentation\':\n
+  format = \'pdf\'\n
+elif portal_type in (\'Text\', \'Presentation\', \'Spreadsheet\', \'Drawing\', \'PDF Document\'):\n
+  format = \'pdf\'\n
+else:\n
+  format = None\n
+\n
+if not format or not context.hasConversion(format=format):\n
+  converted_size_html = \'\'\n
+else:\n
+  converted_size = context.getConversionSize(format=format)\n
+  if converted_size < 1024:\n
+    converted_size_html = \'%sB - \' % converted_size\n
+  elif converted_size < 1048576:\n
+    converted_size_html = \'%.1fKB - \' % (converted_size / 1024.0)\n
+  else:\n
+    converted_size_html = \'%.1fMB - \' % (converted_size / 1048576.0)\n
+\n
+if format is None:\n
+  return \'\'\n
+\n
+# Produce the HTML snippet\n
+download_html = """<a href="%s?format=%s"><img src="%s/km_img/download_%s.png" alt="%s icon"/></a>\n
+                      <p>\n
+                        <a href="%s?format=%s">%s</a><br/>%s%s Format\n
+                      </p>\n
+                 """ % (object_url, format, portal_path, format, format, object_url, format, title, \n
+                                 converted_size_html, format.upper())\n
+\n
+return download_html\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string></string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>0</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>request</string>
+                            <string>portal_path</string>
+                            <string>object_url</string>
+                            <string>title</string>
+                            <string>portal_type</string>
+                            <string>format</string>
+                            <string>None</string>
+                            <string>converted_size_html</string>
+                            <string>converted_size</string>
+                            <string>download_html</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Document_viewDownloadWidget</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/download_widget.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/download_widget.xml?rev=36801&r1=36800&r2=36801&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/download_widget.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/WebSection_viewMinimalKMWidgetFieldLibrary/download_widget.xml [utf8] Fri Jul  2 12:46:22 2010
@@ -307,7 +307,7 @@
       <dictionary>
         <item>
             <key> <string>_text</string> </key>
-            <value> <string>request/current_web_document/Document_viewDownloadWidget</string> </value>
+            <value> <string>request/current_web_document/Base_viewDownloadWidget</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml?rev=36801&r1=36800&r2=36801&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_css/layout.css.xml [utf8] Fri Jul  2 12:46:22 2010
@@ -1519,7 +1519,51 @@ div.centeredInner {\n
 /* Search listbox styling */\n
 div.searchDetails, span.found{\n
   padding-top: 5px;\n
-}
+}\n
+\n
+/* Download widget */\n
+div.download-document-format-list-container{\n
+  display:block;\n
+  float:left;\n
+  max-width: 200px;\n
+}\n
+div.download-document-format-list-container span{\n
+  cursor: pointer; \n
+  display:block;\n
+  float:right;\n
+  background:transparent url(km_img/collapse-down-arrow.gif) no-repeat scroll right 6px;\n
+  padding: 3px;\n
+  padding-right: 10px;\n
+  font-weight: bold;\n
+}\n
+\n
+div.download-document-format-list-menu{\n
+  display:block;\n
+  float:left;\n
+  border: 1px solid #ECEBE2;\n
+}\n
+div.download-document-format-list-container span:hover,\n
+div.download-document-format-list-menu ul li:hover{\n
+  background-color: #ECEBE2;\n
+}\n
+div.download-document-format-list-menu ul{\n
+  list-style-type:none;\n
+  padding:0.4em;\n
+  margin-bottom:0;\n
+  margin-top:0;\n
+}\n
+div.download-document-format-list-menu ul li{\n
+  margin-bottom:2px;\n
+}\n
+div.download-document-format-list-menu ul li.separator{\n
+  border-bottom: 1px solid #ECEBE2;\n
+  margin-bottom:5px;\n
+  padding-bottom:3px;\n
+}\n
+\n
+\n
+\n
+
 
 ]]></string> </value>
         </item>

Modified: erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml?rev=36801&r1=36800&r2=36801&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_theme/km_js/erp5_km.js.xml [utf8] Fri Jul  2 12:46:22 2010
@@ -15,7 +15,7 @@
         </item>
         <item>
             <key> <string>_EtagSupport__etag</string> </key>
-            <value> <string>ts77887532.32</string> </value>
+            <value> <string>ts78059655.7</string> </value>
         </item>
         <item>
             <key> <string>__name__</string> </key>
@@ -31,8 +31,8 @@
 
 // Browser gadget toggle section\n
 function toggleSection(section_id, image_id){\n
-  section_obj = getElement(section_id);\n
-  image_obj = getElement(image_id);\n
+  section_obj = MochiKit.DOM.getElement(section_id);\n
+  image_obj = MochiKit.DOM.getElement(image_id);\n
   if(section_obj.style.display==\'none\'){\n
     section_obj.style.display=\'block\';\n
     image_obj.src=\'images/tree_open.png\';}\n
@@ -64,6 +64,12 @@ function toggleDocumentDetailsPopupWindo
     }\n
 }\n
 \n
+// Toggle any element\n
+function toggleElement(tag_name, class_name){\n
+  dom_element = MochiKit.DOM.getFirstElementByTagAndClassName(tag_name, class_name);\n
+  MochiKit.Visual.toggle(dom_element);\n
+}\n
+\n
 MochiKit.DOM.addLoadEvent(setScreenClass);\n
 connect(window, "onresize", setScreenClass);\n
 \n
@@ -82,7 +88,7 @@ function setScreenClass(){\n
         </item>
         <item>
             <key> <string>size</string> </key>
-            <value> <int>1319</int> </value>
+            <value> <int>1540</int> </value>
         </item>
         <item>
             <key> <string>title</string> </key>

Added: erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml?rev=36801&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml (added)
+++ erp5/trunk/bt5/erp5_km/SkinTemplateItem/portal_skins/erp5_km_widget_library/Base_viewDownloadWidget.xml [utf8] Fri Jul  2 12:46:22 2010
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<tal:block replace="nothing">\n
+  <!--\n
+  This widget displays download widget of a document.\n
+ \n
+  -->\n
+</tal:block>\n
+\n
+<div class="download-document-format-list-container"\n
+     tal:define="target_format_item_list python: here.getTargetFormatItemList();\n
+                       document_url here/absolute_url">\n
+ <span onClick="javascript:toggleElement(\'div\', \'download-document-format-list-menu\');"> Download</span>\n
+  <div class="download-document-format-list-menu" style="opacity: 0.999999; display: none;">\n
+    <ul>\n
+      <li class="separator"><a tal:attributes="href document_url"> Original </a></li>\n
+      <li tal:repeat="target_format_item target_format_item_list">\n
+        <a tal:attributes="href python: \'%s?format=%s\' %(document_url, target_format_item[1])"\n
+           tal:content="python: target_format_item[0]"/>\n
+      </li>\n
+    </ul>\n
+  </div>\n
+\n
+</div>
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>Base_viewDownloadWidget</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_km/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_km/bt/revision?rev=36801&r1=36800&r2=36801&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_km/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_km/bt/revision [utf8] Fri Jul  2 12:46:22 2010
@@ -1 +1 @@
-1476
\ No newline at end of file
+1478
\ No newline at end of file




More information about the Erp5-report mailing list