diff --git a/css/base.css b/css/base.css
index 056b021..d476f14 100644
--- a/css/base.css
+++ b/css/base.css
@@ -54,6 +54,10 @@ button:focus {
outline: 2px solid var(--subtext);
}
+input[type="number"] {
+ width: 50px;
+}
+
input::placeholder,
i,
.gray {
diff --git a/index.php b/index.php
index f302da1..2f82807 100644
--- a/index.php
+++ b/index.php
@@ -119,6 +119,29 @@ if ($user === false) {
}
}
}
+ } else if ($intent === "set-threshold") {
+ $yellow = (int) $_POST["yellow"];
+ $gray = (int) $_POST["gray"];
+
+ if ($yellow <= 0) {
+ $yellow = -1;
+ }
+
+ if ($gray < 0) {
+ $gray = -1;
+ }
+
+ pg_update(
+ $db, "user",
+ array(
+ "yellow_threshold" => $yellow,
+ "gray_threshold" => $gray
+ ),
+ array("id" => $user["id"])
+ );
+
+ $user["yellow_threshold"] = $yellow;
+ $user["gray_threshold"] = $gray;
} else if ($intent === "change-password") {
$old_pw = $_POST["old"];
$new_pw = $_POST["new"];
@@ -235,7 +258,18 @@ foreach ($sections as $section) {
$todo_list .= "
{$lang['list']['none']}";
} else {
foreach ($items as $item) {
- $color = "red";
+ $current_time = time();
+ $for_time = strtotime($item["date"]);
+
+ if ($current_time > $for_time) {
+ $color = "red";
+ } else if ($user["yellow_threshold"] !== -1 && $current_time > $for_time - (60 * 60 * 24 * $user["yellow_threshold"])) {
+ $color = "yellow";
+ } else if ($user["gray_threshold"] !== -1 && $current_time < $for_time - (60 * 60 * 24 * $user["gray_threshold"])) {
+ $color = "gray";
+ } else {
+ $color = "";
+ }
$todo_list .= "" . str_replace(
"%d", htmlspecialchars($item["description"]), str_replace(
@@ -342,6 +376,34 @@ foreach ($sections as $section) {
+
+
{$user['username']}", $lang["settings"]["account"]["current"]); ?>
diff --git a/lang/en-US.json b/lang/en-US.json
index f8d6c55..4b65249 100644
--- a/lang/en-US.json
+++ b/lang/en-US.json
@@ -83,6 +83,19 @@
"save": "Save"
},
+ "cosmetic": {
+ "threshold": {
+ "yellow": "Yellow:",
+ "gray": "Gray:",
+ "days_less": "%n days or less",
+ "days_more": "%n days or more",
+ "disable": "Set to -1 to disable",
+ "button": "Save"
+ },
+
+ "title": "Cosmetic Options"
+ },
+
"account": {
"password": {
"title": "Change Password",