aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-08-23 22:06:42 -0700
committerzotlabs <mike@macgirvin.com>2017-08-23 22:06:42 -0700
commite157e3bec8722c04ed8dc2d215cd2efd0ce3ce79 (patch)
tree0fbe85a21d2a665c510a96d696fc551f46990fe0
parent4450170790de3999dc9c6f8876074e76edee8241 (diff)
downloadvolse-hubzilla-e157e3bec8722c04ed8dc2d215cd2efd0ce3ce79.tar.gz
volse-hubzilla-e157e3bec8722c04ed8dc2d215cd2efd0ce3ce79.tar.bz2
volse-hubzilla-e157e3bec8722c04ed8dc2d215cd2efd0ce3ce79.zip
cards: make page load after comment post
-rw-r--r--Zotlabs/Lib/ThreadItem.php11
-rw-r--r--Zotlabs/Lib/ThreadStream.php6
-rw-r--r--Zotlabs/Module/Cards.php70
-rw-r--r--include/conversation.php6
4 files changed, 55 insertions, 38 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 526169e1b..313001cc7 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -29,6 +29,7 @@ class ThreadItem {
private $visiting = false;
private $channel = null;
private $display_mode = 'normal';
+ private $reload = '';
public function __construct($data) {
@@ -483,6 +484,14 @@ class ThreadItem {
return $this->threaded;
}
+ public function set_reload($val) {
+ $this->reload = $val;
+ }
+
+ public function get_reload() {
+ return $this->reload;
+ }
+
public function set_commentable($val) {
$this->commentable = $val;
foreach($this->get_children() as $child)
@@ -719,7 +728,7 @@ class ThreadItem {
$comment_box = replace_macros($template,array(
'$return_path' => '',
'$threaded' => $this->is_threaded(),
- '$jsreload' => '', //(($conv->get_mode() === 'display') ? $_SESSION['return_url'] : ''),
+ '$jsreload' => $conv->reload,
'$type' => (($conv->get_mode() === 'channel') ? 'wall-comment' : 'net-comment'),
'$id' => $this->get_id(),
'$parent' => $this->get_id(),
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index 0465b20ef..d7a898704 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -22,6 +22,7 @@ class ThreadStream {
private $profile_owner = 0;
private $preview = false;
private $prepared_item = '';
+ public $reload = '';
private $cipher = 'aes256';
// $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->writable = perm_is_allowed($this->profile_owner,$ob_hash,'post_comments');
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':
// 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
diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php
index 19932769f..9114e3b89 100644
--- a/Zotlabs/Module/Cards.php
+++ b/Zotlabs/Module/Cards.php
@@ -58,8 +58,8 @@ class Cards extends \Zotlabs\Web\Controller {
$_SESSION['return_url'] = \App::$query_string;
- $uid = local_channel();
- $owner = \App::$profile_uid;
+ $uid = local_channel();
+ $owner = \App::$profile_uid;
$observer = \App::get_observer();
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
@@ -68,11 +68,7 @@ class Cards extends \Zotlabs\Web\Controller {
notice( t('Permission denied.') . EOL);
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);
$channel = channelx_by_n($owner);
@@ -93,38 +89,42 @@ class Cards extends \Zotlabs\Web\Controller {
if(perm_is_allowed($owner,$ob_hash,'write_pages')) {
- $x = array(
- 'webpage' => ITEM_TYPE_CARD,
- 'is_owner' => true,
- 'nickname' => $channel['channel_address'],
- 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $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,
- 'showacl' => (($is_owner) ? true : false),
- 'visitor' => true,
- 'hide_location' => false,
- 'hide_voting' => false,
- 'profile_uid' => intval($owner),
- 'mimetype' => $mimetype,
- 'mimeselect' => false,
- 'layoutselect' => false,
- 'expanded' => false,
- 'novoting'=> false,
- 'catsenabled' => feature_enabled($owner,'categories'),
+ $x = [
+ 'webpage' => ITEM_TYPE_CARD,
+ 'is_owner' => true,
+ 'nickname' => $channel['channel_address'],
+ 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
+ || $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,
+ 'showacl' => (($is_owner) ? true : false),
+ 'visitor' => true,
+ 'hide_location' => false,
+ 'hide_voting' => false,
+ 'profile_uid' => intval($owner),
+ 'mimetype' => 'text/bbcode',
+ 'mimeselect' => false,
+ 'layoutselect' => false,
+ 'expanded' => false,
+ 'novoting' => false,
+ 'catsenabled' => feature_enabled($owner,'categories'),
'bbco_autocomplete' => 'bbcode',
- 'bbcode' => true
- );
+ 'bbcode' => true
+ ];
+
+ if($_REQUEST['title'])
+ $x['title'] = $_REQUEST['title'];
+ if($_REQUEST['body'])
+ $x['body'] = $_REQUEST['body'];
+ $editor = status_editor($a,$x);
+
}
else {
- $x = '';
+ $editor = '';
}
- if($_REQUEST['title'])
- $x['title'] = $_REQUEST['title'];
- if($_REQUEST['body'])
- $x['body'] = $_REQUEST['body'];
-
$sql_extra = item_permissions_sql($owner);
if($selected_card) {
@@ -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_blocked = 0 ";
-
- if($x)
- $editor = status_editor($a,$x);
-
if($r) {
$parents_str = ids_to_querystr($r,'id');
diff --git a/include/conversation.php b/include/conversation.php
index 0d2dd2224..2d5ccb5b1 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -464,6 +464,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$profile_owner = 0;
$page_writeable = false;
$live_update_div = '';
+ $jsreload = '';
$preview = (($page_mode === 'preview') ? true : false);
$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"
. "<script> var profile_uid = " . App::$profile['profile_uid']
. "; 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_display_mode('list');
}
+ if($page_mode === 'cards') {
+ $item_object->set_reload($jsreload);
+ }
+
}
}