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@
+
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 @@
-