From 8ef84e2aa74bdc280b6a450a553d71ba492a01cc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 13 Jan 2017 11:22:50 +0100 Subject: possibly improve the album list query and save the result in App::$data --- Zotlabs/Module/Photos.php | 15 ++++++--------- include/photos.php | 15 +++++++++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index c0fce1007..ef1eee399 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -691,20 +691,17 @@ class Photos extends \Zotlabs\Web\Controller { } $album = (($datum) ? hex2bin($datum) : ''); - - + \App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; - - $r = q("SELECT resource_id, max(imgscale) AS imgscale FROM photo WHERE uid = %d AND album = '%s' - AND imgscale <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY resource_id", + + //check if the album exists and if we have perms + $r = q("SELECT album FROM photo WHERE uid = %d AND album = '%s' and is_nsfw = %d $sql_extra LIMIT 1", intval($owner_uid), dbesc($album), - intval(PHOTO_NORMAL), - intval(PHOTO_PROFILE), intval($unsafe) ); - if(count($r)) { - \App::set_pager_total(count($r)); + + if($r) { \App::set_pager_itemspage(60); } else { goaway(z_root() . '/photos/' . \App::$data['channel']['channel_address']); diff --git a/include/photos.php b/include/photos.php index 8496c2c86..7ddbe43b9 100644 --- a/include/photos.php +++ b/include/photos.php @@ -464,10 +464,15 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction $sort_key = dbesc($sort_key); $direction = dbesc($direction); - $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction", - intval($channel_id), - intval(PHOTO_NORMAL), - intval(PHOTO_PROFILE) + //$albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction", + // intval($channel_id), + // intval(PHOTO_NORMAL), + // intval(PHOTO_PROFILE) + //); + + // this query provides the same results but might perform better + $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and os_storage = 1 $sql_extra group by album order by $sort_key $direction", + intval($channel_id) ); // add various encodings to the array so we can just loop through and pick them out in a template @@ -490,6 +495,8 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction } } + App::$data['albums'] = $ret; + return $ret; } -- cgit v1.2.3 From 2ace4c57d0a1b5d0030139c28d7d72e071d8b4d8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 13 Jan 2017 11:24:34 +0100 Subject: prevent double scrollbar when we have a modal larger than the viewport --- view/theme/redbasic/css/style.css | 1 - view/theme/redbasic/js/redbasic.js | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index c6f075479..2c1276430 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -9,7 +9,6 @@ /* generals */ html { font-size: 100%; - overflow-x: hidden; } body { diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 3ff0c43ae..6bcdd131f 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -99,11 +99,13 @@ function makeFullScreen(full) { function toggleAside() { $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left'); if($('main').hasClass('region_1-on')){ + $('html').css('overflow-x', ''); $('main').removeClass('region_1-on') $('#overlay').remove(); $('#left_aside_wrapper').trigger("sticky_kit:detach"); } else { + $('html').css('overflow-x', 'hidden'); $('main').addClass('region_1-on') $('
').appendTo('section'); $('#left_aside_wrapper').stick_in_parent({ -- cgit v1.2.3 From c8678ba5a9e1b5c176de85c94570890baec26b13 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 13 Jan 2017 12:53:45 +0100 Subject: evert "prevent double scrollbar when we have a modal larger than the viewport" This reverts commit 2ace4c57d0a1b5d0030139c28d7d72e071d8b4d8. --- view/theme/redbasic/css/style.css | 1 + view/theme/redbasic/js/redbasic.js | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 2c1276430..c6f075479 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -9,6 +9,7 @@ /* generals */ html { font-size: 100%; + overflow-x: hidden; } body { diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 6bcdd131f..3ff0c43ae 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -99,13 +99,11 @@ function makeFullScreen(full) { function toggleAside() { $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left'); if($('main').hasClass('region_1-on')){ - $('html').css('overflow-x', ''); $('main').removeClass('region_1-on') $('#overlay').remove(); $('#left_aside_wrapper').trigger("sticky_kit:detach"); } else { - $('html').css('overflow-x', 'hidden'); $('main').addClass('region_1-on') $('
').appendTo('section'); $('#left_aside_wrapper').stick_in_parent({ -- cgit v1.2.3 From 8ea0b2051a2f037ee67571c01b816b3a286fb5ee Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 13 Jan 2017 13:04:30 +0100 Subject: another try on preventing double scrollbars when a modal is larger than the viewport --- view/theme/redbasic/css/style.css | 2 -- view/theme/redbasic/js/redbasic.js | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index c6f075479..401f052d0 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -9,7 +9,6 @@ /* generals */ html { font-size: 100%; - overflow-x: hidden; } body { @@ -21,7 +20,6 @@ body { background-size: cover; color: $font_colour; margin: 0px; - overflow-x: hidden; } aside { diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index 3ff0c43ae..5410999b4 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -99,11 +99,13 @@ function makeFullScreen(full) { function toggleAside() { $('#expand-aside-icon').toggleClass('fa-arrow-circle-right').toggleClass('fa-arrow-circle-left'); if($('main').hasClass('region_1-on')){ + $('html, body').css('overflow-x', ''); $('main').removeClass('region_1-on') $('#overlay').remove(); $('#left_aside_wrapper').trigger("sticky_kit:detach"); } else { + $('html, body').css('overflow-x', 'hidden'); $('main').addClass('region_1-on') $('
').appendTo('section'); $('#left_aside_wrapper').stick_in_parent({ -- cgit v1.2.3