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
Sebastien Robin
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):
...
@@ -15,38 +15,39 @@ def getWorkflowGraph(workflow):
graph
=
{
'node'
:
{},
'edge'
:
{}}
graph
=
{
'node'
:
{},
'edge'
:
{}}
for
state
in
workflow
.
getStateValueList
():
for
state
in
workflow
.
getStateValueList
():
is_initial_state
=
state
.
getId
()
==
workflow
.
getSourceId
()
is_initial_state
=
state
.
getId
()
==
workflow
.
getSourceId
()
transition_
id_
list
=
[]
transition_list
=
[]
graph
[
'node'
][
state
.
getId
()]
=
{
graph
[
'node'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.state'
,
'_class'
:
'workflow.state'
,
'name'
:
state
.
getTitleOrId
(),
'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
():
for
transition
in
state
.
getDestinationValueList
():
transition_id
=
transition
.
getReference
()
transition_id
=
transition
.
getReference
()
if
transition_id
in
workflow
.
getTransitionIdList
():
if
transition_id
in
workflow
.
getTransitionIdList
():
if
transition
.
getDestinationId
():
if
transition
.
getDestinationId
():
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
(
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
({
dict
(
_class
=
'workflow.transition'
,
'_class'
:
'workflow.transition'
,
source
=
state
.
getId
(),
'source'
:
state
.
getId
(),
destination
=
transition
.
getDestinationId
(),
'destination'
:
transition
.
getDestinationId
(),
name
=
transition
.
getActionName
()
or
transition
.
getTitleOrId
(),
'name'
:
transition
.
getActionName
()
or
transition
.
getTitleOrId
(),
description
=
transition
.
getDescription
(),
'description'
:
transition
.
getDescription
(),
actbox_url
=
transition
.
getAction
(),
'actbox_url'
:
transition
.
getAction
(),
transition_id
=
transition
.
getId
()
# used for edition.
'transition_id'
:
transition
.
getId
(),
# used for edition.
))
'path'
:
transition
.
getPath
()
})
else
:
else
:
# user action
# user action
transition_
id_list
.
append
(
transition_id
)
transition_
list
.
append
(
transition
)
if
transition_id_list
!=
[]:
if
transition_list
!=
[]:
for
transition
in
transition_id_list
:
graph
[
'edge'
][
'transition_to_%s'
%
(
state
.
getId
())]
=
{
graph
[
'edge'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.transition'
,
'_class'
:
'workflow.transition'
,
'source'
:
state
.
getId
(),
'source'
:
state
.
getId
(),
'destination'
:
state
.
getId
(),
'destination'
:
state
.
getId
(),
'name_path_dict'
:
{
transition
.
getTitleOrId
():
transition
.
getPath
()
for
transition
in
transition_list
}
'name'
:
str
(
transition_id_list
)
}
}
if
position_graph
:
if
position_graph
:
...
@@ -55,52 +56,4 @@ def getWorkflowGraph(workflow):
...
@@ -55,52 +56,4 @@ def getWorkflowGraph(workflow):
graph
[
'node'
][
state_id
][
'coordinate'
]
=
position_graph
[
'node'
][
state_id
][
'coordinate'
]
graph
[
'node'
][
state_id
][
'coordinate'
]
=
position_graph
[
'node'
][
state_id
][
'coordinate'
]
return
graph
return
graph
return
json
.
dumps
(
dict
(
graph
=
getWorkflowGraph
(
context
),
class_definition
=
{}),
indent
=
2
)
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
)
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/dream_graph_editor/jsplumb/index.html.html
View file @
78a95a7e
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
<
div
class
=
"
window {{class}}
"
<
div
class
=
"
window {{class}}
"
id
=
"
{{element_id}}
"
id
=
"
{{element_id}}
"
title
=
"
{{title}}
"
>
title
=
"
{{title}}
"
>
{{
name
}}
<
a
href
=
"
{{name_href}}
"
>
{{
name
}}
<
/a
>
<
div
class
=
"
ep
"
><
/div
>
<
div
class
=
"
ep
"
><
/div
>
<
/div
>
<
/div
>
</script>
</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 @@
...
@@ -335,12 +335,26 @@
function
addEdge
(
gadget
,
edge_id
,
edge_data
)
{
function
addEdge
(
gadget
,
edge_id
,
edge_data
)
{
var
overlays
=
[],
var
overlays
=
[],
connection
;
connection
,
label
=
''
;
if
(
edge_data
.
name
)
{
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
=
[
overlays
=
[
[
"
Label
"
,
{
[
"
Label
"
,
{
cssClass
:
"
l1 component label
"
,
cssClass
:
"
l1 component label
"
,
label
:
edge_data
.
name
label
:
label
}]
}]
];
];
}
}
...
@@ -497,7 +511,8 @@
...
@@ -497,7 +511,8 @@
"
class
"
:
node_data
.
_class
.
replace
(
"
.
"
,
"
-
"
),
"
class
"
:
node_data
.
_class
.
replace
(
"
.
"
,
"
-
"
),
element_id
:
dom_element_id
,
element_id
:
dom_element_id
,
title
:
node_data
.
name
||
node_data
.
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
"
);
}),
"
text/html
"
).
querySelector
(
"
.window
"
);
render_element
.
append
(
domElement
);
render_element
.
append
(
domElement
);
box
=
$
(
gadget
.
props
.
element
).
find
(
"
#
"
+
dom_element_id
);
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