Index: openacs-4/packages/forums/tcl/forums-security-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-security-procs.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/forums/tcl/forums-security-procs.tcl 17 May 2003 10:42:46 -0000 1.6
+++ openacs-4/packages/forums/tcl/forums-security-procs.tcl 21 Sep 2003 19:58:58 -0000 1.7
@@ -25,7 +25,7 @@
{-user_id ""}
{-forum_id:required}
} {
- return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege forum_read]
+ return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege read]
}
ad_proc -public require_read_forum {
@@ -41,7 +41,7 @@
{-user_id ""}
{-message_id:required}
} {
- return [permission::permission_p -party_id $user_id -object_id $message_id -privilege forum_read]
+ return [permission::permission_p -party_id $user_id -object_id $message_id -privilege read]
}
ad_proc -public require_read_message {
@@ -57,7 +57,7 @@
{-user_id ""}
{-forum_id:required}
} {
- return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege forum_create]
+ return [permission::permission_p -party_id $user_id -object_id $forum_id -privilege create]
}
ad_proc -public require_post_forum {
@@ -73,7 +73,7 @@
{-user_id ""}
{-message_id:required}
} {
- return [permission::permission_p -party_id $user_id -object_id $message_id -privilege forum_write]
+ return [permission::permission_p -party_id $user_id -object_id $message_id -privilege write]
}
ad_proc -public require_post_message {
Index: openacs-4/packages/forums/www/forum-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/forum-view.adp,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/forums/www/forum-view.adp 28 Aug 2003 09:41:54 -0000 1.21
+++ openacs-4/packages/forums/www/forum-view.adp 21 Sep 2003 19:58:58 -0000 1.22
@@ -2,8 +2,6 @@
#forums.Forum_1# @forum.name;noquote@
@context;noquote@
-
-
-
-
Index: openacs-4/packages/forums/www/message-post.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v
diff -u -r1.22 -r1.23
--- openacs-4/packages/forums/www/message-post.tcl 20 Jun 2003 15:24:24 -0000 1.22
+++ openacs-4/packages/forums/www/message-post.tcl 21 Sep 2003 19:58:58 -0000 1.23
@@ -18,7 +18,7 @@
}
}
-set user_id [ad_verify_and_get_user_id]
+set user_id [ad_conn user_id]
# get the colors from the params
set table_border_color [parameter::get -parameter table_border_color]
@@ -82,6 +82,20 @@
-widget hidden \
-optional
+# We show the anonymous checkbox if you're logged in, and user_id 0 is allowed to post
+set anonymous_allowed_p [expr [ad_conn user_id] != 0 && \
+ ([empty_string_p $forum_id] || \
+ [forum::security::can_post_forum_p -forum_id $forum_id -user_id 0]) && \
+ ([empty_string_p $parent_id] || \
+ [forum::security::can_post_message_p -message_id $parent_id -user_id 0])]
+
+element create message anonymous_p \
+ -label "Anonymous" \
+ -datatype integer \
+ -widget [ad_decode $anonymous_allowed_p 0 "hidden" "checkbox"] \
+ -options { { "Post anonymously" "1" } } \
+ -optional
+
set attachments_enabled_p [forum::attachments_enabled_p]
if {$attachments_enabled_p} {
@@ -94,18 +108,25 @@
if {[form is_valid message]} {
form get_values message \
- message_id forum_id parent_id subject content html_p confirm_p subscribe_p
-
+ message_id forum_id parent_id subject content html_p confirm_p subscribe_p anonymous_p
+
+ if { !$anonymous_allowed_p } {
+ set anonymous_p 0
+ }
+
if {!$confirm_p} {
forum::get -forum_id $forum_id -array forum
set confirm_p 1
set content [string trimright $content]
- set exported_vars [export_form_vars message_id forum_id parent_id subject content html_p confirm_p]
+ set exported_vars [export_form_vars message_id forum_id parent_id subject content html_p confirm_p anonymous_p]
set message(html_p) $html_p
set message(subject) $subject
set message(content) $content
+ if { $anonymous_p } {
+ set user_id 0
+ }
set message(user_id) $user_id
set message(user_name) [db_string select_name {}]
set message(posting_date_ansi) [db_string select_date {}]
@@ -131,13 +152,23 @@
return
}
+ if { [empty_string_p $anonymous_p] } {
+ set anonymous_p 0
+ }
+ if { $anonymous_p } {
+ set post_as_user_id 0
+ } else {
+ set post_as_user_id $user_id
+ }
+
forum::message::new \
-forum_id $forum_id \
-message_id $message_id \
-parent_id $parent_id \
-subject $subject \
-content $content \
- -html_p $html_p
+ -html_p $html_p \
+ -user_id $post_as_user_id
if {[empty_string_p $parent_id]} {
set redirect_url "[ad_conn package_url]message-view?message_id=$message_id"
Index: openacs-4/packages/forums/www/admin/forum-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-edit.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/forums/www/admin/forum-edit.tcl 30 Nov 2002 17:35:58 -0000 1.11
+++ openacs-4/packages/forums/www/admin/forum-edit.tcl 21 Sep 2003 19:58:58 -0000 1.12
@@ -25,10 +25,10 @@
-label [_ forums.Presentation] -datatype text -widget select -options {{Flat flat} {Threaded threaded}}
element create forum posting_policy \
- -label [_ forums.Posting_Policy] -datatype text -widget select -options {{open open} {moderated moderated} {closed closed}}
+ -label [_ forums.Posting_Policy] -datatype text -widget select -options {{Open open} {Moderated moderated} {Closed closed}}
element create forum new_threads_p \
- -label [_ forums.lt_Users_Can_Create_New_] -datatype integer -widget radio -options {{yes 1} {no 0}}
+ -label [_ forums.lt_Users_Can_Create_New_] -datatype integer -widget radio -options {{Yes 1} {No 0}}
if {[form is_valid forum]} {
template::form get_values forum forum_id name charter presentation_type posting_policy new_threads_p
Index: openacs-4/packages/forums/www/admin/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/index.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/forums/www/admin/index.adp 25 Oct 2002 13:00:03 -0000 1.4
+++ openacs-4/packages/forums/www/admin/index.adp 21 Sep 2003 19:58:58 -0000 1.5
@@ -15,6 +15,7 @@
[#forums.disable#
#forums.enable#]
@forums.name@
+(Permissions)
Index: openacs-4/packages/forums/www/admin/permissions-user-add.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/permissions-user-add.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/permissions-user-add.adp 21 Sep 2003 19:58:58 -0000 1.1
@@ -0,0 +1,5 @@
+
+ @page_title@
+ @context@
+
+
Index: openacs-4/packages/forums/www/admin/permissions-user-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/permissions-user-add.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/permissions-user-add.tcl 21 Sep 2003 19:58:58 -0000 1.1
@@ -0,0 +1,16 @@
+ad_page_contract {
+ Redirect page for adding users to the permissions list.
+
+ @author Lars Pind (lars@collaboraid.biz)
+ @creation-date 2003-06-13
+ @cvs-id $Id: permissions-user-add.tcl,v 1.1 2003/09/21 19:58:58 lars Exp $
+} {
+ object_id:integer
+}
+
+forum::get -forum_id $object_id -array forum
+
+set page_title "Add User"
+
+set context [list [list [export_vars -base permissions { object_id }] "$forum(name) Permissions"] $page_title]
+
Index: openacs-4/packages/forums/www/admin/permissions.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/permissions.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/permissions.adp 21 Sep 2003 19:58:58 -0000 1.1
@@ -0,0 +1,5 @@
+
+ @page_title@
+ @context@
+
+
Index: openacs-4/packages/forums/www/admin/permissions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/permissions.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/forums/www/admin/permissions.tcl 21 Sep 2003 19:58:58 -0000 1.1
@@ -0,0 +1,16 @@
+ad_page_contract {
+ Permissions for the subsite itself.
+
+ @author Lars Pind (lars@collaboraid.biz)
+ @creation-date 2003-06-13
+ @cvs-id $Id: permissions.tcl,v 1.1 2003/09/21 19:58:58 lars Exp $
+} {
+ object_id:integer
+}
+
+forum::get -forum_id $object_id -array forum
+
+set page_title "$forum(name) Permissions"
+
+set context [list $page_title]
+