+2007-11-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/SOGo/NSCalendarDate+SOGo.m ([NSCalendarDate
+ +distantFuture]): rewrote method to return an object that is
+ compatible with NSCalendarDate, unlike the implementation in
+ GNUstep.
+ ([NSCalendarDate +distantPast]): same as above.
+
+2007-11-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * UI/MailPartViewers/UIxMailPartHTMLViewer.m: fixed infinite loop
+ when charset is us-ascii, match it to ascii rather than none.
+
+ * SoObjects/Appointments/SOGoAppointmentFolder.m
+ ([SOGoAppointmentFolder
+ -fetchFields:_fieldsfromFolder:_folderfrom:_startDateto:_endDatetitle:titlecomponent:_component]):
+ added search on the c_title column too.
+
+ * UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions
+ -eventsListAction]): take the "search" url parameter into account.
+ ([UIxCalListingActions -eventsListAction]): fetch events matching
+ the title filter too.
+
+ * UI/MainUI/SOGoRootPage.m ([SOGoRootPage -connectAction]): the
+ user infos are now posted as "application/x-www-form-urlencoded".
+ So we have to have like a form has been posted.
+
+2007-11-21 Francis Lachapelle <flachapelle@inverse.ca>
+
+ * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor
+ -calendarList]): also returns the calendar of the current
+ event. This is required so the proper calender is selected when
+ you view an event to which you don't have write access.
+
+ * UI/Common/UIxAclEditor.m ([UIxAclEditor -currentUserIsOwner]):
+ also returns true for super users.
+
+2007-11-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
+ -lookupImap4BodyPartKey:inContext:]): return a correct body part
+ when "0" is requested, taking its mime-type into account.
+
+ * UI/MailPartViewers/UIxMailRenderingContext.m
+ ([UIxMailRenderingContext -flatContentForPartPath:_partPath]):
+ return content for part "0", which would be the message body.
+
2007-11-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/MailPartViewers/UIxMailPartHTMLViewer.m
+2007-11-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+
+ * iCalEntityObject.m ([iCalEntityObject -compare:otherObject]):
+ safely compare between objects which may be nil.
+
2007-11-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* iCalPerson.m ([-rsvp]): return lowercase string.
return nil; /* not found */
}
+- (NSComparisonResult) _compareValue: (id) selfValue
+ withValue: (id) otherValue
+{
+ NSComparisonResult result;
+
+ if (selfValue)
+ {
+ if (otherValue)
+ result = [selfValue compare: otherValue];
+ else
+ result = NSOrderedDescending;
+ }
+ else
+ {
+ if (otherValue)
+ result = NSOrderedAscending;
+ else
+ result = NSOrderedSame;
+ }
+
+ return result;
+}
+
- (NSComparisonResult) _compareVersions: (iCalEntityObject *) otherObject
{
NSComparisonResult result;
- result = [[self sequence] compare: [otherObject sequence]];
+ result = [self _compareValue: [self sequence]
+ withValue: [otherObject sequence]];
if (result == NSOrderedSame)
- result = [[self lastModified] compare: [otherObject lastModified]];
+ result = [self _compareValue: [self lastModified]
+ withValue: [otherObject lastModified]];
return result;
}
fromFolder: (GCSFolder *) _folder
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component;
- (NSArray * ) fetchFields: (NSArray *) _fields
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component;
- (NSArray *) fetchCoreInfosFrom: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component;
- (NSArray *) fetchFreeBusyInfosFrom: (NSCalendarDate *) _startDate
currentFilter = [filters objectAtIndex: 0];
apts = [self fetchCoreInfosFrom: [currentFilter objectForKey: @"start"]
to: [currentFilter objectForKey: @"end"]
+ title: [currentFilter objectForKey: @"title"]
component: [currentFilter objectForKey: @"name"]];
appointments = [apts objectEnumerator];
appointment = [appointments nextObject];
fromFolder: (GCSFolder *) _folder
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component
{
EOQualifier *qualifier;
NSMutableArray *fields, *ma = nil;
NSArray *records;
- NSString *sql, *dateSqlString, *componentSqlString, *privacySqlString;
+ NSString *sql, *dateSqlString, *titleSqlString, *componentSqlString,
+ *privacySqlString;
NGCalendarDateRange *r;
if (_folder == nil) {
dateSqlString = @"";
}
+ if ([title length])
+ titleSqlString = [NSString stringWithFormat: @"AND (c_title"
+ @" isCaseInsensitiveLike: '%%%@%%')", title];
+ else
+ titleSqlString = @"";
+
componentSqlString = [self _sqlStringForComponent: _component];
privacySqlString = [self _privacySqlString];
if (logger)
[self debugWithFormat:@"should fetch (%@=>%@) ...", _startDate, _endDate];
- sql = [NSString stringWithFormat: @"(c_iscycle = 0)%@%@%@",
- dateSqlString, componentSqlString, privacySqlString];
+ sql = [NSString stringWithFormat: @"(c_iscycle = 0)%@%@%@%@",
+ dateSqlString, titleSqlString,
+ componentSqlString, privacySqlString];
/* fetch non-recurrent apts first */
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
/* fetch recurrent apts now. we do NOT consider the date range when doing that
as the c_startdate/c_enddate of a recurring event is always set to the first
recurrence - others are generated on the fly */
- sql = [NSString stringWithFormat: @"(c_iscycle = 1)%@%@", componentSqlString, privacySqlString];
+ sql = [NSString stringWithFormat: @"(c_iscycle = 1)%@%@%@", titleSqlString,
+ componentSqlString, privacySqlString];
qualifier = [EOQualifier qualifierWithQualifierFormat: sql];
- (NSArray *) fetchFields: (NSArray *) _fields
from: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component
{
GCSFolder *folder;
return [self fetchFields: _fields fromFolder: folder
from: _startDate to: _endDate
+ title: title
component: _component];
}
@"c_isopaque", @"c_status", nil];
return [self fetchFields: infos from: _startDate to: _endDate
+ title: nil
component: @"vevent"];
}
- (NSArray *) fetchCoreInfosFrom: (NSCalendarDate *) _startDate
to: (NSCalendarDate *) _endDate
+ title: (NSString *) title
component: (id) _component
{
static NSArray *infos = nil; // TODO: move to a plist file
@"c_partstates", @"c_sequence", @"c_priority", @"c_cycleinfo",
nil];
- return [self fetchFields: infos from: _startDate to: _endDate
+ return [self fetchFields: infos from: _startDate to: _endDate title: title
component: _component];
}
results = [aptFolder fetchFields: _fields
from: _startDate
to: _endDate
+ title: nil
component: _component];
if (![results isNotNull]) continue;
classString = @"SOGoMessageMailBodyPart";
else
{
- NSLog (@"unhandled mime type: '%@'", mimeType);
- classString = nil;
+ classString = @"SOGoMailBodyPart";
+// NSLog (@"unhandled mime type: '%@'", mimeType);
}
- if (classString)
- klazz = NSClassFromString (classString);
- else
- klazz = [SOGoMailBodyPart class];
+ klazz = NSClassFromString (classString);
return klazz;
}
/* We don't have parts here but we're trying to download the message's
content that could be an image/jpeg, as an example */
- if ([parts count] == 0)
+ if ([parts count] == 0 && ![_key intValue])
{
- return [SOGoMailBodyPart objectWithName: @"1" inContainer: self];
+ partDesc = [self bodyStructure];
+ _key = @"1";
+ }
+ else
+ {
+ part = [_key intValue] - 1;
+ if (part > -1 && part < [parts count])
+ partDesc = [parts objectAtIndex: part];
+ else
+ partDesc = nil;
}
- part = [_key intValue] - 1;
- if (part > -1 && part < [parts count])
+ if (partDesc)
{
- partDesc = [parts objectAtIndex: part];
mimeType = [[partDesc keysWithFormat: @"%{type}/%{subtype}"] lowercaseString];
clazz = [SOGoMailBodyPart bodyPartClassForMimeType: mimeType
inContext: _ctx];
}
else
clazz = Nil;
-
+
return [clazz objectWithName:_key inContainer: self];
}
- (NSString *) rfc822DateString;
++ (id) distantFuture;
++ (id) distantPast;
+
@end
#endif /* NSCALENDARDATE_SCHEDULER_H */
timeZoneShift];
}
+#define secondsOfDistantFuture 63113990400.0
+#define secondsOfDistantPast -63113817600.0
+
++ (id) distantFuture
+{
+ static NSCalendarDate *date = nil;
+
+ if (!date)
+ date
+ = [[self alloc] initWithTimeIntervalSinceReferenceDate: secondsOfDistantFuture];
+
+ return date;
+}
+
++ (id) distantPast
+{
+ static NSCalendarDate *date = nil;
+
+ if (!date)
+ date
+ = [[self alloc] initWithTimeIntervalSinceReferenceDate: secondsOfDistantPast];
+
+ return date;
+}
+
@end
#import <SoObjects/SOGo/SOGoContentObject.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
+#import <SoObjects/SOGo/SOGoUser.h>
#import "UIxAclEditor.h"
return [self _displayNameForUID: currentUser];
}
-- (NSString *) toolbar
-{
- NSString *currentLogin, *ownerLogin;
-
- currentLogin = [[context activeUser] login];
- ownerLogin = [[self clientObject] ownerInContext: context];
-
- return (([ownerLogin isEqualToString: currentLogin])
- ? @"SOGoAclOwner.toolbar" : @"SOGoAclAssistant.toolbar");
-}
-
- (void) setUserUIDS: (NSString *) retainedUsers
{
if ([retainedUsers length] > 0)
- (BOOL) currentUserIsOwner
{
SOGoObject *clientObject;
+ SOGoUser *user;
NSString *currentUserLogin, *ownerLogin;
-
+
clientObject = [self clientObject];
ownerLogin = [clientObject ownerInContext: context];
- currentUserLogin = [[context activeUser] login];
-
- return [ownerLogin isEqualToString: currentUserLogin];
+ user = [context activeUser];
+ currentUserLogin = [user login];
+
+ return ([ownerLogin isEqualToString: currentUserLogin]
+ || ([user respondsToSelector: @selector (isSuperUser)]
+ && [user isSuperUser]));
}
// - (id <WOActionResults>) addUserInAcls
- (xmlCharEncoding) _xmlCharsetForCharset: (NSString *) charset
{
struct { NSString *name; xmlCharEncoding encoding; } xmlEncodings[] = {
- { @"us-ascii", XML_CHAR_ENCODING_NONE},
+ { @"us-ascii", XML_CHAR_ENCODING_ASCII},
{ @"utf-8", XML_CHAR_ENCODING_UTF8},
{ @"utf-16le", XML_CHAR_ENCODING_UTF16LE},
{ @"utf-16be", XML_CHAR_ENCODING_UTF16BE},
{ @"iso-8859-9", XML_CHAR_ENCODING_8859_9},
{ @"iso-2022-jp", XML_CHAR_ENCODING_2022_JP},
// { @"iso-2022-jp", XML_CHAR_ENCODING_SHIFT_JIS},
- { @"euc-jp", XML_CHAR_ENCODING_EUC_JP},
- { @"us-ascii", XML_CHAR_ENCODING_ASCII}};
+ { @"euc-jp", XML_CHAR_ENCODING_EUC_JP}};
unsigned count;
xmlCharEncoding encoding;
- (NSData *) flatContentForPartPath: (NSArray *) _partPath
{
NSString *pid;
-
- pid = _partPath ? [_partPath componentsJoinedByString:@"."] : @"";
+ NSData *content;
+
+ pid = _partPath ? [_partPath componentsJoinedByString: @"."] : @"";
+ content = [[self flatContents] objectForKey: pid];
+ if (!content && ![pid intValue])
+ content = [flatContents objectForKey: @""];
- return [[self flatContents] objectForKey:pid];
+ return content;
}
/* viewer components */
- (id <WOActionResults>) connectAction
{
WOResponse *response;
+ WORequest *request;
WOCookie *authCookie;
SOGoWebAuthenticator *auth;
NSString *cookieValue, *cookieString;
auth = [[WOApplication application]
authenticatorInContext: context];
+ request = [context request];
response = [self responseWith204];
cookieString = [NSString stringWithFormat: @"%@:%@",
- [self queryParameterForKey: @"userName"],
- [self queryParameterForKey: @"password"]];
+ [request formValueForKey: @"userName"],
+ [request formValueForKey: @"password"]];
cookieValue = [NSString stringWithFormat: @"basic %@",
[cookieString stringByEncodingBase64]];
authCookie = [WOCookie cookieWithName: [auth cookieNameInContext: context]
NSMutableDictionary *componentsData;
NSCalendarDate *startDate;
NSCalendarDate *endDate;
+ NSString *title;
NSString *userLogin;
WORequest *request;
SOGoDateFormatter *dateFormatter;
param = [request formValueForKey: @"filterpopup"];
if ([param length] > 0)
- [self _setupDatesWithPopup: param andUserTZ: userTZ];
+ {
+ [self _setupDatesWithPopup: param andUserTZ: userTZ];
+ title = [request formValueForKey: @"search"];
+ }
else
{
param = [request formValueForKey: @"sd"];
{
currentInfos = [[currentFolder fetchCoreInfosFrom: startDate
to: endDate
+ title: title
component: component] objectEnumerator];
while ((newInfo = [currentInfos nextObject]))
- (void) setItem: (id) _item;
- (id) item;
+- (SOGoAppointmentFolder *) componentCalendar;
+
- (NSArray *) categoryList;
- (void) setCategories: (NSArray *) _categories;
- (NSArray *) categories;
- (NSArray *) calendarList
{
- SOGoAppointmentFolder *currentCalendar;
+ SOGoAppointmentFolder *calendar, *currentCalendar;
SOGoAppointmentFolders *calendarParent;
NSEnumerator *allCalendars;
SoSecurityManager *sm;
calendarParent
= [[context activeUser] calendarsFolderInContext: context];
sm = [SoSecurityManager sharedSecurityManager];
+ calendar = [self componentCalendar];
allCalendars = [[calendarParent subFolders] objectEnumerator];
while ((currentCalendar = [allCalendars nextObject]))
- if (![sm validatePermission: perm
+ if ([calendar isEqual: currentCalendar] ||
+ ![sm validatePermission: perm
onObject: currentCalendar
inContext: context])
[calendarList addObject: currentCalendar];
<var:popup const:id="calendarList"
list="calendarList" item="item"
string="calendarDisplayName"
- selection="componentCalendar"
+ var:selection="componentCalendar"
/></span></span>
<span class="checkBoxList"><var:string label:value="Priority:" />
<span class="content"><var:popup list="priorities" item="item"
xmlns:rsrc="OGo:url"
className="UIxPageFrame"
title="title"
- var:toolbar="toolbar"
+ const:toolbar="SOGoAclOwner.toolbar"
const:popup="YES">
<form id="aclForm" const:href="saveAcls">
padding-left: 1em;
}
-table.titletable
+TABLE.titletable
{
height: 24px;
vertical-align: middle;
padding-left: 6px;
}
-td.titlecell
+TD.titlecell
{
height: 22px;
vertical-align: middle;
white-space: nowrap;
}
-table.titletable td.titlecell SELECT
+TABLE.titletable TD.titlecell SELECT
{
display: -moz-popup;
border-top: 1px solid #fff;
TABLE#contactsList TD,
TABLE#contactsList TH
{ overflow: hidden;
+ line-height: 16px;
white-space: nowrap; } /* pre, normal, nowrap */
TABLE#contactsList TH
}
function refreshCurrentFolder() {
- openContactsFolder(currentContactFolder, true);
+ openContactsFolder(currentContactFolder, true);
}
function onConfirmContactSelection(event) {
var cid = rows[i].getAttribute("contactid");
var cname = '' + rows[i].getAttribute("contactname");
var email = '' + rows[i].cells[1].innerHTML;
- opener.window.addContact(tag, currentContactFolderName + '/' + cname,
+ window.opener.addContact(tag, currentContactFolderName + '/' + cname,
cid, cname, email);
}
configureSortableTableHeaders(table);
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
}
+
+ // Default sort options
+ sorting["attribute"] = "displayName";
+ sorting["ascending"] = true;
}
FastInit.addOnLoad(initContacts);
text-align: right;
font-weight: bold;
vertical-align: top;
- width: 6em;
+ width: 7em;
}
TD.mailer_fieldvalue
mailAccounts = new Array();
}
-var currentMessages = {};
-var maxCachedMessages = 20;
-var cachedMessages = new Array();
-var currentMailbox = null;
-var currentMailboxType = "";
+var Mailer = {
+ currentMessages: {},
+ maxCachedMessages: 20,
+ cachedMessages: new Array(),
+ currentMailbox: null,
+ currentMailboxType: ""
+};
var usersRightsWindowHeight = 320;
var usersRightsWindowWidth = 400;
function onMessageDoubleClick(event) {
var action;
- if (currentMailboxType == "draft")
+ if (Mailer.currentMailboxType == "draft")
action = "edit";
else
action = "popupview";
function openMessageWindowsForSelection(action, firstOnly) {
if (document.body.hasClassName("popup")) {
- return true;
+ var url = window.location.href;
+ var parts = url.split("/");
+ parts[parts.length-1] = action;
+ window.location.href = parts.join("/");
}
else {
var messageList = $("messageList");
if (rows.length > 0) {
for (var i = 0; i < rows.length; i++) {
openMessageWindow(rows[i].substr(4),
- ApplicationBaseURL + currentMailbox
+ ApplicationBaseURL + Mailer.currentMailbox
+ "/" + rows[i].substr(4)
+ "/" + action);
if (firstOnly)
action = 'markMessageUnread';
markread = false;
}
- var url = ApplicationBaseURL + currentMailbox + "/" + msguid + "/" + action;
+ var url = ApplicationBaseURL + Mailer.currentMailbox + "/" + msguid + "/" + action;
var data = { "window": window, "msguid": msguid, "markread": markread };
triggerAjaxRequest(url, mailListMarkMessageCallback, data);
for (var i = 0; i < rowIds.length; i++) {
var url;
var rowId = rowIds[i].substr(4);
- var messageId = currentMailbox + "/" + rowId;
+ var messageId = Mailer.currentMailbox + "/" + rowId;
url = ApplicationBaseURL + messageId + "/trash";
deleteMessageRequestCount++;
- var data = { "id": rowId, "mailbox": currentMailbox, "messageId": messageId };
+ var data = { "id": rowId, "mailbox": Mailer.currentMailbox, "messageId": messageId };
triggerAjaxRequest(url, deleteSelectedMessagesCallback, data);
}
} else {
if (isHttpStatus204(http.status)) {
var data = http.callbackData;
deleteCachedMessage(data["messageId"]);
- if (currentMailbox == data["mailbox"]) {
+ if (Mailer.currentMailbox == data["mailbox"]) {
var div = $('messageContent');
- if (currentMessages[currentMailbox] == data["id"]) {
+ if (Mailer.currentMessages[Mailer.currentMailbox] == data["id"]) {
div.update();
- currentMessages[currentMailbox] = null;
+ Mailer.currentMessages[Mailer.currentMailbox] = null;
}
var row = $("row_" + data["id"]);
// row.addClassName("deleted"); // when we'll offer "mark as deleted"
deleteMessageRequestCount--;
+
+ if (deleteMessageRequestCount == 0)
+ openMailbox(data["mailbox"], true);
}
}
}
/* send AJAX request (synchronously) */
- var messageId = currentMailbox + "/" + rowIds[i];
+ var messageId = Mailer.currentMailbox + "/" + rowIds[i];
url = (ApplicationBaseURL + messageId
+ "/move?tofolder=" + folder);
http = createHTTPClient();
var row = $("row_" + rowIds[i]);
row.parentNode.removeChild(row);
deleteCachedMessage(messageId);
- if (currentMessages[currentMailbox] == rowIds[i]) {
+ if (Mailer.currentMessages[Mailer.currentMailbox] == rowIds[i]) {
var div = $('messageContent');
div.update();
- currentMessages[currentMailbox] = null;
+ Mailer.currentMessages[Mailer.currentMailbox] = null;
}
}
else /* request failed */
$("searchValue").value = "";
initCriteria();
- currentMailboxType = this.parentNode.getAttribute("datatype");
- if (currentMailboxType == "account" || currentMailboxType == "additional") {
- currentMailbox = mailbox;
+ Mailer.currentMailboxType = this.parentNode.getAttribute("datatype");
+ if (Mailer.currentMailboxType == "account" || Mailer.currentMailboxType == "additional") {
+ Mailer.currentMailbox = mailbox;
$("messageContent").update();
var table = $("messageList");
var head = table.tHead;
function _onMailboxMenuAction(menuEntry, error, actionName) {
var targetMailbox = menuEntry.mailbox.fullName();
- if (targetMailbox == currentMailbox)
+ if (targetMailbox == Mailer.currentMailbox)
window.alert(labels[error]);
else {
var message;
if (document.menuTarget.tagName == "DIV")
- message = currentMessages[currentMailbox];
+ message = Mailer.currentMessages[Mailer.currentMailbox];
else
message = document.menuTarget.getAttribute("id").substr(4);
- var urlstr = (URLForFolderID(currentMailbox) + "/" + message
+ var urlstr = (URLForFolderID(Mailer.currentMailbox) + "/" + message
+ "/" + actionName + "?folder=" + targetMailbox);
- triggerAjaxRequest(urlstr, folderRefreshCallback, currentMailbox);
+ triggerAjaxRequest(urlstr, folderRefreshCallback, Mailer.currentMailbox);
}
}
}
function composeNewMessage() {
- var account = currentMailbox.split("/")[1];
+ var account = Mailer.currentMailbox.split("/")[1];
var url = ApplicationBaseURL + "/" + account + "/compose";
openMailComposeWindow(url);
}
function openMailbox(mailbox, reload, idx) {
- if (mailbox != currentMailbox || reload) {
- currentMailbox = mailbox;
+ if (mailbox != Mailer.currentMailbox || reload) {
+ Mailer.currentMailbox = mailbox;
var url = ApplicationBaseURL + encodeURI(mailbox) + "/view?noframe=1";
var messageContent = $("messageContent");
messageContent.update();
var currentMessage;
if (!idx) {
- currentMessage = currentMessages[mailbox];
+ currentMessage = Mailer.currentMessages[mailbox];
if (currentMessage) {
loadMessage(currentMessage);
url += '&pageforuid=' + currentMessage;
}
function openMailboxAtIndex(event) {
- openMailbox(currentMailbox, true, this.getAttribute("idx"));
+ openMailbox(Mailer.currentMailbox, true, this.getAttribute("idx"));
Event.stop(event);
}
}
if (hasQuotas) {
- var treePath = currentMailbox.split("/");
+ var treePath = Mailer.currentMailbox.split("/");
var quotasMB = new Array();
for (var i = 2; i < treePath.length; i++)
quotasMB.push(treePath[i].substr(6));
var done = false;
var counter = 0;
- while (counter < cachedMessages.length
+ while (counter < Mailer.cachedMessages.length
&& !done)
- if (cachedMessages[counter]
- && cachedMessages[counter]['idx'] == messageId) {
- cachedMessages.splice(counter, 1);
+ if (Mailer.cachedMessages[counter]
+ && Mailer.cachedMessages[counter]['idx'] == messageId) {
+ Mailer.cachedMessages.splice(counter, 1);
done = true;
}
else
var message = null;
var counter = 0;
- while (counter < cachedMessages.length
+ while (counter < Mailer.cachedMessages.length
&& message == null)
- if (cachedMessages[counter]
- && cachedMessages[counter]['idx'] == currentMailbox + '/' + idx)
- message = cachedMessages[counter];
+ if (Mailer.cachedMessages[counter]
+ && Mailer.cachedMessages[counter]['idx'] == Mailer.currentMailbox + '/' + idx)
+ message = Mailer.cachedMessages[counter];
else
counter++;
var timeOldest = -1;
var counter = 0;
- if (cachedMessages.length < maxCachedMessages)
- oldest = cachedMessages.length;
+ if (Mailer.cachedMessages.length < Mailer.maxCachedMessages)
+ oldest = Mailer.cachedMessages.length;
else {
- while (cachedMessages[counter]) {
+ while (Mailer.cachedMessages[counter]) {
if (oldest == -1
- || cachedMessages[counter]['time'] < timeOldest) {
+ || Mailer.cachedMessages[counter]['time'] < timeOldest) {
oldest = counter;
- timeOldest = cachedMessages[counter]['time'];
+ timeOldest = Mailer.cachedMessages[counter]['time'];
}
counter++;
}
oldest = 0;
}
- cachedMessages[oldest] = cachedMessage;
+ Mailer.cachedMessages[oldest] = cachedMessage;
}
function onMessageSelectionChange() {
if (rows.length == 1) {
var idx = rows[0].substr(4);
- if (currentMessages[currentMailbox] != idx) {
- currentMessages[currentMailbox] = idx;
+ if (Mailer.currentMessages[Mailer.currentMailbox] != idx) {
+ Mailer.currentMessages[Mailer.currentMailbox] = idx;
loadMessage(idx);
}
}
markMailInWindow(window, idx, true);
if (cachedMessage == null) {
- var url = (ApplicationBaseURL + currentMailbox + "/"
+ var url = (ApplicationBaseURL + Mailer.currentMailbox + "/"
+ idx + "/view?noframe=1");
document.messageAjaxRequest
= triggerAjaxRequest(url, messageCallback, idx);
var mailContentDiv = document.getElementsByClassName('mailer_mailcontent',
messageDiv)[0];
if (!document.body.hasClassName("popup"))
- Event.observe(mailContentDiv, "contextmenu",
- onMessageContentMenu.bindAsEventListener(mailContentDiv));
+ mailContentDiv.observe("contextmenu", onMessageContentMenu);
var anchors = messageDiv.getElementsByTagName('a');
for (var i = 0; i < anchors.length; i++)
if (anchors[i].href.substring(0,7) == "mailto:") {
if (link) {
var urlstr = link + "/" + this.action;
triggerAjaxRequest(urlstr, ICalendarButtonCallback,
- currentMailbox + "/"
- + currentMessages[currentMailbox]);
+ Mailer.currentMailbox + "/"
+ + Mailer.currentMessages[Mailer.currentMailbox]);
}
else
log("no link");
if (http.readyState == 4)
if (isHttpStatus204(http.status)) {
var oldMsg = http.callbackData;
- var msg = currentMailbox + "/" + currentMessages[currentMailbox];
+ var msg = Mailer.currentMailbox + "/" + Mailer.currentMessages[Mailer.currentMailbox];
if (oldMsg == msg) {
deleteCachedMessage(oldMsg);
- loadMessage(currentMessages[currentMailbox]);
+ loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
}
}
else {
}
function onMessageContentMenu(event) {
+ var element = getTarget(event);
+ if (element.tagName == 'A' && element.href.substring(0,7) == "mailto:")
+ // Don't show the default contextual menu; let the click propagate to
+ // other observers
+ return true;
popupMenu(event, 'messageContentMenu', this);
}
function onEmailAddressClick(event) {
popupMenu(event, 'addressMenu', this);
+ preventDefault(event);
+ return false;
}
function onMessageAnchorClick(event) {
if (http.callbackData) {
var cachedMessage = new Array();
- cachedMessage['idx'] = currentMailbox + '/' + http.callbackData;
+ cachedMessage['idx'] = Mailer.currentMailbox + '/' + http.callbackData;
cachedMessage['time'] = (new Date()).getTime();
cachedMessage['text'] = http.responseText;
if (cachedMessage['text'].length < 30000)
var rows = messageList.getSelectedRowsId();
if (rows.length > 0) {
- var url = (ApplicationBaseURL + currentMailbox + "/"
+ var url = (ApplicationBaseURL + Mailer.currentMailbox + "/"
+ rows[0].substr(4) + "/viewsource");
openMailComposeWindow(url);
}
}
function onEmailTo(event) {
- return openMailTo(this.innerHTML.strip());
+ openMailTo(this.innerHTML.strip());
+ preventDefault(event);
+ return false;
}
function newEmailTo(sender) {
}
function refreshCurrentFolder() {
- openMailbox(currentMailbox, true);
+ openMailbox(Mailer.currentMailbox, true);
}
function refreshFolderByType(type) {
- if (currentMailboxType == type)
+ if (Mailer.currentMailboxType == type)
refreshCurrentFolder();
}
if (data) {
var folder = this.parentNode.parentNode.getAttribute("dataname");
- if (folder != currentMailbox)
+ if (folder != Mailer.currentMailbox)
success = (moveMessages(data, folder) == 0);
}
else
initMailboxTree();
initMessageCheckTimer();
}
+
+ // Default sort options
+ sorting["attribute"] = "date";
+ sorting["ascending"] = false;
}
function initMessageCheckTimer() {
// var treeNodes = document.getElementsByClassName("dTreeNode", tree);
// var i = 0;
// while (i < treeNodes.length
- // && treeNodes[i].getAttribute("dataname") != currentMailbox)
+ // && treeNodes[i].getAttribute("dataname") != Mailer.currentMailbox)
// i++;
// if (i < treeNodes.length) {
// // log("found mailbox");
var urlstr = URLForFolderID(folderID) + "/emptyTrash";
triggerAjaxRequest(urlstr, folderOperationCallback, folderID);
- if (folderID == currentMailbox) {
+ if (folderID == Mailer.currentMailbox) {
var div = $('messageContent');
for (var i = div.childNodes.length - 1; i > -1; i--)
div.removeChild(div.childNodes[i]);
refreshCurrentFolder();
}
- var msgID = currentMessages[folderID];
+ var msgID = Mailer.currentMessages[folderID];
if (msgID)
deleteCachedMessage(folderID + "/" + msgID);
}
function onMenuLabelNone() {
var rowId = document.menuTarget.getAttribute("id").substr(4);
- var messageId = currentMailbox + "/" + rowId;
+ var messageId = Mailer.currentMailbox + "/" + rowId;
var urlstr = ApplicationBaseURL + messageId + "/removeAllLabels";
triggerAjaxRequest(urlstr, messageFlagCallback,
- { mailbox: currentMailbox, msg: rowId, label: null } );
+ { mailbox: Mailer.currentMailbox, msg: rowId, label: null } );
}
function _onMenuLabelFlagX(flag) {
var flags = document.menuTarget.getAttribute("labels").split(" ");
var rowId = document.menuTarget.getAttribute("id").substr(4);
- var messageId = currentMailbox + "/" + rowId;
+ var messageId = Mailer.currentMailbox + "/" + rowId;
var operation = "add";
if (flags.indexOf("label" + flag) > -1)
var urlstr = (ApplicationBaseURL + messageId
+ "/" + operation + "Label" + flag);
triggerAjaxRequest(urlstr, messageFlagCallback,
- { mailbox: currentMailbox, msg: rowId,
+ { mailbox: Mailer.currentMailbox, msg: rowId,
label: operation + flag } );
}
if (http.readyState == 4
&& isHttpStatus204(http.status)) {
var oldMailbox = http.callbackData;
- if (oldMailbox == currentMailbox)
+ if (oldMailbox == Mailer.currentMailbox)
refreshCurrentFolder();
}
else
if (http.readyState == 4
&& isHttpStatus204(http.status)) {
var data = http.callbackData;
- if (data["mailbox"] == currentMailbox) {
+ if (data["mailbox"] == Mailer.currentMailbox) {
var row = $("row_" + data["msg"]);
var operation = data["label"];
if (operation) {
var password = $("password").value;
if (userName.length > 0) {
- var url = ($("connectForm").getAttribute("action")
- + "?userName=" + userName
- + "&password=" + password);
+ var url = $("connectForm").getAttribute("action");
+ var parameters = ("userName=" + userName + "&password=" + password);
document.cookie = "";
- triggerAjaxRequest(url, onLoginCallback);
+ triggerAjaxRequest(url, onLoginCallback, null, parameters,
+ { "Content-type": "application/x-www-form-urlencoded",
+ "Content-length": parameters.length,
+ "Connection": "close" });
}
preventDefault(event);
function onLoginCallback(http) {
if (http.readyState == 4) {
- if (isHttpStatus204(http.status)) {
+ if (isHttpStatus204(http.status))
window.location.href = ApplicationBaseURL + $("userName").value;
- }
}
}
var url = ApplicationBaseURL + "eventslist?sd=" + sd + "&ed=" + ed;
document.refreshCalendarEventsAjaxRequest
= triggerAjaxRequest(url, refreshCalendarEventsCallback,
- {"startDate": sd, "endDate": ed, "scrollEvent": scrollEvent});
+ {"startDate": sd, "endDate": ed,
+ "scrollEvent": scrollEvent});
}
function refreshCalendarEventsCallback(http) {
preventDefault(event);
}
+function refreshCurrentFolder() {
+ refreshEvents();
+}
+
function refreshEvents() {
- return _loadEventHref("eventslist?desc=" + sortOrder
- + "&sort=" + sortKey
- + "&day=" + currentDay
- + "&filterpopup=" + listFilter);
+ var titleSearch;
+ var value = search["value"];
+ if (value && value.length)
+ titleSearch = "&search=" + value;
+ else
+ titleSearch = "";
+
+ return _loadEventHref("eventslist?desc=" + sortOrder
+ + "&sort=" + sortKey
+ + "&day=" + currentDay
+ + titleSearch
+ + "&filterpopup=" + listFilter);
}
function refreshTasks() {
changeDateSelectorDisplay(year + month + "01", true);
}
-function onSearchFormSubmit() {
- log ("search not implemented");
-
- return false;
-}
-
function selectCalendarEvent(div) {
// Select event in calendar view
if (selectedCalendarCell)
left: 8em;
right: 1em; }
+SPAN.content
+{ line-height: 2em; }
+
SPAN.content A
{ line-height: 2em; }
top: 0.5em; }
TABLE#freeBusy TD.attendees INPUT
-{ width: 11.5em;
+{ background-image: url('/SOGo.woa/WebServerResources/abcard.gif');
+ background-repeat: no-repeat;
+ background-position: 2px center;
+ width: 11.5em;
margin: 0px;
+ padding-left: 24px;
margin-left: 5px; }
+TABLE#freeBusy TR.futureAttendee INPUT
+{ background-image: none; }
+
TABLE#freeBusy TR.freeBusyHeader2 TH
{ font-weight: normal; }
#attendeesLabel
-{ display: none; }
-
-#organizerListLabel
-{ display: none; }
+{ display: none; }
\ No newline at end of file
var attendeesLabel = $("attendeesLabel");
var attendeesNames = $("attendeesNames");
var attendeesHref = $("attendeesHref");
- var organizerListLabel = $("organizerListLabel");
- log ("label: "+ organizerListLabel);
for (var i = 0; i < attendeesHref.childNodes.length; i++)
attendeesHref.removeChild(attendeesHref.childNodes[i]);
if (attendeesNames.value.length > 0) {
attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
attendeesLabel.setStyle({ display: "block" });
- if (organizerListLabel)
- organizerListLabel.setStyle({ display: "block" });
}
else {
attendeesLabel.setStyle({ display: "none" });
- if (organizerListLabel)
- organizerListLabel.setStyle({ display: "none" });
}
}
var attendeesHref = $("attendeesHref");
var attendeesLabel = $("attendeesLabel");
var attendeesNames = $("attendeesNames");
- var organizerListLabel = $("organizerListLabel");
Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
if (attendeesNames.value.length > 0) {
- if (organizerListLabel)
- organizerListLabel.setStyle({ display: "block" });
attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
attendeesLabel.setStyle({ display: "block" });
var selector = null;
var selectorURL = '?popup=YES&selectorId=mailer-contacts';
- if (MailEditor.addressBook)
+ if (MailEditor.addressBook && MailEditor.addressBook.open && !MailEditor.addressBook.closed)
MailEditor.addressBook.focus();
else {
- urlstr = ApplicationBaseURL
+ var urlstr = ApplicationBaseURL
+ "../Contacts/"
+ contactSelectorAction + selectorURL;
MailEditor.addressBook = window.open(urlstr, "_blank",
"width=640,height=400,resizable=1,scrollbars=0");
MailEditor.addressBook.selector = selector;
- MailEditor.addressBook.opener = this;
+ MailEditor.addressBook.opener = self;
MailEditor.addressBook.focus();
}
}
}
- if (MailEditor.addressBook)
+ if (MailEditor.addressBook && MailEditor.addressBook.open && !MailEditor.addressBook.closed)
MailEditor.addressBook.close();
Event.stopObserving(window, "beforeunload", onMailEditorClose);
return url_nocache;
}
-function triggerAjaxRequest(url, callback, userdata) {
+function triggerAjaxRequest(url, callback, userdata, content, headers) {
var http = createHTTPClient();
activeAjaxRequests += 1;
log(backtrace());
}
};
- http.send(null);
+ if (headers) {
+ for (var i in headers)
+ http.setRequestHeader(i, headers[i]);
+ }
+ http.send(content);
}
else {
log("triggerAjaxRequest: error creating HTTP Client!");
popup.setStyle({ top: menuTop + "px",
left: menuLeft + "px",
visibility: "visible" });
-
+
document.currentPopupMenu = popup;
$(document.body).observe("click", onBodyClickMenuHandler);
var searchValue = $("searchValue");
var searchCriteria = $("searchCriteria");
- searchValue.setAttribute("ghost-phrase", this.innerHTML);
+ searchValue.ghostPhrase = this.innerHTML;
searchCriteria.value = this.getAttribute('id');
if (this.parentNode.chosenNode)
}
function checkSearchValue(event) {
- var form = event.target;
var searchValue = $("searchValue");
- var ghostPhrase = searchValue.getAttribute('ghost-phrase');
- if (searchValue.value == ghostPhrase)
+ if (searchValue.value == searchValue.ghostPhrase)
searchValue.value = "";
}
-function onSearchChange() {
- log ("onSearchChange()...");
-}
-
function configureSearchField() {
var searchValue = $("searchValue");
var searchOptions = $("searchOptions");
}
function onSearchFocus() {
- ghostPhrase = this.getAttribute("ghost-phrase");
+ ghostPhrase = this.ghostPhrase;
if (this.value == ghostPhrase) {
this.value = "";
this.setAttribute("modified", "");
}
function onSearchBlur(event) {
- var ghostPhrase = this.getAttribute("ghost-phrase");
-
if (!this.value) {
this.setAttribute("modified", "");
this.setStyle({ color: "#aaa" });
- this.value = ghostPhrase;
- refreshCurrentFolder();
- } else if (this.value == ghostPhrase) {
+ this.value = this.ghostPhrase;
+ search["value"] = "";
+ if (searchValue.lastSearch != "") {
+ searchValue.lastSearch = "";
+ refreshCurrentFolder();
+ }
+ } else if (this.value == this.ghostPhrase) {
this.setAttribute("modified", "");
this.setStyle({ color: "#aaa" });
} else {
function onSearchFormSubmit(event) {
var searchValue = $("searchValue");
var searchCriteria = $("searchCriteria");
- var ghostPhrase = searchValue.getAttribute('ghost-phrase');
- if (searchValue.value == ghostPhrase) return;
-
- search["criteria"] = searchCriteria.value;
- search["value"] = searchValue.value;
-
- refreshCurrentFolder();
+ if (searchValue.value != searchValue.ghostPhrase
+ && searchValue.value != searchValue.lastSearch) {
+ search["criteria"] = searchCriteria.value;
+ search["value"] = searchValue.value;
+ searchValue.lastSearch = searchValue.value;
+ refreshCurrentFolder();
+ }
}
function initCriteria() {
var searchCriteria = $("searchCriteria");
var searchValue = $("searchValue");
- if (!searchValue) return;
-
- 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 = firstChild.innerHTML;
- searchValue.setAttribute("modified", "");
- searchValue.setStyle({ color: "#aaa" });
+ if (searchValue) {
+ var searchOptions = $("searchOptions").childNodesWithTag("li");
+ if (searchOptions.length > 0) {
+ var firstChild = searchOptions[0];
+ searchCriteria.value = $(firstChild).getAttribute('id');
+ searchValue.ghostPhrase = firstChild.innerHTML;
+ searchValue.lastSearch = "";
+ if (searchValue.value == '') {
+ searchValue.value = firstChild.innerHTML;
+ searchValue.setAttribute("modified", "");
+ searchValue.setStyle({ color: "#aaa" });
+ }
}
}
}
{ top: 3em; }
/* MailerUI */
+
IMG.dragMessage
{ filter: alpha(opacity=70); }
+TD.mailer_fieldname
+{ width: 8em; }
+
/* SchedulerUI */
DIV[class~="event"]._selected > DIV.eventInside