Merge pull request #45 from alexcloutier/feature/PreventInvitations

New user preference to prevent invitations
pull/47/head
Francis Lachapelle 2014-07-21 09:38:42 -04:00
commit f3ded6ce2a
8 changed files with 1867 additions and 1432 deletions

View File

@ -1,3 +1,4 @@
"This or these persons cannot be invited:" = "This or these persons cannot be invited:";
"Personal Calendar" = "Personal Calendar"; "Personal Calendar" = "Personal Calendar";
vevent_class0 = "(Public event)"; vevent_class0 = "(Public event)";
vevent_class1 = "(Private event)"; vevent_class1 = "(Private event)";

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@
*/ */
#import <Foundation/NSCalendarDate.h> #import <Foundation/NSCalendarDate.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSPropertyList.h> #import <Foundation/NSPropertyList.h>
#import <Foundation/NSString.h> #import <Foundation/NSString.h>
#import <Foundation/NSTimeZone.h> #import <Foundation/NSTimeZone.h>
@ -41,6 +42,7 @@
#import <SOGo/NSString+Utilities.h> #import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoUser.h> #import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserDefaults.h> #import <SOGo/SOGoUserDefaults.h>
#import <SOGo/SOGoUserSettings.h>
#import <SOGo/SOGoDomainDefaults.h> #import <SOGo/SOGoDomainDefaults.h>
#import <SOGo/SOGoSieveManager.h> #import <SOGo/SOGoSieveManager.h>
#import <SOGo/SOGoSystemDefaults.h> #import <SOGo/SOGoSystemDefaults.h>
@ -638,6 +640,47 @@ static NSArray *reminderValues = nil;
return [userDefaults busyOffHours]; return [userDefaults busyOffHours];
} }
- (NSArray *) whiteList
{
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
NSArray *whiteList;
us = [user userSettings];
moduleSettings = [us objectForKey: @"Calendar"];
whiteList = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
return whiteList;
}
- (void) setWhiteList: (NSArray *) whiteList
{
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
us = [user userSettings];
moduleSettings = [us objectForKey: @"Calendar"];
[moduleSettings setObject: whiteList forKey: @"PreventInvitationsWhitelist"];
[us synchronize];
}
- (void) setPreventInvitations: (BOOL) preventInvitations
{
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
us = [user userSettings];
moduleSettings = [us objectForKey: @"Calendar"];
[moduleSettings setObject: [NSNumber numberWithBool: preventInvitations] forKey: @"PreventInvitations"];
[us synchronize];
}
- (BOOL) preventInvitations
{
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
us = [user userSettings];
moduleSettings = [us objectForKey: @"Calendar"];
return [[moduleSettings objectForKey: @"PreventInvitations"] boolValue];
}
- (NSArray *) firstWeekList - (NSArray *) firstWeekList
{ {
return [NSArray arrayWithObjects: return [NSArray arrayWithObjects:

View File

@ -11,12 +11,15 @@
title="title" title="title"
const:popup="YES" const:popup="YES"
const:cssFiles="datepicker.css" const:cssFiles="datepicker.css"
const:jsFiles="RowEditionController.js,PasswordPolicy.js,ckeditor/ckeditor.js,datepicker.js" const:jsFiles="RowEditionController.js,PasswordPolicy.js,ckeditor/ckeditor.js,datepicker.js, SOGoAutoCompletion.js"
> >
<script type="text/javascript"> <script type="text/javascript">
var localeCode = '<var:string value="localeCode"/>'; var localeCode = '<var:string value="localeCode"/>';
</script> </script>
<div class="popupMenu" id="contactsMenu">
<ul></ul>
</div>
<div id="colorPickerDialog" style="display: none;" class="dialog right bottom"> <div id="colorPickerDialog" style="display: none;" class="dialog right bottom">
<div> <div>
<span class="blc-FFFFFF"><!-- --></span> <span class="blc-FFFFFF"><!-- --></span>
@ -91,33 +94,33 @@
<span class="blc-99FF99"><!-- --></span> <span class="blc-99FF99"><!-- --></span>
</div> </div>
</div> </div>
<form id="mainForm" var:href="ownPath"> <form id="mainForm" var:href="ownPath">
<div class="tabsContainer" id="preferencesTabs"> <div class="tabsContainer" id="preferencesTabs">
<ul> <ul>
<li target="generalView"><span> <li target="generalView"><span>
<var:string label:value="General" /></span></li> <var:string label:value="General" /></span></li>
<var:if condition="userHasCalendarAccess"> <var:if condition="userHasCalendarAccess">
<li target="calendarOptionsView"><span><var:string <li target="calendarOptionsView"><span><var:string
label:value="Calendar Options"/></span></li> label:value="Calendar Options"/></span></li>
</var:if </var:if
><li target="contactsOptionsView"><span><var:string ><li target="contactsOptionsView"><span><var:string
label:value="Contacts Options"/></span></li label:value="Contacts Options"/></span></li
><var:if condition="userHasMailAccess"> ><var:if condition="userHasMailAccess">
<li target="mailOptionsView"><span><var:string <li target="mailOptionsView"><span><var:string
label:value="Mail Options"/></span></li> label:value="Mail Options"/></span></li>
<li target="mailAccountsView"><span><var:string <li target="mailAccountsView"><span><var:string
label:value="IMAP Accounts"/></span></li> label:value="IMAP Accounts"/></span></li>
<var:if condition="isVacationEnabled"><li target="vacationView"><span><var:string <var:if condition="isVacationEnabled"><li target="vacationView"><span><var:string
label:value="Vacation"/></span></li></var:if label:value="Vacation"/></span></li></var:if
><var:if condition="isForwardEnabled"><li target="forwardView"><span><var:string ><var:if condition="isForwardEnabled"><li target="forwardView"><span><var:string
label:value="Forward"/></span></li></var:if> label:value="Forward"/></span></li></var:if>
</var:if </var:if
><var:if condition="shouldDisplayAdditionalPreferences"> ><var:if condition="shouldDisplayAdditionalPreferences">
<li target="additionalView"><span> <li target="additionalView"><span>
<var:string label:value="Additional Parameters"/></span></li> <var:string label:value="Additional Parameters"/></span></li>
</var:if </var:if
><var:if condition="shouldDisplayPasswordChange"> ><var:if condition="shouldDisplayPasswordChange">
<li target="passwordView"><span><var:string label:value="Password"/></span></li> <li target="passwordView"><span><var:string label:value="Password"/></span></li>
</var:if> </var:if>
</ul> </ul>
@ -128,38 +131,38 @@
<dd><var:string value="sogoVersion"/></dd> <dd><var:string value="sogoVersion"/></dd>
<dt><var:string label:value="Language :"/></dt> <dt><var:string label:value="Language :"/></dt>
<dd><var:popup list="languages" item="item" <dd><var:popup list="languages" item="item"
const:id="language" const:id="language"
const:name="language" const:name="language"
string="languageText" string="languageText"
selection="language" selection="language"
label:noSelectionString="choose" /></dd> label:noSelectionString="choose" /></dd>
<dt><var:string label:value="Current Time Zone :"/></dt> <dt><var:string label:value="Current Time Zone :"/></dt>
<dd><var:popup list="timeZonesList" item="item" <dd><var:popup list="timeZonesList" item="item"
const:id="timezone" const:id="timezone"
const:name="timezone" const:name="timezone"
string="item" selection="userTimeZone" /></dd> string="item" selection="userTimeZone" /></dd>
<dt><var:string label:value="Short Date Format :"/></dt> <dt><var:string label:value="Short Date Format :"/></dt>
<dd><var:popup list="shortDateFormatsList" item="item" <dd><var:popup list="shortDateFormatsList" item="item"
const:id="shortDateFormat" const:id="shortDateFormat"
const:name="shortDateFormat" const:name="shortDateFormat"
string="itemShortDateFormatText" selection="userShortDateFormat"/></dd> string="itemShortDateFormatText" selection="userShortDateFormat"/></dd>
<dt><var:string label:value="Long Date Format :"/></dt> <dt><var:string label:value="Long Date Format :"/></dt>
<dd><var:popup list="longDateFormatsList" item="item" <dd><var:popup list="longDateFormatsList" item="item"
const:id="longDateFormat" const:id="longDateFormat"
const:name="longDateFormat" const:name="longDateFormat"
string="itemLongDateFormatText" selection="userLongDateFormat" string="itemLongDateFormatText" selection="userLongDateFormat"
/></dd> /></dd>
<dt><var:string label:value="Time Format :"/></dt> <dt><var:string label:value="Time Format :"/></dt>
<dd><var:popup list="timeFormatsList" item="item" <dd><var:popup list="timeFormatsList" item="item"
const:id="timeFormat" const:id="timeFormat"
const:name="timeFormat" const:name="timeFormat"
string="itemTimeFormatText" selection="userTimeFormat" string="itemTimeFormatText" selection="userTimeFormat"
/></dd> /></dd>
<dt><var:string label:value="Default module :"/></dt> <dt><var:string label:value="Default module :"/></dt>
<dd><var:popup list="availableModules" item="item" <dd><var:popup list="availableModules" item="item"
const:id="defaultModule" const:id="defaultModule"
const:name="defaultModule" const:name="defaultModule"
string="itemModuleText" selection="userDefaultModule"/></dd> string="itemModuleText" selection="userDefaultModule"/></dd>
</dl> </dl>
</div> </div>
<var:if condition="userHasCalendarAccess"> <var:if condition="userHasCalendarAccess">
@ -167,88 +170,132 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt><var:string label:value="Week begins on :"/></dt> <dt><var:string label:value="Week begins on :"/></dt>
<dd><var:popup list="daysList" item="item" <dd><var:popup list="daysList" item="item"
const:id="weekStartDay" const:id="weekStartDay"
const:name="weekStartDay" const:name="weekStartDay"
string="itemWeekStartDay" selection="userWeekStartDay"/></dd> string="itemWeekStartDay" selection="userWeekStartDay"/></dd>
<dt><var:string label:value="Day start time :"/></dt> <dt><var:string label:value="Day start time :"/></dt>
<dd><var:popup list="hoursList" item="item" <dd><var:popup list="hoursList" item="item"
const:id="dayStartTime" const:id="dayStartTime"
const:name="dayStartTime" const:name="dayStartTime"
string="item" selection="userDayStartTime"/></dd> string="item" selection="userDayStartTime"/></dd>
<dt><var:string label:value="Day end time :"/></dt> <dt><var:string label:value="Day end time :"/></dt>
<dd><var:popup list="hoursList" item="item" <dd><var:popup list="hoursList" item="item"
const:id="dayEndTime" const:id="dayEndTime"
const:name="dayEndTime" const:name="dayEndTime"
string="item" selection="userDayEndTime"/></dd> string="item" selection="userDayEndTime"/></dd>
<dt></dt> <dt></dt>
<dd><input type="checkbox" <dd><input type="checkbox"
const:name="busyOffHours" const:name="busyOffHours"
const:id="busyOffHours" const:id="busyOffHours"
var:checked="busyOffHours" /> var:checked="busyOffHours" />
<var:string label:value="Show time as busy outside working hours"/></dd> <var:string label:value="Show time as busy outside working hours"/></dd>
<dt><var:string label:value="First week of year :"/></dt> <dt><var:string label:value="First week of year :"/></dt>
<dd><var:popup list="firstWeekList" item="item" <dd><var:popup list="firstWeekList" item="item"
const:id="firstWeek" const:id="firstWeek"
const:name="firstWeek" const:name="firstWeek"
string="itemFirstWeekText" selection="userFirstWeek"/></dd> string="itemFirstWeekText" selection="userFirstWeek"/></dd>
<dt><var:string label:value="Default calendar :"/></dt> <dt><var:string label:value="Default calendar :"/></dt>
<dd><var:popup list="defaultCalendarList" item="item" <dd><var:popup list="defaultCalendarList" item="item"
const:id="defaultCalendar" const:id="defaultCalendar"
const:name="defaultCalendar" const:name="defaultCalendar"
string="itemCalendarText" selection="userDefaultCalendar"/></dd> string="itemCalendarText" selection="userDefaultCalendar"/></dd>
<dt><var:string label:value="Default events classification :"/></dt> <dt><var:string label:value="Default events classification :"/></dt>
<dd><var:popup list="calendarClassificationsList" item="item" <dd><var:popup list="calendarClassificationsList" item="item"
const:id="eventsClassification" const:id="eventsClassification"
const:name="eventsClassification" const:name="eventsClassification"
string="itemClassificationText" selection="eventsDefaultClassification"/></dd> string="itemClassificationText" selection="eventsDefaultClassification"/></dd>
<dt><var:string label:value="Default tasks classification :"/></dt> <dt><var:string label:value="Default tasks classification :"/></dt>
<dd><var:popup list="calendarClassificationsList" item="item" <dd><var:popup list="calendarClassificationsList" item="item"
const:id="tasksClassification" const:id="tasksClassification"
const:name="tasksClassification" const:name="tasksClassification"
string="itemClassificationText" selection="tasksDefaultClassification"/></dd> string="itemClassificationText" selection="tasksDefaultClassification"/></dd>
<dt><var:string label:value="Default reminder :"/></dt> <dt><var:string label:value="Default reminder :"/></dt>
<dd><var:popup list="reminderList" item="item" <dd><var:popup list="reminderList" item="item"
const:disabledValue="-" const:disabledValue="-"
label:noSelectionString="reminder_NONE" label:noSelectionString="reminder_NONE"
const:name="reminderList" const:name="reminderList"
const:id="reminderList" const:id="reminderList"
string="itemReminderText" var:selection="reminder"/></dd> string="itemReminderText" var:selection="reminder"/></dd>
</dl> </dl>
<div class="tabsContainer" id="calendarOptionsTabs">
<label><var:string label:value="Categories"/></label> <ul>
<div id="calendarCategoriesListWrapper" class="listWrapper" <li target="calendarCategoriesView">
><table class="categoriesList" cellspacing="0"> <span><var:string label:value="Categories"/></span></li>
<thead> <li target="calendarAppointmentsInvitationsView">
<tr class="tableview" <span><var:string label:value="Appointments invitations"/></span></li>
><th const:class="tbtv_headercell" const:id="nameTableHeader" </ul>
><var:string label:value="Name"/></th <div class="tabs">
><th const:class="tbtv_headercell" const:id="colorTableHeader" <div id="calendarCategoriesView" class="tab">
><var:string label:value="Color"/></th <div id="calendarCategoriesListWrapper" class="listWrapper">
></tr <table class="categoriesList" cellspacing="0">
></thead> <thead>
<tbody> <tr class="tableview">
<var:foreach list="calendarCategoryList" item="category"> <th const:class="tbtv_headercell" const:id="nameTableHeader">
<tr const:class="categoryListRow" <var:string label:value="Name"/></th>
><td const:class="categoryListCell" <th const:class="tbtv_headercell" const:id="colorTableHeader">
><var:string var:value="category"/></td <var:string label:value="Color"/></th>
><td const:class="categoryListCell" </tr>
><div const:class="colorBox" var:data-color="categoryColor"><entity name="nbsp"/></div></td </thead>
></tr> <tbody>
</var:foreach> <var:foreach list="calendarCategoryList" item="category">
</tbody> <tr const:class="categoryListRow">
</table> <td const:class="categoryListCell">
</div> <var:string var:value="category"/></td>
<div class="bottomToolbar"> <td const:class="categoryListCell">
<a const:id="calendarCategoryAdd" class="bottomButton" href="#"> <div const:class="colorBox" var:data-color="categoryColor"><entity name="nbsp"/></div></td>
<span><img rsrc:src="add-icon.png" label:title="Add" /> </tr>
</span></a> </var:foreach>
<a const:id="calendarCategoryDelete" class="bottomButton" href="#"> </tbody>
<span><img rsrc:src="remove-icon.png" label:title="Delete" /> </table>
</span></a> </div><!-- #calendarCategoriesListWrapper -->
</div> <div class="bottomToolbar">
<input type="hidden" const:id="calendarCategoriesValue" <a const:id="calendarCategoryAdd" class="bottomButton" href="#">
const:name="calendarCategoriesValue" var:value="calendarCategoriesValue"/> <span><img rsrc:src="add-icon.png" label:title="Add" /></span></a>
</div> <a const:id="calendarCategoryDelete" class="bottomButton" href="#">
<span><img rsrc:src="remove-icon.png" label:title="Delete" /> </span></a>
</div><!-- .bottomToolbar -->
<input type="hidden" const:id="calendarCategoriesValue"
const:name="calendarCategoriesValue" var:value="calendarCategoriesValue"/>
</div><!-- #calendarCategoriesView -->
<div id="calendarAppointmentsInvitationsView" class="tab">
<div><input type="checkbox"
const:name="preventInvitations"
const:id="preventInvitations"
var:checked="preventInvitations" />
<var:string label:value="Prevent from being invited to appointments"/></div>
<hr />
<var:string label:value="White list for appointments invitations:"/>
<div id="appointmentsWhiteListWrapper" class="listWrapper">
<table id="tableViewWhiteList" cellspacing="0">
<thead>
<tr class="tableview">
<th const:class="tbtv_headercell" const:id="whiteListTableHeader">
<var:string label:value="Contacts names"/></th>
</tr>
</thead>
<tbody>
<var:foreach list="appointmentsWhiteList" item="contact">
<tr const:class="whiteListRow">
<td const:class="whiteListCell">
<var:string var:value="contact"/></td>
</tr>
</var:foreach>
</tbody>
</table>
</div><!-- #appointmentsWhiteListWrapper -->
<div class="bottomToolbar">
<a const:id="appointmentsWhiteListAdd" class="bottomButton" href="#">
<span><img rsrc:src="add-icon.png" label:title="Add" /></span></a>
<a const:id="appointmentsWhiteListDelete" class="bottomButton" href="#">
<span><img rsrc:src="remove-icon.png" label:title="Delete" /></span></a>
</div><!-- .bottomToolbar -->
<input type="hidden" const:id="whiteList"
const:name="whiteList" var:value="whiteList"/>
</div><!-- #calendarAppointmentsInvitationsView -->
</div><!-- .tabs -->
</div><!-- #calendarOptionsTabs -->
</div><!-- #calendarOptionsView -->
</var:if> </var:if>
<div id="contactsOptionsView" class="tab"> <div id="contactsOptionsView" class="tab">
<label><var:string label:value="Categories"/></label> <label><var:string label:value="Categories"/></label>
@ -258,14 +305,14 @@
<tr class="tableview" <tr class="tableview"
><th const:class="tbtv_headercell" const:id="nameTableHeader" ><th const:class="tbtv_headercell" const:id="nameTableHeader"
><var:string label:value="Name"/></th ><var:string label:value="Name"/></th
></tr ></tr
></thead> ></thead>
<tbody> <tbody>
<var:foreach list="contactsCategoryList" item="category"> <var:foreach list="contactsCategoryList" item="category">
<tr const:class="categoryListRow" <tr const:class="categoryListRow"
><td const:class="categoryListCell" ><td const:class="categoryListCell"
><var:string var:value="category"/></td ><var:string var:value="category"/></td
></tr> ></tr>
</var:foreach> </var:foreach>
</tbody> </tbody>
</table> </table>
@ -278,135 +325,135 @@
<span><img rsrc:src="remove-icon.png" label:title="Delete" /> <span><img rsrc:src="remove-icon.png" label:title="Delete" />
</span></a> </span></a>
</div> </div>
<input type="hidden" const:id="contactsCategoriesValue" <input type="hidden" const:id="contactsCategoriesValue"
const:name="contactsCategoriesValue" var:value="contactsCategoriesValue"/> const:name="contactsCategoriesValue" var:value="contactsCategoriesValue"/>
</div> </div>
<var:if condition="userHasMailAccess"> <var:if condition="userHasMailAccess">
<div id="mailOptionsView" class="tab"> <div id="mailOptionsView" class="tab">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt></dt> <dt></dt>
<dd><input type="checkbox"
const:name="subscribedFoldersOnly"
const:id="subscribedFoldersOnly"
var:checked="showSubscribedFoldersOnly" />
<var:string label:value="Show subscribed mailboxes only"/></dd>
<dt></dt>
<dd><input type="checkbox"
const:name="sortByThreads"
const:id="sortByThreads"
var:checked="sortByThreads" />
<var:string label:value="Sort messages by threads"/></dd>
<dd><input type="checkbox" <dd><input type="checkbox"
const:name="addOutgoingAddresses" const:name="subscribedFoldersOnly"
const:id="addOutgoingAddresses" const:id="subscribedFoldersOnly"
var:checked="addOutgoingAddresses" var:checked="showSubscribedFoldersOnly" />
onChange = "onAddOutgoingAddressesCheck(this);"/> <var:string label:value="Show subscribed mailboxes only"/></dd>
<var:string label:value="When sending mail, add unknown recipients to my"/><br/> <dt></dt>
<var:popup list="addressBookList" item="item" <dd><input type="checkbox"
const:id="addressBookList" const:name="sortByThreads"
const:name="addressBookList" const:id="sortByThreads"
string="itemAddressBookText" selection="userAddressBook"/></dd> var:checked="sortByThreads" />
<var:string label:value="Sort messages by threads"/></dd>
<dd><input type="checkbox"
const:name="addOutgoingAddresses"
const:id="addOutgoingAddresses"
var:checked="addOutgoingAddresses"
onChange = "onAddOutgoingAddressesCheck(this);"/>
<var:string label:value="When sending mail, add unknown recipients to my"/><br/>
<var:popup list="addressBookList" item="item"
const:id="addressBookList"
const:name="addressBookList"
string="itemAddressBookText" selection="userAddressBook"/></dd>
<dt></dt> <dt></dt>
<dt><var:string label:value="Check for new mail:"/></dt> <dt><var:string label:value="Check for new mail:"/></dt>
<dd><var:popup list="messageCheckList" item="item" <dd><var:popup list="messageCheckList" item="item"
const:id="messageCheck" const:id="messageCheck"
const:name="messageCheck" const:name="messageCheck"
string="itemMessageCheckText" selection="userMessageCheck"/></dd> string="itemMessageCheckText" selection="userMessageCheck"/></dd>
<dt><var:string label:value="Forward messages:"/></dt> <dt><var:string label:value="Forward messages:"/></dt>
<dd><var:popup list="messageForwardingList" item="item" <dd><var:popup list="messageForwardingList" item="item"
const:id="messageForwarding" const:id="messageForwarding"
const:name="messageForwarding" const:name="messageForwarding"
string="itemMessageForwardingText" string="itemMessageForwardingText"
selection="userMessageForwarding"/></dd> selection="userMessageForwarding"/></dd>
<dt><var:string label:value="When replying to a message:"/></dt> <dt><var:string label:value="When replying to a message:"/></dt>
<dd><var:popup list="replyPlacementList" item="item" <dd><var:popup list="replyPlacementList" item="item"
const:id="replyPlacementList" const:id="replyPlacementList"
const:name="replyPlacementList" const:name="replyPlacementList"
string="itemReplyPlacementText" string="itemReplyPlacementText"
selection="userReplyPlacement"/></dd> selection="userReplyPlacement"/></dd>
<dt><var:string label:value="And place my signature"/></dt> <dt><var:string label:value="And place my signature"/></dt>
<dd><var:popup list="signaturePlacementList" item="item" <dd><var:popup list="signaturePlacementList" item="item"
const:id="signaturePlacementList" const:id="signaturePlacementList"
const:name="signaturePlacementList" const:name="signaturePlacementList"
string="itemSignaturePlacementText" string="itemSignaturePlacementText"
selection="userSignaturePlacement"/></dd> selection="userSignaturePlacement"/></dd>
<dt><var:string label:value="Compose messages in"/></dt> <dt><var:string label:value="Compose messages in"/></dt>
<dd><var:popup list="composeMessagesType" item="item" <dd><var:popup list="composeMessagesType" item="item"
const:id="composeMessagesType" const:id="composeMessagesType"
const:name="composeMessagesType" const:name="composeMessagesType"
string="itemComposeMessagesText" string="itemComposeMessagesText"
selection="userComposeMessagesType"/></dd> selection="userComposeMessagesType"/></dd>
<dt><var:string label:value="Display remote inline images"/></dt> <dt><var:string label:value="Display remote inline images"/></dt>
<dd><var:popup list="displayRemoteInlineImages" item="item" <dd><var:popup list="displayRemoteInlineImages" item="item"
const:id="displayRemoteInlineImages" const:id="displayRemoteInlineImages"
const:name="displayRemoteInlineImages" const:name="displayRemoteInlineImages"
string="itemDisplayRemoteInlineImagesText" string="itemDisplayRemoteInlineImagesText"
selection="userDisplayRemoteInlineImages"/></dd> selection="userDisplayRemoteInlineImages"/></dd>
</dl> </dl>
<div class="tabsContainer" id="mailOptionsTabs"> <div class="tabsContainer" id="mailOptionsTabs">
<ul> <ul>
<var:if condition="isSieveScriptsEnabled" <var:if condition="isSieveScriptsEnabled"
><li target="mailFiltersView"><span><var:string ><li target="mailFiltersView"><span><var:string
label:value="Filters"/></span></li label:value="Filters"/></span></li
></var:if> ></var:if>
<li target="mailLabelsView"><span><var:string <li target="mailLabelsView"><span><var:string
label:value="Labels"/></span></li> label:value="Labels"/></span></li>
</ul> </ul>
<div class="tabs"> <div class="tabs">
<var:if condition="isSieveScriptsEnabled" <var:if condition="isSieveScriptsEnabled"
><div id="mailFiltersView" class="tab"> ><div id="mailFiltersView" class="tab">
<script type="text/javascript"> <script type="text/javascript">
var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>; var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
</script> </script>
<div id="filtersListWrapper" class="listWrapper"> <div id="filtersListWrapper" class="listWrapper">
<table id="filtersList" cellspacing="0"> <table id="filtersList" cellspacing="0">
<thead> <thead>
<tr class="tableview"> <tr class="tableview">
<th const:class="tbtv_headercell" const:id="nameTableHeader" <th const:class="tbtv_headercell" const:id="nameTableHeader"
><var:string label:value="Name" /></th> ><var:string label:value="Name" /></th>
<th const:class="tbtv_headercell" const:id="activeTableHeader" <th const:class="tbtv_headercell" const:id="activeTableHeader"
><var:string label:value="Active" /></th> ><var:string label:value="Active" /></th>
</tr> </tr>
</thead> </thead>
<tbody><!--space --></tbody> <tbody><!--space --></tbody>
</table> </table>
<input type="hidden" const:name="sieveFilters" const:id="sieveFilters" <input type="hidden" const:name="sieveFilters" const:id="sieveFilters"
var:value="sieveFiltersValue"/> var:value="sieveFiltersValue"/>
</div><!-- #filtersListWrapper --> </div><!-- #filtersListWrapper -->
<div class="bottomToolbar"> <div class="bottomToolbar">
<a const:id="filterAdd" class="bottomButton" href="#"> <a const:id="filterAdd" class="bottomButton" href="#">
<span><img rsrc:src="add-icon.png" label:title="Add" /></span></a> <span><img rsrc:src="add-icon.png" label:title="Add" /></span></a>
<a const:id="filterDelete" class="bottomButton" href="#"> <a const:id="filterDelete" class="bottomButton" href="#">
<span><img rsrc:src="remove-icon.png" label:title="Delete" /></span></a> <span><img rsrc:src="remove-icon.png" label:title="Delete" /></span></a>
<a const:id="filterMoveUp" class="bottomButton" href="#"> <a const:id="filterMoveUp" class="bottomButton" href="#">
<span><img rsrc:src="up-icon.png" label:title="Move Up" /></span></a> <span><img rsrc:src="up-icon.png" label:title="Move Up" /></span></a>
<a const:id="filterMoveDown" class="bottomButton" href="#"> <a const:id="filterMoveDown" class="bottomButton" href="#">
<span><img rsrc:src="down-icon.png" label:title="Move Down" /></span></a> <span><img rsrc:src="down-icon.png" label:title="Move Down" /></span></a>
</div><!-- .bottomToolbar --> </div><!-- .bottomToolbar -->
</div </div
></var:if><!-- #mailFiltersView --> ></var:if><!-- #mailFiltersView -->
<div id="mailLabelsView" class="tab"> <div id="mailLabelsView" class="tab">
<div id="mailLabelsListWrapper" class="listWrapper"> <div id="mailLabelsListWrapper" class="listWrapper">
<table id="labelsList" cellspacing="0"> <table id="labelsList" cellspacing="0">
<thead> <thead>
<tr class="tableview"> <tr class="tableview">
<th const:class="tbtv_headercell" const:id="labelTableHeader" <th const:class="tbtv_headercell" const:id="labelTableHeader"
><var:string label:value="Label"/></th> ><var:string label:value="Label"/></th>
<th const:class="tbtv_headercell" const:id="colorTableHeader" <th const:class="tbtv_headercell" const:id="colorTableHeader"
><var:string label:value="Color"/></th> ><var:string label:value="Color"/></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<var:foreach list="mailLabelList" item="label" <var:foreach list="mailLabelList" item="label"
><tr var:data-name="label.name" const:class="labelListRow"> ><tr var:data-name="label.name" const:class="labelListRow">
<td const:class="labelListCell" <td const:class="labelListCell"
><var:string var:value="label.label"/></td> ><var:string var:value="label.label"/></td>
<td const:class="labelListCell"> <td const:class="labelListCell">
<div const:class="colorBox" var:data-color="label.color"><entity name="nbsp"/></div> <div const:class="colorBox" var:data-color="label.color"><entity name="nbsp"/></div>
</td> </td>
</tr> </tr>
</var:foreach> </var:foreach>
</tbody> </tbody>
</table> </table>
@ -414,33 +461,33 @@
<div class="bottomToolbar"> <div class="bottomToolbar">
<a const:id="mailLabelAdd" class="bottomButton" href="#"> <a const:id="mailLabelAdd" class="bottomButton" href="#">
<span><img rsrc:src="add-icon.png" label:title="Add" /> <span><img rsrc:src="add-icon.png" label:title="Add" />
</span></a> </span></a>
<a const:id="mailLabelDelete" class="bottomButton" href="#"> <a const:id="mailLabelDelete" class="bottomButton" href="#">
<span><img rsrc:src="remove-icon.png" label:title="Delete" /> <span><img rsrc:src="remove-icon.png" label:title="Delete" />
</span></a> </span></a>
</div><!-- .bottomToolbar --> </div><!-- .bottomToolbar -->
<input type="hidden" const:id="mailLabelsValue" <input type="hidden" const:id="mailLabelsValue"
const:name="mailLabelsValue" var:value="mailLabelsValue"/> const:name="mailLabelsValue" var:value="mailLabelsValue"/>
</div><!-- #mailLabelsView --> </div><!-- #mailLabelsView -->
</div><!-- .tabs --> </div><!-- .tabs -->
</div><!-- #mailOptionsTabs --> </div><!-- #mailOptionsTabs -->
</div><!-- #mailOptionsView --> </div><!-- #mailOptionsView -->
<div id="mailAccountsView" class="tab"> <div id="mailAccountsView" class="tab">
<input type="hidden" const:name="mailAccountsJSON" const:id="mailAccountsJSON" <input type="hidden" const:name="mailAccountsJSON" const:id="mailAccountsJSON"
var:value="mailAccounts"/> var:value="mailAccounts"/>
<div id="mailAccountsListWrapper" class="listWrapper" <div id="mailAccountsListWrapper" class="listWrapper"
><ul id="mailAccountsList" ><ul id="mailAccountsList"
><!-- space --></ul ><!-- space --></ul
></div> ></div>
<var:if condition="mailAuxiliaryUserAccountsEnabled"> <var:if condition="mailAuxiliaryUserAccountsEnabled">
<div const:id="mailAccountsToolbar" class="bottomToolbar"> <div const:id="mailAccountsToolbar" class="bottomToolbar">
<a const:id="mailAccountAdd" class="bottomButton" href="#"> <a const:id="mailAccountAdd" class="bottomButton" href="#">
<span><img rsrc:src="add-icon.png" label:title="Add" /> <span><img rsrc:src="add-icon.png" label:title="Add" />
</span></a> </span></a>
<a const:id="mailAccountDelete" class="bottomButton" href="#"> <a const:id="mailAccountDelete" class="bottomButton" href="#">
<span><img rsrc:src="remove-icon.png" label:title="Delete" /> <span><img rsrc:src="remove-icon.png" label:title="Delete" />
</span></a> </span></a>
</div> </div>
</var:if> </var:if>
<div id="mailAccountEditor"> <div id="mailAccountEditor">
@ -448,15 +495,15 @@
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt><var:string label:value="Server Name:"/></dt> <dt><var:string label:value="Server Name:"/></dt>
<dd><input const:name="serverName" const:id="serverName" type="text" const:value=""/> <dd><input const:name="serverName" const:id="serverName" type="text" const:value=""/>
<var:string label:value="Port:"/> <var:string label:value="Port:"/>
<input const:name="port" const:id="port" type="text" const:value=""/></dd> <input const:name="port" const:id="port" type="text" const:value=""/></dd>
<dt><var:string label:value="Encryption:"/></dt> <dt><var:string label:value="Encryption:"/></dt>
<dd><input const:name="encryption" type="radio" const:value="none"/> <dd><input const:name="encryption" type="radio" const:value="none"/>
<var:string label:value="None"/> <var:string label:value="None"/>
<input const:name="encryption" type="radio" const:value="ssl"/> <input const:name="encryption" type="radio" const:value="ssl"/>
<var:string label:value="SSL"/> <var:string label:value="SSL"/>
<input const:name="encryption" type="radio" const:value="tls"/> <input const:name="encryption" type="radio" const:value="tls"/>
<var:string label:value="TLS"/></dd> <var:string label:value="TLS"/></dd>
<dt><var:string label:value="User Name:"/></dt> <dt><var:string label:value="User Name:"/></dt>
<dd><input const:name="userName" const:id="userName" type="text" const:value=""/></dd> <dd><input const:name="userName" const:id="userName" type="text" const:value=""/></dd>
<dt><var:string label:value="Password:"/></dt> <dt><var:string label:value="Password:"/></dt>
@ -464,11 +511,11 @@
</dl> </dl>
<input const:name="encryption" type="hidden" const:value="none"/> <input const:name="encryption" type="hidden" const:value="none"/>
</fieldset> </fieldset>
<script type="text/javascript"> <script type="text/javascript">
var mailCustomFromEnabled = <var:string value="mailCustomFromEnabled" const:escapeHTML="NO"/>; var mailCustomFromEnabled = <var:string value="mailCustomFromEnabled" const:escapeHTML="NO"/>;
</script> </script>
<fieldset const:id="identityInfo"> <fieldset const:id="identityInfo">
<dl class="dl-horizontal"> <dl class="dl-horizontal">
<dt><var:string label:value="Full Name:"/></dt> <dt><var:string label:value="Full Name:"/></dt>
@ -481,40 +528,40 @@
<dd><span id="actSignature"><!--space --></span></dd> <dd><span id="actSignature"><!--space --></span></dd>
</dl> </dl>
</fieldset> </fieldset>
<fieldset const:id="returnReceiptsInfo"> <fieldset const:id="returnReceiptsInfo">
<var:string <var:string
label:value="When I receive a request for a return receipt:" label:value="When I receive a request for a return receipt:"
/><br/> /><br/>
<label><input const:name="receipt-action" const:id="receipt-action-ignore" <label><input const:name="receipt-action" const:id="receipt-action-ignore"
type="radio" const:value="ignore"/> type="radio" const:value="ignore"/>
<var:string <var:string
label:value="Never send a return receipt"/></label label:value="Never send a return receipt"/></label
><br/> ><br/>
<label><input const:name="receipt-action" const:id="receipt-action-allow" <label><input const:name="receipt-action" const:id="receipt-action-allow"
type="radio" const:value="allow"/> type="radio" const:value="allow"/>
<var:string <var:string
label:value="Allow return receipts for some messages"/></label label:value="Allow return receipts for some messages"/></label
><br/> ><br/>
<div id="receiptOptions"> <div id="receiptOptions">
<var:string <var:string
label:value="If I'm not in the To or Cc of the message:"/> label:value="If I'm not in the To or Cc of the message:"/>
<select name="receipt-non-recipient-action" id="receipt-non-recipient-action"> <select name="receipt-non-recipient-action" id="receipt-non-recipient-action">
<option const:value="ignore"><var:string label:value="Never send"/></option> <option const:value="ignore"><var:string label:value="Never send"/></option>
<option const:value="send"><var:string label:value="Always send"/></option> <option const:value="send"><var:string label:value="Always send"/></option>
<option const:value="ask"><var:string label:value="Ask me"/></option> <option const:value="ask"><var:string label:value="Ask me"/></option>
</select><br/> </select><br/>
<var:string <var:string
label:value="If the sender is outside my domain:"/> label:value="If the sender is outside my domain:"/>
<select name="receipt-outside-domain-action" id="receipt-outside-domain-action"> <select name="receipt-outside-domain-action" id="receipt-outside-domain-action">
<option const:value="ignore"><var:string label:value="Never send"/></option> <option const:value="ignore"><var:string label:value="Never send"/></option>
<option const:value="send"><var:string label:value="Always send"/></option> <option const:value="send"><var:string label:value="Always send"/></option>
<option const:value="ask"><var:string label:value="Ask me"/></option> <option const:value="ask"><var:string label:value="Ask me"/></option>
</select><br/> </select><br/>
<var:string <var:string
label:value="In all other cases:"/> label:value="In all other cases:"/>
<select name="receipt-any-action" id="receipt-any-action"> <select name="receipt-any-action" id="receipt-any-action">
<option const:value="ignore"><var:string label:value="Never send"/></option> <option const:value="ignore"><var:string label:value="Never send"/></option>
<option const:value="send"><var:string label:value="Always send"/></option> <option const:value="send"><var:string label:value="Always send"/></option>
@ -524,79 +571,79 @@
</fieldset> </fieldset>
</div> </div>
</div> </div>
<var:if condition="isVacationEnabled"> <var:if condition="isVacationEnabled">
<div id="vacationView" class="tab"> <div id="vacationView" class="tab">
<label><input type="checkbox" <label><input type="checkbox"
const:name="enableVacation" const:name="enableVacation"
const:id="enableVacation" const:id="enableVacation"
var:checked="enableVacation" /> var:checked="enableVacation" />
<var:string label:value="Enable vacation auto reply"/></label> <var:string label:value="Enable vacation auto reply"/></label>
<div id="vacation"> <div id="vacation">
<label><var:string label:value="Auto reply message :"/><br/> <label><var:string label:value="Auto reply message :"/><br/>
<textarea const:name="autoReplyText" <textarea const:name="autoReplyText"
const:id="autoReplyText" const:id="autoReplyText"
var:value="autoReplyText"/> var:value="autoReplyText"/>
</label><br/> </label><br/>
<label><var:string label:value="Email addresses (separated by commas) :"/><br/> <label><var:string label:value="Email addresses (separated by commas) :"/><br/>
<input type="hidden" <input type="hidden"
const:id="defaultEmailAddresses" const:id="defaultEmailAddresses"
var:value="defaultEmailAddresses" /> var:value="defaultEmailAddresses" />
<textarea const:name="autoReplyEmailAddresses" <textarea const:name="autoReplyEmailAddresses"
const:id="autoReplyEmailAddresses" const:id="autoReplyEmailAddresses"
var:value="autoReplyEmailAddresses" /><br/> var:value="autoReplyEmailAddresses" /><br/>
<span><a href="#" class="button" id="addDefaultEmailAddresses"><span> <span><a href="#" class="button" id="addDefaultEmailAddresses"><span>
<var:string label:value="Add default email addresses" /></span></a> <var:string label:value="Add default email addresses" /></span></a>
</span> </span>
</label><br/> </label><br/>
<label><var:string label:value="Days between responses :"/> <label><var:string label:value="Days between responses :"/>
<var:popup list="daysBetweenResponsesList" item="item" <var:popup list="daysBetweenResponsesList" item="item"
const:id="daysBetweenResponsesList" const:id="daysBetweenResponsesList"
const:name="daysBetweenResponsesList" const:name="daysBetweenResponsesList"
string="item" string="item"
selection="daysBetweenResponses" /></label><br/> selection="daysBetweenResponses" /></label><br/>
<label><input type="checkbox" <label><input type="checkbox"
const:name="ignoreLists" const:name="ignoreLists"
const:id="ignoreLists" const:id="ignoreLists"
var:checked="ignoreLists" /> var:checked="ignoreLists" />
<var:string label:value="Do not send responses to mailing lists" /></label><br/> <var:string label:value="Do not send responses to mailing lists" /></label><br/>
<label class="timeDate"><input var:checked="enableVacationEndDate" <label class="timeDate"><input var:checked="enableVacationEndDate"
const:name="enableVacationEndDate" const:id="enableVacationEndDate" type="checkbox" class="checkBox" const:name="enableVacationEndDate" const:id="enableVacationEndDate" type="checkbox" class="checkBox"
/><var:string label:value="Disable auto reply on" /></label><var:component className="UIxTimeDateControl" /><var:string label:value="Disable auto reply on" /></label><var:component className="UIxTimeDateControl"
const:displayTimeControl="0" const:displayTimeControl="0"
var:disabled="disableVacationEndDate" var:disabled="disableVacationEndDate"
const:controlID="vacationEndDate" const:controlID="vacationEndDate"
date="vacationEndDate" date="vacationEndDate"
const:dayStartHour="0" const:dayStartHour="0"
const:dayEndHour="23" const:dayEndHour="23"
/> />
</div> </div>
</div> </div>
</var:if </var:if
><var:if condition="isForwardEnabled"> ><var:if condition="isForwardEnabled">
<div id="forwardView" class="tab"> <div id="forwardView" class="tab">
<label><input type="checkbox" <label><input type="checkbox"
const:name="enableForward" const:name="enableForward"
const:id="enableForward" const:id="enableForward"
var:checked="enableForward" /> var:checked="enableForward" />
<var:string label:value="Forward incoming messages"/></label><br/> <var:string label:value="Forward incoming messages"/></label><br/>
<div id="forward"> <div id="forward">
<label><var:string label:value="Email addresses (separated by commas) :"/><br/> <label><var:string label:value="Email addresses (separated by commas) :"/><br/>
<textarea const:name="forwardAddress" <textarea const:name="forwardAddress"
const:id="forwardAddress" const:id="forwardAddress"
var:value="forwardAddress" /> var:value="forwardAddress" />
</label><br/> </label><br/>
<label><input type="checkbox" <label><input type="checkbox"
const:name="forwardKeepCopy" const:name="forwardKeepCopy"
const:id="forwardKeepCopy" const:id="forwardKeepCopy"
var:checked="forwardKeepCopy" /> var:checked="forwardKeepCopy" />
<var:string label:value="Keep a copy" /></label><br/> <var:string label:value="Keep a copy" /></label><br/>
</div> </div>
</div> </div>
@ -605,23 +652,23 @@
<var:if condition="shouldDisplayPasswordChange"> <var:if condition="shouldDisplayPasswordChange">
<div id="passwordView" class="tab"> <div id="passwordView" class="tab">
<p id="passwordFields"><label><var:string label:value="New password:" <p id="passwordFields"><label><var:string label:value="New password:"
/><input const:id="newPasswordField" class="textField" /><input const:id="newPasswordField" class="textField"
type="password" const:value=""/></label><br/> type="password" const:value=""/></label><br/>
<label><var:string label:value="Confirmation:" <label><var:string label:value="Confirmation:"
/><input const:id="newPasswordConfirmationField" class="textField" /><input const:id="newPasswordConfirmationField" class="textField"
type="password" const:value=""/></label><br/> type="password" const:value=""/></label><br/>
<a href="#" class="button" id="changePasswordBtn" <a href="#" class="button" id="changePasswordBtn"
><span><var:string label:value="Change"/></span></a><br/> ><span><var:string label:value="Change"/></span></a><br/>
</p> </p>
<p id="passwordError"><!-- space --></p> <p id="passwordError"><!-- space --></p>
</div> </div>
</var:if </var:if
><var:if condition="shouldDisplayAdditionalPreferences" ><var:if condition="shouldDisplayAdditionalPreferences"
><div id="additionalView" class="tab"> ><div id="additionalView" class="tab">
<var:component className="UIxAdditionalPreferences"/> <var:component className="UIxAdditionalPreferences"/>
</div></var:if> </div></var:if>
<input type="hidden" id="hasChanged" name="hasChanged" <input type="hidden" id="hasChanged" name="hasChanged"
var:value="hasChanged"/> var:value="hasChanged"/>
</div> </div>
</div> </div>
</form> </form>

View File

@ -2,277 +2,384 @@
// NOTE: The popup menu with id "contactsMenu" must exist before // NOTE: The popup menu with id "contactsMenu" must exist before
// using this interface. // using this interface.
// //
// This interface fires two events: // This interface fires two events:
// - autocompletion:changed : fired when a new contact is selected // - autocompletion:changed : fired when a new contact is selected
// - autocompletion:changedlist : fired when a new list is selected // - autocompletion:changedlist : fired when a new list is selected
// //
var SOGoAutoCompletionInterface = { var SOGoAutoCompletionInterface = {
// Attributes that could be changed from the object // Attributes that could be changed from the object
// inheriting the inteface // inheriting the inteface
uidField: "c_name", uidField: "c_name",
addressBook: null, addressBook: null,
excludeGroups: false, SOGoUsersSearch: false,
excludeLists: false, excludeGroups: false,
excludeLists: false,
// Internal attributes
animationParent: null, // Internal attributes
selectedIndex: -1, animationParent: null,
delay: 0.750, selectedIndex: -1,
delayedSearch: false, delay: 0.750,
menu: null, delayedSearch: false,
menu: null,
bind: function () {
this.menu = $('contactsMenu'); bind: function () {
this.writeAttribute("autocomplete", "off"); this.menu = $('contactsMenu');
this.writeAttribute("container", null); this.writeAttribute("autocomplete", "off");
this.confirmedValue = null; this.writeAttribute("container", null);
this.observe("keydown", this.onKeydown.bindAsEventListener(this)); this.confirmedValue = null;
this.observe("blur", this.onBlur.bindAsEventListener(this)); this.observe("keydown", this.onKeydown.bindAsEventListener(this));
}, this.observe("blur", this.onBlur.bindAsEventListener(this));
},
onKeydown: function (event) {
if (event.ctrlKey || event.metaKey) { onKeydown: function (event) {
this.focussed = true; if (event.ctrlKey || event.metaKey) {
return; this.focussed = true;
} return;
if (event.keyCode == Event.KEY_TAB) { }
if (this.confirmedValue) if (event.keyCode == Event.KEY_TAB) {
this.value = this.confirmedValue; if (this.confirmedValue)
else this.value = this.confirmedValue;
this.writeAttribute("uid", null); else
if (document.currentPopupMenu) this.writeAttribute("uid", null);
hideMenu(document.currentPopupMenu); if (document.currentPopupMenu)
} hideMenu(document.currentPopupMenu);
else if (event.keyCode == 0 }
|| event.keyCode == Event.KEY_BACKSPACE else if (event.keyCode == 0
|| event.keyCode == Event.KEY_DELETE || event.keyCode == Event.KEY_BACKSPACE
|| event.keyCode == 32 // Space || event.keyCode == Event.KEY_DELETE
|| event.keyCode > 47) { || event.keyCode == 32 // Space
this.confirmedValue = null; || event.keyCode > 47) {
this.selectedIndex = -1; this.confirmedValue = null;
if (this.delayedSearch) this.selectedIndex = -1;
window.clearTimeout(this.delayedSearch); if (this.delayedSearch)
this.delayedSearch = this.performSearch.delay(this.delay, this); window.clearTimeout(this.delayedSearch);
} this.delayedSearch = this.performSearch.delay(this.delay, this);
else if (event.keyCode == Event.KEY_RETURN) { }
preventDefault(event); else if (event.keyCode == Event.KEY_RETURN) {
if (this.confirmedValue) preventDefault(event);
this.value = this.confirmedValue; if (this.confirmedValue)
else this.value = this.confirmedValue;
this.writeAttribute("uid", null); else
if (document.currentPopupMenu) this.writeAttribute("uid", null);
hideMenu(document.currentPopupMenu); if (document.currentPopupMenu)
this.selectedIndex = -1; hideMenu(document.currentPopupMenu);
if (this.readAttribute("container")) { this.selectedIndex = -1;
this.confirmedValue = null; if (this.readAttribute("container")) {
this.fire("autocompletion:changedlist", this.readAttribute("container")); this.confirmedValue = null;
} this.fire("autocompletion:changedlist", this.readAttribute("container"));
else
this.fire("autocompletion:changed", event.keyCode);
}
else if (this.menu.getStyle('visibility') == 'visible') {
if (event.keyCode == Event.KEY_UP) { // Up arrow
if (this.selectedIndex > 0) {
var contacts = this.menu.select("li");
contacts[this.selectedIndex--].removeClassName("selected");
this.value = contacts[this.selectedIndex].readAttribute("address");
this.confirmedValue = this.value;
this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid"));
contacts[this.selectedIndex].addClassName("selected");
var container = contacts[this.selectedIndex].readAttribute("container");
if (container)
this.writeAttribute("container", container);
}
}
else if (event.keyCode == Event.KEY_DOWN) { // Down arrow
var contacts = this.menu.select("li");
if (contacts.size() - 1 > this.selectedIndex) {
if (this.selectedIndex >= 0)
contacts[this.selectedIndex].removeClassName("selected");
this.selectedIndex++;
this.value = contacts[this.selectedIndex].readAttribute("address");
this.confirmedValue = this.value;
this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid"));
contacts[this.selectedIndex].addClassName("selected");
var container = contacts[this.selectedIndex].readAttribute("container");
if (container)
this.writeAttribute("container", container);
}
}
}
},
onBlur: function (event) {
if (this.delayedSearch)
window.clearTimeout(this.delayedSearch);
if (this.confirmedValue) {
this.value = this.confirmedValue;
if (this.readAttribute("container"))
this.fire("autocompletion:changedlist", this.readAttribute("container"));
else
this.fire("autocompletion:changed", event.keyCode);
}
else
this.writeAttribute("uid", null);
},
performSearch: function (input) {
// Perform address completion
if (document.contactLookupAjaxRequest) {
// Abort any pending request
document.contactLookupAjaxRequest.aborted = true;
document.contactLookupAjaxRequest.abort();
}
if (input.value.trim().length > minimumSearchLength) {
var urlstr = UserFolderURL + "Contacts/";
if (input.addressBook)
urlstr += input.addressBook + "/contact";
else
urlstr += "allContact";
urlstr += "Search?search=" + encodeURIComponent(input.value);
if (input.excludeGroups)
urlstr += "&excludeGroups=1";
if (input.excludeLists)
urlstr += "&excludeLists=1";
if (input.animationParent)
startAnimation(input.animationParent);
document.contactLookupAjaxRequest =
triggerAjaxRequest(urlstr, input.performSearchCallback.bind(input), input);
}
else {
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
}
},
performSearchCallback: function (http) {
if (http.readyState == 4) {
var list = this.menu.down("ul");
var input = http.callbackData;
if (http.status == 200) {
var start = input.value.length;
var data = http.responseText.evalJSON(true);
if (data.contacts.length > 1) {
list.select("li").each(function(item) {
item.stopObserving("mousedown");
item.remove();
});
// Populate popup menu
for (var i = 0; i < data.contacts.length; i++) {
var contact = data.contacts[i];
var completeEmail = contact["c_cn"];
var uid = "" + contact[this.uidField];
var c_name = "" + contact['c_name'];
if (contact["c_mail"])
completeEmail += " <" + contact["c_mail"] + ">";
var node = new Element('li', { 'address': completeEmail,
'uid': uid });
var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase());
if (matchPosition > -1) {
var matchBefore = completeEmail.substring(0, matchPosition);
var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length);
var matchAfter = completeEmail.substring(matchPosition + data.searchText.length);
node.appendChild(document.createTextNode(matchBefore));
node.appendChild(new Element('strong').update(matchText));
node.appendChild(document.createTextNode(matchAfter));
}
else {
node.appendChild(document.createTextNode(completeEmail));
}
list.appendChild(node);
if (c_name.endsWith(".vlf")) {
// Keep track of list containers
node.writeAttribute("container", contact['container']);
}
if (contact["contactInfo"])
node.appendChild(document.createTextNode(" (" + contact["contactInfo"] + ")"));
$(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this));
}
// Show popup menu
var offsetScroll = Element.cumulativeScrollOffset(input);
var offset = Element.positionedOffset(input);
if ($(document.body).hasClassName("popup") && typeof initPopupMailer == 'undefined')
// Hack for some situations where the offset must be computed differently
offset = Element.cumulativeOffset(input);
var top = offset.top - offsetScroll.top + node.offsetHeight + 3;
var height = 'auto';
var heightDiff = window.height() - offset[1];
var nodeHeight = node.getHeight();
if ((data.contacts.length * nodeHeight) > heightDiff)
// Limit the size of the popup to the window height, minus 12 pixels
height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px';
this.menu.setStyle({ top: top + "px",
left: offset[0] + "px",
height: height,
maxWidth: (window.width() - offset[0] - 12) + "px",
visibility: "visible" });
this.menu.scrollTop = 0;
document.currentPopupMenu = this.menu;
$(document.body).stopObserving("click");
$(document.body).observe("click", onBodyClickMenuHandler);
}
else {
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
if (data.contacts.length == 1) {
// Single result
var contact = data.contacts[0];
var uid = "" + contact[this.uidField];
var c_name = "" + contact['c_name'];
input.writeAttribute("uid", uid);
if (c_name.endsWith(".vlf")) {
this.writeAttribute("container", contact['container']);
}
var completeEmail = contact["c_cn"];
if (contact["c_mail"])
completeEmail += " <" + contact["c_mail"] + ">";
if (contact["c_cn"].substring(0, input.value.length).toUpperCase()
== input.value.toUpperCase())
input.value = completeEmail;
else
// The result matches email address, not user name
input.value += ' >> ' + completeEmail;
input.confirmedValue = completeEmail;
var end = input.value.length;
$(input).selectText(start, end);
this.selectedIndex = -1;
}
}
}
else
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
document.contactLookupAjaxRequest = null;
}
},
onAddressResultClick: function(event) {
var e = Event.element(event);
if (e.tagName != 'LI')
e = e.up('LI');
if (e) {
preventDefault(event);
this.value = e.readAttribute("address");
this.writeAttribute("uid", e.readAttribute("uid"));
if (e.readAttribute("container"))
this.fire("autocompletion:changedlist", e.readAttribute("container"));
else {
this.confirmedValue = this.value;
this.fire("autocompletion:changed", Event.KEY_RETURN);
}
}
} }
else
this.fire("autocompletion:changed", event.keyCode);
}
else if (this.menu.getStyle('visibility') == 'visible') {
if (event.keyCode == Event.KEY_UP) { // Up arrow
if (this.selectedIndex > 0) {
var contacts = this.menu.select("li");
contacts[this.selectedIndex--].removeClassName("selected");
this.value = contacts[this.selectedIndex].readAttribute("address");
this.confirmedValue = this.value;
this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid"));
contacts[this.selectedIndex].addClassName("selected");
var container = contacts[this.selectedIndex].readAttribute("container");
if (container)
this.writeAttribute("container", container);
}
}
else if (event.keyCode == Event.KEY_DOWN) { // Down arrow
var contacts = this.menu.select("li");
if (contacts.size() - 1 > this.selectedIndex) {
if (this.selectedIndex >= 0)
contacts[this.selectedIndex].removeClassName("selected");
this.selectedIndex++;
this.value = contacts[this.selectedIndex].readAttribute("address");
this.confirmedValue = this.value;
this.writeAttribute("uid", contacts[this.selectedIndex].readAttribute("uid"));
contacts[this.selectedIndex].addClassName("selected");
var container = contacts[this.selectedIndex].readAttribute("container");
if (container)
this.writeAttribute("container", container);
}
}
}
},
onBlur: function (event) {
if (this.delayedSearch)
window.clearTimeout(this.delayedSearch);
if (this.confirmedValue) {
this.value = this.confirmedValue;
if (this.readAttribute("container"))
this.fire("autocompletion:changedlist", this.readAttribute("container"));
else
this.fire("autocompletion:changed", event.keyCode);
}
else
this.writeAttribute("uid", null);
},
performSearch: function (input) {
// Perform address completion
if (document.contactLookupAjaxRequest) {
// Abort any pending request
document.contactLookupAjaxRequest.aborted = true;
document.contactLookupAjaxRequest.abort();
}
if (input.value.trim().length > minimumSearchLength) {
if (input.SOGoUsersSearch) {
var urlstr = UserFolderURL + "usersSearch?search=" + encodeURIComponent(input.value);
document.contactLookupAjaxRequest =
triggerAjaxRequest(urlstr, input.performUsersSearchCallback.bind(input), input);
}
else {
var urlstr = UserFolderURL + "Contacts/";
if (input.addressBook)
urlstr += input.addressBook + "/contact";
else
urlstr += "allContact";
urlstr += "Search?search=" + encodeURIComponent(input.value);
if (input.excludeGroups)
urlstr += "&excludeGroups=1";
if (input.excludeLists)
urlstr += "&excludeLists=1";
if (input.animationParent)
startAnimation(input.animationParent);
document.contactLookupAjaxRequest =
triggerAjaxRequest(urlstr, input.performSearchCallback.bind(input), input);
}
}
else {
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
}
},
performSearchCallback: function (http) {
if (http.readyState == 4) {
var list = this.menu.down("ul");
var input = http.callbackData;
if (http.status == 200) {
var start = input.value.length;
var data = http.responseText.evalJSON(true);
if (data.contacts.length > 1) {
list.select("li").each(function(item) {
item.stopObserving("mousedown");
item.remove();
});
// Populate popup menu
for (var i = 0; i < data.contacts.length; i++) {
var contact = data.contacts[i];
var completeEmail = contact["c_cn"];
var uid = "" + contact[this.uidField];
var c_name = "" + contact['c_name'];
if (contact["c_mail"])
completeEmail += " <" + contact["c_mail"] + ">";
var node = new Element('li', { 'address': completeEmail,
'uid': uid });
var matchPosition = completeEmail.toLowerCase().indexOf(data.searchText.toLowerCase());
if (matchPosition > -1) {
var matchBefore = completeEmail.substring(0, matchPosition);
var matchText = completeEmail.substring(matchPosition, matchPosition + data.searchText.length);
var matchAfter = completeEmail.substring(matchPosition + data.searchText.length);
node.appendChild(document.createTextNode(matchBefore));
node.appendChild(new Element('strong').update(matchText));
node.appendChild(document.createTextNode(matchAfter));
}
else {
node.appendChild(document.createTextNode(completeEmail));
}
list.appendChild(node);
if (c_name.endsWith(".vlf")) {
// Keep track of list containers
node.writeAttribute("container", contact['container']);
}
if (contact["contactInfo"])
node.appendChild(document.createTextNode(" (" + contact["contactInfo"] + ")"));
$(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this));
}
// Show popup menu
var offsetScroll = Element.cumulativeScrollOffset(input);
var offset = Element.positionedOffset(input);
if ($(document.body).hasClassName("popup") && typeof initPopupMailer == 'undefined')
// Hack for some situations where the offset must be computed differently
offset = Element.cumulativeOffset(input);
var top = offset.top - offsetScroll.top + node.offsetHeight + 3;
var height = 'auto';
var heightDiff = window.height() - offset[1];
var nodeHeight = node.getHeight();
if ((data.contacts.length * nodeHeight) > heightDiff)
// Limit the size of the popup to the window height, minus 12 pixels
height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px';
this.menu.setStyle({ top: top + "px",
left: offset[0] + "px",
height: height,
maxWidth: (window.width() - offset[0] - 12) + "px",
visibility: "visible" });
this.menu.scrollTop = 0;
document.currentPopupMenu = this.menu;
$(document.body).stopObserving("click");
$(document.body).observe("click", onBodyClickMenuHandler);
}
else {
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
if (data.contacts.length == 1) {
// Single result
var contact = data.contacts[0];
var uid = "" + contact[this.uidField];
var c_name = "" + contact['c_name'];
input.writeAttribute("uid", uid);
if (c_name.endsWith(".vlf")) {
this.writeAttribute("container", contact['container']);
}
var completeEmail = contact["c_cn"];
if (contact["c_mail"])
completeEmail += " <" + contact["c_mail"] + ">";
if (contact["c_cn"].substring(0, input.value.length).toUpperCase()
== input.value.toUpperCase())
input.value = completeEmail;
else
// The result matches email address, not user name
input.value += ' >> ' + completeEmail;
input.confirmedValue = completeEmail;
var end = input.value.length;
$(input).selectText(start, end);
this.selectedIndex = -1;
}
}
}
else
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
document.contactLookupAjaxRequest = null;
}
},
performUsersSearchCallback: function (http) {
if (http.readyState == 4) {
var list = this.menu.down("ul");
var input = http.callbackData;
if (http.status == 200) {
var response = http.responseText.evalJSON();
if (response.length > 1) {
list.select("li").each(function(item) {
item.stopObserving("mousedown");
item.remove();
});
// Populate popup menu
for (var i = 0; i < response.length; i++) {
var c_name = response[i][1];
var completeEmail = c_name;
var c_mail = response[i][2];
var uid = response[i][3];
if (c_mail)
completeEmail += " <" + c_mail + ">";
var node = new Element('li', { 'address': completeEmail,
'uid': uid });
var matchPosition = completeEmail.toLowerCase().indexOf(input.getValue().toLowerCase());
if (matchPosition > -1) {
var matchBefore = completeEmail.substring(0, matchPosition);
var matchText = completeEmail.substring(matchPosition, matchPosition + input.getValue().length);
var matchAfter = completeEmail.substring(matchPosition + input.getValue().length);
node.appendChild(document.createTextNode(matchBefore));
node.appendChild(new Element('strong').update(matchText));
node.appendChild(document.createTextNode(matchAfter));
}
else {
node.appendChild(document.createTextNode(completeEmail));
}
list.appendChild(node);
$(node).observe("mousedown", this.onAddressResultClick.bindAsEventListener(this));
}
// Show popup menu
var offsetScroll = Element.cumulativeScrollOffset(input);
var offset = Element.positionedOffset(input);
if ($(document.body).hasClassName("popup") && typeof initPopupMailer == 'undefined')
// Hack for some situations where the offset must be computed differently
offset = Element.cumulativeOffset(input);
var top = offset.top - offsetScroll.top + node.offsetHeight + 3;
var height = 'auto';
var heightDiff = window.height() - offset[1];
var nodeHeight = node.getHeight();
if ((response.length * nodeHeight) > heightDiff)
// Limit the size of the popup to the window height, minus 12 pixels
height = parseInt(heightDiff/nodeHeight) * nodeHeight - 12 + 'px';
this.menu.setStyle({ top: top + "px",
left: offset[0] + "px",
height: height,
maxWidth: (window.width() - offset[0] - 12) + "px",
visibility: "visible" });
this.menu.scrollTop = 0;
document.currentPopupMenu = this.menu;
$(document.body).stopObserving("click");
$(document.body).observe("click", onBodyClickMenuHandler);
}
else {
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
if (response.length == 1) {
// Single result
var c_name = response[0][1];
var completeEmail = c_name;
var c_mail = response[0][2];
var c_uid = response[0][0];
input.writeAttribute("uid", c_uid);
if (c_mail)
completeEmail += " <" + c_mail + ">";
if (c_uid.substring(0, input.getValue().length).toUpperCase() == input.getValue().toUpperCase())
input.value = completeEmail;
else
// The result matches email address, not user name
input.value += ' >> ' + completeEmail;
input.confirmedValue = completeEmail;
var end = input.getValue().length;
$(input).selectText(start, end);
this.selectedIndex = -1;
}
}
}
else
if (document.currentPopupMenu)
hideMenu(document.currentPopupMenu);
document.contactLookupAjaxRequest = null;
}
},
onAddressResultClick: function(event) {
var e = Event.element(event);
if (e.tagName != 'LI')
e = e.up('LI');
if (e) {
preventDefault(event);
this.value = e.readAttribute("address");
this.writeAttribute("uid", e.readAttribute("uid"));
if (e.readAttribute("container"))
this.fire("autocompletion:changedlist", e.readAttribute("container"));
else {
this.confirmedValue = this.value;
this.fire("autocompletion:changed", Event.KEY_RETURN);
}
}
}
}; };

View File

@ -14,6 +14,12 @@ DIV.bottomToolbar
right: 2em; right: 2em;
bottom: 8px; } bottom: 8px; }
#WhiteListAdd, #WhiteListDelete
{
border-bottom: 1px solid #9B9B9B;
border-right: 1px solid #9B9B9B;
}
#mailAccountsToolbar #mailAccountsToolbar
{ left: 5px; { left: 5px;
bottom: 9px; bottom: 9px;
@ -47,17 +53,35 @@ DIV.listWrapper
padding: 0px; padding: 0px;
margin-top: 2px; margin-top: 2px;
border-left: 1px solid #9b9b9b; border-left: 1px solid #9b9b9b;
border-right: 1px solid #9b9b9b;
background: #ccddec;} background: #ccddec;}
.listWrapper TABLE TD .listWrapper TABLE TD
{ height: 22px; } { height: 22px; }
#calendarCategoriesListWrapper #calendarCategoriesListWrapper
{ top: 232px; { top:1em;
bottom: 30px; bottom: 30px;
right: 2em; right: 2em;
left: 2em; } left: 2em; }
#appointmentsWhiteListWrapper
{ top:4.5em;
bottom: 30px;
right: 2em;
left: 2em; }
#tableViewWhiteList
{ width:100%; }
DIV#calendarOptionsTabs
{ position: absolute;
top: 225px;
left: 0px;
right: 0px;
bottom: 0px;
}
#contactsCategoriesListWrapper #contactsCategoriesListWrapper
{ overflow: auto; { overflow: auto;
position: absolute; position: absolute;

View File

@ -3,109 +3,112 @@ var mailAccounts = null;
var dialogs = {}; var dialogs = {};
function savePreferences(sender) { function savePreferences(sender) {
var sendForm = true; var sendForm = true;
var sigList = $("signaturePlacementList");
if (sigList)
sigList.disabled = false;
if ($("calendarCategoriesListWrapper"))
serializeCalendarCategories();
if ($("contactsCategoriesListWrapper"))
serializeContactsCategories();
if ($("mailLabelsListWrapper"))
serializeMailLabels();
if (typeof mailCustomFromEnabled !== "undefined" && !emailRE.test($("email").value)) {
showAlertDialog(_("Please specify a valid sender address."));
sendForm = false;
}
if ($("replyTo")) {
var replyTo = $("replyTo").value;
if (!replyTo.blank() && !emailRE.test(replyTo)) {
showAlertDialog(_("Please specify a valid reply-to address."));
sendForm = false;
}
}
if ($("dayStartTime")) {
var start = $("dayStartTime");
var selectedStart = parseInt(start.options[start.selectedIndex].value);
var end = $("dayEndTime");
var selectedEnd = parseInt(end.options[end.selectedIndex].value);
if (selectedStart >= selectedEnd) { var sigList = $("signaturePlacementList");
showAlertDialog (_("Day start time must be prior to day end time.")); if (sigList)
sendForm = false; sigList.disabled = false;
}
}
if ($("enableVacation") && $("enableVacation").checked) {
if ($("autoReplyText").value.strip().length == 0 || $("autoReplyEmailAddresses").value.strip().length == 0) {
showAlertDialog(_("Please specify your message and your email addresses for which you want to enable auto reply."));
sendForm = false;
}
if ($("autoReplyText").value.strip().endsWith('\n.')) { if ($("appointmentsWhiteListWrapper"))
showAlertDialog(_("Your vacation message must not end with a single dot on a line.")); serializeAppointmentsWhiteList();
sendForm = false;
}
if ($("enableVacationEndDate") && $("enableVacationEndDate").checked) { if ($("calendarCategoriesListWrapper"))
var e = $("vacationEndDate_date"); serializeCalendarCategories();
var endDate = e.inputAsDate();
var now = new Date(); if ($("contactsCategoriesListWrapper"))
if (isNaN(endDate.getTime()) || endDate.getTime() < now.getTime()) { serializeContactsCategories();
showAlertDialog(_("End date of your auto reply must be in the future."));
if ($("mailLabelsListWrapper"))
serializeMailLabels();
if (typeof mailCustomFromEnabled !== "undefined" && !emailRE.test($("email").value)) {
showAlertDialog(_("Please specify a valid sender address."));
sendForm = false; sendForm = false;
}
} }
}
if ($("enableForward") && $("enableForward").checked) {
var addresses = $("forwardAddress").value.split(",");
for (var i = 0; i < addresses.length && sendForm; i++)
if (!emailRE.test(addresses[i].strip())) {
showAlertDialog(_("Please specify an address to which you want to forward your messages."));
sendForm = false;
}
}
if (typeof sieveCapabilities != "undefined") {
var jsonFilters = prototypeIfyFilters();
$("sieveFilters").setValue(Object.toJSON(jsonFilters));
}
if (sendForm) {
saveMailAccounts();
triggerAjaxRequest($("mainForm").readAttribute("action"), function (http) { if ($("replyTo")) {
if (http.readyState == 4) { var replyTo = $("replyTo").value;
var response = http.responseText.evalJSON(true); if (!replyTo.blank() && !emailRE.test(replyTo)) {
if (http.status == 503) { showAlertDialog(_("Please specify a valid reply-to address."));
showAlertDialog(_(response.textStatus)); sendForm = false;
} }
else if (http.status == 200) { }
if (response.hasChanged == 1) {
window.opener.location.reload(); if ($("dayStartTime")) {
window.close(); var start = $("dayStartTime");
} var selectedStart = parseInt(start.options[start.selectedIndex].value);
else { var end = $("dayEndTime");
window.close(); var selectedEnd = parseInt(end.options[end.selectedIndex].value);
}
if (selectedStart >= selectedEnd) {
showAlertDialog (_("Day start time must be prior to day end time."));
sendForm = false;
} }
else { }
showAlertDialog(_(response.textStatus));
if ($("enableVacation") && $("enableVacation").checked) {
if ($("autoReplyText").value.strip().length == 0 || $("autoReplyEmailAddresses").value.strip().length == 0) {
showAlertDialog(_("Please specify your message and your email addresses for which you want to enable auto reply."));
sendForm = false;
} }
}
}, if ($("autoReplyText").value.strip().endsWith('\n.')) {
null, showAlertDialog(_("Your vacation message must not end with a single dot on a line."));
Form.serialize($("mainForm")), // excludes the file input sendForm = false;
{ "Content-type": "application/x-www-form-urlencoded"} }
);
if ($("enableVacationEndDate") && $("enableVacationEndDate").checked) {
var e = $("vacationEndDate_date");
var endDate = e.inputAsDate();
var now = new Date();
if (isNaN(endDate.getTime()) || endDate.getTime() < now.getTime()) {
showAlertDialog(_("End date of your auto reply must be in the future."));
sendForm = false;
}
}
}
if ($("enableForward") && $("enableForward").checked) {
var addresses = $("forwardAddress").value.split(",");
for (var i = 0; i < addresses.length && sendForm; i++)
if (!emailRE.test(addresses[i].strip())) {
showAlertDialog(_("Please specify an address to which you want to forward your messages."));
sendForm = false;
}
}
if (typeof sieveCapabilities != "undefined") {
var jsonFilters = prototypeIfyFilters();
$("sieveFilters").setValue(Object.toJSON(jsonFilters));
}
if (sendForm) {
saveMailAccounts();
triggerAjaxRequest($("mainForm").readAttribute("action"), function (http) {
if (http.readyState == 4) {
var response = http.responseText.evalJSON(true);
if (http.status == 503) {
showAlertDialog(_(response.textStatus));
}
else if (http.status == 200) {
if (response.hasChanged == 1) {
window.opener.location.reload();
window.close();
}
else {
window.close();
}
}
else {
showAlertDialog(_(response.textStatus));
}
}
},
null,
Form.serialize($("mainForm")), // excludes the file input
{ "Content-type": "application/x-www-form-urlencoded"}
);
} }
return false; return false;
} }
@ -118,14 +121,14 @@ function prototypeIfyFilters() {
newFilter.name = filter.name; newFilter.name = filter.name;
newFilter.match = filter.match; newFilter.match = filter.match;
newFilter.active = filter.active; newFilter.active = filter.active;
if (filter.rules) { if (filter.rules) {
newFilter.rules = $([]); newFilter.rules = $([]);
for (var j = 0; j < filter.rules.length; j++) { for (var j = 0; j < filter.rules.length; j++) {
newFilter.rules.push($(filter.rules[j])); newFilter.rules.push($(filter.rules[j]));
} }
} }
if (filter.actions) { if (filter.actions) {
newFilter.actions = $([]); newFilter.actions = $([]);
for (var j = 0; j < filter.actions.length; j++) { for (var j = 0; j < filter.actions.length; j++) {
@ -134,7 +137,7 @@ function prototypeIfyFilters() {
} }
newFilters.push(newFilter); newFilters.push(newFilter);
} }
return newFilters; return newFilters;
} }
@ -204,25 +207,76 @@ function initPreferences() {
var tabsContainer = $("preferencesTabs"); var tabsContainer = $("preferencesTabs");
var controller = new SOGoTabsController(); var controller = new SOGoTabsController();
controller.attachToTabsContainer(tabsContainer); controller.attachToTabsContainer(tabsContainer);
// Inner tabs on the mail module tab // Inner tabs on the mail module tab
tabsContainer = $('mailOptionsTabs'); tabsContainer = $('mailOptionsTabs');
if (tabsContainer) { if (tabsContainer) {
var mailController = new SOGoTabsController(); var mailController = new SOGoTabsController();
mailController.attachToTabsContainer(tabsContainer); mailController.attachToTabsContainer(tabsContainer);
} }
// Inner tabs on the calendar module tab
tabsContainer = $('calendarOptionsTabs');
if (tabsContainer) {
var mailController = new SOGoTabsController();
mailController.attachToTabsContainer(tabsContainer);
}
_setupEvents(); _setupEvents();
// Optional function called when initializing the preferences // Optional function called when initializing the preferences
// Typically defined inline in the UIxAdditionalPreferences.wox template // Typically defined inline in the UIxAdditionalPreferences.wox template
if (typeof (initAdditionalPreferences) != "undefined") if (typeof (initAdditionalPreferences) != "undefined")
initAdditionalPreferences(); initAdditionalPreferences();
// Color picker // Color picker
$('colorPickerDialog').on('click', 'span', onColorPickerChoice); $('colorPickerDialog').on('click', 'span', onColorPickerChoice);
$(document.body).on("click", onBodyClickHandler); $(document.body).on("click", onBodyClickHandler);
// Calendar whiteList
var whiteList = $("appointmentsWhiteListWrapper");
if(whiteList) {
var whiteListValue = $("whiteList").getValue();
if (whiteListValue != "") {
whiteListValue = whiteListValue.split(",");
var tablebody = $("appointmentsWhiteListWrapper").childNodesWithTag("table")[0].tBodies[0];
for (i = 0; i < whiteListValue.length; i++)
{
var elements = whiteListValue[i].split("=");
var row = new Element("tr");
var td = new Element("td").update("");
var textField = new Element("input");
var span = new Element("span");
row.addClassName("whiteListRow");
row.observe("mousedown", onRowClick);
td.addClassName ("whiteListCell");
td.observe("mousedown", endAllEditables);
td.observe("dblclick", onNameEdit);
textField.addInterface(SOGoAutoCompletionInterface);
textField.SOGoUsersSearch = true;
textField.observe("autocompletion:changed", endEditable);
textField.addClassName("textField");
textField.value = elements[1];
textField.setAttribute("uid", elements[0]);
textField.hide();
span.innerText = elements[1];
td.appendChild(textField);
td.appendChild(span);
row.appendChild (td);
tablebody.appendChild(row);
$(tablebody).deselectAll();
}
}
var table = whiteList.childNodesWithTag("table")[0];
table.multiselect = true;
$("appointmentsWhiteListAdd").observe("click", onAppointmentsWhiteListAdd);
$("appointmentsWhiteListDelete").observe("click", onAppointmentsWhiteListDelete);
}
// Calender categories // Calender categories
var wrapper = $("calendarCategoriesListWrapper"); var wrapper = $("calendarCategoriesListWrapper");
if (wrapper) { if (wrapper) {
@ -237,7 +291,7 @@ function initPreferences() {
$("calendarCategoryDelete").observe("click", onCalendarCategoryDelete); $("calendarCategoryDelete").observe("click", onCalendarCategoryDelete);
wrapper.observe("scroll", onBodyClickHandler); wrapper.observe("scroll", onBodyClickHandler);
} }
// Mail labels/tags // Mail labels/tags
var wrapper = $("mailLabelsListWrapper"); var wrapper = $("mailLabelsListWrapper");
if (wrapper) { if (wrapper) {
@ -251,7 +305,7 @@ function initPreferences() {
$("mailLabelAdd").observe("click", onMailLabelAdd); $("mailLabelAdd").observe("click", onMailLabelAdd);
$("mailLabelDelete").observe("click", onMailLabelDelete); $("mailLabelDelete").observe("click", onMailLabelDelete);
} }
// Contact categories // Contact categories
wrapper = $("contactsCategoriesListWrapper"); wrapper = $("contactsCategoriesListWrapper");
if (wrapper) { if (wrapper) {
@ -264,32 +318,31 @@ function initPreferences() {
$("contactsCategoryAdd").observe("click", onContactsCategoryAdd); $("contactsCategoryAdd").observe("click", onContactsCategoryAdd);
$("contactsCategoryDelete").observe("click", onContactsCategoryDelete); $("contactsCategoryDelete").observe("click", onContactsCategoryDelete);
} }
if ($("replyPlacementList")) if ($("replyPlacementList"))
onReplyPlacementListChange(); onReplyPlacementListChange();
var button = $("addDefaultEmailAddresses"); var button = $("addDefaultEmailAddresses");
if (button) if (button)
button.observe("click", addDefaultEmailAddresses); button.observe("click", addDefaultEmailAddresses);
button = $("changePasswordBtn"); button = $("changePasswordBtn");
if (button) if (button)
button.observe("click", onChangePasswordClick); button.observe("click", onChangePasswordClick);
initSieveFilters(); initSieveFilters();
initMailAccounts(); initMailAccounts();
button = $("enableVacationEndDate"); button = $("enableVacationEndDate");
if (button) { if (button) {
jQuery("#vacationEndDate_date").closest(".date").datepicker( jQuery("#vacationEndDate_date").closest(".date").datepicker({ autoclose: true, position: 'above', weekStart: $('weekStartDay').getValue() });
{ autoclose: true, position: 'above', weekStart: $('weekStartDay').getValue() });
button.on("click", function(event) { button.on("click", function(event) {
if (this.checked) if (this.checked)
$("vacationEndDate_date").enable(); $("vacationEndDate_date").enable();
else else
$("vacationEndDate_date").disable(); $("vacationEndDate_date").disable();
}); });
} }
onAddOutgoingAddressesCheck(); onAddOutgoingAddressesCheck();
} }
@ -977,6 +1030,119 @@ function onCalendarColorEdit(e) {
onCCE(e, "calendarCategoriesListWrapper"); onCCE(e, "calendarCategoriesListWrapper");
} }
function makeEditable (element) {
element.addClassName("editing");
element.removeClassName("whiteListCell");
var span = element.down("SPAN");
span.update();
var textField = element.down("INPUT");
textField.show();
textField.focus();
textField.select();
return true;
}
function endAllEditables (e) {
var r = $$("TABLE#tableViewWhiteList TBODY TR TD");
for (var i = 0; i < r.length; i++) {
var element = $(r[i]);
if (r[i] != this && element.hasClassName("editing"))
endEditable(null, element.down("INPUT"));
}
}
function onNameEdit (e) {
endAllEditables();
if (!this.hasClassName("editing")) {
makeEditable (this);
}
}
function endEditable(event, textField) {
if (!textField)
textField = this;
var uid = textField.readAttribute("uid");
var cell = textField.up("TD");
var textSpan = cell.down("SPAN");
cell.removeClassName("editing");
cell.addClassName("whiteListCell");
textField.hide();
var tmp = textField.value;
tmp = tmp.replace (/</, "&lt;");
tmp = tmp.replace (/>/, "&gt;");
if (!uid)
cell.up("TR").addClassName("notfound");
if (tmp)
textSpan.update(tmp);
else
cell.up("TR").remove();
if (event)
Event.stop(event);
return false;
}
function onAppointmentsWhiteListAdd(e) {
var tablebody = $("appointmentsWhiteListWrapper").childNodesWithTag("table")[0].tBodies[0];
var row = new Element("tr");
var td = new Element("td").update("");
var textField = new Element("input");
var span = new Element("span");
row.addClassName("whiteListRow");
row.observe("mousedown", onRowClick);
td.addClassName ("whiteListCell");
td.observe("mousedown", endAllEditables);
td.observe("dblclick", onNameEdit);
textField.addInterface(SOGoAutoCompletionInterface);
textField.SOGoUsersSearch = true;
textField.observe("autocompletion:changed", endEditable);
textField.addClassName("textField");
td.appendChild(textField);
td.appendChild(span);
row.appendChild (td);
tablebody.appendChild(row);
$(tablebody).deselectAll();
row.selectElement();
makeEditable(td);
}
function onAppointmentsWhiteListDelete(e) {
var list = $('appointmentsWhiteListWrapper').down("TABLE").down("TBODY");
var rows = list.getSelectedNodes();
var count = rows.length;
for (var i=0; i < count; i++) {
rows[i].editionController = null;
rows[i].remove();
}
}
function serializeAppointmentsWhiteList() {
var r = $$("#appointmentsWhiteListWrapper TBODY TR");
var values = [];
for (var i = 0; i < r.length; i++) {
var tds = r[i].childElements().first().down("INPUT");
var uid = tds.getAttribute("uid");
var value = tds.getValue();
var user = uid + "=" + value;
if (uid != null)
values.push(user);
}
$("whiteList").value = values;
}
function onCalendarCategoryAdd(e) { function onCalendarCategoryAdd(e) {
var row = new Element("tr"); var row = new Element("tr");
var nametd = new Element("td").update(""); var nametd = new Element("td").update("");
@ -1016,7 +1182,7 @@ function serializeCalendarCategories() {
var values = []; var values = [];
for (var i = 0; i < r.length; i++) { for (var i = 0; i < r.length; i++) {
var tds = r[i].childElements(); var tds = r[i].childElements();
var name = $(tds.first()).innerHTML; var name = $(tds.first()).innerHTML.trim();
var color = $(tds.last().childElements().first()).readAttribute('data-color'); var color = $(tds.last().childElements().first()).readAttribute('data-color');
values.push("\"" + name + "\": \"" + color + "\""); values.push("\"" + name + "\": \"" + color + "\"");
} }
@ -1144,7 +1310,7 @@ function onContactsCategoryAdd(e) {
var list = $('contactsCategoriesListWrapper').down("TABLE").down("TBODY"); var list = $('contactsCategoriesListWrapper').down("TABLE").down("TBODY");
list.appendChild(row); list.appendChild(row);
resetContactsTableActions (); resetContactsTableActions();
nametd.editionController.startEditing(); nametd.editionController.startEditing();
} }
@ -1175,11 +1341,10 @@ function serializeContactsCategories() {
/* / contact categories */ /* / contact categories */
function onAddOutgoingAddressesCheck(checkBox) { function onAddOutgoingAddressesCheck(checkBox) {
if (!checkBox) { if (!checkBox) {
checkBox = $("addOutgoingAddresses"); checkBox = $("addOutgoingAddresses");
} }
$("addressBookList").disabled = !checkBox.checked; $("addressBookList").disabled = !checkBox.checked;
} }
function onReplyPlacementListChange() { function onReplyPlacementListChange() {

View File

@ -374,7 +374,7 @@ TH.tbtv_navcell
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
background-color: #E7E7E7; background-color: #E7E7E7;
height: 20px; } height: 20px;}
TD.sortableTableHeader:active, TD.sortableTableHeader:active,
TH.sortableTableHeader:active TH.sortableTableHeader:active
@ -410,7 +410,8 @@ TH.tbtv_headercell IMG.tbtv_sortcell
text-align: right; text-align: right;
border: 0px; border: 0px;
width: 12px; width: 12px;
height: 12px; } height: 12px;
top:0;}
.tableview .tableview
{ cursor: default; { cursor: default;