Commit 55884d5d authored by Frank Bergmann's avatar Frank Bergmann

Imported sources

parents
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="intranet-riskmanagement" url="http://openacs.org/repository/apm/packages/intranet-riskmanagement" type="apm_application">
<package-name>Project/Open Riskmanagement</package-name>
<pretty-plural>Project/Open Riskmanagement</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<auto-mount>intranet-riskmanagement</auto-mount>
<version name="2.0" url="http://openacs.org/repository/download/apm/intranet-riskmanagement-2.0.apm">
<owner url="mailto:fraber@fraber.de">Frank Bergmann</owner>
<owner url="mailto:mai-bee@gmx.net">Alwin Egger</owner>
<vendor url="http://www.project-open.com/">Project/Open</vendor>
<provides url="intranet-timesheet" version="1.0"/>
<requires url="intranet-core" version="1.0"/>
<callbacks>
</callbacks>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
-- /packages/intranet-timesheet/sql/oracle/intranet-timesheet-create.sql
--
-- Copyright (C) 1999-2004 various parties
-- The code is based on ArsDigita ACS 3.4
--
-- This program is free software. You can redistribute it
-- and/or modify it under the terms of the GNU General
-- Public License as published by the Free Software Foundation;
-- either version 2 of the License, or (at your option)
-- any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY;
-- without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details.
--
-- @author unknown@arsdigita.com
-- @author frank.bergmann@project-open.com
-- @author mai-bee@gmx.net
------------------------------------------------------------
-- Riskmanagement
--
-- We record project risks and represent them graphically.
--
create table im_risks (
risk_id integer
constraint im_risks_pk
primary key,
-- constraint im_risks_risk_id_fk
-- references acs_objects,
project_id integer not null
constraint im_risks_project_id_fk
references im_projects,
owner_id integer not null
constraint im_risks_owner_id_fk
references users,
probability number(5,2),
impact number(7,0),
title varchar(100),
description varchar(4000),
type integer
references im_categories
constraint im_risks_risk_type_const not null
);
create index im_risks_project_id_idx on im_risks(project_id);
create index im_risks_title_idx on im_risks(title);
begin
-- add_risks should only be allowed to project managers
acs_privilege.create_privilege('add_risks','Add Risks','Add Risks');
end;
/
begin
-- view_risks depends on the company
acs_privilege.create_privilege('view_risks','View Risks','View Risks');
end;
/
--------------
-- View in Project
--------------
create or replace view im_risk_types as
select category_id as risk_type_id, category as risk_type
from im_categories
where category_type = 'Intranet Risk Type';
-- 5100 - 5199 Absence types
delete from im_categories where category_id >= 5100 and category_id <= 5199;
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values ('', 'f', '5100', 'Internal', 'Intranet Risk Type');
insert into im_categories ( CATEGORY_DESCRIPTION, ENABLED_P, CATEGORY_ID, CATEGORY, CATEGORY_TYPE) values ('', 'f', '5101', 'External', 'Intranet Risk Type');
-- views to "risk" items: 210-219
delete from im_view_columns where column_id >= 20100 and column_id < 20200;
delete from im_views where view_id >= 210 and view_id < 220;
insert into im_views (view_id, view_name, visible_for) values (210, 'risk_list_home', 'view_risks');
-- view_columns to "risks" items: 20100 - 20199
insert into im_view_columns values (20101,210,NULL,'Title',
'"<a href=\"/intranet-riskmanagement/view?risk_id=$risk_id\">$risk_title</a>"','','',2,'');
insert into im_view_columns values (20102,210,NULL,'Type',
'"$risk_type_name"','','',3,'');
insert into im_view_columns values (20103,210,NULL,'Probability',
'"$risk_probability"','','',4,'');
insert into im_view_columns values (20104,210,NULL,'Impact',
'"$risk_impact"','','',5,'');
insert into im_view_columns values (20105,210,NULL,'Delete?',
'"<a href=\"/intranet-riskmanagement/delete?[export_url_vars risk_id project_id]\">Del</a>"','','',6,'');
commit;
---------------------------------------------------------
-- Register the component in the core TCL pages
--
BEGIN
im_component_plugin.del_module(module_name => 'intranet-riskmanagement');
END;
/
show errors
commit;
-- Show the forum component in project page
--
declare
v_plugin integer;
begin
v_plugin := im_component_plugin.new (
plugin_name => 'Project Risk Component',
package_name => 'intranet-riskmanagement',
page_url => '/intranet/projects/view',
location => 'left',
sort_order => 30,
component_tcl =>'im_risk_project_component $user_id $project_id'
);
end;
/
show errors
commit;
\ No newline at end of file
-- /packages/intranet-timesheet/sql/oracle/intranet-timesheet-create.sql
--
-- Copyright (C) 1999-2004 various parties
-- The code is based on ArsDigita ACS 3.4
--
-- This program is free software. You can redistribute it
-- and/or modify it under the terms of the GNU General
-- Public License as published by the Free Software Foundation;
-- either version 2 of the License, or (at your option)
-- any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY;
-- without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details.
--
-- @author unknown@arsdigita.com
-- @author frank.bergmann@project-open.com
-- @author mai-bee@gmx.net
------------------------------------------------------------
-- Riskmanagement
--
-- We record project risks and represent them graphically.
--
drop table im_risks;
--------------
-- View in Project
--------------
drop view im_risk_types;
-- 5100 - 5199 Absence types
delete from im_categories where category_id >= 5100 and category_id <= 5199;
-- views to "risk" items: 210-219
delete from im_view_columns where column_id >= 20100 and column_id < 20200;
delete from im_views where view_id >= 210 and view_id < 220;
---------------------------------------------------------
-- Register the component in the core TCL pages
--
BEGIN
im_component_plugin.del_module(module_name => 'intranet-riskmanagement');
END;
/
show errors
commit;
# /packages/intranet-timesheet/tcl/intranet-timesheet-procs.tcl
#
# Copyright (C) 1998-2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_library {
Procs used in riskmanagement module
@author unknown@arsdigita.com
@author mai-bee@gmx.net
}
# ---------------------------------------------------------------------
# Analyze logged hours
# ---------------------------------------------------------------------
ad_proc -public im_risk_project_component {user_id project_id} {
Creates a view of the risks concerning this project an provied a link
to a graphical representation of this data. This is a classical list page.
} {
# defaults
set view_name "risk_list_home"
# check permissions
if {![im_permission $user_id "view_risks"]} {
return ""
}
set return_html ""
# Define Table Columns
set view_id [db_string get_view_id "select view_id from im_views where view_name=:view_name"]
set column_headers [list]
set column_vars [list]
set column_sql "
select
column_name,
column_render_tcl,
visible_for
from
im_view_columns
where
view_id=:view_id
and group_id is null
order by
sort_order"
db_foreach column_list_sql $column_sql {
if {$visible_for == "" || [eval $visible_for]} {
lappend column_headers "$column_name"
lappend column_vars "$column_render_tcl"
}
}
# define sql
set sql "
select
risk_id,
type as risk_type,
im_category_from_id(type) as risk_type_name,
title as risk_title,
probability as risk_probability,
impact as risk_impact
from
im_risks
where
project_id = :project_id
order by
title"
# Format the List Table Header
# Set up colspan to be the number of headers + 1 for the # column
set colspan [expr [llength $column_headers] + 1]
append return_html "<table border=0><tr><td colspan=$colspan align=center class=rowtitle>Risks</td><tr>\n"
append return_html "<tr>\n"
foreach col $column_headers {
append return_html "<td class=rowtitle>$col</td>\n"
}
append return_html "</tr>\n"
# add data
set table_body_html ""
set bgcolor(0) " class=roweven "
set bgcolor(1) " class=rowodd "
set ctr 0
db_foreach risk_query $sql {
#Append together a line of data based on the "column_vars" parameter list
append table_body_html "<tr$bgcolor([expr $ctr % 2])>\n"
foreach column_var $column_vars {
append table_body_html "\t<td valign=top>"
set cmd "append table_body_html $column_var"
eval $cmd
append table_body_html "</td>\n"
}
append table_body_html "</tr>\n"
incr ctr
}
# Show a reasonable message when there are no result rows:
if { $ctr == 0 } {
set table_body_html "
<tr><td colspan=$colspan class=rowodd><div align=center><i>No risks specified for this project</i></div></td></tr>"
}
append return_html $table_body_html
append return_html "</table>"
# add links to graph and to form to add risks
append return_html "<a href=\"/intranet-riskmanagement/graph?project_id=$project_id\">See graphical representation</a>"
if {[im_permission $user_id "add_risks"]} {
append return_html "<br><a href=\"/intranet-riskmanagement/view?curr_project_id=$project_id\">Add risk</a>"
}
return "$return_html<br><br>"
}
# /packages/intranet-core/www/admin/categories/category-add-2.tcl
#
# Copyright (C) 1998-2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Delete a risk.
@param risk_id ID of risk to change/save
@param state pending or aproved
@param return_url the url to return to
@param project_id the current project_id
@author mai-bee@gmx.net
} {
risk_id:integer
{ state "" }
{ return_url "" }
{ project_id "" }
}
set user_id [ad_maybe_redirect_for_registration]
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 == "" } {
set state "pending"
}
switch $state {
"pending" {
set page_body "<form action=\"delete.tcl\" method=GET>The risk is going to be deleted!
<input type=hidden name=state value=approved><input type=hidden name=risk_id value=$risk_id>
<input type=hidden name=project_id value=$project_id><input type=submit name=submit value=OK></form>"
doc_return 200 text/html [im_return_template]
}
"approved" {
if {$risk_id > 0} {
if [catch {
db_dml delete_risk "DELETE from im_risks where risk_id = :risk_id"
} errmsg ] {
ad_return_complaint "Argument Error" "<ul>$errmsg</ul>"
}
}
if { [info exists return_url] && ![empty_string_p $return_url] } {
ad_returnredirect "$return_url"
} else {
ad_returnredirect "/intranet/projects/view?project_id=$project_id"
}
}
}
\ No newline at end of file
# /packages/intranet-core/www/intranet/customers/new.tcl
#
# Copyright (C) 2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Displays a graph representing all the risks corresponding to one project.
@param absence_id which component should be modified
@param return_url the url to be send back after the saving
@author mai-bee@gmx.net
} {
project_id:integer
}
set user_id [ad_maybe_redirect_for_registration]
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} {
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]
set settings [list 0 30 800 400 "t"]
set max_impact 1
db_foreach get_project_risks $sql {
if { $type == 5100 } {
set curr_image "images/bullet-red.gif"
} else {
set curr_image "images/bullet-green.gif"
}
lappend data [list $impact $probability 10 "$title" "/intranet-riskmanagement/view?risk_id=$risk_id" $curr_image]
set max_impact [max $max_impact $impact]
}
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 y_axis [list 0 101 10 "%"]
set page_body [im_get_chart $x_axis $y_axis $data $settings]
}
set page_title "Risks for project \"$project_name\""
set context_bar [ad_context_bar $page_title]
# add legend
append page_body "
<img src=\"images/bullet-red.gif\" width=10 height=10> External Risks<br>
<img src=\"images/bullet-green.gif\" width=10 height=10> Internal Risks"
} else {
ad_return_complaint "Bad Project ID" "<li>The project ID submitted didn't have the right format!"
return
}
doc_return 200 text/html [im_return_template]
# /packages/intranet-translation/www/index.tcl
#
# Copyright (C) 2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/ for licensing details.
ad_page_contract {
@author mai-bee@gmx.net
} {
}
db_release_unused_handles
ad_returnredirect "/intranet/"
# /packages/intranet-core/www/admin/categories/category-add-2.tcl
#
# Copyright (C) 1998-2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Save (changes) in risk. (new.tcl doesn't exist, changes are submitted from view.tcl)
@param risk_id ID of risk to change/save
@param owner_id user saving the risk
@param project_id the project the risk belongs to
@param title title of the risk
@param description mor details
@param probability pro. the incident desribed by the risk occurs
@param impact the impact the incident would have
@param type the type of this risk
@param return_url the url to return back to
@author mai-bee@gmx.net
} {
risk_id:integer
owner_id:notnull
project_id:notnull
title:notnull
description:notnull
probability:notnull
impact:notnull
type:notnull
return_url
}
set user_id [ad_maybe_redirect_for_registration]
if {![im_permission $user_id "add_risks"]} {
ad_return_complaint "Insufficient Privileges" "
<li>You don't have sufficient privileges to add/modify risks."
}
set exception_count 0
set exception_text ""
if { $probability < 0 || $probability > 100 } {
incr exception_count
append exception_text "<li>The probability must be between 0 and 100 %"
}
if { $impact < 0 } {
incr exception_count
append exception_text "<li>The impact must be positive or 0"
}
if { $exception_count > 0 } {
ad_return_complaint $exception_count $exception_text
return
}
if {$risk_id > 0} {
if [catch {
db_dml update_risk "UPDATE
im_risks SET
owner_id = :owner_id,
project_id = :project_id,
probability = :probability,
impact = :impact,
title = :title,
description = :description WHERE
risk_id = :risk_id"
} errmsg ] {
ad_return_complaint "Argument Error" "<ul>$errmsg</ul>"
return
}
} else {
if [catch {
db_dml insert_risk "INSERT INTO im_risks
(risk_id, owner_id, project_id, probability, impact, title, description, type) values
([im_new_object_id], :owner_id, :project_id, :probability, :impact, :title, :description, :type)"
} errmsg] {
ad_return_complaint "Argument Error" " <ul>$errmsg</ul>"
}
}
db_release_unused_handles
if { [info exists return_url] && ![empty_string_p $return_url] } {
ad_returnredirect "$return_url"
} else {
ad_returnredirect "/intranet/projects/view?project_id=$project_id"
}
# /packages/intranet-core/www/intranet/customers/new.tcl
#
# Copyright (C) 2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Displays the editor for one absence.
@param absence_id which component should be modified
@param return_url the url to be send back after the saving
@author mai-bee@gmx.net
} {
{absence_id:integer 0}
}
set user_id [ad_maybe_redirect_for_registration]
set x_axis [list 0 1000 100 "kg"]
set y_axis [list 0 10000 1000 "Euro"]
set data [list [list 400 6000 30 "Test" "http://www.news.ch"]]
set settings [list 0 30 800 400 "t"]
set page_body [im_get_chart $x_axis $y_axis $data $settings]
doc_return 200 text/html [im_return_template]
# /packages/intranet-core/www/intranet/customers/new.tcl
# # Copyright (C) 2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Displays the editor for one absence.
@param absence_id which component should be modified
@param return_url the url to be send back after the saving
@author mai-bee@gmx.net
} {
{absence_id:integer 0}
}
set user_id [ad_maybe_redirect_for_registration]
set page_body [im_risk_project_component $user_id 3088]
doc_return 200 text/html [im_return_template]
# /www/admin/categories/one.tcl
#
# Copyright (C) 2004 various parties
# The code is based on ArsDigita ACS 3.4
#
# This program is free software. You can redistribute it
# and/or modify it under the terms of the GNU General
# Public License as published by the Free Software Foundation;
# either version 2 of the License, or (at your option)
# any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
ad_page_contract {
Displays and edits a risk.
@param risk_id which component should be modified
@param curr_project_id only used on creation of new risk
@author mai-bee@gmx.net
} {
{ risk_id:integer 0 }
{ curr_project_id:integer 0 }
{ return_url "" }
}
set user_id [ad_maybe_redirect_for_registration]
set page_title "View Risk"
set context_bar [ad_context_bar $page_title]
# ---------------------------------------------------------------
# Permission
# ---------------------------------------------------------------
if {![im_permission $user_id "view_risks"]} {
ad_return_complaint "Insufficient Privileges" "
<li>You don't have sufficient privileges to see risks."
}
# ---------------------------------------------------------------
# Get Risk Data
# ---------------------------------------------------------------
if {[info exists risk_id] && ![empty_string_p $risk_id] && $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
}
db_1row pro_name "select project_name from im_projects where project_id = :project_id"
set page_title "Edit Risk"
set context_bar [ad_context_bar $page_title]
} elseif { [info exists curr_project_id] && ![empty_string_p $curr_project_id] && $curr_project_id > 0 } {
# create a new risk
set owner_id $user_id
set project_id $curr_project_id
db_1row pro_name "select project_name from im_projects where project_id = :project_id"
db_1row user_name_date "select im_name_from_user_id(:user_id) as owner_name from dual"
set risk_id 0
set probability "0.00"
set impact "0"
set title ""
set description ""
set type 5100
set page_title "New Risk"
set context_bar [ad_context_bar $page_title]
} else {
ad_return_complaint "Missing Parameters" "<li>To crate a new risk, at least the project ID must be specified (curr_project_id)!"
}
# ---------------------------------------------------------------
# Format Risk Data
# ---------------------------------------------------------------
set html_hidden_info [export_form_vars owner_id risk_id project_id return_url]
set page_body "
<form action=\"new-2.tcl\" method=GET>
$html_hidden_info
<TABLE border=0>
<TBODY>
<TR>
<TD class=rowtitle align=middle colSpan=2>Risk</TD></TR>
<TR class=rowodd>
<TD>User</TD>
<TD><a href=\"/intranet/users/view?[export_url_vars owner_id]\">$owner_name</a></TD></TR>
<TR class=roweven>
<TD>Project</TD>
<TD><a href=\"/intranet/projects/view?[export_url_vars project_id]\">$project_name</a></TD></TR>
<TR class=rowodd>
<TD>Title</TD>
<TD><input name=\"title\" type=\"text\" size=\"100\" value=$title></TD></TR>
<TR class=rowodd>
<TD>Probability</TD>
<TD><input name=\"probability\" type=\"text\" size=\"30\" value=$probability>%</TD></TR>
<TR class=roweven>
<TD>Impact</TD>
<TD><input name=\"impact\" type=\"text\" size=\"30\" value=$impact></TD></TR>
<TR class=rowodd>
<TD>Description</TD>
<TD><textarea name=\"description\" cols=\"50\" rows=\"5\">$description</textarea></TD></TR>
<TR class=rowodd>
<TD>Risk Type</TD>
<TD>[im_category_select "Intranet Risk Type" type $type]</TD></TR>
</TBODY></TABLE>
<input type=submit name=submit value=Save></form><form action=\"delete.tcl\" method=GET><input type=submit name=submit value=Delete>
<input type=hidden name=state value=pending>
<input type=hidden name=risk_id value=$risk_id>
<input type=hidden name=project_id value=$project_id>
</form>
"
doc_return 200 text/html [im_return_template]
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