From fabfc15e5a00e7a5968305bf8e272840500d5a15 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Wed, 12 Sep 2007 02:23:01 +0000
Subject: [PATCH] unhardcoded values. Started to use Zoom Base Category to
 configure Zooms at Planning Box.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16275 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../erp5_xhtml_style/planning_content.xml          |  2 +-
 .../planning_validate_date_list.xml                | 14 +++++++++-----
 .../ERP5/bootstrap/erp5_xhtml_style/bt/revision    |  2 +-
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_content.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_content.xml
index 7d5b380982..0221b2c484 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_content.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_content.xml
@@ -220,7 +220,7 @@ Beware this only generates the HTML code, no CSS generation is done in this scri
       <tal:block tal:condition="python:basic.field.get_value(\'use_date_zoom\')">\n
         <!-- Defining Date Zoom Level -->\n
           <!-- XXX This part has to be improved -->\n
-          <tal:block tal:repeat="current_zoom_level python:[[\'Day\',1],[\'Week\',7],[\'Month\',30],[\'Year\',365]]">\n
+          <tal:block tal:repeat="current_zoom_level python:[ [i.getTitle() , i.getIntIndex() ] for i in context.portal_categories.zoom.contentValues() ]">\n
             <tal:block tal:condition="python:current_zoom_level[1]==basic.secondary_axis_info[\'zoom_level\']">\n
               <b tal:replace="nothing"> current zoom level is selected </b>\n
               <option selected="selected" value="None"\n
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_validate_date_list.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_validate_date_list.xml
index 2ab225a464..4dab8cf3e6 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_validate_date_list.xml
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/planning_validate_date_list.xml
@@ -88,21 +88,23 @@
 #    finish 0h of the next year\'s first day.\n
 #  \n
 \n
+zoom = context.portal_categories.zoom\n
+\n
 # Normalize Day.\n
 bound_start = DateTime(DateTime(bound_begin).strftime("%Y/%m/%d"))\n
 bound_stop = bound_start\n
-if int(zoom_level) == 1:\n
+if int(zoom_level) == zoom.first_zoom_level.getIntIndex():\n
   bound_start = bound_start + zoom_variation\n
   bound_stop = bound_start + 1\n
 \n
-if int(zoom_level) == 7:\n
+if int(zoom_level) == zoom.second_zoom_level.getIntIndex():\n
   # Normalize Week.\n
   while bound_start.Day() is not \'Sunday\':\n
     bound_start = bound_start - 1\n
   bound_start = bound_start + 7 * zoom_variation\n
   bound_stop = bound_start + 7\n
  \n
-if int(zoom_level) == 30:\n
+if int(zoom_level) == zoom.third_zoom_level.getIntIndex():\n
   # Normalize Month.\n
   month = bound_start.month() + zoom_variation\n
   year = bound_start.year() + (month - 1) / 12\n
@@ -117,7 +119,7 @@ if int(zoom_level) == 30:\n
     month = month + 1\n
   bound_stop = DateTime(year, month, 1)\n
 \n
-if int(zoom_level) == 365:\n
+if int(zoom_level) == zoom.fourth_zoom_level.getIntIndex():\n
   # Normalize Year.\n
   year = bound_start.year() + zoom_variation\n
   bound_start = DateTime(year, 1, 1)\n
@@ -177,8 +179,10 @@ return [bound_start , bound_stop]\n
                             <string>bound_begin</string>
                             <string>zoom_level</string>
                             <string>zoom_variation</string>
-                            <string>DateTime</string>
                             <string>_getattr_</string>
+                            <string>context</string>
+                            <string>zoom</string>
+                            <string>DateTime</string>
                             <string>bound_start</string>
                             <string>bound_stop</string>
                             <string>int</string>
diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
index 662d98cc92..ce163e7b6b 100644
--- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
+++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision
@@ -1 +1 @@
-436
\ No newline at end of file
+440
\ No newline at end of file
-- 
2.30.9