From fbc87572e9582a8e5eab710e076fdf49e29ba0f7 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 26 May 2024 23:38:50 +0100 Subject: [PATCH] Calendar start day Allow customising the calendar to start on a Monday instead of Sunday --- calendar_events.php | 10 +++++++++- database_updates.php | 12 +++++++++--- database_version.php | 2 +- db.sql | 1 + post/profile.php | 9 ++++++++- user_preferences.php | 24 ++++++++++++++++++++---- 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/calendar_events.php b/calendar_events.php index 68bc44c46..e8f7eac4f 100644 --- a/calendar_events.php +++ b/calendar_events.php @@ -261,6 +261,14 @@ ?> ], eventOrder: 'allDay,start,-duration,title', + + + firstDay: , }); calendar.render(); @@ -293,4 +301,4 @@ function updateIncrementEndTime() { // Update the end date field document.getElementById("event_add_end").value = new_end; } - \ No newline at end of file + diff --git a/database_updates.php b/database_updates.php index 7bff938b3..416606735 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1912,10 +1912,16 @@ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.1'"); } - // if (CURRENT_DATABASE_VERSION == '1.3.1') { - // // Insert queries here required to update to DB version 1.3.1 + if (CURRENT_DATABASE_VERSION == '1.3.1') { + mysqli_query($mysqli, "ALTER TABLE `user_settings` ADD `user_config_calendar_first_day` TINYINT(1) NOT NULL DEFAULT 0 AFTER `user_config_dashboard_technical_enable`"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.2'"); + } + + // if (CURRENT_DATABASE_VERSION == '1.3.2') { + // // Insert queries here required to update to DB version 1.3.2 // // Then, update the database to the next sequential version - // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.2'"); + // mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '1.3.3'"); // } } else { diff --git a/database_version.php b/database_version.php index e55dd88e0..c976e9a15 100644 --- a/database_version.php +++ b/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "1.3.1"); +DEFINE("LATEST_DATABASE_VERSION", "1.3.2"); diff --git a/db.sql b/db.sql index 4059d7118..81dc9df44 100644 --- a/db.sql +++ b/db.sql @@ -1822,6 +1822,7 @@ CREATE TABLE `user_settings` ( `user_config_records_per_page` int(11) NOT NULL DEFAULT 10, `user_config_dashboard_financial_enable` tinyint(1) NOT NULL DEFAULT 0, `user_config_dashboard_technical_enable` tinyint(1) NOT NULL DEFAULT 0, + `user_config_calendar_first_day` tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/post/profile.php b/post/profile.php index 9bfc3dcc9..d03a53ef6 100644 --- a/post/profile.php +++ b/post/profile.php @@ -144,11 +144,18 @@ header('Location: post.php?logout'); } -if (isset($_POST['edit_your_user_browser_extention'])) { +if (isset($_POST['edit_your_user_preferences'])) { // CSRF Check validateCSRFToken($_POST['csrf_token']); + $calendar_first_day = intval($_POST['calendar_first_day']); + + // Calendar + if (isset($calendar_first_day)) { + mysqli_query($mysqli, "UPDATE user_settings SET user_config_calendar_first_day = $calendar_first_day WHERE user_id = $session_user_id"); + } + // Enable extension access, only if it isn't already setup (user doesn't have cookie) if (isset($_POST['extension']) && $_POST['extension'] == 'Yes') { if (!isset($_COOKIE['user_extension_key'])) { diff --git a/user_preferences.php b/user_preferences.php index 1c5b29761..77426f7f7 100644 --- a/user_preferences.php +++ b/user_preferences.php @@ -1,30 +1,46 @@
-

Browser Extension

+

Preferences

+
+ +
+
+ +
+ +
+
+ 1) { ?>
- > + > -

Note: You must log out and back in again for these changes take effect.

+

Not currently in use / Note: You must log out and back in again for these changes take effect.

- +