aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mod/chat.php5
-rw-r--r--mod/chatsvc.php2
-rw-r--r--view/tpl/chat.tpl33
3 files changed, 35 insertions, 5 deletions
diff --git a/mod/chat.php b/mod/chat.php
index 42a7808d9..b8af4c1a6 100644
--- a/mod/chat.php
+++ b/mod/chat.php
@@ -61,7 +61,10 @@ function chat_content(&$a) {
$x = chatroom_enter($observer,$room_id,'online',$_SERVER['REMOTE_ADDR']);
if(! $x)
return;
- $o = replace_macros(get_markup_template('chat.tpl'),array());
+ $o = replace_macros(get_markup_template('chat.tpl'),array(
+ '$room_id' => $room_id,
+ '$submit' => t('Submit')
+ ));
return $o;
}
diff --git a/mod/chatsvc.php b/mod/chatsvc.php
index b8d2a9f69..23b95cd1c 100644
--- a/mod/chatsvc.php
+++ b/mod/chatsvc.php
@@ -4,6 +4,8 @@ require_once('include/security.php');
function chatsvc_init(&$a) {
+//logger('chatsvc');
+
$ret = array('success' => false);
$a->data['chat']['room_id'] = intval($_REQUEST['room_id']);
diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl
index 6378b8776..d0f9418a0 100644
--- a/view/tpl/chat.tpl
+++ b/view/tpl/chat.tpl
@@ -8,11 +8,36 @@
<div id="chatBottomBar" class="rounded">
<div class="tip"></div>
- <form id="submitForm" method="post" action="">
- <input id="chatText" name="chatText" class="rounded" maxlength="255" />
- <input type="submit" class="blueButton" value="Submit" />
+ <form id="chat-form" method="post" action="#">
+ <input type="hidden" name="room_id" value="{{$room_id}}" />
+ <textarea id="chatText" name="chat_text" rows=3 cols=80></textarea><br />
+ <input type="submit" name="submit" value="{{$submit}}" />
</form>
</div>
-</div> \ No newline at end of file
+</div>
+
+<script>
+var room_id = {{$room_id}};
+
+$('#chat-form').submit(function(ev) {
+ $('body').css('cursor','wait');
+ $.post("chatsvc", $('#chat-form').serialize(),function(data) {
+ load_chats(data);
+ $('body').css('cursor','auto');
+ },'json');
+ ev.preventDefault();
+});
+
+function load_chats(data) {
+ var chat_data = data;
+ if(! data) {
+ $.get("chatsvc?f=&room_id=" + room_id,function(data) {
+ chat_data = $this;
+ });
+ }
+
+
+}
+</script>