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>
This commit is contained in:
Callan Barrett 2008-10-06 06:09:06 +08:00 committed by Loui Chang
parent a0e75dbbfc
commit 34c8a9cf80
3 changed files with 203 additions and 371 deletions

View file

@ -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>

68
web/template/tu_list.php Normal file
View file

@ -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>