summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCallan Barrett <wizzomafizzo@gmail.com>2008-10-06 00:09:06 +0200
committerLoui Chang <louipc.ist@gmail.com>2008-10-06 01:15:47 +0200
commit34c8a9cf80fa857f8024eacd65292cd015673165 (patch)
tree41ccd05de3b85007983af5d314306c849b1fe727
parenta0e75dbbfcde794657a344f6b92888b713b950a7 (diff)
downloadaur-34c8a9cf80fa857f8024eacd65292cd015673165.tar.gz
aur-34c8a9cf80fa857f8024eacd65292cd015673165.tar.xz
Major rearrangement of tu.php, strings setup for translation
All the strings are set up to be translated now, HTML of tu.php has been moved to templates and the worst of it rewritten (there's no longer a massive function in it) Signed-off-by: Callan Barrett <wizzomafizzo@gmail.com> Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rw-r--r--web/html/tu.php438
-rw-r--r--web/template/tu_details.php62
-rw-r--r--web/template/tu_list.php68
3 files changed, 200 insertions, 368 deletions
diff --git a/web/html/tu.php b/web/html/tu.php
index 524e14d8..e2e44b77 100644
--- a/web/html/tu.php
+++ b/web/html/tu.php
@@ -8,44 +8,30 @@ set_lang();
check_sid();
html_header();
-# get login privileges
-#
+# Default votes per page
+$pp = 5;
+
+$atype = "";
if (isset($_COOKIE["AURSID"])) {
- # Only logged in users can do stuff
- #
$atype = account_from_sid($_COOKIE["AURSID"]);
-} else {
- $atype = "";
}
if ($atype == "Trusted User" OR $atype == "Developer") {
- # Show the TU interface
- #
-
- # Temp value for results per page
$pp = 5;
- if (isset($_REQUEST['id'])) {
- # Show application details
- # depending on action and time frame will show either
- # sponsor button, comments and vote buttons
- #
-
- if (intval($_REQUEST['id'])) {
+ if (isset($_GET['id'])) {
+ if (is_numeric($_GET['id'])) {
$q = "SELECT * FROM TU_VoteInfo ";
- $q.= "WHERE ID = " . $_REQUEST['id'];
+ $q.= "WHERE ID = " . $_GET['id'];
$dbh = db_connect();
$results = db_query($q, $dbh);
$row = mysql_fetch_assoc($results);
if (empty($row)) {
- print "Could not retrieve proposal details.\n";
+ print __("Could not retrieve proposal details.");
} else {
- # Print out application details, thanks again AUR
- #
-
$isrunning = $row['End'] > time() ? 1 : 0;
$qvoted = "SELECT * FROM TU_Votes WHERE ";
@@ -53,30 +39,27 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
$qvoted.= "UserID = " . uid_from_sid($_COOKIE["AURSID"]);
$hasvoted = mysql_num_rows(db_query($qvoted, $dbh));
- # Can this person vote?
- #
- $canvote = 1; // we assume they can
- $errorvote = ""; // error message to give
+ $canvote = 1;
+ $errorvote = "";
if ($isrunning == 0) {
$canvote = 0;
- $errorvote = "Voting is closed for this proposal.";
+ $errorvote = __("Voting is closed for this proposal.");
} else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) {
$canvote = 0;
- $errorvote = "You cannot vote in an proposal regarding you.";
+ $errorvote = __("You cannot vote in an proposal about you.");
} else if ($hasvoted != 0) {
$canvote = 0;
- $errorvote = "You've already voted in this proposal.";
+ $errorvote = __("You've already voted in this proposal.");
}
- # have to put this here so results are correct immediately after voting
if ($canvote == 1) {
if (isset($_POST['doVote'])) {
if (isset($_POST['voteYes'])) {
- $myvote = "Yes";
+ $myvote = __("Yes");
} else if (isset($_POST['voteNo'])) {
- $myvote = "No";
+ $myvote = __("No");
} else if (isset($_POST['voteAbstain'])) {
- $myvote = "Abstain";
+ $myvote = __("Abstain");
}
$qvote = "UPDATE TU_VoteInfo SET " . $myvote . " = " . ($row[$myvote] + 1) . " WHERE ID = " . $row['ID'];
@@ -87,7 +70,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
# Can't vote anymore
#
$canvote = 0;
- $errorvote = "You've already voted for this proposal.";
+ $errorvote = __("You've already voted for this proposal.");
# Update if they voted
$hasvoted = mysql_num_rows(db_query($qvoted, $dbh));
@@ -95,357 +78,76 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
$row = mysql_fetch_assoc($results);
}
}
-
- # I think I understand why MVC is good for this stuff..
- echo "<div class=\"pgbox\">\n";
- echo " <div class=\"pgboxtitle\"><span class=\"f3\">Proposal Details</span></div>\n";
- echo " <div class=\"pgboxbody\">\n";
-
- if ($isrunning == 1) {
- print "<div style='text-align: center; font-weight: bold; color: red'>This vote is still running.</div>";
- print "<br />";
- }
-
- print "User: <b>";
-
- if (!empty($row['User'])) {
- print "<a href='packages.php?K=" . $row['User'] . "&SeB=m'>" . $row['User'] . "</a>";
- } else {
- print "N/A";
- }
-
- print "</b><br />\n";
-
- print "Submitted: <b>" . gmdate("r", $row['Submitted']) . "</b> by ";
- print "<b>" . username_from_id($row['SubmitterID']) . "</b><br />\n";
-
- if ($isrunning == 0) {
- print "Ended: ";
- } else {
- print "Ends: ";
- }
- print "<b>" . gmdate("r", $row['End']) . "</b><br />\n";
-
- print "<br />\n";
-
- $row['Agenda'] = htmlentities($row['Agenda']);
- # str_replace seems better than <pre> because it still maintains word wrapping
- print str_replace("\n", "<br />\n", $row['Agenda']);
-
- print "<br />\n";
- print "<br />\n";
-
- print "<center>\n";
- print "<table cellspacing='3' class='boxSoft' style='width: 50%'>\n";
- print "</tr>\n";
- print "<tr>\n";
- print " <td class='boxSoft'>\n";
- print "<table width='100%' cellspacing='0' cellpadding='2'>\n";
-
- print "<tr>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Yes";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "No";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Abstain";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Total";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Voted?";
- print "</span></th>\n";
- print "</tr>\n";
-
- $c = "data1";
-
- print "<tr>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print $row['Yes'];
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print $row['No'];
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print $row['Abstain'];
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print ($row['Yes'] + $row['No'] + $row['Abstain']);
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
-
- if ($hasvoted == 0) {
- print "<span style='color: red; font-weight: bold'>No</span>";
- } else {
- print "<span style='color: green; font-weight: bold'>Yes</span>";
- }
-
- print "</span></span></td>\n";
- print "</tr>\n";
-
- print "</table>\n";
- print "</table>\n";
-
- echo "</div></div>\n";
-
- # Actions, vote buttons
- #
- print "<br />\n";
- print "<div class='pgbox'>\n";
- print "<div class='pgboxtitle'><span class='f3'>Vote Actions</span></div>\n";
- print "<div class='pgboxbody'>\n";
-
- if ($canvote == 1) {
- print "<center><form action='tu.php?id=" . $row['ID'] . "' method='post'>\n";
- print "<input type='submit' class='button' name='voteYes' value='Yes'>\n";
- print "<input type='submit' class='button' name='voteNo' value='No'>\n";
- print "<input type='submit' class='button' name='voteAbstain' value='Abstain'>\n";
- print "<input type='hidden' name='doVote' value='1'>\n";
- print "</form></center>\n";
- } else {
- print "<center>$errorvote</center>";
- }
-
- print "</div></div>\n";
- print "<br /><center><a href='tu.php'>Back</a></center>\n";
-
+ include("tu_details.php");
}
-
} else {
- print "Vote ID not valid.\n";
+ print __("Vote ID not valid.");
}
} else {
- # page listing applications being discussed, voted on and all those finished
- #
-
- # I guess there should be a function since I use this a few times
- function gen_results($offset, $limit, $sort, $by, $type="normal") {
-
- $dbh = db_connect();
-
- if (!empty($offset) AND is_numeric($offset)) {
- if ($offset >= 1) {
- $off = $offset;
- } else {
- $off = 0;
- }
- } else {
- $off = 0;
- }
-
- $q = "SELECT * FROM TU_VoteInfo";
-
- if ($type == "new") {
- $q.= " WHERE End > " . time();
- $application = "Current Votes";
- } else {
- $application = "All Votes";
- }
-
- $order = ($by == 'down') ? 'DESC' : 'ASC';
-
- # not much to sort, I'm unsure how to sort by username
- # when we only store the userid, someone come up with a nifty
- # way to do this
- #
- switch ($sort) {
- case 'sub':
- $q.= " ORDER BY Submitted $order";
- break;
- default:
- $q.= " ORDER BY Submitted $order";
- break;
- }
-
- if ($limit != 0) {
- $q.= " LIMIT " . $off . ", ". $limit;
- }
-
- $result = db_query($q, $dbh);
-
- if ($by == "down") {
- $by_next = "up";
- } else {
- $by_next = "down";
- }
-
- print "<center>\n";
- print "<table cellspacing='3' class='boxSoft'>\n";
- print "<tr>\n";
- print " <td class='boxSoftTitle' align='right'>\n";
- print " <span class='f3'>$application</span>\n";
- print " </td>\n";
- print "</tr>\n";
- print "<tr>\n";
- print " <td class='boxSoft'>\n";
- print "<table width='100%' cellspacing='0' cellpadding='2'>\n";
-
- print "<tr>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Proposal";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "<a href='?off=$off&sort=sub&by=$by_next'>Start</a>";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "End";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "User";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Yes";
- print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "No";
- print "</span></th>\n";
-# I'm not sure if abstains are necessary inthis view, it's just extra clutter
-# print " <th style='border-bottom: #666 1px solid; vertical-align:";
-# print " bottom'><span class='f2'>";
-# print "Abstain";
-# print "</span></th>\n";
- print " <th style='border-bottom: #666 1px solid; vertical-align:";
- print " bottom'><span class='f2'>";
- print "Voted?";
- print "</span></th>\n";
- print "</tr>\n";
-
- if (mysql_num_rows($result) == 0) {
- print "<tr><td align='center' colspan='0'>No results found.</td></tr>\n";
- } else {
- for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
- # Thankyou AUR
-
- # alright, I'm going to just have a "new" table and the
- # "old" table can just have every vote, works just as well
- # and probably saves on doing some crap
- #
-
- (($i % 2) == 0) ? $c = "data1" : $c = "data2";
- print "<tr>\n";
- print " <td class='".$c."'><span class='f4'><span class='blue'>";
-
- $prev_Len = 100;
-
- if (strlen($row["Agenda"]) >= $prev_Len) {
- $row["Agenda"] = htmlentities(substr($row["Agenda"], 0, $prev_Len)) . "... -";
- } else {
- $row["Agenda"] = htmlentities($row["Agenda"]) . " -";
- }
-
- print $row["Agenda"];
- print " <a href='/tu.php?id=" . $row['ID'] . "'>[More]</a>";
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- # why does the AUR use gmdate with formatting that includes the offset
- # to GMT?!
- print gmdate("j M y", $row["Submitted"]);
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print gmdate("j M y", $row["End"]);
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f6'><span class='blue'>";
-
- if (!empty($row['User'])) {
- print "<a href='packages.php?K=" . $row['User'] . "&SeB=m'>";
- print $row['User'] . "</a>";
- } else {
- print "N/A";
- }
-
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print $row['Yes'];
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- print $row['No'];
- print "</span></span></td>\n";
- print " <td class='".$c."'><span class='f5'><span class='blue'>";
- # See above
- # print $row['Abstain'];
- # print "</span></span></td>\n";
- # print " <td class='".$c."'><span class='f5'><span class='blue'>";
-
- $qvoted = "SELECT * FROM TU_Votes WHERE ";
- $qvoted.= "VoteID = " . $row['ID'] . " AND ";
- $qvoted.= "UserID = " . uid_from_sid($_COOKIE["AURSID"]);
- $hasvoted = mysql_num_rows(db_query($qvoted, $dbh));
-
- if ($hasvoted == 0) {
- print "<span style='color: red; font-weight: bold'>No</span>";
- } else {
- print "<span style='color: green; font-weight: bold'>Yes</span>";
- }
-
- print "</span></span></td>\n";
- print "</tr>\n";
- }
- }
+ $dbh = db_connect();
- print "</table>\n";
- print "</table>\n";
+ $offset = $_GET['off'];
+ $limit = $pp;
+ $by = $_GET['by'];
- if ($type == "old" AND $limit != 0) {
- $qnext = "SELECT ID FROM TU_VoteInfo";
- $nextresult = db_query($qnext, $dbh);
+ if (!empty($offset) AND is_numeric($offset)) {
+ if ($offset >= 1) {
+ $off = $offset;
+ } else {
+ $off = 0;
+ }
+ } else {
+ $off = 0;
+ }
- print "<table style='width: 90%'>\n";
+ $order = ($by == 'down') ? 'DESC' : 'ASC';
+ $lim = ($limit > 0) ? " LIMIT " . $off . ", " . $limit : "";
+ $by_next = ($by == "down") ? "up" : "down";
- if (mysql_num_rows($result)) {
- $sort = htmlentities($sort, ENT_QUOTES);
- $by = htmlentities($by, ENT_QUOTES);
+ $prev_Len = 100;
- print "<tr>\n";
- print "<td align='left'>\n";
- if ($off != 0) {
- $back = (($off - $limit) <= 0) ? 0 : $off - $limit;
- print "<a href='tu.php?off=$back&sort=" . $sort . "&by=" . $by . "'>Back</a>";
- }
- print "</td>\n";
+ $q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order;
+ $result = db_query($q, $dbh);
- print "<td align='right'>\n";
- if (($off + $limit) < mysql_num_rows($nextresult)) {
- $forw = $off + $limit;
- print "<a href='tu.php?off=$forw&sort=" . $sort . "&by=" . $by . "'>Next</a>";
- }
- print "</td>\n";
- print "</tr>\n";
- }
- print "</table>\n";
- }
+ $type = __("Current Votes");
+ include("tu_list.php");
+?>
- print "</center>\n";
- }
+<center>
+ <a href='addvote.php'><?php print __("Add") ?></a>
+</center><br />
- # stop notices, ythanku Xilon
- if (empty($_REQUEST['sort'])) { $_REQUEST['sort'] = ""; }
- if (empty($_REQUEST['by'])) { $_REQUEST['by'] = ""; }
- if (empty($_REQUEST['off'])) { $_REQUEST['off'] = ""; }
+<?php
+ $q = "SELECT * FROM TU_VoteInfo ORDER BY Submitted " . $order . $lim;
+ $result = db_query($q, $dbh);
- gen_results(0, 0, $_REQUEST['sort'], $_REQUEST['by'], "new");
- print "<center><a href='addvote.php'>Add</a></center><br />";
- gen_results($_REQUEST['off'], $pp, $_REQUEST['sort'], $_REQUEST['by'], "old");
+ $type = __("All Votes");
+ include("tu_list.php");
+ $qnext = "SELECT ID FROM TU_VoteInfo";
+ $nextresult = db_query($qnext, $dbh);
+?>
+<table style='width: 90%'>
+ <?php if (mysql_num_rows($result)) { $by = htmlentities($by, ENT_QUOTES); ?>
+ <tr>
+ <td align='left'>
+ <?php if ($off != 0) { $back = (($off - $limit) <= 0) ? 0 : $off - $limit; ?>
+ <a href='tu.php?off=<?php print $back ?>&amp;by=<?php print $by ?>'><?php print __("Back") ?></a>
+ <?php } ?>
+ </td>
+ <td align='right'>
+ <?php if (($off + $limit) < mysql_num_rows($nextresult)) { $forw = $off + $limit; ?>
+ <a href='tu.php?off=<?php print $forw ?>&amp;by=<?php print $by ?>'><?php print __("Next") ?></a>
+ <?php } ?>
+ </td>
+ </tr>
+ <?php } ?>
+</table>
+<?php
}
} else {
- print "You are not allowed to access this area.\n";
+ print __("You are not allowed to access this area.");
}
html_footer(AUR_VERSION);
-
-?>
diff --git a/web/template/tu_details.php b/web/template/tu_details.php
new file mode 100644
index 00000000..b1d69f6e
--- /dev/null
+++ b/web/template/tu_details.php
@@ -0,0 +1,62 @@
+<div class="pgbox">
+<div class="pgboxtitle"><span class="f3"><?php print __("Proposal Details") ?></span></div>
+<div class="pgboxbody">
+<?php if ($isrunning == 1) { ?>
+<div style='text-align: center; font-weight: bold; color: red'><?php print __("This vote is still running.") ?></div>
+<br />
+<?php } ?>
+User: <b>
+<?php if (!empty($row['User'])) { ?>
+<a href='packages.php?K=<?php print $row['User'] ?>&amp;SeB=m'><?php print $row['User'] ?></a>
+<?php } else { ?>
+N/A
+<?php } ?>
+</b><br />
+<?php print __("Submitted: %s by %s", "<b>" . gmdate("r", $row['Submitted']) . "</b>", "<b>" . username_from_id($row['SubmitterID']) . "</b>") ?><br />
+<?php print __("End: ") ?><b><?php print gmdate("r", $row['End']) ?></b><br /><br />
+<?php print str_replace("\n", "<br />\n", htmlentities($row['Agenda'])) ?><br /><br />
+<center>
+<table cellspacing='3' class='boxSoft' style='width: 50%'>
+</tr>
+<tr>
+<td class='boxSoft'>
+<table width='100%' cellspacing='0' cellpadding='2'>
+<tr>
+<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Yes") ?></span></th>
+<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("No") ?></span></th>
+<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Abstain") ?></span></th>
+<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Total") ?></span></th>
+<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Voted?") ?></span></th>
+</tr>
+<tr>
+<td class='data1'><span class='f5'><span class='blue'><?php print $row['Yes'] ?></span></span></td>
+<td class='data1'><span class='f5'><span class='blue'><?php print $row['No'] ?></span></span></td>
+<td class='data1'><span class='f5'><span class='blue'><?php print $row['Abstain'] ?></span></span></td>
+<td class='data1'><span class='f5'><span class='blue'><?php print ($row['Yes'] + $row['No'] + $row['Abstain']) ?></span></span></td>
+<td class='data1'><span class='f5'><span class='blue'>
+<?php if ($hasvoted == 0) { ?>
+<span style='color: red; font-weight: bold'><?php print __("No") ?></span>
+<?php } else { ?>
+<span style='color: green; font-weight: bold'><?php print __("Yes") ?></span>
+<?php } ?>
+</span></span></td>
+</tr>
+</table>
+</table>
+</div></div>
+<br />
+<div class='pgbox'>
+<div class='pgboxtitle'><span class='f3'><?php print __("Vote Actions") ?></span></div>
+<div class='pgboxbody'>
+<?php if ($canvote == 1) { ?>
+<center><form action='tu.php?id=<?php print $row['ID'] ?>' method='post'>
+<input type='submit' class='button' name='voteYes' value='<?php print __("Yes") ?>'>
+<input type='submit' class='button' name='voteNo' value='<?php print __("No") ?>'>
+<input type='submit' class='button' name='voteAbstain' value='<?php print __("Abstain") ?>'>
+<input type='hidden' name='doVote' value='1'>
+</form></center>
+<?php } else { ?>
+<center><?php print $errorvote ?></center>
+<?php } ?>
+</div></div>
+<br /><center><a href='tu.php'><?php print __("Back") ?></a></center>
diff --git a/web/template/tu_list.php b/web/template/tu_list.php
new file mode 100644
index 00000000..bec29850
--- /dev/null
+++ b/web/template/tu_list.php
@@ -0,0 +1,68 @@
+<center>
+<table cellspacing='3' class='boxSoft'>
+ <tr>
+ <td class='boxSoftTitle' align='right'>
+ <span class='f3'><?php print $type ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td class='boxSoft'>
+ <table width='100%' cellspacing='0' cellpadding='2'>
+ <tr>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Proposal") ?></span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
+ <a href='?off=<?php print $off ?>&amp;by=<?php print $by_next ?>'><?php print __("Start") ?></a>
+ </span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("End") ?></span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("User") ?></span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Yes") ?></span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("No") ?></span></th>
+ <th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'><?php print __("Voted?") ?></span></th>
+ </tr>
+ <?php if (mysql_num_rows($result) == 0) { ?>
+ <tr><td align='center' colspan='0'><?php print __("No results found.") ?></td></tr>
+ <?php } else { for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { (($i % 2) == 0) ? $c = "data1" : $c = "data2"; ?>
+ <tr>
+ <td class='<?php print $c ?>'><span class='f4'><span class='blue'>
+ <?php
+ if (strlen($row["Agenda"]) >= $prev_Len) {
+ $row["Agenda"] = htmlentities(substr($row["Agenda"], 0, $prev_Len)) . "... - ";
+ } else {
+ $row["Agenda"] = htmlentities($row["Agenda"]) . " - ";
+ }
+ ?>
+ <?php print $row["Agenda"] ?><a href='/tu.php?id=<?php print $row['ID'] ?>'>[<?php print __("More") ?>]</a></span></span>
+ </td>
+ <td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print gmdate("j M y", $row["Submitted"]) ?></span></span></td>
+ <td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print gmdate("j M y", $row["End"]) ?></span></span></td>
+ <td class='<?php print $c ?>'><span class='f6'><span class='blue'>
+ <?php
+ if (!empty($row['User'])) {
+ print "<a href='packages.php?K=" . $row['User'] . "&SeB=m'>" . $row['User'] . "</a>";
+ } else {
+ print "N/A";
+ }
+ ?>
+ </span></span></td>
+ <td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row['Yes'] ?></span></span></td>
+ <td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row['No'] ?></span></span></td>
+ <td class='<?php print $c ?>'>
+ <?php
+ $q = "SELECT * FROM TU_Votes WHERE VoteID = " . $row['ID'] . " AND UserID = " . uid_from_sid($_COOKIE["AURSID"]);
+ $hasvoted = mysql_num_rows(db_query($q, $dbh));
+ ?>
+ <span class='f5'><span class='blue'>
+ <?php if ($hasvoted == 0) { ?>
+ <span style='color: red; font-weight: bold'><?php print __("No") ?></span>
+ <?php } else { ?>
+ <span style='color: green; font-weight: bold'><?php print __("Yes") ?></span>
+ <?php } ?>
+ </span></span>
+ </td>
+ </tr>
+ <?php } } ?>
+ </table>
+ </td>
+ </tr>
+</table>
+</center>