1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Nextprev support for bootstrap glyphs when bootstrap detected. (check for e_BOOTSTRAP === true)

Forum quickreply fully functional. LANs still need cleanup.
This commit is contained in:
Cameron
2013-03-14 04:05:33 -07:00
parent adc108278d
commit 809f9258ae
6 changed files with 75 additions and 28 deletions

View File

@@ -75,6 +75,21 @@ function nextprev_shortcode($parm = '')
$total_items = intval($parm['total']); $total_items = intval($parm['total']);
$check_render = true; $check_render = true;
if(vartrue($parm['glyphs']) && (e_BOOTSTRAP === true))
{
$LAN_NP_FIRST = "<i class='icon-fast-backward'></i>";
$LAN_NP_PREVIOUS = "<i class='icon-backward'></i>";
$LAN_NP_NEXT = "<i class='icon-forward'></i>";
$LAN_NP_LAST = "<i class='icon-fast-forward'></i>";
}
else
{
$LAN_NP_FIRST = LAN_NP_FIRST;
$LAN_NP_PREVIOUS = LAN_NP_PREVIOUS;
$LAN_NP_NEXT = LAN_NP_NEXT;
$LAN_NP_LAST = LAN_NP_LAST ;
}
// search for template keys - default_start, default_end etc. // search for template keys - default_start, default_end etc.
if(isset($parm['tmpl_prefix'])) if(isset($parm['tmpl_prefix']))
{ {
@@ -82,6 +97,12 @@ function nextprev_shortcode($parm = '')
$tprefix = vartrue($parm['tmpl_prefix'], 'default'); $tprefix = vartrue($parm['tmpl_prefix'], 'default');
//$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items; //$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
} }
elseif(isset($parm['tmpl']))
{
// forced
$tprefix = vartrue($parm['tmpl'], 'default');
//$perpage = $parm['amount'] !== 'all' ? intval($parm['amount']) : $total_items;
}
// default, based on prefs // default, based on prefs
elseif($pref['old_np']) elseif($pref['old_np'])
{ {
@@ -258,7 +279,7 @@ function nextprev_shortcode($parm = '')
if($show_first && !empty($tmpl[$tprefix.'nav_first'])) if($show_first && !empty($tmpl[$tprefix.'nav_first']))
{ {
$e_vars->url = str_replace('[FROM]', $first_page, $url); $e_vars->url = str_replace('[FROM]', $first_page, $url);
$e_vars->label = LAN_NP_FIRST; $e_vars->label = $LAN_NP_FIRST;
$e_vars->url_label = LAN_NP_URLFIRST; $e_vars->url_label = LAN_NP_URLFIRST;
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_first'], $e_vars); $ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_first'], $e_vars);
} }
@@ -266,7 +287,7 @@ function nextprev_shortcode($parm = '')
if(!empty($tmpl[$tprefix.'nav_prev'])) if(!empty($tmpl[$tprefix.'nav_prev']))
{ {
$e_vars->url = str_replace('[FROM]', $prev_page, $url); $e_vars->url = str_replace('[FROM]', $prev_page, $url);
$e_vars->label = LAN_NP_PREVIOUS; $e_vars->label = $LAN_NP_PREVIOUS;
$e_vars->url_label = LAN_NP_URLPREVIOUS; $e_vars->url_label = LAN_NP_URLPREVIOUS;
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_prev'], $e_vars); $ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_prev'], $e_vars);
} }
@@ -305,7 +326,7 @@ function nextprev_shortcode($parm = '')
if(!empty($tmpl[$tprefix.'nav_next'])) if(!empty($tmpl[$tprefix.'nav_next']))
{ {
$e_vars->url = str_replace('[FROM]', $next_page, $url); $e_vars->url = str_replace('[FROM]', $next_page, $url);
$e_vars->label = LAN_NP_NEXT; $e_vars->label = $LAN_NP_NEXT;
$e_vars->url_label = LAN_NP_URLNEXT; $e_vars->url_label = LAN_NP_URLNEXT;
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_next'], $e_vars); $ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_next'], $e_vars);
} }
@@ -313,7 +334,7 @@ function nextprev_shortcode($parm = '')
if($show_last && !empty($tmpl[$tprefix.'nav_last'])) if($show_last && !empty($tmpl[$tprefix.'nav_last']))
{ {
$e_vars->url = str_replace('[FROM]', $last_page, $url);//$last_page $e_vars->url = str_replace('[FROM]', $last_page, $url);//$last_page
$e_vars->label = LAN_NP_LAST; $e_vars->label = $LAN_NP_LAST;
$e_vars->url_label = LAN_NP_URLLAST; $e_vars->url_label = LAN_NP_URLLAST;
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_last'], $e_vars); $ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_last'], $e_vars);
} }

View File

@@ -1581,6 +1581,11 @@ class e107
*/ */
public static function css($type, $data, $dep = null, $media = 'all', $preComment = '', $postComment = '', $dependence = null) public static function css($type, $data, $dep = null, $media = 'all', $preComment = '', $postComment = '', $dependence = null)
{ {
if(strstr($data,'bootstrap') && !defined("e_BOOTSTRAP")) // detect bootstrap is enabled. - used in nextprev.sc currently.
{
define("e_BOOTSTRAP", true);
}
$jshandler = e107::getJs(); $jshandler = e107::getJs();
$jshandler->setDependency($dep); $jshandler->setDependency($dep);
@@ -2238,6 +2243,11 @@ class e107
$path = $theme.$fname.'.php'; $path = $theme.$fname.'.php';
if(E107_DBG_INCLUDES)
{
e107::getMessage()->addDebug("Attempting to Load: ".$path);
}
e107::setRegistry($cstring, true); e107::setRegistry($cstring, true);
self::includeLan($path, false); self::includeLan($path, false);
} }

View File

@@ -24,6 +24,7 @@ $(document).ready(function()
var thread = $(this).attr('data-forum-thread'); var thread = $(this).attr('data-forum-thread');
var post = $(this).attr('data-forum-post'); var post = $(this).attr('data-forum-post');
var text = $('#forum-quickreply-text').val(); var text = $('#forum-quickreply-text').val();
var insert = $(this).attr('data-forum-insert');
@@ -37,7 +38,7 @@ $(document).ready(function()
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: script, url: script,
data: { thread: thread, action: action, post: post, text: text }, data: { thread: thread, action: action, post: post, text: text, insert:insert },
success: function(data) { success: function(data) {
// alert(data); // alert(data);
@@ -81,8 +82,8 @@ EON;
e107::js('inline',$jscode,'jquery'); e107::js('inline',$jscode,'jquery');
e107::lan('forum','lan_forum');
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php'); // include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php'); include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php');
@@ -134,7 +135,9 @@ class e107forum
} }
/**
* Handle the Ajax quick-reply.
*/
function ajaxQuickReply() function ajaxQuickReply()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -144,6 +147,7 @@ class e107forum
$postInfo = array(); $postInfo = array();
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE); $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
if (USER) if (USER)
{ {
$postInfo['post_user'] = USERID; $postInfo['post_user'] = USERID;
@@ -153,22 +157,29 @@ class e107forum
{ {
$postInfo['post_user_anon'] = $_POST['anonname']; $postInfo['post_user_anon'] = $_POST['anonname'];
} }
$postInfo['post_entry'] = $_POST['text'];
$postInfo['post_forum'] = intval($_POST['post']); $postInfo['post_entry'] = $_POST['text'];
$postInfo['post_datestamp'] = time(); $postInfo['post_forum'] = intval($_POST['post']);
$postInfo['post_thread'] = intval($_POST['thread']); $postInfo['post_datestamp'] = time();
$postInfo['post_thread'] = intval($_POST['thread']);
$this->postAdd($postInfo); // save it. $this->postAdd($postInfo); // save it.
$postInfo['user_name'] = USERNAME; $postInfo['user_name'] = USERNAME;
$postInfo['user_email'] = USEREMAIL; $postInfo['user_email'] = USEREMAIL;
$postInfo['user_image'] = USERIMAGE; $postInfo['user_image'] = USERIMAGE;
$tmpl = e107::getTemplate('forum','forum_viewtopic','replies'); if($_POST['insert'] == 1)
$sc = e107::getScBatch('view', 'forum'); {
$sc->setScVar('postInfo', $postInfo); $tmpl = e107::getTemplate('forum','forum_viewtopic','replies');
$sc = e107::getScBatch('view', 'forum');
$ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n"; $sc->setScVar('postInfo', $postInfo);
// $ret['html'] = "<tr><td>Help! I can't pass the template!</td><td colspan='2'>".$tp->toHtml($_POST['text'])."</td></tr>"; $ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n";
}
else
{
$ret['html'] = false;
}
$ret['status'] = 'ok'; $ret['status'] = 'ok';
$ret['msg'] = "Your post has been added"; $ret['msg'] = "Your post has been added";

View File

@@ -24,7 +24,7 @@ if (!$e107->isInstalled('forum'))
exit; exit;
} }
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php'); // include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php');
if (isset($_POST['fjsubmit'])) if (isset($_POST['fjsubmit']))
{ {

View File

@@ -224,7 +224,7 @@ if ($thread->pages > 1)
{ {
if(!$thread->page) $thread->page = 1; if(!$thread->page) $thread->page = 1;
$url = rawurlencode(e107::getUrl()->create('forum/thread/view', array('name' => $thread->threadInfo['thread_name'], 'id' => $thread->threadId, 'page' => '[FROM]'))); $url = rawurlencode(e107::getUrl()->create('forum/thread/view', array('name' => $thread->threadInfo['thread_name'], 'id' => $thread->threadId, 'page' => '[FROM]')));
$parms = "total={$thread->pages}&type=page&current={$thread->page}&url=".$url."&caption=off"; $parms = "total={$thread->pages}&type=page&current={$thread->page}&url=".$url."&caption=off&tmpl=default&navcount=4&glyphs=1";
//XXX FIXME - pull-down template not practical here. Can we force another? //XXX FIXME - pull-down template not practical here. Can we force another?
$tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");
@@ -361,11 +361,13 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread
//XXX Show only on the last page?? //XXX Show only on the last page??
if (!vartrue($forum_quickreply)) if (!vartrue($forum_quickreply))
{ {
$ajaxInsert = ($thread->pages == $thread->page) ? 1 : 0;
$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'>
<textarea cols='80' placeholder=\"Post a quick reply\" rows='4' id='forum-quickreply-text' class='tbox input-xxlarge' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea> <textarea cols='80' placeholder=\"Post a quick reply\" rows='4' id='forum-quickreply-text' class='tbox input-xxlarge' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
<div class='center'> <div class='center'>
<input type='submit' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$threadId."' data-forum-action='quickreply' name='reply' value='" . LAN_395 . "' class='btn btn-success button' /> <input type='submit' data-forum-insert='".$ajaxInsert."' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$threadId."' data-forum-action='quickreply' 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' />
</div> </div>
</form>"; </form>";
@@ -378,6 +380,8 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread
} }
} }
$forend = $tp->simpleParse($FORUMEND, $tVars); $forend = $tp->simpleParse($FORUMEND, $tVars);
$forumstring = $forstr . $forthr . vartrue($forrep) . $forend; $forumstring = $forstr . $forthr . vartrue($forrep) . $forend;
@@ -388,16 +392,17 @@ if ($thread->threadInfo['thread_lastpost'] > USERLV && !in_array($thread->thread
{ {
$tst = $forum->threadMarkAsRead($thread->threadId); $tst = $forum->threadMarkAsRead($thread->threadId);
} }
$mes = e107::getMessage();
require_once (HEADERF); require_once (HEADERF);
if ($forum->prefs->get('enclose')) if ($forum->prefs->get('enclose'))
{ {
$ns->tablerender(LAN_01, $forumstring, array('forum_viewtopic', 'main')); $ns->tablerender(LAN_01, $forumstring, $mes->render(). array('forum_viewtopic', 'main'));
} }
else else
{ {
echo $forumstring; echo $mes->render() . $forumstring;
} }
// end ------------------------------------------------------------------------------------------------------------------------------------------------------------------- // end -------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@@ -14,7 +14,7 @@
if ( ! defined('e107_INIT')) { exit(); } if ( ! defined('e107_INIT')) { exit(); }
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php'); // include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_viewforum.php');
// Thread info // Thread info