1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-16 11:36:08 +02:00

Poll and Forum GUI tweaks

This commit is contained in:
Cameron
2013-03-29 03:59:03 -07:00
parent bfc3394aa1
commit 392b386967
5 changed files with 160 additions and 21 deletions

View File

@@ -164,7 +164,7 @@ function poll_list()
$fields = array(
'poll_id' => array('title'=> LAN_ID, 'width'=>'5%', 'forced'=> TRUE),
'poll_title' => array('title'=> POLLAN_3, 'width'=>'auto'),
'poll_options' => array('title'=> POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center' ), // No real vetting
'poll_options' => array('title'=> POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left' ), // No real vetting
// 'poll_start_datestamp' => array('title'=> LAN_AUTHOR, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
// 'poll_end_datestamp' => array('title'=> LAN_DATE, 'type' => 'text', 'width' => 'auto'), // User name
'poll_vote_userclass' => array('title'=> LAN_USERCLASS, 'type' => 'text', 'width' => 'auto'), // Photo
@@ -188,18 +188,22 @@ function poll_list()
{
extract($row); // FIXME
$pollopts = explode(chr(1),$poll_options);
$pollopts = array_filter($pollopts);
$text .= "
<tr>
<td>$poll_id</td>";
$text .= (in_array("poll_title",$fieldpref)) ? "<td class='left'>".$tp -> toHTML($poll_title, TRUE,"no_hook, emotes_off, defs")."</td>" : "";
$text .= (in_array("poll_options",$fieldpref)) ? "<td class='left'>".(str_replace(chr(1),"<br />",$poll_options))."</td>" : "";
$text .= (in_array("poll_options",$fieldpref)) ? "<td class='left'><ul><li>".implode("</li><li>",$pollopts)."</li></ul></td>" : "";
$text .= (in_array("poll_comment",$fieldpref)) ? "<td>".($poll_comment ? LAN_YES : LAN_NO)."</td>" : "";
$text .= (in_array("poll_vote_userclass",$fieldpref)) ? "<td>".(r_userclass_name($poll_vote_userclass))."</td>" : "";
$text .= "
<td class='center'>
<input type='image' name='edit[{$poll_id}]' value='edit' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' />
<input type='image' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" src='".ADMIN_DELETE_ICON_PATH."' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
<td class='center' style='white-space:nowrap'>
<input class='btn btn-large' type='image' name='edit[{$poll_id}]' value='edit' src='".ADMIN_EDIT_ICON_PATH."' alt='".LAN_EDIT."' title='".LAN_EDIT."' style='border:0px' />
<input class='btn btn-large' type='image' name='delete[$poll_id]' value='del' onclick=\"return jsconfirm('".$tp->toJS(LAN_CONFIRMDEL." [".$poll_id."]")."') \" src='".ADMIN_DELETE_ICON_PATH."' alt='".LAN_DELETE."' title='".LAN_DELETE."' style='border:0px' />
</td>
</tr>";
}

View File

@@ -323,7 +323,7 @@ class poll
if ($type == 'preview')
{
$optionArray = $pollArray['poll_option'];
$optionArray = array_filter($pollArray['poll_option']);
$voteArray = array();
$voteArray = array_pad($voteArray, count($optionArray), 0);
$pollArray['poll_allow_multiple'] = $pollArray['multipleChoice'];
@@ -378,18 +378,32 @@ class poll
require(e_PLUGIN.'poll/templates/poll_template.php');
}
if($type == 'forum' && e_BOOTSTRAP === true)
if(deftrue('e_BOOTSTRAP'))
{
require_once(e_PLUGIN."forum/templates/forum_poll_template.php");
if($type == 'forum')
{
require_once(e_PLUGIN."forum/templates/forum_poll_template.php");
$POLL_FORUM_NOTVOTED_START = $FORUM_POLL_TEMPLATE['form']['start'];
$POLL_FORUM_NOTVOTED_LOOP = $FORUM_POLL_TEMPLATE['form']['item'];
$POLL_FORUM_NOTVOTED_END = $FORUM_POLL_TEMPLATE['form']['end'];
$POLL_FORUM_VOTED_START = $FORUM_POLL_TEMPLATE['results']['start'];
$POLL_FORUM_VOTED_LOOP = $FORUM_POLL_TEMPLATE['results']['item'];
$POLL_FORUM_VOTED_END = $FORUM_POLL_TEMPLATE['results']['end'];
}
$POLL_FORUM_NOTVOTED_START = $FORUM_POLL_TEMPLATE['form']['start'];
$POLL_FORUM_NOTVOTED_LOOP = $FORUM_POLL_TEMPLATE['form']['item'];
$POLL_FORUM_NOTVOTED_END = $FORUM_POLL_TEMPLATE['form']['end'];
$POLL_NOTVOTED_START = $POLL_TEMPLATE['form']['start'];
$POLL_NOTVOTED_LOOP = $POLL_TEMPLATE['form']['item'];
$POLL_NOTVOTED_END = $POLL_TEMPLATE['form']['end'];
$POLL_VOTED_START = $POLL_TEMPLATE['results']['start'];
$POLL_VOTED_LOOP = $POLL_TEMPLATE['results']['item'];
$POLL_VOTED_END = $POLL_TEMPLATE['results']['end'];
$POLL_FORUM_VOTED_START = $FORUM_POLL_TEMPLATE['results']['start'];
$POLL_FORUM_VOTED_LOOP = $FORUM_POLL_TEMPLATE['results']['item'];
$POLL_FORUM_VOTED_END = $FORUM_POLL_TEMPLATE['results']['end'];
}
@@ -469,7 +483,7 @@ class poll
$SUBMITBUTTON = "<input class='button btn' type='submit' name='pollvote' value='".POLLAN_30."' />";
if (('preview' == $type || $preview == TRUE) && strpos(e_SELF, "viewtopic") === FALSE)
{
$SUBMITBUTTON = "[".POLLAN_30."]";
$SUBMITBUTTON = "<input class='button btn e-tip' type='button' name='null' title='Disabled' value='".POLLAN_30."' />";
}
$text .= "\n".preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_NOTVOTED_END : $POLL_NOTVOTED_END))."\n</form>";
@@ -530,7 +544,7 @@ class poll
if ($type == 'preview')
{
$caption = POLLAN_23;
$caption = POLLAN_23.SEP."Preview";
$text = "<div style='text-align:center; margin-left: auto; margin-right: auto;'>\n<table style='width:350px' class='fborder'>\n<tr>\n<td>\n$text\n</td></tr></table></div>";
}
elseif ($type == 'forum')

View File

@@ -179,4 +179,63 @@ $POLL_FORUM_VOTED_END = "
</div>
";
/* v2.x template for polls when user has not voted */
$POLL_TEMPLATE = array();
$POLL_TEMPLATE['form']['start'] = "
<div class='clearfix'>
<div class='well'>
<div class='control-group'>
<ul class='nav nav-list'>
<li class='nav-header'>
Poll: {QUESTION}
</li>
";
$POLL_TEMPLATE['form']['item'] = "
<li>
{ANSWER}
</li>";
$POLL_TEMPLATE['form']['end'] = "
</ul>
</div>
<div class='control-group'>
<div class='controls text-center'>
{SUBMITBUTTON}
</div>
</div>
</div>
</div>
";
/* v2.x template for polls when user HAS voted */
$POLL_TEMPLATE['results']['start'] = "
<div class='clearfix'>
<div class='well'>
<h5>Poll: {QUESTION}</h5>
";
$POLL_TEMPLATE['results']['item'] = "
<strong>{OPTION}</strong><small class='pull-right'><a href='#' class='e-tip' title=\"{VOTES}\">{PERCENTAGE}</a></small>
{BAR}
";
$POLL_TEMPLATE['results']['end'] = "
<div class='text-center'><small>{VOTE_TOTAL}</small></div>
</div>
</div>
";
?>