Commit 045e569e authored by Rafael Monnerat's avatar Rafael Monnerat

Update script to the new planning box configuration/refactored.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18286 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 57fb41de
......@@ -134,8 +134,8 @@ x_axis_position = basic.field.get_value(\'x_axis_position\')\n
properties_structure = {\n
\'base\': {},\n
\'frame\': {},\n
\'main_axis\': {},\n
\'secondary_axis\': {},\n
\'report_axis\': {},\n
\'lane_axis\': {},\n
\'line\': {},\n
\'content\': {},\n
\'info\': {},\n
......@@ -143,21 +143,21 @@ properties_structure = {\n
\n
\n
# getting number of elements to display on the main axis\n
if planning.main_axis.size != basic.main_axis_info[\'bound_axis_groups\']:\n
if planning.report_axis.size != basic.report_axis_info[\'bound_axis_groups\']:\n
# number of groups to display over the main axis is different from the expected\n
# value : updating planning size to fit exactly the number of groups \n
if planning.main_axis == planning.Y:\n
if planning.report_axis == planning.Y:\n
# updating Y axis\n
main_axis_step = float(size_planning_height) / float(basic.main_axis_info[\'bound_axis_groups\'])\n
size_planning_height = main_axis_step * planning.main_axis.size\n
report_axis_step = float(size_planning_height) / float(basic.report_axis_info[\'bound_axis_groups\'])\n
size_planning_height = report_axis_step * planning.report_axis.size\n
else:\n
main_axis_step = float(size_planning_width) / float(basic.main_axis_info[\'bound_axis_groups\'])\n
size_planning_width = main_axis_step * planning.main_axis.size\n
report_axis_step = float(size_planning_width) / float(basic.report_axis_info[\'bound_axis_groups\'])\n
size_planning_width = report_axis_step * planning.report_axis.size\n
else:\n
if planning.main_axis == planning.Y:\n
main_axis_step = float(size_planning_height) / float(basic.main_axis_info[\'bound_axis_groups\'])\n
if planning.report_axis == planning.Y:\n
report_axis_step = float(size_planning_height) / float(basic.report_axis_info[\'bound_axis_groups\'])\n
else:\n
main_axis_step = float(size_planning_width) / float(basic.main_axis_info[\'bound_axis_groups\'])\n
report_axis_step = float(size_planning_width) / float(basic.report_axis_info[\'bound_axis_groups\'])\n
\n
# defining planning area CSS class\n
# XXX it can be moved to globals\n
......@@ -216,7 +216,7 @@ for axis in (planning.Y, planning.X):\n
axis_next[\'margin-left\'] = axis_dict[\'width\'] + 5\n
axis_next[\'margin-top\'] = axis_previous[\'margin-top\']\n
\n
if axis == planning.main_axis:\n
if axis == planning.report_axis:\n
# current axis is main axis : need to implement depth widget\n
axis_depth = {\n
\'margin-left\': -10,\n
......@@ -245,7 +245,7 @@ for axis in (planning.Y, planning.X):\n
axis_previous[\'margin-top\'] = -20\n
axis_next[\'margin-left\'] = axis_previous[\'margin-left\']\n
axis_next[\'margin-top\'] = axis_dict[\'height\'] + 5\n
if axis == planning.main_axis:\n
if axis == planning.report_axis:\n
axis_depth = {\n
\'margin-left\': 0,\n
\'bottom\': \'100%\',\n
......@@ -264,7 +264,7 @@ for axis in (planning.Y, planning.X):\n
\n
# now processing groups over the main axis, including their info object\n
# at the same time generating line to separate each group\n
for axis_group in planning.main_axis.axis_group:\n
for axis_group in planning.report_axis.axis_group:\n
axis_group_dict={\n
\'position\': \'absolute\',\n
\'border-style\': \'solid\',\n
......@@ -285,10 +285,10 @@ for axis_group in planning.main_axis.axis_group:\n
\'border-style\': \'solid\',\n
\'border-width\': 0,\n
}\n
if planning.main_axis == planning.X:\n
if planning.report_axis == planning.X:\n
# current axis is X axis\n
axis_group_dict[\'width\'] = float(axis_group.axis_element_number) * main_axis_step\n
axis_group_dict[\'margin-left\'] = float( axis_group.axis_element_start -1) * main_axis_step\n
axis_group_dict[\'width\'] = float(axis_group.axis_element_number) * report_axis_step\n
axis_group_dict[\'margin-left\'] = float( axis_group.axis_element_start -1) * report_axis_step\n
axis_group_dict[\'height\'] = size_x_axis_height - axis_group.depth * depth_height\n
axis_group_dict[\'margin-top\'] = axis_group.depth * depth_height\n
axis_info_dict[\'margin-top\'] = axis_group.depth * depth_height\n
......@@ -351,7 +351,7 @@ for axis_group in planning.main_axis.axis_group:\n
\'border-style\': \'dotted\',\n
\'width\': 0,\n
\'height\': size_planning_height,\n
\'margin-left\': axis_group_dict[\'margin-left\'] + axis_element_number * main_axis_step,\n
\'margin-left\': axis_group_dict[\'margin-left\'] + axis_element_number * report_axis_step,\n
\'margin-top\': 0,\n
}\n
\n
......@@ -362,8 +362,8 @@ for axis_group in planning.main_axis.axis_group:\n
# current axis is Y axis\n
axis_group_dict[\'margin-left\'] = axis_group.depth * depth_width\n
axis_group_dict[\'width\'] = size_y_axis_width - axis_group.depth * depth_width\n
axis_group_dict[\'margin-top\'] = float( axis_group.axis_element_start - 1) * main_axis_step\n
axis_group_dict[\'height\'] = float(axis_group.axis_element_number) * main_axis_step\n
axis_group_dict[\'margin-top\'] = float( axis_group.axis_element_start - 1) * report_axis_step\n
axis_group_dict[\'height\'] = float(axis_group.axis_element_number) * report_axis_step\n
#axis_group_dict[\'text-align\'] = \'center\'\n
#axis_group_dict[\'vertical-align\'] = \'middle\'\n
\n
......@@ -437,7 +437,7 @@ for axis_group in planning.main_axis.axis_group:\n
\'width\': size_planning_width,\n
\'height\': 0,\n
\'margin-left\': 0,\n
\'margin-top\': axis_group_dict[\'margin-top\'] + axis_element_number * main_axis_step,\n
\'margin-top\': axis_group_dict[\'margin-top\'] + axis_element_number * report_axis_step,\n
}\n
\n
# adding current sub line info to properties_structure\n
......@@ -445,15 +445,15 @@ for axis_group in planning.main_axis.axis_group:\n
\n
\n
# adding axis_definitions to dictionnary\n
properties_structure[\'main_axis\'][axis_group.name] = axis_group_dict\n
properties_structure[\'report_axis\'][axis_group.name] = axis_group_dict\n
properties_structure[\'line\'][axis_group.name + \'_line\'] = axis_line_dict\n
#properties_structure[\'info\'][axis_group.name + \'_info\'] = axis_info_dict\n
\n
\n
\n
# processing secondary_axis_group\n
for sec_axis_group in planning.secondary_axis.axis_group:\n
sec_axis_group_dict={\n
# processing lane_axis_group\n
for lane_axis_group in planning.lane_axis.axis_group:\n
lane_axis_group_dict={\n
\'position\': \'absolute\',\n
\'border-color\': \'inherit\',\n
\'border-style\': \'solid\',\n
......@@ -461,97 +461,97 @@ for sec_axis_group in planning.secondary_axis.axis_group:\n
\'background\': \'inherit\',\n
}\n
# info definition\n
sec_axis_info_dict= {\n
lane_axis_info_dict= {\n
\'position\': \'absolute\',\n
}\n
#sec_axis_info_dict[\'border-style\'] = \'solid\'\n
#sec_axis_info_dict[\'border-color\'] = \'#53676e\'\n
#sec_axis_info_dict[\'border-width\'] = 0\n
#lane_axis_info_dict[\'border-style\'] = \'solid\'\n
#lane_axis_info_dict[\'border-color\'] = \'#53676e\'\n
#lane_axis_info_dict[\'border-width\'] = 0\n
# line definition\n
sec_axis_line_dict = {\n
lane_axis_line_dict = {\n
\'position\': \'absolute\',\n
}\n
if sec_axis_group.delimiter_type == 0:\n
sec_axis_line_dict[\'border-style\'] = \'dotted\'\n
if lane_axis_group.delimiter_type == 0:\n
lane_axis_line_dict[\'border-style\'] = \'dotted\'\n
else:\n
sec_axis_line_dict[\'border-style\'] = \'solid\'\n
sec_axis_line_dict[\'border-right-width\'] = 0\n
sec_axis_line_dict[\'border-bottom-width\'] = 0\n
if planning.main_axis == planning.Y:\n
lane_axis_line_dict[\'border-style\'] = \'solid\'\n
lane_axis_line_dict[\'border-right-width\'] = 0\n
lane_axis_line_dict[\'border-bottom-width\'] = 0\n
if planning.report_axis == planning.Y:\n
# current axis is X axis\n
sec_axis_group_dict[\'width\'] = sec_axis_group.position_secondary.absolute_range * size_planning_width\n
sec_axis_group_dict[\'margin-left\'] = sec_axis_group.position_secondary.absolute_begin * size_planning_width\n
sec_axis_group_dict[\'height\'] = size_x_axis_height\n
sec_axis_group_dict[\'margin-top\'] = sec_axis_group.depth\n
sec_axis_info_dict[\'margin-top\'] = 1\n
sec_axis_info_dict[\'margin-left\'] = 1\n
lane_axis_group_dict[\'width\'] = lane_axis_group.position_lane.absolute_range * size_planning_width\n
lane_axis_group_dict[\'margin-left\'] = lane_axis_group.position_lane.absolute_begin * size_planning_width\n
lane_axis_group_dict[\'height\'] = size_x_axis_height\n
lane_axis_group_dict[\'margin-top\'] = lane_axis_group.depth\n
lane_axis_info_dict[\'margin-top\'] = 1\n
lane_axis_info_dict[\'margin-left\'] = 1\n
# dotted line must be vertical\n
if sec_axis_group.delimiter_type == 2:\n
sec_axis_line_dict[\'border-left-width\'] = 2\n
if lane_axis_group.delimiter_type == 2:\n
lane_axis_line_dict[\'border-left-width\'] = 2\n
else:\n
sec_axis_line_dict[\'border-left-width\'] = 1\n
sec_axis_line_dict[\'border-top-width\'] = 0\n
sec_axis_line_dict[\'height\'] = size_planning_height\n
sec_axis_line_dict[\'width\'] = 0\n
sec_axis_line_dict[\'margin-left\'] = sec_axis_group_dict[\'margin-left\']\n
sec_axis_line_dict[\'margin-top\'] = 0\n
lane_axis_line_dict[\'border-left-width\'] = 1\n
lane_axis_line_dict[\'border-top-width\'] = 0\n
lane_axis_line_dict[\'height\'] = size_planning_height\n
lane_axis_line_dict[\'width\'] = 0\n
lane_axis_line_dict[\'margin-left\'] = lane_axis_group_dict[\'margin-left\']\n
lane_axis_line_dict[\'margin-top\'] = 0\n
\n
# updating info size\n
if sec_axis_group_dict[\'height\'] - sec_axis_info_dict[\'margin-top\'] < car_height:\n
if lane_axis_group_dict[\'height\'] - lane_axis_info_dict[\'margin-top\'] < car_height:\n
# block height is too low to be able to display any text\n
# removing block title but keeping tooltip\n
sec_axis_group.info_title.edit(\'\')\n
lane_axis_group.info_title.edit(\'\')\n
else:\n
# height matches info\n
if len(sec_axis_group.info_title.info) * car_width > sec_axis_group_dict[\'width\']:\n
if len(lane_axis_group.info_title.info) * car_width > lane_axis_group_dict[\'width\']:\n
# defining number of caracts to leave\n
nb = max((sec_axis_group_dict[\'width\'] - car_width * 3) / car_width, 0 )\n
nb = max((lane_axis_group_dict[\'width\'] - car_width * 3) / car_width, 0 )\n
# cutting activity\n
sec_axis_group.info_title.edit(sec_axis_group.info_title.info[:int(nb)] + \'..\')\n
lane_axis_group.info_title.edit(lane_axis_group.info_title.info[:int(nb)] + \'..\')\n
# adding axis_definitions to dictionnary\n
properties_structure[\'secondary_axis\'][sec_axis_group.name] = sec_axis_group_dict\n
properties_structure[\'line\'][sec_axis_group.name + \'_line\'] = sec_axis_line_dict\n
#properties_structure[\'info\'][sec_axis_group.name + \'_info\'] = sec_axis_info_dict\n
properties_structure[\'lane_axis\'][lane_axis_group.name] = lane_axis_group_dict\n
properties_structure[\'line\'][lane_axis_group.name + \'_line\'] = lane_axis_line_dict\n
#properties_structure[\'info\'][lane_axis_group.name + \'_info\'] = lane_axis_info_dict\n
\n
else:\n
# current axis is Y axis\n
sec_axis_group_dict[\'margin-left\'] = sec_axis_group.depth\n
sec_axis_group_dict[\'width\'] = size_y_axis_width\n
sec_axis_group_dict[\'margin-top\'] = sec_axis_group.position_secondary.absolute_begin * size_planning_height\n
sec_axis_group_dict[\'height\'] = sec_axis_group.position_secondary.absolute_range * size_planning_height\n
lane_axis_group_dict[\'margin-left\'] = lane_axis_group.depth\n
lane_axis_group_dict[\'width\'] = size_y_axis_width\n
lane_axis_group_dict[\'margin-top\'] = lane_axis_group.position_lane.absolute_begin * size_planning_height\n
lane_axis_group_dict[\'height\'] = lane_axis_group.position_lane.absolute_range * size_planning_height\n
# positionning info object in the middle of the axisGroup\n
sec_axis_info_dict[\'margin-top\'] = ((float(axis_group_dict[\'height\']) - car_height ) / 2.0)\n
sec_axis_info_dict[\'margin-top\'] = 0\n
sec_axis_info_dict[\'margin-left\'] = 1\n
lane_axis_info_dict[\'margin-top\'] = ((float(axis_group_dict[\'height\']) - car_height ) / 2.0)\n
lane_axis_info_dict[\'margin-top\'] = 0\n
lane_axis_info_dict[\'margin-left\'] = 1\n
# dotted line must be horizontal\n
sec_axis_line_dict[\'border-left-width\'] = 0\n
if sec_axis_group.delimiter_type == 2:\n
sec_axis_line_dict[\'border-top-width\'] = 2\n
lane_axis_line_dict[\'border-left-width\'] = 0\n
if lane_axis_group.delimiter_type == 2:\n
lane_axis_line_dict[\'border-top-width\'] = 2\n
else:\n
sec_axis_line_dict[\'border-top-width\'] = 1\n
sec_axis_line_dict[\'width\'] = size_planning_width\n
sec_axis_line_dict[\'height\'] = 0\n
sec_axis_line_dict[\'margin-left\'] = 0\n
sec_axis_line_dict[\'margin-top\'] = sec_axis_group_dict[\'margin-top\']\n
lane_axis_line_dict[\'border-top-width\'] = 1\n
lane_axis_line_dict[\'width\'] = size_planning_width\n
lane_axis_line_dict[\'height\'] = 0\n
lane_axis_line_dict[\'margin-left\'] = 0\n
lane_axis_line_dict[\'margin-top\'] = lane_axis_group_dict[\'margin-top\']\n
\n
\n
# updating info size\n
if sec_axis_group_dict[\'height\'] < car_height:\n
if lane_axis_group_dict[\'height\'] < car_height:\n
# block height is too low to be able to display any text\n
# removing block title but keeping tooltip\n
sec_axis_group.info_title.edit(\'\')\n
lane_axis_group.info_title.edit(\'\')\n
else:\n
# height matches info\n
if len(sec_axis_group.info_title.info) * car_width > sec_axis_group_dict[\'width\']:\n
if len(lane_axis_group.info_title.info) * car_width > lane_axis_group_dict[\'width\']:\n
# defining number of caracts to leave\n
nb = max((sec_axis_group_dict[\'width\'] - car_width * 3) / car_width, 0 )\n
nb = max((lane_axis_group_dict[\'width\'] - car_width * 3) / car_width, 0 )\n
# cutting activity\n
sec_axis_group.info_title.edit(sec_axis_group.info_title.info[:int(nb)] + \'..\')\n
lane_axis_group.info_title.edit(lane_axis_group.info_title.info[:int(nb)] + \'..\')\n
\n
# adding axis_definitions to dictionnary\n
properties_structure[\'secondary_axis\'][sec_axis_group.name] = sec_axis_group_dict\n
properties_structure[\'line\'][sec_axis_group.name + \'_line\'] = sec_axis_line_dict\n
#properties_structure[\'info\'][sec_axis_group.name + \'_info\'] = sec_axis_info_dict\n
properties_structure[\'lane_axis\'][lane_axis_group.name] = lane_axis_group_dict\n
properties_structure[\'line\'][lane_axis_group.name + \'_line\'] = lane_axis_line_dict\n
#properties_structure[\'info\'][lane_axis_group.name + \'_info\'] = lane_axis_info_dict\n
\n
\n
# defining CSS properties for content\n
......@@ -613,7 +613,7 @@ for block_object in planning.content:\n
if block_object.parent_activity.property_dict[\'stat\'] == 0:\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
if planning.report_axis == planning.Y and block_object.parent_activity.property_dict[\'stat\'] == 0:\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
......@@ -807,7 +807,7 @@ return properties_structure\n
<string>properties_structure</string>
<string>_getitem_</string>
<string>float</string>
<string>main_axis_step</string>
<string>report_axis_step</string>
<string>planning_dict</string>
<string>_write_</string>
<string>_getiter_</string>
......@@ -831,10 +831,10 @@ return properties_structure\n
<string>int</string>
<string>axis_element_number</string>
<string>axis_element_dict</string>
<string>sec_axis_group</string>
<string>sec_axis_group_dict</string>
<string>sec_axis_info_dict</string>
<string>sec_axis_line_dict</string>
<string>lane_axis_group</string>
<string>lane_axis_group_dict</string>
<string>lane_axis_info_dict</string>
<string>lane_axis_line_dict</string>
<string>content_dict</string>
<string>block_object</string>
<string>block_dict</string>
......@@ -871,6 +871,10 @@ return properties_structure\n
<key> <string>id</string> </key>
<value> <string>planning_coordinates</string> </value>
</item>
<item>
<key> <string>isIndexable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
......
460
\ No newline at end of file
462
\ 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