From d41e40d9d6598d13ac35c7301316e4dba481be4a Mon Sep 17 00:00:00 2001
From: Lukas Fleischer
Date: Sun, 4 Aug 2013 17:27:41 +0200
Subject: Add a vote type to the TU proposal form
There are only four valid reasons for starting a TU vote, so instead of
letting the user choose a vote length, let her pick a reason and set
vote length and quorum based on that selection.
Signed-off-by: Lukas Fleischer
---
web/html/addvote.php | 46 ++++++++++++++++++++++++++++++++++------------
1 file changed, 34 insertions(+), 12 deletions(-)
(limited to 'web/html')
diff --git a/web/html/addvote.php b/web/html/addvote.php
index 43973f32..3ce99c0b 100644
--- a/web/html/addvote.php
+++ b/web/html/addvote.php
@@ -37,16 +37,34 @@ if ($atype == "Trusted User" || $atype == "Developer") {
}
}
- if (!empty($_POST['length'])) {
- if (!is_numeric($_POST['length'])) {
- $error.= __("Length must be a number.") ;
- } else if ($_POST['length'] < 1) {
- $error.= __("Length must be at least 1.");
- } else {
- $len = (60*60*24)*$_POST['length'];
+ if (!empty($_POST['type'])) {
+ switch ($_POST['type']) {
+ case "add_tu":
+ /* Addition of a TU */
+ $len = 7 * 24 * 60 * 60;
+ $quorum = 0.66;
+ break;
+ case "remove_tu":
+ /* Removal of a TU */
+ $len = 7 * 24 * 60 * 60;
+ $quorum = 0.75;
+ break;
+ case "remove_inactive_tu":
+ /* Removal of a TU (undeclared inactivity) */
+ $len = 5 * 24 * 60 * 60;
+ $quorum = 0.66;
+ break;
+ case "bylaws":
+ /* Amendment of Bylaws */
+ $len = 7 * 24 * 60 * 60;
+ $quorum = 0.75;
+ break;
+ default:
+ $error.= __("Invalid type.") ;
+ break;
}
} else {
- $len = 60*60*24*7;
+ $error.= __("Invalid type.") ;
}
if (empty($_POST['agenda'])) {
@@ -55,7 +73,7 @@ if ($atype == "Trusted User" || $atype == "Developer") {
}
if (!empty($_POST['addVote']) && empty($error)) {
- add_tu_proposal($_POST['agenda'], $_POST['user'], $len, $uid);
+ add_tu_proposal($_POST['agenda'], $_POST['user'], $len, $quorum, $uid);
print "" . __("New proposal submitted.") . "
\n";
} else {
@@ -75,9 +93,13 @@ if ($atype == "Trusted User" || $atype == "Developer") {
= __("(empty if not applicable)") ?>
-
-
- = __("(defaults to 7 if empty)") ?>
+
+
--
cgit v1.2.3-24-g4f1b