Commit 59123325 authored by Frank Bergmann's avatar Frank Bergmann

- Gustaf changes

parent 5769bdc8
......@@ -2,13 +2,13 @@
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td valign=top>
<td valign="top">
</td>
<td valign=top>
<td valign="top">
<table align=right border=0 cellpadding=0 cellspacing=0>
<tr valign=bottom>
<table align="right" border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td>
<div style="float: left; position: relative; -moz-transform: rotate(270deg); -o-transform: rotate(270deg); -webkit-transform: rotate(270deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3);"><%= [lang::message::lookup "" intranet-riskmanagement.Impact Impact] %></div>
</td>
......@@ -20,13 +20,13 @@
</tr>
<tr>
<td>&nbsp;</td>
<td align=center><%= [lang::message::lookup "" intranet-riskmanagement.Probability Probability] %></td>
<td align="center"><%= [lang::message::lookup "" intranet-riskmanagement.Probability Probability] %></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=2>
<td colspan="2">
<div class="risk_table">
<form action="/intranet-riskmanagement/action" method=GET>
<%= [export_vars -form {return_url}] %>
......
......@@ -36,7 +36,7 @@ set probab_classifier_values $probab_classifier
set impact_classifier_values {}
foreach i $impact_classifier {
catch {
lappend impact_classifier_values [expr 1.0 * $project_budget * $i / 100.0]
lappend impact_classifier_values [expr {1.0 * $project_budget * $i / 100.0}]
}
}
......@@ -55,7 +55,7 @@ ad_proc im_risk_chart_classify {
set result ""
for {set i 0} {$i <= [llength $classifier]} {incr i} {
set low [lindex $classifier $i]
set high [lindex $classifier [expr $i+1]]
set high [lindex $classifier $i+1]
if {$value >= $low && $value <= $high} {
set result $i
break
......@@ -64,7 +64,7 @@ ad_proc im_risk_chart_classify {
if {"" == $result} {
if {$value >= $high} {
set result [expr [llength $classifier]-2]
set result [expr {[llength $classifier]-2}]
}
}
......@@ -78,7 +78,7 @@ ad_proc im_risk_chart_bg_color {
} {
Returns a suitable background color for x/y coordinates
} {
set sum [expr $x + $y]
set sum [expr {$x + $y}]
switch $sum {
0 { return "#00FF00" }
1 { return "#80FF80" }
......@@ -165,7 +165,7 @@ array set chart_ids_hash {}
db_foreach risks $risk_sql {
# Format columns for the list view
set row_html "<tr$bgcolor([expr $ctr % 2])>\n"
set row_html "<tr$bgcolor([expr {$ctr % 2}])>\n"
foreach column_var $column_vars {
append row_html "\t<td valign=top><nobr>"
set cmd "append row_html $column_var"
......@@ -186,7 +186,7 @@ db_foreach risks $risk_sql {
# Chart Hash - Number of risks in the cell
set v 0
if {[info exists chart_hash($key)]} { set v $chart_hash($key) }
set v [expr $v + 1]
set v [expr {$v + 1}]
set chart_hash($key) $v
# Chart risk_ids Hash - The IDs of the risks in the cell
......@@ -200,18 +200,18 @@ db_foreach risks $risk_sql {
# Format the risk summary chart
set risk_chart_header "<td width=20></td>"
for {set x 0} {$x < [expr [llength $probab_classifier]-1]} {incr x} {
set val [lindex $probab_classifier [expr $x+1]]
for {set x 0} {$x < [expr {[llength $probab_classifier]-1}]} {incr x} {
set val [lindex $probab_classifier $x+1]
append risk_chart_header "<td width=20 align=center>$val</td>\n"
}
set risk_chart_header "<tr>$risk_chart_header</tr>\n"
set risk_chart_html "<table id=risk_chart border=1 align=right style='border-collapse:separate'>\n"
for {set y [expr [llength $impact_classifier]-2]} {$y >= 0} {incr y -1} {
for {set y [expr {[llength $impact_classifier]-2}]} {$y >= 0} {incr y -1} {
set risk_chart_line ""
set val [lindex $impact_classifier [expr $y+1]]
set val [lindex $impact_classifier $y+1]
append risk_chart_line "<tr>\n<td align=right width=$cell_width>$val</td>\n"
for {set x 0} {$x < [expr [llength $probab_classifier]-1]} {incr x} {
for {set x 0} {$x < [expr {[llength $probab_classifier]-1}]} {incr x} {
set key "$y-$x"
set v ""
if {[info exists chart_hash($key)]} { set v $chart_hash($key) }
......
......@@ -23,7 +23,7 @@ ad_page_contract {
return_url
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set user_name [im_name_from_user_id [ad_conn user_id]]
if {"" != $action_id} { set action [im_category_from_id -translate_p 0 $action_id] }
......
......@@ -30,14 +30,14 @@ ad_page_contract {
{ project_id "" }
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
if {![im_permission $user_id "add_risks"]} {
ad_return_complaint "Insufficient Privileges" "
<li>You don't have sufficient privileges to add/modify risks."
}
if { ![info exists state] || $state == "" } {
if { ![info exists state] || $state eq "" } {
set state "pending"
}
......@@ -51,13 +51,13 @@ switch $state {
}
"approved" {
if {$risk_id > 0} {
if [catch {
if {[catch {
db_dml delete_risk "DELETE from im_risks where risk_id = :risk_id"
} errmsg ] {
} errmsg ]} {
ad_return_complaint "Argument Error" "<ul>$errmsg</ul>"
}
}
if { [info exists return_url] && ![empty_string_p $return_url] } {
if { [info exists return_url] && $return_url ne "" } {
ad_returnredirect "$return_url"
} else {
ad_returnredirect "/intranet/projects/view?project_id=$project_id"
......
......@@ -23,14 +23,14 @@ ad_page_contract {
project_id:integer
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
if {![im_permission $user_id "view_risks"]} {
ad_return_complaint "Insufficient Privileges" "
<li>You don't have sufficient privileges to see risks."
}
if {[info exists project_id] && ![empty_string_p $project_id] && $project_id > 0} {
if {[info exists project_id] && $project_id ne "" && $project_id > 0} {
set sql "select r.*, n.project_name from im_risks r, (select project_name from im_projects where project_id = :project_id) n where project_id = :project_id"
set data [list]
......@@ -50,7 +50,7 @@ if {[info exists project_id] && ![empty_string_p $project_id] && $project_id > 0
if { [llength $data] < 1 } {
set page_body "<br><b>This project doesn't seem to have any risks.</b>\n"
} else {
set x_axis [list 0 [expr $max_impact * 1.1] [im_get_axis $max_impact 10] "&euro;"]
set x_axis [list 0 [expr {$max_impact * 1.1}] [im_get_axis $max_impact 10] "&euro;"]
set y_axis [list 0 101 10 "%"]
set page_body [im_get_chart $x_axis $y_axis $data $settings]
}
......
<master>
<property name="title">@page_title@</property>
<property name="context">@context_bar@</property>
<property name="main_navbar_label">@main_navbar_label@</property>
<property name="sub_navbar">@sub_navbar;noquote@</property>
<property name="left_navbar">@left_navbar_html;noquote@</property>
<property name="show_context_help">@show_context_help_p;noquote@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="context">@context_bar;literal@</property>
<property name="main_navbar_label">@main_navbar_label;literal@</property>
<property name="sub_navbar">@sub_navbar;literal@</property>
<property name="left_navbar">@left_navbar_html;literal@</property>
<property name="show_context_help">@show_context_help_p;literal@</property>
<if @master_p@>
......
......@@ -24,7 +24,7 @@ ad_page_contract {
set return_url [im_url_with_query]
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
set page_title [lang::message::lookup "" intranet-riskmanagement.Risks "Risks"]
set context_bar [im_context_bar $page_title]
set main_navbar_label "projects"
......
......@@ -40,7 +40,7 @@ ad_page_contract {
return_url
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
if {![im_permission $user_id "add_risks"]} {
ad_return_complaint "Insufficient Privileges" "
......@@ -67,7 +67,7 @@ if { $exception_count > 0 } {
if {$risk_id > 0} {
if [catch {
if {[catch {
db_dml update_risk "UPDATE
im_risks SET
owner_id = :owner_id,
......@@ -77,7 +77,7 @@ if {$risk_id > 0} {
title = :title,
description = :description WHERE
risk_id = :risk_id"
} errmsg ] {
} errmsg ]} {
ad_return_complaint "Argument Error" "<ul>$errmsg</ul>"
return
......@@ -94,7 +94,7 @@ if {$risk_id > 0} {
db_release_unused_handles
if { [info exists return_url] && ![empty_string_p $return_url] } {
if { [info exists return_url] && $return_url ne "" } {
ad_returnredirect "$return_url"
} else {
ad_returnredirect "/intranet/projects/view?project_id=$project_id"
......
<master>
<property name="title">@page_title@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="main_navbar_label"></property>
<%= [im_box_header $page_title] %>
......@@ -7,7 +7,7 @@
<form action='@return_url;noquote@' method=POST>
<%= [export_vars -form {return_url risk_id risk_nr risk_name}] %>
<table cellspacing=2 cellpadding=2>
<table cellspacing="2" cellpadding="2">
<if "" eq @risk_type_id@>
<tr class=rowodd>
......@@ -24,7 +24,7 @@
<tr class=roweven>
<td></td>
<td><input type=submit value='<%= [lang::message::lookup "" intranet-core.Continue "Continue"] %>'></td>
<td><input type="submit" value='<%= [lang::message::lookup "" intranet-core.Continue "Continue"] %>'></td>
</tr>
</table>
......
......@@ -21,7 +21,7 @@ ad_page_contract {
# No permissions necessary, that's handled by the object's new page
# Here we just select an object_type_id for the given object.
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
set page_title [lang::message::lookup "" intranet-riskmanagement.Please_Select_a_Risk_Type "Please Select a Risk Type"]
set context_bar [im_context_bar $page_title]
......
<if @enable_master_p@><master></if>
<property name="title">@page_title@</property>
<property name="context">@context;noquote@</property>
<property name="doc(title)">@page_title;literal@</property>
<property name="context">@context;literal@</property>
<property name="main_navbar_label">riskmanagement</property>
<property name="focus">@focus;noquote@</property>
<property name="sub_navbar">@sub_navbar;noquote@</property>
<property name="focus">@focus;literal@</property>
<property name="sub_navbar">@sub_navbar;literal@</property>
<SCRIPT Language=JavaScript src=/resources/diagram/diagram/diagram.js></SCRIPT>
......
......@@ -74,7 +74,7 @@ if {![info exists task]} {
# Default & Security
# ------------------------------------------------------------------
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
set user_id $current_user_id
set current_url [im_url_with_query]
set action_url "/intranet-riskmanagement/new"
......@@ -95,7 +95,7 @@ set edit_risk_status_p 1
# Page Title
set page_title [lang::message::lookup "" intranet-riskmanagement.New_Risk "New Risk"]
if {[exists_and_not_null risk_id]} {
if {([info exists risk_id] && $risk_id ne "")} {
set page_title [db_string title "select project_name from im_projects where project_id = :risk_id" -default ""]
}
if {"" == $page_title && 0 != $risk_type_id} {
......@@ -113,7 +113,7 @@ set context [list $page_title]
# We need the risk_type_id for page title, dynfields etc.
# Check if we can deduce the risk_type_id from risk_id
if {0 == $risk_type_id || "" == $risk_type_id} {
if {[exists_and_not_null risk_id]} {
if {([info exists risk_id] && $risk_id ne "")} {
set risk_type_id [db_string ttype_id "select risk_type_id from im_risks where risk_id = :risk_id" -default 0]
}
}
......@@ -129,7 +129,7 @@ if {![info exists form_mode]} { set form_mode "display" }
if {"edit" == $form_mode} { set show_components_p 0 }
set risk_exists_p 0
if {[exists_and_not_null risk_id]} {
if {([info exists risk_id] && $risk_id ne "")} {
# Check if the risk exists
set risk_exists_p [db_string risk_exists_p "select count(*) from im_risks where risk_id = :risk_id"]
......
......@@ -18,7 +18,7 @@ ad_page_contract {
# Security
#
set menu_label "reporting-project-risks"
set current_user_id [ad_maybe_redirect_for_registration]
set current_user_id [auth::require_login]
set read_p [db_string report_perms "
select im_object_permission_p(m.menu_id, :current_user_id, 'read')
from im_menus m
......@@ -28,7 +28,7 @@ set read_p [db_string report_perms "
# For testing - set manually
set read_p "t"
if {![string equal "t" $read_p]} {
if {"t" ne $read_p } {
set message "You don't have the necessary permissions to view this page"
ad_return_complaint 1 "<li>$message"
ad_script_abort
......@@ -327,7 +327,7 @@ im_report_render_row \
set counter 0
set class ""
db_foreach sql $report_sql {
set class $rowclass([expr $counter % 2])
set class $rowclass([expr {$counter % 2}])
set risk_value_pretty [im_report_format_number $risk_value $output_format $number_locale]
set risk_impact_pretty [im_report_format_number $risk_impact $output_format $number_locale]
......
......@@ -23,7 +23,7 @@ ad_page_contract {
{absence_id:integer 0}
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set x_axis [list 0 1000 100 "kg"]
set y_axis [list 0 10000 1000 "Euro"]
......
......@@ -22,7 +22,7 @@ ad_page_contract {
{absence_id:integer 0}
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set page_body [im_risk_project_component $user_id 3088]
......
......@@ -25,7 +25,7 @@ ad_page_contract {
{ return_url "" }
}
set user_id [ad_maybe_redirect_for_registration]
set user_id [auth::require_login]
set page_title "View Risk"
set context_bar [im_context_bar $page_title]
......@@ -42,7 +42,7 @@ if {![im_permission $user_id "view_risks"]} {
# Get Risk Data
# ---------------------------------------------------------------
if {[info exists risk_id] && ![empty_string_p $risk_id] && $risk_id > 0} {
if {[info exists risk_id] && $risk_id ne "" && $risk_id > 0} {
if { ![db_0or1row risk_data "select r.*, im_name_from_user_id(owner_id) as owner_name from im_risks r where r.risk_id = :risk_id" ] } {
ad_return_complaint "Bad Risk" "<li>We couldn't find the risk \#$risk_id; Hmm... there must be something wrong with our page!"
return
......@@ -52,7 +52,7 @@ if {[info exists risk_id] && ![empty_string_p $risk_id] && $risk_id > 0} {
set page_title "Edit Risk"
set context_bar [im_context_bar $page_title]
} elseif { [info exists curr_project_id] && ![empty_string_p $curr_project_id] && $curr_project_id > 0 } {
} elseif { [info exists curr_project_id] && $curr_project_id ne "" && $curr_project_id > 0 } {
# create a new risk
set owner_id $user_id
set project_id $curr_project_id
......@@ -86,10 +86,10 @@ $html_hidden_info
<TD class=rowtitle align=middle colSpan=2>Risk</TD></TR>
<TR class=rowodd>
<TD>User</TD>
<TD><a href=\"/intranet/users/view?[export_vars -url {owner_id}]\">$owner_name</a></TD></TR>
<TD><a href=\"/intranet/users/[export_vars -base view {owner_id}]\">$owner_name</a></TD></TR>
<TR class=roweven>
<TD>Project</TD>
<TD><a href=\"/intranet/projects/view?[export_vars -url {project_id}]\">$project_name</a></TD></TR>
<TD><a href=\"/intranet/projects/[export_vars -base view {project_id}]\">$project_name</a></TD></TR>
<TR class=rowodd>
<TD>Title</TD>
<TD><input name=\"title\" type=\"text\" size=\"50\" value=$title></TD></TR>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment