Index: openacs-4/packages/chat/www/transcript-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-new.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/chat/www/transcript-new.tcl 24 Jun 2006 14:23:42 -0000 1.4 +++ openacs-4/packages/chat/www/transcript-new.tcl 7 Jun 2007 09:14:25 -0000 1.5 @@ -1,6 +1,7 @@ #/chat/www/transcript-new.tcl ad_page_contract { Display available all available chat messages. + @author Pablo Mu�oz(pablomp@tid.es) } { room_id:integer,notnull } -properties { @@ -14,7 +15,23 @@ contents:onevalue } +set user_id [ad_conn user_id] +#A professor who creates a rooom will be able to admin it. +db_1row room_info2 { + select count(cr.creator) as counter2 + from chat_rooms cr + where cr.room_id = :room_id + and cr.creator = :user_id + } + if { $counter2 > 0} { + set admin_professor "t" + } else { + set admin_professor "f" + } +if { $admin_professor eq "t"} { +} else { permission::require_permission -object_id $room_id -privilege chat_transcript_create +} set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Create_transcript]"] @@ -26,10 +43,35 @@ set title "[_ chat.Create_transcript]" set submit_label "[_ chat.Create_transcript]" set active_p [room_active_status $room_id] +set keywords "" + + #Build a list of all message. db_foreach get_archives_messages {} { - append contents "\[$creation_date\] [chat_user_name $creation_user]: $msg
\n" + + if { $creation_user eq "-1" } { + append contents "\[$creation_date\] System: $msg
\n" + } else { + db_1row room_info2 { + select count(r.alias) + from chat_registered_users r + where r.user_id = :creation_user + and r.room_id = :room_id + } + + if { $count > 0} { + db_1row room_info2 { + select r.alias + from chat_registered_users r + where r.user_id = :creation_user + and r.room_id = :room_id + } + append contents "\[$creation_date\] [chat_user_name2 $creation_user $alias]: $msg
\n" + } else { + append contents "\[$creation_date\] [chat_user_name $creation_user]: $msg
\n" + } + } } ad_return_template "transcript-entry"