Index: openacs-4/packages/chat/lib/current-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/current-messages.tcl,v diff -u -r1.4.8.1 -r1.4.8.2 --- openacs-4/packages/chat/lib/current-messages.tcl 14 Feb 2019 16:15:01 -0000 1.4.8.1 +++ openacs-4/packages/chat/lib/current-messages.tcl 2 Mar 2019 17:51:10 -0000 1.4.8.2 @@ -12,7 +12,7 @@ } db_multirow -extend { person_name } messages select_msg_itens $sql { - set person_name [chat_user_name $creation_user] + set person_name [::chat::Package get_user_name -user_id $creation_user] if {$person_name eq ""} { set person_name "Unknown" } Index: openacs-4/packages/chat/tcl/chat-ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-ajax-procs.tcl,v diff -u -r1.23.2.2 -r1.23.2.3 --- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 26 Feb 2019 18:06:43 -0000 1.23.2.2 +++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 2 Mar 2019 17:51:10 -0000 1.23.2.3 @@ -37,21 +37,21 @@ ::xo::ChatClass Chat -superclass ::xowiki::Chat Chat proc login {-chat_id {-package_id ""} {-mode ""} {-path ""}} { - if {![chat_room_exists_p $chat_id]} { + if {![::xo::db::Class exists_in_db -id $chat_id]} { return [_ chat.Room_not_found] } else { - chat_room_get -room_id $chat_id -array c - set package_id $c(context_id) + set r [::xo::db::Class get_instance_from_db -id $chat_id] + set package_id [$r set context_id] set chat_skin [parameter::get -package_id $package_id -parameter ChatSkin] next -chat_id $chat_id \ -skin $chat_skin \ -package_id $package_id \ -mode $mode \ -path $path \ - -logout_messages_p $c(logout_messages_p) \ - -login_messages_p $c(login_messages_p) \ - -timewindow $c(messages_time_window) \ - -avatar_p $c(avatar_p) + -logout_messages_p [$r set logout_messages_p] \ + -login_messages_p [$r set login_messages_p] \ + -timewindow [$r set messages_time_window] \ + -avatar_p [$r set avatar_p] } } @@ -79,7 +79,7 @@ # if chat doesn't exist anymore, send a message that will inform # the user of being looking at an invalid chat Chat instproc check_valid_room {} { - if {![chat_room_exists_p [:chat_id]]} { + if {![::xo::db::Class exists_in_db -id [:chat_id]]} { ns_return 500 text/plain "chat-errmsg: [_ chat.Room_not_found]" ad_script_abort } @@ -95,9 +95,10 @@ {-uid ""} msg } { - if {![chat_room_exists_p ${:chat_id}]} { + if {![::xo::db::Class exists_in_db -id ${:chat_id}]} { return } + set r [::xo::db::Class get_instance_from_db -id ${:chat_id}] # ignore empty messages if {$msg eq ""} return @@ -109,7 +110,7 @@ # message is sent if {[:current_message_valid]} { set uid [expr {$uid ne "" ? $uid : ${:user_id}}] - chat_message_post ${:chat_id} $uid $msg 1 + $r post_message -msg $msg -creation_user $uid } return $retval Index: openacs-4/packages/chat/tcl/chat-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-init.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/chat/tcl/chat-init.tcl 24 Oct 2018 09:14:26 -0000 1.9 +++ openacs-4/packages/chat/tcl/chat-init.tcl 2 Mar 2019 17:51:10 -0000 1.9.2.1 @@ -12,7 +12,7 @@ # nsv_set chat server_started 0 ## -ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 0 5] chat_flush_rooms +ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 0 5] ::chat::Package flush_rooms ns_cache create chat_room_cache \ -size 350000 \ Index: openacs-4/packages/chat/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-procs.tcl,v diff -u -r1.24.2.5 -r1.24.2.6 --- openacs-4/packages/chat/tcl/chat-procs.tcl 1 Mar 2019 17:26:00 -0000 1.24.2.5 +++ openacs-4/packages/chat/tcl/chat-procs.tcl 2 Mar 2019 17:51:10 -0000 1.24.2.6 @@ -11,19 +11,7 @@ @cvs-id $Id$ } -ad_proc -private chat_post_message_to_db { - {-creation_user ""} - {-creation_ip ""} - room_id - msg -} { - Log chat message to the database. -} { - set r [::xo::db::Class get_instance_from_db -id $room_id] - $r post_message -creation_user $creation_user -creation_ip $creation_ip -msg $msg -} - -ad_proc -public chat_room_get { +ad_proc -deprecated -public chat_room_get { {-room_id {}} {-array:required} } { @@ -59,7 +47,7 @@ return [array get row] } -ad_proc -public chat_room_new { +ad_proc -deprecated -public chat_room_new { {-description ""} {-moderated_p f} {-active_p t} @@ -95,7 +83,7 @@ return [$r save_new] } -ad_proc -public chat_room_exists_p { +ad_proc -deprecated -public chat_room_exists_p { room_id } { Return whether a chat room exists @@ -105,7 +93,7 @@ return [::xo::db::Class exists_in_db -id $room_id] } -ad_proc -public chat_room_edit { +ad_proc -deprecated -public chat_room_edit { room_id pretty_name description @@ -138,18 +126,20 @@ $r set $var [set $var] } $r save + ns_cache flush -- chat_room_cache $room_id } -ad_proc -public chat_room_delete { +ad_proc -deprecated -public chat_room_delete { room_id } { Delete chat room. } { set r [::xo::db::Class get_instance_from_db -id $room_id] $r delete + ns_cache flush -- chat_room_cache $room_id } -ad_proc -public chat_room_message_delete { +ad_proc -deprecated -public chat_room_message_delete { room_id } { Delete all message in the room. @@ -158,7 +148,7 @@ $r delete_messages } -ad_proc -public chat_message_count { +ad_proc -deprecated -public chat_message_count { room_id } { Get message count in the room. @@ -167,7 +157,7 @@ $r count_messages } -ad_proc -public room_active_status { +ad_proc -deprecated -public room_active_status { room_id } { Get room active status. @@ -180,7 +170,7 @@ } } -ad_proc -public chat_room_name { +ad_proc -deprecated -public chat_room_name { room_id } { Get chat room name. @@ -189,7 +179,7 @@ return [$r set pretty_name] } -ad_proc -public chat_moderator_grant { +ad_proc -deprecated -public chat_moderator_grant { room_id party_id } { @@ -199,7 +189,7 @@ $r grant_moderator -party_id $party_id } -ad_proc -public chat_moderator_revoke { +ad_proc -deprecated -public chat_moderator_revoke { room_id party_id } { @@ -209,7 +199,7 @@ $r revoke_moderator -party_id $party_id } -ad_proc -public chat_user_grant { +ad_proc -deprecated -public chat_user_grant { room_id party_id } { @@ -219,7 +209,7 @@ $r grant_user -party_id $party_id } -ad_proc -public chat_user_revoke { +ad_proc -deprecated -public chat_user_revoke { room_id party_id } { @@ -229,7 +219,7 @@ $r revoke_user -party_id $party_id } -ad_proc -public chat_user_ban { +ad_proc -deprecated -public chat_user_ban { room_id party_id } { @@ -239,7 +229,7 @@ $r ban_user -party_id $party_id } -ad_proc -public chat_user_unban { +ad_proc -deprecated -public chat_user_unban { room_id party_id } { @@ -249,7 +239,7 @@ $r unban_user -party_id $party_id } -ad_proc -public chat_revoke_moderators { +ad_proc -deprecated -public chat_revoke_moderators { room_id revoke_list } { @@ -259,7 +249,7 @@ $r revoke_moderator -party_id $revoke_list } -ad_proc -public chat_room_moderate_p { +ad_proc -deprecated -public chat_room_moderate_p { room_id } { Return the moderate status of this chat room. @@ -268,15 +258,15 @@ return [$r set moderated_p] } -ad_proc -public chat_user_name { +ad_proc -deprecated -public chat_user_name { user_id } { Return display name of this user to use in chat. } { return [::chat::Package get_user_name -user_id $user_id] } -ad_proc -public chat_message_post { +ad_proc -deprecated -public chat_message_post { room_id user_id message @@ -288,7 +278,7 @@ $r post_message -msg $message -creation_user $user_id } -ad_proc -public chat_transcript_new { +ad_proc -deprecated -public chat_transcript_new { {-description ""} {-context_id ""} {-creation_user ""} @@ -310,7 +300,7 @@ return [$t save_new] } -ad_proc -public chat_transcript_delete { +ad_proc -deprecated -public chat_transcript_delete { transcript_id } { Delete chat transcript. @@ -319,7 +309,7 @@ -object_id $transcript_id } -ad_proc -public chat_transcript_edit { +ad_proc -deprecated -public chat_transcript_edit { transcript_id pretty_name description Fisheye: Tag 1.5.2.3 refers to a dead (removed) revision in file `openacs-4/packages/chat/tcl/chat-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl 1 Mar 2019 17:26:00 -0000 1.1.2.1 +++ openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl 2 Mar 2019 17:51:10 -0000 1.1.2.2 @@ -159,6 +159,14 @@ } } + ::xo::db::chat_room instproc get_instance_from_db {} { + next + ::xo::dc 1row get_metadata { + select context_id, creation_ip, creation_user + from acs_objects where object_id = :room_id + } + } + ::xo::db::chat_room instproc save_new {} { if {![info exists :creation_user]} { set :creation_user [expr {[ns_conn isconnected] ? [ad_conn user_id] : ""}] Index: openacs-4/packages/chat/www/chat-transcript.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcript.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/chat/www/chat-transcript.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 +++ openacs-4/packages/chat/www/chat-transcript.tcl 2 Mar 2019 17:51:10 -0000 1.6.2.2 @@ -19,7 +19,10 @@ ad_script_abort } -if { [catch {set room_name [chat_room_name $room_id]} errmsg] } { +if { [catch { + set r [::xo::db::Class get_instance_from_db -id $room_id] + set room_name [$r set pretty_name] +} errmsg] } { ad_return_complaint 1 "[_ chat.Room_not_found]" ad_script_abort } Index: openacs-4/packages/chat/www/chat-transcripts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcripts.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/chat/www/chat-transcripts.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 +++ openacs-4/packages/chat/www/chat-transcripts.tcl 2 Mar 2019 17:51:10 -0000 1.4.2.2 @@ -8,12 +8,15 @@ room_id:naturalnum,notnull } -if { [catch {set room_name [chat_room_name $room_id]} errmsg] } { +if { [catch { + set r [::xo::db::Class get_instance_from_db -id $room_id] + set room_name [$r set pretty_name] +} errmsg] } { ad_return_complaint 1 "[_ chat.Room_not_found]" ad_script_abort } -set active [room_active_status $room_id] +set active [$r set active_p] # Local variables: # mode: tcl Index: openacs-4/packages/chat/www/chat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat.tcl,v diff -u -r1.20.2.1 -r1.20.2.2 --- openacs-4/packages/chat/www/chat.tcl 14 Feb 2019 16:15:01 -0000 1.20.2.1 +++ openacs-4/packages/chat/www/chat.tcl 2 Mar 2019 17:51:10 -0000 1.20.2.2 @@ -23,7 +23,10 @@ msgs:multirow } -if { [catch {set room_name [chat_room_name $room_id]} errmsg] } { +if { [catch { + set r [::xo::db::Class get_instance_from_db -id $room_id] + set room_name [$r set pretty_name] +} errmsg] } { ad_return_complaint 1 "[_ chat.Room_not_found]" ad_script_abort } @@ -38,7 +41,7 @@ set read_p [permission::permission_p -object_id $room_id -privilege "chat_read"] set write_p [permission::permission_p -object_id $room_id -privilege "chat_write"] set ban_p [permission::permission_p -object_id $room_id -privilege "chat_ban"] -set moderate_room_p [chat_room_moderate_p $room_id] +set moderate_room_p [$r set moderated_p] if { $moderate_room_p == "t" } { set moderator_p [permission::permission_p -object_id $room_id -privilege "chat_moderator"] Index: openacs-4/packages/chat/www/message-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete-2.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/chat/www/message-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 +++ openacs-4/packages/chat/www/message-delete-2.tcl 2 Mar 2019 17:51:10 -0000 1.9.2.2 @@ -11,7 +11,10 @@ permission::require_permission -object_id $room_id -privilege chat_room_delete -if { [catch {chat_room_message_delete $room_id} errmsg] } { +if { [catch { + set r [::xo::db::Class get_instance_from_db -id $room_id] + $r delete_messages +} errmsg] } { ad_return_complaint 1 "[_ chat.Delete_messages_failed]: $errmsg" ad_script_abort } Index: openacs-4/packages/chat/www/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/message-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/message-delete.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -18,9 +18,10 @@ set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_messages]"] -set pretty_name [chat_room_name $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set pretty_name [$r set pretty_name] -set message_count [chat_message_count $room_id] +set message_count [$r count_messages] ad_return_template Index: openacs-4/packages/chat/www/moderator-grant.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-grant.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/chat/www/moderator-grant.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 +++ openacs-4/packages/chat/www/moderator-grant.tcl 2 Mar 2019 17:51:10 -0000 1.6.2.2 @@ -23,7 +23,9 @@ set submit_label "[_ chat.Grant]" set title "[_ chat.Grant_moderator]" set action "moderator-grant-2" -set description "[_ chat.Grant_moderator_for] [chat_room_name $room_id] [_ chat.to]" +set r [::xo::db::Class get_instance_from_db -id $room_id] +set room_name [$r set pretty_name] +set description "[_ chat.Grant_moderator_for] $room_name [_ chat.to]" db_multirow parties list_parties {} ad_return_template grant-entry Index: openacs-4/packages/chat/www/moderator-revoke.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-revoke.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/moderator-revoke.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/moderator-revoke.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -17,7 +17,8 @@ set party_pretty_name [acs_object_name $party_id] -set pretty_name [chat_room_name $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set pretty_name [$r set pretty_name] # Local variables: # mode: tcl Index: openacs-4/packages/chat/www/room-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete-2.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/room-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/room-delete-2.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -11,7 +11,10 @@ permission::require_permission -object_id $room_id -privilege chat_room_delete -if { [catch {chat_room_delete $room_id} errmsg] } { +if { [catch { + set r [::xo::db::Class get_instance_from_db -id $room_id] + $r delete +} errmsg] } { ad_return_complaint 1 "[_ chat.Delete_room_failed]: $errmsg" ad_script_abort } Index: openacs-4/packages/chat/www/room-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/room-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/room-delete.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -17,7 +17,8 @@ set context_bar [list [list "room?room_id=$room_id" "[_ chat.Room_Information]"] "[_ chat.Delete_room]"] -set pretty_name [chat_room_name $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set pretty_name [$r set pretty_name] ad_return_template Index: openacs-4/packages/chat/www/room-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-edit.tcl,v diff -u -r1.15.2.2 -r1.15.2.3 --- openacs-4/packages/chat/www/room-edit.tcl 26 Feb 2019 18:06:43 -0000 1.15.2.2 +++ openacs-4/packages/chat/www/room-edit.tcl 2 Mar 2019 17:51:10 -0000 1.15.2.3 @@ -80,20 +80,22 @@ } } -new_data { if {[catch { - set room_id [chat_room_new \ - -moderated_p $moderated_p \ - -description $description \ - -active_p $active_p \ - -archive_p $archive_p \ - -auto_flush_p $auto_flush_p \ - -auto_transcript_p $auto_transcript_p \ - -login_messages_p $login_messages_p \ - -logout_messages_p $logout_messages_p \ - -messages_time_window $messages_time_window \ - -avatar_p $avatar_p \ - -context_id [ad_conn package_id] \ - -creation_user [ad_conn user_id] \ - -creation_ip [ad_conn peeraddr] $pretty_name] + set r [::xo::db::chat_room new \ + -moderated_p $moderated_p \ + -description $description \ + -active_p $active_p \ + -archive_p $archive_p \ + -auto_flush_p $auto_flush_p \ + -auto_transcript_p $auto_transcript_p \ + -login_messages_p $login_messages_p \ + -logout_messages_p $logout_messages_p \ + -messages_time_window $messages_time_window \ + -avatar_p $avatar_p \ + -context_id [ad_conn package_id] \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] \ + -pretty_name $pretty_name] + set room_id [$r save_new] } errmsg]} { ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg" ad_script_abort @@ -103,48 +105,51 @@ set comm_id [dotlrn_community::get_community_id] } if {$comm_id ne ""} { - chat_user_grant $room_id $comm_id + $r grant_user -party_id $comm_id } else { #-2 Registered Users #chat_user_grant $room_id -2 #0 Unregistered Visitor #chat_user_grant $room_id 0 #-1 The Public - chat_user_grant $room_id -2 + $r grant_user -party_id -2 } } -edit_request { - if {[catch { - chat_room_get -room_id $room_id -array r - set pretty_name $r(pretty_name) - set description $r(description) - set moderated_p $r(moderated_p) - set archive_p $r(archive_p) - set auto_flush_p $r(auto_flush_p) - set auto_transcript_p $r(auto_transcript_p) - set login_messages_p $r(login_messages_p) - set logout_messages_p $r(logout_messages_p) - set messages_time_window $r(messages_time_window) - set avatar_p $r(avatar_p) - } errmsg]} { + if {[::xo::db::Class exists_in_db -id $room_id]} { + set r [::xo::db::Class get_instance_from_db -id $room_id] + set pretty_name [$r set pretty_name] + set description [$r set description] + set moderated_p [$r set moderated_p] + set active_p [$r set active_p] + set archive_p [$r set archive_p] + set auto_flush_p [$r set auto_flush_p] + set auto_transcript_p [$r set auto_transcript_p] + set login_messages_p [$r set login_messages_p] + set logout_messages_p [$r set logout_messages_p] + set messages_time_window [$r set messages_time_window] + set avatar_p [$r set avatar_p] + } else { ad_return_complaint 1 "[_ chat.Room_not_found]." ad_script_abort } } -edit_data { - if {[catch { - chat_room_edit \ - $room_id \ - $pretty_name \ - $description \ - $moderated_p \ - $active_p \ - $archive_p \ - $auto_flush_p \ - $auto_transcript_p \ - $login_messages_p \ - $logout_messages_p \ - $messages_time_window \ - $avatar_p - } errmsg]} { + set r [::xo::db::Class get_instance_from_db -id $room_id] + foreach var { + pretty_name + description + moderated_p + active_p + archive_p + auto_flush_p + auto_transcript_p + login_messages_p + logout_messages_p + messages_time_window + avatar_p + } { + $r set $var [set $var] + } + if {[catch {$r save} errmsg]} { ad_return_complaint 1 "[_ chat.Could_not_update_room]: $errmsg" ad_script_abort } Index: openacs-4/packages/chat/www/room-enter.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/room-enter.tcl,v diff -u -r1.13 -r1.13.2.1 --- openacs-4/packages/chat/www/room-enter.tcl 1 Oct 2018 12:27:32 -0000 1.13 +++ openacs-4/packages/chat/www/room-enter.tcl 2 Mar 2019 17:51:10 -0000 1.13.2.1 @@ -16,7 +16,8 @@ set write_p [permission::permission_p -object_id $room_id -privilege "chat_write"] set ban_p [permission::permission_p -object_id $room_id -privilege "chat_ban"] ns_log notice "--query ban $ban_p: permission::permission_p -object_id $room_id -privilege chat_ban -party_id [ad_conn user_id]" -set active [room_active_status $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set active [$r set active_p] if { ($read_p == 0 && $write_p == 0) || ($ban_p == 1) || ($active == "f") } { #Display unauthorize privilege page. Index: openacs-4/packages/chat/www/room.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.tcl,v diff -u -r1.11.2.3 -r1.11.2.4 --- openacs-4/packages/chat/www/room.tcl 1 Mar 2019 17:40:56 -0000 1.11.2.3 +++ openacs-4/packages/chat/www/room.tcl 2 Mar 2019 17:51:10 -0000 1.11.2.4 @@ -51,18 +51,18 @@ ### # Get room basic information. ### -chat_room_get -room_id $room_id -array r -set pretty_name $r(pretty_name) -set description $r(description) -set moderated_p $r(moderated_p) -set active_p $r(active_p) -set archive_p $r(archive_p) -set auto_flush_p $r(auto_flush_p) -set auto_transcript_p $r(auto_transcript_p) -set login_messages_p $r(login_messages_p) -set logout_messages_p $r(logout_messages_p) -set messages_time_window $r(messages_time_window) -set avatar_p $r(avatar_p) +set r [::xo::db::Class get_instance_from_db -id $room_id] +set pretty_name [$r set pretty_name] +set description [$r set description] +set moderated_p [$r set moderated_p] +set active_p [$r set active_p] +set archive_p [$r set archive_p] +set auto_flush_p [$r set auto_flush_p] +set auto_transcript_p [$r set auto_transcript_p] +set login_messages_p [$r set login_messages_p] +set logout_messages_p [$r set logout_messages_p] +set messages_time_window [$r set messages_time_window] +set avatar_p [$r set avatar_p] # prettify flags foreach property { @@ -79,7 +79,7 @@ } # get db-message count -set message_count [chat_message_count $room_id] +set message_count [$r count_messages] # List user ban from chat db_multirow -extend {name email unban_url unban_text} banned_users list_user_ban {} { Index: openacs-4/packages/chat/www/transcript-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-delete-2.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/chat/www/transcript-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 +++ openacs-4/packages/chat/www/transcript-delete-2.tcl 2 Mar 2019 17:51:10 -0000 1.6.2.2 @@ -9,7 +9,10 @@ permission::require_permission -object_id $transcript_id -privilege chat_transcript_delete -if { [catch {chat_transcript_delete $transcript_id} errmsg] } { +if { [catch { + set t [::xo::db::Class get_instance_from_db -id $transcript_id] + $t delete +} errmsg] } { ad_return_complaint 1 "[_ chat.Delete_transcript_failed]: $errmsg" ad_script_abort } Index: openacs-4/packages/chat/www/transcript-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-delete.tcl,v diff -u -r1.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/transcript-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/transcript-delete.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -16,10 +16,8 @@ permission::require_permission -object_id $transcript_id -privilege chat_transcript_delete -set transcript_name [db_string query { - select pretty_name from chat_transcripts - where transcript_id = :transcript_id -}] +set t [::xo::db::Class get_instance_from_db -id $transcript_id] +set transcript_name [$t set pretty_name] set context [list "[_ chat.Delete_transcript]"] ad_return_template Index: openacs-4/packages/chat/www/transcript-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-edit-2.tcl,v diff -u -r1.10.2.1 -r1.10.2.2 --- openacs-4/packages/chat/www/transcript-edit-2.tcl 14 Feb 2019 16:15:01 -0000 1.10.2.1 +++ openacs-4/packages/chat/www/transcript-edit-2.tcl 2 Mar 2019 17:51:10 -0000 1.10.2.2 @@ -15,7 +15,13 @@ permission::require_permission -object_id $transcript_id -privilege chat_transcript_edit -if { [catch {chat_transcript_edit $transcript_id $transcript_name $description $contents} errmsg] } { +if { [catch { + set t [::xo::db::Class get_instance_from_db -id $transcript_id] + $t set pretty_name $transcript_name + $t set description $description + $t set contents $contents + $t save +} errmsg] } { ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" ad_script_abort } Index: openacs-4/packages/chat/www/transcript-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-edit.tcl,v diff -u -r1.12.2.1 -r1.12.2.2 --- openacs-4/packages/chat/www/transcript-edit.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 +++ openacs-4/packages/chat/www/transcript-edit.tcl 2 Mar 2019 17:51:10 -0000 1.12.2.2 @@ -14,13 +14,13 @@ set context_bar [list "[_ chat.Edit_transcript]"] set submit_label "[_ chat.Edit]" -set active_p [room_active_status $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set active_p [$r set active_p] -db_1row get_transcript_info { - select pretty_name, description, contents - from chat_transcripts - where transcript_id = :transcript_id -} +set t [::xo::db::Class get_instance_from_db -id $transcript_id] +set pretty_name [$t set pretty_name] +set description [$t set description] +set contents [$t set contents] ad_form -name "edit-transcription" -edit_buttons [list [list [_ chat.Edit] next]] -has_edit 1 -form { {room_id:integer(hidden) @@ -44,7 +44,12 @@ {value $contents} } } -on_submit { - if { [catch {chat_transcript_edit $transcript_id $pretty_name $description $contents} errmsg] } { + $t set pretty_name $pretty_name + $t set description $description + $t set contents $contents + if { [catch { + $t save + } errmsg] } { ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" } else { ad_returnredirect [export_vars -base "chat-transcript" {transcript_id room_id}] Index: openacs-4/packages/chat/www/transcript-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-new-2.tcl,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/chat/www/transcript-new-2.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 +++ openacs-4/packages/chat/www/transcript-new-2.tcl 2 Mar 2019 17:51:10 -0000 1.5.2.2 @@ -16,22 +16,26 @@ set user_id [ad_conn user_id] set creation_ip [ad_conn peeraddr] -set transcript_id [chat_transcript_new \ - -description $description \ - -context_id $package_id \ - -creation_user $user_id \ - -creation_ip $creation_ip \ - $transcript_name $contents $room_id -] +set t [::xo::db::chat_transcript new \ + -description $description \ + -context_id $package_id \ + -creation_user $user_id \ + -creation_ip $creation_ip \ + -pretty_name $transcript_name \ + -contents $contents \ + -room_id $room_id] +set transcript_id [$t save_new] +set r [::xo::db::Class get_instance_from_db -id $room_id] if { $delete_messages eq "on" } { - chat_room_message_delete $room_id + $r delete_messages # forward the information to AJAX ::chat::Chat flush_messages -chat_id $room_id } if { $deactivate_room eq "on" } { - db_dml "update_chat" "update chat_rooms set active_p = 'f' where room_id = $room_id" + $r set active_p false + $r save } ad_returnredirect "chat-transcript?room_id=$room_id&transcript_id=$transcript_id" 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.8.2.1 -r1.8.2.2 --- openacs-4/packages/chat/www/transcript-new.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 +++ openacs-4/packages/chat/www/transcript-new.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 @@ -25,11 +25,13 @@ set contents "" set action "transcript-new-2" set submit_label "[_ chat.Create_transcript]" -set active_p [room_active_status $room_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set active_p [$r set active_p] #Build a list of all message. db_foreach get_archives_messages {} { - append contents "\[$creation_date\] [chat_user_name $creation_user]: $msg
\n" + set user_name [::chat::Package get_user_name -user_id $creation_user] + append contents "\[$creation_date\] $user_name: $msg
\n" } ad_return_template "transcript-entry" Index: openacs-4/packages/chat/www/transcript-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-view.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/chat/www/transcript-view.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 +++ openacs-4/packages/chat/www/transcript-view.tcl 2 Mar 2019 17:51:10 -0000 1.6.2.2 @@ -19,14 +19,11 @@ permission::require_permission -object_id $transcript_id -privilege chat_transcript_view set context_bar [list "[_ chat.View_transcript]"] -db_1row get_transcript { - select pretty_name as transcript_name, - description, - contents, - room_id - from chat_transcripts - where transcript_id=:transcript_id -} +set t [::xo::db::Class get_instance_from_db -id $transcript_id] +set transcript_name [$t set transcript_name] +set description [$t set description] +set contents [$t set contents] +set room_is [$t set room_id] ad_return_template Index: openacs-4/packages/chat/www/user-ban.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-ban.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/chat/www/user-ban.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 +++ openacs-4/packages/chat/www/user-ban.tcl 2 Mar 2019 17:51:10 -0000 1.6.2.2 @@ -24,7 +24,9 @@ set submit_label "[_ chat.Ban]" set title "[_ chat.Ban_user]" set action "user-ban-2" -set description "[_ chat.Ban_chat_read_write] [chat_room_name $room_id] [_ chat.to]" +set r [::xo::db::Class get_instance_from_db -id $room_id] +set room_name [$r set pretty_name] +set description "[_ chat.Ban_chat_read_write] $room_name [_ chat.to]" db_multirow parties list_parties {} ad_return_template grant-entry Index: openacs-4/packages/chat/www/user-unban.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-unban.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/chat/www/user-unban.tcl 14 Feb 2019 16:15:01 -0000 1.7.2.1 +++ openacs-4/packages/chat/www/user-unban.tcl 2 Mar 2019 17:51:10 -0000 1.7.2.2 @@ -17,9 +17,9 @@ set party_pretty_name [acs_object_name $party_id] +set r [::xo::db::Class get_instance_from_db -id $room_id] +set pretty_name [$r set pretty_name] -set pretty_name [chat_room_name $room_id] - # Local variables: # mode: tcl # tcl-indent-level: 2