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

Bugtracker #4162 - allow guests to vote in poll

This commit is contained in:
e107steved
2007-11-01 22:47:27 +00:00
parent cee860bac9
commit d731eb31c5
2 changed files with 28 additions and 18 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/admin_config.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/poll/admin_config.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2007-10-28 21:09:52 $ | $Date: 2007-11-01 22:46:19 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -107,13 +107,16 @@ if (POLLACTION == "edit" && !$_POST['preview'] && !$_POST['submit'])
$_POST['multipleChoice'] = $poll_allow_multiple; $_POST['multipleChoice'] = $poll_allow_multiple;
$_POST['showResults'] = $poll_result_type; $_POST['showResults'] = $poll_result_type;
$_POST['pollUserclass'] = $poll_vote_userclass; // Can't have everyone voting if tracking method is user ID
$_POST['pollUserclass'] = (($poll_vote_userclass == e_UC_PUBLIC) && $poll_storage_method == 2) ? e_UC_MEMBER : $poll_vote_userclass;
$_POST['storageMethod'] = $poll_storage_method; $_POST['storageMethod'] = $poll_storage_method;
} }
} }
if (isset($_POST['preview'])) if (isset($_POST['preview']))
{ {
// Can't have everyone voting if tracking method is user ID
if (($_POST['pollUserclass'] == e_UC_PUBLIC) && ($_POST['storageMethod'] == 2)) $_POST['pollUserclass'] = e_UC_MEMBER;
$poll->render_poll($_POST, "preview"); $poll->render_poll($_POST, "preview");
} }
@@ -144,7 +147,9 @@ if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) {
</tr>"; </tr>";
} }
$text .= "</table>"; $text .= "</table>";
} else { }
else
{
$text .= "<div style='text-align:center'>".POLLAN_7."</div>"; $text .= "<div style='text-align:center'>".POLLAN_7."</div>";
} }
$text .= "</form></div></div>"; $text .= "</form></div></div>";
@@ -156,17 +161,22 @@ $text = $poll -> renderPollForm();
$ns->tablerender(POLLAN_2, $text); $ns->tablerender(POLLAN_2, $text);
require_once(e_ADMIN."footer.php"); require_once(e_ADMIN."footer.php");
function headerjs() {
function headerjs()
{
global $tp; global $tp;
$headerjs = "<script type=\"text/javascript\"> $headerjs = "<script type=\"text/javascript\">
function confirm_(poll_id){ function confirm_(poll_id)
{
var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\"); var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\");
if (x){ if (x)
{
document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id; document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id;
document.getElementById('del_poll').submit(); document.getElementById('del_poll').submit();
} }
} }
</script>"; </script>";
return $headerjs; return $headerjs;
} }
?> ?>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $
| $Revision: 1.6 $ | $Revision: 1.7 $
| $Date: 2007-08-12 19:52:55 $ | $Date: 2007-11-01 22:47:25 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -541,14 +541,14 @@ class poll
<tr> <tr>
<td style='width:30%' class='forumheader3'>".POLLAN_15."</td> <td style='width:30%' class='forumheader3'>".POLLAN_15."</td>
<td class='forumheader3'>".r_userclass("pollUserclass", $_POST['pollUserclass'], 'off', "member,admin,classes,matchclass")."</td> <td class='forumheader3'>".r_userclass("pollUserclass", $_POST['pollUserclass'], 'off', "public,member,admin,classes,matchclass")."</td>
</tr> </tr>
<tr> <tr>
<td style='width:30%' class='forumheader3'>".POLLAN_16."</td> <td style='width:30%' class='forumheader3'>".POLLAN_16."</td>
<td class='forumheader3'> <td class='forumheader3'>
<input type='radio' name='storageMethod' value='0'".(!$_POST['storageMethod'] ? " checked='checked'" : "")." /> ".POLLAN_17."<br /> <input type='radio' name='storageMethod' value='0'".(!$_POST['storageMethod'] ? " checked='checked'" : "")." /> ".POLLAN_17."<br />
<input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] == 1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br /> <input type='radio' name='storageMethod' value='1'".($_POST['storageMethod'] ==1 ? " checked='checked'" : "")." /> ".POLLAN_18."<br />
<input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19." <input type='radio' name='storageMethod' value='2'".($_POST['storageMethod'] ==2 ? " checked='checked'" : "")." /> ".POLLAN_19."
</tr> </tr>