From a476a06108a43157a092f4af11b3baea48cf29b3 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Mon, 18 Sep 2023 12:36:34 -0400 Subject: [PATCH 1/2] Issue #335: Default access type should be configurable #335 - Changed to admin.php and pref.php to support setting a system-wide default and allowing each user to override with a personal setting --- admin.php | 29 +++++++++++++++++++++++++---- edit_entry.php | 4 +++- includes/js/admin.js | 11 +++++++++++ pref.php | 27 +++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/admin.php b/admin.php index a1bcdb2b5..332b0058e 100644 --- a/admin.php +++ b/admin.php @@ -360,9 +360,30 @@ function save_pref ( $prefs, $src ) { . translate ( 'Weekend starts on' ) . ': -
' . print_radio ( 'TIME_FORMAT', +
'; + + echo '
'; + echo '
'; + + echo '
' . print_radio ( 'TIME_FORMAT', ['12' => translate ( '12 hour' ), '24' => translate ( '24 hour' )] ) . '
' - . print_radio ( 'DISABLE_ACCESS_FIELD' ) . '
+ . print_radio ( 'DISABLE_ACCESS_FIELD', '', "disable_access_handler" ) . '
' . print_radio ( 'DISABLE_PARTICIPANTS_FIELD' ) . '
diff --git a/edit_entry.php b/edit_entry.php index b072654de..0f65c7552 100644 --- a/edit_entry.php +++ b/edit_entry.php @@ -431,7 +431,9 @@ function time_selection($prefix, $time = '', $trigger = false) } $cal_time = ($hour * 10000) + (isset($minute) ? $minute * 100 : 0); -if (empty($access)) +if (empty($access) && isset($DEFAULT_VISIBILITY)) + $access = $DEFAULT_VISIBILITY; +else if (empty($access)) $access = ''; if (empty($cal_url)) diff --git a/includes/js/admin.js b/includes/js/admin.js index 0edb04297..ee468da30 100644 --- a/includes/js/admin.js +++ b/includes/js/admin.js @@ -7,6 +7,7 @@ function init_admin() { popup_handler(); public_handler(); sr_handler(); + disable_access_handler(); return true; } @@ -182,6 +183,16 @@ function email_handler() { } } +// Gets called when the user changes the selection from "Disable Access" +function disable_access_handler () { + if ($('#admin_DISABLE_ACCESS_FIELD_N').is(':checked')) { + $('#default_visibility_div').show(); + } else { + $('#default_visibility_div').hide(); + } +} + + function showPreview() { var theme = document.forms['prefform'].admin_THEME.value.toLowerCase(); diff --git a/pref.php b/pref.php index b91eac708..316f1a352 100644 --- a/pref.php +++ b/pref.php @@ -385,6 +385,33 @@ function save_pref( $prefs, $src) {   +"> + + + "> Date: Mon, 18 Sep 2023 16:10:39 -0400 Subject: [PATCH 2/2] Issue #417: edit_entry.php shows date selection instead of time selection --- edit_entry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit_entry.php b/edit_entry.php index 0f65c7552..066c08056 100644 --- a/edit_entry.php +++ b/edit_entry.php @@ -777,7 +777,7 @@ function time_selection($prefix, $time = '', $trigger = false) - +