Index: openacs-4/contrib/packages/acknowledgement/acknowledgement.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/acknowledgement.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/acknowledgement.info 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+
+ Acknowledgement
+ Acknowledgements
+ f
+ t
+ acknowledgements
+
+
+ Peter Alberer
+ Ask system users for acknowledgements
+ 2003-10-08
+ Ask system users for acknowledgements
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.de_DE.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.de_DE.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.de_DE.ISO-8859-1.xml 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,56 @@
+
+
+
+ Nutzungsbedingung
+ Nutzungsbedingungen
+ Diese Nutzungsbedingung akzeptieren
+ Best�tigung bereits erfolgt
+ Sie haben diese Nutzungsbedingung bereits akzeptiert
+ Bitte markieren Sie das K�stchen als Zeichen Ihrer Zustimmung
+ Bitte schreiben Sie als Zeichen Ihrer Zustimmung das Wort %word% in das folgende Textfeld
+ Bitte geben Sie als Zeichen Ihrer Zustimmung Ihr Passwort in das folgende Textfeld ein
+ Danke f�r Ihre Zustimmung, wir w�nschen weiterhin viel Spass mit dem System
+ Zur�ck
+ Sie haben die Nutzungsbedingung nicht akzeptiert und werden vermutlich Probleme bei der weiteren Nutzung des System erfahren.
+ Details zu einer Nutzungsbedingung
+ Noch nicht akzeptiert
+ Noch nicht akzeptierte Nutzungsbedingungen
+ Bereits akzeptierte Nutzungsbedingungen
+ Kein F�lligkeitsdatum
+ F�lligkeitsdatum
+ Titel
+ Beschreibung
+ Best�tigungsdatum
+ Akzeptiert am
+ Nutzungsbedingung akzeptieren
+ Best�tigung absenden
+ Kurzbezeichner
+ Kurzbezeichner f�r eine Nutzungsbedingung, kann verwendet werden um programmgesteuert zu pr�fen, ob f�r einen Benutzer eine Best�tigung vorliegt.
+ Global
+ Wenn eine Best�tigung als "global" markiert ist, dann muss diese vom Benutzer des System akzeptiert werden, widrigenfalls wird der Account gesperrt. Nicht globale Best�tigungen regeln den Zugriff zu einzelnen Funktionen, und k�nnen programmgesteuert gepr�ft werden.
+ Modus
+ Gibt an, auf welche Weise ein Nutzer die Best�tigung abgegen muss.
+ Phrase
+ Falls Sie als Modus "Phrase" angegeben haben, geben Sie bitte hier die Phrase ein, die als Best�tigungstext erwartet wird (max. 20 Zeichen).
+ Gruppe
+ Diese Best�tigung nur einer bestimmten Nutzergruppe anzeigen. Zur Zeit werden nur direkte Mitgliedschaften beachtet (keine Kaskade)
+ Falls die Best�tigung bis zu einem bestimmten Datum akzeptiert werden muss, geben Sie dieses Datum bitte hier an
+ Alle Nutzungsbedingungen
+ Neue Nutzungsbedingung anlegen
+ Benutzer
+ Best�tigung nicht vorhanden
+ Eine Best�tigung mit der angegebenen ID ist nicht vorhanden
+ Nachname
+ Vorname
+ Fehler beim Reset
+ Beim L�schen der Nutzerdaten ist ein Fehler aufgetreten
+ Diese Best�tigung l�schen
+ Nutzerdaten zur�cksetzen
+ Anzahl von Benutzern, die diese Nutzungsbedingung akzeptiert haben
+ Alle bisherigen Benutzerbest�tigungen f�r diese Nutzungsbedingungen l�schen?
+ Alle Benutzer sperren, die diese Nutzungsbedingung nicht akzeptiert haben
+ Benutzerkennungen wurden gesperrt
+ Nutzungsbedingungen anzeigen
+ Zu akzeptierende Nutzungsbedingungen
+ Sie haben nicht alle Nutzungsbedingungen akzeptiert.
+
Index: openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.en_US.ISO-8859-1.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/catalog/acknowledgement.en_US.ISO-8859-1.xml 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,56 @@
+
+
+
+ Term of Use
+ Term of Use
+ Accept this Term of Use
+ Term of Use has already been accepted
+ You have already accepted this Term of Use
+ Please mark the checkbox as a sign of your acceptance
+ As a sign of your acceptance please enter the word %word% in the textbox
+ As a sign of your acceptance please enter your password into the textbox
+ Thanks for your acceptance, have fun using the system
+ Back
+ You have not accepted the term of use and will probably get problems accessing parts of the site in the future.
+ Details for this Term of Use
+ Not yet accepted
+ Terms of Use not yet accepted
+ Accepted Terms of Use
+ No due-date
+ Due-date
+ Title
+ Description
+ Date of acceptance
+ Accepted on
+ Accept Term of Use
+ Send confirmation
+ Shortname
+ Shortname for a term of use. This can be used to programmatically check for acceptance of a term of use via acknowledgement::require_response $shortname (for the current user)
+ Global
+ If a term of use is marked "global", it is valid for the whole site and has to be accepted by any user. Accounts of users who do not accept a global term of use are/will be locked. A term of use should not be global if it is just valid for part of the site.
+ Modus
+ How to let the user confirm the term of use. (present a checkbox, ask to enter a phrase, ask to enter the password)
+ Phrase
+ If you have entered "Phrase" for the mode, please enter the phrase you want the user to enter.
+ Group
+ Term of use can be valid for a certain group only. Currently only direct group memberships are supported (no cascade)
+ If the term of use can be confirmed until a certain date, please enter this due-date here.
+ All terms of use
+ Create a new term of use
+ User
+ Term of use not found
+ A term of use with the ID you entered can not be found
+ Last name
+ First names
+ Error while reseting
+ There has been an error during the reset operation
+ Delete this term of use
+ Reset the user confirmations
+ Number of user that have confirmed this term of use
+ Delete all confirmations for this term of use?
+ Lock all the users that have not confirmed this term of use
+ user accounts have been locked
+ Show terms of use
+ Terms of use you have to accept
+ You have not accepted all terms of use.
+
Index: openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-create.sql 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,170 @@
+
+create sequence acknowledgment_seq;
+
+create table acknowledgments (
+ ack_id integer
+ constraint ack_pk primary key,
+ shortname varchar(20)
+ constraint acs_shortname_nil
+ not null
+ constraint acs_shortname_un
+ unique,
+ title varchar(400)
+ constraint ack_title_nil
+ not null,
+ description varchar(2000)
+ constraint ack_desc_nil
+ not null,
+ global_p boolean
+ constraint acs_global_nil
+ not null,
+ ack_mode varchar(10)
+ constraint ack_mode_nil
+ not null
+ constraint ack_mode_ck
+ check (ack_mode in ('checkbox', 'phrase', 'password')),
+ ack_phrase varchar(20),
+ group_id integer
+ constraint ack_group_fk
+ references groups(group_id),
+ due_date date
+);
+
+create index acknowledgments_idx1 on acknowledgments(due_date);
+
+create table acknowledgment_responses (
+ ack_id integer
+ constraint ack_resp_ack_id_nil
+ not null
+ constraint ack_resp_ack_id_fk
+ references acknowledgments(ack_id),
+ user_id integer
+ constraint ack_resp_user_nil
+ not null
+ constraint ack_resp_user_fk
+ references users(user_id),
+ ack_date timestamp
+ default now()
+);
+
+create unique index acknowledgments_resp_idx1 on acknowledgment_responses(ack_id,user_id);
+
+create or replace function acknowledgment__new(integer,varchar,varchar,varchar,boolean,varchar,varchar,integer,date)
+returns integer as '
+declare
+ p_object_id alias for $1;
+ p_shortname alias for $2;
+ p_title alias for $3;
+ p_description alias for $4;
+ p_global alias for $5;
+ p_ack_mode alias for $6;
+ p_ack_phrase alias for $7;
+ p_group_id alias for $8;
+ p_due_date alias for $9;
+ v_object_id integer;
+begin
+ if p_object_id is null then
+ v_object_id := nextval(''acknowledgment_seq'');
+ else
+ v_object_id := p_object_id;
+ end if;
+
+ insert into acknowledgments
+ (ack_id, shortname, title, description, global_p, ack_mode, ack_phrase, group_id, due_date)
+ values
+ (v_object_id, p_shortname, p_title, p_description, p_global, p_ack_mode, p_ack_phrase, p_group_id, p_due_date);
+
+ return v_object_id;
+
+end;' language 'plpgsql';
+
+create or replace function acknowledgment__edit(integer,varchar,varchar,varchar,boolean,varchar,varchar,integer,date)
+returns integer as '
+declare
+ p_object_id alias for $1;
+ p_shortname alias for $2;
+ p_title alias for $3;
+ p_description alias for $4;
+ p_global alias for $5;
+ p_ack_mode alias for $6;
+ p_ack_phrase alias for $7;
+ p_group_id alias for $8;
+ p_due_date alias for $9;
+ v_object_id integer;
+begin
+ update acknowledgments
+ set shortname = p_shortname,
+ title = p_title,
+ description = p_description,
+ global_p = p_global,
+ ack_mode = p_ack_mode,
+ ack_phrase = p_ack_phrase,
+ group_id = p_group_id,
+ due_date = p_due_date
+ where ack_id = p_object_id;
+
+ return v_object_id;
+
+end;' language 'plpgsql';
+
+create or replace function acknowledgment__delete(integer)
+returns integer as '
+declare
+ p_object_id alias for $1;
+begin
+ delete from acknowledgment_responses
+ where ack_id = p_object_id;
+
+ delete from acknowledgments
+ where ack_id = p_object_id;
+
+ return 1;
+
+end;' language 'plpgsql';
+
+create or replace function acknowledgment__reset(integer)
+returns integer as '
+declare
+ p_object_id alias for $1;
+begin
+ delete from acknowledgment_responses
+ where ack_id = p_object_id;
+
+ return 1;
+
+end;' language 'plpgsql';
+
+create or replace function acknowledgment__new_response(integer,integer)
+returns integer as '
+declare
+ p_object_id alias for $1;
+ p_user_id alias for $2;
+begin
+ insert into acknowledgment_responses
+ (ack_id, user_id)
+ values
+ (p_object_id, p_user_id);
+
+ return 1;
+
+end;' language 'plpgsql';
+
+create or replace view acknowledgments_all_view as
+select
+ ack.ack_id, ack.shortname, ack.title, ack.due_date, ack.ack_mode, ack.group_id,
+ (select count(*) from acknowledgment_responses where ack_id = ack.ack_id) as responses
+from
+ acknowledgments ack
+order by
+ ack.ack_id;
+
+create or replace view acknowledgments_view as
+select
+ ack.ack_id, ack.shortname, ack.title, ack.due_date, ack.ack_mode, ack.group_id,
+ (select count(*) from acknowledgment_responses where ack_id = ack.ack_id) as responses
+from
+ acknowledgments ack
+where
+ ack.due_date > now()::date
+order by
+ ack.ack_id;
Index: openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-drop.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/sql/postgresql/acknowledgement-drop.sql 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,10 @@
+
+drop function acknowledgment__new(integer,varchar,varchar,varchar,boolean,varchar,varchar,integer,date);
+drop function acknowledgment__edit(integer,varchar,varchar,varchar,boolean,varchar,varchar,integer,date);
+drop function acknowledgment__delete(integer);
+drop function acknowledgment__reset(integer);
+drop function acknowledgment__new_response(integer,integer);
+
+drop table acknowledgment_responses cascade;
+drop table acknowledgments cascade;
+drop sequence acknowledgment_seq;
Index: openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-init.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-init.tcl 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,3 @@
+
+#create a cache for acknowledgement information
+ns_cache create ack_info_cache -timeout 3600
Index: openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/tcl/acknowledgement-procs.tcl 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,184 @@
+
+namespace eval acknowledgement {}
+
+proc ack_scheduler {} {
+ return 1
+}
+
+ad_proc -private acknowledgement::affected_users { ack_id group_id } {
+ Procedure is work in progress, currently hard coded returns users that
+ would be affected by a ban operation
+} {
+ if { [empty_string_p $group_id] } {
+ set sql_str {
+ select user_id from users
+ where not exists (select 1 from acknowledgment_responses where ack_id = :ack_id and user_id = users.user_id)
+ }
+ } else {
+ set sql_str {
+ select member_id from group_member_map
+ where group_id = $group_id
+ and not exists (select 1 from acknowledgment_responses where ack_id = :ack_id and user_id = member_id)
+ }
+ }
+ return [db_list get_user_list $sql_str]
+}
+
+ad_proc -public acknowledgement::lock_accounts { ack_id } {
+ Lock accounts of users who have not accepted a term of use
+} {
+ array set ack_info [get_data -ack_id $ack_id]
+ foreach element [affected_users $ack_id $ack_info(group_id)] {
+ acs_user::change_state -user_id $element -state "banned"
+ }
+ return [llength $lock_list]
+}
+
+ad_proc -public acknowledgement::get_data {
+ {-shortname ""}
+ {-ack_id ""}
+} {
+ Get information about a certain term of use
+} {
+ if { [empty_string_p $ack_id] } {
+ if { [empty_string_p $shortname] } { return 0 }
+ set sql_str "select ack_id from acknowledgments where shortname = :shortname"
+ set ack_id [db_string get_data $sql_str -default 0]
+ if { $ack_id == 0 } { return 0 }
+ }
+ set fields [list ack_id shortname title description global_p ack_mode ack_phrase group_id due_date]
+ set db_result [db_0or1row get_data "select [join $fields ","] from acknowledgments where ack_id = :ack_id"]
+ if { $db_result == 0 } { return 0 }
+ set output [list]
+ foreach element $fields {
+ lappend output $element [set $element]
+ }
+ ns_log Notice "Returning $output"
+ return $output
+}
+
+ad_proc -public acknowledgement::new { ack_id shortname title description global_p mode phrase group_id date } {
+ Create a new acknowledgement item
+} {
+ set sql_str "select acknowledgment__new(:ack_id,:shortname,:title,:description,:global_p,:mode,:phrase,:group_id,:date)"
+ return [db_string write_data $sql_str]
+}
+
+ad_proc -public acknowledgement::edit { ack_id shortname title description global_p mode phrase group_id date } {
+ Edit item data
+} {
+ set sql_str "select acknowledgment__edit(:ack_id,:shortname,:title,:description,:global_p,:mode,:phrase,:group_id,:date)"
+ return [db_string write_data $sql_str]
+}
+
+ad_proc -public acknowledgement::delete { ack_id } {
+ Delete an existing acknowledgement item
+} {
+ return [db_string write_data "select acknowledgment__delete(:ack_id)"]
+}
+
+ad_proc -public acknowledgement::repent_url { user_id } {
+ The url that users are presented to accept an acknowledgement
+ during the login procedure
+} {
+ return "[_ acknowledgement.repent]"
+}
+
+ad_proc -public acknowledgement::overdue_acks_p { user_id } {
+ Get the number of acknowledgement items that are "overdue" for a certain user
+} {
+ set sql_str {
+ select 1 from acknowledgments a
+ where global_p = 't'
+ and not exists (select 1 from acknowledgment_responses where ack_id = a.ack_id and user_id = :user_id)
+ and ( due_date is null or due_date <= now()::date )
+ and (a.group_id is null or ((select count(*) from group_member_map where group_id = a.group_id and member_id = :user_id) > 0))
+ }
+ return [llength [db_list get_data $sql_str]]
+}
+
+ad_proc -public acknowledgement::get_for_user { user_id {filter "overdue"} } {
+ Get the acknowledgement items that are "overdue" for a certain user
+ or if filter is "all" then return all items
+} {
+ set sql_str {
+ select a.ack_id, a.title, a.due_date from acknowledgments a
+ where global_p = 't'
+ and not exists (select 1 from acknowledgment_responses where ack_id = a.ack_id and user_id = :user_id)
+ }
+ if { $filter == "overdue" } { append sql_str " and ( due_date is null or due_date >= now()::date )" }
+ append sql_str {
+ and (a.group_id is null or ((select count(*) from group_member_map where group_id = a.group_id and member_id = :user_id) > 0))
+ order by a.ack_id
+ }
+ return [db_list_of_lists get_data $sql_str]
+}
+
+ad_proc -public acknowledgement::record_response { ack_id {user_id 0} } {
+ Record the response of a user to a certain acknowledgement item
+} {
+ if { $user_id == 0 } { set user_id [ad_get_user_id] }
+ db_string write_data "select acknowledgment__new_response(:ack_id,:user_id)"
+ array set ack_info [get_data -ack_id $ack_id]
+ ns_cache set ack_info_cache "${ack_info(shortname)}.$user_id" 1
+ return
+}
+
+ad_proc -public acknowledgement::reset_responses { ack_id } {
+ Reset all responses that user have given to an acknowledement item so far
+} {
+ return [db_string write_data "select acknowledgment__reset(:ack_id)"]
+}
+
+proc acknowledgement::response_exists_p { ack_id user_id } {
+ return [db_string get_data "select 1 from acknowledgment_responses where ack_id = :ack_id and user_id = :user_id" -default 0]
+}
+
+ad_proc -public acknowledgement::response_url {} {
+ An url that users are redirected to when they have to accept an acknowledgement item
+} {
+ return "/acknowledgements/record_response"
+}
+
+ad_proc -public acknowledgement::require_response { shortname } {
+ Programmatically check whether the current user has accepted a certain
+ acknowledgement item. The procedure checks whether the user has to
+ accept the acknowledgement item (because of group constraints) or not
+ and records the result in the cache ack_info_cache. If the user has not
+ accepted the item he is redirected to the url returned from acknowledgement::response_url
+
+ @param shortname The shortname of an acknowledement item
+ @see acknowledgement::response_url
+} {
+ set user_id [ad_get_user_id]
+ if { ![ns_cache get ack_info_cache "${shortname}.$user_id" result] } {
+ set result [acknowledgement::require_response_no_cache $user_id $shortname]
+ ns_cache set ack_info_cache "${shortname}.$user_id" $result
+ }
+ if { $result != 1 } {
+ set return_url [ns_conn url]
+ if { [ns_conn query] != "" } { append return_url "?[ns_conn query]" }
+ ad_returnredirect "$result&return_url=$return_url"
+ ad_script_abort
+ }
+ return 1
+}
+
+ad_proc -private acknowledgement::require_response_no_cache { user_id shortname } {
+ Checks whether a certain user has to accept a certain acknowledgement item
+ Called by acknowledgement::require_response
+
+ @see acknowledgement::require_response
+} {
+ array set ack_info [get_data -shortname $shortname]
+ set response_p [response_exists_p $ack_info(ack_id) $user_id]
+ if { $response_p } { return 1 }
+ if { [empty_string_p $ack_info(group_id)] } {
+ return "[response_url]?id=$ack_info(ack_id)"
+ } elseif { [group::member_p -user_id $user_id -group_id $ack_info(group_id) -cascade] } {
+ return "[response_url]?id=$ack_info(ack_id)"
+ }
+ return 1
+}
+
+ns_log Notice "Loaded acknowledgement procs"
Index: openacs-4/contrib/packages/acknowledgement/www/details.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/details.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/details.adp 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,6 @@
+
+@context@
+@page_title@
+
+
+@confirm_link;noquote@
Index: openacs-4/contrib/packages/acknowledgement/www/details.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/details.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/details.tcl 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,42 @@
+ad_page_contract {
+ Show details for one acknowledgement.
+
+ @author Peter Alberer(peter@alberer.com)
+ @creation-date 2003-10-06
+} {
+ id:notnull
+}
+
+set user_id [ad_get_user_id]
+set page_title [_ acknowledgement.details]
+set context [list $page_title]
+set confirm_link ""
+
+db_1row get_data {
+ select title,description,due_date,resp.ack_date
+ from acknowledgments a left join
+ (select ack_id, ack_date from acknowledgment_responses where user_id = :user_id) resp
+ on a.ack_id = resp.ack_id
+ where a.ack_id = :id
+}
+
+if { $ack_date == "" } {
+ set pretty_ack_date [_ acknowledgement.not_signed]
+ set confirm_link "[_ acknowledgement.sign_ack]"
+} else {
+ set pretty_ack_date [lc_time_fmt $ack_date "%Q"]
+}
+
+if { $due_date == "" } {
+ set pretty_due_date [_ acknowledgement.no_due_date]
+} else {
+ set pretty_due_date [lc_time_fmt $due_date "%Q"]
+}
+
+ad_form -name one_ack -mode display -has_edit 1 -form \
+{
+ {title:text {html {size 50}} {label "#acknowledgement.title#"} {value $title}}
+ {description:text {html {cols 60 rows 13}} {label "#acknowledgement.description#"} {value $description}}
+ {due_date:text {label "#acknowledgement.due_date#"} {value $pretty_due_date}}
+ {ack_date:text {label "#acknowledgement.sign_date#"} {value $pretty_ack_date}}
+}
Index: openacs-4/contrib/packages/acknowledgement/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/index.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/index.adp 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,13 @@
+
+@context@
+@page_title@
+
+
+
+
Index: openacs-4/contrib/packages/acknowledgement/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/index.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/index.tcl 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,60 @@
+
+set user_id [ad_get_user_id]
+
+if { $user_id == 0 } {
+ ad_returnredirect "/"
+ ad_script_abort
+}
+
+set page_title [_ acknowledgement.acks]
+set context [list $page_title]
+set admin_p [ad_permission_p [ad_conn package_id] admin]
+
+#get the acknowledgements that are relevant for the given user
+#in this case we want all acknowledgements, not only the ones that are overdue
+set open_acks_list [acknowledgement::get_for_user $user_id "all"]
+multirow create open_acks ack_id title due_date
+
+foreach element $open_acks_list {
+ multirow append open_acks [lindex $element 0] [lindex $element 1] [lc_time_fmt [lindex $element 2] "%Q"]
+}
+
+list::create \
+ -name "open_acks" \
+ -multirow "open_acks" \
+ -key ack_id \
+ -row_pretty_plural [_ acknowledgement.acks] \
+ -elements {
+ title {
+ label "Name"
+ link_url_eval {details?id=$ack_id}
+ }
+ due_date {
+ label "#acknowledgement.due_date#"
+ }
+ }
+
+#show all of the acknowledgements that the user has accepted
+db_multirow -extend { ack_date_pretty } confirmed_acks select_acks {
+ select a.ack_id, a.title, resp.ack_date
+ from acknowledgments a inner join (select ack_id, user_id, ack_date from acknowledgment_responses where user_id = :user_id) resp
+ on a.ack_id = resp.ack_id
+ order by ack_id;
+} {
+ set ack_date_pretty [lc_time_fmt $ack_date "%Q"]
+}
+
+list::create \
+ -name "confirmed_acks" \
+ -multirow "confirmed_acks" \
+ -key ack_id \
+ -row_pretty_plural [_ acknowledgement.acks] \
+ -elements {
+ title {
+ label "Name"
+ link_url_eval {details?id=$ack_id}
+ }
+ ack_date_pretty {
+ label "#acknowledgement.signed_ack_at_date#"
+ }
+ }
Index: openacs-4/contrib/packages/acknowledgement/www/record_response.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/record_response.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/record_response.adp 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,25 @@
+
+@context@
+@page_title@
+
+
+
+
@title@
+
@description@
+
+
+
+
+
+
+ @html;noquote@
+
Index: openacs-4/contrib/packages/acknowledgement/www/record_response.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/acknowledgement/www/record_response.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/acknowledgement/www/record_response.tcl 10 Oct 2003 14:46:42 -0000 1.1
@@ -0,0 +1,86 @@
+ad_page_contract {
+ Record user response for one acknowledgement.
+
+ @author Peter Alberer(peter@alberer.com)
+ @creation-date 2003-10-06
+} {
+ id:notnull
+ {mode "show"}
+ {user_id ""}
+ {return_url "/acknowledgements/"}
+ {response ""}
+}
+
+if { $user_id == "" } {
+ set user_id [ad_get_user_id]
+ set override_mode 0
+} else {
+ #if we get a user_id via url vars it means that the login-page redirected the
+ #user to us because the user has not yet confirmed a term of use.
+ #we do not login the user before she has confirmed the term of use because
+ #otherwise she could go wherever she wanted on the site.
+ #in order to be able to authenticate the user despite that, we force the
+ #confirm mode "password".
+ set override_mode 1
+ set return_url "/register/"
+}
+
+set page_title [_ acknowledgement.sign_ack]
+set context [list $page_title]
+
+db_1row get_data {
+ select title, description, due_date, ack_mode, ack_phrase, resp.ack_date
+ from acknowledgments a left join
+ (select ack_id, ack_date from acknowledgment_responses where user_id = :user_id) resp
+ on a.ack_id = resp.ack_id
+ where a.ack_id = :id
+}
+
+if { $ack_date != "" } {
+ ad_return_error [_ acknowledgement.ack_signed_1] [_ acknowledgement.ack_signed_2]
+ ad_script_abort
+}
+
+if { $override_mode == 1 } { set ack_mode "password" }
+
+if { $mode == "show" } {
+ switch $ack_mode {
+ "checkbox" {
+ set confirm_html "