Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-cost
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-cost
Commits
a69ed522
Commit
a69ed522
authored
Nov 03, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Implemented CSP (Content Security Policy)
parent
b4bd2785
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
11 deletions
+31
-11
intranet-cost-procs.tcl
tcl/intranet-cost-procs.tcl
+23
-7
index.adp
www/cost-centers/index.adp
+7
-0
index.tcl
www/cost-centers/index.tcl
+1
-4
No files found.
tcl/intranet-cost-procs.tcl
View file @
a69ed522
...
...
@@ -1529,7 +1529,7 @@ ad_proc im_costs_project_finance_component {
append cost_html "
<tr class='rowplain'>
<td colspan=99>
<input class=
\"
$fold
_class
\"
id=
\"
$cost
_type_id
\"
type=
\"
button
\"
value=
\"\"
onclick=
\"
toggle_visibility
(
$cost
_id,
$cost
_type_id
);
\"
fold_status=
\"
$open
_p
\"
>
<input class=
\"
$fold
_class
\"
id=
\"
toggle_$cost_type_id
\"
type=
\"
button
\"
value=
\"
\"
fold_status=
\"
$open
_p
\"
>
<span class='table_interim_title'>$cost_type_l10n</span>
</td>
</tr>
\n
"
...
...
@@ -1537,6 +1537,10 @@ ad_proc im_costs_project_finance_component {
set old_cost_type_id
$cost
_type_id
set old_atleast_one_unreadable_p
$atleast
_one_unreadable_p
set atleast_one_unreadable_p 0
append toggle_js "
document.getElementById
(
'toggle_$cost_type_id'
)
.addEventListener
(
'click', function
()
{
toggle_visibility
(
$cost
_id,
$cost
_type_id
);
});
"
}
# Avoid errors with strange cost_type_ids from planning etc
...
...
@@ -1688,8 +1692,13 @@ ad_proc im_costs_project_finance_component {
# Close the main table
append cost_html "
</tbody></table>
\n
"
set nonce_html ""
if {
[
info
exists ::__csp_nonce
]
&& "" ne
$::
__csp_nonce} {
set nonce_html "
nonce=
\"
$::
__csp_nonce
\"
"
}
append cost_html "
<script type=
\"
text/javascript
\"
>
<script type=
\"
text/javascript
\"
$nonce
_html
>
var costs =
{};
"
foreach ctype_id
[
array
names cost_hash
]
{
...
...
@@ -1700,17 +1709,17 @@ ad_proc im_costs_project_finance_component {
// Change visibility of row
function toggle_visibility
(
cost_id, cost_type_id
)
{
console.log
(
'toggle_visibility: cost_type_: ' + cost_type_id
);
var header = document.getElementById
(
cost_type_id
);
var header = document.getElementById
(
'toggle_'+
cost_type_id
);
var fold_status = 'o'
;
var cost_list = costs
\[
cost_type_id
\]
;
if
(
document.getElementById
(
cost_type_id
)
.getAttribute
(
'fold_status'
)
== 'o'
)
{
if
(
document.getElementById
(
'toggle_'+
cost_type_id
)
.getAttribute
(
'fold_status'
)
== 'o'
)
{
// current status is 'open', hide all children
for
(
var i = 0
;
i < cost_list.length
;
i++
)
{
var elem = document.getElementById
(
'cost_'+cost_list
\[
i
\]
);
if
(
elem != null
)
{
elem.className = elem.className.replace
(
'row_visible', 'row_hidden'
);
};
var elem = document.getElementById
(
'note_'+cost_list
\[
i
\]
);
if
(
elem != null
)
{
elem.className = elem.className.replace
(
'row_visible', 'row_hidden'
);
};
};
};
if
(
header != null
)
{
header.style.backgroundImage = 'url
(
/intranet/images/plus_9.gif
)
'
;
// change background image
header.setAttribute
(
'fold_status', 'c'
);
// set hidden attribute fold_status
...
...
@@ -1723,7 +1732,7 @@ ad_proc im_costs_project_finance_component {
if
(
elem != null
)
{
elem.className = elem.className.replace
(
'row_hidden', 'row_visible'
);
};
var elem = document.getElementById
(
'note_'+cost_list
\[
i
\]
);
if
(
elem != null
)
{
elem.className = elem.className.replace
(
'row_hidden', 'row_visible'
);
};
};
};
if
(
header != null
)
{
header.style.backgroundImage = 'url
(
/intranet/images/minus_9.gif
)
'
;
// change background image
header.setAttribute
(
'fold_status', 'o'
);
// set hidden attribute fold_status
...
...
@@ -1861,7 +1870,7 @@ ad_proc im_costs_project_finance_component {
</td></tr>
<tr><td>$currency_outdated_warning</td></tr>
</table>
"
"
}
...
...
@@ -1983,6 +1992,13 @@ ad_proc im_costs_project_finance_component {
set result_html "
$currency
_outdated_warning
<script type='text/javascript' nonce='$::__csp_nonce'>
window.addEventListener
(
'load', function
()
{
$toggle
_js
});
</script>
<table>
<tr valign=top>
<td valign=top>
...
...
www/cost-centers/index.adp
View file @
a69ed522
...
...
@@ -4,6 +4,13 @@
<property name="admin_navbar_label">admin_cost_centers</property>
<property name="left_navbar">@left_navbar_html;literal@</property>
<script type="text/javascript" <if @::__csp_nonce@ not nil>nonce="@::__csp_nonce;literal@"</if>>
window.addEventListener('load', function() {
document.getElementById('list_check_all').addEventListener('click', function() { acs_ListCheckAll('inconsistent_parents', this.checked) });
});
</script>
<h1>@page_title@</h1>
@help_txt;noquote@
...
...
www/cost-centers/index.tcl
View file @
a69ed522
...
...
@@ -215,10 +215,7 @@ template::list::create \
-bulk_actions
$bulk
_actions_list
\
-elements
{
cc_chk
{
label
"<input type=
\"
checkbox
\"
checked
name=
\"
_dummy
\"
onclick=
\"
acs_ListCheckAll('inconsistent_parents', this.checked)
\"
title=
\"
Check/uncheck all rows
\"
>"
label
"<input id=list_check_all type=
\"
checkbox
\"
checked name=
\"
_dummy
\"
title=
\"
Check/uncheck all rows
\"
>"
display_template
{
@inconsistent_parents.cc_chk
;
noquote@
}
...
...
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