aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-03-23 10:03:54 +0100
committerMario Vavti <mario@mariovavti.com>2018-03-23 10:03:54 +0100
commit376091010f0c4613c76e30d81285c5c5f54f56d5 (patch)
tree6a61747e2ba53c507488d87e33bda6eba7ab84ef /Zotlabs/Module
parentac967db4e87761c1be98d6f548ecedd55d942fea (diff)
parentaf8cbf000fb1433b7c7d2c6c4543980f01ba69a9 (diff)
downloadvolse-hubzilla-376091010f0c4613c76e30d81285c5c5f54f56d5.tar.gz
volse-hubzilla-376091010f0c4613c76e30d81285c5c5f54f56d5.tar.bz2
volse-hubzilla-376091010f0c4613c76e30d81285c5c5f54f56d5.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Articles.php20
-rw-r--r--Zotlabs/Module/Cards.php21
-rw-r--r--Zotlabs/Module/Display.php34
3 files changed, 67 insertions, 8 deletions
diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php
index e2e0fed5d..62ce1cb9c 100644
--- a/Zotlabs/Module/Articles.php
+++ b/Zotlabs/Module/Articles.php
@@ -127,21 +127,26 @@ class Articles extends \Zotlabs\Web\Controller {
$editor = '';
}
+ $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 = '';
if($selected_card) {
$r = q("select * from iconfig where iconfig.cat = 'system' and iconfig.k = 'ARTICLE' 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 item.uid = %d and item_type = %d
- $sql_extra order by item.created desc",
+ $sql_extra $sql_item order by item.created desc $pager_sql",
intval($owner),
intval(ITEM_TYPE_ARTICLE)
);
@@ -152,6 +157,8 @@ class Articles extends \Zotlabs\Web\Controller {
if($r) {
+ $pager_total = count($r);
+
$parents_str = ids_to_querystr($r,'id');
$items = q("SELECT item.*, item.id AS item_id
@@ -173,13 +180,18 @@ class Articles extends \Zotlabs\Web\Controller {
$mode = 'articles';
- $content = conversation($items,$mode,false,'traditional');
+ if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
+ $page_mode = 'pager_list';
+ else
+ $page_mode = 'traditional';
+
+ $content = conversation($items,$mode,false,$page_mode);
$o = replace_macros(get_markup_template('cards.tpl'), [
'$title' => t('Articles'),
'$editor' => $editor,
'$content' => $content,
- '$pager' => alt_pager($a,count($items))
+ '$pager' => alt_pager($a,$pager_total)
]);
return $o;
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index f87988183..d3b16e82e 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -131,20 +131,26 @@ 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 = '';
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 $pager_sql",
intval($owner),
intval(ITEM_TYPE_CARD)
);
@@ -156,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
@@ -175,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') && (! $selected_card))
+ $page_mode = 'pager_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;
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 8e8a1ed24..fa29ce66c 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -134,6 +134,40 @@ class Display extends \Zotlabs\Web\Controller {
return '';
}
}
+ if($target_item['item_type'] == ITEM_TYPE_ARTICLE) {
+ $x = q("select * from channel where channel_id = %d limit 1",
+ intval($target_item['uid'])
+ );
+ $y = q("select * from iconfig left join item on iconfig.iid = item.id
+ where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and item.id = %d limit 1",
+ intval($target_item['uid']),
+ intval($target_item['id'])
+ );
+ if($x && $y) {
+ goaway(z_root() . '/articles/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
+ }
+ else {
+ notice( t('Page not found.') . EOL);
+ return '';
+ }
+ }
+ if($target_item['item_type'] == ITEM_TYPE_CARD) {
+ $x = q("select * from channel where channel_id = %d limit 1",
+ intval($target_item['uid'])
+ );
+ $y = q("select * from iconfig left join item on iconfig.iid = item.id
+ where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'CARD' and item.id = %d limit 1",
+ intval($target_item['uid']),
+ intval($target_item['id'])
+ );
+ if($x && $y) {
+ goaway(z_root() . '/cards/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
+ }
+ else {
+ notice( t('Page not found.') . EOL);
+ return '';
+ }
+ }
$static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);