1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Forum: Fix wrapper styling. More work on experimental 'split' function.

This commit is contained in:
Cameron
2016-05-04 09:13:46 -07:00
parent 8dbe69c291
commit 1ad918eb65
4 changed files with 60 additions and 29 deletions

View File

@@ -814,7 +814,7 @@ class e107forum
function threadAdd($threadInfo, $postInfo) function threadAdd($threadInfo, $postInfo)
{ {
$e107 = e107::getInstance();
$info = array(); $info = array();
// $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread']; // $info['_FIELD_TYPES'] = $this->fieldTypes['forum_thread'];
@@ -1059,14 +1059,15 @@ class e107forum
} }
/** /**
* Checks if post is the initial post which started the topic. * Checks if post is the initial post which started the topic.
* Retrieves list of post_id's belonging to one post_thread. When lowest value is equal to input param, return true. * Retrieves list of post_id's belonging to one post_thread. When lowest value is equal to input param, return true.
* Used to prevent deleting of the initial post (so topic shows empty does not get hidden accidently while posts remain in database) * Used to prevent deleting of the initial post (so topic shows empty does not get hidden accidently while posts remain in database)
* *
* @param int id of the post * @param $postId
* @return boolean true if post is the initial post of the topic (false, if not) * @return bool true if post is the initial post of the topic (false, if not)
* *
*/ * @internal param int $postid
*/
function threadDetermineInitialPost($postId) function threadDetermineInitialPost($postId)
{ {
$sql = e107::getDb(); $sql = e107::getDb();
@@ -1090,6 +1091,8 @@ class e107forum
return false; return false;
} }
function threadGetUserPostcount($threadId) function threadGetUserPostcount($threadId)
{ {
$threadId = (int)$threadId; $threadId = (int)$threadId;

View File

@@ -675,7 +675,7 @@ class forum_post_handler
$frm = e107::getForm(); $frm = e107::getForm();
$sql = e107::getDb();
$tp = e107::getParser(); $tp = e107::getParser();
$ns = e107::getRender(); $ns = e107::getRender();
@@ -1308,7 +1308,7 @@ class forum_post_handler
function splitThread($post) private function splitThread($post)
{ {
if(!deftrue('MODERATOR')) if(!deftrue('MODERATOR'))
{ {
@@ -1325,11 +1325,19 @@ class forum_post_handler
$threadInfo['thread_user'] = $this->data['post_user']; $threadInfo['thread_user'] = $this->data['post_user'];
print_a($this->data); // print_a($this->data);
if($ret = $this->forumObj->threadAdd($threadInfo, false)) if($ret = $this->forumObj->threadAdd($threadInfo, false))
{ {
e107::getMessage()->addSuccess("Created new thread #".$ret['threadid']);
$urlInfo = $threadInfo;
$urlInfo['thread_sef'] = $ret['threadsef'];
$urlInfo['thread_id'] = $ret['threadid'];
$urlInfo['forum_sef'] = $this->forumObj->getForumSef($threadInfo);
$newUrl = e107::url('forum','topic', $urlInfo);
e107::getMessage()->addSuccess("Created new thread <a class='alert-link' href='".$newUrl."'>#".$ret['threadid']."</a>");
$update = array( $update = array(
'post_thread' => $ret['threadid'], 'post_thread' => $ret['threadid'],
'post_forum' => $threadInfo['thread_forum_id'], 'post_forum' => $threadInfo['thread_forum_id'],
@@ -1372,6 +1380,13 @@ class forum_post_handler
} }
} }
$sc = e107::getScBatch('post', 'forum')->setScVar('forum', $this->forumObj)->setScVar('threadInfo', vartrue($this->data))->setVars($this->data);
$text = e107::getParser()->parseTemplate("<div class='row-fluid'><div>{FORUM_POST_BREADCRUMB}</div></div>",true,$sc);
$text .= e107::getMessage()->render();
e107::getRender()->tablerender(LAN_FORUM_3052, $text);
} }

View File

@@ -452,14 +452,18 @@ $i = $thread->page;
$sc = e107::getScBatch('view', 'forum'); $sc = e107::getScBatch('view', 'forum');
foreach ($postList as $postInfo)
foreach ($postList as $c => $postInfo)
{ {
if($postInfo['post_options']) if($postInfo['post_options'])
{ {
$postInfo['post_options'] = unserialize($postInfo['post_options']); $postInfo['post_options'] = unserialize($postInfo['post_options']);
} }
$loop_uid = (int)$postInfo['post_user']; $loop_uid = (int)$postInfo['post_user'];
$tnum = $i; $tnum = $i;
$i++; $i++;
//TODO: Look into fixing this, to limit to a single query per pageload //TODO: Look into fixing this, to limit to a single query per pageload
@@ -467,9 +471,24 @@ foreach ($postList as $postInfo)
$e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= " . USERID . ' LIMIT 1'; $e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= " . USERID . ' LIMIT 1';
$e_hide_hidden = LAN_FORUM_2008; $e_hide_hidden = LAN_FORUM_2008;
$e_hide_allowed = USER; $e_hide_allowed = USER;
if ($tnum > 1)
$sc->wrapper('forum_viewtopic/replies'); // default.
if($thread->page ==1 && $c == 0)
{ {
$postInfo['thread_start'] = true;
$sc->setScVar('postInfo', $postInfo);
$sc->setVars($postInfo); // compatibility
$sc->wrapper('forum_viewtopic/thread');
// $forum_shortcodes = e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo)->wrapper('forum/viewtopic');
$forthr = $tp->parseTemplate($FORUMTHREADSTYLE, true, $sc) . "\n";
}
else
{
$postInfo['thread_start'] = false; $postInfo['thread_start'] = false;
$alt = !$alt; $alt = !$alt;
@@ -486,19 +505,14 @@ foreach ($postList as $postInfo)
$_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE); $_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE);
$sc->wrapper('forum_viewtopic/replies'); $sc->wrapper('forum_viewtopic/replies');
} }
// $forum_shortcodes = e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo)->wrapper('forum/viewtopic'); // $forum_shortcodes = e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo)->wrapper('forum/viewtopic');
$forrep .= $tp->parseTemplate($_style, true, $sc) . "\n"; $forrep .= $tp->parseTemplate($_style, true, $sc) . "\n";
} }
else
{
$postInfo['thread_start'] = true;
$sc->setScVar('postInfo', $postInfo);
$sc->setVars($postInfo); // compatibility
$sc->wrapper('forum_viewtopic/thread');
// $forum_shortcodes = e107::getScBatch('view', 'forum')->setScVar('postInfo', $postInfo)->wrapper('forum/viewtopic');
$forthr = $tp->parseTemplate($FORUMTHREADSTYLE, true, vartrue($sc)) . "\n";
}
} }
unset($loop_uid); unset($loop_uid);

View File

@@ -477,7 +477,6 @@ $FORUM_VIEWTOPIC_TEMPLATE['deleted'] = "
$FORUM_VIEWTOPIC_WRAPPER['thread']['ATTACHMENTS'] = "<div class='forum-viewtopic-attachments'>{---}</div>"; $FORUM_VIEWTOPIC_WRAPPER['thread']['ATTACHMENTS'] = "<div class='forum-viewtopic-attachments'>{---}</div>";
$FORUM_VIEWTOPIC_WRAPPER['thread']['CUSTOMTITLE'] = "<span class='forum-viewtopic-customtitle'><small>{---}</small></span>"; $FORUM_VIEWTOPIC_WRAPPER['thread']['CUSTOMTITLE'] = "<span class='forum-viewtopic-customtitle'><small>{---}</small></span>";
$FORUM_VIEWTOPIC_WRAPPER['replies']['ATTACHMENTS'] = $FORUM_VIEWTOPIC_WRAPPER['thread']['ATTACHMENTS'];
$FORUM_VIEWTOPIC_WRAPPER['replies']['CUSTOMTITLE'] = $FORUM_VIEWTOPIC_WRAPPER['thread']['CUSTOMTITLE'];
//$FORUMDELETEDSTYLE = "<br />DELETED";
?>