1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Forum template work.

This commit is contained in:
Cameron
2013-03-12 04:22:09 -07:00
parent 652cda0b3b
commit 5cb899f8af
13 changed files with 617 additions and 22 deletions

View File

@@ -1,3 +1,5 @@
//<?php
global $$parm; global $$parm;
$bc = $$parm; $bc = $$parm;
$flist = explode(",", $bc['fieldlist']); $flist = explode(",", $bc['fieldlist']);
@@ -7,6 +9,9 @@ foreach($flist as $f)
if($bc[$f]['value']) if($bc[$f]['value'])
{ {
$ret .= $bc[$f]['value']; $ret .= $bc[$f]['value'];
$opt[] = $bc[$f]['value'];
if($bc[$f]['sep']) if($bc[$f]['sep'])
{ {
$ret .= $bc[$f]['sep']; $ret .= $bc[$f]['sep'];
@@ -14,4 +19,16 @@ foreach($flist as $f)
} }
} }
if($bc['style']=='bootstrap')
{
return '<ul class="breadcrumb">
<li><a href="#">Home</a> <span class="divider">/</span></li>
<li><a href="#">Library</a> <span class="divider">/</span></li>
<li class="active">Data</li>
</ul>';
}
return $ret; return $ret;

View File

@@ -495,9 +495,11 @@ class convert
if (($i > 4) || ($result[$i] != 0)) if (($i > 4) || ($result[$i] != 0))
{ // Only show non-zero values, except always show minutes/seconds { // Only show non-zero values, except always show minutes/seconds
$outputArray[] = $result[$i]." ".($result[$i] == 1 ? $params[$i][2] : $params[$i][3]) ; $outputArray[] = $result[$i]." ".($result[$i] == 1 ? $params[$i][2] : $params[$i][3]) ;
if($format == 'short' && $i == 1) { break; }
} }
} }
return ($mode ? $outputArray : implode(", ", $outputArray)); return ($mode ? $outputArray : implode(", ", $outputArray) . " ago"); //XXX LAN
} }

View File

@@ -218,16 +218,19 @@ class e_ranks
{ {
//Main Site Admin //Main Site Admin
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][1])."' alt='".$this->_getName($this->ranks['special'][1])."' title='".$this->_getName($this->ranks['special'][1])."' />"; $data['special'] = "<img src='".$this->_getImage($this->ranks['special'][1])."' alt='".$this->_getName($this->ranks['special'][1])."' title='".$this->_getName($this->ranks['special'][1])."' />";
$data['name'] = $this->_getName($this->ranks['special'][1]);
} }
else else
{ {
//Site Admin //Site Admin
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][2])."' alt='".$this->_getName($this->ranks['special'][2])."' title='".$this->_getName($this->ranks['special'][2])."' />"; $data['special'] = "<img src='".$this->_getImage($this->ranks['special'][2])."' alt='".$this->_getName($this->ranks['special'][2])."' title='".$this->_getName($this->ranks['special'][2])."' />";
$data['name'] = $this->_getName($this->ranks['special'][2]);
} }
} }
elseif($moderator) elseif($moderator)
{ {
$data['special'] = "<img src='".$this->_getImage($this->ranks['special'][3])."' alt='".$this->_getName($this->ranks['special'][3])."' title='".$this->_getName($this->ranks['special'][3])."' />"; $data['special'] = "<img src='".$this->_getImage($this->ranks['special'][3])."' alt='".$this->_getName($this->ranks['special'][3])."' title='".$this->_getName($this->ranks['special'][3])."' />";
$data['name'] = $this->_getName($this->ranks['special'][3]);
} }
$userData['user_daysregged'] = max(1, round((time() - $userData['user_join']) / 86400)); $userData['user_daysregged'] = max(1, round((time() - $userData['user_join']) / 86400));
@@ -255,8 +258,11 @@ class e_ranks
} }
} }
if($rank !== false) if($rank !== false)
{
if(!isset($data['name']))
{ {
$data['name'] = $this->_getName($this->ranks['data'][$rank]); $data['name'] = $this->_getName($this->ranks['data'][$rank]);
}
$img_title = ($this->ranks['data'][$rank]['name'] ? " alt='{$data['name']}' title='{$data['name']}'" : ' alt = ""'); $img_title = ($this->ranks['data'][$rank]['name'] ? " alt='{$data['name']}' title='{$data['name']}'" : ' alt = ""');
$data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank])."'{$img_title} />"; $data['pic'] = "<img {$img_title} src='".$this->_getImage($this->ranks['data'][$rank])."'{$img_title} />";
} }

View File

@@ -211,6 +211,28 @@ if (!isset($FORUM_MAIN_START))
} }
} }
include(e_PLUGIN.'forum/templates/forum_template.php'); include(e_PLUGIN.'forum/templates/forum_template.php');
if(is_array($FORUM_TEMPLATE)) // new v2.x format.
{
$FORUM_MAIN_START = $FORUM_TEMPLATE['main-start'];
$FORUM_MAIN_PARENT = $FORUM_TEMPLATE['main-parent'];
$FORUM_MAIN_FORUM = $FORUM_TEMPLATE['main-forum'];
$FORUM_MAIN_END = $FORUM_TEMPLATE['main-end'];
$FORUM_NEWPOSTS_START = $FORUM_TEMPLATE['main-start']; // $FORUM_TEMPLATE['new-start'];
$FORUM_NEWPOSTS_MAIN = $FORUM_TEMPLATE['main-forum']; // $FORUM_TEMPLATE['new-main'];
$FORUM_NEWPOSTS_END = $FORUM_TEMPLATE['main-end']; // $FORUM_TEMPLATE['new-end'];
$FORUM_TRACK_START = $FORUM_TEMPLATE['main-start']; // $FORUM_TEMPLATE['track-start'];
$FORUM_TRACK_MAIN = $FORUM_TEMPLATE['main-forum']; // $FORUM_TEMPLATE['track-main'];
$FORUM_TRACK_END = $FORUM_TEMPLATE['main-end']; // $FORUM_TEMPLATE['track-end'];
}
require_once(HEADERF); require_once(HEADERF);
$forumList = $forum->forumGetForumList(); $forumList = $forum->forumGetForumList();
@@ -307,6 +329,15 @@ function parse_forum($f, $restricted_string = '')
$fVars->REPLIES = $f['forum_replies']; $fVars->REPLIES = $f['forum_replies'];
$fVars->FORUMSUBFORUMS = ''; $fVars->FORUMSUBFORUMS = '';
$badgeReplies = ($f['forum_replies']) ? "badge-info" : "";
$badgeThreads = ($f['forum_threads']) ? "badge-info" : "";
$fVars->THREADSX = "<span class='badge {$badgeThreads}'>".$f['forum_threads']."</span>";
$fVars->REPLIESX = "<span class='badge {$badgeReplies}'>".$f['forum_replies']."</span>";
if(is_array($forumList['subs'][$f['forum_id']])) if(is_array($forumList['subs'][$f['forum_id']]))
{ {
list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']); list($lastpost_datestamp, $lastpost_thread) = explode('.', $f['forum_lastpost_info']);
@@ -335,11 +366,16 @@ function parse_forum($f, $restricted_string = '')
{ {
$lastpost_name = $e107->tp->toHTML($f['forum_lastpost_user_anon']); $lastpost_name = $e107->tp->toHTML($f['forum_lastpost_user_anon']);
} }
$fVars->LASTPOSTUSER = $lastpost_name;
$fVars->LASTPOSTDATE .= $gen->computeLapse($lastpost_datestamp, time(), false, false, 'short');
$lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum'); $lastpost_datestamp = $gen->convert_date($lastpost_datestamp, 'forum');
$fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>'; $fVars->LASTPOST = $lastpost_datestamp.'<br />'.$lastpost_name." <a href='".$e107->url->create('forum/thread/last', array('name' => $lastpost_name, 'id' => $lastpost_thread))."'>".IMAGE_post2.'</a>';
} }
else else
{ {
$fVars->LASTPOSTUSER = "";
$fVars->LASTPOSTDATE = "-";
$fVars->LASTPOST = '-'; $fVars->LASTPOST = '-';
} }
return $e107->tp->simpleParse($FORUM_MAIN_FORUM, $fVars); return $e107->tp->simpleParse($FORUM_MAIN_FORUM, $fVars);

View File

@@ -1202,6 +1202,7 @@ class e107forum
$FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']); $FORUM_CRUMB['thread']['value'] = str_replace($search, $replace, $FORUM_CRUMB['thread']['value']);
$FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread'; $FORUM_CRUMB['fieldlist'] = 'sitename,forums,parent,subparent,forum,thread';
// $FORUM_CRUMB['style'] = 'bootstrap';
$BREADCRUMB = $e107->tp->parseTemplate('{BREADCRUMB=FORUM_CRUMB}', true); $BREADCRUMB = $e107->tp->parseTemplate('{BREADCRUMB=FORUM_CRUMB}', true);
} }
else else

View File

@@ -513,7 +513,7 @@ $text = $tp->parseTemplate($FORUMPOST, true);
// ------------------------------------------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------------------------------------------
if ($forum->prefs->get('forum_enclose')) if ($forum->prefs->get('enclose'))
{ {
$ns->tablerender($forum->prefs->get('title'), $text); $ns->tablerender($forum->prefs->get('title'), $text);
} }

View File

@@ -80,6 +80,27 @@ if (!vartrue($FORUM_VIEW_START))
} }
} }
if(is_array($FORUMVIEW_TEMPLATE)) // New Template.
{
$FORUM_VIEW_START_CONTAINER = $FORUMVIEW_TEMPLATE['start'];
$FORUM_VIEW_START = $FORUMVIEW_TEMPLATE['header'];
$FORUM_VIEW_FORUM = $FORUMVIEW_TEMPLATE['item'];
$FORUM_VIEW_FORUM_STICKY = $FORUMVIEW_TEMPLATE['item-sticky'];
$FORUM_VIEW_FORUM_ANNOUNCE = $FORUMVIEW_TEMPLATE['item-announce'];
$FORUM_VIEW_END = $FORUMVIEW_TEMPLATE['footer'];
$FORUM_VIEW_END_CONTAINER = $FORUMVIEW_TEMPLATE['end'];
$FORUM_VIEW_SUB_START = $FORUMVIEW_TEMPLATE['sub-header'];
$FORUM_VIEW_SUB = $FORUMVIEW_TEMPLATE['sub-item'];
$FORUM_VIEW_SUB_END = $FORUMVIEW_TEMPLATE['sub-footer'];
$FORUM_IMPORTANT_ROW = $FORUMVIEW_TEMPLATE['divider-important'];
$FORUM_NORMAL_ROW = $FORUMVIEW_TEMPLATE['divider-normal'];
}
$forumInfo['forum_name'] = $e107->tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off'); $forumInfo['forum_name'] = $e107->tp->toHTML($forumInfo['forum_name'], true, 'no_hook, emotes_off');
$forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_description'], true, 'no_hook'); $forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_description'], true, 'no_hook');
@@ -156,6 +177,7 @@ if ($pages)
if($forum->checkPerm($forumId, 'post')) if($forum->checkPerm($forumId, 'post'))
{ {
$fVars->NEWTHREADBUTTON = "<a href='".$e107->url->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>'; $fVars->NEWTHREADBUTTON = "<a href='".$e107->url->create('forum/thread/new', array('id' => $forumId))."'>".IMAGE_newthread.'</a>';
$fVars->NEWTHREADBUTTONX = newthreadjump($e107->url->create('forum/thread/new', array('id' => $forumId))); // "<a class='btn btn-primary' href='".."'>New Thread</a>";
} }
if(substr($forumInfo['forum_name'], 0, 1) == '*') if(substr($forumInfo['forum_name'], 0, 1) == '*')
@@ -209,12 +231,12 @@ $fVars->ICONKEY = "
</table>"; </table>";
$fVars->SEARCH = " $fVars->SEARCH = "
<form method='get' action='".e_BASE."search.php'> <form method='get' class='form-inline input-append' action='".e_BASE."search.php'>
<p> <p>
<input class='tbox' type='text' name='q' size='20' value='' maxlength='50' /> <input class='tbox' type='text' name='q' size='20' value='' maxlength='50' />
<button class='btn button' type='submit' name='s' >".LAN_180."</button>
<input type='hidden' name='r' value='0' /> <input type='hidden' name='r' value='0' />
<input type='hidden' name='ref' value='forum' /> <input type='hidden' name='ref' value='forum' />
<input class='btn button' type='submit' name='s' value='".LAN_180."' />
</p> </p>
</form>"; </form>";
@@ -313,10 +335,9 @@ if($container_only)
$forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars); $forum_view_start = $tp->simpleParse($FORUM_VIEW_START, $fVars);
$forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars); $forum_view_end = $tp->simpleParse($FORUM_VIEW_END, $fVars);
if ($forum->prefs->get('enclose'))
if ($forum->prefs->get('forum_enclose'))
{ {
$ns->tablerender($forum->prefs->get('forum_title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1')); $ns->tablerender($forum->prefs->get('title'), $forum_view_start.$forum_view_subs.$forum_view_forum.$forum_view_end, array('forum_viewforum', 'main1'));
} }
else else
{ {
@@ -347,6 +368,11 @@ function parse_thread($thread_info)
$tVars->VIEWS = $thread_info['thread_views']; $tVars->VIEWS = $thread_info['thread_views'];
$tVars->REPLIES = $thread_info['thread_total_replies']; $tVars->REPLIES = $thread_info['thread_total_replies'];
$badge = ($thread_info['thread_views'] > 0) ? "badge-info" : "";
$tVars->REPLIESX = "<span class='badge badge-info'>".$thread_info['thread_total_replies']."</span>";
$tVars->VIEWSX = "<span class='badge {$badge}'>".$thread_info['thread_views']."</span>";
if ($tVars->REPLIES) if ($tVars->REPLIES)
{ {
$lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum'); $lastpost_datestamp = $gen->convert_date($thread_info['thread_lastpost'], 'forum');
@@ -355,24 +381,31 @@ function parse_thread($thread_info)
// XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens // XXX hopefully & is not allowed in user name - it would break parsing of url parameters, change to array if something wrong happens
$url = $e107->url->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}"); $url = $e107->url->create('user/profile/view', "name={$thread_info['lastpost_username']}&id={$thread_info['thread_lastuser']}");
$tVars->LASTPOST = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>"; $tVars->LASTPOST = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
$tVars->LASTPOSTUSER = "<a href='{$url}'>".$thread_info['lastpost_username']."</a>";
} }
else else
{ {
if(!$thread_info['thread_lastuser']) if(!$thread_info['thread_lastuser'])
{ {
$tVars->LASTPOST = $e107->tp->toHTML($thread_info['thread_lastuser_anon']); $tVars->LASTPOST = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
$tVars->LASTPOSTUSER = $e107->tp->toHTML($thread_info['thread_lastuser_anon']);
} }
else else
{ {
$tVars->LASTPOST = FORLAN_19; $tVars->LASTPOST = FORLAN_19;
$tVars->LASTPOSTUSER = FORLAN_19;
} }
} }
$tVars->LASTPOST .= '<br />'.$lastpost_datestamp; $tVars->LASTPOST .= '<br />'.$lastpost_datestamp;
$tVars->LASTPOSTDATE .= $gen->computeLapse($thread_info['thread_lastpost'],time(), false, false, 'short');
} }
$newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed)); $newflag = (USER && $thread_info['thread_lastpost'] > USERLV && !in_array($thread_info['thread_id'], $threadsViewed));
$tVars->THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum'); $tVars->THREADDATE = $gen->convert_date($thread_info['thread_datestamp'], 'forum');
$tVars->THREADTIMELAPSE = $gen->computeLapse($thread_info['thread_datestamp'],time(), false, false, 'short'); // convert_date($thread_info['thread_datestamp'], 'forum');
$tVars->ICON = ($newflag ? IMAGE_new : IMAGE_nonew); $tVars->ICON = ($newflag ? IMAGE_new : IMAGE_nonew);
if ($tVars->REPLIES >= $forum->prefs->get('popular', 10)) if ($tVars->REPLIES >= $forum->prefs->get('popular', 10))
{ {
@@ -464,6 +497,8 @@ function parse_thread($thread_info)
$tVars->PAGES = ''; $tVars->PAGES = '';
} }
$tVars->PAGESX = fpages($thread_info, $tVars->REPLIES);
if (MODERATOR) if (MODERATOR)
{ {
// FIXME _URL_ thread name // FIXME _URL_ thread name
@@ -477,6 +512,8 @@ function parse_thread($thread_info)
<a href='".$e107->url->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a> <a href='".$e107->url->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a>
</div></form> </div></form>
'; ';
$tVars->ADMINOPTIONS = fadminoptions($thread_info);
} }
$text .= "</td> $text .= "</td>
@@ -502,7 +539,9 @@ function parse_thread($thread_info)
if (!$tVars->REPLIES) if (!$tVars->REPLIES)
{ {
$tVars->REPLIES = LAN_317; // 'None' $tVars->REPLIES = LAN_317; // 'None'
$tVars->REPLIESX = "<span class='badge'>0</span>";
$tVars->LASTPOST = ' - '; $tVars->LASTPOST = ' - ';
$tVars->LASTPOSTDATE = ' - ';
} }
switch($thread_info['thread_sticky']) switch($thread_info['thread_sticky'])
@@ -533,6 +572,16 @@ function parse_sub($subInfo)
$tVars->SUB_DESCRIPTION = $e107->tp->toHTML($subInfo['forum_description'], false, 'no_hook'); $tVars->SUB_DESCRIPTION = $e107->tp->toHTML($subInfo['forum_description'], false, 'no_hook');
$tVars->SUB_THREADS = $subInfo['forum_threads']; $tVars->SUB_THREADS = $subInfo['forum_threads'];
$tVars->SUB_REPLIES = $subInfo['forum_replies']; $tVars->SUB_REPLIES = $subInfo['forum_replies'];
$badgeReplies = ($subInfo['forum_replies']) ? "badge-info" : "";
$badgeThreads = ($subInfo['forum_replies']) ? "badge-info" : "";
$tVars->SUB_THREADSX = "<span class='badge {$badgeThreads}'>".$subInfo['forum_threads']."</span>";
$tVars->SUB_REPLIESX = "<span class='badge {$badgeReplies}'>".$subInfo['forum_replies']."</span>";
// $tVars->REPLIESX = "<span class='badge badge-info'>".$thread_info['thread_total_replies']."</span>";
// $tVars->VIEWSX = "<span class='badge {$badge}'>".$thread_info['thread_views']."</span>";
if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list)) if(USER && is_array($newflag_list) && in_array($subInfo['forum_id'], $newflag_list))
{ {
@@ -579,4 +628,131 @@ function forumjump()
return $text; return $text;
} }
function fadminoptions($thread_info)
{
$tVars = new e_vars;
$e107 = e107::getInstance();
// $text = "<form method='post' action='".e_REQUEST_URI."' id='frmMod_{$forumId}_{$threadId}' style='margin:0;'>";
$text .= '<div class="btn-group"><button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu left">
';
//FIXME - not fully working.
$moveUrl = $e107->url->create('forum/thread/move', "id=".$thread_info['thread_id']);
$text .= "<li><a href='#'>Delete</a></li>";
$text .= "<li><a href='#'>Stick/Unstick</a></li>";
$text .= "<li><a href='#'><i class='icon_lock'></i> Lock/Unlock</a></li>";
$text .= "<li><a href='{$moveUrl}'>Move</a></li>";
/*
$text .= "<li><input type='image' ".IMAGE_admin_delete." name='deleteThread_{$threadId}' value='thread_action' onclick=\"return confirm_({$threadId})\" /> Delete</li>";
$text .= "<li>".($thread_info['thread_sticky'] == 1 ? "<input type='image' ".IMAGE_admin_unstick." name='unstick_{$threadId}' value='thread_action' /> Unstick" : "<input type='image' ".IMAGE_admin_stick." name='stick_{$threadId}' value='thread_action' /> Stick")."
</li>";
$text .= "<li>".($thread_info['thread_active'] ? "<input type='image' ".IMAGE_admin_lock." name='lock_{$threadId}' value='thread_action' /> Lock" : "<input type='image' ".IMAGE_admin_unlock." name='unlock_{$threadId}' value='thread_action' /> Unlock"). "
</li>";
$text .= "<li><a href='".$e107->url->create('forum/thread/move', "id={$threadId}")."'>".IMAGE_admin_move.'</a> Move</li>';
*/
$text .= "</ul></div>";
// $text .= "</form>";
return $text;
}
function fpages($thread_info, $replies)
{
global $forum;
$pages = ceil(($replies)/$forum->prefs->get('postspage'));
$urlparms = $thread_info;
if ($pages > 1)
{
if($pages > 6)
{
for($a = 0; $a <= 2; $a++)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
}
$text .= ' ... ';
for($a = $pages-3; $a <= $pages-1; $a++)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
}
}
else
{
for($a = 0; $a <= ($pages-1); $a++)
{
$aa = $a + 1;
$text .= $text ? ' ' : '';
$urlparms['page'] = $aa;
$url = e107::getUrl()->create('forum/thread/view', $urlparms);
$opts[] = "<a class='btn btn-mini' data-toggle='tooltip' title=\"Go to Page $aa\" href='{$url}'>{$aa}</a>";
}
}
$text = implode("",$opts); // ."</div>";
}
else
{
$text = '';
}
return $text;
}
function newthreadjump($url)
{
global $forum;
$jumpList = $forum->forumGetAllowed('view');
$text = '<div class="btn-group">
<a href="'.$url.'" class="btn btn-primary">New Thread</a>
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
';
foreach($jumpList as $key => $val)
{
$text .= '<li><a href="'.$key.'">Go to: '.$val.'</a></li>';
}
$text .= '
</ul>
</div>';
return $text;
}
?> ?>

View File

@@ -154,6 +154,19 @@ if (!vartrue($FORUMSTART))
} }
} }
// New in v2.x
if(is_array($FORUMTOPIC_TEMPLATE))
{
$FORUMSTART = $FORUMTOPIC_TEMPLATE['start'];
$FORUMTHREADSTYLE = $FORUMTOPIC_TEMPLATE['thread'];
$FORUMEND = $FORUMTOPIC_TEMPLATE['end'];
$FORUMREPLYSTYLE = $FORUMTOPIC_TEMPLATE['replies'];
}
// get info for main thread ------------------------------------------------------------------------------------------------------------------------------------------------------------------- // get info for main thread -------------------------------------------------------------------------------------------------------------------------------------------------------------------
$tVars = new e_vars; $tVars = new e_vars;
$forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK) $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
@@ -161,9 +174,9 @@ $forum->set_crumb(true, '', $tVars); // Set $BREADCRUMB (and BACKLINK)
//$tVars->BACKLINK = $tVars->BREADCRUMB; //$tVars->BACKLINK = $tVars->BREADCRUMB;
//$tVars->FORUM_CRUMB = $crumbs['forum_crumb']; //$tVars->FORUM_CRUMB = $crumbs['forum_crumb'];
$tVars->THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off'); $tVars->THREADNAME = $e107->tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off');
$tVars->NEXTPREV = "&lt;&lt; <a href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_389 . "</a>"; $tVars->NEXTPREV = "<a class='btn btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>&laquo; " . LAN_389 . "</a>";
$tVars->NEXTPREV .= ' | '; // $tVars->NEXTPREV .= ' | ';
$tVars->NEXTPREV .= "<a href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_390 . "</a> &gt;&gt;"; $tVars->NEXTPREV .= "<a class='btn btn-small' href='" . $e107->url->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>" . LAN_390 . " &raquo;</a>";
if ($forum->prefs->get('track') && USER) if ($forum->prefs->get('track') && USER)
{ {
@@ -171,7 +184,7 @@ if ($forum->prefs->get('track') && USER)
$url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call $url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call
$tVars->TRACK .= " $tVars->TRACK .= "
<span id='forum-track-trigger-container'> <span id='forum-track-trigger-container'>
<a href='{$url}' id='forum-track-trigger'>{$img}</a> <a class='btn btn-small' href='{$url}' id='forum-track-trigger'>{$img}</a>
</span> </span>
<script type='text/javascript'> <script type='text/javascript'>
e107.runOnLoad(function(){ e107.runOnLoad(function(){
@@ -190,6 +203,7 @@ if ($forum->prefs->get('track') && USER)
"; ";
} }
$tVars->MODERATORS = LAN_321 . implode(', ', $forum->modArray); $tVars->MODERATORS = LAN_321 . implode(', ', $forum->modArray);
$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : ''); $tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_66 : '');
@@ -215,12 +229,70 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
$tVars->BUTTONS .= "<a href='" . $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . "</a>"; $tVars->BUTTONS .= "<a href='" . $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])) . "'>" . IMAGE_newthread . "</a>";
} }
$tVars->BUTTONSX = forumbuttons($thread);
function forumbuttons($thread)
{
global $forum;
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread->threadInfo['thread_active'])
{
$replyUrl = "<a class='btn btn-primary' href='" . e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId)) . "'>Post a Reply</a>";
}
if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'thread'))
{
$options[] = " <a href='" . e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])) . "'>Create New Thread</a>";
}
$options[] = "<a href='" . e107::getUrl()->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>Go to " . LAN_389 . "</a>"; //FIXME LAN
$options[] = "<a href='" . e107::getUrl()->create('forum/thread/prev', array('id' => $thread->threadId)) . "'>Go to " . LAN_390 . "</a>"; //FIXME LAN
$text = '<div class="btn-group">
'.$replyUrl.'
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
';
foreach($options as $key => $val)
{
$text .= '<li>'.$val.'</li>';
}
$jumpList = $forum->forumGetAllowed();
$text .= "<li class='divider'></li>";
foreach($jumpList as $key=>$val)
{
$text .= '<li><a href ="'.$key.'">Go to '.$val.'</a></li>';
}
$text .= '
</ul>
</div>';
return $text;
}
$tVars->POLL = vartrue($pollstr); $tVars->POLL = vartrue($pollstr);
$tVars->FORUMJUMP = forumjump(); $tVars->FORUMJUMP = forumjump();
$tVars->MESSAGE = $thread->message; $tVars->MESSAGE = $thread->message;
$forstr = $tp->simpleParse($FORUMSTART, $tVars); $forstr = $tp->simpleParse($FORUMSTART, $tVars);
unset($forrep); unset($forrep);
@@ -277,10 +349,10 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread
$tVars->QUICKREPLY = " $tVars->QUICKREPLY = "
<form action='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "' method='post'> <form action='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "' method='post'>
<p>" . LAN_393 . ":<br /> <p>" . LAN_393 . ":<br />
<textarea cols='60' rows='4' class='tbox' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea> <textarea cols='80' rows='4' class='tbox input-xxlarge' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
<br /> <br />
<input type='submit' name='fpreview' value='" . LAN_394 . "' class='btn button' /> &nbsp; <input type='submit' name='fpreview' value='" . LAN_394 . "' class='btn button' /> &nbsp;
<input type='submit' name='reply' value='" . LAN_395 . "' class='btn button' /> <input type='submit' name='reply' value='" . LAN_395 . "' class='btn btn-success button' />
<input type='hidden' name='thread_id' value='$thread_parent' /> <input type='hidden' name='thread_id' value='$thread_parent' />
</p> </p>
</form>"; </form>";

View File

@@ -93,14 +93,18 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_avatar() function sc_avatar()
{ {
//return e107::getParser()->parseTemplate("{AVATAR=".$this->postInfo['user_image']."}");
if ($this->postInfo['post_user']) if ($this->postInfo['post_user'])
{ {
if(!$avatar = getcachedvars('forum_avatar_'.$this->postInfo['post_user'])) if(!$avatar = getcachedvars('forum_avatar_'.$this->postInfo['post_user']))
{ {
if ($this->postInfo['user_image']) if ($this->postInfo['user_image'])
{ {
require_once(e_HANDLER.'avatar_handler.php'); // require_once(e_HANDLER.'avatar_handler.php');
$avatar = "<div class='spacer'><img src='".avatar($this->postInfo['user_image'])."' alt='' /></div><br />"; $avatar = "<img src='".e_MEDIA_AVATAR.$this->postInfo['user_image']."' alt=\"".$this->postInfo['user_name']."\"/>";
} }
else else
{ {
@@ -273,8 +277,14 @@ class plugin_forum_view_shortcodes extends e_shortcode
$rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']); $rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']);
// FIXME - level handler!!! // FIXME - level handler!!!
if($parm == 'badge')
{
return "<span class='label label-info'>".$rankInfo['name']."</span>";
}
if(!$parm) { $parm = 'name'; } if(!$parm) { $parm = 'name'; }
switch($parm) switch($parm)
{ {
@@ -315,8 +325,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
} }
function sc_lasteditby() function sc_lasteditby()
{ { if(isset($this->postInfo['edit_name']))
if(isset($this->postInfo['edit_name']))
{ {
if($parm == 'link') if($parm == 'link')
{ {
@@ -339,5 +348,57 @@ class plugin_forum_view_shortcodes extends e_shortcode
// Defined in case an indicator is required // Defined in case an indicator is required
return ''; return '';
} }
function sc_usercombo()
{
$tp = e107::getParser();
// $text2 = $this->sc_level('special');
// $text .= $this->sc_level('pic');
$ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value}",true);
$username = $this->postInfo['user_name'];
$text = '<div class="btn-group">
<a class="btn btn-small" href="'.e_BASE.'user.php?'.$this->postInfo['post_user'].'">'.$username.'</a>
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
';
$text .= "<li><a href='#'>".$this->sc_level('userid')."</a></li>";
$text .= "<li><a href='#'>".$this->sc_joined()."</a></li>";
if($ue)
{
$text .= "<li><a hre='#'>".$ue."</a></li>";
}
$text .= "<li><a href='#'>".$this->sc_posts()."</a></li>";
$text .= "<li class='divider'></li>";
if(plugInstalled('pm') && ($this->postInfo['post_user'] > 0))
{
$text .= "<li><a href='".e_PLUGIN_ABS."pm/pm.php?send.{$this->postInfo['post_user']}'>Send Private Message</a></li>";
}
if($website = $this->sc_website())
{
$text .= "<li>".$website."</li>";
}
// {EMAILIMG}
// {WEBSITEIMG}
$text .= "</ul>
</div>";
return $text;
}
} }
?> ?>

View File

@@ -65,4 +65,60 @@ if (!isset($FORUM_TRACK_END))
$FORUM_TRACK_END = "</table>\n</div>\n</div>"; $FORUM_TRACK_END = "</table>\n</div>\n</div>";
} }
/*
$FORUM_MAIN_START = "<br />MAIN START";
$FORUM_MAIN_PARENT = "<br />MAIN PARENT";
$FORUM_MAIN_FORUM = "<br />MAIN FORUM";
$FORUM_MAIN_END = "<br />MAIN END";
$FORUM_NEWPOSTS_START = "<br />NEWPOSTS-START";
$FORUM_NEWPOSTS_MAIN = "<br />NEWPOSTS-MAIN";
$FORUM_NEWPOSTS_END = "<br />NEWPOSTS END";
$FORUM_TRACK_START = "<br />TRACK-START";
$FORUM_TRACK_MAIN = "<br />TRACK-MAIN";
$FORUM_TRACK_END = "<br />TRACK-END";
*/
$FORUM_TEMPLATE['main-start'] = "<table class='table table-striped'>
<colgroup>
<col style='width:3%' />
<col />
<col />
<col />
<col />
</colgroup>
<tr>
<th colspan='5'>{FORUMTITLE}</th>
</tr>";
$FORUM_TEMPLATE['main-parent'] = "<tr>
<th colspan='2'>{PARENTNAME} {PARENTSTATUS}</th>
<th>".LAN_55."</th>
<th>".FORLAN_21."</th>
<th>".FORLAN_22."</th>
</tr>";
$FORUM_TEMPLATE['main-forum'] = "<tr>
<td>{NEWFLAG}</td>
<td>{FORUMNAME}<br /><small>{FORUMDESCRIPTION}</small>{FORUMSUBFORUMS}</td>
<td>{THREADSX}</td>
<td>{REPLIESX}</td>
<td><small>{LASTPOSTUSER} {LASTPOSTDATE}</small></td>
</tr>";
$FORUM_TEMPLATE['main-end'] = "</table>";
?> ?>

View File

@@ -267,5 +267,71 @@ $FORUM_CRUMB['subparent']['value'] = "<a class='forumlink' href='{SUBPARENT_HREF
$FORUM_CRUMB['subparent']['sep'] = " :: "; $FORUM_CRUMB['subparent']['sep'] = " :: ";
$FORUM_CRUMB['forum']['value'] = "{FORUM_TITLE}"; $FORUM_CRUMB['forum']['value'] = "{FORUM_TITLE}";
// New in v2.x - replaces all of the above $FORUM_VIEW_xxxx etc.
// <small>{BREADCRUMB}</small> //FIXME Breadcrumb looks crummy
$FORUMVIEW_TEMPLATE['start'] = "";
$FORUMVIEW_TEMPLATE['header'] = "<div class='row'><div class='span9 pull-left'><h3>{FORUMTITLE}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{NEWTHREADBUTTONX}</div></div>
<table class='table table-hover table-striped'>
<colgroup>
<col style='width:3%' />
<col />
<col style='width:10%' />
<col style='width:10%' />
<col style='width:20%' />
</colgroup>
{SUBFORUMS}";
$FORUMVIEW_TEMPLATE['item'] = "<tr><td>{ICON}</td><td>{THREADNAME}<div><small class='clearfix'>by {POSTER} {THREADTIMELAPSE} {PAGESX}</small></div></td><td>{REPLIESX}</td><td>{VIEWSX}</td><td><small>{LASTPOSTUSER} {LASTPOSTDATE} </small><span class='pull-right'>{ADMINOPTIONS}</span></td></tr>\n";
$FORUMVIEW_TEMPLATE['item-sticky'] = $FORUMVIEW['item'] ; // "<tr><td>{THREADNAME}</td></tr>\n";
$FORUMVIEW_TEMPLATE['item-announce'] = $FORUMVIEW['item'] ; // "<tr><td>{THREADNAME}</td></tr>\n";
$FORUMVIEW_TEMPLATE['sub-header'] = "<tr><th colspan='2'>".FORLAN_20."</th><th>".LAN_55."</th><th>".FORLAN_21."</th><th>".FORLAN_22."</th></tr>";
$FORUMVIEW_TEMPLATE['sub-item'] = "<tr><td>{NEWFLAG}</td>
<td><div>{SUB_FORUMTITLE}</div><small>{SUB_DESCRIPTION}</small></td>
<td>{SUB_REPLIESX}</td>
<td>{SUB_THREADSX}</td>
<td>{SUB_LASTPOST}</td>
</tr>\n";
$FORUMVIEW_TEMPLATE['sub-footer'] = "";
$FORUMVIEW_TEMPLATE['divider-important'] = "<tr><th colspan='2'>".LAN_411."</th><th>".LAN_55."</th><th>".LAN_56."</th><th>".LAN_57."</th></tr>";
$FORUMVIEW_TEMPLATE['divider-normal'] = "<tr><th colspan='2'>".LAN_412."</th><th>".LAN_55."</th><th>".LAN_56."</th><th>".LAN_57."</th></tr>";
$FORUMVIEW_TEMPLATE['footer'] = "</table>
<div class='row'>
<div class='span5 pull-left left' style='padding-top:10px'>{SEARCH}</div><div class='span3 pull-right right' style='padding-top:10px'>{NEWTHREADBUTTONX}</div>
</div>";
$FORUMVIEW_TEMPLATE['end'] = "<!--- END --> \n";
?> ?>

View File

@@ -300,4 +300,104 @@ $FORUM_CRUMB['subparent']['sep'] = " :: ";
$FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORUM_TITLE}</a>"; $FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORUM_TITLE}</a>";
// {MODERATORS} {THREADSTATUS}
$FORUMTOPIC_TEMPLATE['start'] = "<a id='top'></a>
<div class='row'>
<div class='span6 pull-left'>{BACKLINK}</div>
</div>
<div class='row'>
<div class='span9 pull-left'><h3>{THREADNAME}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{BUTTONSX}</div>
</div>
{MESSAGE}
<table class='table table-striped'>
<colgroup>
<col style='width:20%' />
<col />
<col />
</colgroup>
<tr>
<th>".LAN_402."</th>
<th colspan='2'>".LAN_403."</th>
</tr>
";
$FORUMTOPIC_TEMPLATE['end'] = "</tr></table>
<div class='center'>{QUICKREPLY}</div>
<table class='table'>
<tr>
<td style='width:80%'>{GOTOPAGES}
</td>
<td style='width:20%; text-align: right; white-space: nowrap'>
{BUTTONSX}
</td>
</tr>
</table>
</div>
";
$FORUMTOPIC_TEMPLATE['thread'] ="
<tr>
<td class='forumheader' style='vertical-align:middle'>{NEWFLAG} {USERCOMBO}{ANON_IP}</td>
<td class='smallblacktext'>{THREADDATESTAMP}</td>
<td style='text-align:right'>{EMAILITEM} {PRINTITEM} {REPORTIMG}{EDITIMG}{QUOTEIMG} </td>
</tr>
<tr>
<td class='forumheader3' style='vertical-align:top'>
{CUSTOMTITLE}
{AVATAR}
<small>
{LEVEL=badge}{LEVEL=pic}
</small>
</td>
<td colspan='2' class='forumheader3' style='vertical-align:top'>
{POLL}
{POST}
{ATTACHMENTS}
{LASTEDIT}{LASTEDITBY=link}
{SIGNATURE}
</td>
</tr>
<tr>
<td class='finfobar'>
<span class='smallblacktext'>
{TOP}
</span>
</td>
<td class='finfobar' style='vertical-align:top'>
</td>
<td style='text-align:right'>
{MODOPTIONS}
</td>
</tr>
<tr>
<td colspan='3'>
</td>
</tr>";
$FORUMTOPIC_TEMPLATE['replies'] = $FORUMTOPIC_TEMPLATE['thread'];
//$FORUMDELETEDSTYLE = "<br />DELETED";
?> ?>

View File

@@ -20,6 +20,8 @@
.clear-l { clear: right } .clear-l { clear: right }
.clear-r { clear: left } .clear-r { clear: left }
td.text-center { text-align:center; }
/* Core Icons */ /* Core Icons */
.icon { border: 0 } .icon { border: 0 }
.icon.action { vertical-align: middle } .icon.action { vertical-align: middle }