]> err.no Git - scalable-opengroupware.org/commitdiff
disable delete button in mailviewer if deletion is not allowed
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Jul 2005 16:45:39 +0000 (16:45 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 6 Jul 2005 16:45:39 +0000 (16:45 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@672 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/MailerUI/ChangeLog
SOGo/UI/MailerUI/UIxMailToolbar.m
SOGo/UI/MailerUI/Version
SOGo/UI/MailerUI/product.plist
SOGo/UI/Templates/MailerUI/UIxMailToolbar.wox

index ce1bdbb7a498d9e3ee8c933ecad04fa7d223d3ba..56f072032c4dc575ef509e3fe6fa7454c3b46c10 100644 (file)
@@ -1,5 +1,13 @@
 2005-07-06  Helge Hess  <helge.hess@opengroupware.org>
 
+       * 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
index 4b217d367da11ca117f9016b4286b8c4dd757695..d2207629bffd2c072ad4cdacf0aebe5acc929c20 100644 (file)
@@ -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 <SOGoUI/UIxComponent.h>
 
   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 */
index 96d59ce041182b7f62f1f00587e6c353693cc44b..30a0105ca6400a26427b5660ce71c202690ba846 100644 (file)
@@ -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
index ae4559a3d5835516b1a16755ac588656b8fa4a9e..5cd3368e7cb1d8fb451b37d1cdb24685851cc2f4 100644 (file)
                 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";   },
 */
             ),
                 cssClass = "tbicon_getmail"; label = "Get Mail"; },
               {
                 link     = "#"; // "compose"; // target = "_blank";
+                isSafe   = NO;
                 onclick  = "clickedCompose(this);return false;";
                 cssClass = "tbicon_compose"; label = "Write";
               },
                 cssClass = "tbicon_getmail"; label = "Get Mail"; },
               {
                 link     = "#"; // "compose"; // target = "_blank";
+                isSafe = NO;
                 onclick  = "clickedCompose(this);return false;";
                 cssClass = "tbicon_compose"; label = "Write"; },
             )
           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";
               { 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"; },
             )
           );
index 09e715d848e20cc6ac7d343590490b2efc9351ad..e51bb6fb52b3ca7778f9ec76641c06f0da327487 100644 (file)
@@ -7,21 +7,27 @@
   xmlns:label="OGo:label"
   xmlns:so="http://www.skyrix.com/od/so-lookup"
 >
+  <!-- image row -->
   <tr>
     <var:foreach list="toolbarConfig" item="toolbarGroup">
       <var:foreach list="toolbarGroup" item="buttonInfo">
-        <td class="tb_icon"
+        <var:if condition="isButtonEnabled">
+          <td class="tb_icon"
             ><a var:href="buttonInfo.link" var:target="buttonInfo.target"
                var:class="buttonInfo.cssClass"
                 var:onclick="buttonInfo.onclick"></a></td>
+        </var:if>
       </var:foreach>
       <td class="tb_spacer"> </td>
     </var:foreach>
   </tr>
+  <!-- label row -->
   <tr>
     <var:foreach list="toolbarConfig" item="toolbarGroup">
       <var:foreach list="toolbarGroup" item="buttonInfo">
-        <td class="tb_label"><var:string value="buttonInfo.label" /></td>
+        <var:if condition="isButtonEnabled">
+          <td class="tb_label"><var:string value="buttonInfo.label" /></td>
+        </var:if>
       </var:foreach>
       <td class="tb_spacer"> </td>
     </var:foreach>