Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
Commits
78a95a7e
Commit
78a95a7e
authored
Aug 26, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Workflow: add links on erp5_graph_editor for transitions and states
parent
9810eed5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
73 deletions
+41
-73
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
...eItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
+22
-69
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/index.html.html
...5_graph_editor/dream_graph_editor/jsplumb/index.html.html
+1
-1
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
...rp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
+18
-3
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
View file @
78a95a7e
...
...
@@ -15,38 +15,39 @@ def getWorkflowGraph(workflow):
graph
=
{
'node'
:
{},
'edge'
:
{}}
for
state
in
workflow
.
getStateValueList
():
is_initial_state
=
state
.
getId
()
==
workflow
.
getSourceId
()
transition_
id_
list
=
[]
transition_list
=
[]
graph
[
'node'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.state'
,
'name'
:
state
.
getTitleOrId
(),
'is_initial_state'
:
1
if
is_initial_state
else
0
'is_initial_state'
:
is_initial_state
,
'path'
:
state
.
getPath
()
}
for
transition
in
state
.
getDestinationValueList
():
transition_id
=
transition
.
getReference
()
if
transition_id
in
workflow
.
getTransitionIdList
():
if
transition
.
getDestinationId
():
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
(
dict
(
_class
=
'workflow.transition'
,
source
=
state
.
getId
(),
destination
=
transition
.
getDestinationId
(),
name
=
transition
.
getActionName
()
or
transition
.
getTitleOrId
(),
description
=
transition
.
getDescription
(),
actbox_url
=
transition
.
getAction
(),
transition_id
=
transition
.
getId
()
# used for edition.
))
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
({
'_class'
:
'workflow.transition'
,
'source'
:
state
.
getId
(),
'destination'
:
transition
.
getDestinationId
(),
'name'
:
transition
.
getActionName
()
or
transition
.
getTitleOrId
(),
'description'
:
transition
.
getDescription
(),
'actbox_url'
:
transition
.
getAction
(),
'transition_id'
:
transition
.
getId
(),
# used for edition.
'path'
:
transition
.
getPath
()
})
else
:
# user action
transition_
id_list
.
append
(
transition_id
)
transition_
list
.
append
(
transition
)
if
transition_id_list
!=
[]:
for
transition
in
transition_id_list
:
graph
[
'edge'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.transition'
,
'source'
:
state
.
getId
(),
'destination'
:
state
.
getId
(),
'name'
:
str
(
transition_id_list
)
}
if
transition_list
!=
[]:
graph
[
'edge'
][
'transition_to_%s'
%
(
state
.
getId
())]
=
{
'_class'
:
'workflow.transition'
,
'source'
:
state
.
getId
(),
'destination'
:
state
.
getId
(),
'name_path_dict'
:
{
transition
.
getTitleOrId
():
transition
.
getPath
()
for
transition
in
transition_list
}
}
if
position_graph
:
...
...
@@ -55,52 +56,4 @@ def getWorkflowGraph(workflow):
graph
[
'node'
][
state_id
][
'coordinate'
]
=
position_graph
[
'node'
][
state_id
][
'coordinate'
]
return
graph
class_definition
=
{
'workflow.transition'
:
{
'_class'
:
'edge'
,
'type'
:
'object'
,
'description'
:
'A Workflow Transition'
,
'properties'
:
{
'name'
:
{
'type'
:
'string'
,
'name'
:
'Name'
,
'description'
:
'Name of this transition, will be displayed in the document actions'
,
},
'description'
:
{
'type'
:
'string'
,
'name'
:
'Description'
,
},
'actbox_url'
:
{
'type'
:
'string'
,
'name'
:
'Action URL'
,
'description'
:
'URL of the action, variables will be substitued. XXX TODO: higher level ! just configure "script name" '
},
}
},
'workflow.state'
:
{
'_class'
:
'node'
,
'type'
:
'object'
,
'description'
:
'A Workflow State'
,
'properties'
:
{
'name'
:
{
'type'
:
'string'
,
'name'
:
'Name'
,
'description'
:
'The name of the state, will be displayed in document view'
,
},
'id'
:
{
'type'
:
'string'
,
'name'
:
'Id'
,
'description'
:
'Id of the state, will be used for catalog searches'
,
},
'is_initial_state'
:
{
'type'
:
'string'
,
'enum'
:
[
'Yes'
,
'No'
],
'name'
:
'Is initial State'
,
'description'
:
'Set to Yes if this state is the initial state for newly created documents'
,
},
}
}
}
return
json
.
dumps
(
dict
(
graph
=
getWorkflowGraph
(
context
),
class_definition
=
class_definition
),
indent
=
2
)
return
json
.
dumps
(
dict
(
graph
=
getWorkflowGraph
(
context
),
class_definition
=
{}),
indent
=
2
)
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/index.html.html
View file @
78a95a7e
...
...
@@ -22,7 +22,7 @@
<
div
class
=
"
window {{class}}
"
id
=
"
{{element_id}}
"
title
=
"
{{title}}
"
>
{{
name
}}
<
a
href
=
"
{{name_href}}
"
>
{{
name
}}
<
/a
>
<
div
class
=
"
ep
"
><
/div
>
<
/div
>
</script>
...
...
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/jsplumb.js.js
View file @
78a95a7e
...
...
@@ -335,12 +335,26 @@
function
addEdge
(
gadget
,
edge_id
,
edge_data
)
{
var
overlays
=
[],
connection
;
connection
,
label
=
''
;
if
(
edge_data
.
name
)
{
label
=
edge_data
.
name
;
if
(
edge_data
.
path
)
{
label
=
label
.
link
(
edge_data
.
path
)
}
}
if
(
edge_data
.
name_path_dict
)
{
var
linked_name_list
=
[]
for
(
var
name
in
edge_data
.
name_path_dict
)
{
linked_name_list
.
push
(
name
.
link
(
edge_data
.
name_path_dict
[
name
]));
}
label
=
linked_name_list
.
join
(
'
,
'
);
}
if
(
label
)
{
overlays
=
[
[
"
Label
"
,
{
cssClass
:
"
l1 component label
"
,
label
:
edge_data
.
name
label
:
label
}]
];
}
...
...
@@ -497,7 +511,8 @@
"
class
"
:
node_data
.
_class
.
replace
(
"
.
"
,
"
-
"
),
element_id
:
dom_element_id
,
title
:
node_data
.
name
||
node_data
.
id
,
name
:
node_data
.
name
||
node_data
.
id
name
:
node_data
.
name
||
node_data
.
id
,
name_href
:
node_data
.
path
}),
"
text/html
"
).
querySelector
(
"
.window
"
);
render_element
.
append
(
domElement
);
box
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
dom_element_id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment