From 810e012730f430ae54219659605e8ed5fc35560b Mon Sep 17 00:00:00 2001 From: znek Date: Wed, 27 Oct 2004 15:42:44 +0000 Subject: [PATCH] MoveTo PopUp feature git-svn-id: http://svn.opengroupware.org/SOGo/trunk@432 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Mailer/ChangeLog | 5 + SOGo/UI/Mailer/English.lproj/default.strings | 4 + SOGo/UI/Mailer/GNUmakefile | 2 + SOGo/UI/Mailer/UIxMailListView.m | 46 +++++- SOGo/UI/Mailer/UIxMailListView.wox | 24 ++- SOGo/UI/Mailer/UIxMailMoveToPopUp.m | 148 +++++++++++++++++++ SOGo/UI/Mailer/UIxMailMoveToPopUp.wox | 24 +++ SOGo/UI/Mailer/Version | 2 +- SOGo/UI/Mailer/mailer.css | 22 +++ 9 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 SOGo/UI/Mailer/UIxMailMoveToPopUp.m create mode 100644 SOGo/UI/Mailer/UIxMailMoveToPopUp.wox diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index a3d0c808..87679576 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2004-10-27 Marcus Mueller + + * UIxMailMoveToPopUp.[m|wox]: component which renders a popup + containing possible destinations for a mail move operation (v0.9.52) + 2004-10-27 Helge Hess * UIxMailEditor.m: default method returns a redirect to 'edit', added diff --git a/SOGo/UI/Mailer/English.lproj/default.strings b/SOGo/UI/Mailer/English.lproj/default.strings index c9d8f3d2..8f4f1317 100644 --- a/SOGo/UI/Mailer/English.lproj/default.strings +++ b/SOGo/UI/Mailer/English.lproj/default.strings @@ -24,3 +24,7 @@ "msgnumber_to" = "to"; "msgnumber_of" = "of"; + +/* MailMoveToPopUp */ + +"MoveTo" = "Move …"; diff --git a/SOGo/UI/Mailer/GNUmakefile b/SOGo/UI/Mailer/GNUmakefile index 35fce169..09a61129 100644 --- a/SOGo/UI/Mailer/GNUmakefile +++ b/SOGo/UI/Mailer/GNUmakefile @@ -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 \ diff --git a/SOGo/UI/Mailer/UIxMailListView.m b/SOGo/UI/Mailer/UIxMailListView.m index 61b36667..dfd8d395 100644 --- a/SOGo/UI/Mailer/UIxMailListView.m +++ b/SOGo/UI/Mailer/UIxMailListView.m @@ -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; } diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index 58fa4a6c..c11b5cd6 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -29,7 +29,6 @@ - @@ -115,6 +114,8 @@ @@ -182,9 +183,26 @@ - + + +
+ + +
+ + diff --git a/SOGo/UI/Mailer/UIxMailMoveToPopUp.m b/SOGo/UI/Mailer/UIxMailMoveToPopUp.m new file mode 100644 index 00000000..14fc01ef --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailMoveToPopUp.m @@ -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 + +@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 index 00000000..bf1de0ca --- /dev/null +++ b/SOGo/UI/Mailer/UIxMailMoveToPopUp.wox @@ -0,0 +1,24 @@ + + + \ No newline at end of file diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index 10d5dbea..aed4bf5f 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -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 diff --git a/SOGo/UI/Mailer/mailer.css b/SOGo/UI/Mailer/mailer.css index 37d00d0c..fd9142a7 100644 --- a/SOGo/UI/Mailer/mailer.css +++ b/SOGo/UI/Mailer/mailer.css @@ -150,6 +150,13 @@ 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; -- 2.39.5