cards: make page load after comment post

This commit is contained in:
zotlabs 2017-08-23 22:06:42 -07:00
parent 4450170790
commit e157e3bec8
4 changed files with 55 additions and 38 deletions

View File

@ -29,6 +29,7 @@ class ThreadItem {
private $visiting = false; private $visiting = false;
private $channel = null; private $channel = null;
private $display_mode = 'normal'; private $display_mode = 'normal';
private $reload = '';
public function __construct($data) { public function __construct($data) {
@ -483,6 +484,14 @@ class ThreadItem {
return $this->threaded; return $this->threaded;
} }
public function set_reload($val) {
$this->reload = $val;
}
public function get_reload() {
return $this->reload;
}
public function set_commentable($val) { public function set_commentable($val) {
$this->commentable = $val; $this->commentable = $val;
foreach($this->get_children() as $child) foreach($this->get_children() as $child)
@ -719,7 +728,7 @@ class ThreadItem {
$comment_box = replace_macros($template,array( $comment_box = replace_macros($template,array(
'$return_path' => '', '$return_path' => '',
'$threaded' => $this->is_threaded(), '$threaded' => $this->is_threaded(),
'$jsreload' => '', //(($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''), '$jsreload' => $conv->reload,
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'), '$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(), '$id' => $this->get_id(),
'$parent' => $this->get_id(), '$parent' => $this->get_id(),

View File

@ -22,6 +22,7 @@ class ThreadStream {
private $profile_owner = 0; private $profile_owner = 0;
private $preview = false; private $preview = false;
private $prepared_item = ''; private $prepared_item = '';
public $reload = '';
private $cipher = 'aes256'; private $cipher = 'aes256';
// $prepared_item is for use by alternate conversation structures such as photos // $prepared_item is for use by alternate conversation structures such as photos
@ -57,6 +58,11 @@ class ThreadStream {
$this->profile_owner = \App::$profile['profile_uid']; $this->profile_owner = \App::$profile['profile_uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments'); $this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
break; break;
case 'cards':
$this->profile_owner = \App::$profile['profile_uid'];
$this->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
$this->reload = $_SESSION['return_url'];
break;
case 'display': case 'display':
// in this mode we set profile_owner after initialisation (from conversation()) and then // in this mode we set profile_owner after initialisation (from conversation()) and then
// pull some trickery which allows us to re-invoke this function afterward // pull some trickery which allows us to re-invoke this function afterward

View File

@ -69,10 +69,6 @@ class Cards extends \Zotlabs\Web\Controller {
return; return;
} }
$mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype'));
$layout = (($_REQUEST['layout']) ? $_REQUEST['layout'] : get_pconfig($owner,'system','page_layout'));
$is_owner = ($uid && $uid == $owner); $is_owner = ($uid && $uid == $owner);
$channel = channelx_by_n($owner); $channel = channelx_by_n($owner);
@ -93,36 +89,40 @@ class Cards extends \Zotlabs\Web\Controller {
if(perm_is_allowed($owner,$ob_hash,'write_pages')) { if(perm_is_allowed($owner,$ob_hash,'write_pages')) {
$x = array( $x = [
'webpage' => ITEM_TYPE_CARD, 'webpage' => ITEM_TYPE_CARD,
'is_owner' => true, 'is_owner' => true,
'nickname' => $channel['channel_address'], 'nickname' => $channel['channel_address'],
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
'acl' => (($is_owner) ? populate_acl($channel_acl,false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => (($is_owner) ? populate_acl($channel_acl, false,
\Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''),
'permissions' => $channel_acl, 'permissions' => $channel_acl,
'showacl' => (($is_owner) ? true : false), 'showacl' => (($is_owner) ? true : false),
'visitor' => true, 'visitor' => true,
'hide_location' => false, 'hide_location' => false,
'hide_voting' => false, 'hide_voting' => false,
'profile_uid' => intval($owner), 'profile_uid' => intval($owner),
'mimetype' => $mimetype, 'mimetype' => 'text/bbcode',
'mimeselect' => false, 'mimeselect' => false,
'layoutselect' => false, 'layoutselect' => false,
'expanded' => false, 'expanded' => false,
'novoting'=> false, 'novoting' => false,
'catsenabled' => feature_enabled($owner,'categories'), 'catsenabled' => feature_enabled($owner,'categories'),
'bbco_autocomplete' => 'bbcode', 'bbco_autocomplete' => 'bbcode',
'bbcode' => true 'bbcode' => true
); ];
}
else {
$x = '';
}
if($_REQUEST['title']) if($_REQUEST['title'])
$x['title'] = $_REQUEST['title']; $x['title'] = $_REQUEST['title'];
if($_REQUEST['body']) if($_REQUEST['body'])
$x['body'] = $_REQUEST['body']; $x['body'] = $_REQUEST['body'];
$editor = status_editor($a,$x);
}
else {
$editor = '';
}
$sql_extra = item_permissions_sql($owner); $sql_extra = item_permissions_sql($owner);
@ -147,10 +147,6 @@ class Cards extends \Zotlabs\Web\Controller {
and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0
and item.item_blocked = 0 "; and item.item_blocked = 0 ";
if($x)
$editor = status_editor($a,$x);
if($r) { if($r) {
$parents_str = ids_to_querystr($r,'id'); $parents_str = ids_to_querystr($r,'id');

View File

@ -464,6 +464,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$profile_owner = 0; $profile_owner = 0;
$page_writeable = false; $page_writeable = false;
$live_update_div = ''; $live_update_div = '';
$jsreload = '';
$preview = (($page_mode === 'preview') ? true : false); $preview = (($page_mode === 'preview') ? true : false);
$previewing = (($preview) ? ' preview ' : ''); $previewing = (($preview) ? ' preview ' : '');
@ -523,6 +524,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$live_update_div = '<div id="live-cards"></div>' . "\r\n" $live_update_div = '<div id="live-cards"></div>' . "\r\n"
. "<script> var profile_uid = " . App::$profile['profile_uid'] . "<script> var profile_uid = " . App::$profile['profile_uid']
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n"; . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
$jsreload = $_SESSION['return_url'];
} }
@ -817,6 +819,10 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$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') {
$item_object->set_reload($jsreload);
}
} }
} }