mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01: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:
parent
adc108278d
commit
809f9258ae
@ -75,6 +75,21 @@ function nextprev_shortcode($parm = '')
|
||||
$total_items = intval($parm['total']);
|
||||
$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.
|
||||
if(isset($parm['tmpl_prefix']))
|
||||
{
|
||||
@ -82,6 +97,12 @@ function nextprev_shortcode($parm = '')
|
||||
$tprefix = vartrue($parm['tmpl_prefix'], 'default');
|
||||
//$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
|
||||
elseif($pref['old_np'])
|
||||
{
|
||||
@ -258,7 +279,7 @@ function nextprev_shortcode($parm = '')
|
||||
if($show_first && !empty($tmpl[$tprefix.'nav_first']))
|
||||
{
|
||||
$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;
|
||||
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_first'], $e_vars);
|
||||
}
|
||||
@ -266,7 +287,7 @@ function nextprev_shortcode($parm = '')
|
||||
if(!empty($tmpl[$tprefix.'nav_prev']))
|
||||
{
|
||||
$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;
|
||||
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_prev'], $e_vars);
|
||||
}
|
||||
@ -305,7 +326,7 @@ function nextprev_shortcode($parm = '')
|
||||
if(!empty($tmpl[$tprefix.'nav_next']))
|
||||
{
|
||||
$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;
|
||||
$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']))
|
||||
{
|
||||
$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;
|
||||
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_last'], $e_vars);
|
||||
}
|
||||
|
@ -1581,6 +1581,11 @@ class e107
|
||||
*/
|
||||
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->setDependency($dep);
|
||||
|
||||
@ -2237,6 +2242,11 @@ class e107
|
||||
else $fname = e_LANGUAGE;
|
||||
|
||||
$path = $theme.$fname.'.php';
|
||||
|
||||
if(E107_DBG_INCLUDES)
|
||||
{
|
||||
e107::getMessage()->addDebug("Attempting to Load: ".$path);
|
||||
}
|
||||
|
||||
e107::setRegistry($cstring, true);
|
||||
self::includeLan($path, false);
|
||||
|
@ -24,6 +24,7 @@ $(document).ready(function()
|
||||
var thread = $(this).attr('data-forum-thread');
|
||||
var post = $(this).attr('data-forum-post');
|
||||
var text = $('#forum-quickreply-text').val();
|
||||
var insert = $(this).attr('data-forum-insert');
|
||||
|
||||
|
||||
|
||||
@ -37,7 +38,7 @@ $(document).ready(function()
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
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) {
|
||||
// alert(data);
|
||||
|
||||
@ -81,8 +82,8 @@ EON;
|
||||
|
||||
e107::js('inline',$jscode,'jquery');
|
||||
|
||||
|
||||
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
|
||||
e107::lan('forum','lan_forum');
|
||||
// include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
|
||||
include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php');
|
||||
|
||||
|
||||
@ -134,41 +135,51 @@ class e107forum
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handle the Ajax quick-reply.
|
||||
*/
|
||||
function ajaxQuickReply()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
if(varset($_POST['action']) == 'quickreply' && vartrue($_POST['text']))
|
||||
{
|
||||
|
||||
|
||||
$postInfo = array();
|
||||
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
|
||||
|
||||
if (USER)
|
||||
{
|
||||
$postInfo['post_user'] = USERID;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$postInfo['post_user_anon'] = $_POST['anonname'];
|
||||
}
|
||||
$postInfo['post_entry'] = $_POST['text'];
|
||||
$postInfo['post_forum'] = intval($_POST['post']);
|
||||
$postInfo['post_datestamp'] = time();
|
||||
$postInfo['post_thread'] = intval($_POST['thread']);
|
||||
|
||||
$postInfo['post_entry'] = $_POST['text'];
|
||||
$postInfo['post_forum'] = intval($_POST['post']);
|
||||
$postInfo['post_datestamp'] = time();
|
||||
$postInfo['post_thread'] = intval($_POST['thread']);
|
||||
|
||||
$this->postAdd($postInfo); // save it.
|
||||
|
||||
$postInfo['user_name'] = USERNAME;
|
||||
$postInfo['user_email'] = USEREMAIL;
|
||||
$postInfo['user_image'] = USERIMAGE;
|
||||
|
||||
$tmpl = e107::getTemplate('forum','forum_viewtopic','replies');
|
||||
$sc = e107::getScBatch('view', 'forum');
|
||||
$sc->setScVar('postInfo', $postInfo);
|
||||
|
||||
$ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n";
|
||||
// $ret['html'] = "<tr><td>Help! I can't pass the template!</td><td colspan='2'>".$tp->toHtml($_POST['text'])."</td></tr>";
|
||||
|
||||
if($_POST['insert'] == 1)
|
||||
{
|
||||
$tmpl = e107::getTemplate('forum','forum_viewtopic','replies');
|
||||
$sc = e107::getScBatch('view', 'forum');
|
||||
$sc->setScVar('postInfo', $postInfo);
|
||||
$ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret['html'] = false;
|
||||
}
|
||||
|
||||
$ret['status'] = 'ok';
|
||||
$ret['msg'] = "Your post has been added";
|
||||
|
@ -24,7 +24,7 @@ if (!$e107->isInstalled('forum'))
|
||||
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']))
|
||||
{
|
||||
|
@ -224,7 +224,7 @@ if ($thread->pages > 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]')));
|
||||
$parms = "total={$thread->pages}&type=page¤t={$thread->page}&url=".$url."&caption=off";
|
||||
$parms = "total={$thread->pages}&type=page¤t={$thread->page}&url=".$url."&caption=off&tmpl=default&navcount=4&glyphs=1";
|
||||
|
||||
//XXX FIXME - pull-down template not practical here. Can we force another?
|
||||
$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??
|
||||
if (!vartrue($forum_quickreply))
|
||||
{
|
||||
$ajaxInsert = ($thread->pages == $thread->page) ? 1 : 0;
|
||||
|
||||
$tVars->QUICKREPLY = "
|
||||
<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>
|
||||
<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' />
|
||||
</div>
|
||||
</form>";
|
||||
@ -378,6 +380,8 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$forend = $tp->simpleParse($FORUMEND, $tVars);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
$mes = e107::getMessage();
|
||||
require_once (HEADERF);
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
echo $forumstring;
|
||||
echo $mes->render() . $forumstring;
|
||||
}
|
||||
|
||||
// end -------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user