From c0a2d6a7ee8a9162dc1de0a213173764190bd52f Mon Sep 17 00:00:00 2001 From: Florian Schlichting Date: Fri, 30 Dec 2016 17:48:27 +0100 Subject: [PATCH] do not show edit buttons on admin pages when not allowed to edit --- inc/ui/collection-edit.php | 49 +++++++++++++++++++++++++------------- inc/ui/principal-edit.php | 39 ++++++++++++++++++++---------- 2 files changed, 59 insertions(+), 29 deletions(-) diff --git a/inc/ui/collection-edit.php b/inc/ui/collection-edit.php index 9e62356b..9ac41b49 100644 --- a/inc/ui/collection-edit.php +++ b/inc/ui/collection-edit.php @@ -90,7 +90,7 @@ if ( $can_write_collection && $editor->IsSubmit() ) { $c->messages[] = i18n("Creating new Collection."); } else { - $c->messages[] = i18n("Updating Collection record."); + $c->messages[] = i18n("Updating Collection."); } if ( !$editor->Write() ) { $c->messages[] = i18n("Failed to write collection."); @@ -128,7 +128,7 @@ if ( $can_write_collection && $editor->IsSubmit() ) { else { if ( $id > 0 ) $editor->GetRecord(); if ( $editor->IsSubmit() ) { - $c->messages[] = i18n('You do not have permission to modify this record.'); + $c->messages[] = i18n('You do not have permission to modify this collection.'); } } if ( $editor->Available() ) { @@ -233,6 +233,25 @@ $btn_fb = htmlspecialchars(translate('Free/Busy')); $btn_fb_title = htmls $btn_sd = htmlspecialchars(translate('Schedule Deliver')); $btn_sd_title = htmlspecialchars(translate('Privileges to allow delivery of scheduling messages')); $btn_ss = htmlspecialchars(translate('Schedule Send')); $btn_ss_title = htmlspecialchars(translate('Privileges to delegate scheduling decisions')); +if ($can_write_collection || ! $id > 0) { + $privileges_row = << + + + +
$privileges_set +EOPRIV; + $submit_row = ' ##submit## '; +} else { + $privileges_row = collection_privilege_format_function( $editor->Value('default_privileges') ); + $privileges_row = '
' . $privileges_row . '
'; + $submit_row = ''; +} $id = $editor->Value('collection_id'); $template = << $prompt_addressbook: ##is_addressbook.checkbox## $prompt_privileges:##use_default_privs.checkbox##      
- - - - -
$privileges_set
+ $privileges_row + $prompt_timezone: ##timezone.select## $prompt_schedule_transp: ##schedule_transp.select## $prompt_description: ##description.textarea.78x6## - ##submit## + $submit_row