Index: openacs-4/packages/chat/lib/current-messages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/current-messages.adp,v diff -u -r1.2 -r1.2.10.1 --- openacs-4/packages/chat/lib/current-messages.adp 24 Jun 2006 14:23:41 -0000 1.2 +++ openacs-4/packages/chat/lib/current-messages.adp 17 Mar 2020 14:06:38 -0000 1.2.10.1 @@ -1,14 +1,12 @@
- - -

- @messages.creation_date@ - @messages.person_name@: - @messages.msg@ -

-
-
- + + +

+ @messages:item@ +

+
+
+

#chat.No_information_available#

-
-
\ No newline at end of file + + 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.4 -r1.4.8.5 --- openacs-4/packages/chat/lib/current-messages.tcl 9 Feb 2020 15:30:16 -0000 1.4.8.4 +++ openacs-4/packages/chat/lib/current-messages.tcl 17 Mar 2020 14:06:38 -0000 1.4.8.5 @@ -4,20 +4,10 @@ room_id:naturalnum } -set sql { - select to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date, creation_user, msg - from chat_msgs - where room_id = :room_id - order by creation_date -} +set r [::xo::db::Class get_instance_from_db -id $room_id] +set messages [$r transcript_messages] +set n_messages [llength $messages] -db_multirow -extend { person_name } messages select_msg_items $sql { - set person_name [::chat::Package get_user_name -user_id $creation_user] - if {$person_name eq ""} { - set person_name "Unknown" - } -} - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/chat/lib/transcript-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/Attic/transcript-view.adp,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/lib/transcript-view.adp 7 Aug 2017 23:48:07 -0000 1.4 +++ openacs-4/packages/chat/lib/transcript-view.adp 17 Mar 2020 14:06:38 -0000 1.4.2.1 @@ -13,4 +13,4 @@ -
@contents;noquote@
+
@contents@
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.9 -r1.1.2.10 --- openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl 9 Feb 2020 15:30:16 -0000 1.1.2.9 +++ openacs-4/packages/chat/tcl/xotcl-chat-procs.tcl 17 Mar 2020 14:06:38 -0000 1.1.2.10 @@ -285,37 +285,77 @@ new transcript and then delete them. } { if {${:auto_transcript_p}} { - set room_id ${:room_id} - set contents [list] - ::xo::dc foreach get_archives_messages { - select msg, - creation_user, - to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date - from chat_msgs - where room_id = :room_id - and msg is not null - order by creation_date - } { - if {$creation_user > 0} { - set user_name [::chat::Package get_user_name -user_id $creation_user] - } else { - set user_name "system" + :create_transcript + } + :delete_messages + } + + ::xo::db::chat_room ad_instproc create_transcript { + -pretty_name + -description + -creation_user + {-creation_ip ""} + } { + Creates a new transcript of all current chat room messages. + + @return transcript_id of the new transcript or the empty + string when no messages were in the chat room. + } { + if {![info exists pretty_name]} { + set today [clock format [clock seconds] -format "%d.%m.%Y"] + set pretty_name "#chat.transcript_of_date# $today" + } + if {![info exists description]} { + set description "#chat.automatically_created_transcript#" + } + if {![info exists creation_user]} { + set creation_user ${:creation_user} + } + + set contents [:transcript_messages] + if {[llength $contents] > 0} { + set t [::xo::db::chat_transcript new \ + -creation_user $creation_user \ + -creation_ip $creation_ip \ + -pretty_name $pretty_name \ + -description $description \ + -package_id ${:package_id} \ + -room_id ${:room_id} \ + -contents [join $contents \n]] + $t save_new + return [$t set transcript_id] + } + } + + ::xo::db::chat_room ad_instproc transcript_messages {} { + Formats the current content of a chat room as a list of + messages formatted so they can be displayed or stored in the + transcript. + + @return list of formatted messages + } { + set room_id ${:room_id} + set contents [list] + ::xo::dc foreach get_archives_messages { + select msg, + creation_user, + to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date + from chat_msgs + where room_id = :room_id + and msg is not null + order by creation_date + } { + if {$creation_user > 0} { + set user_name [::chat::Package get_user_name -user_id $creation_user] + if {$user_name eq ""} { + set user_name Unknown } - lappend contents "\[$creation_date\] ${user_name}: $msg" + } else { + set user_name "system" } - if {[llength $contents] > 0} { - set today [clock format [clock seconds] -format "%d.%m.%Y"] - set t [::xo::db::chat_transcript new \ - -creation_user ${:creation_user} \ - -pretty_name "#chat.transcript_of_date# $today" \ - -description "#chat.automatically_created_transcript#" \ - -package_id ${:package_id} \ - -room_id ${:room_id} \ - -contents [join $contents "
\n"]] - $t save_new - } + lappend contents "\[$creation_date\] ${user_name}: $msg" } - :delete_messages + return $contents } # Index: openacs-4/packages/chat/www/transcript-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-entry.adp,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/chat/www/transcript-entry.adp 7 Aug 2017 23:48:07 -0000 1.11 +++ openacs-4/packages/chat/www/transcript-entry.adp 17 Mar 2020 14:06:38 -0000 1.11.2.1 @@ -13,7 +13,6 @@
-
@@ -60,7 +59,11 @@
#chat.Contents#
-
@contents;noquote@
+
+ + @messages:item@
+
+
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.3 -r1.5.2.4 --- openacs-4/packages/chat/www/transcript-new-2.tcl 13 May 2019 10:02:55 -0000 1.5.2.3 +++ openacs-4/packages/chat/www/transcript-new-2.tcl 17 Mar 2020 14:06:38 -0000 1.5.2.4 @@ -7,26 +7,21 @@ {description:trim ""} {delete_messages:optional "off"} {deactivate_room:optional "off"} - contents:trim,notnull,html } permission::require_permission -object_id $room_id -privilege chat_transcript_create -set package_id [ad_conn package_id] set user_id [ad_conn user_id] set creation_ip [ad_conn peeraddr] -set t [::xo::db::chat_transcript new \ - -description $description \ - -package_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] + +set transcript_id [$r create_transcript \ + -pretty_name $transcript_name \ + -description $description \ + -creation_user $user_id \ + -creation_ip $creation_ip] + if { $delete_messages eq "on" } { $r delete_messages # forward the information to AJAX 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.2 -r1.8.2.3 --- openacs-4/packages/chat/www/transcript-new.tcl 2 Mar 2019 17:51:10 -0000 1.8.2.2 +++ openacs-4/packages/chat/www/transcript-new.tcl 17 Mar 2020 14:06:38 -0000 1.8.2.3 @@ -28,11 +28,7 @@ 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 {} { - set user_name [::chat::Package get_user_name -user_id $creation_user] - append contents "\[$creation_date\] $user_name: $msg
\n" -} +set messages [$r transcript_messages] ad_return_template "transcript-entry"