diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml index 1e7f529a98600dd2126b3169f790d0fcaf69544d..c963de2f8f17757c68b826e0bcfe0df254645969 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml @@ -97,7 +97,7 @@ portal_catalog = container.portal_catalog\n \n # First find the web section we are in\n current_node = context\n -while not current_node.getPortalType() in (\'Web Section\', \'Web Site\', \'Domain\'):\n +while not current_node.getPortalType() in (\'Web Section\', \'Web Site\'):\n current_node = current_node.aq_parent\n \n # Then find the publication categories referenced by the web section\n @@ -113,7 +113,7 @@ def checkMember(x):\n return x\n \n # get all web pages and check if their publication category is in the category list of the web section\n -#reference_list = map(lambda x:x.getReference(), context.getSourceValueList(portal_type="Web Page"))\n +# reference_list = map(lambda x:x.getReference(), context.getSourceValueList(portal_type="Web Page"))\n reference_list = map(lambda x:x.getReference(), portal_catalog(portal_type=(\'Web Page\',)))\n if reference_list:\n li = filter(checkMember, list(context.portal_catalog(portal_type="Web Page")) )\n @@ -121,17 +121,21 @@ if reference_list:\n else:\n my_list=[]\n \n -if hasattr(context,\'getAggregateList\'):\n - aggregate_values = context.getAggregateList()\n +# get al web pages associated to the section by aggregate-relation\n +if hasattr(current_node,\'getAggregateList\'):\n + aggregate_values = current_node.getAggregateList()\n aggregate_values = map(context.restrictedTraverse,aggregate_values)\n - li.extend(aggregate_values) # this causes a crash\n - context.log("AVVVVVV",aggregate_values)\n -\n + li.extend(aggregate_values) \n \n -def abcd(x):\n - return x#.getPortalType()\n +# Remove Duplicate entries in my_list\n +my_clean_list=[]\n +my_reference_list=[]\n +for my_element in my_list:\n + if not my_element.getReference() in my_reference_list:\n + my_clean_list.append(my_element)\n + my_reference_list.append(my_element.getReference())\n \n -return map(abcd,my_list)\n +return my_clean_list\n \n \n ## FYI - old implementation - broken\n @@ -244,7 +248,10 @@ return map(abcd,my_list)\n <string>my_list</string> <string>hasattr</string> <string>aggregate_values</string> - <string>abcd</string> + <string>my_clean_list</string> + <string>my_reference_list</string> + <string>_getiter_</string> + <string>my_element</string> </tuple> </value> </item> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml index e524eebc88b06989eeb6732b9a0e15ecc32b41a9..2fdddffce14406cd65a15e687e7ba002959247a0 100644 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml @@ -68,9 +68,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -# This script is part of ERP5 Web\n + <value> <string># This script is part of ERP5 Web\n #\n # ERP5 Web is an extension to ERP5 which provides a way\n # to create web sites which can display selected\n @@ -101,51 +99,22 @@ # NOTE: it is still unknown whether this script\n # needs to be integrated or not to the absolute_url API\n \n -# FYI old implementation\n -\n # First build the main section URL\n main_section = context\n main_section_path = None\n -#while main_section_path is None and main_section is not None:\n -# if hasattr(main_section, \'getPortalType\'):\n -# if main_section.getPortalType() == \'Web Section\':\n -# main_section_path = str(main_section.getObject().absolute_url())\n -# elif main_section.getPortalType() == \'Web Site\':\n -# main_section_path = str(main_section.getObject().absolute_url())\n -# main_section = main_section.aq_parent\n -while hasattr(main_section,\'aq_parent\'):\n +while hasattr(main_section,\'aq_parent\') and hasattr(main_section,\'getPortalType\') and main_section.getPortalType()!="Web Section" and main_section.getPortalType()!="Web Site":\n main_section_path = str(main_section.absolute_url())\n main_section = main_section.aq_parent\n \n +# then, if context is a web page, the reference must be added to the URL\n +my_reference=None\n +if hasattr(context,\'getReference\'):\n + my_reference = context.getReference()\n +if my_reference==None:\n + my_reference=""\n \n -\n -# Then get the object\n -brain=None\n -if brain is None: brain=context\n -object = brain.getObject()\n -#if object is not None:\n -# if object.hasReference():\n -# reference = object.getReference()\n -# else:\n -# reference = None\n -#else:\n -# return ""\n -\n -#if reference:\n -# return "%s/%s" % (main_section_path, reference)\n -\n -if context.getPortalType()=="Web Page":\n - billl=context.WebSite_getBreadcrumbItemList()\n - billl=billl[1][1].WebSite_getDocumentUrl() #get the URL of the section\n - if context.getReference() is None:\n - return "ERROR: Reference-Attribute Missing for"+repr(context)\n - return billl+"/"+context.getReference()\n -#context.log("hello",context.title+"==>"+context.aq_parent.WebSite_getDocumentUrl()+"--"+context.aq_inner.getUrl()+"--"+context.aq_inner.absolute_url()+"--"+context.aq_parent.absolute_url())\n -\n -return "%s/%s" % (main_section_path, object.getRelativeUrl())\n - - -]]></string> </value> +return main_section.absolute_url() + "/" + my_reference\n +</string> </value> </item> <item> <key> <string>_code</string> </key> @@ -198,13 +167,9 @@ return "%s/%s" % (main_section_path, object.getRelativeUrl())\n <string>None</string> <string>main_section_path</string> <string>hasattr</string> - <string>str</string> <string>_getattr_</string> - <string>brain</string> - <string>object</string> - <string>billl</string> - <string>_getitem_</string> - <string>repr</string> + <string>str</string> + <string>my_reference</string> </tuple> </value> </item> diff --git a/bt5/erp5_web/bt/change_log b/bt5/erp5_web/bt/change_log index 2a6adebec580fc85d5f39466729be21d8a1482aa..a16399bcd015ffb57e8fb22e11a5744a9739387f 100644 --- a/bt5/erp5_web/bt/change_log +++ b/bt5/erp5_web/bt/change_log @@ -1,3 +1,9 @@ +2006-08-24 Stefan +* URLs work with and without virtual hosting. +* No duplicate entries in WebSection_getDocumentValueList() if a page is associated by aggregate and also in a relevant publication section. +* Problem with WebSection_getDocumentValueList() fixed (aggregated pages were not in the list form this context). +* Removed some context.log() entries. + 2006-08-23 Stefan * First rework of Web API scripts. diff --git a/bt5/erp5_web/bt/revision b/bt5/erp5_web/bt/revision index 725cdcde65066b900790a2033dd6e9be01d6ba96..fb351815657b5e2d423f156c000b624c3a74b73d 100644 --- a/bt5/erp5_web/bt/revision +++ b/bt5/erp5_web/bt/revision @@ -1 +1 @@ -193 \ No newline at end of file +197 \ No newline at end of file diff --git a/bt5/erp5_web/bt/version b/bt5/erp5_web/bt/version index 9fc80f937fab96c3d0109624aca8028d0f3edff6..87a0871112f9244bbad0fc8331376317417760b9 100644 --- a/bt5/erp5_web/bt/version +++ b/bt5/erp5_web/bt/version @@ -1 +1 @@ -0.3.2 \ No newline at end of file +0.3.3 \ No newline at end of file