]> err.no Git - scalable-opengroupware.org/commitdiff
made toolbars context sensitive and configurable
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Oct 2004 15:15:52 +0000 (15:15 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Oct 2004 15:15:52 +0000 (15:15 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@359 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/GNUmakefile
SOGo/UI/Mailer/UIxMailListView.m
SOGo/UI/Mailer/UIxMailListView.wox
SOGo/UI/Mailer/UIxMailMainFrame.wox
SOGo/UI/Mailer/UIxMailToolbar.m [new file with mode: 0644]
SOGo/UI/Mailer/UIxMailToolbar.wox [new file with mode: 0644]
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/product.plist

index 6504db88615f91fba53d0b4d235e0a2708bcd7ff..6da63f7094c20036042885296b0193a980bd0da3 100644 (file)
@@ -1,5 +1,14 @@
 2004-10-05  Helge Hess  <helge.hess@opengroupware.org>
 
+       * v0.9.21
+
+       * UIxMailTree: made toolbar configurable using 'toolbar' slot on the
+         clientObject
+
+       * product.plist: added toolbar configurations
+
+       * UIxMailMainFrame.wox: moved toolbar to own component
+
        * UIxMailListView: added simple navigation (v0.9.20)
 
        * v0.9.19
index aacadd4e0c8d7a0e5b3e136815e6ed915116046e..6c2c8cc476b231b93a8e2f92146231a419be8c2a 100644 (file)
@@ -19,6 +19,7 @@ MailerUI_OBJC_FILES += \
        \
        UIxMailMainFrame.m      \
        UIxMailTree.m           \
+       UIxMailToolbar.m        \
        \
        UIxMailAccountsView.m   \
        UIxMailAccountView.m    \
@@ -39,6 +40,7 @@ MailerUI_RESOURCE_FILES += \
 MailerUI_RESOURCE_FILES += \
        UIxMailMainFrame.wox    \
        UIxMailTree.wox         \
+       UIxMailToolbar.wox      \
        \
        UIxMailAccountsView.wox \
        UIxMailAccountView.wox  \
index c597fbd0fceb4535240ad81a388bfbca65e0034b..99736d0cd6dc7d3b50355c782b044f1268092eaa 100644 (file)
 }
 
 - (NSString *)imap4SortKey {
+  NSString *sort;
+  
+  sort = [[[self context] request] formValueForKey:@"sort"];
+  
   return @"SUBJECT";
 }
 
index adee279d574b437e30bc190fdf2d3fc571d34fd3..2554e2262960ce5ddbf1161f6a537ce400ac55d6 100644 (file)
          <!-- TODO: see AB for sorting -->
           
           <td class="tbtv_headercell" width="60%">
-           <a href="?sort=subject"><var:string label:value="Subject" /></a>
+           <a href="view" _sort="subject"><var:string label:value="Subject" /></a>
           </td>
           <td class="tbtv_headercell">
             <var:if condition="showToAddress" const:negate="YES">
-              <a href="?sort=from"><var:string label:value="From" /></a>
+              <a href="view" _sort="from"><var:string label:value="From" /></a>
             </var:if>
             <var:if condition="showToAddress">
-              <a href="?sort=to"><var:string label:value="To" /></a>
+              <a href="view" _sort="to"><var:string label:value="To" /></a>
             </var:if>
           </td>
           <td class="tbtv_headercell" width="17">
@@ -43,7 +43,7 @@
             <img rsrc:src="icon_read.gif" />
           </td>
           <td class="tbtv_headercell">
-            <a href="?sort=date"><var:string label:value="Date" /></a>
+            <a href="view" _sort="date"><var:string label:value="Date" /></a>
           </td>
         </tr>
         <tr class="tableview">
index 5bcc5ac1db76511c84916a6339d1cc09876c0004..108b1021e903d64a1ffbbd36b74f49ede4708411 100644 (file)
       <!-- this table is required for right alignment -->
       <tr>
         <td valign="top" class="vertframerow">
-          <table border="0">
-            <tr>
-              <td class="tb_icon"
-                  ><a href="getMail" class="tbicon_getmail"> </a></td>
-              <td class="tb_icon"><a href="compose" target="_blank" 
-                  class="tbicon_compose"> </a></td>
-              <td class="tb_icon"><a href="addressbook" target="addressbook"
-                  class="tbicon_addressbook"> </a></td>
-              <td class="tb_spacer"> </td>
-
-              <!-- TODO: should do a form submit? -->
-              <td class="tb_icon"><a href="#" class="tbicon_reply"   > </a></td>
-              <td class="tb_icon"><a href="#" class="tbicon_replyall"> </a></td>
-              <td class="tb_icon"><a href="#" class="tbicon_forward" > </a></td>
-              <td class="tb_spacer"> </td>
-
-              <td class="tb_icon"><a href="#" class="tbicon_delete"> </a></td>
-              <td class="tb_icon"><a href="#" class="tbicon_junk"  > </a></td>
-              <td class="tb_spacer"> </td>
-
-              <td class="tb_icon"><a href="#" class="tbicon_print"> </a></td>
-              <td class="tb_icon"><a href="#" class="tbicon_stop" > </a></td>
-            </tr>
-            <tr>
-              <td class="tb_label">Get Mail</td>
-              <td class="tb_label">Write</td>
-              <td class="tb_label">Address Book</td>
-              <td class="tb_spacer"> </td>
-              <td class="tb_label">Reply</td>
-              <td class="tb_label">Reply All</td>
-              <td class="tb_label">Forward</td>
-              <td class="tb_spacer"> </td>
-              <td class="tb_label">Delete</td>
-              <td class="tb_label">Junk</td>
-              <td class="tb_spacer"> </td>
-              <td class="tb_label">Print</td>
-              <td class="tb_label">Stop</td>
-            </tr>
-          </table>
+          <var:component className="UIxMailToolbar" />
         </td>
         <td align="right" width="80" class="vertframerow">
           <table border="0">
diff --git a/SOGo/UI/Mailer/UIxMailToolbar.m b/SOGo/UI/Mailer/UIxMailToolbar.m
new file mode 100644 (file)
index 0000000..82a6d0c
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+  Copyright (C) 2004 SKYRIX Software AG
+
+  This file is part of OpenGroupware.org.
+
+  OGo is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with OGo; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+// $Id$
+
+#include <SOGoUI/UIxComponent.h>
+
+@class NSArray, NSDictionary;
+
+@interface UIxMailToolbar : UIxComponent
+{
+  NSArray      *toolbarConfig;
+  NSArray      *toolbarGroup;
+  NSDictionary *buttonInfo;
+}
+@end
+
+#include <SOGo/SoObjects/Mailer/SOGoMailBaseObject.h>
+#include "common.h"
+#include <NGObjWeb/SoComponent.h>
+
+@implementation UIxMailToolbar
+
+- (void)dealloc {
+  [self->toolbarGroup  release];
+  [self->toolbarConfig release];
+  [self->buttonInfo    release];
+  [super dealloc];
+}
+
+/* notifications */
+
+- (void)sleep {
+  [self->toolbarGroup  release]; self->toolbarGroup  = nil;
+  [self->toolbarConfig release]; self->toolbarConfig = nil;
+  [self->buttonInfo    release]; self->buttonInfo    = nil;
+  [super sleep];
+}
+
+/* accessors */
+
+- (void)setToolbarGroup:(id)_group {
+  ASSIGN(self->toolbarGroup, _group);
+}
+- (id)toolbarGroup {
+  return self->toolbarGroup;
+}
+
+- (void)setButtonInfo:(id)_info {
+  ASSIGN(self->buttonInfo, _info);
+}
+- (id)buttonInfo {
+  return self->buttonInfo;
+}
+
+/* toolbar */
+
+- (id)toolbarConfig {
+  id tmp;
+  
+  if (self->toolbarConfig != nil)
+    return [self->toolbarConfig isNotNull] ? self->toolbarConfig : nil;
+  
+  tmp = [[self clientObject] lookupName:@"toolbar" inContext:[self context]
+                            acquire:NO];
+  if ([tmp isKindOfClass:[NSException class]]) {
+    [self logWithFormat:
+           @"ERROR: not toolbar configuration found on SoObject: %@ (%@)",
+           [self clientObject], [[self clientObject] soClass]];
+    self->toolbarConfig = [[NSNull null] retain];
+    return nil;
+  }
+  self->toolbarConfig = [tmp retain];
+  return self->toolbarConfig;
+}
+
+/* labels */
+
+- (NSString *)buttonLabel {
+  WOResourceManager *rm;
+  NSArray           *languages;
+  WOContext         *ctx;
+  NSString          *key, *label;
+
+  key = [[self buttonInfo] valueForKey:@"label"];
+  
+  /* lookup languages */
+  
+  ctx = [self context];
+  languages = [ctx hasSession]
+    ? [[ctx session] languages]
+    : [[ctx request] browserLanguages];
+
+  /* lookup resource manager */
+  
+  if ((rm = [self resourceManager]) == nil)
+    rm = [[WOApplication application] resourceManager];
+  if (rm == nil)
+    [self debugWithFormat:@"WARNING: missing resource manager!"];
+  
+  /* lookup string */
+  
+  label = [rm stringForKey:key inTableNamed:nil withDefaultValue:key
+              languages:languages];
+  return label;
+}
+
+@end /* UIxMailToolbar */
diff --git a/SOGo/UI/Mailer/UIxMailToolbar.wox b/SOGo/UI/Mailer/UIxMailToolbar.wox
new file mode 100644 (file)
index 0000000..e0c3a46
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" standalone="yes"?>
+<table
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:var="http://www.skyrix.com/od/binding"
+  xmlns:const="http://www.skyrix.com/od/constant"
+  xmlns:rsrc="OGo:url"
+  xmlns:label="OGo:label"
+  xmlns:so="http://www.skyrix.com/od/so-lookup"
+>
+  <tr>
+    <var:foreach list="toolbarConfig" item="toolbarGroup">
+      <var:foreach list="toolbarGroup" item="buttonInfo">
+        <td class="tb_icon"
+            ><a var:href="buttonInfo.link" 
+               var:class="buttonInfo.cssClass"></a></td>
+      </var:foreach>
+      <td class="tb_spacer"> </td>
+    </var:foreach>
+  </tr>
+  <tr>
+    <var:foreach list="toolbarConfig" item="toolbarGroup">
+      <var:foreach list="toolbarGroup" item="buttonInfo">
+        <td class="tb_label"><var:string value="buttonInfo.label" /></td>
+      </var:foreach>
+      <td class="tb_spacer"> </td>
+    </var:foreach>
+  </tr>
+</table>
index 7cb001acfe53aa2f6319d40435bdf0120783297d..49f242e531df55a4ec8619c8424bdc414d69e19a 100644 (file)
@@ -1,3 +1,3 @@
 # $Id$
 
-SUBMINOR_VERSION:=20
+SUBMINOR_VERSION:=21
index f272c668f0dbb915fd5572dbb7016f5f43f9ec1d..7c2732e48635f403491c78fe34170956840eabef 100644 (file)
 
   categories = {
     SOGoMailFolder = {
+      slots = {
+        toolbar = {
+          protectedBy = "View";
+          value = ( /* the toolbar groups */
+            ( /* first group */
+              {
+                link  = "getMail";
+                cssClass = "tbicon_getmail"; label = "Get Mail";
+              },
+              {
+                link  = "compose"; target = "_blank";
+                cssClass = "tbicon_compose"; label = "Write";
+              },
+              {
+                link  = "addressbook"; target = "addressbook";
+                cssClass = "tbicon_addressbook"; label = "Write";
+              }
+            ),
+            ( /* second group */
+              { link = "#"; 
+                cssClass = "tbicon_reply";    label = "Reply";     },
+              { link = "#"; 
+                cssClass = "tbicon_replyall"; label = "Reply All"; },
+              { link = "#"; cssClass = "tbicon_forward";  label = "Forward";   },
+            ),
+            ( /* third group */
+              { link = "#"; 
+                cssClass = "tbicon_delete"; label = "Delete"; },
+              { link = "#"; 
+                cssClass = "tbicon_junk";   label = "Junk";   },
+            ),
+            ( /* fourth group */
+              { link = "#"; cssClass = "tbicon_print"; label = "Print"; },
+              { link = "#"; cssClass = "tbicon_stop";  label = "Stop";  },
+            ),
+          );
+        };
+      };
       methods = {
         view = {
           protectedBy = "View";
           pageName    = "UIxMailListView"; 
           actionName  = "getMail";
         };
+
+        compose = {
+          protectedBy = "View";
+          pageName    = "UIxMailEditor"; 
+        };
       };
     };
 
     SOGoMailObject = {
+      slots = {
+        toolbar = {
+          protectedBy = "View";
+          value = ( /* the toolbar groups */
+            ( /* first group */
+              {
+                link  = "getMail";
+                cssClass = "tbicon_getmail"; label = "Get Mail";
+              },
+              {
+                link  = "compose"; target = "_blank";
+                cssClass = "tbicon_compose"; label = "Write";
+              },
+              {
+                link  = "addressbook"; target = "addressbook";
+                cssClass = "tbicon_addressbook"; label = "Write";
+              }
+            ),
+            ( /* second group */
+              { link = "#"; 
+                cssClass = "tbicon_reply";    label = "Reply";     },
+              { link = "#"; 
+                cssClass = "tbicon_replyall"; label = "Reply All"; },
+              { link = "#"; cssClass = "tbicon_forward";  label = "Forward";   },
+            ),
+            ( /* third group */
+              { link = "#"; 
+                cssClass = "tbicon_delete"; label = "Delete"; },
+              { link = "#"; 
+                cssClass = "tbicon_junk";   label = "Junk";   },
+            ),
+            ( /* fourth group */
+              { link = "#"; cssClass = "tbicon_print"; label = "Print"; },
+              { link = "#"; cssClass = "tbicon_stop";  label = "Stop";  },
+            ),
+          );
+        };
+      };
       methods = {
         view = { 
           protectedBy = "View";
     };
     
     SOGoMailAccounts = {
+      slots = {
+        toolbar = {
+          protectedBy = "View";
+          value = ( /* the toolbar groups */
+            ( /* first group */
+              {
+                link  = "getMail";
+                cssClass = "tbicon_getmail"; label = "Get Mail";
+              },
+            )
+          );
+        };
+      };
       methods = {
         view = {
           protectedBy = "View";
     };
     
     SOGoMailAccount = {
+      slots = {
+        toolbar = {
+          protectedBy = "View";
+          value = ( /* the toolbar groups */
+            ( /* first group */
+              {
+                link  = "getMail";
+                cssClass = "tbicon_getmail"; label = "Get Mail";
+              },
+            )
+          );
+        };
+      };
       methods = {
         view = {
           protectedBy = "View";