make list mode work in cards and articles

This commit is contained in:
zotlabs 2018-03-22 17:17:00 -07:00
parent 4ba91cf4e3
commit 05e11844e5
4 changed files with 42 additions and 8 deletions

View File

@ -180,8 +180,8 @@ class Articles extends \Zotlabs\Web\Controller {
$mode = 'articles'; $mode = 'articles';
if(get_pconfig(local_channel(),'system','articles_list_mode')) if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
$page_mode = 'list'; $page_mode = 'pager_list';
else else
$page_mode = 'traditional'; $page_mode = 'traditional';

View File

@ -183,8 +183,8 @@ class Cards extends \Zotlabs\Web\Controller {
$mode = 'cards'; $mode = 'cards';
if(get_pconfig(local_channel(),'system','articles_list_mode')) if(get_pconfig(local_channel(),'system','articles_list_mode') && (! $selected_card))
$page_mode = 'list'; $page_mode = 'pager_list';
else else
$page_mode = 'traditional'; $page_mode = 'traditional';
@ -194,7 +194,7 @@ class Cards extends \Zotlabs\Web\Controller {
'$title' => t('Cards'), '$title' => t('Cards'),
'$editor' => $editor, '$editor' => $editor,
'$content' => $content, '$content' => $content,
'$pager' => alt_pager($a, $pager_total)) '$pager' => alt_pager($a, $pager_total)
]); ]);
return $o; return $o;

View File

@ -134,6 +134,40 @@ class Display extends \Zotlabs\Web\Controller {
return ''; 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); $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0);

View File

@ -838,11 +838,11 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$item_object = new Zotlabs\Lib\ThreadItem($item); $item_object = new Zotlabs\Lib\ThreadItem($item);
$conv->add_thread($item_object); $conv->add_thread($item_object);
if($page_mode === 'list') { if(($page_mode === 'list') || ($page_mode === 'pager_list')) {
$item_object->set_template('conv_list.tpl'); $item_object->set_template('conv_list.tpl');
$item_object->set_display_mode('list'); $item_object->set_display_mode('list');
} }
if($page_mode === 'cards') { if($mode === 'cards' || $mode === 'articles') {
$item_object->set_reload($jsreload); $item_object->set_reload($jsreload);
} }
@ -857,7 +857,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
} }
} }
if($page_mode === 'traditional' || $page_mode === 'preview') { if(in_array($page_mode, [ 'traditional', 'preview', 'pager_list'] )) {
$page_template = get_markup_template("threaded_conversation.tpl"); $page_template = get_markup_template("threaded_conversation.tpl");
} }
elseif($update) { elseif($update) {