begin
:1 := logger_project.new (
@@ -22,7 +22,7 @@
begin
- logger_project.delete(:project_id);
+ logger_project.del(:project_id);
end;
Index: openacs-4/packages/logger/tcl/project-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/logger/tcl/project-procs.tcl 25 Apr 2003 09:47:11 -0000 1.4
+++ openacs-4/packages/logger/tcl/project-procs.tcl 1 May 2003 10:00:24 -0000 1.5
@@ -9,6 +9,32 @@
namespace eval logger::project {}
+ad_proc -private logger::project::insert {
+ {-name:required}
+ {-description ""}
+ {-project_lead ""}
+ {-project_id ""}
+ {-package_id:required}
+ {-creation_user:required}
+ {-creation_ip:required}
+} {
+ Inserts a logger project into the database. This proc is only used internally.
+ Should not be used by applications.
+
+ @return The project_id of the created project.
+
+ @author Peter Marklund
+} {
+ # Project lead defaults to creation user
+ if { [empty_string_p $project_lead] } {
+ set project_lead $creation_user
+ }
+
+ set project_id [db_exec_plsql insert_project {}]
+
+ return $project_id
+}
+
ad_proc -public logger::project::new {
{-name:required}
{-description ""}
@@ -22,7 +48,7 @@
This proc requires the ad_conn proc to be initialized (uses user_id, peeraddr, and package_id).
The ad_conn proc is initialized
- by the request processor during an HTTP request to an OpenACS server.
+ by the request processor during an HTTP request to an OpenACS server. Invokes logger::project::insert
@param name The name of the project.
@@ -33,20 +59,21 @@
@return The project_id of the created project.
+ @see logger::project::insert
+
@author Peter Marklund
} {
# Use ad_conn to initialize variables
logger::util::set_vars_from_ad_conn {package_id creation_user creation_ip}
- # Project lead defaults to creation user
- if { [empty_string_p $project_lead] } {
- set project_lead $creation_user
- }
-
- # Insert the project
- set project_id [db_exec_plsql insert_project {}]
-
- return $project_id
+ return [logger::project::insert \
+ -name $name \
+ -description $description \
+ -project_lead $project_lead \
+ -project_id $project_id \
+ -package_id $package_id \
+ -creation_user $creation_user \
+ -creation_ip $creation_ip]
}
ad_proc -public logger::project::edit {
Index: openacs-4/packages/logger/tcl/variable-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/variable-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/logger/tcl/variable-procs.tcl 25 Apr 2003 09:47:11 -0000 1.4
+++ openacs-4/packages/logger/tcl/variable-procs.tcl 1 May 2003 10:00:24 -0000 1.5
@@ -42,7 +42,7 @@
set package_id [db_null]
}
- db_exec_plsql insert_variable {}
+ set variable_id [db_exec_plsql insert_variable {}]
return $variable_id
}
Index: openacs-4/packages/logger/tcl/test/logger-test-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/test/logger-test-init.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/logger/tcl/test/logger-test-init.tcl 25 Apr 2003 09:47:47 -0000 1.5
+++ openacs-4/packages/logger/tcl/test/logger-test-init.tcl 1 May 2003 10:00:47 -0000 1.6
@@ -49,12 +49,16 @@
# Create a package
- set package_id [apm_package_instance_new -instance_name $package_name \
- -package_key logger]
+ # Using the old depreceated proc here because apm_package_instance_new have different
+ # arg lists on cvs head and 4.6 branch
+ set package_id [apm_package_create_instance $package_name [ad_conn package_id] logger]
# Create a project in that package
- set project_id [logger::project::new -name $project_name \
- -package_id $package_id]
+ logger::util::set_vars_from_ad_conn {creation_user creation_ip}
+ set project_id [logger::project::insert -name $project_name \
+ -package_id $package_id \
+ -creation_user $creation_user \
+ -creation_ip $creation_ip]
# Assert that the name of the project can be retrieved
logger::project::get -project_id $project_id \
@@ -79,9 +83,7 @@
# Create and map the minutes variable
# (variate by pre-generating the variable id this time)
- set minutes_var_id [db_nextval logger_variables_seq]
- set minutes_var_id [logger::variable::new -variable_id $minutes_var_id \
- -name $minutes_var(name) \
+ set minutes_var_id [logger::variable::new -name $minutes_var(name) \
-unit $minutes_var(unit) \
-type $minutes_var(type)]
logger::project::add_variable -project_id $project_id \
Index: openacs-4/packages/logger/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/logger/www/index.adp 1 May 2003 07:20:16 -0000 1.4
+++ openacs-4/packages/logger/www/index.adp 1 May 2003 10:01:00 -0000 1.5
@@ -29,7 +29,9 @@
@projects.name@
- +
+
+ +
+
@@ -58,7 +60,7 @@
@variables.name@ (@variables.unit@)
-
+
+
Index: openacs-4/packages/logger/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/logger/www/index.tcl 1 May 2003 07:20:16 -0000 1.4
+++ openacs-4/packages/logger/www/index.tcl 1 May 2003 10:01:00 -0000 1.5
@@ -13,7 +13,7 @@
}
set package_id [ad_conn package_id]
-set user_id [ad_conn user_id]
+set current_user_id [ad_conn user_id]
set admin_p [permission::permission_p -object_id $package_id -privilege admin]
###########
@@ -184,7 +184,7 @@
# We always show the current user in the user filter so if we are showing "my entries" carry over the selected_user_id
# when selecting a project
set url_export_list {{selected_project_id $project_id}}
- if { [string equal $selected_user_id $user_id] } {
+ if { [string equal $selected_user_id $current_user_id] } {
lappend url_export_list selected_user_id
}
set url "index?[export_vars $url_export_list]"
@@ -264,7 +264,7 @@
where ao.object_id = le.entry_id
and submitter.user_id = ao.creation_user
and ([ad_decode $where_clauses "" "" "[join $where_clauses "\n and "]"]
- or submitter.user_id = :user_id
+ or submitter.user_id = :current_user_id
)
group by submitter.user_id, submitter.first_names, submitter.last_name
" {
Index: openacs-4/packages/logger/www/log.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/logger/www/log.adp 30 Apr 2003 12:21:02 -0000 1.2
+++ openacs-4/packages/logger/www/log.adp 1 May 2003 10:01:00 -0000 1.3
@@ -6,6 +6,8 @@
-Log History for last 31 Days
+
+ Log History for last 31 Days
-
+
+
Index: openacs-4/packages/logger/www/log.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/logger/www/log.tcl 30 Apr 2003 12:21:02 -0000 1.3
+++ openacs-4/packages/logger/www/log.tcl 1 May 2003 10:01:00 -0000 1.4
@@ -19,7 +19,7 @@
}
set package_id [ad_conn package_id]
-set user_id [ad_conn user_id]
+set current_user_id [ad_conn user_id]
if { [exists_and_not_null entry_id] } {
set entry_exists_p [db_string entry_exists_p {
@@ -186,3 +186,19 @@
ad_returnredirect "[ad_conn url]?entry_id=$entry_id"
ad_script_abort
}
+
+###########
+#
+# Log history
+#
+###########
+
+# Show the log history if the user is looking at /editing his own entry or if
+# the user is adding a new entry
+if { $entry_exists_p && [string equal $current_user_id $entry_array(creation_user)] } {
+ set entry_edited_by_owner_p 1
+} else {
+ set entry_edited_by_owner_p 0
+}
+
+set show_log_history_p [expr $entry_edited_by_owner_p || ! $entry_exists_p]