Serialization of the whiteList

This commit is contained in:
Alexandre Cloutier
2014-07-07 10:00:16 -04:00
parent 8ded5a8aaf
commit 16d02455bd
3 changed files with 36 additions and 16 deletions

View File

@@ -639,6 +639,26 @@ static NSArray *reminderValues = nil;
return [userDefaults busyOffHours];
}
- (NSString *) whiteListValue
{
SOGoUserSettings *us;
id *whiteListValue;
us = [user userSettings];
whiteListValue = [us objectForKey:@"whiteListInvitations"];
return whiteListValue;
}
- (void) setWhiteListValue: (NSArray *) whiteList
{
SOGoUserSettings *us;
us = [user userSettings];
[us setObject: whiteList forKey: @"whiteListInvitations"];
[us synchronize];
}
- (void) setPreventInvitations: (BOOL) preventInvitations
{
SOGoUserSettings *us;

View File

@@ -19,7 +19,7 @@
<div class="popupMenu" id="contactsMenu">
<ul></ul>
</div>
<div id="colorPickerDialog" style="display: none;" class="dialog right bottom">
<div>
<span class="blc-FFFFFF"><!-- --></span>
@@ -223,7 +223,6 @@
var:checked="preventInvitations" />
<var:string label:value="Prevent from being invited to appointments"/></dd>
</dl>
<label id="whiteListLabel"><var:string label:value="White list for appointments invitations:"/></label>
<div id="appointmentsWhiteListWrapper" class="listWrapper">
<table class="tableview" id="tableViewWhiteList">
@@ -231,7 +230,8 @@
<tr class="tableview">
<th const:class="tbtv_headercell" const:id="whiteListTableHeader">
<var:string label:value="Contacts names"/></th>
</tr></thead>
</tr>
</thead>
<tbody>
<var:foreach list="appointmentsWhiteList" item="contact">
<tr const:class="whiteListRow">
@@ -244,10 +244,12 @@
</div>
<div id="whiteListToolbar">
<a const:id="appointmentsWhiteListAdd" href="#">
<img rsrc:src="add-icon.png" label:title="Add" id="WhiteListAdd"/></a>
<img rsrc:src="add-icon.png" label:title="Add" id="WhiteListAdd"/></a>
<a const:id="appointmentsWhiteListDelete" href="#">
<img rsrc:src="remove-icon.png" label:title="Delete" id="WhiteListDelete" /></a>
<img rsrc:src="remove-icon.png" label:title="Delete" id="WhiteListDelete" /></a>
</div>
<input type="hidden" const:id="whiteListValue"
const:name="whiteListValue" var:value="whiteListValue"/>
<label id="calendarCategoriesLabel"><var:string label:value="Categories"/></label>
<div id="calendarCategoriesListWrapper" class="listWrapper">

View File

@@ -9,8 +9,8 @@ function savePreferences(sender) {
if (sigList)
sigList.disabled = false;
// if ($("appointmentsWhiteListWrapper"))
// serializeAppointmentsWhiteList();
if ($("appointmentsWhiteListWrapper"))
serializeAppointmentsWhiteList();
if ($("calendarCategoriesListWrapper"))
serializeCalendarCategories();
@@ -236,10 +236,9 @@ function initPreferences() {
table.multiselect = true;
$("appointmentsWhiteListAdd").observe("click", onAppointmentsWhiteListAdd);
$("appointmentsWhiteListDelete").observe("click", onAppointmentsWhiteListDelete);
whiteList.observe("scroll", onBodyClickHandler);
}
// Calendar categories
// Calender categories
var wrapper = $("calendarCategoriesListWrapper");
if (wrapper) {
var table = wrapper.childNodesWithTag("table")[0];
@@ -1095,13 +1094,12 @@ function serializeAppointmentsWhiteList() {
var values = [];
for (var i = 0; i < r.length; i++) {
var tds = r[i].childElements();
var name = $(tds.first()).innerHTML;
var email = "";
values.push("\"" + name + "\": \"" + color + "\"");
var tds = r[i].childElements().first().down("INPUT");
var uid = tds.getAttribute("uid");
values.push(uid);
}
//$("calendarCategoriesValue").value = "{ " + values.join(",\n") + "}";
$("whiteListValue").value = values;
}
function onCalendarCategoryAdd(e) {
@@ -1143,7 +1141,7 @@ function serializeCalendarCategories() {
var values = [];
for (var i = 0; i < r.length; i++) {
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');
values.push("\"" + name + "\": \"" + color + "\"");
}
@@ -1271,7 +1269,7 @@ function onContactsCategoryAdd(e) {
var list = $('contactsCategoriesListWrapper').down("TABLE").down("TBODY");
list.appendChild(row);
resetContactsTableActions ();
resetContactsTableActions();
nametd.editionController.startEditing();
}