[Erp5-report] r8577 - /erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jul 19 14:12:56 CEST 2006


Author: kevin
Date: Wed Jul 19 14:12:53 2006
New Revision: 8577

URL: http://svn.erp5.org?rev=8577&view=rev
Log:
Previous version was an empty shell, here is the version with true code in it.

Modified:
    erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSiteMap.xml

Modified: erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSiteMap.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSiteMap.xml?rev=8577&r1=8576&r2=8577&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSiteMap.xml (original)
+++ erp5/trunk/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSiteMap.xml Wed Jul 19 14:12:53 2006
@@ -74,24 +74,62 @@
   TODO: add parameters to filter by object type / object visibility (admin or not) and security\n
 """\n
 \n
-# Get default site root if no root defined\n
-if site_root in (\'\', None):\n
-  site_root = context.WebSite_getSiteValue()\n
-\n
-# site_map is the tree of sections/subsections/documents of the web site.\n
+def WebDocument_getURI(object):\n
+  """\n
+    This function return the right URI depending of the object type.\n
+  """\n
+  if object.getPortalType() == \'Web Page\':\n
+    return object.getReference()\n
+  else:\n
+    return object.getId()\n
+\n
+\n
+\n
+# Get default site root\n
+site_root = context.WebSite_getSiteValue()\n
+\n
+# \'site_content\' is the tree of sections/subsections/documents of the web site.\n
 # Here is the description of data structure:\n
-#   site_map = [ {}                    <- first_level object #1\n
-#              , {}                    <- first_level object #2\n
-#              , {\'sub-content\': []}   <- first_level object #3 with sub objects\n
-#              ]\n
+#   site_content = [ {}                    <- first_level object #1\n
+#                  , {}                    <- first_level object #2\n
+#                  , {\'sub-content\': []}   <- first_level object #3 with sub objects\n
+#                  ]\n
 # {dict} contain properties of the object\n
 # [list] can be ordered\n
-\n
-site_map = [{ \'sub-content\':\'\'}]\n
-\n
-main_sections = site_root.WebSite_getMainSection()\n
-\n
-return repr(main_sections)\n
+site_content = []\n
+\n
+# Start browsing the site from main sections\n
+for section in site_root.WebSite_getMainSectionList():\n
+  sub_doc_list = section.WebSite_getDocumentValueList() or []\n
+  sub_content_list = []\n
+  section_url = section.absolute_url()\n
+  # Get sub sections and content of each main section\n
+  for sub_doc in sub_doc_list:\n
+    sub_content_list.append({\n
+        \'title\'      : sub_doc.ERP5Web_getVerboseTitle()\n
+      , \'link\'       : "%s/%s" % (section_url, WebDocument_getURI(sub_doc))\n
+      , \'object\'     : sub_doc\n
+      , \'sub-content\': []\n
+      })\n
+  site_content.append({\n
+        \'title\'      : section.ERP5Web_getVerboseTitle()\n
+      , \'link\'       : section_url\n
+      , \'object\'     : section\n
+      , \'sub-content\': sub_content_list\n
+      })\n
+\n
+if include_site:\n
+  # Add the most upper object: the website site itself\n
+  site_map = {\n
+      \'title\'       : "%s - Home" % (site_root.getTitle())\n
+    , \'link\'        : site_root.absolute_url()\n
+    , \'object\'      : site_root\n
+    , \'sub-content\' : site_content\n
+    }\n
+else:\n
+  site_map = site_content\n
+\n
+return site_map\n
 
 
 ]]></string> </value>
@@ -104,17 +142,13 @@
         </item>
         <item>
             <key> <string>_filepath</string> </key>
-            <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getSiteMap</string> </value>
-        </item>
-        <item>
-            <key> <string>_owner</string> </key>
             <value>
               <none/>
             </value>
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>site_root=None</string> </value>
+            <value> <string>show_pages=True, include_site=True, depth_limit=None</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -134,19 +168,27 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>1</int> </value>
+                        <value> <int>3</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
+                            <string>show_pages</string>
+                            <string>include_site</string>
+                            <string>depth_limit</string>
+                            <string>WebDocument_getURI</string>
+                            <string>_getattr_</string>
+<string>context</string>
                             <string>site_root</string>
-                            <string>None</string>
-                            <string>_getattr_</string>
-                            <string>context</string>
+                            <string>site_content</string>
+                            <string>_getiter_</string>
+                            <string>section</string>
+                            <string>sub_doc_list</string>
+                            <string>sub_content_list</string>
+                            <string>section_url</string>
+                            <string>sub_doc</string>
                             <string>site_map</string>
-                            <string>main_sections</string>
-                            <string>repr</string>
                           </tuple>
                         </value>
                     </item>
@@ -159,6 +201,8 @@
             <key> <string>func_defaults</string> </key>
             <value>
               <tuple>
+                <int>1</int>
+                <int>1</int>
                 <none/>
               </tuple>
             </value>




More information about the Erp5-report mailing list