Commit a4b1b703 authored by Rafael Monnerat's avatar Rafael Monnerat

Added Date Zoom feature at Planning Box.

Added Frozen Blocs Configuration.

The Planning Box was partially refactored in some parts by me (and also Romain) these lasts months, this commit was the initial  ones.


The tests and documentation update will come soon.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15883 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent dd4e8e68
<?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 encoding="cdata"><![CDATA[
# Define the condition for the bloc is frozen or not.\n
# The Bloc is frozen when:\n
# - it\'s a Simulation Movement\n
# - The user is not allowed to edit it\n
# - it\'s a part of a block \n
# - the object is one Calendar Period\n
\n
frozen_portal_type_list = context.getPortalCalendarPeriodTypeList() + (\'Simulation Movement\',\'Presence Request Period\')\n
\n
return (not context.portal_membership.checkPermission(\'Modify portal content\', block.parent_activity.object)) or \\\n
(block.parent_activity.object.getPortalType() in frozen_portal_type_list ) or \\\n
(not ((block.position_x.relative_begin > 0) and \\\n
(block.position_x.relative_end < 1) and \\\n
(block.property_dict[\'stat\'] == 0)))\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>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>block</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>block</string>
<string>_getattr_</string>
<string>context</string>
<string>frozen_portal_type_list</string>
<string>_getitem_</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>PlanningBox_isFrozenBlock</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -166,7 +166,7 @@ else:\n
planning_dict= {\n
\'position\': \'relative\',\n
\'border-style\': \'solid\',\n
\'border-color\': \'#000000\',\n
\'border-color\': \'#d5e6de\',\n
\'border-width\': 0,\n
\'background\': \'#d5e6de\',\n
\'width\': size_planning_width + size_border_width_left + size_y_axis_width + size_y_axis_space + 20,\n
......@@ -583,9 +583,10 @@ for block_object in planning.content:\n
block_dict = {\n
\'position\': \'absolute\',\n
\'border-style\': \'solid\',\n
\'border-color\': \'#53676e\',\n
\'border-color\': \'#53676e\',\n
\'border-width\': 1,\n
}\n
\n
if block_object.error == 1: # task has error (not validated)\n
block_dict[\'background\'] = \'#e4c4da\'\n
elif block_object.warning == 1: # other bloc in the same task has error\n
......@@ -598,7 +599,10 @@ for block_object in planning.content:\n
else: # default color\n
block_dict[\'background\'] = \'#bdd2e7\'\n
\n
\n
# XXX Define the frozen Blocs\n
if context.PlanningBox_isFrozenBlock(block=block_object):\n
block_dict[\'border-width\'] = 0\n
\n
block_dict[\'width\'] = block_object.position_x.relative_range * size_planning_width\n
block_dict[\'height\'] = block_object.position_y.relative_range * size_planning_height\n
block_dict[\'margin-left\'] = block_object.position_x.relative_begin * size_planning_width\n
......@@ -608,10 +612,11 @@ for block_object in planning.content:\n
# the whole following process is aimed to take care of the non-stat blocks\n
\n
if planning.main_axis == planning.Y and block_object.parent_activity.property_dict[\'stat\'] == 0:\n
# Y axis is main axis\n
# adapt Y block size\n
block_dict[\'height\'] = block_dict[\'height\'] - 10\n
block_dict[\'margin-top\'] = block_dict[\'margin-top\'] + 5\n
if block_object.parent_activity.object.getUid() not in basic.sec_layer_uid_list:\n
# Y axis is main axis\n
# adapt Y block size\n
block_dict[\'height\'] = block_dict[\'height\'] - 10\n
block_dict[\'margin-top\'] = block_dict[\'margin-top\'] + 5\n
elif block_object.parent_activity.property_dict[\'stat\'] == 0:\n
# X axis is main axis\n
# adapt X block size\n
......@@ -831,6 +836,7 @@ return properties_structure\n
<string>content_dict</string>
<string>block_object</string>
<string>block_dict</string>
<string>context</string>
<string>top_string</string>
<string>top_list</string>
<string>bot_string</string>
......
......@@ -94,13 +94,15 @@ This script builds a string with all necessary data to allow block\n
moving and resizing\n
"""\n
\n
returned_string = "<script type=\\"text/javascript\\">SET_DHTML("\n
for block in planning.content:\n
if block.property_dict[\'stat\'] == 0:\n
returned_string += \'"%s",\' % block.name\n
returned_string += "\\"top\\"+CURSOR_N_RESIZE+VERTICAL, \\"right\\"+CURSOR_E_RESIZE+HORIZONTAL, \\"bottom\\"+CURSOR_S_RESIZE+VERTICAL, \\"left\\"+CURSOR_W_RESIZE+HORIZONTAL);</script>"\n
block_string = \',\'.join([\'"%s"\' % block.name for block in planning.content if \\\n
not context.PlanningBox_isFrozenBlock(block=block)])\n
\n
return returned_string\n
return \'<script type="text/javascript">SET_DHTML(%s,\' \\\n
\'"top"+CURSOR_N_RESIZE+VERTICAL, \' \\\n
\'"right"+CURSOR_E_RESIZE+HORIZONTAL, \' \\\n
\'"bottom"+CURSOR_S_RESIZE+VERTICAL, \' \\\n
\'"left"+CURSOR_W_RESIZE+HORIZONTAL\' \\\n
\');</script>\' % block_string\n
]]></string> </value>
......@@ -152,11 +154,13 @@ return returned_string\n
<value>
<tuple>
<string>planning</string>
<string>returned_string</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>block</string>
<string>_getitem_</string>
<string>context</string>
<string>block_string</string>
</tuple>
</value>
</item>
......
<?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 encoding="cdata"><![CDATA[
# Define the Two dates (Start date and stop date ) that will be \n
# used by Planning Box at secondary axis and also used as SQL params\n
# at list method.\n
#\n
# Returned a list with 2 dates which is normalized as;\n
#\n
# - Days always starts at 0H and finish at 0h of the next day.\n
# \n
# - Weeks always starts at 0H of the last Sunday and finish at 0h of\n
# the next sunday.\n
#\n
# - 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
# - 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
\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
bound_start = bound_start + zoom_variation\n
bound_stop = bound_start + 1\n
\n
if int(zoom_level) == 7:\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
# Normalize Month.\n
month = bound_start.month() + zoom_variation\n
year = bound_start.year() + (month - 1) / 12\n
month = month % 12\n
if month == 0:\n
month = 12\n
bound_start = DateTime(year, month, 1)\n
if month >= 12:\n
year = year + 1\n
month = 1\n
else:\n
month = month + 1\n
bound_stop = DateTime(year, month, 1)\n
\n
if int(zoom_level) == 365:\n
# Normalize Year.\n
year = bound_start.year() + zoom_variation\n
bound_start = DateTime(year, 1, 1)\n
bound_stop = DateTime(year+1, 1, 1)\n
\n
return [bound_start , bound_stop]\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>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>bound_begin=None, zoom_level=1,zoom_variation=0</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>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>bound_begin</string>
<string>zoom_level</string>
<string>zoom_variation</string>
<string>DateTime</string>
<string>_getattr_</string>
<string>bound_start</string>
<string>bound_stop</string>
<string>int</string>
<string>month</string>
<string>year</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<int>1</int>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>planning_validate_date_list</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>OFS.Image</string>
<string>Image</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>planningbox.png</string> </value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>data</string> </key>
<value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAABgAAAAaCAMAAACaYWzBAAACtVBMVEX///8zM2YAZgDq6u/CwtGy
srL+goQkJEeHh5LR0d2jo6fw8PT6+vuxsbIAM5j5+//8/f8AOZ4AOJ0AN5wANpsANZoAJmwAP6IA
PaEAPJ8AO58AK3AARKYAQqUAQKP1+f8AS6wASaoASKgARqgARqcAM3b4+/8AUbAAUK8AT64ATq0A
TawAS6unrLL0+f8AV7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AAAAAAAAAAO
bW9xc3SGiA4AAAAAAAABAAAAAAAAAAAADg4ODg4ODg4OAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAEAAAACAgICAgICAgICAAAAAAAAAAAAAAABAAAAAqyusLK0tri6AgAAAAAAAAAAAAAA
AQAAAAKsrrCytLa4ugIAAAAAAAAAAAAAAAEAAAACAgICAgICAgICAAAAAAAAAAAAAAABAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAeXl5eXl5eXl5eXl5eXl5eUAAAAAAAAAAAHLys3P0dPW19nb3d/h
4wbkAAAAAAAAAAABy8vMztDS1NXY2tze4OLm5AAAAAAAAAAAAeTk5OTk5OTk5OTk5OTk5OQAAAAA
AAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAMnJycnJycnJyckAAAAAAQAA
AAAAAAAAAADJw8XGyLy+wMHJAAAAAAEAAAAAAAAAAAAAycLExse7vb/ByQAAAAABAAAAAAAAAAAA
AMnJycnJycnJyckAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAQEBAQEBAQEB
AQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjeaP2+IkgrAAAAAElFTkSuQmCC</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>26</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <long>1476</long> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>24</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2007-08-18 yo
* ERP5Site does not have getPortalType, so avoid calling getPortalType if not present.
2007-08-29 Rafael
* Updated Planning Box related stuff
2007-07-02 Yusei
* Fixed a invalid xhtml template.
......
417
\ No newline at end of file
421
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment