From a6247cfebca9343aa008a0c0ad864adab36b96b6 Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 6 Jul 2005 16:45:39 +0000 Subject: [PATCH] disable delete button in mailviewer if deletion is not allowed git-svn-id: http://svn.opengroupware.org/SOGo/trunk@672 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/MailerUI/ChangeLog | 8 ++++++++ SOGo/UI/MailerUI/UIxMailToolbar.m | 16 ++++++++++++++-- SOGo/UI/MailerUI/Version | 2 +- SOGo/UI/MailerUI/product.plist | 19 ++++++++++++++----- SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox | 10 ++++++++-- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index ce1bdbb7..56f07203 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,5 +1,13 @@ 2005-07-06 Helge Hess + * v0.9.125 + + * UIxMailToolbar.m: added ability to disable toolbar buttons in case an + operation is not allowed (eg an object got deleted) + + * product.plist: added 'isSafe=NO' markers to unsafe HTTP methods in + toolbar, added 'enabled' binding for 'delete' button + * v0.9.124 * UIxMailView.m: improved error handling in case the delete flag could diff --git a/SOGo/UI/MailerUI/UIxMailToolbar.m b/SOGo/UI/MailerUI/UIxMailToolbar.m index 4b217d36..d2207629 100644 --- a/SOGo/UI/MailerUI/UIxMailToolbar.m +++ b/SOGo/UI/MailerUI/UIxMailToolbar.m @@ -1,5 +1,5 @@ /* - Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2004-2005 SKYRIX Software AG This file is part of OpenGroupware.org. @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #include @@ -122,4 +121,17 @@ return label; } +/* enable/disable buttons */ + +- (BOOL)isButtonEnabled { + // TODO: replace 'enabled' with WOAssociation when this gets a dynamic + // element + NSString *onOffKey; + + if ((onOffKey = [[self buttonInfo] valueForKey:@"enabled"]) == nil) + return YES; + + return [[[[self context] page] valueForKeyPath:onOffKey] boolValue]; +} + @end /* UIxMailToolbar */ diff --git a/SOGo/UI/MailerUI/Version b/SOGo/UI/MailerUI/Version index 96d59ce0..30a0105c 100644 --- a/SOGo/UI/MailerUI/Version +++ b/SOGo/UI/MailerUI/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=123 +SUBMINOR_VERSION:=125 # v0.9.100 requires libNGMime v4.5.213 # v0.9.99 requires libNGMime v4.5.212 diff --git a/SOGo/UI/MailerUI/product.plist b/SOGo/UI/MailerUI/product.plist index ae4559a3..5cd3368e 100644 --- a/SOGo/UI/MailerUI/product.plist +++ b/SOGo/UI/MailerUI/product.plist @@ -196,23 +196,30 @@ cssClass = "tbicon_getmail"; label = "Get Mail"; }, { link = "#"; // "compose"; // target = "_blank"; + isSafe = NO; onclick = "clickedCompose(this);return false;"; cssClass = "tbicon_compose"; label = "Write"; }, ), ( // second group { link = "reply"; + isSafe = NO; cssClass = "tbicon_reply"; label = "Reply"; }, { link = "replyall"; + isSafe = NO; cssClass = "tbicon_replyall"; label = "Reply All"; }, { link = "forward"; + isSafe = NO; cssClass = "tbicon_forward"; label = "Forward"; }, ), ( // third group - { link = "delete"; + { link = "delete"; + isSafe = NO; + enabled = clientObject.isDeletionAllowed; cssClass = "tbicon_delete"; label = "Delete"; }, /* TODO: enable when we know how to mark junk (#971) { link = "#"; + isSafe = NO; cssClass = "tbicon_junk"; label = "Junk"; }, */ ), @@ -312,6 +319,7 @@ cssClass = "tbicon_getmail"; label = "Get Mail"; }, { link = "#"; // "compose"; // target = "_blank"; + isSafe = NO; onclick = "clickedCompose(this);return false;"; cssClass = "tbicon_compose"; label = "Write"; }, @@ -355,6 +363,7 @@ cssClass = "tbicon_getmail"; label = "Get Mail"; }, { link = "#"; // "compose"; // target = "_blank"; + isSafe = NO; onclick = "clickedCompose(this);return false;"; cssClass = "tbicon_compose"; label = "Write"; }, ) @@ -388,7 +397,7 @@ protectedBy = "View"; value = ( /* the toolbar groups */ ( /* first group */ - { link = "#"; + { link = "#"; isSafe = NO; onclick = "clickedEditorSend(this);return false;"; cssClass = "tbicon_send"; label = "Send"; }, { link = "#"; target = "addressbook"; @@ -397,13 +406,13 @@ { link = "#"; target = "anais"; onclick = "openAnais(this);return false;"; cssClass = "tbicon_addressbook"; label = "Anais"; }, - { link = "#"; + { link = "#"; isSafe = NO; onclick = "clickedEditorAttach(this)"; cssClass = "tbicon_attach"; label = "Attach"; }, - { link = "#"; + { link = "#"; isSafe = NO; onclick = "clickedEditorSave(this);return false;"; cssClass = "tbicon_save"; label = "Save"; }, - { link = "delete"; + { link = "delete"; isSafe = NO; cssClass = "tbicon_delete"; label = "Delete"; }, ) ); diff --git a/SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox b/SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox index 09e715d8..e51bb6fb 100644 --- a/SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox +++ b/SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox @@ -7,21 +7,27 @@ xmlns:label="OGo:label" xmlns:so="http://www.skyrix.com/od/so-lookup" > + - + + + - + + + -- 2.39.2