From 9a52b90f227e8ff774110cc2f5cd536714d9802d Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 22 Mar 2018 15:38:00 -0700 Subject: hubzilla issue #1013 - comments not displayed in single card/article view --- Zotlabs/Module/Cards.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Cards.php') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index f87988183..1bcd88a33 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -132,19 +132,20 @@ class Cards extends \Zotlabs\Web\Controller { $sql_extra = item_permissions_sql($owner); + $sql_item = ''; if($selected_card) { $r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'CARD' and iconfig.v = '%s' limit 1", dbesc($selected_card) ); if($r) { - $sql_extra .= "and item.id = " . intval($r[0]['iid']) . " "; + $sql_item = "and item.id = " . intval($r[0]['iid']) . " "; } } $r = q("select * from item where uid = %d and item_type = %d - $sql_extra order by item.created desc", + $sql_extra $sql_item order by item.created desc", intval($owner), intval(ITEM_TYPE_CARD) ); -- cgit v1.2.3 From 4ba91cf4e3da5637a8c2a4a65f84c3178ce0d343 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 22 Mar 2018 16:34:27 -0700 Subject: make alt_pager work for articles/cards --- Zotlabs/Module/Cards.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Cards.php') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 1bcd88a33..d507f1a9f 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -131,6 +131,11 @@ class Cards extends \Zotlabs\Web\Controller { } + $itemspage = get_pconfig(local_channel(),'system','itemspage'); + \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start'])); + + $sql_extra = item_permissions_sql($owner); $sql_item = ''; @@ -145,7 +150,7 @@ class Cards extends \Zotlabs\Web\Controller { $r = q("select * from item where uid = %d and item_type = %d - $sql_extra $sql_item order by item.created desc", + $sql_extra $sql_item order by item.created desc $pager_sql", intval($owner), intval(ITEM_TYPE_CARD) ); @@ -157,6 +162,8 @@ class Cards extends \Zotlabs\Web\Controller { $items_result = []; if($r) { + $pager_total = count($r); + $parents_str = ids_to_querystr($r, 'id'); $items = q("SELECT item.*, item.id AS item_id @@ -176,13 +183,18 @@ class Cards extends \Zotlabs\Web\Controller { $mode = 'cards'; - $content = conversation($items_result, $mode, false, 'traditional'); + if(get_pconfig(local_channel(),'system','articles_list_mode')) + $page_mode = 'list'; + else + $page_mode = 'traditional'; + + $content = conversation($items_result, $mode, false, $page_mode); $o = replace_macros(get_markup_template('cards.tpl'), [ '$title' => t('Cards'), '$editor' => $editor, '$content' => $content, - '$pager' => alt_pager($a, count($items_result)) + '$pager' => alt_pager($a, $pager_total)) ]); return $o; -- cgit v1.2.3 From 05e11844e5a0f90b7f45f27047b2926442484108 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 22 Mar 2018 17:17:00 -0700 Subject: make list mode work in cards and articles --- Zotlabs/Module/Cards.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Cards.php') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index d507f1a9f..d3b16e82e 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -183,8 +183,8 @@ class Cards extends \Zotlabs\Web\Controller { $mode = 'cards'; - if(get_pconfig(local_channel(),'system','articles_list_mode')) - $page_mode = 'list'; + if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card)) + $page_mode = 'pager_list'; else $page_mode = 'traditional'; @@ -194,7 +194,7 @@ class Cards extends \Zotlabs\Web\Controller { '$title' => t('Cards'), '$editor' => $editor, '$content' => $content, - '$pager' => alt_pager($a, $pager_total)) + '$pager' => alt_pager($a, $pager_total) ]); return $o; -- cgit v1.2.3