Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-forum
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-forum
Commits
1e8de7ac
Commit
1e8de7ac
authored
Apr 08, 2004
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- removed the /forum/*.tcl files
parent
0e72d726
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
1415 deletions
+0
-1415
forum-action.tcl
www/forum/forum-action.tcl
+0
-109
new-system-incident.tcl
www/forum/new-system-incident.tcl
+0
-141
new-tind-2.tcl
www/forum/new-tind-2.tcl
+0
-305
new-tind.tcl
www/forum/new-tind.tcl
+0
-731
view-tind.tcl
www/forum/view-tind.tcl
+0
-129
No files found.
www/forum/forum-action.tcl
deleted
100755 → 0
View file @
0e72d726
# /packages/intranet-forum/www/intranet/forum/forum-action.tcl
#
# Copyright (C
)
2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_page_contract
{
Purpose: Takes commands from the /intranet/projects/view
page and saves changes, deletes tasks and scans for Trados
files.
@param return_url the url to return to
@param group_id group id
@author frank.bergmann@project-open.com
}
{
submit
action
topic_id:array,optional
{
return_url
""
}
}
set
user_id
[
ad_maybe_redirect_for_registration
]
set
page_body
"<PRE>
\n
"
if
{
$return
_url ==
""
}
{
set return_url
"/intranet/forum/"
}
set
topic_list
[
array
names topic_id
]
ns_log Notice
"forum-action: topic_list=
$topic
_list"
if
{
0 ==
[
llength
$topic
_list
]}
{
ad_returnredirect
$return
_url
}
# Make sure the respective im_forum_topic_user_map entries exist:
foreach
topic_insert_id
$topic
_list
{
if
{
[
catch
{
db_dml insert_forum_topic_map
"insert into im_forum_topic_user_map
(topic_id, user_id) values (
$topic
_insert_id,
$user
_id)"
}
err_msg
]
}
{
# nothing - probably existed before
}
}
# Convert the list of selected topics into a
# "topic_id in (1,2,3,4...
)
" clause
#
set topic_in_clause "
and topic_id in
(
"
append topic_in_clause
[
join
$topic
_list
", "
]
append topic_in_clause "
)
\n
"
ns_log Notice "
forum-action: topic_in_clause=$topic_in_clause
"
switch
$submit
{
"
Apply
" {
switch
$action
{
move_to_deleted {
set sql "
update im_forum_topic_user_map
set folder_id = 1
where
user_id=:user_id
$topic
_in_clause
"
db_dml mark_topics
$sql
}
move_to_inbox {
set sql "
update im_forum_topic_user_map
set folder_id = 0
where user_id=:user_id
$topic
_in_clause
"
db_dml mark_topics
$sql
}
mark_as_read {
set sql "
update im_forum_topic_user_map
set read_p = 't'
where user_id=:user_id
$topic
_in_clause
"
db_dml mark_topics
$sql
}
mark_as_unread {
set sql "
update im_forum_topic_user_map
set read_p = 'f'
where user_id=:user_id
$topic
_in_clause
"
db_dml mark_topics
$sql
}
default {
ad_return_complaint 1 "
<li>Unknown value for action: '$action'
"
}
}
ad_returnredirect
$return
_url
}
default {
ad_return_complaint 1 "
<li>Unknown value for submit: '$submit'
"
}
}
www/forum/new-system-incident.tcl
deleted
100755 → 0
View file @
0e72d726
# /packages/intranet-forum/www/intranet/forum/new-system-error.tcl
#
# Copyright (C
)
2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_page_contract
{
Creates a new system error from a
"Report this error"
button.
Works as an inteface between the request procesor generating
the incident and the forum module that works differntly
then
the old ACS ticket tracker.
So there are several difficulties:
- This page is publicly accessible, so it may be used for
denial of service attacks by flooding the system with
incidents
- We have to route the incidents to
@author frank.bergmann@project-open.com
}
{
error_url:trim
error_info:trim
error_first_names:trim
error_last_name:trim
error_user_email:trim
core_version:trim
system_url:trim
publisher_name
}
ns_log Notice
"new-system-incident: error_url=
$error
_url"
ns_log Notice
"new-system-incident: error_info=
$error
_info"
ns_log Notice
"new-system-incident: error_first_names=
$error
_first_names"
ns_log Notice
"new-system-incident: error_last_name=
$error
_last_name"
ns_log Notice
"new-system-incident: error_user_email=
$error
_user_email"
ns_log Notice
"new-system-incident: core_version=
$core
_version"
# Maximum number of incidents per day per IP address
# Designed to avoid denial or service attacks
set
max_dayily_incidents 3
# -----------------------------------------------------------------
# Lookup user_id or create entry
# -----------------------------------------------------------------
# Keep in mind that the email and other data might be completely fake.
ns_log Notice
"Check if the user already has an account:
$error
_user_email"
set
error_user_id
[
db_string user_id
"select party_id from parties where lower(email) = lower(:error_user_email)"
-default 0
]
if
{
0 !=
$error
_user_id
}
{
# The user already exists:
# Make sure there are no more
then
$max
_incidents today from the same IP
# ToDo: Implement !!!
}
else
{
# Doesn't exist yet - let's create it
ns_log Notice
"new-system-incident: creating new user '
$error
_user_email'"
array set creation_info
[
auth::create_user
\
-email
$error
_user_email
\
-url
$error
_url
\
-verify_password_confirm
\
-first_names
$error
_first_names
\
-last_name
$error
_last_name
\
-screen_name
"
$error
_first_names
$error
_last_name"
\
-username
"
$error
_first_names
$error
_last_name"
\
-password
$error
_first_names
\
-password_confirm
$error
_first_names
\
]
ns_log Notice
"new-system-incident: checking for '
$error
_user_email' after creation"
set error_user_id
[
db_string user_id
"select party_id from parties where lower(email) = lower(:error_user_email)"
-default 0
]
}
if
{
!$error_user_id
}
{
# create user didn't succeed...
# ToDo!!!
ad_return_complaint 1
"<li>Error accepted"
return
}
# -----------------------------------------------------------------
# Create an incident (without mail alert
)
# -----------------------------------------------------------------
set
topic_id
[
db_nextval
"im_forum_topics_seq"
]
set
parent_id
""
set
owner_id
$error
_user_id
set
scope
"group"
set
subject
$error
_url
set
message
$error
_info
set
priority 3
set
asignee_id
""
set
due
[
db_string tomorrow
"select sysdate+1 from dual"
]
# 1102 is "Incident"
set
topic_type_id 1102
# 1202 is "Open"
set
topic_status_id 1202
db_transaction
{
db_dml topic_insert
"
INSERT INTO im_forum_topics (
topic_id, group_id, parent_id, topic_type_id, topic_status_id,
posting_date, owner_id, scope, subject, message, priority,
asignee_id, due_date
) VALUES (
:topic_id, :report_group_id, :parent_id, :topic_type_id, :topic_status_id,
sysdate, :owner_id, :scope, :subject, :message, :priority,
:asignee_id, :due
)"
}
on_error
{
ad_return_error
"Error adding a new topic"
"
<LI>There was an error adding your ticket to our system.<br>
Please send an email to <A href=
\"
mailto:
[
ad_parameter
"SystemOwner"
""
""
]
\"
>
our webmaster</a>, thanks."
}
set
page_body
"
<H1>Incident Received</H1>
Your incident hast been received.<br>
You will be notified as soon as possible.
"
doc_return 200 text/html
[
im_return_template
]
www/forum/new-tind-2.tcl
deleted
100755 → 0
View file @
0e72d726
# /packages/intranet-forum/www/intranet-forum/forum/new-tind-2.tcl
#
# Copyright (C
)
2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_page_contract
{
process a new topic form submission
@param receive_updates:
all, none, major
(
=issue resolved, task done
)
@param actions:
accept, reject, clarify, close
@action_type:
new_message, edit_message, undefined, reply_message
@author frank.bergmann@project-open.com
}
{
action_type
{
actions
""
}
{
comments:trim
""
}
owner_id:integer
old_asignee_id:integer
object_id:integer
topic_id:integer
parent_id:integer
{
topic_type_id 0
}
{
topic_status_id 0
}
{
old_topic_status_id 0
}
{
scope
"pm"
}
{
subject:trim
}
{
message:trim
}
{
priority
"5"
}
{
asignee_id
""
}
{
due_date:array,date
""
}
{
receive_updates
"major"
}
{
read_p
"f"
}
{
folder_id
"0"
}
return_url
{
submit_save
""
}
{
submit_close
""
}
{
submit_accept
""
}
{
submit_reject
""
}
{
submit_clarify
""
}
}
# ------------------------------------------------------------------
# Procedures
# ------------------------------------------------------------------
ad_proc -public im_forum_topic_alert_user
{
$topic
_id
$owner
_id
$asignee
_id
$topic
_status_id
$old
_topic_status_id
}
{
Returns 1/0 to indicate whether the specific user wants to be
informed about a specific event
}
{
return 1
}
# ------------------------------------------------------------------
# Security, Parameters & Default
# ------------------------------------------------------------------
set
user_id
[
ad_maybe_redirect_for_registration
]
set
exception_text
""
set
exception_count 0
if
{
!
[
info
exists subject
]
||
$subject
==
""
}
{
append exception_text
"<li>You must enter a topic name"
incr exception_count
}
if
{
[
info
exists subject
]
&&
[
string
match
{
*
\"
*
}
$subject
]
}
{
append exception_text
"<li>Your topic name cannot include string quotes. It makes life too difficult for this collection of software."
incr exception_count
}
# check for not null start date
if
{
[
info
exists due_date
(
date
)
]
}
{
set due
$due
_date
(
date
)
}
else
{
set due
""
}
if
{
$exception
_count> 0
}
{
ad_return_complaint
$exception
_count
$exception
_text
return 0
}
# Only incidents and tasks have priority, status, asignees and
# due_dates
#
set
task_or_incident_p 0
if
{
$topic
_type_id == 1102 ||
$topic
_type_id == 1104
}
{
set task_or_incident_p 1
}
if
{
""
!=
$comments
}
{
set user_name
[
db_string get_user_name
[
im_name_from_user_id
(
user_id
)]]
set today_date
[
db_string get_today_date
"select sysdate from dual"
]
append message
"
\n\n\[
Comment from
$user
_name on
$today
_date
\]
:
\n
$comments
"
}
# ---------------------------------------------------------------------
# Reply to the topic
# ---------------------------------------------------------------------
if
{[
string
equal
$actions
"reply"
]}
{
ad_returnredirect
"/intranet-forum/forum/new-tind"
}
# ------------------------------------------------------------------
# Save the im_forum_topics record
# ------------------------------------------------------------------
if
{[
string
equal
$action
_type
"new_message"
]
||
[
string
equal
$action
_type
"reply_message"
]}
{
# We are creating a new item
db_transaction
{
db_dml topic_insert
"
insert into im_forum_topics (
topic_id, object_id, parent_id, topic_type_id, topic_status_id,
posting_date, owner_id, scope, subject, message, priority,
asignee_id, due_date
) values (
:topic_id, :object_id, :parent_id, :topic_type_id, :topic_status_id,
sysdate, :owner_id, :scope, :subject, :message, :priority,
:asignee_id, :due
)"
}
on_error
{
ad_return_error
"Error adding a new topic"
"
The database rejected the addition of discussion topic
\"
$subject
\"
. Here the error message: <pre>
$errmsg
\n
</pre>
\n
"
}
}
else
{
# We are modifying an existing item
db_transaction
{
db_dml topic_update
"
update im_forum_topics set
object_id=:object_id,
parent_id=:parent_id,
topic_type_id=:topic_type_id,
topic_status_id=:topic_status_id,
posting_date=sysdate,
owner_id=:owner_id,
scope=:scope,
subject=:subject,
message=:message,
priority=:priority,
asignee_id=:asignee_id,
due_date=:due
where topic_id=:topic_id"
}
on_error
{
ad_return_error
"Error modifying a topic"
"
The database rejected the modification of a of discussion topic
\"
$subject
\"
. Here the error message: <pre>
$errmsg
\n
</pre>
\n
"
}
}
# ---------------------------------------------------------------------
# Save the im_forum_topic_user_map record
# ---------------------------------------------------------------------
# im_forum_topics_user_map may or may not exist for every user.
# So we create a record just in case, even if the SQL fails.
db_transaction
{
db_dml im_forum_topic_user_map_insert
"
insert into im_forum_topic_user_map
(topic_id, user_id, read_p, folder_id, receive_updates) values
(:topic_id, :user_id, :read_p, :folder_id, :receive_updates)"
}
on_error
{
# nothing - may already exist...
}
# Now let's update the existing entry
db_transaction
{
db_dml im_forum_topic_user_map_update
"
update im_forum_topic_user_map set
read_p=:read_p,
folder_id=:folder_id,
receive_updates=:receive_updates
where
topic_id=:topic_id
and user_id=:user_id"
}
on_error
{
ad_return_error
"Error modifying a im_forum_topic_user_map"
"
The database rejected the modification of a of discussion topic
\"
$subject
\"
. Here the error message: <pre>
$errmsg
\n
</pre>
\n
"
}
# ---------------------------------------------------------------------
# Alert about asignee_changes
# ---------------------------------------------------------------------
ns_log Notice
"new-tind-2: asignee_id=
$asignee
_id, old_asignee_id=
$old
_asignee_id"
# Inform the asignee that he has got a new task/incident
#
if
{
$asignee
_id !=
$old
_asignee_id
}
{
# Always send a mail to a new asignee
#
set msg_url
"
[
ad_parameter SystemUrl
]
"
append msg_url
"/intranet-forum/forum/view?topic_id=
$topic
_id"
set topic_type
[
db_string topic_type
"select category from im_categories where category_id=:topic_type_id"
]
set msg_subject
"New
$topic
_type:
$subject
"
im_send_alert
$asignee
_id
"hourly"
$msg
_url
$msg
_subject
$message
# Inform the owner about the change except if it iss a client
# or if it is someone who
}
# ---------------------------------------------------------------------
# Close the ticket
# ---------------------------------------------------------------------
if
{[
string
equal
$actions
"close"
]}
{
# ToDo: Security Check
# Close the existing ticket.
set topic_status_id
[
im_topic_status_id_closed
]
db_transaction
{
db_dml topic_close
"
update im_forum_topics set topic_status_id = :topic_status_id
where topic_id=:topic_id"
}
on_error
{
ad_return_error
"Error modifying a topic"
"
Error closing
\"
$subject
\"
: <pre>
$errmsg
\n
</pre>
\n
"
}
# Send a mail to all subscribed users
#
set stakeholder_sql
"
select user_id
from im_forum_topic_user_map m
where m.topic_id=:topic_id
and receive_updates <> 'none'
"
db_foreach update_stakeholders
$stakeholder
_sql
{
set msg_url
"
[
ad_parameter SystemUrl
]
"
append msg_url
"/intranet-forum/forum/view?topic_id=
$topic
_id"
set topic_type
[
db_string topic_type
"select category from im_categories where category_id=:topic_type_id"
]
set msg_subject
"Closed
$topic
_type:
$subject
"
im_send_alert
$asignee
_id
"hourly"
$msg
_url
$msg
_subject
$message
}
}
# ---------------------------------------------------------------------
# Accept the ticket
# ---------------------------------------------------------------------
if
{[
string
equal
$actions
"accept"
]}
{
# ToDo: Security Check
# Set the status to
"accepted"
set topic_status_id
[
im_topic_status_id_accepted
]
db_transaction
{
db_dml topic_close
"
update im_forum_topics set topic_status_id = :topic_status_id
where topic_id=:topic_id"
}
on_error
{
ad_return_error
"Error modifying a topic"
"
Error closing
\"
$subject
\"
: <pre>
$errmsg
\n
</pre>
\n
"
}
# Send email notifications only to
"all changes"
.
#
set stakeholder_sql
"
select user_id
from im_forum_topic_user_map m
where m.topic_id=:topic_id
and receive_updates='all'
"
db_foreach update_stakeholders
$stakeholder
_sql
{
set msg_url
"
[
ad_parameter SystemUrl
]
"
append msg_url
"/intranet-forum/forum/view?topic_id=
$topic
_id"
set topic_type
[
db_string topic_type
"select category from im_categories where category_id=:topic_type_id"
]
set msg_subject
"Accepted
$topic
_type:
$subject
"
im_send_alert
$asignee
_id
"hourly"
$msg
_url
$msg
_subject
$message
}
}
db_release_unused_handles
ad_returnredirect
$return
_url
www/forum/new-tind.tcl
deleted
100755 → 0
View file @
0e72d726
This diff is collapsed.
Click to expand it.
www/forum/view-tind.tcl
deleted
100755 → 0
View file @
0e72d726
# /packages/intranet-forum/www/intranet/forum/view-tind.tcl
#
# Copyright (C
)
2003-2004 Project/Open
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_page_contract
{
Create a new Task, Incident, News or Discussion
(
TIND
)
@param topic_id: Message to refer to
@param display_style:
topic = full topic
(
subject+message
)
, no subtopics
thread = complete tree of subjects
topic_thread = full topic plus subtopics subjects
full = topic+all subtopics
@author frank.bergmann@project-open.com
}
{
topic_id:integer
{
display_style
"all"
}
{
return_url
""
}
}
# -------------- Security, Parameters & Default --------------------------
set
user_id
[
ad_maybe_redirect_for_registration
]
set
user_is_admin_p
[
im_is_user_site_wide_or_intranet_admin
$user
_id
]
set
user_is_wheel_p
[
ad_user_group_member
[
im_wheel_group_id
]
$user
_id
]
if
{
""
==
$return
_url
}
{
set return_url
[
im_url_with_query
]
}
set
page_title
"View Topic"
set
context_bar
[
ad_context_bar
[
list
/intranet/forum/ Forum
]
$page
_title
]
# -------------- Get the tree --------------------------
set
topic_sql
"
select
t.*,
ug.group_name,
tr.indent_level,
(10-tr.indent_level) as colspan_level,
ftc.category as topic_type,
fts.category as topic_status,
ou.first_names||' '||ou.last_name as owner_name,
au.first_names||' '||au.last_name as asignee_name
from
(select
topic_id,
(level-1) as indent_level
from
im_forum_topics t
start with
topic_id=:topic_id
connect by
parent_id = PRIOR topic_id
) tr,
im_forum_topics t,
users ou,
users au,
user_groups ug,
im_categories ftc,
im_categories fts
where
tr.topic_id = t.topic_id
and t.owner_id=ou.user_id
and ug.group_id=t.group_id
and t.asignee_id=au.user_id(+)
and t.topic_type_id=ftc.category_id(+)
and t.topic_status_id=fts.category_id(+)
"
# -------------- Setup the outer table with indents-----------------------
append
page_body
"
<br>
[
im_forum_navbar
"/intranet/projects/index"
[
list
]]
"
# outer table with 10 columns for indenting
append
page_body
"
<table cellspacing=0 border=0 cellpadding=3>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
"
# -------------- Render all TIND elements -----------------------
set
msg_ctr 1
db_foreach get_topic
$topic
_sql
{
# position table within the outer indent-table
append page_body
"<tr>"
if
{
$indent
_level > 0
}
{
append page_body
"<td colspan=
$indent
_level> </td>"
}
append page_body
"
<td colspan=
$colspan
_level>
<table border=0 cellpadding=0 bgcolor=#E0E0E0>"
if
{
$msg
_ctr == 1
}
{
append page_body
"
<tr><td class=rowtitle colspan=2 align=center>
$topic
_type</td></tr>"
}
append page_body
"
[
im_forum_render_tind
$topic
_id
$topic
_type_id
$topic
_type
$topic
_status_id
$topic
_status
$owner
_id
$asignee
_id
$owner
_name
$asignee
_name
$user
_id
$group
_id
$group
_name
$subject
$message
$posting
_date
$due
_date
$priority
$scope
]
</table>
</td>
</tr>
"
incr msg_ctr
}
append
page_body
"</table>
\n
"
doc_return 200 text/html
[
im_return_template
]
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