]> err.no Git - scalable-opengroupware.org/commitdiff
MoveTo PopUp feature
authorznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 27 Oct 2004 15:42:44 +0000 (15:42 +0000)
committerznek <znek@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 27 Oct 2004 15:42:44 +0000 (15:42 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@432 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/English.lproj/default.strings
SOGo/UI/Mailer/GNUmakefile
SOGo/UI/Mailer/UIxMailListView.m
SOGo/UI/Mailer/UIxMailListView.wox
SOGo/UI/Mailer/UIxMailMoveToPopUp.m [new file with mode: 0644]
SOGo/UI/Mailer/UIxMailMoveToPopUp.wox [new file with mode: 0644]
SOGo/UI/Mailer/Version
SOGo/UI/Mailer/mailer.css

index a3d0c808a3ad3f77f9053902d4dd3a76b5c5993f..876795763c66aa69328ec046b6d2c81ed4c7709a 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-27  Marcus Mueller  <znek@mulle-kybernetik.com>
+
+       * UIxMailMoveToPopUp.[m|wox]: component which renders a popup
+         containing possible destinations for a mail move operation (v0.9.52)
+
 2004-10-27  Helge Hess  <helge.hess@opengroupware.org>
 
        * UIxMailEditor.m: default method returns a redirect to 'edit', added
index c9d8f3d21e9c70d9fecf7a395e9ec256b35bb0d9..8f4f131760c3b1a01b9297dc38209508bfb215dc 100644 (file)
@@ -24,3 +24,7 @@
 
 "msgnumber_to"  = "to";
 "msgnumber_of"  = "of";
+
+/* MailMoveToPopUp */
+
+"MoveTo"        = "Move &hellip;";
index 35fce169ad8c32fdd7eb230acaf0aa0ccb73466b..09a611293bc06acc25aa981a1ae66ab31bfbb709 100644 (file)
@@ -26,6 +26,7 @@ MailerUI_OBJC_FILES += \
        UIxMailListView.m               \
        UIxMailView.m                   \
        UIxMailSortableTableHeader.m    \
+       UIxMailMoveToPopUp.m            \
        \
        UIxMailEditor.m                 \
        UIxMailEditorAttach.m           \
@@ -53,6 +54,7 @@ MailerUI_RESOURCE_FILES += \
        UIxMailListView.wox             \
        UIxMailView.wox                 \
        UIxMailSortableTableHeader.wox  \
+       UIxMailMoveToPopUp.wox          \
        \
        UIxMailEditor.wox               \
        UIxMailEditorAttach.wox         \
index 61b3666727b7c1d5e12318fe3a69aeee91ac050d..dfd8d395b241b0189d852ba8aa244b1dae795df7 100644 (file)
@@ -295,9 +295,49 @@ static int attachmentFlagSize = 8096;
 
 - (NSString *)jsCode {
   static NSString *script = \
-    @"function toggleRowSelectionStatus(sender) {\n"
-    @"}\n"
-    @"";
+  @"var rowSelectionCount = 0;\n"
+  @"\n"
+  @"validateControls();\n"
+  @"\n"
+  @"function showElement(e, shouldShow) {\n"
+  @"   e.style.display = shouldShow ? \"\" : \"none\";\n"
+  @"}\n"
+  @"\n"
+  @"function enableElement(e, shouldEnable) {\n"
+  @"  if(!e)\n"
+  @"    return;\n"
+  @"  if(shouldEnable) {\n"
+  @"    if(e.hasAttribute(\"disabled\"))\n"
+  @"      e.removeAttribute(\"disabled\");\n"
+  @"  }\n"
+  @"  else {\n"
+  @"    e.setAttribute(\"disabled\", \"1\");\n"
+  @"  }\n"
+  @"}\n"
+  @"\n"
+  @"function toggleRowSelectionStatus(sender) {\n"
+  @"  rowID = sender.value;\n"
+  @"  tr = document.getElementById(rowID);\n"
+  @"  if(sender.checked) {\n"
+  @"    tr.className = \"tableview_selected\";\n"
+  @"    rowSelectionCount += 1;\n"
+  @"  }\n"
+  @"  else {\n"
+  @"    tr.className = \"tableview\";\n"
+  @"    rowSelectionCount -= 1;\n"
+  @"  }\n"
+  @"  this.validateControls();\n"
+  @"}\n"
+  @"\n"
+  @"function validateControls() {\n"
+  @"  var e = document.getElementById(\"moveto\");\n"
+  @"  this.enableElement(e, rowSelectionCount > 0);\n"
+  @"}\n"
+  @"\n"
+  @"function moveTo(uri) {\n"
+  @"  alert(\"MoveTo: \" + uri);\n"
+  @"}\n"
+  @"";
   return script;
 }
 
index 58fa4a6c6e273213ca78cc87af444e0afaac93ef..c11b5cd62b17ba0e8fef2300a15543c718f87344 100644 (file)
@@ -29,7 +29,6 @@
       </script>
       <table border="0" width="100%" cellspacing="0" cellpadding="1">
         <tr class="tableview">
-         <!-- TODO: see AB for sorting -->
           <td class="tbtv_headercell" width="17">
             <var:entity const:name="nbsp" />
           </td>
             <td>
               <input type="checkbox"
                      var:value="msgRowID"
+                     const:checked="NO"
+                     const:name="selectedRows"
                      onclick="javascript:toggleRowSelectionStatus(this);"
               />
             </td>
             </td>
           </tr>
         </var:foreach>
-        <span id="selected_uids" style="visibility: hidden;">
-        </span>
+        <tr class="tableview">
+          <td colspan="6" class="tbtv_actcell">
+            <!-- actions -->
+            <var:component className="UIxMailMoveToPopUp"
+                           const:identifier="moveto"
+                           const:callback="moveTo"
+                           rootNodes="clientObject.treeNavigationNodes"
+            />
+          </td>
+        </tr>
       </table>
+      <span id="selected_uids" style="visibility: hidden;">
+      </span>
     </div>
   </div>
+  <!--
+  <div>
+    <pre>
+    tnn: <var:string value="clientObject.treeNavigationNodes" />
+    </pre>
+  </div>
+  -->
 </var:component>
diff --git a/SOGo/UI/Mailer/UIxMailMoveToPopUp.m b/SOGo/UI/Mailer/UIxMailMoveToPopUp.m
new file mode 100644 (file)
index 0000000..14fc01e
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ Copyright (C) 2000-2004 SKYRIX Software AG
+ This file is part of OGo
+ 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 <NGObjWeb/NGObjWeb.h>
+
+@interface UIxMailMoveToPopUp : WOComponent
+{
+  NSString *identifier;
+  NSString *callback;
+  id rootNodes;
+  id item;
+}
+
+- (NSString *)itemDisplayString;
+- (NSString *)itemURL;
+  
+- (void)_appendEntriesFromNodeDict:(NSDictionary *)_dict
+                            toList:(NSMutableArray *)_list
+                        withPrefix:(NSString *)_pathPrefix;
+@end
+
+#include "common.h"
+
+@implementation UIxMailMoveToPopUp
+
+- (void)dealloc {
+  [self->identifier release];
+  [self->callback   release];
+  [self->rootNodes  release];
+  [self->item       release];
+  [super dealloc];
+}
+
+- (void)setIdentifier:(NSString *)_identifier {
+  ASSIGN(self->identifier, _identifier);
+}
+- (NSString *)identifier {
+  return self->identifier;
+}
+
+- (void)setCallback:(NSString *)_callback {
+  ASSIGN(self->callback, _callback);
+}
+- (NSString *)callback {
+  return self->callback;
+}
+
+- (void)setRootNodes:(id)_rootNodes {
+  ASSIGN(self->rootNodes, _rootNodes);
+}
+- (id)rootNodes {
+  return self->rootNodes;
+}
+
+- (void)setItem:(id)_item {
+  ASSIGN(self->item, _item);
+}
+- (id)item {
+  return self->item;
+}
+
+- (NSArray *)sortedNodes {
+  NSMutableArray *r;
+  NSDictionary *dict;
+
+  r = [NSMutableArray arrayWithCapacity:10];
+  /* INBOX node */
+  dict = [[self->rootNodes objectForKey:@"children"] objectAtIndex:0];
+  [self _appendEntriesFromNodeDict:dict toList:r withPrefix:nil];
+  return r;
+}
+
+- (void)_appendEntriesFromNodeDict:(NSDictionary *)_dict
+                            toList:(NSMutableArray *)_list
+                        withPrefix:(NSString *)_pathPrefix
+{
+  NSMutableDictionary *e;
+  NSString *title, *link;
+  NSArray *children;
+  unsigned count, i;
+
+  title = [_dict objectForKey:@"title"];
+  link = [_dict objectForKey:@"link"];
+  e = [[NSMutableDictionary alloc] initWithCapacity:2];
+  if(!_pathPrefix)
+    _pathPrefix = title;
+  else
+    _pathPrefix = [NSString stringWithFormat:@"%@.%@", _pathPrefix, title];
+  [e setObject:_pathPrefix forKey:@"title"];
+  [e setObject:link forKey:@"link"];
+  [_list addObject:e];
+  [e release];
+  
+  children = [_dict objectForKey:@"children"];
+  count = [children count];
+  for(i = 0; i < count; i++) {
+    NSDictionary *dict;
+    
+    dict = [children objectAtIndex:i];
+    [self _appendEntriesFromNodeDict:dict
+                              toList:_list
+                          withPrefix:_pathPrefix];
+  }
+}
+
+- (NSString *)itemDisplayString {
+  return [self->item objectForKey:@"title"];
+}
+
+- (NSString *)itemURL {
+  return [self->item objectForKey:@"link"];
+}
+
+- (NSString *)itemDisabledValue {
+  return [[self itemURL] isEqualToString:@"."] ? @" disabled" : @"";
+}
+
+/* JavaScript */
+
+- (NSString *)selectItemJS {
+  static NSString *selectJS = \
+    @"javascript:if(!this.hasAttribute('disabled')) %@('%@');";
+  return [NSString stringWithFormat:selectJS,
+    self->callback,
+    [self itemURL]];
+}
+
+@end
diff --git a/SOGo/UI/Mailer/UIxMailMoveToPopUp.wox b/SOGo/UI/Mailer/UIxMailMoveToPopUp.wox
new file mode 100644 (file)
index 0000000..bf1de0c
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version='1.0' standalone='yes'?>
+
+<select xmlns="http://www.w3.org/1999/xhtml"
+        xmlns:var="http://www.skyrix.com/od/binding"
+        xmlns:const="http://www.skyrix.com/od/constant"
+        xmlns:uix="OGo:uix"
+        xmlns:rsrc="OGo:url"
+        xmlns:label="OGo:label"
+        var:name="identifier"
+        var:id="identifier"
+        const:disabled="1"
+>            
+  <option value="title"
+          checked="1"
+          read="1"
+  ><var:string label:value="MoveTo" const:escapeHTML="NO" /></option>
+  <var:foreach list="sortedNodes" item="item" >
+    <option var:value="itemURL"
+            var:onClick="selectItemJS"
+            var:otherTagString="itemDisabledValue"
+    ><var:string value="itemDisplayString" /></option>
+  </var:foreach>
+  <option value="all" disabled="1" >All</option>
+</select>
\ No newline at end of file
index 10d5dbea4aa899e015dc90f07918160662a81276..aed4bf5f71b371b23ba0382f0854b8b39b99fcc3 100644 (file)
@@ -1,6 +1,6 @@
 # $Id$
 
-SUBMINOR_VERSION:=50
+SUBMINOR_VERSION:=52
 
 # v0.9.50 requires NGMime   v4.3.190
 # v0.9.43 requires NGObjWeb v4.3.73
index 37d00d0cf10be28ddc98b961ede08912f1d1902c..fd9142a70b5d5d203ea8be8594a3a989b062e84d 100644 (file)
   vertical-align: top;
 }
 
+.tableview_selected { 
+  font-size:        9pt;
+  font-family:      Arial, Helvetica, Verdana, Geneva, Tahoma, sans-serif;
+  vertical-align:   top;
+  background-color: #ffffcc;
+}
+
 td.tbtv_navcell { 
   border-width:        1;
   border-style:        solid;
@@ -180,6 +187,21 @@ td.tbtv_headercell {
   background-color:    #D4D0C8;
 }
 
+td.tbtv_actcell { 
+  border-width:        1;
+  border-style:        solid;
+  border-top-color:    #808080;
+  border-left-color:   #808080;
+  border-bottom-color: #808080;
+  border-right-color:  #808080;
+  padding-top:         4px;
+  padding-bottom:      3px;
+  padding-left:        4px;
+  padding-right:       4px;
+  
+  background-color:    #D4D0C8;
+}
+
 td.tbtv_headercell a {
   margin:  0px auto;
   display: block;