Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.14 -r1.15 --- openacs-4/packages/acs-tcl/acs-tcl.info 12 Mar 2002 05:05:23 -0000 1.14 +++ openacs-4/packages/acs-tcl/acs-tcl.info 16 Mar 2002 01:32:21 -0000 1.15 @@ -31,7 +31,6 @@ - @@ -72,6 +71,9 @@ + + + @@ -84,6 +86,7 @@ + Index: openacs-4/packages/acs-tcl/tcl/community-core-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-tcl/tcl/community-core-procs-postgresql.xql 13 Feb 2002 17:41:11 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/community-core-procs-postgresql.xql 16 Mar 2002 01:32:21 -0000 1.6 @@ -27,34 +27,4 @@ - - - select membership_rel__approve(:rel_id) - - - - - - select membership_rel__ban(:rel_id) - - - - - - select membership_rel__reject(:rel_id) - - - - - - select membership_rel__delete(:rel_id) - - - - - - select membership_rel__unapprove(:rel_id) - - - Index: openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 9 Mar 2002 02:00:02 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/community-core-procs.tcl 16 Mar 2002 01:32:21 -0000 1.8 @@ -155,33 +155,7 @@ return } - switch -exact $state { - "approved" { - db_exec_plsql member_approve { - begin membership_rel.approve(rel_id => :rel_id); end; - } - } - "banned" { - db_exec_plsql member_ban { - begin membership_rel.ban(rel_id => :rel_id); end; - } - } - "rejected" { - db_exec_plsql member_reject { - begin membership_rel.reject(rel_id => :rel_id); end; - } - } - "deleted" { - db_exec_plsql member_delete { - begin membership_rel.delete(rel_id => :rel_id); end; - } - } - "needs approval" { - db_exec_plsql member_unapprove { - begin membership_rel.unapprove(rel_id => :rel_id); end; - } - } - } + membership_rel::change_state -rel_id $rel_id -state $state } ad_proc -public approve { @@ -191,37 +165,37 @@ } { change_state -user_id $user_id -state "approved" } - + ad_proc -public ban { {-user_id:required} } { Ban a user } { change_state -user_id $user_id -state "banned" } - + ad_proc -public reject { {-user_id:required} } { Reject a user } { change_state -user_id $user_id -state "rejected" } - + ad_proc -public delete { {-user_id:required} } { Delete a user } { change_state -user_id $user_id -state "deleted" } - + ad_proc -public unapprove { {-user_id:required} } { Unapprove a user } { change_state -user_id $user_id -state "needs approval" } - + } Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/membership-rel-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs-oracle.xql 16 Mar 2002 01:32:21 -0000 1.1 @@ -0,0 +1,36 @@ + + + + oracle8.1.6 + + + + begin membership_rel.approve(rel_id => :rel_id); end; + + + + + + begin membership_rel.ban(rel_id => :rel_id); end; + + + + + + begin membership_rel.delete(rel_id => :rel_id); end; + + + + + + begin membership_rel.reject(rel_id => :rel_id); end; + + + + + + begin membership_rel.unapprove(rel_id => :rel_id); end; + + + + Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/membership-rel-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs-postgresql.xql 16 Mar 2002 01:32:21 -0000 1.1 @@ -0,0 +1,36 @@ + + + + postgresql7.1 + + + + begin membership_rel__approve(rel_id => :rel_id); end; + + + + + + begin membership_rel__ban(rel_id => :rel_id); end; + + + + + + begin membership_rel__delete(rel_id => :rel_id); end; + + + + + + begin membership_rel__reject(rel_id => :rel_id); end; + + + + + + begin membership_rel__unapprove(rel_id => :rel_id); end; + + + + Index: openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl 16 Mar 2002 01:32:21 -0000 1.1 @@ -0,0 +1,66 @@ +ad_library { + Manage Membership Relations + + @author yon (yon@openforce.net) + @creation-date 2002-03-15 + @version $Id: membership-rel-procs.tcl,v 1.1 2002/03/16 01:32:21 yon Exp $ +} + +namespace eval membership_rel { + + ad_proc -public change_state { + {-rel_id:required} + {-state:required} + } { + Change the state of a membership relation + } { + switch -exact $state { + "approved" { db_exec_plsql approve {} } + "banned" { db_exec_plsql ban {} } + "rejected" { db_exec_plsql reject {} } + "deleted" { db_exec_plsql delete {} } + "needs approval" { db_exec_plsql unapprove {} } + } + } + + ad_proc -public approve { + {-rel_id:required} + } { + Approve a membership relation + } { + change_state -rel_id $rel_id -state "approved" + } + + ad_proc -public ban { + {-rel_id:required} + } { + Ban a membership relation + } { + change_state -rel_id $rel_id -state "banned" + } + + ad_proc -public reject { + {-rel_id:required} + } { + Reject a membership relation + } { + change_state -rel_id $rel_id -state "rejected" + } + + ad_proc -public delete { + {-rel_id:required} + } { + Delete a membership relation + } { + change_state -rel_id $rel_id -state "deleted" + } + + ad_proc -public unapprove { + {-rel_id:required} + } { + Unapprove a membership relation + } { + change_state -rel_id $rel_id -state "needs approval" + } + +}