head 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2000.01.08.02.08.37; author tarik; state Exp; branches; next 1.1; 1.1 date 2000.01.08.00.22.42; author tarik; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @# File: /groups/group/index.tcl # Date: mid-1998 # Contact: teadams@@arsdigita.com, tarik@@arsdigita.com # Purpose: this is the group public page # # Note: group_id, group_name, short_name, admin_email, scope, ug_navbar_list and ug_context_bar_list # are already set up in the environment by the ug_serve_section set db [ns_db gethandle] set selection [ns_db 1row $db " select ug.approved_p, ug.creation_user, ug.registration_date, ug.group_type, ug.new_member_policy, u.first_names, u.last_name from user_groups ug, users u where group_id = $group_id and ug.creation_user = u.user_id"] set_variables_after_query ReturnHeaders ns_write " [ug_header "Main Page" $db $group_id] [ug_page_title "Main Page" $db $group_id $group_name] [ad_scope_context_bar_ws_or_index $group_name]
" if { $approved_p == "f" } { append html "
this group is awaiting approval by [ad_system_owner]
[ug_footer $admin_email] " } # get group sections set selection [ns_db select $db " select section_key, section_pretty_name, section_type from content_sections where scope='group' and group_id=$group_id and section_type!='admin' and module_key!='custom-sections' and enabled_p='t' order by sort_key "] set system_section_counter 0 set non_system_section_counter 0 while { [ns_db getrow $db $selection] } { set_variables_after_query if { [string compare $section_type system]==0 } { append system_sections_html " $section_pretty_name
" incr system_section_counter } else { append non_system_sections_html " $section_pretty_name
" incr non_system_section_counter } } if { [expr $system_section_counter + $non_system_section_counter]>0 } { append html "

Sections

" if { $system_section_counter>0 } { append html " $system_sections_html " } if { $non_system_section_counter>0 } { append html "
$non_system_sections_html " } append html "

" } # let's look for administrators set selection [ns_db select $db "select map.user_id, first_names || ' ' || last_name as name from user_group_map map, users where map.user_id = users.user_id and role = 'administrator' and group_id=$group_id"] while { [ns_db getrow $db $selection] } { set_variables_after_query append administrator_items "$name
\n" } if [info exists administrator_items] { append html "

Group Administrators

\n\n$administrator_items\n" } set user_id [ad_get_user_id] if { $user_id == 0 } { if { $new_member_policy != "closed" } { # there is at least some possibility of a member joining append html "If you want to join this group, you'll need to log in ." } } else { # the user is logged in if { [database_to_tcl_string $db "select count(*) from user_group_map where group_id = $group_id and user_id = $user_id"] > 0 } { # user is already a member append html "
You are a member of this group. You can remove yourself." } else { switch $new_member_policy { "open" { append html "

Join

This group has an open enrollment policy. You can simply sign up." } "wait" { append html "

Join

The administrator approves users who wish to end this group. Submit your name for approval." } "closed" { append html " This group has closed membership policy. You cannot become a member of this group." } } } } set user_id [ad_verify_and_get_user_id] set helper_args "" if { [ad_user_group_authorized_admin $user_id $group_id $db] == 1 } { append helper_args [list "[ug_admin_url]/[ad_urlencode $short_name]/" "Administration page"] } ns_write " [help_upper_right_menu $helper_args]
$html
[ad_style_bodynote "Created by $first_names $last_name on [util_AnsiDatetoPrettyDate $registration_date]"] [ug_footer $admin_email] " @ 1.1 log @Initial revision @ text @d45 1 a45 1 from content_sections_temp d51 1 @