some work on mod chat
This commit is contained in:
parent
e4f3605054
commit
5462453bf2
@ -202,7 +202,7 @@ function chatroom_list($uid) {
|
|||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
$sql_extra = permissions_sql($uid);
|
$sql_extra = permissions_sql($uid);
|
||||||
|
|
||||||
$r = q("select cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name, cr_id order by cr_name",
|
$r = q("select allow_cid, allow_gid, deny_cid, deny_gid, cr_name, cr_id, count(cp_id) as cr_inroom from chatroom left join chatpresence on cr_id = cp_room where cr_uid = %d $sql_extra group by cr_name, cr_id order by cr_name",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -92,10 +92,8 @@ EOT;
|
|||||||
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
|
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'),'photos_nav_btn');
|
||||||
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
|
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'),'cloud_nav_btn');
|
||||||
|
|
||||||
require_once('include/chat.php');
|
|
||||||
$has_chats = chatroom_list_count(local_channel());
|
|
||||||
if(! UNO)
|
if(! UNO)
|
||||||
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'] . (($has_chats) ? '' : '/new'), t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
|
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'], t('Chat'),"",t('Your chatrooms'),'chat_nav_btn');
|
||||||
|
|
||||||
|
|
||||||
require_once('include/menu.php');
|
require_once('include/menu.php');
|
||||||
|
@ -797,12 +797,15 @@ function widget_chatroom_list($arr) {
|
|||||||
|
|
||||||
require_once("include/chat.php");
|
require_once("include/chat.php");
|
||||||
$r = chatroom_list($a->profile['profile_uid']);
|
$r = chatroom_list($a->profile['profile_uid']);
|
||||||
|
|
||||||
|
if($r) {
|
||||||
return replace_macros(get_markup_template('chatroomlist.tpl'), array(
|
return replace_macros(get_markup_template('chatroomlist.tpl'), array(
|
||||||
'$header' => t('Chat Rooms'),
|
'$header' => t('Chat Rooms'),
|
||||||
'$baseurl' => z_root(),
|
'$baseurl' => z_root(),
|
||||||
'$nickname' => $a->profile['channel_address'],
|
'$nickname' => $a->profile['channel_address'],
|
||||||
'$items' => $r,
|
'$items' => $r,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function widget_bookmarkedchats($arr) {
|
function widget_bookmarkedchats($arr) {
|
||||||
|
52
mod/chat.php
52
mod/chat.php
@ -194,42 +194,38 @@ function chat_content(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(local_channel() && argc() > 2 && argv(2) === 'new') {
|
|
||||||
|
|
||||||
$acl = new Zotlabs\Access\AccessList($channel);
|
|
||||||
$channel_acl = $acl->get();
|
|
||||||
|
|
||||||
require_once('include/acl_selectors.php');
|
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('chatroom_new.tpl'),array(
|
|
||||||
'$header' => t('New Chatroom'),
|
|
||||||
'$name' => array('room_name',t('Chatroom Name'),'', ''),
|
|
||||||
'$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''),
|
|
||||||
'$permissions' => t('Permissions'),
|
|
||||||
'$acl' => populate_acl($channel_acl,false),
|
|
||||||
'$submit' => t('Submit')
|
|
||||||
));
|
|
||||||
return $o;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
|
|
||||||
$o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
|
$o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']);
|
||||||
|
|
||||||
require_once('include/widgets.php');
|
$acl = new Zotlabs\Access\AccessList($channel);
|
||||||
|
$channel_acl = $acl->get();
|
||||||
|
|
||||||
|
$lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock');
|
||||||
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
|
$chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array(
|
||||||
|
'$header' => t('New Chatroom'),
|
||||||
|
'$name' => array('room_name',t('Chatroom name'),'', ''),
|
||||||
|
'$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''),
|
||||||
|
'$permissions' => t('Permissions'),
|
||||||
|
'$acl' => populate_acl($channel_acl,false),
|
||||||
|
'$lockstate' => $lockstate,
|
||||||
|
'$submit' => t('Submit')
|
||||||
|
|
||||||
|
));
|
||||||
|
|
||||||
|
$rooms = chatroom_list($a->profile['profile_uid']);
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array(
|
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array(
|
||||||
'$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']),
|
'$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']),
|
||||||
'$baseurl' => z_root(),
|
'$baseurl' => z_root(),
|
||||||
'$nickname' => $channel['channel_address'],
|
'$nickname' => $a->profile['channel_address'],
|
||||||
'$rooms' => widget_chatroom_list(array()),
|
'$rooms' => $rooms,
|
||||||
'$newroom' => t('New Chatroom'),
|
'$norooms' => t('No chatrooms available'),
|
||||||
'$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0)
|
'$newroom' => t('Create New'),
|
||||||
|
'$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0),
|
||||||
|
'$chatroom_new' => $chatroom_new
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -14,11 +14,21 @@ function lockview_content(&$a) {
|
|||||||
if(! $item_id)
|
if(! $item_id)
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
if (!in_array($type, array('item','photo','event', 'menu_item')))
|
if (!in_array($type, array('item','photo','event', 'menu_item', 'chatroom')))
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
//we have different naming in in menu_item table
|
//we have different naming in in menu_item table and chatroom table
|
||||||
$id = (($type == 'menu_item') ? 'mitem_id' : 'id');
|
switch($type) {
|
||||||
|
case 'menu_item':
|
||||||
|
$id = 'mitem_id';
|
||||||
|
break;
|
||||||
|
case 'chatroom':
|
||||||
|
$id = 'cr_id';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$id = 'id';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1",
|
$r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1",
|
||||||
dbesc($type),
|
dbesc($type),
|
||||||
@ -30,8 +40,18 @@ function lockview_content(&$a) {
|
|||||||
|
|
||||||
$item = $r[0];
|
$item = $r[0];
|
||||||
|
|
||||||
//we have different naming in in menu_item table
|
//we have different naming in in menu_item table and chatroom table
|
||||||
$uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']);
|
switch($type) {
|
||||||
|
case 'menu_item':
|
||||||
|
$uid = $item['mitem_channel_id'];
|
||||||
|
break;
|
||||||
|
case 'chatroom':
|
||||||
|
$uid = $item['cr_uid'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$uid = $item['uid'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if($uid != local_channel()) {
|
if($uid != local_channel()) {
|
||||||
echo '<li>' . t('Remote privacy information not available.') . '</li>';
|
echo '<li>' . t('Remote privacy information not available.') . '</li>';
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
#chatroom-new {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatrooms-index {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatrooms-index th:nth-child(1),
|
||||||
|
#chatrooms-index td:nth-child(1){
|
||||||
|
padding: 7px 3px 7px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatrooms-index th:nth-child(3),
|
||||||
|
#chatrooms-index td:nth-child(3){
|
||||||
|
padding: 7px 10px 7px 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatrooms-index-tool {
|
||||||
|
padding: 7px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#chatContainer {
|
#chatContainer {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
[region=aside]
|
[region=aside]
|
||||||
[widget=profile][/widget]
|
[widget=vcard][/widget]
|
||||||
|
[widget=chatroom_list][/widget]
|
||||||
[widget=bookmarkedchats][/widget]
|
[widget=bookmarkedchats][/widget]
|
||||||
[widget=suggestedchats][/widget]
|
[widget=suggestedchats][/widget]
|
||||||
[/region]
|
[/region]
|
||||||
|
@ -1510,6 +1510,7 @@ nav .dropdown-menu {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chatroom-index-row:hover td,
|
||||||
.locs-index-row:hover td,
|
.locs-index-row:hover td,
|
||||||
[id^="cloud-index-"]:hover td,
|
[id^="cloud-index-"]:hover td,
|
||||||
.cloud-index-active {
|
.cloud-index-active {
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
<div class="generic-content-wrapper-styled">
|
<div id="chatroom-new" class="section-content-tools-wrapper">
|
||||||
<h1>{{$header}}</h1>
|
<form action="chat" method="post" >
|
||||||
|
{{include file="field_input.tpl" field=$name}}
|
||||||
<form action="chat" method="post" >
|
{{include file="field_input.tpl" field=$chat_expire}}
|
||||||
{{include file="field_input.tpl" field=$name}}
|
{{$acl}}
|
||||||
{{include file="field_input.tpl" field=$chat_expire}}
|
<div class="btn-group pull-right">
|
||||||
<button id="dbtn-acl" class="btn btn-default" data-toggle="modal" data-target="#aclModal" onclick="return false;" >{{$permissions}}</button>
|
<button id="dbtn-acl" class="btn btn-default" data-toggle="modal" data-target="#aclModal" title="{{$permissions}}" onclick="return false;" ><i id="jot-perms-icon" class="icon-{{$lockstate}}"></i></button>
|
||||||
{{$acl}}
|
<button id="dbtn-submit" class="btn btn-primary" type="submit" name="submit" value="{{$submit}}">{{$submit}}</button>
|
||||||
<div class="clear"></div>
|
</div>
|
||||||
<br />
|
<div class="clear"></div>
|
||||||
<br />
|
</form>
|
||||||
<input id="dbtn-submit" type="submit" name="submit" value="{{$submit}}" />
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<div class="widget">
|
<div class="widget">
|
||||||
<h3>{{$header}}</h3>
|
<h3>{{$header}}</h3>
|
||||||
{{if $items}}
|
{{if $items}}
|
||||||
<table class="chatroomlist">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
{{foreach $items as $item}}
|
{{foreach $items as $item}}
|
||||||
<tr><td align="left"><a href="{{$baseurl}}/chat/{{$nickname}}/{{$item.cr_id}}">{{$item.cr_name}}</a></td><td align="right">{{$item.cr_inroom}}</td></tr>
|
<li><a href="{{$baseurl}}/chat/{{$nickname}}/{{$item.cr_id}}"><span class="badge pull-right">{{$item.cr_inroom}}</span>{{$item.cr_name}}</a></li>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</table>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,12 +1,39 @@
|
|||||||
<div class="generic-content-wrapper-styled">
|
<div class="generic-content-wrapper">
|
||||||
<h2>{{$header}}</h2>
|
<div class="section-title-wrapper">
|
||||||
|
{{if $is_owner}}
|
||||||
{{if $is_owner}}
|
<button type="button" class="btn btn-success btn-xs pull-right" onclick="openClose('chatroom-new');"><i class="icon-plus-sign"></i> {{$newroom}}</button>
|
||||||
<p>
|
{{/if}}
|
||||||
<span class="btn btn-default"><a href="{{$baseurl}}/chat/{{$nickname}}/new">{{$newroom}}</a></span>
|
<h2>{{$header}}</h2>
|
||||||
</p>
|
</div>
|
||||||
{{/if}}
|
{{if $is_owner}}
|
||||||
|
{{$chatroom_new}}
|
||||||
{{$rooms}}
|
{{/if}}
|
||||||
|
{{if $rooms}}
|
||||||
|
<div class="section-content-wrapper-np">
|
||||||
|
<table id="chatrooms-index">
|
||||||
|
<tr>
|
||||||
|
<th width="98%">name</th>
|
||||||
|
<th width="1%" class="chatrooms-index-tool"></th>
|
||||||
|
<th width="1%"></th>
|
||||||
|
</tr>
|
||||||
|
{{foreach $rooms as $room}}
|
||||||
|
<tr class="chatroom-index-row">
|
||||||
|
<td><a href="{{$baseurl}}/chat/{{$nickname}}/{{$room.cr_id}}">{{$room.cr_name}}</a></td>
|
||||||
|
<td class="chatrooms-index-tool dropdown">
|
||||||
|
{{if $room.allow_cid || $room.allow_gid || $room.deny_cid || $room.deny_gid}}
|
||||||
|
<i class="icon-lock lockview dropdown-toggle" data-toggle="dropdown" onclick="lockview('chatroom',{{$room.cr_id}});"></i>
|
||||||
|
<ul id="panel-{{$room.cr_id}}" class="lockview-panel dropdown-menu"></ul>
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
<td><span class="badge">{{$room.cr_inroom}}</span></td>
|
||||||
|
</tr>
|
||||||
|
{{/foreach}}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<div class="section-content-wrapper">
|
||||||
|
{{$norooms}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user