diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core.xml new file mode 100644 index 0000000000000000000000000000000000000000..ec86d387aba6c7815de72f59a6891a1356b2fa10 --- /dev/null +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="Folder" module="OFS.Folder"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>erp5_ical_core</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core/ical_view.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core/ical_view.xml new file mode 100644 index 0000000000000000000000000000000000000000..d5ca915bad9e3d9ff6644c3026ee635dd02e2efc --- /dev/null +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_core/ical_view.xml @@ -0,0 +1,87 @@ +<?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>__ac_local_roles__</string> </key> + <value> + <none/> + </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_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 metal:define-macro="master"\n +><tal:block tal:define="dummy python: request.RESPONSE.setHeader(\'Content-Type\', \'text/calendar;; charset=utf-8\');\n + ical_string string:iCal;\n + dummy python: context.getPortalObject().portal_skins.changeSkin(ical_string);\n + dummy python: request.set(\'portal_skin\', ical_string);"\n +><tal:block tal:define="listbox_fields python: [field for field in form.get_fields() if\n + (field.meta_type == \'ListBox\' or \n + field.meta_type == \'ProxyField\' and\n + field.getRecursiveTemplateField().meta_type == \'ListBox\')]"\n +>BEGIN:VCALENDAR\n +VERSION:2.0\n +PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN\n +<tal:block tal:repeat="listbox_field listbox_fields"\n +><tal:block tal:content="structure python: listbox_field.render()"/></tal:block\n +>END:VCALENDAR</tal:block\n +></tal:block\n +></tal:block> + +]]></string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ical_view</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style.xml index af1b38ab10c3c0c4c8cfdab28eb7fa620b4616f3..ce00b9857c5fb3c71fd60796eb1f360ae12749f4 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>OFS.Folder</string> - <string>Folder</string> - </tuple> - <none/> + <global name="Folder" module="OFS.Folder"/> + <tuple/> </tuple> </pickle> <pickle> @@ -18,12 +15,39 @@ <none/> </value> </item> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>business_template_registered_skin_selections</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> <item> <key> <string>_objects</string> </key> <value> <tuple/> </value> </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>business_template_registered_skin_selections</string> </key> + <value> <string>iCal</string> </value> + </item> <item> <key> <string>id</string> </key> <value> <string>erp5_ical_style</string> </value> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalCategory.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalCategory.xml index a5647eaf428d139ef3ab24e6cb698ebf7e4b5b30..33c05c22387370f2a4dc94c47b3eb3beac26d1a5 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalCategory.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalCategory.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -74,11 +71,18 @@ or events related to the same sale opportunity)\n """\n project = None\n -ptype = context.getPortalType()\n -if ptype == \'Task\':\n - project = context.getSourceProjectValue()\n -if ptype in context.getPortalEventTypeList():\n - project = context.getFollowUpValue()\n +\n +if brainObject is not None:\n + real_context = brainObject\n +else:\n + real_context = context\n +\n +portal_type = real_context.getPortalType()\n +if portal_type == \'Task\':\n + project = real_context.getSourceProjectValue()\n +elif portal_type in context.getPortalEventTypeList():\n + project = real_context.getFollowUpValue()\n +\n if project is not None:\n # we have to tweak here because not all object have references\n if hasattr(project, \'getReference\'):\n @@ -102,7 +106,7 @@ return \'\'\n </item> <item> <key> <string>_params</string> </key> - <value> <string></string> </value> + <value> <string>brainObject=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -122,17 +126,19 @@ return \'\'\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>brainObject</string> <string>None</string> <string>project</string> - <string>_getattr_</string> + <string>real_context</string> <string>context</string> - <string>ptype</string> + <string>_getattr_</string> + <string>portal_type</string> <string>hasattr</string> </tuple> </value> @@ -145,7 +151,9 @@ return \'\'\n <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalComponent.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalComponent.xml index 2da23b4491620f2748b5bed9deff3436c22bffcf..24a894f5d41f66e51114efc0fcb29e204728ba11 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalComponent.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalComponent.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -69,17 +66,21 @@ <item> <key> <string>_body</string> </key> <value> <string>"""\n - Figure out if it is an event or a todo.\n + Figure out if it is an journal, event or a todo.\n Sample implementation: Task is a todo, event is an event, \n - anything else is an event too.\n + anything else is an journal.\n """\n +portal_type = None\n +if brainObject is not None:\n + portal_type = brainObject.getPortalType()\n +else:\n + portal_type = context.getPortalType()\n \n -ptype = context.getPortalType()\n -if ptype == \'Task\':\n +if portal_type == \'Task\':\n return \'todo\'\n -if ptype in context.getPortalEventTypeList():\n +elif portal_type in context.getPortalEventTypeList():\n return \'event\'\n -return \'event\'\n +return \'journal\'\n </string> </value> </item> <item> @@ -96,7 +97,7 @@ return \'event\'\n </item> <item> <key> <string>_params</string> </key> - <value> <string></string> </value> + <value> <string>brainObject=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -116,15 +117,17 @@ return \'event\'\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>brainObject</string> + <string>None</string> + <string>portal_type</string> <string>_getattr_</string> <string>context</string> - <string>ptype</string> </tuple> </value> </item> @@ -136,7 +139,9 @@ return \'event\'\n <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalPercentComplete.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalPercentComplete.xml index 4cb58560abde6881085c35d48c33a8b7ec42c416..4bf9d6d023d92216e030ba45b56fbc390dac9a21 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalPercentComplete.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalPercentComplete.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -68,7 +65,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>return context.Base_getICalStatusItem()[1]\n + <value> <string>return context.Base_getICalStatusItem(brainObject)[1]\n </string> </value> </item> <item> @@ -85,7 +82,7 @@ </item> <item> <key> <string>_params</string> </key> - <value> <string></string> </value> + <value> <string>brainObject=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -105,15 +102,16 @@ <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>brainObject</string> <string>_getitem_</string> <string>_getattr_</string> -<string>context</string> + <string>context</string> </tuple> </value> </item> @@ -125,7 +123,9 @@ <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatus.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatus.xml index 75a5938d7c040aa7681eedf795da889cd125ab67..971868e70b4b51c910f8aa380e3d4f6a7eac372b 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatus.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatus.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -68,7 +65,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>return context.Base_getICalStatusItem()[0]\n + <value> <string>return context.Base_getICalStatusItem(brainObject)[0]\n </string> </value> </item> <item> @@ -85,7 +82,7 @@ </item> <item> <key> <string>_params</string> </key> - <value> <string></string> </value> + <value> <string>brainObject=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -105,12 +102,13 @@ <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>brainObject</string> <string>_getitem_</string> <string>_getattr_</string> <string>context</string> @@ -125,7 +123,9 @@ <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatusItem.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatusItem.xml index 04574446672f243b7cb7dc08b72c6a7d1ae7f248..b5fee493c6618af9cbc97398648db665b4f92202 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatusItem.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Base_getICalStatusItem.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + <tuple/> </tuple> </pickle> <pickle> @@ -69,17 +66,15 @@ <item> <key> <string>_body</string> </key> <value> <string>"""\n - Give an ICal status and percent-completed for a todo entry.\n + Give an ICal status and percent-completed for a todo entry and status for a event entry.\n Return a tuple of (status, percent_complete).\n - Status is one of: \'needs-action\', \'in-process\', \'completed\' and \'cancelled\'\n - or nothing, then we\'ll assume it is \'needs-action\'.\n - Sample implementation for a Task:\n + For todo status is one of: \'needs-action\', \'in-process\', \'completed\' and \'cancelled\' or nothing,\n + then we\'ll assume it is \'needs-action\'.\n + For event status is one of: \'cancelled\', \'confirmed\', \'tentative\' or nothing, \n + then we\'ll assume it is \'tentative\'.\n """\n -\n -if context.getPortalType() != \'Task\':\n - return (\'\', 0)\n -\n -status_map = {\n +status = \'\'\n +status_map_task = {\n \'draft\' : (\'needs-action\', 0),\n \'planned\' : (\'needs-action\', 33),\n \'ordered\' : (\'in-process\', 66),\n @@ -87,7 +82,26 @@ status_map = {\n \'cancelled\' : (\'cancelled\', 0)\n }\n \n -return status_map.get(context.getSimulationState(), (\'\', 0))\n +status_map_event = {\n + \'CANCELLED\' : (\'expired\', \'deleted\', \'cancelled\'),\n + \'CONFIRMED\' : (\'started\', \'responded\', \'delivered\', \'assigned\', \'acknowledged\'),\n + \'TENTATIVE\' : (\'draft\', \'planned\', \'new\', \'ordered\')\n +}\n +\n +if brainObject is not None:\n + real_context = brainObject\n +else:\n + real_context = context\n +\n +portal_type = real_context.getPortalType()\n +if portal_type == \'Task\':\n + return status_map_task.get(real_context.getSimulationState(), (\'\', 0))\n +elif portal_type in context.getPortalEventTypeList():\n + for status_item in status_map_event:\n + if real_context.getSimulationState() in status_map_event[status_item]:\n + status = status_item\n + break\n +return (status, 0)\n </string> </value> </item> <item> @@ -104,7 +118,7 @@ return status_map.get(context.getSimulationState(), (\'\', 0))\n </item> <item> <key> <string>_params</string> </key> - <value> <string></string> </value> + <value> <string>brainObject=None</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -124,15 +138,24 @@ return status_map.get(context.getSimulationState(), (\'\', 0))\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> - <string>_getattr_</string> + <string>brainObject</string> + <string>status</string> + <string>status_map_task</string> + <string>status_map_event</string> + <string>None</string> + <string>real_context</string> <string>context</string> - <string>status_map</string> + <string>_getattr_</string> + <string>portal_type</string> + <string>_getiter_</string> + <string>status_item</string> + <string>_getitem_</string> </tuple> </value> </item> @@ -144,7 +167,9 @@ return status_map.get(context.getSimulationState(), (\'\', 0))\n <item> <key> <string>func_defaults</string> </key> <value> - <none/> + <tuple> + <none/> + </tuple> </value> </item> <item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal.xml index 6e389ab5e9b943addf5d5c20971967936bd65127..c84942855cb601db83d34b6d2b3764bb69e42487 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.ERP5Form.Form</string> - <string>ERP5Form</string> - </tuple> - <none/> + <global name="ERP5Form" module="Products.ERP5Form.Form"/> + <tuple/> </tuple> </pickle> <pickle> @@ -49,6 +46,16 @@ <key> <string>action</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>edit_order</string> </key> + <value> + <list/> + </value> + </item> <item> <key> <string>encoding</string> </key> <value> <string>UTF-8</string> </value> @@ -74,7 +81,7 @@ <value> <dictionary> <item> - <key> <string>bottom</string> </key> + <key> <string>bottom</string> </key> <value> <list> <string>listbox</string> @@ -82,25 +89,25 @@ </value> </item> <item> - <key> <string>center</string> </key> + <key> <string>center</string> </key> <value> <list/> </value> </item> <item> - <key> <string>hidden</string> </key> + <key> <string>hidden</string> </key> <value> <list/> </value> </item> <item> - <key> <string>left</string> </key> + <key> <string>left</string> </key> <value> <list/> </value> </item> <item> - <key> <string>right</string> </key> + <key> <string>right</string> </key> <value> <list/> </value> @@ -118,11 +125,11 @@ </item> <item> <key> <string>name</string> </key> - <value> <string>Folder_asRSS</string> </value> + <value> <string>Folder_viewContentListAsICal</string> </value> </item> <item> <key> <string>pt</string> </key> - <value> <string>template_ical_style</string> </value> + <value> <string>ical_view</string> </value> </item> <item> <key> <string>row_length</string> </key> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal/listbox.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal/listbox.xml index f58a7864d65c60342ec8b2d12865d1020af4f3af..db24bfd1fa2a07a5fb01be5eff23efc9f19dc29d 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal/listbox.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Folder_viewContentListAsICal/listbox.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.ERP5Form.ListBox</string> - <string>ListBox</string> - </tuple> - <none/> + <global name="ListBox" module="Products.ERP5Form.ListBox"/> + <tuple/> </tuple> </pickle> <pickle> @@ -319,49 +316,53 @@ <key> <string>alternate_name</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>anchor</string> </key> + <value> <int>0</int> </value> + </item> <item> <key> <string>columns</string> </key> <value> <list> <tuple> <string>title</string> - <string>ical_summary</string> + <string>summary</string> </tuple> <tuple> <string>creation_date</string> - <string>ical_created</string> + <string>created</string> </tuple> <tuple> <string>modification_date</string> - <string>ical_last-modified</string> + <string>last-modified</string> </tuple> <tuple> <string>uid</string> - <string>ical_uid</string> + <string>uid</string> </tuple> <tuple> <string>start_date</string> - <string>ical_dtstart</string> + <string>dtstart</string> </tuple> <tuple> <string>stop_date</string> - <string>ical_dtend</string> + <string>dtend</string> </tuple> <tuple> <string>Base_getICalComponent</string> - <string>ical_component</string> + <string>component</string> </tuple> <tuple> <string>Base_getICalCategory</string> - <string>ical_categories</string> + <string>categories</string> </tuple> <tuple> <string>Base_getICalStatus</string> - <string>ical_status</string> + <string>status</string> </tuple> <tuple> <string>Base_getICalPercentComplete</string> - <string>ical_percent-complete</string> + <string>percent-complete</string> </tuple> </list> </value> @@ -444,7 +445,7 @@ </item> <item> <key> <string>page_template</string> </key> - <value> <string>Listbox_viewAsICal</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>portal_types</string> </key> @@ -521,11 +522,8 @@ <record id="2" aka="AAAAAAAAAAI="> <pickle> <tuple> - <tuple> - <string>Products.Formulator.MethodField</string> - <string>Method</string> - </tuple> - <none/> + <global name="Method" module="Products.Formulator.MethodField"/> + <tuple/> </tuple> </pickle> <pickle> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/ListBox_asHTML.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/ListBox_asHTML.xml new file mode 100644 index 0000000000000000000000000000000000000000..246d3aa295d6faaec7a93393b923a79e988370b8 --- /dev/null +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/ListBox_asHTML.xml @@ -0,0 +1,205 @@ +<?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>_Access_contents_information_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_bindings_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_cache_settings_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_permissions_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_FTP_access_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Manage_WebDAV_Locks_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Manage_properties_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Take_ownership_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Undo_changes_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_View_management_screens_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_Lock_items_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_Unlock_items_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_access_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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_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 \n + xmlns:tal="http://xml.zope.org/namespaces/tal"\n + xmlns:i18n="http://xml.zope.org/namespaces/i18n"\n + tal:define="line_list here/query;\n + label_list here/getLabelValueList;\n + real_context here/getContext;"\n +><tal:block tal:replace="structure python: real_context.Listbox_asICal(label_list, line_list)"/></tal:block> + +]]></string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/calendar; charset=utf-8</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ListBox_asHTML</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_asICal.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_asICal.xml new file mode 100644 index 0000000000000000000000000000000000000000..cdedb29897bab0ec13726d6a54d315701e4ec1c8 --- /dev/null +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_asICal.xml @@ -0,0 +1,337 @@ +<?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>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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>"""\n + An ICal data format implementation.\n + USAGE\n + Data are drawn from a listbox as they are;\n + mandatory columns: (\'summary\', \'description\', \'created\', \'dtstamp\', \'last-modified\', \'uid\', \'dtstart\', \'dtend\', \'component\', \'url\')\n + optional columns: (\'location\', \'status\', \'completed\', \'percent-complete\', \'categories\')\n + Title (summary) can be anything, same for description, location and categories (categories can be one word or a comma-separated list, although not all clients can use multiple categories).\n + Component can be "journal", "event" or "todo".\n + Dates should be returned by listbox with no extra processing - the script formats them appropriately.\n + \'completed\' and \'percent-complete\' is valid only for todo\n + \'status\' is valid for todo and can be: needs-action|completed|in-process|cancelled (default is needs-action)\n + \'status\' is valid for event and can be: tentative|confirmed|cancelled\n + PREPROCESSING\n + If no start date is given, we take created\n + If no stop date is given, we take start date\n + For "todo" if status is \'completed\' and no percent-complete is given, we take 100%.\n + For "todo" if status is \'completed\' and no completed date is given, we take dtend.\n + IMPLEMENTATION DETAILS:\n + dtstamp = indicates the date/time that the instance of the iCalendar object was created.\n + due (in VTODO) = dtend\n + dates are formatted "YYYYMMDDTHHMMSSZ" (which is HTML4 without separators).\n + all dates are converted to GMT, then the client will adjust them to its local timezone\n +"""\n +from DateTime import DateTime\n +now = DateTime()\n +allowed_field_list = (\'summary\', \'description\', \'created\', \n + \'last-modified\', \'uid\', \'dtstamp\', \n + \'dtstart\', \'dtend\', \'component\', \'url\', \n + \'location\', \'categories\', \'status\', \n + \'completed\', \'percent-complete\')\n +allowed_status_list_todo = (\'COMPLETED\', \'IN-PROCESS\', \n + \'CANCELLED\', \'NEEDS-ACTION\')\n +\n +# mapping listbox column headers with iCalendar properties\n +# if listbox column headers are more than one the index of first occured in listbox columns is getting\n +related_column_map = {\n + \'summary\' : (\'title\',),\n + \'created\' : (\'creation date\',),\n + \'last-modified\' : (\'modification date\',),\n + \'dtstart\' : (\'start date\', \'begin date\',),\n + \'dtend\' : (\'stop date\', \'end date\',)\n +}\n +\n +def convertDate(value):\n + """ Format dates. """\n + if hasattr(value, \'toZone\'):\n + # we dont specify time zone in the file, \n + # but recalculate everything into UTC\n + value = value.toZone(\'UTC\')\n + value = value.HTML4()\n + value = value.replace(\'-\', \'\')\n + value = value.replace(\':\', \'\')\n + return value\n +\n +# figure out which column is which, by using column titles\n +ical_column_mapping = {}\n +for index, column_item in enumerate(label_list):\n + column_header = column_item[1].lower()\n + if column_header in allowed_field_list:\n + ical_column_mapping[column_header] = index\n + continue\n + for related_column in related_column_map:\n + if column_header in related_column_map[related_column] and \\\n + related_column not in ical_column_mapping:\n + ical_column_mapping[related_column] = index\n + break\n +\n +for index, column_item in enumerate(label_list):\n + column_header = column_item[1].lower()\n + if column_header == \'date\':\n + if column_item[0].find(\'start_date\') or column_item[0].find(\'startdate\'):\n + if not ical_column_mapping.get(\'dtstart\', None):\n + ical_column_mapping[\'dtstart\'] = index\n + elif column_item[0].find(\'end_date\') or column_item[0].find(\'enddate\'):\n + if not ical_column_mapping.get(\'dtstart\', None):\n + ical_column_mapping[\'dtend\'] = index\n +\n +items = []\n +for line in line_list:\n + brainObject = line.getBrain()\n + column_item_list = line.getValueList()\n + ical_item_dict = {}\n + # collect values\n + for header, index in ical_column_mapping.items():\n + value_tuple = column_item_list[index]\n + # the [0] is a raw value, the [1] is rendered; we want strings rendered (as unicode),\n + # but other stuff (like int or DateTime) we want as they are\n + if hasattr(value_tuple[0], \'lower\'):\n + value = value_tuple[1]\n + else:\n + if isinstance(value_tuple[0], DateTime):\n + value = convertDate(value_tuple[0])\n + else:\n + value = value_tuple[0]\n + ical_item_dict[header.upper()] = value\n +\n + for field in allowed_field_list:\n + field_upper = field.upper()\n + if field_upper not in ical_item_dict:\n + if field_upper == \'SUMMARY\' and hasattr(brainObject, \'getTitle\'):\n + ical_item_dict[\'SUMMARY\'] = brainObject.getTitle()\n + elif field_upper == \'DESCRIPTION\' and hasattr(brainObject, \'getDescription\'):\n + ical_item_dict[\'DESCRIPTION\'] = brainObject.getDescription()\n + elif field_upper == \'CREATED\' and hasattr(brainObject, \'getCreationDate\'):\n + ical_item_dict[\'CREATED\'] = convertDate(brainObject.getCreationDate())\n + elif field_upper == \'LAST-MODIFIED\' and hasattr(brainObject, \'getModificationDate\'):\n + ical_item_dict[\'LAST-MODIFIED\'] = convertDate(brainObject.getModificationDate())\n + elif field_upper == \'UID\' and hasattr(brainObject, \'getUid\'):\n + ical_item_dict[\'UID\'] = brainObject.getUid()\n + elif field_upper == \'COMPONENT\':\n + if hasattr(brainObject, \'getPortalType\'):\n + ical_item_dict[\'COMPONENT\'] = context.Base_getICalComponent(brainObject)\n + else:\n + ical_item_dict[\'COMPONENT\'] = \'journal\'\n + elif field_upper == \'URL\' and hasattr(brainObject, \'absolute_url\'):\n + ical_item_dict[\'URL\'] = brainObject.absolute_url() + \'/view\'\n + elif field_upper == \'DTSTAMP\':\n + ical_item_dict[\'DTSTAMP\'] = convertDate(now)\n + elif field_upper == \'DTSTART\':\n + if hasattr(line.getBrain(), \'getCreationDate\'):\n + ical_item_dict[\'DTSTART\'] = convertDate(brainObject.getCreationDate())\n + else:\n + ical_item_dict[\'DTSTART\'] = convertDate(now)\n + elif field_upper == \'DTEND\':\n + ical_item_dict[\'DTEND\'] = ical_item_dict[\'DTSTART\']\n + elif field_upper == \'CATEGORIES\' and ical_item_dict[\'COMPONENT\'] != \'journal\' and \\\n + hasattr(brainObject, \'getPortalType\'):\n + ical_item_dict[\'CATEGORIES\'] = context.Base_getICalCategory(brainObject)\n + elif field_upper == \'STATUS\' and ical_item_dict[\'COMPONENT\'] != \'journal\' and \\\n + hasattr(brainObject, \'getPortalType\'):\n + ical_item_dict[\'STATUS\'] = context.Base_getICalStatus(brainObject)\n + elif field_upper == \'PERCENT-COMPLETE\' and ical_item_dict[\'COMPONENT\'] == \'todo\' and \\\n + hasattr(brainObject, \'getPortalType\'):\n + ical_item_dict[\'PERCENT-COMPLETE\'] = context.Base_getICalPercentComplete(brainObject)\n +\n + # check and process\n + if ical_item_dict[\'DTSTART\'] is None:\n + ical_item_dict[\'DTSTART\'] = ical_item_dict[\'CREATED\']\n + if ical_item_dict[\'DTEND\'] is None:\n + ical_item_dict[\'DTEND\'] = ical_item_dict[\'DTSTART\']\n +\n + # check and fix for todo and event\n + if ical_item_dict[\'COMPONENT\'] == \'todo\':\n + status = ical_item_dict.get(\'STATUS\', False)\n + if status:\n + status = status.upper()\n + ical_item_dict[\'STATUS\'] = status\n + if status not in allowed_status_list_todo:\n + raise ValueError(\'ICal status %s is not allowed\' % status)\n + if status == \'COMPLETED\':\n + if not ical_item_dict.get(\'PERCENT-COMPLETE\', False):\n + ical_item_dict[\'PERCENT-COMPLETE\'] = 100\n + if not ical_item_dict.get(\'COMPLETED\', False):\n + ical_item_dict[\'COMPLETED\'] = ical_item_dict[\'DTEND\']\n + else:\n + ical_item_dict[\'STATUS\'] = \'NEEDS-ACTION\'\n + if not ical_item_dict.get(\'PERCENT-COMPLETE\', False):\n + ical_item_dict[\'PERCENT-COMPLETE\'] = 0\n + elif ical_item_dict[\'COMPONENT\'] == \'event\':\n + status = ical_item_dict.get(\'STATUS\', False)\n + if not status:\n + ical_item_dict[\'STATUS\'] = \'TENTATIVE\'\n + items.append(ical_item_dict)\n +\n +return context.Listbox_renderAsICal(items=items)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>label_list, line_list</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>2</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>label_list</string> + <string>line_list</string> + <string>DateTime</string> + <string>now</string> + <string>allowed_field_list</string> + <string>allowed_status_list_todo</string> + <string>related_column_map</string> + <string>convertDate</string> + <string>ical_column_mapping</string> + <string>_getiter_</string> + <string>enumerate</string> + <string>index</string> + <string>column_item</string> + <string>_getattr_</string> + <string>_getitem_</string> + <string>column_header</string> + <string>_write_</string> + <string>related_column</string> + <string>None</string> + <string>items</string> + <string>line</string> + <string>brainObject</string> + <string>column_item_list</string> + <string>ical_item_dict</string> + <string>header</string> + <string>value_tuple</string> + <string>hasattr</string> + <string>value</string> + <string>isinstance</string> + <string>field</string> + <string>field_upper</string> + <string>context</string> + <string>False</string> + <string>status</string> + <string>ValueError</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>Listbox_asICal</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_renderAsICal.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_renderAsICal.xml index c69f5e4c052044b3ae4144f67bad0de7c628c714..da557765a31d3b6b94346eb7377c66a20227fcb5 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_renderAsICal.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_renderAsICal.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>OFS.DTMLMethod</string> - <string>DTMLMethod</string> - </tuple> - <none/> + <global name="DTMLMethod" module="OFS.DTMLMethod"/> + <tuple/> </tuple> </pickle> <pickle> @@ -38,39 +35,110 @@ <key> <string>raw</string> </key> <value> <string encoding="cdata"><![CDATA[ -BEGIN:VCALENDAR\n -VERSION:2.0\n -PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN\n <dtml-in prefix="loop" expr="items">\n +<dtml-if expr="loop_item[\'COMPONENT\']==\'journal\'">\n +BEGIN:VJOURNAL\n +<dtml-if expr="loop_item.get(\'CREATED\')">\n +CREATED:<dtml-var expr="loop_item[\'CREATED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'LAST-MODIFIED\')">\n +LAST-MODIFIED:<dtml-var expr="loop_item[\'LAST-MODIFIED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTAMP\')">\n +DTSTAMP:<dtml-var expr="loop_item[\'DTSTAMP\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'UID\')">\n +UID:uuid<dtml-var expr="loop_item[\'UID\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'SUMMARY\')">\n +SUMMARY:<dtml-var expr="loop_item[\'SUMMARY\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DESCRIPTION\')">\n +DESCRIPTION:<dtml-var expr="loop_item[\'DESCRIPTION\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTART\')">\n +DTSTART:<dtml-var expr="loop_item[\'DTSTART\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'URL\')">\n +URL:<dtml-var expr="loop_item[\'URL\']">\n +</dtml-if>\n +END:VJOURNAL\n +</dtml-if>\n <dtml-if expr="loop_item[\'COMPONENT\']==\'event\'">\n BEGIN:VEVENT\n +<dtml-if expr="loop_item.get(\'CREATED\')">\n CREATED:<dtml-var expr="loop_item[\'CREATED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'LAST-MODIFIED\')">\n LAST-MODIFIED:<dtml-var expr="loop_item[\'LAST-MODIFIED\']">\n -DTSTAMP:<dtml-var expr="loop_item[\'CREATED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTAMP\')">\n +DTSTAMP:<dtml-var expr="loop_item[\'DTSTAMP\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'UID\')">\n UID:uuid<dtml-var expr="loop_item[\'UID\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'SUMMARY\')">\n SUMMARY:<dtml-var expr="loop_item[\'SUMMARY\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DESCRIPTION\')">\n +DESCRIPTION:<dtml-var expr="loop_item[\'DESCRIPTION\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'STATUS\')">\n +STATUS:<dtml-var expr="loop_item[\'STATUS\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTART\')">\n DTSTART:<dtml-var expr="loop_item[\'DTSTART\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTEND\')">\n DTEND:<dtml-var expr="loop_item[\'DTEND\']">\n -<dtml-if expr="loop_item.get(\'LOCATION\', \'\')">\n -LOCATION:<dtml-var expr="loop_item[\'LOCATION\']">\n </dtml-if>\n -<dtml-if expr="loop_item.get(\'CATEGORIES\', \'\')">\n +<dtml-if expr="loop_item.get(\'URL\')">\n +URL:<dtml-var expr="loop_item[\'URL\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'CATEGORIES\')">\n CATEGORIES:<dtml-var expr="loop_item[\'CATEGORIES\']">\n </dtml-if>\n +<dtml-if expr="loop_item.get(\'LOCATION\')">\n +LOCATION:<dtml-var expr="loop_item[\'LOCATION\']">\n +</dtml-if>\n END:VEVENT\n </dtml-if>\n <dtml-if expr="loop_item[\'COMPONENT\']==\'todo\'">\n BEGIN:VTODO\n +<dtml-if expr="loop_item.get(\'CREATED\')">\n CREATED:<dtml-var expr="loop_item[\'CREATED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'LAST-MODIFIED\')">\n LAST-MODIFIED:<dtml-var expr="loop_item[\'LAST-MODIFIED\']">\n -DTSTAMP:<dtml-var expr="loop_item[\'CREATED\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTAMP\')">\n +DTSTAMP:<dtml-var expr="loop_item[\'DTSTAMP\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'UID\')">\n UID:uuid<dtml-var expr="loop_item[\'UID\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'SUMMARY\')">\n SUMMARY:<dtml-var expr="loop_item[\'SUMMARY\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DESCRIPTION\')">\n +DESCRIPTION:<dtml-var expr="loop_item[\'DESCRIPTION\']">\n +</dtml-if>\n <dtml-if expr="loop_item.get(\'STATUS\')">\n STATUS:<dtml-var expr="loop_item[\'STATUS\']">\n </dtml-if>\n +<dtml-if expr="loop_item.get(\'DTSTART\')">\n DTSTART:<dtml-var expr="loop_item[\'DTSTART\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'DTEND\')">\n DUE:<dtml-var expr="loop_item[\'DTEND\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'URL\')">\n +URL:<dtml-var expr="loop_item[\'URL\']">\n +</dtml-if>\n +<dtml-if expr="loop_item.get(\'CATEGORIES\')">\n +CATEGORIES:<dtml-var expr="loop_item[\'CATEGORIES\']">\n +</dtml-if>\n <dtml-if expr="loop_item.get(\'COMPLETED\')">\n COMPLETED:<dtml-var expr="loop_item[\'COMPLETED\']">\n </dtml-if>\n @@ -80,14 +148,9 @@ PERCENT-COMPLETE:<dtml-var expr="loop_item[\'PERCENT-COMPLETE\']">\n <dtml-if expr="loop_item.get(\'LOCATION\')">\n LOCATION:<dtml-var expr="loop_item[\'LOCATION\']">\n </dtml-if>\n -<dtml-if expr="loop_item.get(\'CATEGORIES\')">\n -CATEGORIES:<dtml-var expr="loop_item[\'CATEGORIES\']">\n -</dtml-if>\n END:VTODO\n </dtml-if>\n -</dtml-in>\n -END:VCALENDAR\n - +</dtml-in> ]]></string> </value> </item> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_viewAsICal.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_viewAsICal.xml deleted file mode 100644 index 7d9e4d78a2b5b4bed4594ac82d5ce6880065a6ee..0000000000000000000000000000000000000000 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/Listbox_viewAsICal.xml +++ /dev/null @@ -1,257 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <tuple> - <tuple> - <string>Products.PythonScripts.PythonScript</string> - <string>PythonScript</string> - </tuple> - <none/> - </tuple> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Python_magic</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>__ac_local_roles__</string> </key> - <value> - <none/> - </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>"""\n - An ICal data format implementation.\n - USAGE\n - Data are drawn from a listbox as they are; a custom listbox is needed, with \n - column titles prefixed with \'ical_\'\n - mandatory columns: (\'summary\', \'created\', \'dtstamp\', \'last-modified\', \'uid\', \'dtstart\', \'dtend\', \'component\')\n - optional columns: (\'location\', \'categories\', \'status\', \'completed\', \'percent-complete\')\n - Title (summary) can be anything, same for location and categories (categories can be one word or a comma-separated\n - list, although not all clients can use multiple categories).\n - Component can be "event" or "todo".\n - Dates should be returned by listbox with no extra processing - the script formats them appropriately.\n - \'status\' is valid only for todo, and can be: needs-action|completed|in-process|cancelled (default is needs-action)\n - PREPROCESSING\n - If start and stop date are the same, we assume it lasts 1 hour.\n - If status is \'completed\' and no percent-complete is given, we take 100%.\n - If status is \'completed\' and no completed date is given, we take dtend.\n - IMPLEMENTATION DETAILS:\n - dtstamp = created\n - due (in VTODO) = dtend\n - dates are formatted "YYYYMMDDTHHMMSSZ" (which is HTML4 without separators).\n - all dates are converted to GMT, then the client will adjust them to its local timezone\n -"""\n -\n -allowed_field_list = (\'summary\', \'created\', \'last-modified\', \'uid\', \'dtstart\', \'dtend\', \'component\', \'location\', \'categories\',\n - \'status\', \'completed\', \'percent-complete\')\n -allowed_status_list = (\'COMPLETED\', \'IN-PROCESS\', \'CANCELLED\', \'NEEDS-ACTION\')\n -\n -# items are taken in the standard listbox way\n -line_list = context.query();\n -label_list = context.getLabelValueList();\n -real_context = context.getContext()\n -\n -# figure out which column is which, by using column titles\n -ical_column_mapping = {}\n -for index, column_item in enumerate(label_list):\n - column_header = column_item[1]\n - if column_header.startswith(\'ical_\'):\n - field_name = column_header[5:]\n - if field_name in allowed_field_list:\n - ical_column_mapping[field_name] = index\n -\n -items = []\n -\n -for line in line_list:\n - column_item_list = line.getValueList()\n - ical_item_dict = {}\n - # collect values\n - for header, index in ical_column_mapping.items():\n - value_tuple = column_item_list[index]\n - # the [0] is a raw value, the [1] is rendered; we want strings rendered (as unicode),\n - # but other stuff (like int or DateTime) we want as they are\n - if hasattr(value_tuple[0], \'lower\'):\n - value = value_tuple[1]\n - else:\n - value = value_tuple[0]\n - ical_item_dict[header.upper()] = value\n - # check and process\n - if not hasattr(ical_item_dict[\'DTSTART\'], \'HTML4\'):\n - # real_context.log(\'Item %(SUMMARY)s has illegal start date: %(DTSTART)s, skipping\' % ical_item_dict) \n - continue\n - if ical_item_dict[\'DTSTART\'] == ical_item_dict[\'DTEND\'] or not hasattr(ical_item_dict[\'DTEND\'], \'HTML4\'):\n - # real_context.log(\'End date %(DTEND)s for item %(SUMMARY)s is empty, illegal or equal to start date, assuming start date + 1 hour\' % ical_item_dict)\n - ical_item_dict[\'DTEND\'] = DateTime(ical_item_dict[\'DTSTART\'].timeTime() + 3600) # add 1 hour\n - # check and fix for todo\n - if ical_item_dict[\'COMPONENT\'] == \'todo\':\n - status = ical_item_dict.get(\'STATUS\', False)\n - if status:\n - status = status.upper()\n - ical_item_dict[\'STATUS\'] = status\n - if status not in allowed_status_list:\n - raise ValueError(\'ICal status %s is not allowed\' % status)\n - if status == \'COMPLETED\':\n - if not ical_item_dict.get(\'PERCENT-COMPLETE\', False):\n - ical_item_dict[\'PERCENT-COMPLETE\'] = 100\n - if not ical_item_dict.get(\'COMPLETED\', False):\n - ical_item_dict[\'COMPLETED\'] = ical_item_dict[\'DTEND\']\n - else:\n - ical_item_dict[\'STATUS\'] = \'NEEDS-ACTION\'\n - # reformat dates\n - for header, value in ical_item_dict.items():\n - if hasattr(value, \'toZone\'):\n - value = value.toZone(\'GMT\') # we dont specify time zone in the file, but recalculate everything into GMT instead\n - value = value.HTML4()\n - value = value.replace(\'-\', \'\')\n - value = value.replace(\':\', \'\')\n - ical_item_dict[header] = value\n - items.append(ical_item_dict)\n -\n -return real_context.Listbox_renderAsICal(items=items)\n -</string> </value> - </item> - <item> - <key> <string>_code</string> </key> - <value> - <none/> - </value> - </item> - <item> - <key> <string>_filepath</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>allowed_field_list</string> - <string>allowed_status_list</string> - <string>_getattr_</string> - <string>context</string> - <string>line_list</string> - <string>label_list</string> - <string>real_context</string> - <string>ical_column_mapping</string> - <string>_getiter_</string> - <string>enumerate</string> - <string>index</string> - <string>column_item</string> - <string>_getitem_</string> - <string>column_header</string> - <string>field_name</string> - <string>_write_</string> - <string>items</string> - <string>line</string> - <string>column_item_list</string> - <string>ical_item_dict</string> - <string>header</string> - <string>value_tuple</string> - <string>hasattr</string> - <string>value</string> - <string>DateTime</string> - <string>False</string> - <string>status</string> - <string>ValueError</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>Listbox_viewAsICal</string> </value> - </item> - <item> - <key> <string>warnings</string> </key> - <value> - <tuple/> - </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/template_ical_style.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_list.xml similarity index 79% rename from bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/template_ical_style.xml rename to bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_list.xml index 6158aed6774edc2506feeb3d802c34592e436ac1..91b76b45158a79cae2d223ca8f2d969fccdfec7b 100644 --- a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/template_ical_style.xml +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_list.xml @@ -3,11 +3,8 @@ <record id="1" aka="AAAAAAAAAAE="> <pickle> <tuple> - <tuple> - <string>Products.PageTemplates.ZopePageTemplate</string> - <string>ZopePageTemplate</string> - </tuple> - <none/> + <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> + <tuple/> </tuple> </pickle> <pickle> @@ -48,12 +45,7 @@ <key> <string>_text</string> </key> <value> <string encoding="cdata"><![CDATA[ -<tal:block tal:define="dummy python:request.RESPONSE.setHeader(\'Content-Type\', \'text/calendar;; charset=utf-8\');"\n -><tal:block tal:define="listbox python:form[\'listbox\'];" \n -><tal:block tal:content="structure python: listbox.render()" />\n -</tal:block>\n -</tal:block>\n - +<tal:block metal:use-macro="here/ical_view/macros/master" /> ]]></string> </value> </item> @@ -67,7 +59,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>template_ical_style</string> </value> + <value> <string>form_list</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_view.xml b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_view.xml new file mode 100644 index 0000000000000000000000000000000000000000..9fd29031457b9e11a8ec1ec62031f436cd8314ca --- /dev/null +++ b/bt5/erp5_ical_style/SkinTemplateItem/portal_skins/erp5_ical_style/form_view.xml @@ -0,0 +1,71 @@ +<?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>__ac_local_roles__</string> </key> + <value> + <none/> + </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_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 metal:use-macro="here/ical_view/macros/master" /> + +]]></string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>text/html</string> </value> + </item> + <item> + <key> <string>expand</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>form_view</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_ical_style/bt/change_log b/bt5/erp5_ical_style/bt/change_log index e6ed9872181fa7fb4d1692035cdc1ac23bff24c1..08f92be695954f749033f3f1f6276b749a866dc8 100644 --- a/bt5/erp5_ical_style/bt/change_log +++ b/bt5/erp5_ical_style/bt/change_log @@ -1,5 +1,8 @@ +2007-07-22 zstoinov +* Make iCal bt5 more generic and add support for dynamic skin selection from URL. + 2007-08-29 -Release-ready. +* Release-ready. 2007-08-13 -First working version. \ No newline at end of file +* First working version. \ No newline at end of file diff --git a/bt5/erp5_ical_style/bt/revision b/bt5/erp5_ical_style/bt/revision index c7930257dfef505fd996e1d6f22f2f35149990d0..da2d3988d7d1a255376770b1e87394ebb42febb3 100644 --- a/bt5/erp5_ical_style/bt/revision +++ b/bt5/erp5_ical_style/bt/revision @@ -1 +1 @@ -7 \ No newline at end of file +14 \ No newline at end of file diff --git a/bt5/erp5_ical_style/bt/template_catalog_datetime_key_list b/bt5/erp5_ical_style/bt/template_catalog_datetime_key_list new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bt5/erp5_ical_style/bt/template_catalog_local_role_key_list b/bt5/erp5_ical_style/bt/template_catalog_local_role_key_list new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bt5/erp5_ical_style/bt/template_catalog_role_key_list b/bt5/erp5_ical_style/bt/template_catalog_role_key_list new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bt5/erp5_ical_style/bt/template_catalog_scriptable_key_list b/bt5/erp5_ical_style/bt/template_catalog_scriptable_key_list new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bt5/erp5_ical_style/bt/template_skin_id_list b/bt5/erp5_ical_style/bt/template_skin_id_list index fb3107484c5aca325e930653dc85f1b67fd1e29b..9130b953c6cc06f4d70b627c8f34c6e4963c4d9f 100644 --- a/bt5/erp5_ical_style/bt/template_skin_id_list +++ b/bt5/erp5_ical_style/bt/template_skin_id_list @@ -1 +1,2 @@ +erp5_ical_core erp5_ical_style \ No newline at end of file diff --git a/bt5/erp5_ical_style/bt/template_tool_id_list b/bt5/erp5_ical_style/bt/template_tool_id_list new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391