Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
erp5
Commits
f2cd97eb
Commit
f2cd97eb
authored
May 12, 2023
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
graph_editor: Support translation.
parent
5e2b3bbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
...eItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
+14
-2
No files found.
bt5/erp5_graph_editor/SkinTemplateItem/portal_skins/erp5_graph_editor/Workflow_getGraph.py
View file @
f2cd97eb
import
json
import
json
from
Products.ERP5Type.Utils
import
getTranslationStringWithContext
# TODO:
# TODO:
# select after script in edge properties
# select after script in edge properties
# checked box for validation ? or at least select before script
# checked box for validation ? or at least select before script
def
getWorkflowGraph
(
workflow
):
def
getWorkflowGraph
(
workflow
):
workflow_id
=
workflow
.
getId
()
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_list
=
[]
transition_list
=
[]
state_name
=
state
.
getId
()
state_title
=
state
.
getTitle
()
if
state_title
:
translated_state_title
=
getTranslationStringWithContext
(
context
,
state_title
,
'state'
,
workflow_id
)
if
translated_state_title
:
state_name
=
translated_state_title
graph
[
'node'
][
state
.
getId
()]
=
{
graph
[
'node'
][
state
.
getId
()]
=
{
'_class'
:
'workflow.state'
,
'_class'
:
'workflow.state'
,
'name'
:
state
.
getTitleOrId
()
,
'name'
:
state
_name
,
'is_initial_state'
:
is_initial_state
,
'is_initial_state'
:
is_initial_state
,
'path'
:
state
.
getPath
()
'path'
:
state
.
getPath
()
}
}
...
@@ -20,11 +28,15 @@ def getWorkflowGraph(workflow):
...
@@ -20,11 +28,15 @@ def getWorkflowGraph(workflow):
transition_id
=
transition
.
getReference
()
transition_id
=
transition
.
getReference
()
if
transition_id
in
workflow
.
getTransitionReferenceList
():
if
transition_id
in
workflow
.
getTransitionReferenceList
():
if
transition
.
getDestinationId
():
if
transition
.
getDestinationId
():
transition_name
=
transition
.
getActionName
()
or
transition
.
getTitleOrId
()
translated_transition_name
=
getTranslationStringWithContext
(
context
,
transition_name
,
'transition'
,
workflow_id
)
if
translated_transition_name
:
transition_name
=
translated_transition_name
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
({
graph
[
'edge'
][
"%s_%s"
%
(
state
.
getId
(),
transition
.
getId
())]
=
({
'_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
_name
,
'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.
...
...
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