2007-11-19 Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ * UI/PreferencesUI/UIxPreferences.m ([UIxPreferences -signature]):
+ returns the signature for the default identity of the default
+ accouunt...
+ ([UIxPreferences -setSignature:newSignature]): accessor that sets
+ the default signature.
+
+ * UI/MailerUI/UIxMailAccountActions.m ([UIxMailAccountActions
+ -composeAction]): append the message signature to the new draft.
+
+ * SoObjects/Mailer/SOGoMailReply.m ([SOGoMailReply -signature]):
+ same as above.
+
+ * SoObjects/Mailer/SOGoMailForward.m ([SOGoMailForward
+ -signature]): new method that takes the user's signature and put
+ it at the end of the message, if exists.
+
+ * UI/Common/UIxPageFrame.m ([UIxPageFrame -isSuperUser]): new
+ accessor that forwards the call to the active user.
+
+ * SoObjects/SOGo/SOGoUser.m ([SOGoUser -signature]): returns the
+ user default signature.
+ ([SOGoUser -isSuperUser]): declares whether the user is listed
+ among the super users.
+
+ * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor
+ -setComponent:newComponent]): retain the component object.
+ ([UIxComponentEditor -organizerIdentity]): new accessor method to
+ handle list of possible organizers.
+
+ * UI/Scheduler/UIxAppointmentEditor.m ([UIxAppointmentEditor
+ -event]): retain the returned event object.
+
+ * SoObjects/Appointments/SOGoAppointmentObject.m
+ ([SOGoAppointmentObject -saveComponent:newEvent]): reset the
+ organizer only if there are no attendees AND the owner of the
+ component is not the organizer him-/herself.
+
* UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor
-toolbar]): rewrote in a way that ensures that each case is
handled properly.
{
iCalEvent *oldEvent;
NSArray *attendees;
+ SOGoUser *currentUser;
[[newEvent parent] setMethod: @""];
- if ([newEvent userIsOrganizer: [context activeUser]])
+ currentUser = [context activeUser];
+ if ([newEvent userIsOrganizer: currentUser])
{
oldEvent = [self component: NO secure: NO];
if (oldEvent)
toAttendees: attendees];
}
- if (![[newEvent attendees] count])
+ if (![[newEvent attendees] count]
+ && [[self ownerInContext: context]
+ isEqualToString: [currentUser login]])
[[newEvent uniqueChildWithTag: @"organizer"] setValue: 0
to: @""];
}
<#hasCc>CC: <#cc/></#hasCc><#hasNewsGroups>Newsgroups: <#newsgroups/></#hasNewsGroups><#hasReferences>References: <#references/></#hasReferences>
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
On <#date/>, <#from/> wrote:
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
return [sourceMail contentForEditing];
}
+- (NSString *) signature
+{
+ NSString *signature, *mailSignature;
+
+ signature = [[context activeUser] signature];
+ if ([signature length])
+ mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature];
+ else
+ mailSignature = @"";
+
+ return mailSignature;
+}
+
@end
@implementation SOGoMailEnglishForward
<#hasCc>Copie: <#cc/></#hasCc><#hasNewsGroups>Forums de discussion: <#newsgroups/></#hasNewsGroups><#hasReferences>Références: <#references/></#hasReferences>
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
Le <#date/>, <#from/> a écrit:
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
<#hasCc>Kopie: <#cc/></#hasCc><#hasNewsGroups>Newsgroup: <#newsgroups/></#hasNewsGroups><#hasReferences>Referenzen: <#references/></#hasReferences>
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
On <#date/>, <#from/> wrote:
<#messageBody/>
+
+<#signature/>
value = messageBody;
escapeHTML = NO;
}
+
+signature: WOString {
+ value = signature;
+ escapeHTML = NO;
+}
return [[sourceMail contentForEditing] stringByApplyingMailQuoting];
}
+- (NSString *) signature
+{
+ NSString *signature, *mailSignature;
+
+ signature = [[context activeUser] signature];
+ if ([signature length])
+ mailSignature = [NSString stringWithFormat: @"--\r\n%@", signature];
+ else
+ mailSignature = @"";
+
+ return mailSignature;
+}
+
@end
@implementation SOGoMailEnglishReply
- (NSString *) messageForwarding;
- (NSString *) messageCheck;
+- (NSString *) signature;
+
+- (BOOL) isSuperUser;
+
/* folders */
- (SOGoUserFolder *) homeFolderInContext: (id) context;
return [[defaultAccount objectForKey: @"identities"] objectAtIndex: 0];
}
+- (NSString *) signature
+{
+ return [[self primaryIdentity] objectForKey: @"signature"];
+}
+
- (NSString *) messageForwarding
{
NSString *messageForwarding;
&& [login isEqualToString: [otherUser login]]);
}
+- (BOOL) isSuperUser
+{
+ return [superUsernames containsObject: login];
+}
+
@end /* SOGoUser */
- (void) setToolbar: (NSString *) newToolbar;
- (NSString *) toolbar;
+- (BOOL) isSuperUser;
+
- (BOOL) isCompatibleBrowser;
- (BOOL) isIE7Compatible;
- (BOOL) isMac;
return toolbar;
}
+- (BOOL) isSuperUser
+{
+ return [[context activeUser] isSuperUser];
+}
+
/* browser/os identification */
- (BOOL) isCompatibleBrowser
pageName = "UIxUserRightsEditor";
};
saveUserRights = {
- protectedBy = "ReadAcls";
+ protectedBy = "SaveAcls";
pageName = "UIxUserRightsEditor";
actionName = "saveUserRights";
};
css = [handler css];
if ([css length])
- cssContent = [NSString stringWithFormat: @"<style type=\"text/css\">%@</style>",
- [handler css]];
+ cssContent
+ = [NSString stringWithFormat: @"<style type=\"text/css\">%@</style>",
+ [handler css]];
else
cssContent = @"";
#import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h>
-#import <NGObjWeb/WOContext.h>
+#import <NGObjWeb/WOContext+SoObjects.h>
#import <NGObjWeb/WORequest.h>
#import <NGObjWeb/WOResponse.h>
#import <NGImap4/NGImap4Connection.h>
+
#import <SoObjects/Mailer/SOGoMailAccount.h>
#import <SoObjects/Mailer/SOGoDraftObject.h>
#import <SoObjects/Mailer/SOGoDraftsFolder.h>
#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSObject+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
+#import <SoObjects/SOGo/SOGoUser.h>
#import "../Common/WODirectAction+SOGo.h"
{
SOGoDraftsFolder *drafts;
SOGoDraftObject *newDraftMessage;
- NSString *urlBase, *url, *value;
+ NSString *urlBase, *url, *value, *signature;
NSArray *mailTo;
-
+ BOOL save;
drafts = [[self clientObject] draftsFolderInContext: context];
newDraftMessage = [drafts newDraft];
+ save = NO;
+
value = [[self request] formValueForKey: @"mailto"];
if ([value length] > 0)
{
mailTo = [NSArray arrayWithObject: value];
- [newDraftMessage setHeaders: [NSDictionary dictionaryWithObject: mailTo
- forKey: @"to"]];
- [newDraftMessage storeInfo];
+ [newDraftMessage
+ setHeaders: [NSDictionary dictionaryWithObject: mailTo
+ forKey: @"to"]];
+ save = YES;
+ }
+
+ signature = [[context activeUser] signature];
+ if ([signature length])
+ {
+ [newDraftMessage
+ setText: [NSString stringWithFormat: @"\r\n--\r\n%@", signature]];
+ save = YES;
}
+ if (save)
+ [newDraftMessage storeInfo];
urlBase = [newDraftMessage baseURLInContext: context];
url = [urlBase composeURLWithAction: @"edit"
"Access Contents Information" = ( "Owner", "ObjectReader" );
"Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" );
"Add Folders" = ( "Owner", "FolderCreator" );
- "ReadAcls" = ( "Owner", "AuthorizedSubscriber" );
+ "ReadAcls" = ( "Owner" );
"SaveAcls" = ( "Owner" );
"Delete Objects" = ( "Owner", "ObjectEraser" );
};
#import <NGObjWeb/WOContext.h>
#import <NGObjWeb/WORequest.h>
+#import <SoObjects/SOGo/NSArray+Utilities.h>
#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
// string="itemIdentityText" selection="defaultIdentity"/></label>
- (NSArray *) identitiesList
{
- return [user allIdentities];
+ NSDictionary *primaryAccount;
+
+#warning we manage only one account per user at this time...
+ primaryAccount = [[user mailAccounts] objectAtIndex: 0];
+
+ return [primaryAccount objectForKey: @"identities"];
}
- (NSString *) itemIdentityText
return [item keysWithFormat: @"%{fullName} <%{email}>"];
}
-- (NSDictionary *) defaultIdentity
+- (NSMutableDictionary *) defaultIdentity
{
- NSDictionary *currentIdentity, *defaultIdentity;
+ NSMutableDictionary *currentIdentity, *defaultIdentity;
NSEnumerator *identities;
defaultIdentity = nil;
return defaultIdentity;
}
+- (NSString *) signature
+{
+ return [[self defaultIdentity] objectForKey: @"signature"];
+}
+
+- (void) setSignature: (NSString *) newSignature
+{
+ [[self defaultIdentity] setObject: newSignature
+ forKey: @"signature"];
+ [userDefaults setObject: [user mailAccounts]
+ forKey: @"MailAccounts"];
+}
+
- (id <WOActionResults>) defaultAction
{
id <WOActionResults> results;
/* template values */
- (iCalEvent *) event
{
+ if (!event)
+ {
+ event = (iCalEvent *) [[self clientObject] component: NO secure: NO];
+ [event retain];
+ }
+
return event;
}
NSString *saveURL;
NSMutableArray *calendarList;
+ NSMutableArray *organizerList;
+ NSDictionary *organizerIdentity;
/* individual values */
NSCalendarDate *cycleUntilDate;
- (void) setSaveURL: (NSString *) newSaveURL;
- (NSString *) saveURL;
+- (void) setItem: (id) _item;
+- (id) item;
+
- (NSArray *) categoryList;
- (void) setCategories: (NSArray *) _categories;
- (NSArray *) categories;
- (NSString *) status;
- (NSString *) itemStatusText;
-- (void) setItem: (id) _item;
-- (id) item;
-- (NSString *) itemPriorityText;
-
- (void) setTitle: (NSString *) _value;
- (NSString *) title;
- (void) setLocation: (NSString *) _value;
- (NSString *) location;
+- (NSString *) location;
+
- (void) setComment: (NSString *) _value;
- (NSString *) comment;
#import <SoObjects/Appointments/SOGoTaskObject.h>
#import <SoObjects/SOGo/iCalEntityObject+Utilities.h>
#import <SoObjects/SOGo/LDAPUserManager.h>
+#import <SoObjects/SOGo/NSDictionary+Utilities.h>
#import <SoObjects/SOGo/NSString+Utilities.h>
#import <SoObjects/SOGo/SOGoUser.h>
#import <SoObjects/SOGo/SOGoPermissions.h>
[self setIsCycleEndNever];
componentOwner = @"";
organizer = nil;
+ organizerIdentity = nil;
attendeesNames = nil;
attendeesUIDs = nil;
attendeesEmails = nil;
[title release];
[location release];
[organizer release];
+ [organizerIdentity release];
[comment release];
[priority release];
[categories release];
[attendeesEmails release];
[calendarList release];
+ [component release];
+
[super dealloc];
}
if (!component)
{
- component = newComponent;
+ ASSIGN (component, newComponent);
co = [self clientObject];
componentOwner = [co ownerInContext: nil];
return url;
}
+- (NSString *) organizerName
+{
+ return [organizer mailAddress];
+}
+
+- (BOOL) canBeOrganizer
+{
+ NSString *owner;
+ SOGoCalendarComponent *co;
+ SOGoUser *currentUser;
+ BOOL hasOrganizer;
+
+ co = [self clientObject];
+ owner = [co ownerInContext: context];
+ currentUser = [context activeUser];
+
+ hasOrganizer = ([[organizer value: 0] length] > 0);
+
+ return ([co isNew]
+ || ([owner isEqualToString: [currentUser login]]
+ && (!hasOrganizer || [component userIsOrganizer: currentUser])));
+}
+
- (BOOL) hasOrganizer
{
- return (![organizer isVoid]);
+ return ([[organizer value: 0] length] && ![self canBeOrganizer]);
}
-- (NSString *) organizerName
+- (void) setOrganizerIdentity: (NSDictionary *) newOrganizerIdentity
{
- return [organizer mailAddress];
+ ASSIGN (organizerIdentity, newOrganizerIdentity);
+}
+
+- (NSDictionary *) organizerIdentity
+{
+ NSArray *allIdentities;
+ NSEnumerator *identities;
+ NSDictionary *currentIdentity;
+ NSString *orgEmail;
+
+ orgEmail = [organizer rfc822Email];
+ if (!organizerIdentity)
+ {
+ if ([orgEmail length])
+ {
+ allIdentities = [[context activeUser] allIdentities];
+ identities = [allIdentities objectEnumerator];
+ while (!organizerIdentity
+ && ((currentIdentity = [identities nextObject])))
+ if ([[currentIdentity objectForKey: @"email"]
+ caseInsensitiveCompare: orgEmail]
+ == NSOrderedSame)
+ ASSIGN (organizerIdentity, currentIdentity);
+ }
+ }
+
+ return organizerIdentity;
+}
+
+- (NSArray *) organizerList
+{
+ return [[context activeUser] allIdentities];
+}
+
+- (NSString *) itemOrganizerText
+{
+ return [item keysWithFormat: @"%{fullName} <%{email}>"];
}
- (void) setAttendeesNames: (NSString *) newAttendeesNames
- (void) _handleOrganizer
{
NSString *organizerEmail;
- SOGoUser *activeUser;
- NSDictionary *primaryIdentity;
+ NSString *owner, *login;
organizerEmail = [[component organizer] email];
if ([organizerEmail length] == 0)
{
- if ([[component attendees] count] > 0)
+ owner = [[self clientObject] ownerInContext: context];
+ login = [[context activeUser] login];
+ if (![owner isEqualToString: login]
+ || [[component attendees] count] > 0)
{
ASSIGN (organizer, [iCalPerson elementWithTag: @"organizer"]);
- activeUser = [context activeUser];
- primaryIdentity = [activeUser primaryIdentity];
- [organizer setCn: [activeUser cn]];
- [organizer setEmail: [primaryIdentity objectForKey: @"email"]];
+ [organizer setCn: [organizerIdentity objectForKey: @"fullName"]];
+ [organizer setEmail: [organizerIdentity objectForKey: @"email"]];
[component setOrganizer: organizer];
}
}
#warning the following methods probably share some code...
- (NSString *) _toolbarForOwner: (SOGoUser *) ownerUser
+ andClientObject: (SOGoCalendarComponent *) clientObject
{
NSString *toolbarFilename;
iCalPersonPartStat participationStatus;
}
else
{
- if ([component isKindOfClass: [iCalEvent class]])
+ if ([clientObject isKindOfClass: [SOGoAppointmentObject class]])
toolbarFilename = @"SOGoAppointmentObject.toolbar";
else
toolbarFilename = @"SOGoTaskObject.toolbar";
}
- (NSString *) _toolbarForDelegate: (SOGoUser *) ownerUser
+ andClientObject: (SOGoCalendarComponent *) clientObject
{
- SOGoCalendarComponent *clientObject;
SoSecurityManager *sm;
NSString *toolbarFilename, *adminToolbar;
iCalPersonPartStat participationStatus;
- clientObject = [self clientObject];
-
- if ([component isKindOfClass: [iCalEvent class]])
+ if ([clientObject isKindOfClass: [SOGoAppointmentObject class]])
adminToolbar = @"SOGoAppointmentObject.toolbar";
else
adminToolbar = @"SOGoTaskObject.toolbar";
roles: nil];
if ([ownerUser isEqual: [context activeUser]])
- toolbarFilename = [self _toolbarForOwner: ownerUser];
+ toolbarFilename = [self _toolbarForOwner: ownerUser
+ andClientObject: clientObject];
else
- toolbarFilename = [self _toolbarForDelegate: ownerUser];
+ toolbarFilename = [self _toolbarForDelegate: ownerUser
+ andClientObject: clientObject];
return toolbarFilename;
[statusDate release];
[status release];
[statusPercent release];
+ [todo release];
[super dealloc];
}
/* template values */
- (iCalToDo *) todo
{
+ if (!todo)
+ {
+ todo = (iCalToDo *) [[self clientObject] component: NO secure: NO];
+ [todo retain];
+ }
+
return todo;
}
- (id) changeStatusAction
{
SOGoTaskObject *clientObject;
- NSString *newStatus, *iCalString;
+ NSString *newStatus;
clientObject = [self clientObject];
todo = (iCalToDo *) [clientObject component: NO secure: NO];
+ [todo retain];
if (todo)
{
newStatus = [self queryParameterForKey: @"status"];
[todo setPercentComplete: @"0"];
[todo setStatus: @"IN-PROCESS"];
}
-
- iCalString = [[clientObject calendar: NO secure: NO] versitString];
- [clientObject saveContentString: iCalString];
+ [clientObject saveComponent: todo];
}
- return self;
+ return [self responseWith204];
}
@end
</var:foreach>
</var:foreach>
<tr class="addressListElement" id="lastRow">
- <td class="headerField">
+ <td class="headerField" onclick="fancyAddRow(true,'');">
<var:popup name="currentPopUpId"
- const:disabled="1"
list="headers"
item="item"
label:displayString="$item"
label:value="Calendar Options"/></li>
<li target="mailOptionsView"><var:string
label:value="Mail Options"/></li>
-<!-- <li target="identitiesView"><var:string
- label:value="Identities"/></li> -->
+ <li target="identitiesView"><var:string
+ label:value="Identities"/></li>
<var:if condition="shouldDisplayPasswordChange">
<li target="passwordView"><var:string label:value="Password"/></li>
</var:if>
</label> -->
</div>
<div id="identitiesView" class="tab">
- <var:multiselection id="identitiesList" item="item"
- string="itemIdentityText" selection="defaultIdentity">
+ <!--<var:multiselection const:id="identitiesList" item="item"
+ list="identitiesList" displayString="itemIdentityText">
</var:multiselection>
- <br/>
+ <br/>-->
+ <var:string label:value="Signature:"/><br/>
+ <textarea const:id="signature" const:name="signature"
+ var:value="signature"/>
</div>
<var:if condition="shouldDisplayPasswordChange">
<div id="passwordView" class="tab">
</span></span>
<var:if condition="hasOrganizer"
><label id="organizerLabel"><var:string label:value="Organizer:"
- /><span class="content"><var:string value="organizerName"/></span></label>
+ /><span class="content"><var:string
+ value="organizerName"/></span></label>
</var:if>
+ <var:if condition="canBeOrganizer"
+ ><label id="organizerListLabel"><var:string label:value="Organizer:"
+ /><span class="content"><var:popup list="organizerList"
+ item="item" string="itemOrganizerText"
+ var:selection="organizerIdentity"/>
+ </span></label></var:if>
<label id="attendeesLabel"><var:string label:value="Attendees:"
/><span class="content"
><a href="#" id="attendeesHref"><!-- space --></a></span></label>
<div id="javascriptSafetyNet"><!-- space --></div>
<script type="text/javascript">
- var ApplicationBaseURL = '<var:string value="applicationPath" />';
+ var ApplicationBaseURL = '<var:string value="applicationPath"/>';
var ResourcesURL = '/SOGo.woa/WebServerResources';
+ <var:if condition="isSuperUser"
+ >var IsSuperUser = true;
+ </var:if>
+ <var:if condition="isSuperUser" const:negate="YES"
+ >var IsSuperUser = false;
+ </var:if>
<var:if condition="shortUserNameForDisplay" const:value="anonymous"
const:negate="YES"
>var UserFolderURL = '<var:string value="userFolderPath" />';
}
function onMenuSharing(event) {
+ if ($(this).hasClassName("disabled"))
+ return;
+
var folders = $("contactFolders");
var selected = folders.getSelectedNodes()[0];
var owner = selected.getAttribute("owner");
}
}
+function onContactFoldersMenuPrepareVisibility() {
+ var folders = $("contactFolders");
+ var selected = folders.getSelectedNodes();
+
+ if (selected.length > 0) {
+ var folderOwner = selected[0].getAttribute("owner");
+ var sharingOption = $(this).down("ul").childElements().last();
+ // Disable the "Sharing" option when address book is not owned by user
+ if (folderOwner == UserLogin || IsSuperUser)
+ sharingOption.removeClassName("disabled");
+ else
+ sharingOption.addClassName("disabled");
+ }
+}
+
function getMenus() {
var menus = {};
menus["contactFoldersMenu"] = new Array(onMenuModify, "-", null,
onMenuWriteToContact, null, "-",
onMenuDeleteContact);
menus["searchMenu"] = new Array(setSearchCriteria);
-
+
+ var contactFoldersMenu = $("contactFoldersMenu");
+ if (contactFoldersMenu)
+ contactFoldersMenu.prepareVisibility = onContactFoldersMenuPrepareVisibility;
+
return menus;
}
if (leftDiff < 0)
menuLeft -= popup.offsetWidth;
+ if (popup.prepareVisibility)
+ popup.prepareVisibility();
+
popup.setStyle( { top: menuTop + "px",
left: menuLeft + "px",
visibility: "visible" } );
function changeCalendarDisplay(data, newView) {
var url = ApplicationBaseURL + ((newView) ? newView : currentView);
-
- selectedCalendarCell = null;
-
var day = null;
var scrollEvent = null;
+
if (data) {
day = data['day'];
scrollEvent = data['scrollEvent'];
day = currentDay;
if (day) {
- var divs = $$('div.day[day='+day+']');
- if (divs.length > 0) {
- // Don't reload the view if the event is present in current view
-
- // Find day number
- var dayNumber;
- var classes = $w(divs[0].className);
- for (var i = 0; i < classes.length; i++) {
- if (classes[i] == 'day')
- continue;
- if (classes[i] == 'selectedDay')
- break;
- dayNumber = classes[i];
- break;
- }
+ if (data) {
+ var divs = $$('div.day[day='+day+']');
+ if (divs.length) {
+ // Don't reload the view if the event is present in current view
+
+ // Deselect previous day
+ var selectedDivs = $$('div.day.selectedDay');
+ selectedDivs.each(function(div) {
+ div.removeClassName('selectedDay');
+ });
+
+ // Select new day
+ divs.each(function(div) {
+ div.addClassName('selectedDay');
+ });
+
+ // Deselect day in date selector
+ if (document.selectedDate)
+ document.selectedDate.deselect();
+
+ // Select day in date selector
+ var selectedLink = $$('table#dateSelectorTable a[day='+day+']');
+ if (selectedLink.length > 0) {
+ selectedCell = selectedLink[0].up(1);
+ selectedCell.select();
+ document.selectedDate = selectedCell;
+ }
+
+ // Scroll to event
+ scrollDayView(scrollEvent);
- // Deselect previous day
- var selectedDivs = $$('div.day.selectedDay');
- selectedDivs.each(function(div) {
- div.removeClassName('selectedDay');
- });
-
- // Select new day
- selectedDivs = $$('div.day.'+dayNumber);
- selectedDivs.each(function(div) {
- div.addClassName('selectedDay');
- });
-
- // Deselect day in date selector
- if (document.selectedDate)
- document.selectedDate.deselect();
-
- // Select day in date selector
- var selectedLink = $$('table#dateSelectorTable a[day='+day+']');
- if (selectedLink.length > 0) {
- selectedCell = selectedLink[0].up(1);
- selectedCell.select();
- document.selectedDate = selectedCell;
+ return false;
}
-
- // Scroll to event
- scrollDayView(scrollEvent);
-
- return false;
}
url += "?day=" + day;
}
// log ("switching to view: " + newView);
// log ("changeCalendarDisplay: " + url);
+ selectedCalendarCell = null;
+
if (document.dayDisplayAjaxRequest) {
// log ("aborting day ajaxrq");
document.dayDisplayAjaxRequest.aborted = true;
}
function scrollDayView(scrollEvent) {
+ var divs;
+ // Select event in calendar view
+ if (scrollEvent) {
+ divs = $$("div#calendarContent div." + eventClass(scrollEvent));
+ selectCalendarEvent(divs[0]);
+ }
+
+ // Don't scroll if in month view
if (currentView == "monthview")
return;
$(daysView.childNodesWithTag("div")[0]).childNodesWithTag("div");
if (scrollEvent) {
- var divs = $$("div#calendarContent div." + eventClass(scrollEvent));
+ divs = $$("div#calendarContent div." + eventClass(scrollEvent));
var classes = $w(divs[0].className);
for (var i = 0; i < classes.length; i++) {
if (classes[i].startsWith("starts")) {
}
}
else
+ // Scroll to 8 AM
offset = hours[8].offsetTop;
daysView.scrollTop = offset - 5;
document.refreshCalendarEventsAjaxRequest.aborted = true;
document.refreshCalendarEventsAjaxRequest.abort();
}
- var url = ApplicationBaseURL + "/eventslist?sd=" + sd + "&ed=" + ed;
+ var url = ApplicationBaseURL + "eventslist?sd=" + sd + "&ed=" + ed;
document.refreshCalendarEventsAjaxRequest
= triggerAjaxRequest(url, refreshCalendarEventsCallback,
{"startDate": sd, "endDate": ed, "scrollEvent": scrollEvent});
http.callbackData["startDate"],
http.callbackData["endDate"]);
}
- if (http.callbackData["scrollEvent"])
- scrollDayView(http.callbackData["scrollEvent"]);
+ scrollDayView(http.callbackData["scrollEvent"]);
}
else
log("AJAX error when refreshing calendar events");
// log("viewS: " + viewStartDate);
var startHour = null;
var endHour = null;
-
+
+ var siblings = new Array();
for (var i = 0; i < days.length; i++)
if (days[i].earlierDate(viewStartDate) == viewStartDate
&& days[i].laterDate(viewEndDate) == viewEndDate) {
var eventDiv = newEventDIV(eventData[0], eventData[1], starts, lasts,
null, null, title);
+ siblings.push(eventDiv);
+ eventDiv.siblings = siblings;
var dayString = days[i].getDayString();
// log("day: " + dayString);
var parentDiv = null;
document.tasksListAjaxRequest.aborted = true;
document.tasksListAjaxRequest.abort();
}
- url = ApplicationBaseURL + "/" + href;
+ url = ApplicationBaseURL + href;
var tasksList = $("tasksList");
var selectedIds;
return false;
}
-function onCalendarSelectEvent() {
- var list = $("eventsList");
- $(list.tBodies[0]).deselectAll();
-
+function selectCalendarEvent(div) {
+ // Select event in calendar view
if (selectedCalendarCell)
for (var i = 0; i < selectedCalendarCell.length; i++)
selectedCalendarCell[i].deselect();
- for (var i = 0; i < this.siblings.length; i++)
- this.siblings[i].select();
- selectedCalendarCell = this.siblings;
+ for (var i = 0; i < div.siblings.length; i++)
+ div.siblings[i].select();
+
+ selectedCalendarCell = div.siblings;
+}
+
+function onCalendarSelectEvent() {
+ var list = $("eventsList");
+
+ selectCalendarEvent(this);
+
+ // Select event in events list
+ $(list.tBodies[0]).deselectAll();
var row = $(this.cname);
if (row) {
var div = row.parentNode.parentNode.parentNode;
newStatus = (newStatus ? 0 : 1);
}
- url = (ApplicationBaseURL + "/" + this.parentNode.calendar
+ url = (ApplicationBaseURL + this.parentNode.calendar
+ "/" + taskId + "/changeStatus?status=" + newStatus);
if (http) {
http.open("POST", url, false /* not async */);
http.url = url;
http.send("");
- if (http.status == 200)
+ if (isHttpStatus204(http.status))
refreshTasks();
} else
log ("no http client?");
return false;
}
+function onCalendarsMenuPrepareVisibility() {
+ var folders = $("calendarList");
+ var selected = folders.getSelectedNodes();
+
+ if (selected.length > 0) {
+ var folderOwner = selected[0].getAttribute("owner");
+ var sharingOption = $(this).down("ul").childElements().last();
+ // Disable the "Sharing" option when calendar is not owned by user
+ if (folderOwner == UserLogin || IsSuperUser)
+ sharingOption.removeClassName("disabled");
+ else
+ sharingOption.addClassName("disabled");
+ }
+}
+
function getMenus() {
var menus = {};
null, "-", onMenuSharing);
menus["searchMenu"] = new Array(setSearchCriteria);
+ var calendarsMenu = $("calendarsMenu");
+ if (calendarsMenu)
+ calendarsMenu.prepareVisibility = onCalendarsMenuPrepareVisibility;
+
return menus;
}
function onMenuSharing(event) {
+ if ($(this).hasClassName("disabled"))
+ return;
+
var folders = $("calendarList");
var selected = folders.getSelectedNodes()[0];
- /* FIXME: activation of the context menu should preferable select the entry
+ /* FIXME: activation of the context menu should preferably select the entry
above which the event has occured */
if (selected) {
var folderID = selected.getAttribute("id");
var contactSelectorAction = 'acls-contacts';
var defaultUserID = '';
+var userRightsHeight;
+var userRightsWidth;
function addUser(userName, userID) {
if (!$(userID)) {
function setEventsOnUserNode(node) {
Event.observe(node, "mousedown", listRowMouseDownHandler);
+ Event.observe(node, "selectstart", listRowMouseDownHandler);
Event.observe(node, "dblclick", onOpenUserRights);
Event.observe(node, "click", onRowClick);
}
elements[elements.length-1] = "userRights?uid=" + userID;
window.open(elements.join("/"), "",
- "width=" + this.userRightsWidth
- + ",height=" + this.userRightsHeight
+ "width=" + userRightsWidth
+ + ",height=" + userRightsHeight
+ ",resizable=0,scrollbars=0,toolbar=0,"
+ "location=0,directories=0,status=0,menubar=0,copyhistory=0");
}
Event.observe(buttons[1], "click", onUserRemove);
}
- this.userRightsHeight = window.opener.getUsersRightsWindowHeight();
- this.userRightsWidth = window.opener.getUsersRightsWindowWidth();
+ userRightsHeight = window.opener.getUsersRightsWindowHeight();
+ userRightsWidth = window.opener.getUsersRightsWindowWidth();
}
FastInit.addOnLoad(onAclLoadHandler);
function uixEarlierDate(date1, date2) {
// can this be done in a sane way?
- // cuicui = 'year';
if (date1.getYear() < date2.getYear()) return date1;
if (date1.getYear() > date2.getYear()) return date2;
// same year
- // cuicui += '/month';
if (date1.getMonth() < date2.getMonth()) return date1;
if (date1.getMonth() > date2.getMonth()) return date2;
// // same month
- // cuicui += '/date';
if (date1.getDate() < date2.getDate()) return date1;
if (date1.getDate() > date2.getDate()) return date2;
// same day
alert(labels.validate_invalid_enddate);
return false;
}
- // cuicui = '';
tmpdate = uixEarlierDate(startdate, enddate);
if (tmpdate == enddate) {
- // window.alert(cuicui);
alert(labels.validate_endbeforestart);
return false;
}
#attendeesLabel
{ display: none; }
+
+#organizerListLabel
+{ display: none; }
function onPopupAttendeesWindow(event) {
- if (event)
- preventDefault(event);
- window.open(ApplicationBaseURL + "/editAttendees", null,
- "width=803,height=573");
+ if (event)
+ preventDefault(event);
+ window.open(ApplicationBaseURL + "/editAttendees", null,
+ "width=803,height=573");
- return false;
+ return false;
}
function onSelectPrivacy(event) {
- if (event.button == 0 || (isSafari() && event.button == 1)) {
- var node = getTarget(event);
- if (node.tagName != 'BUTTON')
- node = $(node).up("button");
- popupToolbarMenu(node, "privacy-menu");
- Event.stop(event);
-// preventDefault(event);
- }
+ if (event.button == 0 || (isSafari() && event.button == 1)) {
+ var node = getTarget(event);
+ if (node.tagName != 'BUTTON')
+ node = $(node).up("button");
+ popupToolbarMenu(node, "privacy-menu");
+ Event.stop(event);
+ // preventDefault(event);
+ }
}
function onPopupUrlWindow(event) {
- if (event)
- preventDefault(event);
-
- var urlInput = document.getElementById("url");
- var newUrl = window.prompt(labels["Target:"], urlInput.value);
- if (newUrl != null) {
- var documentHref = $("documentHref");
- var documentLabel = $("documentLabel");
- if (documentHref.childNodes.length > 0) {
- documentHref.childNodes[0].nodeValue = newUrl;
- if (newUrl.length > 0)
- documentLabel.setStyle({ display: "block" });
- else
- documentLabel.setStyle({ display: "none" });
- }
- else {
- documentHref.appendChild(document.createTextNode(newUrl));
- if (newUrl.length > 0)
- documentLabel.setStyle({ display: "block" });
- }
- urlInput.value = newUrl;
- }
-
- return false;
+ if (event)
+ preventDefault(event);
+
+ var urlInput = document.getElementById("url");
+ var newUrl = window.prompt(labels["Target:"], urlInput.value);
+ if (newUrl != null) {
+ var documentHref = $("documentHref");
+ var documentLabel = $("documentLabel");
+ if (documentHref.childNodes.length > 0) {
+ documentHref.childNodes[0].nodeValue = newUrl;
+ if (newUrl.length > 0)
+ documentLabel.setStyle({ display: "block" });
+ else
+ documentLabel.setStyle({ display: "none" });
+ }
+ else {
+ documentHref.appendChild(document.createTextNode(newUrl));
+ if (newUrl.length > 0)
+ documentLabel.setStyle({ display: "block" });
+ }
+ urlInput.value = newUrl;
+ }
+
+ return false;
}
function onPopupDocumentWindow(event) {
- var documentUrl = $("url");
+ var documentUrl = $("url");
- preventDefault(event);
- window.open(documentUrl.value, "SOGo_Document");
+ preventDefault(event);
+ window.open(documentUrl.value, "SOGo_Document");
- return false;
+ return false;
}
function onMenuSetClassification(event) {
- event.cancelBubble = true;
+ event.cancelBubble = true;
- var classification = this.getAttribute("classification");
- if (this.parentNode.chosenNode)
- this.parentNode.chosenNode.removeClassName("_chosen");
- this.addClassName("_chosen");
- this.parentNode.chosenNode = this;
+ var classification = this.getAttribute("classification");
+ if (this.parentNode.chosenNode)
+ this.parentNode.chosenNode.removeClassName("_chosen");
+ this.addClassName("_chosen");
+ this.parentNode.chosenNode = this;
-// log("classification: " + classification);
- var privacyInput = document.getElementById("privacy");
- privacyInput.value = classification;
+ // log("classification: " + classification);
+ var privacyInput = document.getElementById("privacy");
+ privacyInput.value = classification;
}
function onChangeCalendar(event) {
- var calendars = $("calendarFoldersList").value.split(",");
- var form = document.forms["editform"];
- var urlElems = form.getAttribute("action").split("/");
- var choice = calendars[this.value];
- urlElems[urlElems.length-3] = choice;
- form.setAttribute("action", urlElems.join("/"));
+ var calendars = $("calendarFoldersList").value.split(",");
+ var form = document.forms["editform"];
+ var urlElems = form.getAttribute("action").split("/");
+ var choice = calendars[this.value];
+ urlElems[urlElems.length-3] = choice;
+ form.setAttribute("action", urlElems.join("/"));
}
function refreshAttendees() {
- var attendeesLabel = $("attendeesLabel");
- var attendeesNames = $("attendeesNames");
- var attendeesHref = $("attendeesHref");
-
- 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" });
- }
- else
- attendeesLabel.setStyle({ display: "none" });
+ 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" });
+ }
}
function initializeAttendeesHref() {
- var attendeesHref = $("attendeesHref");
- var attendeesLabel = $("attendeesLabel");
- var attendeesNames = $("attendeesNames");
-
- Event.observe(attendeesHref, "click", onPopupAttendeesWindow, false);
- if (attendeesNames.value.length > 0) {
- attendeesHref.setStyle({ textDecoration: "underline", color: "#00f" });
- attendeesHref.appendChild(document.createTextNode(attendeesNames.value));
- attendeesLabel.setStyle({ display: "block" });
- }
+ 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" });
+ }
}
function initializeDocumentHref() {
- var documentHref = $("documentHref");
- var documentLabel = $("documentLabel");
- var documentUrl = $("url");
-
- Event.observe(documentHref, "click", onPopupDocumentWindow, false);
- documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
- if (documentUrl.value.length > 0) {
- documentHref.appendChild(document.createTextNode(documentUrl.value));
- documentLabel.setStyle({ display: "block" });
- }
-
- var changeUrlButton = $("changeUrlButton");
- Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
+ var documentHref = $("documentHref");
+ var documentLabel = $("documentLabel");
+ var documentUrl = $("url");
+
+ Event.observe(documentHref, "click", onPopupDocumentWindow, false);
+ documentHref.setStyle({ textDecoration: "underline", color: "#00f" });
+ if (documentUrl.value.length > 0) {
+ documentHref.appendChild(document.createTextNode(documentUrl.value));
+ documentLabel.setStyle({ display: "block" });
+ }
+
+ var changeUrlButton = $("changeUrlButton");
+ Event.observe(changeUrlButton, "click", onPopupUrlWindow, false);
}
function initializePrivacyMenu() {
- var privacy = $("privacy").value.toUpperCase();
- if (privacy.length > 0) {
- var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
- var menuEntries = $(privacyMenu).childNodesWithTag("li");
- var chosenNode;
- if (privacy == "CONFIDENTIAL")
- chosenNode = menuEntries[1];
- else if (privacy == "PRIVATE")
- chosenNode = menuEntries[2];
- else
- chosenNode = menuEntries[0];
- privacyMenu.chosenNode = chosenNode;
- $(chosenNode).addClassName("_chosen");
- }
+ var privacy = $("privacy").value.toUpperCase();
+ if (privacy.length > 0) {
+ var privacyMenu = $("privacy-menu").childNodesWithTag("ul")[0];
+ var menuEntries = $(privacyMenu).childNodesWithTag("li");
+ var chosenNode;
+ if (privacy == "CONFIDENTIAL")
+ chosenNode = menuEntries[1];
+ else if (privacy == "PRIVATE")
+ chosenNode = menuEntries[2];
+ else
+ chosenNode = menuEntries[0];
+ privacyMenu.chosenNode = chosenNode;
+ $(chosenNode).addClassName("_chosen");
+ }
}
function onComponentEditorLoad(event) {
- if (!$("statusPercent"))
- initializeAttendeesHref();
- initializeDocumentHref();
- initializePrivacyMenu();
- var list = $("calendarList");
- Event.observe(list, "mousedown",
- onChangeCalendar.bindAsEventListener(list),
- false);
- list.fire("mousedown");
-
- var menuItems = $("itemPrivacyList").childNodesWithTag("li");
- for (var i = 0; i < menuItems.length; i++)
- Event.observe(menuItems[i], "mousedown",
- onMenuSetClassification.bindAsEventListener(menuItems[i]),
- false);
+ if (!$("statusPercent"))
+ initializeAttendeesHref();
+ initializeDocumentHref();
+ initializePrivacyMenu();
+ var list = $("calendarList");
+ Event.observe(list, "mousedown",
+ onChangeCalendar.bindAsEventListener(list),
+ false);
+ list.fire("mousedown");
+
+ var menuItems = $("itemPrivacyList").childNodesWithTag("li");
+ for (var i = 0; i < menuItems.length; i++)
+ Event.observe(menuItems[i], "mousedown",
+ onMenuSetClassification.bindAsEventListener(menuItems[i]),
+ false);
}
FastInit.addOnLoad(onComponentEditorLoad);
{ line-height: 2.0em;
padding-left: 0.5em; }
+TABLE#addressList TR#lastRow SELECT
+{ visibility: hidden; }
+
DIV#subjectRow INPUT
{ background-image: none;
width: 60%; }
DIV#passwordView
{ padding-top: 3em;
padding-right: 10em; }
+
+DIV#identitiesView
+{ padding-top: 5px;
+ padding-left: 5px; }
+
+#signature
+{ width: 380px;
+ height: 125px; }
if (popup.prepareVisibility)
popup.prepareVisibility();
+
popup.setStyle({ top: menuTop + "px",
left: menuLeft + "px",
visibility: "visible" });