Index: openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 12 May 2004 02:07:44 -0000 1.2
+++ openacs-4/packages/evaluation/sql/postgresql/evaluation-drop.sql 14 May 2004 23:38:42 -0000 1.3
@@ -200,6 +200,14 @@
drop function evaluation__delete_answer (integer);
---------------------------------------
+-- GRADES SHEETS
+---------------------------------------
+
+drop function evaluation__new_student_eval (integer, integer, integer, integer, numeric, char, text, varchar, timestamptz, integer, varchar, varchar, timestamptz, varchar, varchar);
+
+drop function evaluation__delete_student_eval (integer)
+
+---------------------------------------
-- STUDENT EVALUATIONS
---------------------------------------
Index: openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 13 May 2004 16:29:40 -0000 1.3
+++ openacs-4/packages/evaluation/tcl/apm-callback-procs.tcl 14 May 2004 23:38:42 -0000 1.4
@@ -13,6 +13,77 @@
namespace eval evaluation::apm_callbacks {}
+
+ad_proc -private evaluation::apm_callbacks::package_install {
+} {
+ Does the integration whith the notifications package.
+} {
+ db_transaction {
+
+ # Define notifications for new assignment
+
+ # The notification type impl
+ set impl_id \
+ [acs_sc::impl::new_from_spec -spec {
+ name one_assignment_notif_type
+ contract_name NotificationType
+ owner evaluation
+ aliases {
+ GetURL evaluation::notification::get_url
+ ProcessReply evaluation::notification::process_reply
+ }
+ }]
+
+ set type_id [notification::type::new \
+ -sc_impl_id $impl_id \
+ -short_name one_assignment_notif \
+ -pretty_name "One Assignment" \
+ -description "Notification of a new Assignmnent"]
+
+ # Enable the various intervals and delivery method
+ notification::type::interval_enable \
+ -type_id $type_id \
+ -interval_id [notification::interval::get_id_from_name -name instant]
+
+ notification::type::interval_enable \
+ -type_id $type_id \
+ -interval_id [notification::interval::get_id_from_name -name hourly]
+
+ notification::type::interval_enable \
+ -type_id $type_id \
+ -interval_id [notification::interval::get_id_from_name -name daily]
+
+ notification::type::delivery_method_enable \
+ -type_id $type_id \
+ -delivery_method_id [notification::delivery::get_id -short_name email]
+
+ }
+}
+
+ad_proc -private evaluation::apm_callbacks::package_uninstall {
+} {
+
+ Cleans the integration whith the notifications package.
+
+} {
+
+ db_transaction {
+
+ # Delete the notification type service contract
+ delete_notification_type_contract
+
+ # Delete the service contract implementation from the notifications service
+ unregister_email_delivery_method
+
+ # Unregister email delivery method service contract implementation
+ delete_email_delivery_method_impl
+
+ # Delete the delivery method service contract
+ delete_delivery_method_contract
+
+ }
+}
+
ad_proc -private evaluation::apm_callbacks::package_instantiate {
-package_id:required
} {
@@ -74,7 +145,7 @@
'evaluation_student_evals'
);
}
-
+
set creation_user [ad_verify_and_get_user_id]
set creation_ip [ad_conn peeraddr]
Index: openacs-4/packages/evaluation/tcl/evaluation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/tcl/evaluation-procs.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 12 May 2004 02:07:44 -0000 1.2
+++ openacs-4/packages/evaluation/tcl/evaluation-procs.tcl 14 May 2004 23:38:42 -0000 1.3
@@ -7,14 +7,53 @@
}
namespace eval evaluation {}
+namespace eval evaluation::notification {}
#####
#
# evaluation namespace
#
#####
+ad_proc -public evaluation::notification::get_url {
+ -task_id:required
+} {
+ returns a full url to the object_id.
+ handles messages and forums.
+} {
+
+ db_1row get_grade_id "select grade_id from evaluation_tasks where task_id = :task_id and content_revision__is_live(task_id) = true"
+ set assignment_url "[ad_url][ad_conn package_url]"
+ return [export_vars -base "${assignment_url}task-view" { task_id grade_id }]
+
+}
+ad_proc -public evaluation::notification::do_notification {
+ -task_id:required
+ -package_id:required
+} {
+
+ db_1row select_names {
+ select eg.grade_name,
+ et.task_name
+ from evaluation_grades eg,
+ evaluation_tasks et
+ where et.task_id = :task_id
+ and et.grade_id = eg.grade_id
+ }
+
+ set new_content "If you wan to see more.... ok see [evaluation::notification::get_url -task_id $task_id]"
+
+ # Notifies the users that requested notification for the specific assignment
+
+ notification::new \
+ -type_id [notification::type::get_type_id -short_name one_assignment_notif] \
+ -object_id $package_id \
+ -response_id $task_id \
+ -notif_subject "New Assignment" \
+ -notif_text $new_content
+}
+
ad_proc -public evaluation::package_key {} {
return "evaluation"
}
Index: openacs-4/packages/evaluation/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/evaluation/www/index.adp 12 May 2004 02:07:45 -0000 1.2
+++ openacs-4/packages/evaluation/www/index.adp 14 May 2004 23:38:43 -0000 1.3
@@ -6,7 +6,8 @@
Evaluations Admin
-Tasks
+Assignments
+@notification_chunk;noquote@
- There are no tasks for this package.
Index: openacs-4/packages/evaluation/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/index.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/index.tcl 28 Apr 2004 11:06:41 -0000 1.1
+++ openacs-4/packages/evaluation/www/index.tcl 14 May 2004 23:38:43 -0000 1.2
@@ -23,4 +23,11 @@
}
+set notification_chunk [notification::display::request_widget \
+ -type one_assignment_notif \
+ -object_id $package_id \
+ -pretty_name "Assignments" \
+ -url [ad_conn url] \
+ ]
+
ad_return_template
\ No newline at end of file
Index: openacs-4/packages/evaluation/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/index.adp 28 Apr 2004 11:06:41 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/index.adp 14 May 2004 23:38:43 -0000 1.2
@@ -7,7 +7,8 @@
- Admin my Assignment Types
-Tasks
+Assignments
+@notification_chunk;noquote@
- There are no tasks for this package.
Index: openacs-4/packages/evaluation/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/index.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/index.tcl 28 Apr 2004 11:06:41 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/index.tcl 14 May 2004 23:38:43 -0000 1.2
@@ -20,4 +20,11 @@
}
+set notification_chunk [notification::display::request_widget \
+ -type one_assignment_notif \
+ -object_id $package_id \
+ -pretty_name "Assignments" \
+ -url [ad_conn url] \
+ ]
+
ad_return_template
\ No newline at end of file
Index: openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 28 Apr 2004 11:09:54 -0000 1.1
+++ openacs-4/packages/evaluation/www/admin/tasks/task-add-edit.tcl 14 May 2004 23:38:43 -0000 1.2
@@ -290,7 +290,8 @@
db_exec_plsql copy_content { *SQL* }
}
}
-
+
+ evaluation::notification::do_notification -task_id $revision_id -package_id [ad_conn package_id]
ad_returnredirect "$return_url"
ad_script_abort
}