aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-11-03 14:49:03 -0800
committerfriendica <info@friendica.com>2014-11-03 14:49:03 -0800
commita6d8c3193a6fc243f3e516118c793e5b871b8247 (patch)
tree1425c809b156a47498f4caaeac683c3b3177079e /include
parentac858f4bd4fcb9c65cbc7b19288cdad0076aa072 (diff)
downloadvolse-hubzilla-a6d8c3193a6fc243f3e516118c793e5b871b8247.tar.gz
volse-hubzilla-a6d8c3193a6fc243f3e516118c793e5b871b8247.tar.bz2
volse-hubzilla-a6d8c3193a6fc243f3e516118c793e5b871b8247.zip
various UI issues related to having an enormous number of entries in the posted_date selector including years/months that had no posts
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php7
-rw-r--r--include/widgets.php17
2 files changed, 20 insertions, 4 deletions
diff --git a/include/items.php b/include/items.php
index d173e1a98..325947341 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4128,10 +4128,13 @@ function first_post_date($uid,$wall = false) {
* current flat list of all representative dates.
*/
-function list_post_dates($uid,$wall) {
+function list_post_dates($uid,$wall,$mindate) {
$dnow = datetime_convert('',date_default_timezone_get(),'now','Y-m-d');
- $dthen = first_post_date($uid,$wall);
+ if($mindate)
+ $dthen = datetime_convert('',date_default_timezone_get(),$mindate);
+ else
+ $dthen = first_post_date($uid,$wall);
if(! $dthen)
return array();
diff --git a/include/widgets.php b/include/widgets.php
index 2e406aa77..703bc07a8 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -330,19 +330,32 @@ function widget_archive($arr) {
$wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0);
$style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select');
+ $showend = ((get_pconfig($uid,'system','archive_show_end_date')) ? true : false);
+ $mindate = get_pconfig($uid,'system','archive_mindate');
+ $visible_years = get_pconfig($uid,'system','archive_visible_years');
+ if(! $visible_years)
+ $visible_years = 5;
+
+
$url = z_root() . '/' . $a->cmd;
- $ret = list_post_dates($uid,$wall);
+ $ret = list_post_dates($uid,$wall,$mindate);
if(! count($ret))
return '';
+ $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
+ $cutoff = ((array_key_exists($cutoff_year,$ret))? true : false);
+
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
'$title' => t('Archives'),
- '$size' => ((count($ret) > 6) ? 6 : count($ret)),
+ '$size' => $visible_years,
+ '$cutoff_year' => $cutoff_year,
+ '$cutoff' => $cutoff,
'$url' => $url,
'$style' => $style,
+ '$showend' => $showend,
'$dates' => $ret
));
return $o;