This commit is contained in:
friendica 2014-09-20 16:22:21 -07:00
commit 44cb423f21
10 changed files with 709 additions and 613 deletions

View File

@ -189,6 +189,17 @@ function chatroom_list($uid) {
return $r;
}
function chatroom_list_count($uid) {
require_once('include/security.php');
$sql_extra = permissions_sql($uid);
$r = q("select count(*) as total from chatroom where cr_uid = %d $sql_extra",
intval($uid)
);
return $r[0]['total'];
}
/**
* create a chat message via API.
* It is the caller's responsibility to enter the room.

View File

@ -1552,8 +1552,8 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
}
require_once('include/chat.php');
$chats = chatroom_list($uid);
if (count($chats)) {
$has_chats = chatroom_list_count($uid);
if ($has_chats) {
$tabs[] = array(
'label' => t('Chatrooms'),
'url' => $a->get_baseurl() . '/chat/' . $nickname,
@ -1563,7 +1563,9 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
);
}
if($is_owner) {
require_once('include/menu.php');
$has_bookmarks = menu_list_count(local_user(),'',MENU_BOOKMARK) + menu_list_count(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
if($is_owner && $has_bookmarks) {
$tabs[] = array(
'label' => t('Bookmarks'),
'url' => $a->get_baseurl() . '/bookmarks',

View File

@ -124,7 +124,17 @@ function menu_list($channel_id, $name = '', $flags = 0) {
return $r;
}
function menu_list_count($channel_id, $name = '', $flags = 0) {
$sel_options = '';
$sel_options .= (($name) ? " and menu_name = '" . protect_sprintf(dbesc($name)) . "' " : '');
$sel_options .= (($flags) ? " and menu_flags = " . intval($flags) . " " : '');
$r = q("select count(*) as total from menu where menu_channel_id = %d $sel_options",
intval($channel_id)
);
return $r[0]['total'];
}
function menu_edit($arr) {

View File

@ -105,14 +105,19 @@ EOT;
$nav['usermenu'][] = Array('cloud/' . $channel['channel_address'],t('Files'),"",t('Your files'));
require_once('include/chat.php');
$chats = chatroom_list(local_user());
if (count($chats)) {
$has_chats = chatroom_list_count(local_user());
if($has_chats) {
$nav['usermenu'][] = Array('chat/' . $channel['channel_address'],t('Chat'),"",t('Your chatrooms'));
}
$nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'));
require_once('include/menu.php');
$has_bookmarks = menu_list_count(local_user(),'',MENU_BOOKMARK) + menu_list_count(local_user(),'',MENU_SYSTEM|MENU_BOOKMARK);
if($has_bookmarks) {
$nav['usermenu'][] = Array('bookmarks', t('Bookmarks'), "", t('Your bookmarks'));
}
if(feature_enabled($channel['channel_id'],'webpages'))
$nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'));
$nav['usermenu'][] = Array('webpages/' . $channel['channel_address'],t('Webpages'),"",t('Your webpages'));
}
else {
if(! get_account_id())

File diff suppressed because it is too large Load Diff

View File

@ -687,7 +687,9 @@ function admin_page_users(&$a){
$order = " order by account_email asc ";
if($_REQUEST['order'] === 'expires')
$order = " order by account_expires desc ";
if($_REQUEST['order'] === 'created')
$order = " order by account_created desc ";
$users =q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d ) > 0 as `blocked`, " .
"(SELECT GROUP_CONCAT( ch.channel_address SEPARATOR ' ') FROM channel as ch " .
"WHERE ch.channel_account_id = ac.account_id and not (ch.channel_pageflags & %d )) as `channels` " .

View File

@ -703,7 +703,7 @@ function photos_content(&$a) {
if(count($r)) {
$twist = 'rotright';
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
$o .= '<div id="photo-album-contents-' . $a->pager['page'] . '">';
$o .= '<div id="photo-album-contents">';
foreach($r as $rr) {
@ -758,20 +758,15 @@ function photos_content(&$a) {
echo $ajaxout;
killme();
}
echo '<div id="photo-album-contents-' . $a->pager['page'] . '">';
echo $ajaxout;
echo '</div>';
echo '<script>justifyPhotos(' . $a->pager['page'] . ');</script>';
echo '<script>justifyPhotosAjax();</script>';
killme();
}
$o .= '</div>'; // photo-album-contents
$o .= '<script>justifyPhotos(' . $a->pager['page'] . ');</script>';
$o .= '<div id="page-end"></div>';
$o .= '</div>'; // photo-album-contents
$o .= '<div id="photo-album-end"></div>';
$o .= '<script>$(document).ready(function() { loadingPage = false;});</script>';
$o .= '<script>$(document).ready(function() { loadingPage = false; justifyPhotos(); });</script>';
$o .= '<div id="page-spinner"></div>';
// $o .= paginate($a);
@ -1226,7 +1221,6 @@ function photos_content(&$a) {
if($photos) {
$o = replace_macros(get_markup_template('photosajax.tpl'),array(
'$photos' => $photos,
'$page' => $a->pager['page']
));
}
else {
@ -1243,7 +1237,6 @@ function photos_content(&$a) {
'$can_post' => $can_post,
'$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
'$photos' => $photos,
'$page' => $a->pager['page']
));
}

View File

@ -704,22 +704,26 @@ function updateConvItems(mode,data) {
}
function justifyPhotos(bParam_page) {
function justifyPhotos() {
justifiedGalleryActive = true;
$('#photo-album-contents-' + bParam_page).justifiedGallery({
lastRow : 'nojustify',
$('#photo-album-contents').justifiedGallery({
margins: 3,
sizeRangeSuffixes : {
sizeRangeSuffixes: {
'lt100': '-2',
'lt240': '-2',
'lt320': '-2',
'lt500': '-1',
'lt500': '',
'lt640': '-1',
'lt1024': '-0'
}
}).on('jg.complete', function(e){ justifiedGalleryActive = false; });
}
function justifyPhotosAjax() {
justifiedGalleryActive = true;
$('#photo-album-contents').justifiedGallery('norewind').on('jg.complete', function(e){ justifiedGalleryActive = false; });
}
function notify_popup_loader(notifyType) {
/* notifications template */

View File

@ -3,14 +3,12 @@
<a id="photo-top-upload-link" href="{{$upload.1}}">{{$upload.0}}</a>
{{/if}}
<div id="photo-album-contents-{{$page}}">
<div id="photo-album-contents">
{{foreach $photos as $photo}}
{{include file="photo_top.tpl"}}
{{/foreach}}
</div>
<script>justifyPhotos({{$page}});</script>
<div id="page-end"></div>
</div>
<div class="photos-end"></div>
<script>$(document).ready(function() { loadingPage = false;});</script>
<script>$(document).ready(function() { loadingPage = false; justifyPhotos(); });</script>
<div id="page-spinner"></div>

View File

@ -1,7 +1,4 @@
<!-- -->
<div id="photo-album-contents-{{$page}}">
{{foreach $photos as $photo}}
{{include file="photo_top.tpl"}}
{{/foreach}}
</div>
<script>justifyPhotos({{$page}});</script>
<script>justifyPhotosAjax()</script>