Index: openacs-4/packages/acs-subsite/catalog/acs-subsite.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/catalog/acs-subsite.en_US.ISO-8859-1.xml,v diff -u -r1.28 -r1.29 --- openacs-4/packages/acs-subsite/catalog/acs-subsite.en_US.ISO-8859-1.xml 30 Sep 2003 10:22:36 -0000 1.28 +++ openacs-4/packages/acs-subsite/catalog/acs-subsite.en_US.ISO-8859-1.xml 3 Oct 2003 10:14:30 -0000 1.29 @@ -47,6 +47,8 @@ Confirm Current Password Current users: + <p> Your online status is currently not visible to other users. </p> + <p> Your online status is currently visible to other users. </p> Customize Question Direct Permissions edit your alerts @@ -265,6 +267,8 @@ Your email is confirmed Your forgotten password on %system_name% Your URL doesn't have the correct form. A valid URL would be something like "%valid_url_example%". + Make yourself invisible + Make yourself visible Name: New Password New users: @@ -325,6 +329,8 @@ User Creation Failed Username Welcome Back + Users currently online + Who's Online Your email: Your email address: Your Portrait Index: openacs-4/packages/acs-subsite/tcl/group-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-subsite/tcl/group-procs.tcl 2 Oct 2003 22:43:30 -0000 1.8 +++ openacs-4/packages/acs-subsite/tcl/group-procs.tcl 3 Oct 2003 10:14:30 -0000 1.9 @@ -191,29 +191,72 @@ } ad_proc -public group::join_policy { - { -group_id "" } + {-group_id:required} } { Returns a group's join policy ('open', 'closed', or 'needs approval') @author Oumi Mehrotra (oumi@arsdigita.com) @creation-date 10/2000 } { - - set join_policy [db_string select_join_policy { + return [db_string select_join_policy { select join_policy from groups where group_id = :group_id }] - } -ad_proc -public group::possible_member_states { +ad_proc -public group::update { + {-group_id:required} + {-array:required} +} { + Updates a group. + + @param group_id The ID of the group to update. + @param array Name of array containing the columns to update. + Valid columns are group_name, join_policy. + Valid join_policy values are 'open', 'closed', 'needs approval'. + } { + upvar $array row + + # Construct clauses for the update statement + set columns { group_name join_policy } + set set_clauses [list] + foreach name [array names row] { + if { [lsearch -exact $columns $name] == -1 } { + error "Attribute '$name' isn't valid for groups." + } + lappend set_clauses "$name = :$name" + set $name $row($name) + } + if { [llength $set_clauses] == 0 } { + # No rows to update + return + } + + db_dml update_group " + update groups + set [join $set_clauses ", "] + where group_id = :group_id + " +} + +ad_proc -public group::possible_member_states {} { + Returns the list of possible member states: approved, needs approval, banned, rejected, deleted. } { return [list approved "needs approval" banned rejected deleted] } +ad_proc -public group::get_join_policy_options {} { + Returns a list of valid join policies in a format suitable for a form builder drop-down. +} { + return [list \ + [list "Open" "open"] \ + [list "Needs approval" "needs approval"] \ + [list "Closed" "closed"]] +} + ad_proc -public group::default_member_state { { -join_policy "" } { -create_p "" } Index: openacs-4/packages/acs-subsite/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/index.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-subsite/www/index.adp 2 Oct 2003 22:04:46 -0000 1.12 +++ openacs-4/packages/acs-subsite/www/index.adp 3 Oct 2003 10:14:31 -0000 1.13 @@ -35,6 +35,11 @@ + + +

» Members

+ + Index: openacs-4/packages/acs-subsite/www/admin/configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/configure.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/admin/configure.tcl 22 Sep 2003 09:52:09 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/admin/configure.tcl 3 Oct 2003 10:14:31 -0000 1.6 @@ -13,16 +13,29 @@ # TODO: Add join policy - ad_form -name name -cancel_url [ad_conn url] -mode display -form { {instance_name:text {label "Subsite name"} {html {size 50}} } + {master_template:text(select) + {label "Template"} + {help_text "Choose the layout and navigation you want for your community."} + {options [subsite::get_template_options]} + } + {join_policy:text(select) + {label "Join policy"} + {options [group::get_join_policy_options]} + } } -on_request { set instance_name [ad_conn instance_name] + set master_template [parameter::get -parameter DefaultMaster -package_id [ad_conn package_id]] + set join_policy [group::join_policy -group_id [application_group::group_id_from_package_id]] } -on_submit { apm_package_rename -instance_name $instance_name + parameter::set_value -parameter DefaultMaster -package_id [ad_conn package_id] -value $master_template + set group(join_policy) $join_policy + group::update -group_id [application_group::group_id_from_package_id] -array group } -after_submit { ad_returnredirect [ad_conn url] ad_script_abort Index: openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl 2 Oct 2003 22:15:49 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl 3 Oct 2003 10:14:31 -0000 1.6 @@ -34,6 +34,10 @@ {help_text "Choose the layout and navigation you want for your community."} {options [subsite::get_template_options]} } + {join_policy:text(select) + {label "Join policy"} + {options [group::get_join_policy_options]} + } } -on_submit { set folder [site_node::verify_folder_name \ -parent_node_id [ad_conn node_id] \ @@ -54,6 +58,8 @@ -package_key acs-subsite] parameter::set_value -parameter DefaultMaster -package_id $new_package_id -value $master_template + set group(join_policy) $join_policy + group::update -group_id [application_group::group_id_from_package_id -package_id $new_package_id] -array group } errsmg] } { ad_return_error "Problem Creating Application" "We had a problem creating the community." } Index: openacs-4/packages/acs-subsite/www/pvt/home.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/pvt/home.adp,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-subsite/www/pvt/home.adp 1 Oct 2003 15:48:37 -0000 1.16 +++ openacs-4/packages/acs-subsite/www/pvt/home.adp 3 Oct 2003 10:14:31 -0000 1.17 @@ -21,16 +21,22 @@

-

- » #acs-subsite.lt_What_other_people_see# -

+ +

+ » #acs-subsite.Manage_your_notifications# +

+

» #acs-subsite.Close_your_account#

+

+ » #acs-subsite.lt_What_other_people_see# +

+

#acs-subsite.Your_Portrait#

@@ -44,5 +50,21 @@

-

Who's online?

-» View a list of online users \ No newline at end of file +

#acs-subsite.Whos_Online_title#

+ +

+ » #acs-subsite.Whos_Online_link_label# +

+ + + #acs-subsite.Currently_invisible_msg# +

+ » #acs-subsite.Make_yourself_visible_label# +

+
+ + #acs-subsite.Currently_visible_msg# +

+ » #acs-subsite.Make_yourself_invisible_label# +

+
Index: openacs-4/packages/acs-subsite/www/pvt/home.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/pvt/home.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-subsite/www/pvt/home.tcl 30 Sep 2003 10:13:44 -0000 1.16 +++ openacs-4/packages/acs-subsite/www/pvt/home.tcl 3 Oct 2003 10:14:31 -0000 1.17 @@ -40,6 +40,9 @@ set community_member_url [acs_community_member_url -user_id $user_id] +set notifications_url [lindex [site_node::get_children -node_id [subsite::get_element -element node_id] -package_key "notifications"] 0] + + set system_name [ad_system_name] set portrait_upload_url [export_vars -base "../user/portrait/upload" { { return_url [ad_return_url] } }] @@ -49,6 +52,7 @@ } + if [ad_parameter SolicitPortraitP "user-info" 0] { # we have portraits for some users if ![db_0or1row get_portrait_info " @@ -72,3 +76,8 @@ set portrait_state "none" } + +set whos_online_url "[subsite::get_element -element url]shared/whos-online" +set make_visible_url "[subsite::get_element -element url]shared/make-visible" +set make_invisible_url "[subsite::get_element -element url]shared/make-invisible" +set invisible_p [whos_online::user_invisible_p [ad_conn untrusted_user_id]] Index: openacs-4/packages/acs-subsite/www/shared/make-invisible.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/make-invisible.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/www/shared/make-invisible.tcl 3 Oct 2003 10:14:32 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + Make user invisible. +} + +auth::require_login + +whos_online::set_invisible [ad_conn user_id] + +ad_returnredirect [ad_pvt_home] + Index: openacs-4/packages/acs-subsite/www/shared/make-visible.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/make-visible.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/www/shared/make-visible.tcl 3 Oct 2003 10:14:32 -0000 1.1 @@ -0,0 +1,10 @@ +ad_page_contract { + Make user visible. +} + +auth::require_login + +whos_online::unset_invisible [ad_conn user_id] + +ad_returnredirect [ad_pvt_home] + Index: openacs-4/packages/acs-subsite/www/shared/whos-online.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/whos-online.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-subsite/www/shared/whos-online.adp 1 Oct 2003 15:48:37 -0000 1.7 +++ openacs-4/packages/acs-subsite/www/shared/whos-online.adp 3 Oct 2003 10:14:32 -0000 1.8 @@ -2,11 +2,5 @@ @title;noquote@ @context;noquote@ -These are the registered users who have -requested a page from this server within the last -@whos_online_interval@ seconds. Note that not logged -in users are not included in this list. -

- -

+

Index: openacs-4/packages/acs-subsite/www/shared/whos-online.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/whos-online.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-subsite/www/shared/whos-online.tcl 1 Oct 2003 15:48:37 -0000 1.6 +++ openacs-4/packages/acs-subsite/www/shared/whos-online.tcl 3 Oct 2003 10:14:32 -0000 1.7 @@ -12,32 +12,44 @@ set title "Who's Online?" set context [list "Who's Online"] -set whos_online_interval [util::whos_online::interval] +set whos_online_interval [whos_online::interval] template::list::create \ -name online_users \ -multirow online_users \ -elements { - user_link { + name { label "User name" - display_template { - @online_users.user_link;noquote@ - } + link_url_col url } - last_request_seconds { - label "Seconds since last request" + online_time_pretty { + label "Online Time" + html { align right } } } -multirow create online_users user_link last_request_seconds -foreach user_id [util::whos_online::user_ids] { +set users [list] + +foreach user_id [whos_online::user_ids] { acs_user::get -user_id $user_id -array user - set user_name "$user(first_names) $user(last_name)" - set user_link [acs_community_member_link -user_id $user_id -label $user_name] - set last_request_seconds [util::whos_online::time_since_last_request $user_id] + set first_request_minutes [expr [whos_online::seconds_since_first_request $user_id] / 60] - multirow append online_users $user_link $last_request_seconds + lappend users [list \ + "$user(first_names) $user(last_name)" \ + [acs_community_member_url -user_id $user_id] \ + "$first_request_minutes minutes"] + } -ad_return_template +set users [lsort -index 0 $users] + +multirow create online_users name url online_time_pretty + +foreach elm $users { + multirow append online_users \ + [lindex $elm 0] \ + [lindex $elm 1] \ + [lindex $elm 2] +} + Index: openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 23 Sep 2003 17:43:30 -0000 1.23 +++ openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 3 Oct 2003 10:14:30 -0000 1.24 @@ -163,7 +163,7 @@