Index: openacs-4/packages/chat/chat.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/chat.info,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/chat/chat.info 14 Mar 2006 12:16:08 -0000 1.7 +++ openacs-4/packages/chat/chat.info 30 Mar 2006 09:15:12 -0000 1.7.2.1 @@ -7,19 +7,21 @@ f f - - David Dao - Server based chat with an html and java client. - 2004-10-10 + + Peter Alberer + Server based chat with an html and ajax client. + 2006-03-24 OpenACS - Modified by Agustin.Lopez@uv.es (University of Valencia, Spain). + Adapted by Peter Alberer 2006/03/25 to allow java and ajax to coexist. Adapted by Tekne 2006/03/01 to replace JAVA server with AJAX; make use of generalized chat class from xotcl-core + 0 - + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/catalog/chat.de_DE.ISO-8859-1.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml 14 Mar 2006 12:16:08 -0000 1.1 +++ openacs-4/packages/chat/catalog/chat.en_US.ISO-8859-1.xml 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -1,9 +1,13 @@ - + + Actions Active + active users Add moderator Add user to room + Ajax + ajax client Archive Are you sure you want to delete Are you sure you want to revoke chat user privilege of @@ -12,6 +16,7 @@ Ban Ban chat read/write privilege for Ban user + Banned users Chat Chat main page Confirm chat transcript delete @@ -28,16 +33,23 @@ Create new room failed Create room Create transcript + Creation date + Current conversation + date + Raum nach Erstellung des Protokolls deaktivieren Delete all messages in the room Delete messages + Delete messages after creating the transcript Delete messages failed Delete room Delete room failed Delete transcript Delete transcript failed Description Edit + Edit Room Edit transcript + exit chat room Extreme Actions from Grant @@ -47,31 +59,49 @@ Grant user has entered the room has left the room + HTML HTML + html client + JavaScript Java + Javascript key + last activity Log off + Message + Message count messages in Moderated + Message Name No information available + No active remove Revoke revoke Revoke moderator Revoke user Admin + Deactive Room Room Information Room moderators Room name Room no active Room not found, Invalid room id Send/Refresh + Sending message... There are no rooms available to + Protocol Transcript name + Protocol of + Protocol of the messages in room Transcript preview + transcription of all chat messages Transcripts + Available transcripts in room + Trascript + Trasncript Unauthorized Unauthorized privilege Unban @@ -84,6 +114,7 @@ View View transcript for name or email or username limited to + <b>Warning</b> The package parameter "DefaultClient" is set to "Ajax" but the package xotcl-core is not installed. Ajax will not work without xotcl-core! Yes You don't have permission to enter this chat room your name is Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/current-messages.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/current-messages.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/transcript-view.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/transcript-view.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/transcripts.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/transcripts.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/lib/transcripts.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/tcl/chat-ajax-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? 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.5 -r1.5.2.1 --- openacs-4/packages/chat/tcl/chat-procs.tcl 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/tcl/chat-procs.tcl 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -124,7 +124,7 @@ } { Log chat message to the database. } { - ns_log Notice $msg + # ns_log Notice $msg db_exec_plsql post_message {} } @@ -308,9 +308,10 @@ } { Return display name of this user to use in chat. } { + acs_user::get -user_id $user_id -array user + set name [expr {$user(screen_name) ne "" ? $user(screen_name) : $user(name)}] + return $name - return [db_exec_plsql get_chat_user_name {}] - } ad_proc -public chat_message_post { @@ -327,12 +328,10 @@ set status "pending" } - set chat_msg "[chat_user_name $user_id]$user_id$room_id$message$status" - # Add message to queue. Notify thread responsible for broadcast message to applets. - - nsv_set chat html_message $chat_msg - ns_mutex unlock [nsv_get chat new_message] - + if [catch {chat_post_message_to_db -creation_user $user_id $room_id $message} errmsg] { + ns_log error "chat_post_message_to_db: error: $errmsg" + } + } @@ -368,7 +367,7 @@ set user_name [chat_user_name $user_id] - upvar "$msgs:rowcount" counter + upvar "$msgs:rowcount" counter set chat_messages [nsv_get chat_room $room_id] @@ -419,15 +418,6 @@ db_transaction { set transcript_id [db_exec_plsql create_transcript {}] db_exec_plsql grant_permission {} -# -# db_dml transcript_content { -# update chat_transcripts -# set contents = empty_clob() -# where transcript_id = :transcript_id -# returning contents into :1 -# } -clobs [list $contents] -# } on_error { -# ad_return_complaint 1 "Insert fail: $errmsg" } return $transcript_id @@ -450,26 +440,7 @@ } { Edit chat transcript. } { - db_transaction { - db_exec_plsql edit_transcript { - - } - #db_dml transcript_content { - # update chat_transcripts - # set contents = empty_clob() - # where transcript_id = :transcript_id - # returning contents into :1 - #} -clobs [list $contents] - } - + db_exec_plsql edit_transcript {} } - - - - - - - - Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax-chat-script.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax-chat-script.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcript.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcripts.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/chat-transcripts.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/www/chat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/chat.tcl 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/chat.tcl 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -1,7 +1,7 @@ #/chat/www/chat.tcl ad_page_contract { - Decide which template to use HTML or Java. + Decide which template to use HTML or AJAX. @author David Dao (ddao@arsdigita.com) @creation-date November 22, 2000 @@ -29,18 +29,15 @@ ad_return_complaint 1 "[_ chat.Room_not_found]" } -set context_bar [list $room_name] - +set context_bar $room_name set user_id [ad_conn user_id] - -set read_p [ad_permission_p $room_id "chat_read"] -set write_p [ad_permission_p $room_id "chat_write"] -set ban_p [ad_permission_p $room_id "chat_ban"] - +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] if { $moderate_room_p == "t" } { - set moderator_p [ad_permission_p $room_id "chat_moderator"] + set moderator_p [permission::permission_p -object_id $room_id -privilege "chat_moderator"] } else { # This is an unmoderate room, therefore everyone is a moderator. set moderator_p "1" @@ -54,42 +51,27 @@ # Get chat screen name. set user_name [chat_user_name $user_id] -# Determine which template to use for html or java client -if {$client == "java"} { - set template_use "java-chat" - # Get config paramater for applet. - set width [ad_parameter AppletWidth "" 500] - set height [ad_parameter AppletHeight "" 400] - - set host [ad_parameter ServerHost "" [ns_config "ns/server/[ns_info server]/module/nssock" Hostname]] - set port [ad_parameter ServerPort "" 8200] -} else { - set template_use "html-chat" +# send message to the database +if { ![empty_string_p $message] } { + chat_message_post $room_id $user_id $message $moderator_p +} - chat_message_retrieve msgs $room_id $user_id - - if { ![empty_string_p $message] } { - chat_message_post $room_id $user_id $message $moderator_p +# Determine which template to use for html or ajax client +switch $client { + "html" { + set template_use "html-chat" + # forward to ajax if necessary + if { ![empty_string_p $message] && [llength [info command ::chat::Chat]] > 0 } { + set session_id [ad_conn session_id] + ::chat::Chat c1 -volatile -chat_id $room_id -session_id $session_id + c1 add_msg $message + } } - - - + "ajax" { + set template_use "ajax-chat-script" + } } ad_return_template $template_use - - - - - - - - - - - - - - Index: openacs-4/packages/chat/www/html-chat.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/html-chat.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/html-chat.adp 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/html-chat.adp 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -2,24 +2,16 @@ @context_bar;noquote@ @room_name;noquote@ -[#chat.Log_off#] +#chat.Log_off# +#chat.Trascript# +@richclient.title@ +

+

#chat.Chat#: -
-
    - - - -@user_name@: @message@
    -
    -
    - -@msgs.screen_name@: @msgs.chat_msg@
    -
    - -
+ Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/html-chat.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/www/index-postgresql.xql 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/index-postgresql.xql 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -19,8 +19,10 @@ from chat_rooms rm, acs_objects obj where rm.room_id = obj.object_id + and obj.context_id = :package_id order by rm.pretty_name + Index: openacs-4/packages/chat/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/index.adp 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/index.adp 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -6,46 +6,20 @@ @cvs-id $Id$ --> -@context_bar;noquote@ +#chat.Chat_main_page# #chat.Chat_main_page# - - - -[#chat.Create_a_new_room#] + +
+ @warning;noquote@ +
-

#chat.There_are_no_rooms_available# +

#chat.There_are_no_rooms_available#

+

#chat.Create_a_new_room#

- - - <% - set can_see 0 - if {($rooms(active_p) eq "t" && $rooms(user_p) eq "t") || ($rooms(admin_p) eq "t")} { - set can_see 1 - } - %> - - - - - - - - -
@rooms.pretty_name@ - [ HTML | java ] - - - [#chat.room_admin#] - - - (NO #chat.Active#) - - <% set desc [string range $rooms(description) 0 50] %> - - @desc@ -
+
+ Index: openacs-4/packages/chat/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/index.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/chat/www/index.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/index.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -15,23 +15,89 @@ } set package_id [ad_conn package_id] - -set context_bar [list] - set user_id [ad_conn user_id] +set actions [list] +set room_create_p [permission::permission_p -object_id $package_id -privilege chat_room_create] +set default_client [parameter::get -parameter "DefaultClient"] +set warning "" -set room_create_p [ad_permission_p $package_id chat_room_create] +if { $default_client eq "ajax" } { + if { ![apm_package_installed_p xotcl-core] } { + set warning "[_ chat.xotcl_missing]" + set default_client "html" + } elseif { [llength [info command ::chat::Chat]] == 0 } { + set warning "[_ chat.bootstrap_patch_missing]" + set default_client "html" + } +} +if { $room_create_p } { + lappend actions "#chat.Create_a_new_room#" room-edit "#chat.Create_a_new_room#" +} -db_multirow rooms rooms_list {} +db_multirow -extend { active_users last_activity } rooms rooms_list {} { + if { [llength [info command ::chat::Chat]] > 0 } { + set room [::chat::Chat create new -volatile -chat_id $room_id] + set active_users [$room nr_active_users] + set last_activity [$room last_activity] + } else { + set active_users "-" + set last_activity "-" + } +} +list::create \ + -name "rooms" \ + -multirow "rooms" \ + -key room_id \ + -pass_properties {room_create_p} \ + -actions $actions \ + -row_pretty_plural [_ chat.rooms] \ + -elements { + active { + label "Aktiv" + html { align "center" } + display_template { + +
+ +
+
+ +
+ +
+
+ } + } + pretty_name { + label "Name" + display_template { + + @rooms.pretty_name@ + + + @rooms.pretty_name@ + + } + } + active_users { + label "#chat.active_users#" + html { style "text-align:center;" } + } + last_activity { + label "#chat.last_activity#" + html { style "text-align:center;" } + } + actions { + label "#chat.actions#" + display_template { + #chat.Transcripts# + + #chat.room_admin# + + } + } + } ad_return_template - - - - - - - - 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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/message-delete-2.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/message-delete-2.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -9,11 +9,14 @@ room_id:integer,notnull } -ad_require_permission $room_id chat_room_delete +permission::require_permission -object_id $room_id -privilege chat_room_delete - if { [catch {chat_room_message_delete $room_id} errmsg] } { ad_return_complaint 1 "[_ chat.Delete_messages_failed]: $errmsg" } +if { [llength [info command ::chat::Chat]] > 0 } { + ::chat::Chat flush_messages -chat_id $room_id +} + ad_returnredirect . \ No newline at end of file Fisheye: Tag 1.4.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-edit-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? 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.4 -r1.4.2.1 --- openacs-4/packages/chat/www/room-edit.tcl 14 Mar 2006 12:16:09 -0000 1.4 +++ openacs-4/packages/chat/www/room-edit.tcl 30 Mar 2006 09:15:12 -0000 1.4.2.1 @@ -2,46 +2,77 @@ ad_page_contract { Display a form to edit room information. - @author David Dao (ddao@arsdigita.com) - @creation-date November 13, 2000 - @cvs-id $Id$ + @author Peter Alberer (peter@alberer.com) + @creation-date March 26, 2006 } { - room_id:integer,notnull -} -properties { - context_bar:onevalue - room_id:onevalue - title:onevalue - action:onevalue - submit_label:onevalue - pretty_name:onevalue - description:onevalue - moderated_p:onevalue - active_p:onevalue - room:onerow -} + room_id:integer,optional +} -ad_require_permission $room_id chat_room_edit +permission::require_permission -object_id [ad_conn package_id] -privilege chat_room_edit +if { ![info exists room_id] } { + set title "[_ chat.Create_a_new_room]" +} else { + set title "[_ chat.Edit_room] \"[chat_room_name $room_id]\"" +} -if {[catch {db_1row room_info { - select pretty_name, description, moderated_p, archive_p, active_p - from chat_rooms - where room_id = :room_id}} errmsg]} { - - ad_return_complaint 1 "[_ chat.Room_not_found]." +ad_form -name "edit-room" -edit_buttons [list [list [_ chat.Update_room] next]] -has_edit 1 -form { + {room_id:key} + {moderated_p:boolean(hidden) + {value "f"} + } + {archive_p:boolean(hidden) + {value "t"} + } + {pretty_name:text(text) + {label "#chat.Room_name#" } + } + {description:text(textarea),optional + {label "#chat.Description#" } + {html {rows 6 cols 65}} + } + {active_p:boolean(radio) + {label "#chat.Active#" } + {options {{Ja t} {Nein f}}} + {value "t"} + } +} -new_data { + if {[catch {set room_id [chat_room_new -moderated_p $moderated_p \ + -description $description \ + -active_p $active_p \ + -archive_p $archive_p \ + -context_id [ad_conn package_id] \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] $pretty_name]} errmsg]} { + ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg" + break + } + set comm_id [dotlrn_community::get_community_id] + if {$comm_id ne ""} { + chat_user_grant $room_id [dotlrn_community::get_community_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 + } +} -edit_request { + if {[catch {db_1row room_info { + select pretty_name, description, moderated_p, archive_p, active_p + from chat_rooms + where room_id = :room_id}} errmsg]} { + ad_return_complaint 1 "[_ chat.Room_not_found]." + break + } +} -edit_data { + if {[catch {chat_room_edit $room_id $pretty_name $description $moderated_p $active_p $archive_p} errmsg]} { + ad_return_complaint 1 "[_ chat.Could_not_update_room]: $errmsg" + break + } +} -after_submit { + ad_returnredirect "room?room_id=$room_id" + ad_script_abort } -ns_log notice "send: moderated_p:$moderated_p archive_p:$archive_p active_p:$active_p" - -set context_bar [list "Edit room '$pretty_name'"] -set title "Edit room '$pretty_name'" -set action "room-edit-2" -set submit_label "[_ chat.Update_room]" - -ad_return_template "room-entry" - - - - - - 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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/room-enter.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/room-enter.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -10,24 +10,28 @@ room_id:integer,notnull client:trim } -chat_start_server + set user_id [ad_conn user_id] -set read_p [ad_permission_p $room_id "chat_read"] -set write_p [ad_permission_p $room_id "chat_write"] -set ban_p [ad_permission_p $room_id "chat_ban"] +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 active [room_active_status $room_id] - if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") || ($active == "f") } { #Display unauthorize privilege page. ad_returnredirect unauthorized ad_script_abort } -if {$client == "html"} { - - chat_message_post $room_id $user_id "[_ chat.has_entered_the_room]." "1" +switch $client { + "java" { + chat_start_server + } + "html" - "ajax" - "html-chat-script" { + ns_log Notice "YY room-enter: has_entered_the room" + chat_message_post $room_id $user_id "[_ chat.has_entered_the_room]." "1" + } } ad_returnredirect "chat?room_id=$room_id&client=$client" Fisheye: Tag 1.5.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-entry.adp'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/www/room-exit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-exit.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/chat/www/room-exit.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/room-exit.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -10,12 +10,10 @@ } set user_id [ad_conn user_id] +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 read_p [ad_permission_p $room_id "chat_read"] -set write_p [ad_permission_p $room_id "chat_write"] -set ban_p [ad_permission_p $room_id "chat_ban"] - if { ($read_p == "0" && $write_p == "0") || ($ban_p == "1") } { #Display unauthorize privilege page. ad_returnredirect unauthorized @@ -24,5 +22,12 @@ chat_message_post $room_id $user_id "[_ chat.has_left_the_room]." "1" -#ad_returnredirect index -ad_returnredirect [dotlrn::get_url] +# send to AJAX +if { [llength [info command ::chat::Chat]] > 0 } { + set session_id [ad_conn session_id] + ::chat::Chat c1 -volatile -chat_id $room_id -session_id $session_id + c1 logout +} + +ad_returnredirect index +#ad_returnredirect [dotlrn::get_url] Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-new-2.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/room-new.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/www/room-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-oracle.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/www/room-oracle.xql 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/room-oracle.xql 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -24,22 +24,14 @@ - select party_id, acs_object.name(party_id) as name - from acs_object_party_privilege_map - where object_id = :room_id - and privilege = 'chat_ban' + select m.party_id, p.last_name || ', ' || p.first_names as name, pa.email + from acs_object_party_privilege_map m, persons p, parties pa + where m.party_id = p.person and m.object_id = :room_id + and m.privilege = 'chat_ban' and p.person_id = pa.party_id + order by p.last_name, p.first_names - - - - select transcript_id, pretty_name - from chat_transcripts - where room_id = :room_id - - - Index: openacs-4/packages/chat/www/room-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/www/room-postgresql.xql 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/room-postgresql.xql 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -20,25 +20,16 @@ - - select party_id, acs_object__name(party_id) as name - from acs_object_party_privilege_map - where object_id = :room_id - and privilege = 'chat_ban' + select m.party_id, p.last_name || ', ' || p.first_names as name, pa.email + from acs_object_party_privilege_map m, persons p, parties pa + where m.party_id = p.person_id and m.object_id = :room_id + and m.privilege = 'chat_ban' and p.person_id = pa.party_id + order by p.last_name, p.first_names - - - - select transcript_id, pretty_name - from chat_transcripts - where room_id = :room_id - - - Index: openacs-4/packages/chat/www/room.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/room.adp 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/room.adp 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -11,82 +11,47 @@

#chat.Room_Information#

-
    -
  • #chat.Room_name#: @pretty_name@ -
  • #chat.Description#:
    @description@
    - -
  • #chat.Active#: @active_p@ -
  • #chat.Archive#: @archive_p@ + + + + + + + + + + + + + + + + + +
    #chat.Room_name#@pretty_name@
    #chat.Description#@description@
    #chat.Active#@active_p@
    #chat.message_count#@message_count@
    -

    (#chat.Edit#) +

    +#chat.Edit# +#acs-kernel.common_Permissions# -

+ +#chat.Delete_all_messages_in_the_room# +#chat.Delete_room# +

#chat.No_information_available#. -

#chat.Users_allow# -

-#chat.Users_ban# - - - - - - +

#chat.Transcripts# -

- -

#chat.Extreme_Actions# -

-
- Index: openacs-4/packages/chat/www/room.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/chat/www/room.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/room.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -1,7 +1,6 @@ #/www/chat/room.tcl ad_page_contract { Display information about chat room. - @author David Dao (ddao@arsdigita.com) @creation-date November 15, 2000 @cvs-id $Id$ @@ -24,7 +23,6 @@ moderator_grant_p:onevalue moderator_revoke_p:onevalue transcript_create_p:onevalue - transcript_delete_p:onevalue transcript_edit_p:onevalue transcript_view_p:onevalue moderators:multirow @@ -35,68 +33,60 @@ set context_bar [list "[_ chat.Room_Information]"] - ### # Get all available permission of this user on this room. ### -set room_view_p [ad_permission_p $room_id chat_room_view] -set room_edit_p [ad_permission_p $room_id chat_room_edit] -set room_delete_p [ad_permission_p $room_id chat_room_delete] -set user_ban_p [ad_permission_p $room_id chat_user_ban] -set user_unban_p [ad_permission_p $room_id chat_user_unban] -set user_grant_p [ad_permission_p $room_id chat_user_grant] -set user_revoke_p [ad_permission_p $room_id chat_user_revoke] -set moderator_grant_p [ad_permission_p $room_id chat_moderator_grant] -set moderator_revoke_p [ad_permission_p $room_id chat_moderator_revoke] -set transcript_create_p [ad_permission_p $room_id chat_transcript_create] -set transcript_delete_p [ad_permission_p $room_id chat_transcript_delete] -set transcript_edit_p [ad_permission_p $room_id chat_transcript_edit] -set transcript_view_p [ad_permission_p $room_id chat_transcript_view] +set room_view_p [permission::permission_p -object_id $room_id -privilege chat_room_view] +set room_edit_p [permission::permission_p -object_id $room_id -privilege chat_room_edit] +set room_delete_p [permission::permission_p -object_id $room_id -privilege chat_room_delete] +set user_ban_p [permission::permission_p -object_id $room_id -privilege chat_user_ban] +set user_unban_p [permission::permission_p -object_id $room_id -privilege chat_user_unban] +set user_grant_p [permission::permission_p -object_id $room_id -privilege chat_user_grant] +set user_revoke_p [permission::permission_p -object_id $room_id -privilege chat_user_revoke] +set moderator_grant_p [permission::permission_p -object_id $room_id -privilege chat_moderator_grant] +set moderator_revoke_p [permission::permission_p -object_id $room_id -privilege chat_moderator_revoke] +set transcript_create_p [permission::permission_p -object_id $room_id -privilege chat_transcript_create] ### -# End geting all available permissions. -### - -### # Get room basic information. ### - - -#db_1row room_info { -# select pretty_name, description, decode(moderated_p, 't', 'Yes', 'No') as moderated_p, -# decode(archive_p, 't', 'Yes', 'No') as archive_p, -# decode(active_p, 't', 'Yes', 'No') as active_p -# from chat_rooms -# where room_id = :room_id -#} - db_1row room_info { select pretty_name, description, moderated_p, active_p, archive_p from chat_rooms where room_id = :room_id } -# List available room moderators. -db_multirow moderators list_moderators {} +# get db-message count +set message_count [db_string message_count "select count(*) from chat_msgs where room_id = :room_id" -default 0] -# List authorized chat users. -db_multirow users_allow list_user_allow {} - # List user ban from chat -db_multirow users_ban list_user_ban {} +db_multirow banned_users list_user_ban {} +list::create \ + -name "banned_users" \ + -multirow "banned_users" \ + -key party_id \ + -pass_properties { user_unban_p room_id } \ + -row_pretty_plural [_ chat.banned_users] \ + -elements { + name { + label "Name" + } + email { + label "Email" + } + actions { + label "#chat.actions#" + html { align "center" } + display_template { + + + + + + } + } + } -# List available chat transcript -db_multirow chat_transcripts list_transcripts {} - ad_return_template - - - - - - - - - Index: openacs-4/packages/chat/www/search-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/search-2.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/www/search-2.tcl 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/search-2.tcl 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -97,7 +97,8 @@ } else { set query "select username, user_id, email_verified_p, first_names, last_name, email, member_state from cc_users -where [join $where_clause "\nand "]" +where [join $where_clause "\nand "] +limit $SQL_LIMIT" } set i 0 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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/transcript-delete.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/transcript-delete.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -14,7 +14,7 @@ transcript_id:onevalue } -ad_require_permission $transcript_id chat_transcript_delete +permission::require_permission -object_id $transcript_id -privilege chat_transcript_delete set context_bar [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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/transcript-edit-2.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/transcript-edit-2.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -13,9 +13,8 @@ {description:trim ""} } -ad_require_permission $transcript_id chat_transcript_edit +permission::require_permission -object_id $transcript_id -privilege chat_transcript_edit - if { [catch {chat_transcript_edit $transcript_id $transcript_name $description $contents} errmsg] } { ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/transcript-edit.adp'. Fisheye: No comparison available. Pass `N' to diff? 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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/transcript-edit.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/transcript-edit.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -8,32 +8,44 @@ } { transcript_id:integer,notnull room_id:integer,notnull -} -properties { - context_bar:onevalue - title:onevalue - room_id:onevalue - transcript_id:onevalue - transcript_name:onevalue - description:onevalue - contents:onevalue - action:onevalue - submit_label:onevalue -} +} -ad_require_permission $transcript_id chat_transcript_edit +permission::require_permission -object_id $transcript_id -privilege chat_transcript_edit set context_bar [list "[_ chat.Edit_transcript]"] -set title "[_ chat.Edit_transcript]" -set action "transcript-edit-2" set submit_label "[_ chat.Edit]" +set active_p [room_active_status $room_id] db_1row get_transcript_info { - select pretty_name as transcript_name, - description, - contents + select pretty_name, description, contents from chat_transcripts where transcript_id = :transcript_id } -ad_return_template "transcript-entry" - +ad_form -name "edit-transcription" -edit_buttons [list [list [_ chat.Edit] next]] -has_edit 1 -form { + {room_id:integer(hidden) + {value $room_id} + } + {transcript_id:integer(hidden) + {value $transcript_id} + } + {pretty_name:text(text) + {label "#chat.Transcript_name#" } + {value $pretty_name} + } + {description:text(textarea),optional + {label "#chat.Description#" } + {html {rows 6 cols 65}} + {value $description} + } + {contents:text(textarea) + {label "#chat.Transcript#" } + {html {rows 6 cols 65}} + {value $contents} + } +} -on_submit { + if { [catch {chat_transcript_edit $transcript_id $pretty_name $description $contents} errmsg] } { + ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" + } + ad_returnredirect "chat-transcript?transcript_id=$transcript_id&room_id=$room_id" +} 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.5 -r1.5.2.1 --- openacs-4/packages/chat/www/transcript-entry.adp 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/transcript-entry.adp 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -12,22 +12,42 @@
- - - -
#chat.Transcript_name#: + + + + - - + + + + + + + + + + + + - - - + - - - +
#chat.Transcript_name# +
#chat.Description# :
#chat.Delete_messages# +
+ [i] + #chat.delete_messages_after_transcript# +
+
#chat.Room_deactivate# +
+ [i] + #chat.deactivate_room_after_transcript# +
+
#chat.Description#
#chat.Contents#: +
#chat.Contents# +
@contents;noquote@
+
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.1.1.1 -r1.1.1.1.14.1 --- openacs-4/packages/chat/www/transcript-new-2.tcl 20 Apr 2001 20:51:08 -0000 1.1.1.1 +++ openacs-4/packages/chat/www/transcript-new-2.tcl 30 Mar 2006 09:15:12 -0000 1.1.1.1.14.1 @@ -5,27 +5,36 @@ room_id:integer,notnull transcript_name:trim,notnull {description:trim ""} + {delete_messages:optional "off"} + {deactivate_room:optional "off"} contents:trim,notnull,html } -ad_require_permission $room_id chat_transcript_create +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 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 transcript_id [chat_transcript_new -description $description \ - -context_id $package_id \ - -creation_user $user_id \ - -creation_ip $creation_ip \ - $transcript_name $contents $room_id] +if { $delete_messages eq "on" } { + chat_room_message_delete $room_id + # forward the information to AJAX + if { [llength [info command ::chat::Chat]] > 0 } { + ::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" +} -ad_returnredirect "transcript-view?room_id=$room_id&transcript_id=$transcript_id" +ad_returnredirect "chat-transcript?room_id=$room_id&transcript_id=$transcript_id" - - - - - Index: openacs-4/packages/chat/www/transcript-new-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-new-postgresql.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/chat/www/transcript-new-postgresql.xql 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/transcript-new-postgresql.xql 30 Mar 2006 09:15:12 -0000 1.1.2.1 @@ -4,11 +4,11 @@ - select msg, person__name(creation_user) as name + 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 msg_id + order by creation_date 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.3 -r1.3.2.1 --- openacs-4/packages/chat/www/transcript-new.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/transcript-new.tcl 30 Mar 2006 09:15:12 -0000 1.3.2.1 @@ -14,29 +14,23 @@ contents:onevalue } -ad_require_permission $room_id chat_transcript_create +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]"] set transcript_id "" -set transcript_name "[_ chat.Untitled]" +set transcript_name "[_ chat.transcript_of_date] [clock format [clock seconds] -format "%d.%m.%y %H:%M:%S"]" set description "" set contents "" set action "transcript-new-2" set title "[_ chat.Create_transcript]" set submit_label "[_ chat.Create_transcript]" +set active_p [room_active_status $room_id] #Build a list of all message. db_foreach get_archives_messages {} { - append contents "$name: $msg
\n" + append contents "\[$creation_date\] [chat_user_name $creation_user]: $msg
\n" } ad_return_template "transcript-entry" - - - - - - - Index: openacs-4/packages/chat/www/transcript-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-view.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/transcript-view.adp 14 Mar 2006 12:16:09 -0000 1.5 +++ openacs-4/packages/chat/www/transcript-view.adp 30 Mar 2006 09:15:12 -0000 1.5.2.1 @@ -11,9 +11,13 @@ [#chat.Edit#]
    -
  • #chat.Name#: @transcript_name@
  • -
  • #chat.Description#: @description@
  • -
  • #chat.Contents#:

    @contents@

  • +
  • #chat.Name#: @transcript_name@ +
  • #chat.Description#: @description@ + + +
      +

      @contents;noquote@

    +
Index: openacs-4/packages/chat/www/user-ban-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-ban-2.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.14.1 --- openacs-4/packages/chat/www/user-ban-2.tcl 20 Apr 2001 20:51:08 -0000 1.1.1.1 +++ openacs-4/packages/chat/www/user-ban-2.tcl 30 Mar 2006 09:15:12 -0000 1.1.1.1.14.1 @@ -11,7 +11,7 @@ party_id:integer,notnull } -ad_require_permission $room_id chat_user_ban +permission::require_permission -object_id $room_id -privilege chat_user_ban chat_user_ban $room_id $party_id Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/chat.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/chat.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/users.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat/www/resources/active.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/active.png,v diff -u -r1.1 -r1.1.2.1 Binary files differ Index: openacs-4/packages/chat/www/resources/admin.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/admin.gif,v diff -u -r1.1 -r1.1.2.1 Binary files differ Index: openacs-4/packages/chat/www/resources/inactive.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/resources/inactive.png,v diff -u -r1.1 -r1.1.2.1 Binary files differ