Index: openacs-4/packages/xowiki/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/chat-procs.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/xowiki/tcl/chat-procs.tcl 16 Jun 2015 19:49:20 -0000 1.19 +++ openacs-4/packages/xowiki/tcl/chat-procs.tcl 7 Aug 2017 23:48:30 -0000 1.20 @@ -44,7 +44,7 @@ #my log "chat_id=$chat_id, path=$path" if {$path eq ""} { set path [lindex [site_node::get_url_from_object_id -object_id $package_id] 0] - } elseif {[string range $path end end] ne "/"} { + } elseif {[string index $path end] ne "/"} { append path / } @@ -77,7 +77,7 @@ set mode polling # # Check, whether we have the tcllibthread and a sufficiently new - # aolserver/naviserver supporting bgdelivery transfers. + # aolserver/NaviServer supporting bgdelivery transfers. # if {[info commands ::thread::mutex] ne "" && ![catch {ns_conn contentsentlength}]} { @@ -119,7 +119,7 @@ error "mode $mode unknown, valid are: polling, streaming and scripted-streaming" } } - set send_url ${path}ajax/chat?m=add_msg&$context&msg= + set send_url ${path}ajax/chat?m=add_msg&$context&msg= if { ![file exists [acs_root_dir]/$jspath] } { return -code error "File [acs_root_dir]/$jspath does not exist" @@ -140,13 +140,22 @@ overflow:auto; } + template::add_body_script -script [subst {document.getElementById('chatMsg').focus();}] + switch $mode { - polling {return "\ - -
+ @@ -159,13 +168,16 @@ ::xowiki::Chat create c1 -destroy_on_cleanup -chat_id $chat_id -session_id $session_id -mode $mode set r [ns_urldecode [c1 get_all]] regsub -all {<[/]?div[^>]*>} $r "" r + template::add_event_listener \ + -id "messages-form" -event "submit" \ + -script {chatSendMsg();} return "\ -
$r
- +
" } @@ -175,16 +187,20 @@ ::xowiki::Chat create c1 -destroy_on_cleanup -chat_id $chat_id -session_id $session_id -mode $mode set r [ns_urldecode [c1 get_all]] regsub -all {<[/]?div[^>]*>} $r "" r + template::add_event_listener \ + -id "messages-form" -event "submit" \ + -script {chatSendMsg();} return "\ - -
+
-
+
+ " }