From 806f1f0fa134cc0168c9f86aaf10b8357fc19905 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 4 May 2014 20:30:52 -0700 Subject: UI for deleting chatrooms --- include/chat.php | 3 +++ mod/chat.php | 3 +++ view/css/mod_chat.css | 15 +++++++++++---- view/css/widgets.css | 6 ++++++ view/tpl/chat.tpl | 15 +++++++++++++-- view/tpl/chatroomlist.tpl | 2 +- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/include/chat.php b/include/chat.php index 8e84d9be0..4c79319ee 100644 --- a/include/chat.php +++ b/include/chat.php @@ -84,6 +84,9 @@ function chatroom_destroy($channel,$arr) { q("delete from chatpresence where cp_room = %d", intval($r[0]['cr_id']) ); + q("delete from chat where chat_room = %d", + intval($r[0]['cr_id']) + ); } $ret['success'] = true; return $ret; diff --git a/mod/chat.php b/mod/chat.php index bf6eed57c..caf800f80 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -49,6 +49,7 @@ function chat_post(&$a) { if($_POST['action'] === 'drop') { + logger('delete chatroom'); chatroom_destroy($channel,array('cr_name' => $room)); goaway(z_root() . '/chat/' . $channel['channel_address']); } @@ -168,12 +169,14 @@ function chat_content(&$a) { } $o = replace_macros(get_markup_template('chat.tpl'),array( + '$is_owner' => ((local_user() && local_user() == $x[0]['cr_uid']) ? true : false), '$room_name' => $room_name, '$room_id' => $room_id, '$baseurl' => z_root(), '$nickname' => argv(1), '$submit' => t('Submit'), '$leave' => t('Leave Room'), + '$drop' => t('Delete This Room'), '$away' => t('I am away right now'), '$online' => t('I am online'), '$bookmark_link' => $bookmark_link, diff --git a/view/css/mod_chat.css b/view/css/mod_chat.css index 7963fbbd6..58680baec 100644 --- a/view/css/mod_chat.css +++ b/view/css/mod_chat.css @@ -10,13 +10,20 @@ overflow-y: auto; } - #chatUsers { + #chatSide { float: right; - width: 120px; + width: 150px; height: 100%; - border: 1px solid #000; } - + + #chatDrop { + margin-bottom: 20px; +} + + #chatUsers { + border: 1px solid #000; +} + #chatBottomBar { position: relative; bottom: 0; diff --git a/view/css/widgets.css b/view/css/widgets.css index 7e6b16bb2..f42ec65ee 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -166,4 +166,10 @@ li:hover .group-edit-icon { #photo-albums-upload-link { margin-top: 10px; +} + +/* Chatrooms */ + +.chatroomlist td { + padding: 0 5px 0; } \ No newline at end of file diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index acb7e5bef..9f95d2999 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -5,8 +5,19 @@
-
- +
+ {{if $is_owner}} +
+
+ + + +
+

+ {{/if}} + +

+
diff --git a/view/tpl/chatroomlist.tpl b/view/tpl/chatroomlist.tpl index c26ba0c33..71fec8200 100644 --- a/view/tpl/chatroomlist.tpl +++ b/view/tpl/chatroomlist.tpl @@ -1,7 +1,7 @@

{{$header}}

{{if $items}} - +
{{foreach $items as $item}} {{/foreach}} -- cgit v1.2.3
{{$item.cr_name}}{{$item.cr_inroom}}