Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rest
Commits
ece52c63
Commit
ece52c63
authored
Jul 04, 2015
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Summary: - REST / Gantt Editor:
Fixed JSON quoting to deal with \ and " and adhere to standards in general
parent
077e8006
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
project-task-tree.json.tcl
www/data-source/project-task-tree.json.tcl
+7
-9
No files found.
www/data-source/project-task-tree.json.tcl
View file @
ece52c63
...
...
@@ -118,7 +118,6 @@ set projects_sql "
p.*, -- p.* needs to come after gp.* in case gp is NULL
tree_level(p.tree_sortkey) as level,
(p.end_date - p.start_date)::interval as duration,
(select im_name_from_user_id(min(r.object_id_two)) from acs_rels r where r.object_id_one = p.project_id) as assignee,
(select count(*) from im_projects child where child.parent_id = p.project_id) as num_children,
CASE WHEN bts.open_p = 'o' THEN 'true' ELSE 'false' END as expanded,
p.sort_order
...
...
@@ -181,8 +180,6 @@ template::multirow foreach task_multirow {
for
{
set
i 0
}
{
$i
<
$old
_level
}
{
incr
i
}
{
append indent
"
\t
"
}
}
set project_name
"
$project
_name"
# The current task is on the same level as the previous.
# This is also executed after reducing the old_level in the previous while loop
if
{
$level
==
$old
_level
}
{
...
...
@@ -203,25 +200,26 @@ template::multirow foreach task_multirow {
if
{[
info
exists predecessor_hash
(
$project
_id
)]}
{
set predecessor_tasks
$predecessor
_hash
(
$project
_id
)
}
if
{[
info
exists assignee_hash
(
$project
_id
)]}
{
set assignees
$assignee
_hash
(
$project
_id
)
}
set quoted_char_map
{
"
\n
"
"
\\\n
"
"
\r
"
""
"
\"
"
"
\\\"
"
"
\\
"
"
\\\\
"
}
set quoted_project_name
[
string
map
$quoted
_char_map
$project
_name
]
append task_json
"
${indent}
\{
${indent}
\t
id:
$project
_id,
${indent}
\t
text:
'
$project
_name'
,
${indent}
\t
text:
\"
$quoted
_project_name
\"
,
${indent}
\t
duration:13.5,
${indent}
\t
predecessors:
\[
[
join
$predecessor
_tasks
", "
]
\]
,
${indent}
\t
assignees:
\[
[
join
$assignees
", "
]
\]
,
${indent}
\t
user:'
$assignee
',
${indent}
\t
iconCls:'task-folder',
${indent}
\t
iconCls:
\"
task-folder
\"
,
${indent}
\t
expanded:
$expanded
,
"
foreach var
$valid
_vars
{
# Skip xml_* variables
(
only used by MS-Project
)
if
{[
regexp
{
^xml_
}
$var
match
]}
{
continue
}
# Append the value to the JSON output
set value
[
set
$var
]
set
mapped_value
[
string
map
{
"
\n
"
"<br>"
"
\r
"
""
}
$value
]
append task_json
"
${indent}
\t
$var:
'
$mapped
_value'
,
\n
"
set
quoted_value
[
string
map
$quoted
_char_map
$value
]
append task_json
"
${indent}
\t
$var:
\"
$quoted
_value
\"
,
\n
"
}
append task_json
"
${indent}
\t
leaf:
$leaf
_json"
...
...
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