mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-10 07:48:52 +00:00
Indentation in JavaScript files
This commit is contained in:
@@ -4,28 +4,28 @@ var dialogs = {};
|
||||
|
||||
function savePreferences(sender) {
|
||||
var sendForm = true;
|
||||
|
||||
|
||||
var sigList = $("signaturePlacementList");
|
||||
if (sigList)
|
||||
sigList.disabled = false;
|
||||
|
||||
|
||||
if ($("appointmentsWhiteListWrapper"))
|
||||
serializeAppointmentsWhiteList();
|
||||
|
||||
|
||||
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)) {
|
||||
@@ -33,30 +33,30 @@ function savePreferences(sender) {
|
||||
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) {
|
||||
showAlertDialog (_("Day start time must be prior to day end time."));
|
||||
sendForm = 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.')) {
|
||||
showAlertDialog(_("Your vacation message must not end with a single dot on a line."));
|
||||
sendForm = false;
|
||||
}
|
||||
|
||||
|
||||
if ($("enableVacationEndDate") && $("enableVacationEndDate").checked) {
|
||||
var e = $("vacationEndDate_date");
|
||||
var endDate = e.inputAsDate();
|
||||
@@ -67,7 +67,7 @@ function savePreferences(sender) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($("enableForward") && $("enableForward").checked) {
|
||||
var addresses = $("forwardAddress").value.split(",");
|
||||
for (var i = 0; i < addresses.length && sendForm; i++)
|
||||
@@ -76,15 +76,15 @@ function savePreferences(sender) {
|
||||
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);
|
||||
@@ -105,12 +105,12 @@ function savePreferences(sender) {
|
||||
}
|
||||
}
|
||||
},
|
||||
null,
|
||||
Form.serialize($("mainForm")), // excludes the file input
|
||||
{ "Content-type": "application/x-www-form-urlencoded"}
|
||||
);
|
||||
}
|
||||
return false;
|
||||
null,
|
||||
Form.serialize($("mainForm")), // excludes the file input
|
||||
{ "Content-type": "application/x-www-form-urlencoded"}
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function prototypeIfyFilters() {
|
||||
@@ -121,14 +121,14 @@ function prototypeIfyFilters() {
|
||||
newFilter.name = filter.name;
|
||||
newFilter.match = filter.match;
|
||||
newFilter.active = filter.active;
|
||||
|
||||
|
||||
if (filter.rules) {
|
||||
newFilter.rules = $([]);
|
||||
for (var j = 0; j < filter.rules.length; j++) {
|
||||
newFilter.rules.push($(filter.rules[j]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (filter.actions) {
|
||||
newFilter.actions = $([]);
|
||||
for (var j = 0; j < filter.actions.length; j++) {
|
||||
@@ -137,7 +137,7 @@ function prototypeIfyFilters() {
|
||||
}
|
||||
newFilters.push(newFilter);
|
||||
}
|
||||
|
||||
|
||||
return newFilters;
|
||||
}
|
||||
|
||||
@@ -207,32 +207,32 @@ function initPreferences() {
|
||||
var tabsContainer = $("preferencesTabs");
|
||||
var controller = new SOGoTabsController();
|
||||
controller.attachToTabsContainer(tabsContainer);
|
||||
|
||||
|
||||
// Inner tabs on the mail module tab
|
||||
tabsContainer = $('mailOptionsTabs');
|
||||
if (tabsContainer) {
|
||||
var mailController = new SOGoTabsController();
|
||||
mailController.attachToTabsContainer(tabsContainer);
|
||||
}
|
||||
|
||||
|
||||
// Inner tabs on the calendar module tab
|
||||
tabsContainer = $('calendarOptionsTabs');
|
||||
if (tabsContainer) {
|
||||
var mailController = new SOGoTabsController();
|
||||
mailController.attachToTabsContainer(tabsContainer);
|
||||
}
|
||||
|
||||
|
||||
_setupEvents();
|
||||
|
||||
|
||||
// Optional function called when initializing the preferences
|
||||
// Typically defined inline in the UIxAdditionalPreferences.wox template
|
||||
if (typeof (initAdditionalPreferences) != "undefined")
|
||||
initAdditionalPreferences();
|
||||
|
||||
|
||||
// Color picker
|
||||
$('colorPickerDialog').on('click', 'span', onColorPickerChoice);
|
||||
$(document.body).on("click", onBodyClickHandler);
|
||||
|
||||
|
||||
// Calendar whiteList
|
||||
var whiteList = $("appointmentsWhiteListWrapper");
|
||||
if(whiteList) {
|
||||
@@ -241,13 +241,13 @@ function initPreferences() {
|
||||
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");
|
||||
@@ -261,22 +261,22 @@ function initPreferences() {
|
||||
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
|
||||
var wrapper = $("calendarCategoriesListWrapper");
|
||||
if (wrapper) {
|
||||
@@ -291,7 +291,7 @@ function initPreferences() {
|
||||
$("calendarCategoryDelete").observe("click", onCalendarCategoryDelete);
|
||||
wrapper.observe("scroll", onBodyClickHandler);
|
||||
}
|
||||
|
||||
|
||||
// Mail labels/tags
|
||||
var wrapper = $("mailLabelsListWrapper");
|
||||
if (wrapper) {
|
||||
@@ -305,7 +305,7 @@ function initPreferences() {
|
||||
$("mailLabelAdd").observe("click", onMailLabelAdd);
|
||||
$("mailLabelDelete").observe("click", onMailLabelDelete);
|
||||
}
|
||||
|
||||
|
||||
// Contact categories
|
||||
wrapper = $("contactsCategoriesListWrapper");
|
||||
if (wrapper) {
|
||||
@@ -318,31 +318,31 @@ function initPreferences() {
|
||||
$("contactsCategoryAdd").observe("click", onContactsCategoryAdd);
|
||||
$("contactsCategoryDelete").observe("click", onContactsCategoryDelete);
|
||||
}
|
||||
|
||||
|
||||
if ($("replyPlacementList"))
|
||||
onReplyPlacementListChange();
|
||||
|
||||
|
||||
var button = $("addDefaultEmailAddresses");
|
||||
if (button)
|
||||
button.observe("click", addDefaultEmailAddresses);
|
||||
|
||||
|
||||
button = $("changePasswordBtn");
|
||||
if (button)
|
||||
button.observe("click", onChangePasswordClick);
|
||||
|
||||
|
||||
initSieveFilters();
|
||||
|
||||
|
||||
initMailAccounts();
|
||||
|
||||
|
||||
button = $("enableVacationEndDate");
|
||||
if (button) {
|
||||
jQuery("#vacationEndDate_date").closest(".date").datepicker({ autoclose: true, position: 'above', weekStart: $('weekStartDay').getValue() });
|
||||
button.on("click", function(event) {
|
||||
if (this.checked)
|
||||
$("vacationEndDate_date").enable();
|
||||
else
|
||||
$("vacationEndDate_date").disable();
|
||||
});
|
||||
if (this.checked)
|
||||
$("vacationEndDate_date").enable();
|
||||
else
|
||||
$("vacationEndDate_date").disable();
|
||||
});
|
||||
}
|
||||
onAddOutgoingAddressesCheck();
|
||||
}
|
||||
@@ -937,10 +937,10 @@ function saveMailAccounts() {
|
||||
|
||||
// Could be null if ModuleConstraints disables email access
|
||||
if (editor)
|
||||
//Instead of removing the modules, we disable it. This will prevent the window to crash if we have a connection error.
|
||||
editor.select('input, select').each(function(i) { i.disable(); })
|
||||
//Instead of removing the modules, we disable it. This will prevent the window to crash if we have a connection error.
|
||||
editor.select('input, select').each(function(i) { i.disable(); })
|
||||
|
||||
compactMailAccounts();
|
||||
compactMailAccounts();
|
||||
var mailAccountsJSON = $("mailAccountsJSON");
|
||||
|
||||
if (mailAccountsJSON)
|
||||
@@ -1033,15 +1033,15 @@ function onCalendarColorEdit(e) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1064,15 +1064,15 @@ function onNameEdit (e) {
|
||||
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 (/</, "<");
|
||||
tmp = tmp.replace (/>/, ">");
|
||||
@@ -1082,10 +1082,10 @@ function endEditable(event, textField) {
|
||||
textSpan.update(tmp);
|
||||
else
|
||||
cell.up("TR").remove();
|
||||
|
||||
|
||||
if (event)
|
||||
Event.stop(event);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1095,7 +1095,7 @@ function onAppointmentsWhiteListAdd(e) {
|
||||
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");
|
||||
@@ -1105,23 +1105,23 @@ function onAppointmentsWhiteListAdd(e) {
|
||||
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();
|
||||
@@ -1130,7 +1130,7 @@ function onAppointmentsWhiteListDelete(e) {
|
||||
|
||||
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");
|
||||
@@ -1272,7 +1272,7 @@ function serializeMailLabels() {
|
||||
var name = r[i].readAttribute("data-name");
|
||||
var label = $(tds.first()).innerHTML;
|
||||
var color = $(tds.last().childElements().first()).readAttribute('data-color');
|
||||
|
||||
|
||||
/* if name is null, that's because we've just added a new tag */
|
||||
if (!name) {
|
||||
name = label.replace(/[ \(\)\/\{%\*<>\\\"]/g, "_");
|
||||
@@ -1339,14 +1339,14 @@ function serializeContactsCategories() {
|
||||
}
|
||||
|
||||
/* / contact categories */
|
||||
|
||||
|
||||
function onAddOutgoingAddressesCheck(checkBox) {
|
||||
if (!checkBox) {
|
||||
checkBox = $("addOutgoingAddresses");
|
||||
}
|
||||
$("addressBookList").disabled = !checkBox.checked;
|
||||
}
|
||||
|
||||
|
||||
function onReplyPlacementListChange() {
|
||||
if ($("replyPlacementList").value == 0) {
|
||||
// Reply placement is above quote, signature can be place before of after quote
|
||||
|
||||
Reference in New Issue
Block a user