diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.py b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.py new file mode 100644 index 0000000000000000000000000000000000000000..f0df0c2032b4bd7d6fa9fcee00ba773a0bfb4fc9 --- /dev/null +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.py @@ -0,0 +1,40 @@ +import json +portal = context.getPortalObject() +graph = {'node': {}, 'edge': {}} + + +class_definition = { + 'movement': { + '_class': 'edge', + 'type': 'object', + 'description': 'Movement changing the location of the item', + 'properties': { } + }, + 'node': { + '_class': 'node', + 'type': 'object', + 'description': 'A Node where the item was moved to', + 'properties': { }, + }, +} + +for i, tracking in enumerate(reversed(portal.portal_simulation.getTrackingList(aggregate_uid=context.getUid()))): + movement = portal.portal_catalog.getObject(tracking.delivery_uid) + for node in (movement.getSourceValue(), movement.getDestinationValue()): + if node: + graph['node'][node.getUid()] = dict( + _class='node', + name=node.getTitle(), + link=node.absolute_url()) + else: + graph['node']["null"] = dict( + _class='node', + name="(origin)") + + graph['edge'][movement.getUid()] = dict( + _class="movement", + name="%s: %s (%s)" % (i+1, movement.getTitle(), movement.getStopDate().strftime("%Y/%m/%d")), + link=movement.absolute_url(), + source=movement.getSourceUid() or "null", + destination=movement.getDestinationUid() or "null") +return json.dumps(dict(graph=graph, class_definition=class_definition), indent=2) diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.xml new file mode 100644 index 0000000000000000000000000000000000000000..0549081b0ecf184f8401c5f49a167b566bbc23e0 --- /dev/null +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_getTrackingListGraphAsJSON.xml @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </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>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Item_getTrackingListGraphAsJSON</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList.xml index ffc74016b69a94e3d1e0ee4cce6860130219c4e9..86001c51a298fa638a0389fd9bbfe0d5d6175b1a 100644 --- a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList.xml +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList.xml @@ -76,6 +76,7 @@ <value> <list> <string>listbox</string> + <string>my_jsplumb_graph</string> </list> </value> </item> diff --git a/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList/my_jsplumb_graph.xml b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList/my_jsplumb_graph.xml new file mode 100644 index 0000000000000000000000000000000000000000..350b6c79d67fdffc5e01b316737f67ed13496779 --- /dev/null +++ b/bt5/erp5_item/SkinTemplateItem/portal_skins/erp5_item/Item_viewTrackingList/my_jsplumb_graph.xml @@ -0,0 +1,289 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="GadgetField" module="Products.ERP5Form.GadgetField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_jsplumb_graph</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>gadget_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>js_sandbox</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>data_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>gadget_url</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>input_type</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>js_sandbox</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string>page</string> </value> + </item> + <item> + <key> <string>data_url</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>gadget_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>js_sandbox</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Graph</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>context/Item_getTrackingListGraphAsJSON</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: context.getPortalObject().restrictedTraverse(\'dream_graph_editor/jsplumb/index.html\', None) is not None</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: context.getPortalObject().restrictedTraverse(\'dream_graph_editor/jsplumb/index.html\').absolute_url()</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData>