character set fix
[cacert-boardvoting.git] / motions.php
index 2f56af4..90899b6 100644 (file)
@@ -3,9 +3,10 @@
        $db = new DB();
        $db->closeVotes();
        $page = is_numeric($_REQUEST['page'])?$_REQUEST['page']:1;
+       $user = $db->auth();
 
        if ($_REQUEST['withdrawl'] && $_REQUEST['confirm'] && $_REQUEST['id']) {
-               if (!($user = $db->auth())) {
+               if (!$user) {
                        header("HTTP/1.0 302 Redirect");
                        header("Location: denied.php");
                        exit();
@@ -44,6 +45,9 @@ BODY;
                <link rel="stylesheet" type="text/css" href="styles.css" />
        </head>
        <body>
+       <?php
+               if ($user) echo '<a href="?unvoted=1">Show my outstanding votes</a><br/>'; 
+       ?>
                <table class="list">
                        <tr>
                                <th>Status</th>
@@ -55,8 +59,14 @@ BODY;
                                        $stmt = $db->getStatement("list decision");
                                        $stmt->execute(array($_REQUEST['motion']));
                                } else {
-                                       $stmt = $db->getStatement("list decisions");
-                                       $stmt->execute(array($page));
+                                       if ($user && $_REQUEST['unvoted']) {
+                                               $stmt = $db->getStatement("list my unvoted decisions");
+                                               $stmt->bindParam(":id",$user['id']);
+                                       } else {
+                                               $stmt = $db->getStatement("list decisions");
+                                       }
+                                       $stmt->bindParam(":page",$page);
+                                       $stmt->execute();
                                }
                                $items = 0;
                                $id = -1;
@@ -75,14 +85,13 @@ BODY;
                                                ?>
                                                </td>
                                                <td>
-                                               <i><a href="motions.php?id=<?php echo $row['tag'].'">'.$row['tag']; ?></a></i><br/>
-                                               <b><?php echo htmlentities($row['title']); ?></b><br/>
+                                               <i><a href="motions.php?motion=<?php echo $row['tag'].'">'.$row['tag']; ?></a></i><br/>
+                                               <b><?php echo htmlspecialchars($row['title']); ?></b><br/>
                                                <pre><?php echo htmlspecialchars($row['content']); ?></pre>
                                                <br/>
                                                <i>Due: <?php echo($row['due']); ?> UTC</i><br/>
                                                <i>Proposed: <?php echo($row['proposer']); ?> (<?php echo($row['proposed']); ?> UTC)</i><br/>
-                                               <i>Required Votes: <?php echo($row['quorum']); ?></i><br/>
-                                               <i>Majority: <?php echo($row['majority']); ?>%</i><br/>
+                                               <i>Vote type: <?php echo(!$row['votetype']?'motion':'veto'); ?></i><br/>
                                                <i>Aye|Naye|Abstain: <?php echo($row['ayes']); ?>|<?php echo($row['nayes']); ?>|<?php echo($row['abstains']); ?></i><br/>
                                        <?php
                                                if ($row['status'] ==0 || $_REQUEST['showvotes']) {