blob: 7784e23d4443f48ba1a6fe5e7755395672f53ab7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
<?php
require_once("database.php");
$db = new DB();
$db->closeVotes();
$page = is_numeric($_REQUEST['page'])?$_REQUEST['page']:1;
?>
<html>
<head>
<title>CAcert Board Decisions</title>
<meta http-equiv="Content-Type" content="text/html; charset='UTF-8'" />
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<table class="list">
<tr>
<th>Status</th>
<th>Motion</th>
<th>Actions</th>
</tr>
<?php
if ($_REQUEST['withdrawl'] && $_REQUEST['confirm'] && $_REQUEST['id']) {
$stmt = $db->getStatement("close decision");
$status = -2;
$stmt->bindParam(":status",$status);
$stmt->bindParam(":decision",$_REQUEST['id']);
$stmt->execute();
}
if ($_REQUEST['motion']) {
$stmt = $db->getStatement("list decision");
$stmt->execute(array($_REQUEST['motion']));
} else {
$stmt = $db->getStatement("list decisions");
$stmt->execute(array($page));
}
$items = 0;
$id = -1;
while ($row = $stmt->fetch()) {
$items++;
$id = $row['id'];
?><tr>
<td class="<?php switch($row['status']) { case 0: echo "pending"; break; case 1: echo "approved"; break; case -1: echo "declined"; break; case -2: echo "withdrawn"; break; }?>">
<?php
switch($row['status']) {
case 0: echo "Pending<br/><i>".$row['due']." UTC</i>"; break;
case 1: echo "Approved<br/><i>".$row['modified']." UTC</i>"; break;
case -1: echo "Declined<br/><i>".$row['modified']." UTC</i>"; break;
case -2: echo "Withdrawn<br/><i>".$row['modified']." UTC</i>"; break;
}
?>
</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/>
<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>Aye|Naye|Abstain: <?php echo($row['ayes']); ?>|<?php echo($row['nayes']); ?>|<?php echo($row['abstains']); ?></i><br/>
<?php
if ($row['status'] ==0 || $_REQUEST['showvotes']) {
$state = array('Naye','Abstain','Aye');
$vstmt = $db->getStatement("list votes");
$vstmt->execute(array($row['id']));
echo "<i>Votes:</i><br/>";
while ($vrow = $vstmt->fetch()) {
echo "<i>".$vrow['name']." ".$state[$vrow['vote']+1]."</i><br/>";
}
} else {
echo '<i><a href="motions.php?motion='.$row['tag'].'&showvotes=1">Show Votes</a></i><br/>';
}
?>
</td>
<td class="actions">
<?php
if ($row['status'] == 0) {
?>
<ul>
<li><a href="vote.php?motion=<?php echo($row['id']); ?>&vote=1">Aye</a></li>
<li><a href="vote.php?motion=<?php echo($row['id']); ?>&vote=0">Abstain</a></li>
<li><a href="vote.php?motion=<?php echo($row['id']); ?>&vote=-1">Naye</a></li>
<li><a href="proxy.php?motion=<?php echo($row['id']); ?>">Proxy Vote</a></li>
<li><a href="motion.php?motion=<?php echo($row['id']); ?>">Modify</a></li>
<li><a href="motions.php?motion=<?php echo($row['tag']); ?>&withdrawl=1">Withdrawl</a></li>
</ul>
<?php
} else {
?>
<?php
}
?>
</td>
</tr><?php
}
?>
<tr>
<td colspan="2" class="navigation">
<?php if ($page>1) { ?><a href="?page=<?php echo($page-1); ?>"><</a><?php } else { ?> <?php } ?>
<?php if ($items>9) { ?><a href="?page=<?php echo($page+1); ?>">></a><?php } else { ?> <?php } ?>
</td>
<td class="actions">
<ul>
<li><a href="motion.php">New Motion</a></li>
</ul>
</td>
</tr>
<?php
if ($_REQUEST['withdrawl']) {
?>
<tr>
<td colspan="3">
<?php
if ($_REQUEST['confirm'] && $_REQUEST['id']) {
?>
<a href="motions.php">Motion Withdrawn</a>
<?php
} else {
?>
<form action="?withdrawl=1&confirm=1&id=<?php echo $id;?>" method="post">
<input type="submit" value="Withdrawl">
</form>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</table>
</body>
</html>
|