+2007-06-28 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * UI/Common/UIxSortButton.m: removed useless class module.
+
+ * UI/Common/UIxSortableTableHeader.m: removed useless class
+ module.
+
+ * UI/Contacts/UIxContactsListView.m ([UIxContactsListView
+ -contactInfos]): use the "asc" url parameter instead of "desc" to
+ determine the ordering.
+ ([-sortOrdering]): removed method.
+ ([UIxContactsListView -init]): removed the "searchText" ivar.
+ (general): the template no longer use the UIxSortableTableHeader
+ components.
+
+ * UI/MailerUI/UIxMailListView.m ([UIxMailListView
+ -defaultSortKey]): default sort following the messages arrival
+ instead of their date.
+ ([-isSortedDescending]): removed method.
+ ([-imap4SortOrdering]): use the "asc" url parameter instead of
+ "desc" to determine the ordering.
+ (general): the template no longer use the UIxSortableTableHeader
+ components.
+
+2007-06-27 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * UI/MailerUI/UIxMailListView.m ([UIxMailListView -sleep]):
+ removed method.
+ ([-setQualifier:_msg], [-qualifier]): removed methods.
+ ([UIxMailListView -defaultAction]): added code to handle the
+ search criteria and value passed as url parameters. Also, we now
+ handle the same search criterias as Thunderbird/Icedove.
+
+2007-06-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * UI/PreferencesUI/UIxJSONPreferences.m ([UIxJSONPreferences
+ -jsonDefaultsAction]): bug fix: returns a WOResponse instance with
+ the string instead of the string itself.
+ ([UIxJSONPreferences -jsonSettingsAction]): same as above.
+
+ * SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): new module
+ bool var "acceptAnyUser" that is set when the AuthenticationMethod
+ user default is nil.
+ ([SOGoUser -initWithLogin:newLoginroles:newRoles]):
+ unconditionnally returns an instance whenever acceptAnyUser is set.
+
+2007-06-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * Main/sogod.m (main): prevent SOGo from running as root.
+
2007-06-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoUser.m ([SOGoUser
SOGoAppointmentFolder = {
superclass = "SOGoFolder";
defaultRoles = {
- "FreeBusyLookup" = ( "Owner", "FreeBusy", "AuthorizedSubscriber" );
+/* "FreeBusyLookup" = ( "Owner", "FreeBusy", "AuthorizedSubscriber" ); */
"ViewWholePublicRecords" = ( "Owner", "PublicResponder", "PublicModifier", "PublicViewer" );
"ViewDAndTOfPublicRecords" = ( "Owner", "PublicDAndTViewer" );
"ModifyPublicRecords" = ( "Owner", "PublicModifier" );
};
};
SOGoGroupAppointmentFolder = {
- superclass = "SOGoAppointmentFolder";
+ superclass = "SOGoAppointmentFolder";
};
SOGoCalendarComponent = {
superclass = "SOGoContentObject";
};
};
SOGoAppointmentObject = {
- superclass = "SOGoCalendarComponent";
+ superclass = "SOGoCalendarComponent";
};
SOGoTaskObject = {
superclass = "SOGoCalendarComponent";
};
SOGoFreeBusyObject = {
- superclass = "SOGoContentObject";
- protectedBy = "<public>";
+ superclass = "SOGoContentObject";
+ protectedBy = "Access Contents Information";
+ defaultRoles = {
+ "Access Contents Information" = ( "Owner", "Authenticated" );
+ "WebDAV Access" = ( "Owner", "Authenticated" );
+ };
};
};
}
"Calendar" = "Calendar";
"Address Book" = "Address Book";
"Mail" = "Mail";
+"Preferences" = "Preferences";
"Logoff" = "Logoff";
"Right Administration" = "Right Administration";
"Log Console (dev.)" = "Log Console (dev.)";
"Calendar" = "Agenda";
"Address Book" = "Carnet d'adresses";
"Mail" = "Courrier";
+"Preferences" = "Préférences";
"Logoff" = "Quitter";
"Right Administration" = "Partage";
"Log Console (dev.)" = "Journal (dév.)";
CommonUIProduct.m \
UIxPageFrame.m \
UIxPrintPageFrame.m \
- UIxSortButton.m \
UIxAppNavView.m \
\
UIxAclEditor.m \
UIxTabItem.m \
UIxUserRightsEditor.m \
\
- UIxSortableTableHeader.m \
- \
UIxToolbar.m
CommonUI_RESOURCE_FILES += \
+++ /dev/null
-/*
- Copyright (C) 2004-2005 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.
-*/
-
-#include <NGObjWeb/WOComponent.h>
-
-@interface UIxSortButton : WOComponent
-@end
-
-@implementation UIxSortButton
-@end /* UIxSortButton */
-
+++ /dev/null
-/*
- Copyright (C) 2004-2005 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.
-*/
-
-#include <NGObjWeb/SoComponent.h>
-
-/*
- UIxSortableTableHeader
-
- TODO: document.
-
- Note: needs to inherit from SoComponent so that resource lookup properly
- works!
-*/
-
-@interface UIxSortableTableHeader : SoComponent
-{
- NSString *label;
- NSString *sortKey;
- NSString *href;
- NSDictionary *queryDictionary;
- BOOL isDefault;
-}
-
-@end
-
-#include "common.h"
-
-@implementation UIxSortableTableHeader
-
-- (void)dealloc {
- [self->label release];
- [self->sortKey release];
- [self->href release];
- [self->queryDictionary release];
- [super dealloc];
-}
-
-/* Accessors */
-
-- (void)setLabel:(NSString *)_label {
- ASSIGNCOPY(self->label, _label);
-}
-- (NSString *)label {
- return self->label;
-}
-
-- (void)setSortKey:(NSString *)_sortKey {
- ASSIGNCOPY(self->sortKey, _sortKey);
-}
-
-- (NSString *)sortKey {
- return self->sortKey;
-}
-
-- (void)setHref:(NSString *)_href {
- ASSIGNCOPY(self->href, _href);
-}
-- (NSString *)href {
- return self->href;
-}
-
-- (void)setQueryDictionary:(NSDictionary *)_queryDictionary {
- ASSIGN(self->queryDictionary, _queryDictionary);
-}
-- (NSDictionary *)queryDictionary {
- return self->queryDictionary;
-}
-
-- (id)singleQueryValueForKey:(NSString *)_key {
- id so;
-
- so = [self->queryDictionary objectForKey:_key];
- if (![so isNotNull]) return nil;
-
- if (![so isKindOfClass:[NSArray class]])
- return so;
-
- return ([so count] > 0) ? [so objectAtIndex:0] : nil;
-}
-
-- (void)setIsDefault:(BOOL)_isDefault {
- self->isDefault = _isDefault;
-}
-- (BOOL)isDefault {
- return self->isDefault;
-}
-
-/* derived accessors */
-
-- (BOOL) isSelected
-{
- NSString *so;
-
- so = [self singleQueryValueForKey:@"sort"];
-
- return ((so)
- ? [so isEqualToString:self->sortKey]
- : isDefault);
-}
-
-- (BOOL)isSortedDescending
-{
- NSString *desc;
-
- desc = [[[self context] request] formValueForKey:@"desc"];
-
- return ((desc)
- ? [desc boolValue]
- : YES);
-}
-
-@end /* UIxSortableTableHeader */
@interface UIxContactsListView : UIxComponent
{
- NSString *searchText;
NSDictionary *currentContact;
NSString *selectorComponentClass;
}
return self;
}
-- (void) dealloc
-{
- if (searchText)
- [searchText release];
- [super dealloc];
-}
-
/* accessors */
- (void) setCurrentContact: (NSDictionary *) _contact
return currentContact;
}
-- (void) setSearchText: (NSString *) _txt
-{
- ASSIGNCOPY (searchText, _txt);
-}
-
-- (id) searchText
-{
- if (!searchText)
- [self setSearchText: [self queryParameterForKey:@"search"]];
-
- return searchText;
-}
-
- (id <WOActionResults>) mailerContactsAction
{
selectorComponentClass = @"UIxContactsMailerSelection";
NSString *s;
s = [self queryParameterForKey: @"sort"];
- if ([s length] == 0)
+ if (![s length])
s = [self defaultSortKey];
return s;
}
-- (NSComparisonResult) sortOrdering
-{
- return ([[self queryParameterForKey:@"desc"] boolValue]
- ? NSOrderedDescending
- : NSOrderedAscending);
-}
-
- (NSArray *) contactInfos
{
id <SOGoContactFolder> folder;
+ NSString *ascending, *searchText, *valueText;
+ NSComparisonResult ordering;
folder = [self clientObject];
- return [folder lookupContactsWithFilter: [self searchText]
- sortBy: [self sortKey]
- ordering: [self sortOrdering]];
-}
+ ascending = [self queryParameterForKey: @"asc"];
+ ordering = ((![ascending length] || [ascending boolValue])
+ ? NSOrderedAscending : NSOrderedDescending);
-/* notifications */
+ searchText = [self queryParameterForKey: @"search"];
+ if ([searchText length] > 0)
+ valueText = [self queryParameterForKey: @"value"];
+ else
+ valueText = nil;
-- (void) sleep
-{
- if (searchText)
- {
- [searchText release];
- searchText = nil;
- }
- currentContact = nil;
-// [allRecords release];
-// allRecords = nil;
-// [filteredRecords release];
-// filteredRecords = nil;
- [super sleep];
+ return [folder lookupContactsWithFilter: valueText
+ sortBy: [self sortKey]
+ ordering: ordering];
}
/* actions */
/* MailListView */
-"Subject or Sender contains" = "Subject or Sender contains";
+"Sender" = "Sender";
+"Subject or Sender" = "Subject or Sender";
+"To or Cc" = "To or Cc";
+"Entire Message" = "Entire Message";
+
"Date" = "Date";
"View" = "View";
"All" = "All";
"View:" = "Voir :";
-"Subject or Sender contains" = "Sujet ou Expéditeur contient ";
+"Sender" = "Expéditeur";
+"Subject or Sender" = "Sujet ou expéditeur";
+"To or Cc" = "Pour ou Copie à";
+"Entire Message" = "Message Complet";
+
"Date" = "Date";
"All" = "Tous";
"Unread" = "Non lus";
@implementation UIxMailFilterPanel
-static NSArray *filters = nil;
-static NSDictionary *filterToQualifier = nil;
+static NSArray *filters = nil;
+// static NSDictionary *filterToQualifier = nil;
+ (void)initialize {
// TODO: also available: answered, draft [custom: NotJunk and Junk]
// Note: we currently cannot use: "flags != 'deleted'"
static NSString *quals[] = {
- @"all", nil,
- @"read", @"flags = 'seen' AND NOT (flags = 'deleted')",
- @"unread", @"flags = 'unseen' AND NOT (flags = 'deleted')",
+ @"all", nil,
+ @"read", @"flags = 'seen' AND NOT (flags = 'deleted')",
+ @"unread", @"flags = 'unseen' AND NOT (flags = 'deleted')",
@"deleted", @"flags = 'deleted'",
@"flagged", @"flags = 'flagged'",
nil, nil
}
}
- filterToQualifier = [md copy];
+// filterToQualifier = [md copy];
filters = [ma copy];
[md release]; md = nil;
[ma release]; ma = nil;
return self;
}
-- (void)dealloc {
- [self->searchCriteria release];
- [self->searchText release];
+- (void) dealloc
+{
+ [searchCriteria release];
+ [searchText release];
[super dealloc];
}
/* accessors */
-- (void)setSearchText: (NSString *)_txt
+- (void) setSearchText: (NSString *) _txt
{
- ASSIGNCOPY(self->searchText, _txt);
+ ASSIGN (searchText, _txt);
}
-- (void)setSearchCriteria: (NSString *)_txt
+- (void) setSearchCriteria: (NSString *) _txt
{
- ASSIGNCOPY(self->searchText, _txt);
+ ASSIGN (searchText, _txt);
}
-- (NSString *)searchText
+- (NSString *) searchText
{
- if (self->searchText == nil)
+ if (!searchText)
{
- self->searchText =
- [[[[self context] request] formValueForKey:@"search"] copy];
+ searchText = [[context request] formValueForKey: @"value"];
+ [searchText retain];
}
- return self->searchText;
+
+ return searchText;
}
-- (NSString *)searchCriteria
+- (NSString *) searchCriteria
{
- if (self->searchCriteria == nil)
+ if (!searchCriteria)
{
- self->searchCriteria =
- [[[[self context] request] formValueForKey:@"criteria"] copy];
+ searchCriteria = [[context request] formValueForKey: @"criteria"];
+ [searchCriteria retain];
}
- return self->searchCriteria;
+
+ return searchCriteria;
}
/* filters */
-- (NSArray *)filters
+- (NSArray *) filters
{
return filters;
}
/* qualifiers */
-- (EOQualifier *) searchTextQualifier
-{
- EOQualifier *q;
- NSString *s;
+// - (EOQualifier *) searchTextQualifier
+// {
+// EOQualifier *q;
+// NSString *s;
- s = [self searchText];
- if ([s length] == 0)
- return nil;
+// s = [self searchText];
+// if ([s length] == 0)
+// return nil;
- q = [EOQualifier qualifierWithQualifierFormat:
- @"(subject doesContain: %@) OR "
- @"(from doesContain: %@)",
- s, s];
- return q;
-}
-
-- (NSString *)filterLabel
-{
-#if 1
- return [[[self context] page] labelForKey:[self valueForKey:@"filter"]];
-#else
- return [self valueForKey:@"filter"];
-#endif
-}
-
-- (NSString *)selectedFilter
-{
- return [[[self context] request] formValueForKey:@"filterpopup"];
-}
-
-- (EOQualifier *)filterQualifier
-{
- NSString *selectedFilter;
+// q = [EOQualifier qualifierWithQualifierFormat:
+// @"(subject doesContain: %@) OR "
+// @"(from doesContain: %@)",
+// s, s];
+// return q;
+// }
+
+// - (NSString *) filterLabel
+// {
+// #if 1
+// return [[context page] labelForKey:[self valueForKey:@"filter"]];
+// #else
+// return [self valueForKey:@"filter"];
+// #endif
+// }
+
+// - (NSString *) selectedFilter
+// {
+// return [[context request] formValueForKey: @"filterpopup"];
+// }
+
+// - (EOQualifier *) filterQualifier
+// {
+// NSString *selectedFilter;
- selectedFilter = [self selectedFilter];
+// selectedFilter = [self selectedFilter];
- return [selectedFilter length] > 0
- ? [filterToQualifier objectForKey:selectedFilter] : nil;
-}
-
-- (EOQualifier *) qualifier
-{
- EOQualifier *sq, *fq;
- NSArray *qa;
+// return [selectedFilter length] > 0
+// ? [filterToQualifier objectForKey:selectedFilter] : nil;
+// }
+
+// - (EOQualifier *) qualifier
+// {
+// EOQualifier *sq, *fq;
+// NSArray *qa;
- sq = [self searchTextQualifier];
- fq = [self filterQualifier];
+// sq = [self searchTextQualifier];
+// fq = [self filterQualifier];
- if (fq == nil) return sq;
- if (sq == nil) return fq;
+// if (fq == nil) return sq;
+// if (sq == nil) return fq;
- qa = [NSArray arrayWithObjects:fq, sq, nil];
- return [[[EOAndQualifier alloc] initWithQualifierArray:qa] autorelease];
-}
+// qa = [NSArray arrayWithObjects:fq, sq, nil];
+
+// return [[[EOAndQualifier alloc] initWithQualifierArray:qa] autorelease];
+// }
@end /* UIxMailFilterPanel */
NSTimeZone *userTimeZone;
}
-- (NSString *)defaultSortKey;
-- (NSString *)imap4SortKey;
-- (NSString *)imap4SortOrdering;
-
-- (BOOL)isSortedDescending;
+- (NSString *) defaultSortKey;
+- (NSString *) imap4SortKey;
+- (NSString *) imap4SortOrdering;
@end
#import <NGExtensions/NSNull+misc.h>
#import <NGExtensions/NSString+misc.h>
+#import <EOControl/EOQualifier.h>
+
#import <SoObjects/Mailer/SOGoMailFolder.h>
#import <SoObjects/Mailer/SOGoMailObject.h>
#import <SoObjects/SOGo/SOGoDateFormatter.h>
@implementation UIxMailListView
+- (id) init
+{
+ SOGoUser *user;
+
+ if ((self = [super init]))
+ {
+ qualifier = nil;
+ user = [context activeUser];
+ ASSIGN (dateFormatter, [user dateFormatterInContext: context]);
+ ASSIGN (userTimeZone, [user timeZone]);
+ }
+
+ return self;
+}
+
- (void) dealloc
{
- [self->qualifier release];
- [self->sortedUIDs release];
- [self->messages release];
- [self->message release];
+ [qualifier release];
+ [sortedUIDs release];
+ [messages release];
+ [message release];
[dateFormatter release];
[userTimeZone release];
[super dealloc];
}
-/* notifications */
-
-- (void) sleep
-{
- [self->qualifier release]; self->qualifier = nil;
- [self->sortedUIDs release]; self->sortedUIDs = nil;
- [self->messages release]; self->messages = nil;
- [self->message release]; self->message = nil;
- [super sleep];
-}
-
/* accessors */
-- (void)setMessage:(id)_msg
+- (void) setMessage: (id) _msg
{
- ASSIGN(self->message, _msg);
+ ASSIGN(message, _msg);
}
- (id) message
{
- return self->message;
+ return message;
}
- (NSString *) messageDate
return [dateFormatter formattedDateAndTime: messageDate];
}
-- (void) setQualifier: (EOQualifier *) _msg
-{
- ASSIGN(self->qualifier, _msg);
-}
-
-- (EOQualifier *) qualifier
-{
- return self->qualifier;
-}
-
- (BOOL) showToAddress
{
NSString *ftype;
/* Note: see SOGoMailManager.m for allowed IMAP4 keys */
static NSArray *keys = nil;
if (keys == nil) {
- keys = [[NSArray alloc] initWithObjects:
+ keys = [[NSArray alloc] initWithObjects: @"UID",
@"FLAGS", @"ENVELOPE", @"RFC822.SIZE", nil];
}
return keys;
- (NSString *) defaultSortKey
{
- return @"DATE";
+ return @"ARRIVAL";
}
- (NSString *) imap4SortKey
{
NSString *sort;
- sort = [[[self context] request] formValueForKey:@"sort"];
+ sort = [[context request] formValueForKey: @"sort"];
- if ([sort length] == 0)
+ if (![sort length])
sort = [self defaultSortKey];
return [sort uppercaseString];
}
-- (BOOL) isSortedDescending
-{
- NSString *desc;
-
- desc = [[[self context] request] formValueForKey:@"desc"];
-
- return ((desc)
- ? [desc boolValue]
- : YES);
-}
-
- (NSString *) imap4SortOrdering
{
- NSString *sort;
+ NSString *sort, *ascending;
sort = [self imap4SortKey];
- if ([self isSortedDescending])
+ ascending = [[context request] formValueForKey: @"asc"];
+ if (![ascending boolValue])
sort = [@"REVERSE " stringByAppendingString: sort];
return sort;
- (NSRange) fetchRange
{
- if (self->firstMessageNumber == 0)
+ if (firstMessageNumber == 0)
return NSMakeRange(0, messagesPerPage);
- return NSMakeRange(self->firstMessageNumber - 1, messagesPerPage);
+ return NSMakeRange(firstMessageNumber - 1, messagesPerPage);
}
- (NSArray *) sortedUIDs
{
if (!sortedUIDs)
{
- sortedUIDs
- = [[self clientObject] fetchUIDsMatchingQualifier: [self qualifier]
- sortOrdering: [self imap4SortOrdering]];
+ sortedUIDs
+ = [[self clientObject] fetchUIDsMatchingQualifier: qualifier
+ sortOrdering: [self imap4SortOrdering]];
[sortedUIDs retain];
}
- return self->sortedUIDs;
+ return sortedUIDs;
}
- (unsigned int) totalMessageCount
{
- return [self->sortedUIDs count];
+ return [sortedUIDs count];
}
- (BOOL) showsAllMessages
NSArray *msgs;
NSRange r;
unsigned len;
- SOGoUser *user;
- if (self->messages != nil)
- return self->messages;
-
- user = [context activeUser];
- if (!dateFormatter)
- dateFormatter = [user dateFormatterInContext: context];
- if (!userTimeZone)
- ASSIGN (userTimeZone, [user timeZone]);
+ if (messages != nil)
+ return messages;
r = [self fetchBlock];
uids = [self sortedUIDs];
/* only need to restrict if we have a lot */
uids = [uids subarrayWithRange:r];
- msgs = [[self clientObject] fetchUIDs:uids parts:[self fetchKeys]];
- self->messages = [[msgs valueForKey:@"fetch"] retain];
- return self->messages;
+ msgs = [[self clientObject] fetchUIDs: uids parts: [self fetchKeys]];
+ messages = [[msgs valueForKey: @"fetch"] retain];
+
+ return messages;
}
/* URL processing */
{
NSString *uid;
- if ((uid = [[[self context] request] formValueForKey:@"uid"]) == nil)
+ if ((uid = [[context request] formValueForKey: @"uid"]) == nil)
return nil;
- return [[self clientObject] lookupName:uid inContext:[self context]
- acquire:NO];
+ return [[self clientObject] lookupName: uid
+ inContext: context
+ acquire: NO];
}
/* actions */
- (BOOL) isJavaScriptRequest
{
- return [[[[self context] request] formValueForKey:@"jsonly"] boolValue];
+ return [[[context request] formValueForKey:@"jsonly"] boolValue];
}
- (id) javaScriptOK
{
WOResponse *r;
- r = [[self context] response];
+ r = [context response];
[r setStatus:200 /* OK */];
return r;
}
return firstMessage;
}
+- (void) _setQualifierForCriteria: (NSString *) criteria
+ andValue: (NSString *) value
+{
+ [qualifier release];
+
+ if ([criteria isEqualToString: @"subject"])
+ qualifier = [EOQualifier qualifierWithQualifierFormat:
+ @"(subject doesContain: %@)",
+ value];
+ else if ([criteria isEqualToString: @"sender"])
+ qualifier = [EOQualifier qualifierWithQualifierFormat:
+ @"(from doesContain: %@)",
+ value];
+ else if ([criteria isEqualToString: @"subject_or_sender"])
+ qualifier = [EOQualifier qualifierWithQualifierFormat:
+ @"(subject doesContain: %@) OR "
+ @"(from doesContain: %@)",
+ value, value];
+ else if ([criteria isEqualToString: @"to_or_cc"])
+ qualifier = [EOQualifier qualifierWithQualifierFormat:
+ @"(to doesContain: %@) OR "
+ @"(cc doesContain: %@)",
+ value, value];
+ else if ([criteria isEqualToString: @"entire_message"])
+ qualifier = [EOQualifier qualifierWithQualifierFormat:
+ @"(message doesContain: %@)",
+ value];
+ else
+ qualifier = nil;
+
+ [qualifier retain];
+}
+
- (id) defaultAction
{
WORequest *request;
- NSString *specificMessage;
+ NSString *specificMessage, *searchCriteria, *searchValue;
- request = [[self context] request];
+ request = [context request];
[[self clientObject] flushMailCaches];
specificMessage = [request formValueForKey: @"pageforuid"];
- self->firstMessageNumber
+ searchCriteria = [request formValueForKey: @"search"];
+ searchValue = [request formValueForKey: @"value"];
+ if ([searchCriteria length] > 0
+ && [searchValue length] > 0)
+ [self _setQualifierForCriteria: searchCriteria
+ andValue: searchValue];
+
+ firstMessageNumber
= ((specificMessage)
? [self firstMessageOfPageFor: [specificMessage intValue]]
: [[request formValueForKey:@"idx"] intValue]);
{
// TODO: we might want to flush the caches?
NSException *error;
- id client;
-
- if ((client = [self clientObject]) == nil) {
- return [NSException exceptionWithHTTPStatus:404 /* Not Found */
- reason:@"did not find mail folder"];
- }
-
- if ((error = [[self clientObject] expunge]) != nil)
- return error;
+ id clientObject;
+
+ clientObject = [self clientObject];
+ if (clientObject)
+ {
+ error = [clientObject expunge];
+ if (!error)
+ {
+ if ([clientObject respondsToSelector: @selector(flushMailCaches)])
+ [clientObject flushMailCaches];
+ return [self redirectToLocation:@"view"];
+ }
+ }
+ else
+ error = [NSException exceptionWithHTTPStatus:404 /* Not Found */
+ reason: @"did not find mail folder"];
- if ([client respondsToSelector:@selector(flushMailCaches)])
- [client flushMailCaches];
- return [self redirectToLocation:@"view"];
+ return error;
}
@end
02111-1307, USA.
*/
+#warning importing common is baaaad
#import <Foundation/Foundation.h>
#if LIB_FOUNDATION_LIBRARY
superclass = "SoComponent";
protectedBy = "View";
defaultRoles = {
- "View" = ( "Authenticated", "FreeBusy" );
+ "View" = ( "Authenticated" );
};
};
SOGoObject = {
#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WODirectAction.h>
+#import <NGObjWeb/WOResponse.h>
+#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import "UIxJSONPreferences.h"
@implementation UIxJSONPreferences
+- (WOResponse *) _makeResponse: (NSString *) jsonText
+{
+ WOResponse *response;
+
+ response = [context response];
+ [response setHeader: @"text/plain; charset=utf-8"
+ forKey: @"content-type"];
+ [response appendContentString: jsonText];
+
+ return response;
+}
+
- (WOResponse *) jsonDefaultsAction
{
NSUserDefaults *defaults;
defaults = [[context activeUser] userDefaults];
- return [defaults jsonRepresentation];
+ return [self _makeResponse: [defaults jsonRepresentation]];
}
- (WOResponse *) jsonSettingsAction
settings = [[context activeUser] userSettings];
- return [settings jsonRepresentation];
+ return [self _makeResponse: [settings jsonRepresentation]];
}
@end
- (void) dealloc
{
- [self->queryParameters release];
- if (_selectedDate)
- [_selectedDate release];
+ [queryParameters release];
+ [_selectedDate release];
[super dealloc];
}
value = [[part substringFromIndex:(r.location + r.length)]
stringByUnescapingURL];
}
- [self->queryParameters setObject:value forKey:key];
+ [queryParameters setObject:value forKey:key];
part = [e nextObject];
}
}
NSRange r;
NSString *qs;
- if (self->queryParameters)
- return self->queryParameters;
+ if (queryParameters)
+ return queryParameters;
- self->queryParameters = [[NSMutableDictionary alloc] initWithCapacity:8];
+ queryParameters = [[NSMutableDictionary alloc] initWithCapacity:8];
req = [[self context] request];
uri = [req uri];
/* add form values */
[self addKeepAliveFormValuesToQueryParameters];
- return self->queryParameters;
+ return queryParameters;
}
- (NSDictionary *) queryParameters
"Search appointments" = "Recherche de rendez-vous";
"Search in Anais" = "Recherche par Anaïs";
-"All day Event" = "Toute la journée";
+"All day Event" = "Événement sur la journéee";
"check for conflicts" = "Vérifier les conflits";
"Browse URL" = "Visiter l'URL";
<tbody>
<tr class="tableview">
<!-- localize -->
- <td class="tbtv_headercell headerName">
- <var:component className="UIxSortableTableHeader"
- label:label="Name"
- const:sortKey="cn"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- />
- </td>
- <td class="tbtv_headercell headerEmail">
- <var:component className="UIxSortableTableHeader"
- label:label="Email"
- const:sortKey="mail"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- />
- </td>
- <td class="tbtv_headercell">
- <var:string label:value="Screen Name" />
- </td>
- <td class="tbtv_headercell">
- <var:string label:value="Organization" />
- </td>
- <td class="tbtv_headercell">
- <var:string label:value="Work Phone" />
- </td>
- </tr>
+ <td class="tbtv_headercell" id="nameHeader"
+ ><var:string label:value="Name"
+ /></td
+ ><td class="tbtv_headercell" id="mailHeader"
+ ><var:string label:value="Email"/></td
+ ><td class="tbtv_headercell" id="screenNameHeader"
+ ><var:string label:value="Screen Name" /></td
+ ><td class="tbtv_headercell" id="orgHeader"
+ ><var:string label:value="Organization" /></td
+ ><td class="tbtv_headercell" id="phoneHeader"
+ ><var:string label:value="Work Phone" /></td
+ ></tr>
<var:foreach list="contactInfos" item="currentContact">
<tr class="tableview"
onclick="return onContactRowClick(event, this);"
ondblclick="return onContactRowDblClick(event, this);"
oncontextmenu="return onContactContextMenu(event, this);">
- <td onmousedown="return false;"><img rsrc:src="abcard.gif"
+ <td><img rsrc:src="abcard.gif"
/><var:string value="displayName" const:escapeHTML="YES" /></td>
- <td onmousedown="return false;"><var:string value="currentContact.mail"/></td>
- <td onmousedown="return false;"><var:string value="currentContact.screenname"/></td>
- <td onmousedown="return false;"><var:string value="currentContact.o"/></td>
- <td onmousedown="return false;"><var:string value="currentContact.telephonenumber"/></td>
+ <td><var:string value="currentContact.mail"/></td>
+ <td><var:string value="currentContact.screenname"/></td>
+ <td><var:string value="currentContact.o"/></td>
+ <td><var:string value="currentContact.telephonenumber"/></td>
</tr>
</var:foreach>
</tbody>
>
<div class="menu" id="searchMenu">
<ul id="searchOptions">
- <li id="subject"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="Subject"/></li>
- <li id="sender"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="Sender"/></li>
- <li id="subject_or_sender"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="Subject or Sender"/></li>
- <li id="to_or_cc"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="To or Cc"/></li>
- <li id="entire_message"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="Entire Message"/></li>
- <li id="find_in_message"
- onmousedown="return false;"
- onmouseup="setSearchCriteria(event);"><var:string label:value="Find In Message"/></li>
+ <li id="subject"><var:string label:value="Subject"/></li>
+ <li id="sender"><var:string label:value="Sender"/></li>
+ <li id="subject_or_sender"><var:string
+ label:value="Subject or Sender"/></li>
+ <li id="to_or_cc"><var:string label:value="To or Cc"/></li>
+ <li id="entire_message"><var:string
+ label:value="Entire Message"/></li>
</ul>
</div>
-
+
<div id="filterPanel">
<var:if condition="hideFrame" const:negate="YES"
><span class="searchBox" style="float: right">
menuid="searchMenu" />
</span>
- <var:string label:value="View:" />
+<!-- <var:string label:value="View:" />
<var:popup list="filters"
item="filter" string="filterLabel" value="filter"
selection="selectedFilter"
- const:name="filterpopup" />
+ const:name="filterpopup" /> -->
</var:if>
</div>
</container>
<?xml version='1.0' standalone='yes'?>
- <table multiselect="yes" id="messageList"
- 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">
- <thead>
- <tr class="tableview"
- ><td class="tbtv_headercell messageFlagColumn"
- ><var:entity const:name="nbsp" /></td
- ><td class="tbtv_headercell messageFlagColumn">
- <img rsrc:src="title_attachment_14x14.png" width="14"
- height="14"
- /></td
- ><td class="tbtv_headercell tbtv_subject_headercell"
- ><var:component className="UIxSortableTableHeader"
- label:label="Subject"
- const:sortKey="subject"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- /></td
- ><td class="tbtv_headercell tbtv_from_headercell"
- ><var:if condition="showToAddress" const:negate="YES"
- ><var:component className="UIxSortableTableHeader"
- label:label="From"
- const:sortKey="from"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- /></var:if
- ><var:if condition="showToAddress"
- ><var:component className="UIxSortableTableHeader"
- label:label="To"
- const:sortKey="to"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- /></var:if
- ></td
- ><td class="tbtv_headercell messageFlagColumn"
- ><img rsrc:src="title_read_14x14.png" width="14" height="14"
- /></td
- ><td class="tbtv_headercell tbtv_date_headercell"
- ><var:component className="UIxSortableTableHeader"
- label:label="Date"
- const:sortKey="date"
- const:href="view"
- var:queryDictionary="context.request.formValues"
- const:isDefault="YES"
- /></td
- ></tr>
- <tr class="tableview"
- ><td colspan="6" class="tbtv_navcell"
- ><var:if condition="hasPrevious">
- <a href="#"
- idx="1"><var:string label:value="first"/></a> |
- <a href="#"
- var:idx="prevFirstMessageNumber"
- ><var:string label:value="previous"/></a> |
- </var:if>
- <var:string value="firstMessageNumber" />
- <var:string label:value="msgnumber_to" />
- <var:string value="lastMessageNumber" />
- <var:string label:value="msgnumber_of" />
- <var:string value="sortedUIDs.count" />
- <var:if condition="hasNext"
- >| <a href="#"
- var:idx="nextFirstMessageNumber"
- ><var:string label:value="next" /></a>
- </var:if
+<!DOCTYPE table>
+<table multiselect="yes" id="messageList"
+ 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">
+ <thead>
+ <tr class="tableview"
+ ><td class="tbtv_headercell messageFlagColumn"
+ ><var:entity const:name="nbsp" /></td
+ ><td class="tbtv_headercell messageFlagColumn">
+ <img rsrc:src="title_attachment_14x14.png" width="14"
+ height="14"/></td
+ ><td class="tbtv_headercell" id="subjectHeader"
+ ><var:string label:value="Subject"/></td
+ ><td class="tbtv_headercell" id="fromHeader"
+ ><var:if condition="showToAddress" const:negate="YES"
+ ><var:string label:value="From"/></var:if
+ ><var:if condition="showToAddress"
+ ><var:string label:value="To"/></var:if
+ ></td
+ ><td class="tbtv_headercell" id="messageFlagHeader"
+ ><img rsrc:src="title_read_14x14.png"/></td
+ ><td class="tbtv_headercell" id="dateHeader"
+ ><var:string label:value="Date"/></td
+ ></tr>
+ <tr class="tableview"
+ ><td colspan="6" class="tbtv_navcell"
+ ><var:if condition="hasPrevious">
+ <a href="#"
+ idx="1"><var:string label:value="first"/></a> |
+ <a href="#"
+ var:idx="prevFirstMessageNumber"
+ ><var:string label:value="previous"/></a> |
+ </var:if>
+ <var:string value="firstMessageNumber" />
+ <var:string label:value="msgnumber_to" />
+ <var:string value="lastMessageNumber" />
+ <var:string label:value="msgnumber_of" />
+ <var:string value="sortedUIDs.count" />
+ <var:if condition="hasNext"
+ >| <a href="#"
+ var:idx="nextFirstMessageNumber"
+ ><var:string label:value="next" /></a>
+ </var:if
+ ></td
+ ></tr
+ >
+ </thead>
+ <tbody>
+ <var:foreach list="messages" item="message"
+ ><tr var:class="messageRowStyleClass" var:id="msgRowID"
+ ><td class="messageFlagColumn"><var:entity name="nbsp"/></td
+ ><td class="messageFlagColumn"
+ ><var:if condition="hasMessageAttachment"
+ ><img rsrc:src="title_attachment_14x14.png"
+ /></var:if
></td
- ></tr
- >
- </thead>
- <tbody>
- <var:foreach list="messages" item="message"
- ><tr var:class="messageRowStyleClass" var:id="msgRowID"
- ><td class="messageFlagColumn"><var:entity name="nbsp"/></td
- ><td class="messageFlagColumn"
- ><var:if condition="hasMessageAttachment"
- ><img rsrc:src="title_attachment_14x14.png"
- /></var:if
- ></td
-
- ><td
- var:class="messageSubjectCellStyleClass"
- var:id="msgDivID"
- ><var:string value="message.envelope.subject"
- formatter="context.mailSubjectFormatter"
- /></td
+
+ ><td
+ var:class="messageSubjectCellStyleClass"
+ var:id="msgDivID"
+ ><var:string value="message.envelope.subject"
+ formatter="context.mailSubjectFormatter"
+ /></td
- ><td class="messageAddressColumn"
- ><var:if condition="showToAddress" const:negate="YES"
- ><var:string value="message.envelope.from"
- formatter="context.mailEnvelopeAddressFormatter"
- /></var:if
- ><var:if condition="showToAddress"
- ><var:string value="message.envelope.to"
- formatter="context.mailEnvelopeAddressFormatter"
- /></var:if
- ></td
-
- ><td class="messageFlagColumn"
- ><var:if condition="isMessageRead"
- ><img rsrc:src="icon_read.gif"
- class="mailerReadIcon"
- label:title="Mark Unread"
- label:title-markread="Mark Read"
- label:title-markunread="Mark Unread"
- var:id="msgIconReadImgID"
- /></var:if
- ><var:if condition="isMessageRead" const:negate="YES"
- ><img rsrc:src="icon_unread.gif"
- class="mailerUnreadIcon"
- label:title="Mark Read"
- label:title-markread="Mark Read"
- label:title-markunread="Mark Unread"
- var:id="msgIconUnreadImgID"
- /></var:if
- ></td
-
- ><td class="messageDateColumn"
- ><span class="mailer_datefield"
- ><var:string value="messageDate"
- /></span
- ><entity name="nbsp"
- /></td
- ></tr>
- </var:foreach>
- </tbody>
+ ><td class="messageAddressColumn"
+ ><var:if condition="showToAddress" const:negate="YES"
+ ><var:string value="message.envelope.from"
+ formatter="context.mailEnvelopeAddressFormatter"
+ /></var:if
+ ><var:if condition="showToAddress"
+ ><var:string value="message.envelope.to"
+ formatter="context.mailEnvelopeAddressFormatter"
+ /></var:if
+ ></td
+
+ ><td class="messageFlagColumn"
+ ><var:if condition="isMessageRead"
+ ><img rsrc:src="icon_read.gif"
+ class="mailerReadIcon"
+ label:title="Mark Unread"
+ label:title-markread="Mark Read"
+ label:title-markunread="Mark Unread"
+ var:id="msgIconReadImgID"
+ /></var:if
+ ><var:if condition="isMessageRead" const:negate="YES"
+ ><img rsrc:src="icon_unread.gif"
+ class="mailerUnreadIcon"
+ label:title="Mark Read"
+ label:title-markread="Mark Read"
+ label:title-markunread="Mark Unread"
+ var:id="msgIconUnreadImgID"
+ /></var:if
+ ></td
+
+ ><td class="messageDateColumn"
+ ><span class="mailer_datefield"
+ ><var:string value="messageDate"
+ /></span
+ ><entity name="nbsp"
+ /></td
+ ></tr>
+ </var:foreach>
+ </tbody>
</table>
<div id="rightPanel">
<var:component className="UIxMailFilterPanel" qualifier="qualifier" />
-
- <div id="mailboxContent"><!-- space --></div>
- <div class="dragHandle" id="rightDragHandle"><!-- space --></div>
- <div id="messageContent"><!-- space --></div>
+ <div id="mailboxContent"><!-- space --></div>
+ <div class="dragHandle" id="rightDragHandle"><!-- space --></div>
+ <div id="messageContent"><!-- space --></div>
</div>
<var:string value="errorAlertJavaScript" const:escapeHTML="NO" />
{ white-space: nowrap;
width: 20%; }
-TABLE#contactsList TD.headerName,
-TABLE#contactsList TD.headerEmail
+TD#nameHeader,
+TD#mailHeader
{ width: 30%; }
TABLE#contactsList TD IMG
/* JavaScript for SOGoContacts */
var cachedContacts = new Array();
-var currentContactFolder = '/personal';
+var currentContactFolder = null;
var usersRightsWindowHeight = 200;
var usersRightsWindowWidth = 450;
return true;
}
-function openContactsFolder(contactsFolder, params) {
- if (contactsFolder != currentContactFolder || params) {
+function openContactsFolder(contactsFolder, reload, idx) {
+ if (contactsFolder != currentContactFolder || reload) {
+ currentContactFolder = contactsFolder;
+ var url = URLForFolderID(currentContactFolder) +
+ "/view?noframe=1";
+
+ var searchValue = search["value"];
+ if (searchValue && searchValue.length > 0)
+ url += ("&search=" + search["criteria"]
+ + "&value=" + searchValue);
+ var sortAttribute = sorting["attribute"];
+ if (sortAttribute && sortAttribute.length > 0)
+ url += ("&sort=" + sorting["attribute"]
+ + "&asc=" + sorting["ascending"]);
+
+ var selection;
if (contactsFolder == currentContactFolder) {
var contactsList = $("contactsList");
if (contactsList)
window.alert("no contactsList");
}
else
- selection = null;
-
- currentContactFolder = contactsFolder;
- var url = URLForFolderID(currentContactFolder) +
- "/view?noframe=1&sort=cn&desc=0";
- if (params)
- url += '&' + params;
-
- var selection;
- if (document.contactsListAjaxRequest) {
- document.contactsListAjaxRequest.aborted = true;
- document.contactsListAjaxRequest.abort();
- }
- document.contactsListAjaxRequest
- = triggerAjaxRequest(url, contactsListCallback, selection);
+ selection = null;
+
+ if (document.contactsListAjaxRequest) {
+ document.contactsListAjaxRequest.aborted = true;
+ document.contactsListAjaxRequest.abort();
+ }
+ document.contactsListAjaxRequest
+ = triggerAjaxRequest(url, contactsListCallback, selection);
}
}
= triggerAjaxRequest(url, contactsListCallback);
}
+function configureContactsListHeaders(cells) {
+ for (var i = 0; i < cells.length; i++) {
+ var currentCell = $(cells[i]);
+ Event.observe(currentCell, "click",
+ onHeaderClick.bindAsEventListener(currentCell));
+ Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
+ }
+}
+
function contactsListCallback(http) {
var div = $("contactsListContent");
&& http.status == 200) {
document.contactsListAjaxRequest = null;
div.innerHTML = http.responseText;
+
+ var table = $("contactsList");
+ if (table)
+ configureContactsListHeaders(table.tBodies[0].rows[0].cells);
+
+ if (sorting["attribute"] && sorting["attribute"].length > 0) {
+ var sortHeader;
+ if (sorting["attribute"] == "cn")
+ sortHeader = $("nameHeader");
+ else if (sorting["attribute"] == "mail")
+ sortHeader = $("mailHeader");
+ else if (sorting["attribute"] == "screenname")
+ sortHeader = $("screenNameHeader");
+ else if (sorting["attribute"] == "o")
+ sortHeader = $("orgHeader");
+ else if (sorting["attribute"] == "telephonenumber")
+ sortHeader = $("phoneHeader");
+ else
+ sortHeader = null;
+
+ if (sortHeader) {
+ var sortImage = createElement("img", "messageSortImage", "sortImage");
+ sortHeader.insertBefore(sortImage, sortHeader.firstChild);
+ if (sorting["ascending"])
+ sortImage.src = ResourcesURL + "/title_sortdown_12x12.png";
+ else
+ sortImage.src = ResourcesURL + "/title_sortup_12x12.png";
+ }
+ }
+
var selected = http.callbackData;
if (selected) {
- for (var i = 0; i < selected.length; i++)
- $(selected[i]).select();
+ for (var i = 0; i < selected.length; i++) {
+ var row = $(selected[i]);
+ if (row)
+ row.select();
+ }
}
- configureSortableTableHeaders();
}
else
log ("ajax problem 1");
}
function onHeaderClick(event) {
- if (document.contactsListAjaxRequest) {
- document.contactsListAjaxRequest.aborted = true;
- document.contactsListAjaxRequest.abort();
- }
- url = URLForFolderID(currentContactFolder);
-// // log("url: " + url);
-// var url = "" + this.href;
- if (url.indexOf("noframe=", 0) == -1)
- url += "&noframe=1";
- document.contactsListAjaxRequest
- = triggerAjaxRequest(url, contactsListCallback);
+ var headerId = this.getAttribute("id");
+ var newSortAttribute;
+ if (headerId == "nameHeader")
+ newSortAttribute = "cn";
+ else if (headerId == "mailHeader")
+ newSortAttribute = "mail";
+ else if (headerId == "screenNameHeader")
+ newSortAttribute = "screenname";
+ else if (headerId == "orgHeader")
+ newSortAttribute = "o";
+ else if (headerId == "phoneHeader")
+ newSortAttribute = "telephonenumber";
+
+ log("header: " + headerId);
+
+ if (sorting["attribute"] == newSortAttribute)
+ sorting["ascending"] = !sorting["ascending"];
+ else {
+ sorting["attribute"] = newSortAttribute;
+ sorting["ascending"] = true;
+ }
+
+ refreshCurrentFolder();
- event.preventDefault();
+ preventDefault(event);
}
function registerDraggableMessageNodes() {
var div = $("contactsListContent");
div.innerHTML = "";
}
- else
- openContactsFolder(nodes[0].getAttribute("id"), null);
+ else {
+ search = {};
+ sorting = {};
+ $("searchValue").value = "";
+ initCriteria();
+ openContactsFolder(nodes[0].getAttribute("id"));
+ }
}
-function onSearchFormSubmit() {
- var searchValue = $("searchValue");
-
- openContactsFolder(currentContactFolder,
- "search=" + searchValue.value);
-
- return false;
+function refreshCurrentFolder() {
+ openContactsFolder(currentContactFolder, true);
}
function onConfirmContactSelection(event) {
&& selectorList.value != initialValues)
selector.changeNotification("addition");
- event.preventDefault();
+ preventDefault(event);
}
function onContactMailTo(node) {
}
function refreshContacts(contactId) {
- openContactsFolder(currentContactFolder, "reload=true");
- cachedContacts[currentContactFolder + "/" + contactId] = null;
- loadContact(contactId);
+ refreshCurrentFolder();
+ cachedContacts[currentContactFolder + "/" + contactId] = null;
+ loadContact(contactId);
- return false;
+ return false;
}
function onAddressBookNew(event) {
function onAddressBookAdd(event) {
openUserFolderSelector(newUserFolderCallback, "contact");
- event.preventDefault();
+ preventDefault(event);
}
function onFolderUnsubscribeCB(folderId) {
}
}
- event.preventDefault();
+ preventDefault(event);
}
function deletePersonalAddressBook(folderId) {
var personalFolder = $("/personal");
personalFolder.select();
+ openContactsFolder("/personal");
}
}
function setEventsOnContactFolder(node) {
- Event.observe(node, "mousedown", listRowMouseDownHandler, false);
- Event.observe(node, "click", onRowClick, false);
- Event.observe(node, "contextmenu", onContactFoldersContextMenu.bindAsEventListener(node), false);
+ Event.observe(node, "mousedown", listRowMouseDownHandler, false);
+ Event.observe(node, "click", onRowClick, false);
+ Event.observe(node, "contextmenu",
+ onContactFoldersContextMenu.bindAsEventListener(node), false);
}
function onMenuSharing(event) {
return menus;
}
-function configureSearchField() {
- var searchValue = $("searchValue");
-
- Event.observe(searchValue, "mousedown", onSearchMouseDown.bindAsEventListener(searchValue), false);
- Event.observe(searchValue, "click", popupSearchMenu.bindAsEventListener(searchValue), false);
- Event.observe(searchValue, "blur", onSearchBlur.bindAsEventListener(searchValue), false);
- Event.observe(searchValue, "focus", onSearchFocus.bindAsEventListener(searchValue), false);
- Event.observe(searchValue, "keydown", onSearchKeyDown.bindAsEventListener(searchValue), false);
-}
-
function configureSelectionButtons() {
var container = $("contactSelectionButtons");
if (container) {
var buttons = container.childNodesWithTag("input");
for (var i = 0; i < buttons.length; i++)
- Event.observe(buttons[i], "click", onConfirmContactSelection.bindAsEventListener(buttons[i]), false);
+ Event.observe(buttons[i], "click",
+ onConfirmContactSelection.bindAsEventListener(buttons[i]));
}
}
function initContacts(event) {
if (!document.body.hasClassName("popup")) {
configureAbToolbar();
- configureSearchField();
}
else
configureSelectionButtons();
}
TABLE#messageList
-{ display: block;
+{ cursor: default;
+ display: block;
position: absolute;
background-color: #fff;
color: #000;
TABLE#messageList TD
{ height: 1.2em; }
+TD#messageFlagHeader,
TABLE#messageList TD.messageFlagColumn
{ width: 1em;
text-align: center; }
+TD#subjectHeader,
TABLE#messageList TD.tbtv_subject_headercell,
TABLE#messageList td.mailer_unreadmailsubject,
TABLE#messageList td.mailer_readmailsubject
{ width: 40%;
min-width: 40%; }
+TD#fromHeader,
TABLE#messageList TD.tbtv_from_headercell,
TABLE#messageList TD.messageAddressColumn
{ width: 35%;
overflow: hidden; }
+TD#dateHeader,
TABLE#messageList TD.tbtv_date_headercell,
TABLE#messageList TD.messageDateColumn
{ width: 25%;
/* send AJAX request (synchronously) */
var messageId = currentMailbox + "/" + rowIds[i];
- url = ApplicationBaseURL + messageId + "/move?jsonly=1&tofolder=" + folder;
+ url = (ApplicationBaseURL + messageId
+ + "/move?jsonly=1&tofolder=" + folder);
http = createHTTPClient();
http.open("GET", url, false /* not async */);
http.send("");
this.select();
topNode.selectedEntry = this;
+ search = {};
+ sorting = {};
+ $("searchValue").value = "";
+ initCriteria();
+
var datatype = this.parentNode.getAttribute("datatype");
if (datatype == "account" || datatype == "additional") {
currentMailbox = mailbox;
window.alert("unimplemented");
}
-function _refreshWindowMailbox() {
- openMailbox(currentMailbox, true);
-}
-
function refreshMailbox() {
var topWindow = getTopWindow();
if (topWindow)
- topWindow._refreshWindowMailbox();
+ topWindow.refreshCurrentFolder();
return false;
}
-function openMailbox(mailbox, reload) {
+function openMailbox(mailbox, reload, idx) {
if (mailbox != currentMailbox || reload) {
currentMailbox = mailbox;
- var url = ApplicationBaseURL + mailbox + "/view?noframe=1&desc=1";
- var mailboxContent = $("mailboxContent");
- var rightDragHandle = $("rightDragHandle");
+ var url = ApplicationBaseURL + mailbox + "/view?noframe=1";
var messageContent = $("messageContent");
messageContent.innerHTML = '';
- if (mailbox.lastIndexOf("/") == 0) {
- var url = (ApplicationBaseURL + currentMailbox + "/"
- + "/view?noframe=1");
- if (document.messageAjaxRequest) {
- document.messageAjaxRequest.aborted = true;
- document.messageAjaxRequest.abort();
- }
- document.messageAjaxRequest
- = triggerAjaxRequest(url, messageCallback);
- mailboxContent.innerHTML = '';
- mailboxContent.style.visibility = "hidden;";
- rightDragHandle.style.visibility = "hidden;";
- messageContent.style.top = "0px;";
- } else {
- if (document.messageListAjaxRequest) {
- document.messageListAjaxRequest.aborted = true;
- document.messageListAjaxRequest.abort();
- }
- if (currentMessages[mailbox]) {
- loadMessage(currentMessages[mailbox]);
- url += '&pageforuid=' + currentMessages[mailbox];
- }
- document.messageListAjaxRequest
- = triggerAjaxRequest(url, messageListCallback,
- currentMessages[mailbox]);
- if (mailboxContent.getStyle('visibility') == "hidden") {
- mailboxContent.setStyle({ visibility: "visible" });
- rightDragHandle.setStyle({ visibility: "visible" });
- messageContent.setStyle({ top: (rightDragHandle.offsetTop
- + rightDragHandle.offsetHeight
- + 'px') });
- }
+
+ if (currentMessages[mailbox]) {
+ loadMessage(currentMessages[mailbox]);
+ url += '&pageforuid=' + currentMessages[mailbox];
+ }
+
+ var searchValue = search["value"];
+ if (searchValue && searchValue.length > 0)
+ url += ("&search=" + search["criteria"]
+ + "&value=" + searchValue);
+ var sortAttribute = sorting["attribute"];
+ if (sortAttribute && sortAttribute.length > 0)
+ url += ("&sort=" + sorting["attribute"]
+ + "&asc=" + sorting["ascending"]);
+ if (idx)
+ url += "&idx=" + idx;
+
+ if (document.messageListAjaxRequest) {
+ document.messageListAjaxRequest.aborted = true;
+ document.messageListAjaxRequest.abort();
}
+
+ var mailboxContent = $("mailboxContent");
+ if (mailboxContent.getStyle('visibility') == "hidden") {
+ mailboxContent.setStyle({ visibility: "visible" });
+ var rightDragHandle = $("rightDragHandle");
+ rightDragHandle.setStyle({ visibility: "visible" });
+ messageContent.setStyle({ top: (rightDragHandle.offsetTop
+ + rightDragHandle.offsetHeight
+ + 'px') });
+ }
+
+ document.messageListAjaxRequest
+ = triggerAjaxRequest(url, messageListCallback,
+ currentMessages[mailbox]);
}
- // triggerAjaxRequest(mailbox, 'toolbar', toolbarCallback);
}
function openMailboxAtIndex(event) {
- var idx = this.getAttribute("idx");
- var url = ApplicationBaseURL + currentMailbox + "/view?noframe=1&idx=" + idx;
-
- if (document.messageListAjaxRequest) {
- document.messageListAjaxRequest.aborted = true;
- document.messageListAjaxRequest.abort();
- }
- document.messageListAjaxRequest
- = triggerAjaxRequest(url, messageListCallback);
+ openMailbox(currentMailbox, true, this.getAttribute("idx"));
preventDefault(event);
}
div.innerHTML = http.responseText;
var selected = http.callbackData;
if (selected) {
- var row = $('row_' + selected);
- row.select();
+ var row = $("row_" + selected);
+ if (row)
+ row.select();
}
configureMessageListEvents();
- configureSortableTableHeaders();
+ if (sorting["attribute"] && sorting["attribute"].length > 0) {
+ var sortHeader;
+ if (sorting["attribute"] == "subject")
+ sortHeader = $("subjectHeader");
+ else if (sorting["attribute"] == "from")
+ sortHeader = $("fromHeader");
+ else if (sorting["attribute"] == "date")
+ sortHeader = $("dateHeader");
+ else
+ sortHeader = null;
+
+ if (sortHeader) {
+ var sortImage = createElement("img", "messageSortImage", "sortImage");
+ sortHeader.insertBefore(sortImage, sortHeader.firstChild);
+ if (sorting["ascending"])
+ sortImage.src = ResourcesURL + "/title_sortdown_12x12.png";
+ else
+ sortImage.src = ResourcesURL + "/title_sortup_12x12.png";
+ }
+ }
}
else
log("messageListCallback: problem during ajax request (readyState = " + http.readyState + ", status = " + http.status + ")");
}
function onHeaderClick(event) {
- if (document.messageListAjaxRequest) {
- document.messageListAjaxRequest.aborted = true;
- document.messageListAjaxRequest.abort();
+ var headerId = this.getAttribute("id");
+ var newSortAttribute;
+ if (headerId == "subjectHeader")
+ newSortAttribute = "subject";
+ else if (headerId == "fromHeader")
+ newSortAttribute = "from";
+ else if (headerId == "dateHeader")
+ newSortAttribute = "date";
+ else
+ newSortAttribute = "arrival";
+
+ if (sorting["attribute"] == newSortAttribute)
+ sorting["ascending"] = !sorting["ascending"];
+ else {
+ sorting["attribute"] = newSortAttribute;
+ sorting["ascending"] = true;
}
- var link = this.getAttribute('href');
- url = ApplicationBaseURL + currentMailbox + "/" + link;
- if (!link.match(/noframe=/))
- url += "&noframe=1";
- document.messageListAjaxRequest
- = triggerAjaxRequest(url, messageListCallback);
+
+ refreshCurrentFolder();
preventDefault(event);
}
-function onSearchFormSubmit() {
- log("search not implemented");
-
- return false;
+function refreshCurrentFolder() {
+ openMailbox(currentMailbox, true);
}
function pouetpouet(event) {
return msgIds;
}
+/* a model for a futur refactoring of the sortable table headers mechanism */
+
+function configureMessageListHeaders(cells) {
+ for (var i = 0; i < cells.length; i++) {
+ var currentCell = $(cells[i]);
+ Event.observe(currentCell, "click",
+ onHeaderClick.bindAsEventListener(currentCell));
+ Event.observe(currentCell, "mousedown", listRowMouseDownHandler);
+ }
+}
+
function configureMessageListEvents() {
var messageList = $("messageList");
if (messageList) {
Event.observe(messageList, "mousedown",
onMessageSelectionChange.bindAsEventListener(messageList));
+
+ configureMessageListHeaders(messageList.tHead.rows[0].cells);
var cell = messageList.tHead.rows[1].cells[0];
if ($(cell).hasClassName("tbtv_navcell")) {
var anchors = $(cell).childNodesWithTag("a");
rows[i].dndGhost = messageListGhost;
rows[i].dndDataForType = messageListData;
document.DNDManager.registerSource(rows[i]);
-
+
for (var j = 0; j < rows[i].cells.length; j++) {
var cell = rows[i].cells[j];
Event.observe(cell, "mousedown", listRowMouseDownHandler);
mailboxTree.o(1);
}
-function configureSearchField() {
- var searchValue = $("searchValue");
-
- Event.observe(searchValue, "mousedown", onSearchMouseDown.bindAsEventListener(searchValue));
- Event.observe(searchValue, "click", popupSearchMenu.bindAsEventListener(searchValue));
- Event.observe(searchValue, "blur", onSearchBlur.bindAsEventListener(searchValue));
- Event.observe(searchValue, "focus", onSearchFocus.bindAsEventListener(searchValue));
- Event.observe(searchValue, "keydown", onSearchKeyDown.bindAsEventListener(searchValue));
-}
-
function initMailer(event) {
if (!document.body.hasClassName("popup")) {
- configureSearchField();
configureMessageListEvents();
initDnd();
currentMailbox = "/" + accounts[0] + "/INBOX";
null);
menus["mark-menu"] = new Array(null, null, null, null, "-", null, "-",
null, null, null);
+ menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria,
+ setSearchCriteria, setSearchCriteria,
+ setSearchCriteria);
return menus;
}
function onUserAdd(event) {
openUserFolderSelector(null, "user");
- event.preventDefault();
+ preventDefault(event);
}
function removeUserCallback(http) {
var userId = nodes[i].getAttribute("id");
triggerAjaxRequest(baseURL + userId, removeUserCallback, nodes[i]);
}
- event.preventDefault();
+ preventDefault(event);
}
function subscribeToFolder(refreshCallback, refreshCallbackData) {
function openRightsForDefaultUser(event) {
openRightsForUserID(defaultUserID);
- event.preventDefault();
+ preventDefault(event);
}
function onOpenUserRights(event) {
openRightsForUser();
- event.preventDefault();
+ preventDefault(event);
}
function onAclLoadHandler() {
function onContactKeydown(event) {
if (event.keyCode == 9) {
- event.preventDefault();
+ preventDefault(event);
if (this.confirmedValue)
this.value = this.confirmedValue;
var row = this.parentNode.parentNode.nextSibling;
}
function onEditorOkClick(event) {
- event.preventDefault();
+ preventDefault(event);
attendeesNames = new Array();
attendeesEmails = new Array();
}
function onEditorCancelClick(event) {
- event.preventDefault();
+ preventDefault(event);
window.close();
}
function onPopupDocumentWindow(event) {
var documentUrl = $("url");
- event.preventDefault();
+ preventDefault(event);
window.open(documentUrl.value, "SOGo_Document");
return false;
}
function onFolderTreeItemClick(event) {
- event.preventDefault();
+ preventDefault(event);
var topNode = $("d");
if (topNode.selectedEntry)
-// written by Dean Edwards, 2005\r
-// with input from Tino Zijdel, Matthias Miller, Diego Perini\r
-// http://dean.edwards.name/weblog/2005/10/add-event/\r
-function addEvent(element, type, handler) {\r
- // Modification by Tanny O'Haley, http://tanny.ica.com to add the\r
- // DOMContentLoaded for all browsers.\r
- if (type == "DOMContentLoaded" || type == "domload") {\r
- addDOMLoadEvent(handler);\r
- return;\r
- }\r
- \r
- if (element.addEventListener) {\r
- element.addEventListener(type, handler, false);\r
- } else {\r
- // assign each event handler a unique ID\r
- if (!handler.$$guid) handler.$$guid = addEvent.guid++;\r
- // create a hash table of event types for the element\r
- if (!element.events) element.events = {};\r
- // create a hash table of event handlers for each element/event pair\r
- var handlers = element.events[type];\r
- if (!handlers) {\r
- handlers = element.events[type] = {};\r
- // store the existing event handler (if there is one)\r
- if (element["on" + type]) {\r
- handlers[0] = element["on" + type];\r
- }\r
- }\r
- // store the event handler in the hash table\r
- handlers[handler.$$guid] = handler;\r
- // assign a global event handler to do all the work\r
- element["on" + type] = handleEvent;\r
- }\r
-};\r
-// a counter used to create unique IDs\r
-addEvent.guid = 1;\r
-\r
-function removeEvent(element, type, handler) {\r
- if (element.removeEventListener) {\r
- element.removeEventListener(type, handler, false);\r
- } else {\r
- // delete the event handler from the hash table\r
- if (element.events && element.events[type]) {\r
- delete element.events[type][handler.$$guid];\r
- }\r
- }\r
-};\r
-\r
-function handleEvent(event) {\r
- var returnValue = true;\r
- // grab the event object (IE uses a global event object)\r
- event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);\r
- // get a reference to the hash table of event handlers\r
- var handlers = this.events[event.type];\r
- // execute each event handler\r
- for (var i in handlers) {\r
- this.$$handleEvent = handlers[i];\r
- if (this.$$handleEvent(event) === false) {\r
- returnValue = false;\r
- }\r
- }\r
- return returnValue;\r
-};\r
-\r
-function fixEvent(event) {\r
- // add W3C standard event methods\r
- event.preventDefault = fixEvent.preventDefault;\r
- event.stopPropagation = fixEvent.stopPropagation;\r
- return event;\r
-};\r
-fixEvent.preventDefault = function() {\r
- this.returnValue = false;\r
-};\r
-fixEvent.stopPropagation = function() {\r
- this.cancelBubble = true;\r
-};\r
-\r
-// End Dean Edwards addEvent.\r
-\r
-// Tino Zijdel - crisp@xs4all.nl This little snippet fixes the problem that the onload attribute on \r
-// the body-element will overwrite previous attached events on the window object for the onload event.\r
-if (!window.addEventListener) {\r
- document.onreadystatechange = function(){\r
- if (window.onload && window.onload != handleEvent) {\r
- addEvent(window, 'load', window.onload);\r
- window.onload = handleEvent;\r
- }\r
- }\r
-}\r
-\r
-// Here are my functions for adding the DOMContentLoaded event to browsers other\r
-// than Mozilla.\r
-\r
-// Array of DOMContentLoaded event handlers.\r
-window.onDOMLoadEvents = new Array();\r
-window.DOMContentLoadedInitDone = false;\r
-\r
-// Function that adds DOMContentLoaded listeners to the array.\r
-function addDOMLoadEvent(listener) {\r
- window.onDOMLoadEvents[window.onDOMLoadEvents.length]=listener;\r
-}\r
-\r
-// Function to process the DOMContentLoaded events array.\r
-function DOMContentLoadedInit() {\r
- // quit if this function has already been called\r
- if (window.DOMContentLoadedInitDone) return;\r
-\r
- // flag this function so we don't do the same thing twice\r
- window.DOMContentLoadedInitDone = true;\r
-\r
- // iterates through array of registered functions \r
- for (var i=0; i<window.onDOMLoadEvents.length; i++) {\r
- var func = window.onDOMLoadEvents[i];\r
- func();\r
- }\r
-}\r
-\r
-function DOMContentLoadedScheduler() {\r
- // quit if the init function has already been called\r
- if (window.DOMContentLoadedInitDone) return true;\r
- \r
- // First, check for Safari or KHTML.\r
- // Second, check for IE.\r
- //if DOM methods are supported, and the body element exists\r
- //(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1] \r
- //in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)\r
- if(/KHTML|WebKit/i.test(navigator.userAgent)) {\r
- if(/loaded|complete/.test(document.readyState)) {\r
- DOMContentLoadedInit();\r
- } else {\r
- // Not ready yet, wait a little more.\r
- setTimeout("DOMContentLoadedScheduler()", 250);\r
- }\r
- } else if(document.getElementById("__ie_onload")) {\r
- return true;\r
- } else if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null)) {\r
- DOMContentLoadedInit();\r
- } else {\r
- // Not ready yet, wait a little more.\r
- setTimeout("DOMContentLoadedScheduler()", 250);\r
- }\r
- \r
- return true;\r
-}\r
-\r
-// Schedule to run the init function.\r
-setTimeout("DOMContentLoadedScheduler()", 250);\r
-\r
-// Just in case window.onload happens first, add it there too.\r
-addEvent(window, "load", DOMContentLoadedInit);\r
-\r
-// If addEventListener supports the DOMContentLoaded event.\r
-if(document.addEventListener)\r
- document.addEventListener("DOMContentLoaded", DOMContentLoadedInit, false);\r
-\r
-/* for Internet Explorer */\r
-/*@cc_on @*/\r
-/*@if (@_win32)\r
- document.write("<script id=__ie_onload defer src=\"//:\"><\/script>");\r
- var script = document.getElementById("__ie_onload");\r
- script.onreadystatechange = function() {\r
- if (this.readyState == "complete") {\r
- DOMContentLoadedInit(); // call the onload handler\r
- }\r
- };\r
-/*@end @*/\r
+// written by Dean Edwards, 2005
+// with input from Tino Zijdel, Matthias Miller, Diego Perini
+// http://dean.edwards.name/weblog/2005/10/add-event/
+function addEvent(element, type, handler) {
+ // Modification by Tanny O'Haley, http://tanny.ica.com to add the
+ // DOMContentLoaded for all browsers.
+ if (type == "DOMContentLoaded" || type == "domload") {
+ addDOMLoadEvent(handler);
+ return;
+ }
+
+ if (element.addEventListener) {
+ element.addEventListener(type, handler, false);
+ } else {
+ // assign each event handler a unique ID
+ if (!handler.$$guid) handler.$$guid = addEvent.guid++;
+ // create a hash table of event types for the element
+ if (!element.events) element.events = {};
+ // create a hash table of event handlers for each element/event pair
+ var handlers = element.events[type];
+ if (!handlers) {
+ handlers = element.events[type] = {};
+ // store the existing event handler (if there is one)
+ if (element["on" + type]) {
+ handlers[0] = element["on" + type];
+ }
+ }
+ // store the event handler in the hash table
+ handlers[handler.$$guid] = handler;
+ // assign a global event handler to do all the work
+ element["on" + type] = handleEvent;
+ }
+};
+// a counter used to create unique IDs
+addEvent.guid = 1;
+
+function removeEvent(element, type, handler) {
+ if (element.removeEventListener) {
+ element.removeEventListener(type, handler, false);
+ } else {
+ // delete the event handler from the hash table
+ if (element.events && element.events[type]) {
+ delete element.events[type][handler.$$guid];
+ }
+ }
+};
+
+function handleEvent(event) {
+ var returnValue = true;
+ // grab the event object (IE uses a global event object)
+ event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
+ // get a reference to the hash table of event handlers
+ var handlers = this.events[event.type];
+ // execute each event handler
+ for (var i in handlers) {
+ this.$$handleEvent = handlers[i];
+ if (this.$$handleEvent(event) === false) {
+ returnValue = false;
+ }
+ }
+ return returnValue;
+};
+
+function fixEvent(event) {
+ // add W3C standard event methods
+ event.preventDefault = fixEvent.preventDefault;
+ event.stopPropagation = fixEvent.stopPropagation;
+ return event;
+};
+fixEvent.preventDefault = function() {
+ this.returnValue = false;
+};
+fixEvent.stopPropagation = function() {
+ this.cancelBubble = true;
+};
+
+// End Dean Edwards addEvent.
+
+// Tino Zijdel - crisp@xs4all.nl This little snippet fixes the problem that the onload attribute on
+// the body-element will overwrite previous attached events on the window object for the onload event.
+if (!window.addEventListener) {
+ document.onreadystatechange = function(){
+ if (window.onload && window.onload != handleEvent) {
+ addEvent(window, 'load', window.onload);
+ window.onload = handleEvent;
+ }
+ }
+}
+
+// Here are my functions for adding the DOMContentLoaded event to browsers other
+// than Mozilla.
+
+// Array of DOMContentLoaded event handlers.
+window.onDOMLoadEvents = new Array();
+window.DOMContentLoadedInitDone = false;
+
+// Function that adds DOMContentLoaded listeners to the array.
+function addDOMLoadEvent(listener) {
+ window.onDOMLoadEvents[window.onDOMLoadEvents.length]=listener;
+}
+
+// Function to process the DOMContentLoaded events array.
+function DOMContentLoadedInit() {
+ // quit if this function has already been called
+ if (window.DOMContentLoadedInitDone) return;
+
+ // flag this function so we don't do the same thing twice
+ window.DOMContentLoadedInitDone = true;
+
+ // iterates through array of registered functions
+ for (var i=0; i<window.onDOMLoadEvents.length; i++) {
+ var func = window.onDOMLoadEvents[i];
+ func();
+ }
+}
+
+function DOMContentLoadedScheduler() {
+ // quit if the init function has already been called
+ if (window.DOMContentLoadedInitDone) return true;
+
+ // First, check for Safari or KHTML.
+ // Second, check for IE.
+ //if DOM methods are supported, and the body element exists
+ //(using a double-check including document.body, for the benefit of older moz builds [eg ns7.1]
+ //in which getElementsByTagName('body')[0] is undefined, unless this script is in the body section)
+ if(/KHTML|WebKit/i.test(navigator.userAgent)) {
+ if(/loaded|complete/.test(document.readyState)) {
+ DOMContentLoadedInit();
+ } else {
+ // Not ready yet, wait a little more.
+ setTimeout("DOMContentLoadedScheduler()", 250);
+ }
+ } else if(document.getElementById("__ie_onload")) {
+ return true;
+ } else if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null)) {
+ DOMContentLoadedInit();
+ } else {
+ // Not ready yet, wait a little more.
+ setTimeout("DOMContentLoadedScheduler()", 250);
+ }
+
+ return true;
+}
+
+// Schedule to run the init function.
+setTimeout("DOMContentLoadedScheduler()", 250);
+
+// Just in case window.onload happens first, add it there too.
+addEvent(window, "load", DOMContentLoadedInit);
+
+// If addEventListener supports the DOMContentLoaded event.
+if(document.addEventListener)
+ document.addEventListener("DOMContentLoaded", DOMContentLoadedInit, false);
+
+/* for Internet Explorer */
+/*@cc_on @*/
+/*@if (@_win32)
+ document.write("<script id=__ie_onload defer src=\"//:\"><\/script>");
+ var script = document.getElementById("__ie_onload");
+ script.onreadystatechange = function() {
+ if (this.readyState == "complete") {
+ DOMContentLoadedInit(); // call the onload handler
+ }
+ };
+/*@end @*/
TD.headerCell,
TD.tbtv_headercell,
TD.tbtv_navcell
-{ background-color: #d4d0c8;
+{ vertical-align: middle;
+ background-color: #d4d0c8;
border-top: 1px solid #fff;
border-left: 1px solid #fff;
border-right: 2px solid #222;
TD.headerCell:active,
TD.tbtv_headercell:active
-{ background-color: #DCDAD5;
- border: 1px solid #9c9a94;
- -moz-border-bottom-colors: #9c9a94;
- -moz-border-right-colors: #9c9a94; }
+{ background-color: #dcdad5;
+ padding-top: 2px;
+ border-top: 1px solid #9c9a94;
+ border-left: 1px solid #9c9a94;
+ border-right: 2px solid #9c9a94;
+ border-bottom: 1px solid #9c9a94; }
TD.headerCell SPAN,
td.tbtv_headercell SPAN
/* background-color: #C4C0B8; */
}
+IMG.sortImage,
TD.headerCell IMG.tbtv_sortcell,
td.tbtv_headercell img.tbtv_sortcell
{ float: right;
var activeAjaxRequests = 0;
var menus = new Array();
+var search = {};
+var sorting = {};
var weekStartIsMonday = true;
// logArea = null;
var allDocumentElements = null;
+var userDefaults = null;
+var userSettings = null;
+
/* a W3C compliant document.all */
function getAllScopeElements(scope) {
var elements = new Array();
}
}
+function createElement(tagName, id, classes, attributes, htmlAttributes,
+ parentNode) {
+ var newElement = $(document.createElement(tagName));
+ if (id)
+ newElement.setAttribute("id", id);
+ if (classes) {
+ if (typeof(classes) == "string")
+ newElement.addClassName(classes);
+ else
+ for (var i = 0; i < classes.length; i++)
+ newElement.addClassName(classes[i]);
+ }
+ if (attributes)
+ for (var i in attributes)
+ newElement[i] = attributes[i];
+ if (htmlAttributes)
+ for (var i in htmlAttributes)
+ newElement.setAttribute(i, attributes[i]);
+ if (parentNode)
+ parentNode.appendChild(newElement);
+
+ return $(newElement);
+}
+
function ml_stripActionInURL(url) {
if (url[url.length - 1] != '/') {
var i;
// http://developer.apple.com/internet/webcontent/xmlhttpreq.html
if (typeof XMLHttpRequest != "undefined")
return new XMLHttpRequest();
-
+
try { return new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { }
try { return new ActiveXObject("Microsoft.XMLHTTP"); }
/* search field */
function popupSearchMenu(event) {
- var node = getTarget(event);
-
var menuId = this.getAttribute("menuid");
- relX = event.pageX - node.cascadeLeftOffset();
- relY = event.pageY - node.cascadeTopOffset();
+ relX = event.pageX - $(this).cascadeLeftOffset();
+ relY = event.pageY - $(this).cascadeTopOffset();
if (event.button == 0
&& relX < 24) {
if (document.currentPopupMenu)
hideMenu(event, document.currentPopupMenu);
- var popup = document.getElementById(menuId);
- popup.setStyle({ top: node.offsetHeight + "px",
- left: (node.offsetLeft + 3) + "px",
+ var popup = $(menuId);
+ popup.setStyle({ top: this.offsetHeight + "px",
+ left: (this.offsetLeft + 3) + "px",
visibility: "visible" });
document.currentPopupMenu = popup;
searchCriteria = $("searchCriteria");
searchValue.setAttribute("ghost-phrase", this.innerHTML);
-// searchCriteria = this.getAttribute('id');
+ searchCriteria.value = this.getAttribute('id');
}
function checkSearchValue(event) {
log ("onSearchChange()...");
}
+function configureSearchField() {
+ var searchValue = $("searchValue");
+
+ Event.observe(searchValue, "mousedown",
+ onSearchMouseDown.bindAsEventListener(searchValue));
+ Event.observe(searchValue, "click",
+ popupSearchMenu.bindAsEventListener(searchValue));
+ Event.observe(searchValue, "blur",
+ onSearchBlur.bindAsEventListener(searchValue));
+ Event.observe(searchValue, "focus",
+ onSearchFocus.bindAsEventListener(searchValue));
+ Event.observe(searchValue, "keydown",
+ onSearchKeyDown.bindAsEventListener(searchValue));
+}
+
function onSearchMouseDown(event) {
var superNode = this.parentNode.parentNode.parentNode;
relX = (event.pageX - superNode.offsetLeft - this.offsetLeft);
this.timer = setTimeout("onSearchFormSubmit()", 1000);
}
+function onSearchFormSubmit(event) {
+ var searchValue = $("searchValue");
+ var searchCriteria = $("searchCriteria");
+
+ search["criteria"] = searchCriteria.value;
+ search["value"] = searchValue.value;
+
+ refreshCurrentFolder();
+}
+
function initCriteria() {
var searchCriteria = $("searchCriteria");
var searchValue = $("searchValue");
- var firstOption;
- var searchOptions = $("searchOptions");
- if (searchOptions) {
- var firstOption;
- $A(searchOptions.childNodes).each(function (item) {
- if (item.tagName == 'LI') {
- firstOption = item;
- }
- });
- searchCriteria.value = firstOption.getAttribute('id');
- searchValue.setAttribute('ghost-phrase', firstOption.innerHTML);
+ var searchOptions = $("searchOptions").childNodesWithTag("li");
+ if (searchOptions.length > 0) {
+ var firstChild = searchOptions[0];
+ searchCriteria.value = $(firstChild).getAttribute('id');
+ searchValue.setAttribute('ghost-phrase', firstChild.innerHTML);
if (searchValue.value == '') {
- searchValue.value = firstOption.innerHTML;
+ searchValue.value = firstChild.innerHTML;
searchValue.setAttribute("modified", "");
searchValue.setStyle({ color: "#aaa" });
}
}
function listRowMouseDownHandler(event) {
- preventDefault(event);
+ preventDefault(event);
}
/* tabs */
return color;
}
+function loadPreferences() {
+ var url = UserFolderURL + "jsonDefaults";
+ var http = createHTTPClient();
+ http.open("GET", url, false);
+ http.send("");
+ if (http.status == 200)
+ userDefaults = http.responseText.evalJSON(true);
+
+ url = UserFolderURL + "jsonSettings";
+ http.open("GET", url, false);
+ http.send("");
+ if (http.status == 200)
+ userSettings = http.responseText.evalJSON(true);
+}
+
function onLoadHandler(event) {
- queryParameters = parseQueryParameters('' + window.location);
- if (!$(document.body).hasClassName("popup")) {
- initLogConsole();
- initCriteria();
- }
- initMenus();
- initTabs();
- configureDragHandles();
- configureSortableTableHeaders();
- configureLinkBanner();
- var progressImage = $("progressIndicator");
- if (progressImage)
- progressImage.parentNode.removeChild(progressImage);
- Event.observe(document.body, "contextmenu", onBodyClickContextMenu);
+ loadPreferences();
+ queryParameters = parseQueryParameters('' + window.location);
+ if (!$(document.body).hasClassName("popup")) {
+ initLogConsole();
+ initCriteria();
+ configureSearchField();
+ }
+ initMenus();
+ initTabs();
+ configureDragHandles();
+ configureSortableTableHeaders();
+ configureLinkBanner();
+ var progressImage = $("progressIndicator");
+ if (progressImage)
+ progressImage.parentNode.removeChild(progressImage);
+ Event.observe(document.body, "contextmenu", onBodyClickContextMenu);
}
function onBodyClickContextMenu(event) {
- preventDefault(event);
+ preventDefault(event);
}
function configureSortableTableHeaders() {
- var headers = document.getElementsByClassName("sortableTableHeader");
- for (var i = 0; i < headers.length; i++) {
- var header = headers[i];
- var anchor = $(header).childNodesWithTag("a")[0];
- if (anchor)
- Event.observe(anchor, "click",
- onHeaderClick.bindAsEventListener(anchor));
- }
+ var headers = document.getElementsByClassName("sortableTableHeader");
+ for (var i = 0; i < headers.length; i++) {
+ var header = headers[i];
+ var anchor = $(header).childNodesWithTag("a")[0];
+ if (anchor)
+ Event.observe(anchor, "click",
+ onHeaderClick.bindAsEventListener(anchor));
+ }
}
function onLinkBannerClick() {
w.opener = window;
w.focus();
- event.preventDefault();
+ preventDefault(event);
}
function configureLinkBanner() {
addEvent(window, 'load', onLoadHandler);
+function parent$(element) {
+ return this.opener.document.getElementById(element);
+}
+
/* stubs */
+function refreshCurrentFolder() {
+}
+
function configureDragHandles() {
}
function onHeaderClick(event) {
window.alert("generic headerClick");
}
-
-function parent$(element) {
- return this.opener.document.getElementById(element);
-}