mirror of
https://github.com/e107inc/e107.git
synced 2025-08-20 05:11:42 +02:00
Forum/Poll template work.
This commit is contained in:
@@ -131,16 +131,21 @@ if ($thread->message)
|
||||
e107::getMessage()->add($thread->message);
|
||||
}
|
||||
|
||||
if (isset($thread->threadInfo['thread_options']['poll']))
|
||||
{
|
||||
if (!defined('POLLCLASS'))
|
||||
{
|
||||
include (e_PLUGIN . 'poll/poll_class.php');
|
||||
}
|
||||
|
||||
|
||||
//if (isset($thread->threadInfo['thread_options']['poll'])) //XXX Currently Failing - misconfigured thread-options.
|
||||
//{
|
||||
$_qry = 'SELECT * FROM `#polls` WHERE `poll_datestamp` = ' . $thread->threadId;
|
||||
$poll = new poll;
|
||||
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
|
||||
}
|
||||
if($sql->gen($_qry))
|
||||
{
|
||||
if (!defined('POLLCLASS'))
|
||||
{
|
||||
include_once(e_PLUGIN . 'poll/poll_class.php');
|
||||
}
|
||||
$poll = new poll;
|
||||
$pollstr = "<div class='spacer'>" . $poll->render_poll($_qry, 'forum', 'query', true) . '</div>';
|
||||
}
|
||||
//}
|
||||
//Load forum templates
|
||||
// FIXME - new template paths!
|
||||
if (file_exists(THEME . 'forum_design.php'))
|
||||
|
@@ -129,23 +129,113 @@ class plugin_forum_post_shortcodes extends e_shortcode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function sc_forumattachment()
|
||||
{
|
||||
$pref = e107::getPref();
|
||||
global $forum;
|
||||
|
||||
//. <div>".($pref['image_post'] ? "Attach file / image" : "Attach file")."</div>
|
||||
|
||||
$tooltip = "Allowed file types | ".vartrue($allowed_filetypes).". Any other file type will be deleted instantly.
|
||||
Maximum file size: ".(vartrue($max_upload_size) ? $max_upload_size."bytes" : ini_get('upload_max_filesize'));
|
||||
|
||||
$fileattach = "
|
||||
|
||||
|
||||
<div>
|
||||
<div id='fiupsection'>
|
||||
<span id='fiupopt'>
|
||||
<input class='tbox e-tip' title=\"".$tooltip."\" name='file_userfile[]' type='file' size='47' />
|
||||
</span>
|
||||
</div>
|
||||
<input class='btn button' type='button' name='addoption' value=\"Add Another\" onclick=\"duplicateHTML('fiupopt','fiupsection')\" />
|
||||
</div>
|
||||
|
||||
";
|
||||
|
||||
if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
|
||||
{
|
||||
return $fileattach;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sc_postoptions($parm='')
|
||||
{
|
||||
$type = $this->sc_postthreadas();
|
||||
$poll = $this->sc_poll('front');
|
||||
$attach = $this->sc_forumattachment();
|
||||
|
||||
$text = "
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><a href='#type' data-toggle='tab'>Type</a></li>";
|
||||
|
||||
$text .= ($poll) ? "<li><a href='#poll' data-toggle='tab'>Poll</a></li>\n" : "";
|
||||
$text .= ($attach) ? "<li><a href='#attach' data-toggle='tab'>Attachment</a></li>\n" : "";
|
||||
|
||||
$text .= "
|
||||
</ul>
|
||||
<div class='tab-content text-left'>
|
||||
<div class='tab-pane active' id='type'>
|
||||
<div class='control-group'>
|
||||
<label class='control-label'>Post thread as:</label>
|
||||
<div class='controls'>
|
||||
".$type."
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
if($poll)
|
||||
{
|
||||
$text .= "<div class='tab-pane' id='poll'>
|
||||
".$poll."
|
||||
</div>";
|
||||
|
||||
}
|
||||
|
||||
if($attach)
|
||||
{
|
||||
$text .= "
|
||||
<div class='tab-pane' id='attach'>
|
||||
".$attach."
|
||||
</div>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</div>";
|
||||
|
||||
|
||||
return $text;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function sc_poll($parm='')
|
||||
{
|
||||
global $forum, $poll_form, $action;
|
||||
|
||||
if(!$poll_form)
|
||||
global $forum, $action;
|
||||
|
||||
if(is_readable(e_PLUGIN."poll/poll_class.php"))
|
||||
{
|
||||
if(is_readable(e_PLUGIN."poll/poll_class.php"))
|
||||
{
|
||||
require_once(e_PLUGIN."poll/poll_class.php");
|
||||
$pollo = new poll;
|
||||
$poll_form = $pollo -> renderPollForm("forum");
|
||||
}
|
||||
require_once(e_PLUGIN."poll/poll_class.php");
|
||||
$pollo = new poll;
|
||||
$type = ($parm == 'front') ? 'front' : 'forum';
|
||||
|
||||
$poll_form = $pollo -> renderPollForm($type);
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'nt' && check_class($forum->prefs->get('poll')) && strpos(e_QUERY, 'edit') === false)
|
||||
{
|
||||
if($parm == 'front')
|
||||
{
|
||||
return $poll_form;
|
||||
}
|
||||
|
||||
|
||||
return "<tr><td><a href='#pollform' class='e-expandit'>Add Poll</a></td><td>
|
||||
<div id='pollform' style='display:none'>
|
||||
<table class='table table-striped'>".$poll_form."</table></div></td></tr>";
|
||||
@@ -153,22 +243,21 @@ class plugin_forum_post_shortcodes extends e_shortcode
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function sc_postthreadas()
|
||||
{
|
||||
global $action, $threadInfo;
|
||||
|
||||
if (MODERATOR && $action == "nt")
|
||||
{
|
||||
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : vartrue($threadInfo['thread_sticky'])); // no reference of 'head' $threadInfo['head']['thread_sticky']
|
||||
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : vartrue($threadInfo['thread_sticky'],0)); // no reference of 'head' $threadInfo['head']['thread_sticky']
|
||||
|
||||
$opts = array(0 => "Normal", 1 => "Sticky", 2 => "Announcement");
|
||||
|
||||
return e107::getForm()->radio('threadtype',$opts, $thread_sticky);
|
||||
|
||||
|
||||
|
||||
return "<br /><span class='defaulttext'>post thread as
|
||||
<input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1." <input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2." <input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
|
||||
// return "<br /><span class='defaulttext'>post thread as
|
||||
// <input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1." <input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2." <input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
71
e107_plugins/forum/templates/forum_poll_template.php
Normal file
71
e107_plugins/forum/templates/forum_poll_template.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/* v2.x template for forum polls when user has not voted */
|
||||
|
||||
$FORUM_POLL_TEMPLATE = array();
|
||||
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['start'] = "
|
||||
<div class='clearfix'>
|
||||
<div class='well span6'>
|
||||
<div class='control-group'>
|
||||
<ul class='nav nav-list'>
|
||||
<li class='nav-header'>
|
||||
Poll: {QUESTION}
|
||||
</li>
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['item'] = "
|
||||
<li>
|
||||
{ANSWER}
|
||||
</li>";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['form']['end'] = "
|
||||
</ul>
|
||||
</div>
|
||||
<div class='control-group'>
|
||||
<div class='controls text-center'>
|
||||
{SUBMITBUTTON}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
|
||||
/* v2.x template for forum polls when user HAS voted */
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['start'] = "
|
||||
<div class='clearfix'>
|
||||
<div class='well span6'>
|
||||
<h5>Poll: {QUESTION}</h5>
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['item'] = "
|
||||
<strong>{OPTION}</strong><small class='pull-right'><a href='#' class='e-tip' title=\"{VOTES}\">{PERCENTAGE}</a></small>
|
||||
{BAR}
|
||||
";
|
||||
|
||||
$FORUM_POLL_TEMPLATE['results']['end'] = "
|
||||
<div class='text-center'><small>{VOTE_TOTAL}</small></div>
|
||||
</div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@@ -243,23 +243,14 @@ $FORUMPOST_TEMPLATE['form'] = "
|
||||
<td style='width:80%'>
|
||||
{POSTBOX}
|
||||
{EMAILNOTIFY}
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<td style='width:20%'>Post thread as</td>
|
||||
<td style='width:80%'>
|
||||
{POSTTHREADAS}
|
||||
</td></tr>
|
||||
{POLL}
|
||||
{FILEATTACH}
|
||||
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='2' style='text-align:center'>
|
||||
{BUTTONS}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<td style='width:20%'>Post Options</td>
|
||||
<td style='width:80%'>
|
||||
{POSTOPTIONS}
|
||||
</td></tr></table>
|
||||
<div class='text-center'>
|
||||
{BUTTONS}
|
||||
</div>
|
||||
{FORMEND}
|
||||
|
||||
</div></div>
|
||||
|
@@ -283,7 +283,7 @@ $FORUM_CRUMB['forum']['value'] = "{FORUM_TITLE}";
|
||||
// <small>{BREADCRUMB}</small> //FIXME Breadcrumb looks crummy
|
||||
|
||||
$FORUM_VIEWFORUM_TEMPLATE['start'] = "";
|
||||
$FORUM_VIEWFORUM_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>
|
||||
$FORUM_VIEWFORUM_TEMPLATE['header'] = "<div class='row-fluid'><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%' />
|
||||
|
@@ -2,13 +2,10 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2013 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -310,11 +307,11 @@ $FORUM_CRUMB['forum']['value'] = "<a class='forumlink' href='{FORUM_HREF}'>{FORU
|
||||
|
||||
$FORUM_VIEWTOPIC_TEMPLATE['start'] = "
|
||||
|
||||
<div class='row'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span6 pull-left'>{BACKLINK}</div>
|
||||
</div>
|
||||
|
||||
<div class='row'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span9 pull-left'><h3>{THREADNAME}</h3></div><div class='span3 pull-right right' style='padding-top:10px'>{BUTTONSX}</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user