[Erp5-report] r21055 - in /experimental/bt5/erp5_core_experimental: SkinTemplateItem/portal...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 21 12:59:30 CEST 2008
Author: mikolaj
Date: Wed May 21 12:59:29 2008
New Revision: 21055
URL: http://svn.erp5.org?rev=21055&view=rev
Log:
2008-05-20 Mikolaj
* added modified time domains needed along the lane_axis title patch for nicer lane_axis display
* calendar holidays taken into consideration for marking special days. If no calendar found only Saturdays and Sundays are coloured.
Added:
experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateDayDomain.xml
experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateMonthDomain.xml
experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateWeekDomain.xml
experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateYearDomain.xml
Modified:
experimental/bt5/erp5_core_experimental/bt/change_log
experimental/bt5/erp5_core_experimental/bt/revision
experimental/bt5/erp5_core_experimental/bt/version
Added: experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateDayDomain.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateDayDomain.xml?rev=21055&view=auto
==============================================================================
--- experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateDayDomain.xml (added)
+++ experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateDayDomain.xml Wed May 21 12:59:29 2008
@@ -1,0 +1,288 @@
+<?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 encoding="cdata"><![CDATA[
+
+from Products.ERP5Type.Message import Message\n
+from Products.ERP5Type.Document import newTempBase\n
+from string import zfill\n
+portal_object = context.getPortalObject()\n
+request = context.REQUEST\n
+domain_list = []\n
+\n
+selection_name = request.get(\'selection_name\')\n
+selection = context.portal_selections.getSelectionFor(\n
+ selection_name, request)\n
+\n
+params = selection.getParams()\n
+bound_start = DateTime(params.get(\'bound_start\', DateTime()))\n
+bound_start = DateTime(bound_start.year() , bound_start.month() , bound_start.day()) \n
+\n
+bound_start = bound_start + params.get(\'bound_variation\', 0)\n
+bound_stop = bound_start + 1\n
+\n
+# Definning date order using user Preference Options\n
+try:\n
+ date_order = context.portal_preferences.getActivePreference().getPreferredDateOrder()\n
+ if (date_order is None) or date_order not in [ \'dmy\', \'ymd\' , \'mdy\' ]:\n
+ date_order = \'ymd\'\n
+except AttributeError:\n
+ date_order = \'ymd\'\n
+\n
+special_day_list = None\n
+if hasattr(context, \'Base_getCalendarHolidayList\'):\n
+ special_day_list = context.Base_getCalendarHolidayList(bound_start,bound_stop)\n
+category_list = []\n
+if depth == 0:\n
+ current_date = bound_start\n
+ # This zoom will show one day divided in columns that represents 1 hour.\n
+ # 1.0/24 means 1 hour in DateTime float format\n
+ hour = 1.0/24\n
+ while current_date < bound_stop:\n
+ # Create one Temp Object\n
+ o = newTempBase(portal_object, id=\'year\' ,uid=\'new_%s\' % zfill(\'year\',4))\n
+ # Setting Axis Dates start and stop\n
+ o.setProperty(\'start\',current_date)\n
+ o.setProperty(\'stop\', current_date + hour)\n
+ o.setProperty(\'relative_position\', int(current_date))\n
+\n
+ # Seting delimiter\n
+ if current_date.hour() == 24:\n
+ o.setProperty(\'delimiter_type\', 1)\n
+ else:\n
+ o.setProperty(\'delimiter_type\', 0)\n
+\n
+ # MIKOLAJ: check if this day is not a holiday in default calendar\n
+ if special_day_list is not None:\n
+ # since current_date changes by the hour we have to use the hourless date - bound_start\n
+ if bound_start in special_day_list:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+ else:\n
+ # if no calendar supplied then just mark Saturdays and Sundays\n
+ if current_date.Day() in [\'Saturday\', \'Sunday\']:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+\n
+ # defining date order\n
+ date_order_list = []\n
+ for i in date_order:\n
+ if i == \'d\': date_order_list.append(current_date.day())\n
+ if i == \'m\': date_order_list.append(current_date.month())\n
+ \n
+ title = \'%s:00\' % str(current_date.hour())\n
+ o.setProperty(\'title\', title)\n
+ \n
+ # defining group title for the new lane_axis rendering\n
+ group_title = \'%s - %s\' % (Message(domain=\'erp5_ui\', message=current_date.Day()),current_date.Date())\n
+ o.setProperty(\'group_title\', group_title)\n
+ \n
+ tp = \'%s\' % str(current_date.hour())\n
+ o.setProperty(\'tooltip\', tp) \n
+\n
+ category_list.append(o) \n
+ \n
+ current_date = current_date + 1.0/24\n
+\n
+else:\n
+ return domain_list\n
+\n
+for category in category_list:\n
+ domain = parent.generateTempDomain(id = \'sub\' + category.getProperty(\'id\'))\n
+ domain.edit(title = category.getTitle(),\n
+ membership_criterion_base_category = (\'parent\', ), \n
+ membership_criterion_category = (category,),\n
+ domain_generator_method_id = script.id,\n
+ uid = category.getUid())\n
+ \n
+ domain_list.append(domain)\n
+\n
+context.log("%s on %s" % (script.getId(), context.getPath()), "%d objects domain" % len(domain_list))\n
+return domain_list\n
+\n
+# vim: filetype=python\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>_lazy_compilation</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>depth, parent, **kw</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>depth</string>
+ <string>parent</string>
+ <string>kw</string>
+ <string>Products.ERP5Type.Message</string>
+ <string>Message</string>
+ <string>Products.ERP5Type.Document</string>
+ <string>newTempBase</string>
+ <string>string</string>
+ <string>zfill</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal_object</string>
+ <string>request</string>
+ <string>domain_list</string>
+ <string>selection_name</string>
+ <string>selection</string>
+ <string>params</string>
+ <string>DateTime</string>
+ <string>bound_start</string>
+ <string>bound_stop</string>
+ <string>date_order</string>
+ <string>None</string>
+ <string>AttributeError</string>
+ <string>special_day_list</string>
+ <string>hasattr</string>
+ <string>category_list</string>
+ <string>current_date</string>
+ <string>hour</string>
+ <string>o</string>
+ <string>int</string>
+ <string>date_order_list</string>
+ <string>_getiter_</string>
+ <string>i</string>
+ <string>str</string>
+ <string>title</string>
+ <string>group_title</string>
+ <string>tp</string>
+ <string>category</string>
+ <string>domain</string>
+ <string>script</string>
+ <string>len</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>Base_generateDayDomain</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateMonthDomain.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateMonthDomain.xml?rev=21055&view=auto
==============================================================================
--- experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateMonthDomain.xml (added)
+++ experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateMonthDomain.xml Wed May 21 12:59:29 2008
@@ -1,0 +1,310 @@
+<?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 encoding="cdata"><![CDATA[
+
+# - Months always starts at 0h of the current month\'s first day and \n
+# finish 0h of the next month\'s first day.\n
+\n
+from Products.ERP5Type.Message import Message\n
+from Products.ERP5Type.Document import newTempBase\n
+from string import zfill\n
+portal_object = context.getPortalObject()\n
+request = context.REQUEST\n
+domain_list = []\n
+\n
+form_id=request.get(\'form_id\')\n
+selection_name = request.get(\'selection_name\')\n
+selection = context.portal_selections.getSelectionFor(selection_name, request)\n
+\n
+params = selection.getParams()\n
+zoom_variation = params.get(\'bound_variation\', 0)\n
+bound_start = DateTime(params.get(\'bound_start\', DateTime()))\n
+zoom_begin = DateTime(bound_start.year() , bound_start.month() , bound_start.day()) \n
+\n
+# Normalize Month.\n
+month = zoom_begin.month() + zoom_variation\n
+year = zoom_begin.year() + (month - 1) / 12\n
+month = month % 12\n
+if month == 0:\n
+ month = 12\n
+current_date = DateTime(year, month, 1)\n
+if month >= 12:\n
+ year = year + 1\n
+ month = 1\n
+else:\n
+ month = month + 1\n
+axis_stop = DateTime(year, month, 1)\n
+\n
+\n
+default_link_url =\'setLanePath?form_id=%s&list_selection_name=%s\' %(\n
+ form_id, selection_name)\n
+\n
+# Definning date order using user Preference Options\n
+try:\n
+ date_order = context.portal_preferences.getActivePreference().getPreferredDateOrder()\n
+ context.log("%s on %s" % (script.getId(), context.getPath()), "%s" % date_order)\n
+ if (date_order is None) or date_order not in [ \'dmy\', \'ymd\' , \'mdy\' ]:\n
+ date_order = \'ymd\'\n
+except AttributeError:\n
+ # no Enabled preferences found.\n
+ date_order = \'ymd\'\n
+\n
+# Checking for special days set in calendar\n
+special_day_list = None\n
+if hasattr(context, \'Base_getCalendarHolidayList\'):\n
+ special_day_list = context.Base_getCalendarHolidayList(current_date,axis_stop)\n
+category_list = []\n
+if depth == 0: \n
+ # recovering first date displayed, without time:\n
+ while current_date < axis_stop: \n
+ # Create one Temp Object\n
+ o = newTempBase(portal_object, id=str(current_date.Day()) ,uid=\'new_%s\' % zfill(\'year\',4))\n
+\n
+ # Setting Axis Dates start and stop\n
+ o.setProperty(\'start\',current_date)\n
+ o.setProperty(\'stop\',current_date+1)\n
+ o.setProperty(\'relative_position\', int(current_date))\n
+\n
+ # Seting delimiter \n
+ if current_date.day() == 15:\n
+ o.setProperty(\'delimiter_type\', 1)\n
+ else:\n
+ o.setProperty(\'delimiter_type\', 0)\n
+\n
+ # MIKOLAJ: check if this day is not a holiday in default calendar\n
+ if special_day_list is not None:\n
+ if current_date in special_day_list:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+ else:\n
+ if current_date.Day() in [\'Saturday\', \'Sunday\']:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+\n
+ date_order_list = []\n
+ for i in date_order:\n
+ if i == \'d\': date_order_list.append(current_date.day())\n
+ if i == \'m\': date_order_list.append(current_date.month())\n
+ if i == \'y\': date_order_list.append(current_date.year())\n
+\n
+ o.setProperty(\'title\', \'%s\' % str(current_date.day()))\n
+\n
+ # setting group title for new rendering of lane axis\n
+ o.setProperty(\'group_title\', \'%s - %s\' % (Message(domain=\'erp5_ui\', message=current_date.Month()), current_date.year()))\n
+\n
+ tp = \'%s %s\' % (Message(domain=\'erp5_ui\', message=current_date.Day(),mapping=None), str(current_date))\n
+ o.setProperty(\'tooltip\', tp) \n
+\n
+ link = \'%s&bound_start=%s&lane_path=grenapilot_week_domain\' % ( default_link_url, current_date)\n
+ o.setProperty(\'link\', link) \n
+\n
+ category_list.append(o) \n
+\n
+ # go to next date\n
+ current_date = current_date + 1\n
+else:\n
+ return domain_list \n
+\n
+for category in category_list:\n
+ domain = parent.generateTempDomain(id = \'sub\' + category.getProperty(\'id\'))\n
+ domain.edit(title = category.getTitle(),\n
+ membership_criterion_base_category = (\'parent\', ), \n
+ membership_criterion_category = (category,),\n
+ domain_generator_method_id = script.id,\n
+ uid = category.getUid())\n
+ \n
+ domain_list.append(domain)\n
+\n
+#context.log("%s on %s" % (script.getId(), context.getPath()), "%d objects domain" % len(domain_list))\n
+return domain_list\n
+\n
+# vim: filetype=python\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>_lazy_compilation</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>depth, parent, **kw</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>depth</string>
+ <string>parent</string>
+ <string>kw</string>
+ <string>Products.ERP5Type.Message</string>
+ <string>Message</string>
+ <string>Products.ERP5Type.Document</string>
+ <string>newTempBase</string>
+ <string>string</string>
+ <string>zfill</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal_object</string>
+ <string>request</string>
+ <string>domain_list</string>
+ <string>form_id</string>
+ <string>selection_name</string>
+ <string>selection</string>
+ <string>params</string>
+ <string>zoom_variation</string>
+ <string>DateTime</string>
+ <string>bound_start</string>
+ <string>zoom_begin</string>
+ <string>month</string>
+ <string>year</string>
+ <string>current_date</string>
+ <string>axis_stop</string>
+ <string>default_link_url</string>
+ <string>date_order</string>
+ <string>script</string>
+ <string>None</string>
+ <string>AttributeError</string>
+ <string>special_day_list</string>
+ <string>hasattr</string>
+ <string>category_list</string>
+ <string>str</string>
+ <string>o</string>
+ <string>int</string>
+ <string>date_order_list</string>
+ <string>_getiter_</string>
+ <string>i</string>
+ <string>tp</string>
+ <string>link</string>
+ <string>category</string>
+ <string>domain</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>Base_generateMonthDomain</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateWeekDomain.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateWeekDomain.xml?rev=21055&view=auto
==============================================================================
--- experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateWeekDomain.xml (added)
+++ experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateWeekDomain.xml Wed May 21 12:59:29 2008
@@ -1,0 +1,314 @@
+<?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 encoding="cdata"><![CDATA[
+
+# - Weeks always starts at 0H of the last Sunday and finish at 0h of\n
+# the next sunday.\n
+\n
+from Products.ERP5Type.Message import Message\n
+from Products.ERP5Type.Document import newTempBase\n
+from string import zfill\n
+\n
+portal_object = context.getPortalObject()\n
+request = context.REQUEST\n
+domain_list = []\n
+form_id=request.get(\'form_id\')\n
+\n
+selection_name = request.get(\'selection_name\')\n
+selection = context.portal_selections.getSelectionFor(\n
+ selection_name, request)\n
+\n
+params = selection.getParams()\n
+bound_variation = params.get(\'bound_variation\', 0)\n
+bound_start = DateTime(params.get(\'bound_start\', DateTime()))\n
+bound_start = DateTime(bound_start.year() , bound_start.month() , bound_start.day()) \n
+\n
+# Normalize Week.\n
+while bound_start.Day() is not \'Monday\':\n
+ bound_start = bound_start - 1\n
+current_date = bound_start + 7 * bound_variation\n
+bound_stop = current_date + 7\n
+\n
+default_link_url =\'setLanePath?form_id=%s&list_selection_name=%s\' %(\n
+ form_id, selection_name)\n
+\n
+# Definning date order using user Preference Options\n
+try:\n
+ date_order = context.portal_preferences.getActivePreference().getPreferredDateOrder()\n
+ if (date_order is None) or date_order not in [ \'dmy\', \'ymd\' , \'mdy\' ]:\n
+ date_order = \'ymd\'\n
+except AttributeError:\n
+ date_order = \'ymd\'\n
+\n
+# Checking for special days set in calendar\n
+special_day_list = None\n
+if hasattr(context, \'Base_getCalendarHolidayList\'):\n
+ special_day_list = context.Base_getCalendarHolidayList(current_date,bound_stop)\n
+category_list = []\n
+if depth == 0: \n
+ # This case show Seven days\n
+ while current_date < bound_stop:\n
+ # Create one Temp Object\n
+ o = newTempBase(portal_object, id=\'week\' ,uid=\'new_%s\' % zfill(\'week\',4))\n
+ # Setting Axis Dates start and stop\n
+ o.setProperty(\'start\',current_date)\n
+ o.setProperty(\'stop\', current_date+1)\n
+ o.setProperty(\'relative_position\', int(current_date))\n
+\n
+ # Seting delimiter \n
+ if current_date.day() == 1:\n
+ o.setProperty(\'delimiter_type\', 2)\n
+ elif current_date.day() == 15:\n
+ o.setProperty(\'delimiter_type\', 1)\n
+ else:\n
+ o.setProperty(\'delimiter_type\', 0)\n
+\n
+ # MIKOLAJ: check if this day is not a holiday in default calendar\n
+ context.log(\'Special day list: %s\' % special_day_list)\n
+ if special_day_list is not None:\n
+ context.log(\'Current date: %s\' % current_date)\n
+ if current_date in special_day_list:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+ else:\n
+ if current_date.Day() in [\'Saturday\', \'Sunday\']:\n
+ o.setProperty(\'delimiter_type\', 3)\n
+\n
+\n
+ # defining date order\n
+ date_order_list = []\n
+ for i in date_order:\n
+ if i == \'d\': date_order_list.append(current_date.day())\n
+ if i == \'m\': date_order_list.append(current_date.month())\n
+ if i == \'y\': date_order_list.append(current_date.year())\n
+\n
+ title = \'%s %s/%s/%s\' % (Message(domain=\'erp5_ui\', message=current_date.Day(), mapping=None),\n
+ str(date_order_list[0]), \n
+ str(date_order_list[1]),\n
+ str(date_order_list[2]))\n
+ o.setProperty(\'title\', title)\n
+\n
+ monthOfYear = current_date.dayOfYear() / 7 + 1\n
+\n
+ # setting group title for new rendering of lane axis\n
+ o.setProperty(\'group_title\', \'%s - %s - %s: %s\' % (Message(domain=\'erp5_ui\', message=current_date.Month()),\n
+ current_date.year(),\n
+ Message(domain=\'erp5_ui\', message=\'week number\'),\n
+ monthOfYear))\n
+\n
+ # Defining ToolTip (Optional)\n
+ tp = \'%s %s\' % (Message(domain=\'erp5_ui\', message=current_date.Day(),mapping=None), str(current_date))\n
+ o.setProperty(\'tooltip\', tp) \n
+\n
+ # Defining Link (Optional)\n
+ link = \'%s&bound_start=%s&lane_path=grenapilot_day_domain\' % ( default_link_url, current_date)\n
+ o.setProperty(\'link\', link) \n
+\n
+ category_list.append(o) \n
+ current_date = current_date + 1\n
+else:\n
+ return domain_list\n
+\n
+for category in category_list:\n
+ domain = parent.generateTempDomain(id = \'sub\' + category.getProperty(\'id\'))\n
+ domain.edit(title = category.getTitle(),\n
+ membership_criterion_base_category = (\'parent\', ), \n
+ membership_criterion_category = (category,),\n
+ domain_generator_method_id = script.id,\n
+ uid = category.getUid())\n
+ \n
+ domain_list.append(domain)\n
+\n
+return domain_list\n
+\n
+# vim: filetype=python\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>_lazy_compilation</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>depth, parent, **kw</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>depth</string>
+ <string>parent</string>
+ <string>kw</string>
+ <string>Products.ERP5Type.Message</string>
+ <string>Message</string>
+ <string>Products.ERP5Type.Document</string>
+ <string>newTempBase</string>
+ <string>string</string>
+ <string>zfill</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal_object</string>
+ <string>request</string>
+ <string>domain_list</string>
+ <string>form_id</string>
+ <string>selection_name</string>
+ <string>selection</string>
+ <string>params</string>
+ <string>bound_variation</string>
+ <string>DateTime</string>
+ <string>bound_start</string>
+ <string>current_date</string>
+ <string>bound_stop</string>
+ <string>default_link_url</string>
+ <string>date_order</string>
+ <string>None</string>
+ <string>AttributeError</string>
+ <string>special_day_list</string>
+ <string>hasattr</string>
+ <string>category_list</string>
+ <string>o</string>
+ <string>int</string>
+ <string>date_order_list</string>
+ <string>_getiter_</string>
+ <string>i</string>
+ <string>str</string>
+ <string>_getitem_</string>
+ <string>title</string>
+ <string>monthOfYear</string>
+ <string>tp</string>
+ <string>link</string>
+ <string>category</string>
+ <string>domain</string>
+ <string>script</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>Base_generateWeekDomain</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Added: experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateYearDomain.xml
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateYearDomain.xml?rev=21055&view=auto
==============================================================================
--- experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateYearDomain.xml (added)
+++ experimental/bt5/erp5_core_experimental/SkinTemplateItem/portal_skins/erp5_core_experimental/Base_generateYearDomain.xml Wed May 21 12:59:29 2008
@@ -1,0 +1,285 @@
+<?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 encoding="cdata"><![CDATA[
+
+# - Years always starts at 0h of the current year\'s first day and \n
+# finish 0h of the next year\'s first day.\n
+\n
+from Products.ERP5Type.Message import Message\n
+from Products.ERP5Type.Document import newTempBase\n
+from string import zfill\n
+\n
+portal_object = context.getPortalObject()\n
+request = context.REQUEST\n
+domain_list = []\n
+form_id=request.get(\'form_id\')\n
+\n
+selection_name = request.get(\'selection_name\')\n
+selection = context.portal_selections.getSelectionFor(\n
+ selection_name, request)\n
+\n
+params = selection.getParams()\n
+zoom_begin = DateTime(params.get(\'bound_start\', DateTime()))\n
+year = zoom_begin.year() + params.get(\'bound_variation\', 0)\n
+current_date = DateTime(year, 1, 1)\n
+\n
+default_link_url =\'setLanePath?form_id=%s&list_selection_name=%s\' %(\n
+ form_id, selection_name)\n
+\n
+# Definning date order using user Preference Options\n
+try:\n
+ date_order = context.portal_preferences.getActivePreference().getPreferredDateOrder()\n
+ if (date_order is None) or date_order not in [ \'dmy\', \'ymd\' , \'mdy\' ]:\n
+ date_order = \'ymd\'\n
+except AttributeError:\n
+ date_order = \'ymd\'\n
+\n
+\n
+category_list = []\n
+if depth == 0: \n
+ # getting list of months\n
+ count = 0\n
+ while count < 12:\n
+ # Create one Temp Object\n
+ o = newTempBase(portal_object, id=\'year\' ,uid=\'new_%s\' % zfill(\'year\',4))\n
+ # Seting delimiter \n
+ if current_date.month() in [1, 7]:\n
+ o.setProperty(\'delimiter_type\', 1)\n
+ else:\n
+ o.setProperty(\'delimiter_type\', 0)\n
+ \n
+ # Setting Axis Dates start and stop\n
+ o.setProperty(\'start\',current_date)\n
+ if current_date.month() != 12:\n
+ stop_date = DateTime(current_date.year(),current_date.month() +1,1)\n
+ else:\n
+ stop_date = DateTime(year+1, 1, 1)\n
+ o.setProperty(\'stop\', stop_date)\n
+ \n
+ o.setProperty(\'relative_position\', int(current_date))\n
+\n
+ date_order_list = []\n
+ for i in date_order:\n
+ if i == \'m\': date_order_list.append(current_date.month())\n
+ if i == \'y\': date_order_list.append(current_date.year())\n
+\n
+ o.setProperty(\'title\', \'%s\' % Message(domain=\'erp5_ui\', message=current_date.Month()))\n
+\n
+ # Setting group title for new rendering of lane axis\n
+ o.setProperty(\'group_title\', current_date.year())\n
+\n
+ # Defining ToolTip (Optional)\n
+ tp = \'%s %s\' % (Message(domain=\'erp5_ui\', message=current_date.Day(),mapping=None), str(current_date))\n
+ o.setProperty(\'tooltip\', tp)\n
+\n
+ # Defining Link\n
+ link = \'%s&bound_start=%s&lane_path=grenapilot_month_domain\' % ( default_link_url, current_date)\n
+ o.setProperty(\'link\', link) \n
+ \n
+ category_list.append(o) \n
+ current_date = DateTime(str(current_date.year()) + \'/\' + str((current_date.month() +1)) + \'/1\')\n
+ count += 1\n
+else:\n
+ return domain_list\n
+\n
+for category in category_list:\n
+ domain = parent.generateTempDomain(id = \'sub\' + category.getProperty(\'id\'))\n
+ domain.edit(title = category.getTitle(),\n
+ membership_criterion_base_category = (\'parent\', ), \n
+ membership_criterion_category = (category,),\n
+ domain_generator_method_id = script.id,\n
+ uid = category.getUid())\n
+ \n
+ domain_list.append(domain)\n
+\n
+return domain_list\n
+\n
+# vim: filetype=python\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>_lazy_compilation</string> </key>
+ <value> <int>1</int> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string>depth, parent, **kw</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>depth</string>
+ <string>parent</string>
+ <string>kw</string>
+ <string>Products.ERP5Type.Message</string>
+ <string>Message</string>
+ <string>Products.ERP5Type.Document</string>
+ <string>newTempBase</string>
+ <string>string</string>
+ <string>zfill</string>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>portal_object</string>
+ <string>request</string>
+ <string>domain_list</string>
+ <string>form_id</string>
+ <string>selection_name</string>
+ <string>selection</string>
+ <string>params</string>
+ <string>DateTime</string>
+ <string>zoom_begin</string>
+ <string>year</string>
+ <string>current_date</string>
+ <string>default_link_url</string>
+ <string>date_order</string>
+ <string>None</string>
+ <string>AttributeError</string>
+ <string>category_list</string>
+ <string>count</string>
+ <string>o</string>
+ <string>stop_date</string>
+ <string>int</string>
+ <string>date_order_list</string>
+ <string>_getiter_</string>
+ <string>i</string>
+ <string>str</string>
+ <string>tp</string>
+ <string>link</string>
+ <string>_inplacevar_</string>
+ <string>category</string>
+ <string>domain</string>
+ <string>script</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>Base_generateYearDomain</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: experimental/bt5/erp5_core_experimental/bt/change_log
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/bt/change_log?rev=21055&r1=21054&r2=21055&view=diff
==============================================================================
--- experimental/bt5/erp5_core_experimental/bt/change_log (original)
+++ experimental/bt5/erp5_core_experimental/bt/change_log Wed May 21 12:59:29 2008
@@ -1,4 +1,6 @@
--
+2008-05-20 Mikolaj
+* added modified time domains needed along the lane_axis title patch for nicer lane_axis display
+* calendar holidays taken into consideration for marking special days. If no calendar found only Saturdays and Sundays are coloured.
2008-03-14 Mikolaj
* moved listbox marking support to separate BT (erp5_xhtml_style_experimental)
Modified: experimental/bt5/erp5_core_experimental/bt/revision
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/bt/revision?rev=21055&r1=21054&r2=21055&view=diff
==============================================================================
--- experimental/bt5/erp5_core_experimental/bt/revision (original)
+++ experimental/bt5/erp5_core_experimental/bt/revision Wed May 21 12:59:29 2008
@@ -1,1 +1,1 @@
-25
+26
Modified: experimental/bt5/erp5_core_experimental/bt/version
URL: http://svn.erp5.org/experimental/bt5/erp5_core_experimental/bt/version?rev=21055&r1=21054&r2=21055&view=diff
==============================================================================
--- experimental/bt5/erp5_core_experimental/bt/version (original)
+++ experimental/bt5/erp5_core_experimental/bt/version Wed May 21 12:59:29 2008
@@ -1,1 +1,1 @@
-0.2
+0.3.0
More information about the Erp5-report
mailing list