Index: openacs-4/packages/acs-subsite/www/permissions/grant.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/permissions/grant.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/acs-subsite/www/permissions/grant.tcl 17 May 2003 10:02:04 -0000 1.4
+++ openacs-4/packages/acs-subsite/www/permissions/grant.tcl 29 Sep 2003 14:53:37 -0000 1.5
@@ -2,53 +2,179 @@
ad_page_contract {
- @author rhs@mit.edu
- @creation-date 2000-08-20
- @cvs-id $Id$
+ @author rhs@mit.edu
+ @creation-date 2000-08-20
+ @cvs-id $Id$
} {
- object_id:integer,notnull
- {application_url ""}
+ object_id:integer,notnull
+ privileges:multiple,optional
+ {application_url ""}
}
ad_require_permission $object_id admin
# The object name is used in various localized messages below
set name [db_string name {select acs_object.name(:object_id) from dual}]
-doc_body_append "[ad_header "[_ acs-subsite.lt_Grant_Permission_on_n]"]
+set title [_ acs-subsite.lt_Grant_Permission_on_n]
-
[_ acs-subsite.lt_Grant_Permission_on_n]
+set context [list [list one?[export_url_vars object_id] "[_ acs-subsite.Permissions_for_name]"] [_ acs-subsite.Grant]]
-[ad_context_bar [list ./?[export_url_vars object_id] "[_ acs-subsite.Permissions_for_name]"] "[_ acs-subsite.Grant]"]
-
-
+element create grant object_id \
+ -widget hidden \
+ -value $object_id
-[ad_footer]
-"
+element create grant application_url \
+ -widget hidden \
+ -value $application_url \
+ -optional
+
+element create grant party_id \
+ -widget party_search \
+ -datatype party_search \
+ -optional
+
+
+if { [form is_valid grant] } {
+ # A valid submission, grant and revoke accordingly.
+
+ form get_values grant
+
+ if { ![info exists privileges] } {
+ # no privilege was selected
+ set privileges [list]
+ }
+
+ # loop through all privileges, grant checked and revoke un-checked
+ # (assuming that there are not too many privs in total, otherwise
+ # this would be slow)
+ foreach privilege $existing_privs {
+ if { [lsearch $privileges $privilege] > -1 } {
+ db_exec_plsql grant { }
+ } else {
+ db_exec_plsql revoke { }
+ }
+ }
+
+ ad_returnredirect "one?[export_url_vars object_id]"
+}
+