mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-29 15:15:37 +00:00
Revert merge from inverse
https://github.com/Zentyal/sogo/pull/150 Because the login on web with the use of outlook is broken after including the DomainLessLogin feature
This commit is contained in:
@@ -31,7 +31,7 @@ function openContactsFolder(contactsFolder, reload, idx) {
|
||||
|
||||
var selection;
|
||||
if (idx) {
|
||||
selection = [idx.asCSSIdentifier()];
|
||||
selection = [idx];
|
||||
}
|
||||
else if (contactsFolder == Contact.currentAddressBook) {
|
||||
var contactsList = $("contactsList");
|
||||
@@ -74,7 +74,7 @@ function contactsListCallback(http) {
|
||||
var contact = data[i];
|
||||
var row = rows[i];
|
||||
row.className = contact["c_component"];
|
||||
row.setAttribute("id", contact["c_name"].asCSSIdentifier());
|
||||
row.setAttribute("id", contact["c_name"]);
|
||||
row.setAttribute("categories", contact["c_categories"]);
|
||||
row.setAttribute("contactname", contact["c_cn"]);
|
||||
var cells = row.getElementsByTagName("TD");
|
||||
@@ -111,7 +111,7 @@ function contactsListCallback(http) {
|
||||
for (var j = i; j < data.length; j++) {
|
||||
var contact = data[j];
|
||||
var row = createElement("tr",
|
||||
contact["c_name"].asCSSIdentifier(),
|
||||
contact["c_name"],
|
||||
contact["c_component"],
|
||||
null,
|
||||
{ categories: contact["c_categories"],
|
||||
@@ -272,7 +272,7 @@ function _onContactMenuAction(folderItem, action, refresh) {
|
||||
if (Object.isArray(document.menuTarget) && selectedFolders.length > 0) {
|
||||
var selectedFolderId = $(selectedFolders[0]).readAttribute("id");
|
||||
var contactIds = $(document.menuTarget).collect(function(row) {
|
||||
return row.getAttribute("id").fromCSSIdentifier();
|
||||
return row.getAttribute("id");
|
||||
});
|
||||
|
||||
for (var i = 0; i < contactIds.length; i++) {
|
||||
@@ -283,7 +283,9 @@ function _onContactMenuAction(folderItem, action, refresh) {
|
||||
}
|
||||
|
||||
var url = ApplicationBaseURL + "/" + selectedFolderId + "/" + action;
|
||||
var uids = contactIds.collect(encodeURIComponent).join('&uid=');
|
||||
var uids = contactIds.collect(function (s) {
|
||||
return encodeURIComponent(s.unescapeHTML());
|
||||
}).join('&uid=');
|
||||
if (refresh)
|
||||
triggerAjaxRequest(url, actionContactCallback, selectedFolderId,
|
||||
('folder='+ folderId + '&uid=' + uids),
|
||||
@@ -310,22 +312,22 @@ function onMenuExportContact (event) {
|
||||
if (canExport) {
|
||||
var selectedFolderId = $(selectedFolders[0]).readAttribute("id");
|
||||
var contactIds = document.menuTarget.collect(function(row) {
|
||||
return row.readAttribute("id").fromCSSIdentifier();
|
||||
return row.readAttribute("id");
|
||||
});
|
||||
var url = ApplicationBaseURL + "/" + selectedFolderId + "/export"
|
||||
+ "?uid=" + contactIds.collect(encodeURIComponent).join("&uid=");
|
||||
+ "?uid=" + contactIds.join("&uid=");
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
function onMenuRawContact (event) {
|
||||
var cname = document.menuTarget.collect(function(row) {
|
||||
return row.readAttribute("id").fromCSSIdentifier();
|
||||
return row.readAttribute("id");
|
||||
});
|
||||
|
||||
$(function() {
|
||||
openGenericWindow(URLForFolderID(Contact.currentAddressBook)
|
||||
+ "/" + encodeURIComponent(cname) + "/raw");
|
||||
+ "/" + cname + "/raw");
|
||||
}).delay(0.1);
|
||||
}
|
||||
|
||||
@@ -348,22 +350,22 @@ function actionContactCallback(http) {
|
||||
}
|
||||
}
|
||||
|
||||
function loadContact(cname) {
|
||||
function loadContact(idx) {
|
||||
if (document.contactAjaxRequest) {
|
||||
document.contactAjaxRequest.aborted = true;
|
||||
document.contactAjaxRequest.abort();
|
||||
}
|
||||
|
||||
if (cachedContacts[Contact.currentAddressBook + "/" + cname]) {
|
||||
if (cachedContacts[Contact.currentAddressBook + "/" + idx]) {
|
||||
var div = $('contactView');
|
||||
Contact.currentContactId = cname;
|
||||
div.innerHTML = cachedContacts[Contact.currentAddressBook + "/" + cname];
|
||||
Contact.currentContactId = idx;
|
||||
div.innerHTML = cachedContacts[Contact.currentAddressBook + "/" + idx];
|
||||
}
|
||||
else {
|
||||
var url = (URLForFolderID(Contact.currentAddressBook)
|
||||
+ "/" + encodeURIComponent(cname) + "/view?noframe=1");
|
||||
+ "/" + encodeURIComponent(idx.unescapeHTML()) + "/view?noframe=1");
|
||||
document.contactAjaxRequest
|
||||
= triggerAjaxRequest(url, contactLoadCallback, cname);
|
||||
= triggerAjaxRequest(url, contactLoadCallback, idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,9 +418,8 @@ function moveTo(uri) {
|
||||
/* contact menu entries */
|
||||
function onContactRowDblClick(event) {
|
||||
var t = getTarget(event);
|
||||
var cname = t.parentNode.getAttribute('id').fromCSSIdentifier();
|
||||
var cname = t.parentNode.getAttribute('id');
|
||||
|
||||
cname = encodeURIComponent(cname);
|
||||
openContactWindow(URLForFolderID(Contact.currentAddressBook)
|
||||
+ "/" + cname + "/edit", cname);
|
||||
|
||||
@@ -437,7 +438,7 @@ function onContactSelectionChange(event) {
|
||||
|
||||
if (rows.length == 1) {
|
||||
var node = $(rows[0]);
|
||||
loadContact(node.getAttribute('id').fromCSSIdentifier());
|
||||
loadContact(node.getAttribute('id'));
|
||||
}
|
||||
else if (rows.length > 1) {
|
||||
$('contactView').update();
|
||||
@@ -478,9 +479,8 @@ function onToolbarEditSelectedContacts(event) {
|
||||
}
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var id = encodeURIComponent(rows[i].fromCSSIdentifier());
|
||||
openContactWindow(URLForFolderID(Contact.currentAddressBook)
|
||||
+ "/" + id + "/edit", rows[i]);
|
||||
+ "/" + rows[i] + "/edit", rows[i]);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -488,17 +488,16 @@ function onToolbarEditSelectedContacts(event) {
|
||||
|
||||
function onToolbarWriteToSelectedContacts(event) {
|
||||
var contactsList = $('contactsList');
|
||||
var rowIds = contactsList.getSelectedRowsId();
|
||||
var rows = contactsList.getSelectedRowsId();
|
||||
var rowsWithEmail = 0;
|
||||
|
||||
if (rowIds.length == 0) {
|
||||
if (rows.length == 0) {
|
||||
showAlertDialog(_("Please select a contact."));
|
||||
}
|
||||
else {
|
||||
openMailComposeWindow(ApplicationBaseURL + "/../Mail/compose"
|
||||
+ "?folder=" + Contact.currentAddressBook.substring(1)
|
||||
+ "&uid=" + rowIds.collect(function(id) {
|
||||
return encodeURIComponent(id.fromCSSIdentifier());
|
||||
}).join("&uid="));
|
||||
+ "&uid=" + rows.join("&uid="));
|
||||
if (document.body.hasClassName("popup"))
|
||||
window.close();
|
||||
}
|
||||
@@ -525,28 +524,26 @@ function onToolbarDeleteSelectedContactsConfirm(dialogId) {
|
||||
var contactsList = $('contactsList');
|
||||
var rowIds = contactsList.getSelectedRowsId();
|
||||
var urlstr = (URLForFolderID(Contact.currentAddressBook) + "/batchDelete");
|
||||
|
||||
for (var i = 0; i < rowIds.length; i++)
|
||||
$(rowIds[i]).hide();
|
||||
triggerAjaxRequest(urlstr, onContactDeleteEventCallback, rowIds,
|
||||
('ids=' + rowIds.collect(function(id) {
|
||||
return encodeURIComponent(id.fromCSSIdentifier());
|
||||
('ids=' + rowIds.collect(function (s) {
|
||||
return encodeURIComponent(s.unescapeHTML());
|
||||
}).join(",")),
|
||||
{ "Content-type": "application/x-www-form-urlencoded" });
|
||||
}
|
||||
|
||||
function onContactDeleteEventCallback(http) {
|
||||
var rowIds = http.callbackData;
|
||||
if (http.readyState == 4) {
|
||||
if (isHttpStatus204(http.status)) {
|
||||
var rowIds = http.callbackData;
|
||||
var row;
|
||||
var nextRow = null;
|
||||
for (var i = 0; i < rowIds.length; i++) {
|
||||
var id = rowIds[i].fromCSSIdentifier();
|
||||
delete cachedContacts[Contact.currentAddressBook + "/" + id];
|
||||
delete cachedContacts[Contact.currentAddressBook + "/" + rowIds[i]];
|
||||
row = $(rowIds[i]);
|
||||
var displayName = row.readAttribute("contactname");
|
||||
if (Contact.currentContactId == id) {
|
||||
if (Contact.currentContactId == row) {
|
||||
Contact.currentContactId = null;
|
||||
}
|
||||
var nextRow = row.next("tr");
|
||||
@@ -558,7 +555,7 @@ function onContactDeleteEventCallback(http) {
|
||||
}
|
||||
}
|
||||
if (nextRow) {
|
||||
Contact.currentContactId = nextRow.getAttribute("id").fromCSSIdentifier();
|
||||
Contact.currentContactId = nextRow.getAttribute("id");
|
||||
nextRow.selectElement();
|
||||
loadContact(Contact.currentContactId);
|
||||
}
|
||||
@@ -673,7 +670,7 @@ function onConfirmContactSelection(event) {
|
||||
var contactsList = $("contactsList");
|
||||
var rows = contactsList.getSelectedRows();
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
var cid = rows[i].getAttribute("id").fromCSSIdentifier();
|
||||
var cid = rows[i].getAttribute("id");
|
||||
if (cid.endsWith(".vlf")) {
|
||||
addListToOpener(tag, Contact.currentAddressBook, currentAddressBookName, cid);
|
||||
}
|
||||
@@ -1298,7 +1295,7 @@ function onDocumentKeydown(event) {
|
||||
else if (keyCode == Event.KEY_DOWN ||
|
||||
keyCode == Event.KEY_UP) {
|
||||
if (Contact.currentContactId) {
|
||||
var row = $(Contact.currentContactId.asCSSIdentifier());
|
||||
var row = $(Contact.currentContactId);
|
||||
var nextRow;
|
||||
if (keyCode == Event.KEY_DOWN)
|
||||
nextRow = row.next("tr");
|
||||
@@ -1322,7 +1319,7 @@ function onDocumentKeydown(event) {
|
||||
|
||||
// Select and load the next message
|
||||
nextRow.selectElement();
|
||||
loadContact(nextRow.readAttribute("id").fromCSSIdentifier());
|
||||
loadContact(nextRow.readAttribute("id"));
|
||||
}
|
||||
Event.stop(event);
|
||||
}
|
||||
@@ -1468,12 +1465,11 @@ function onCategoriesMenuItemClick() {
|
||||
var rowIds = contactsList.getSelectedRowsId();
|
||||
if (rowIds.length > 0) {
|
||||
for (var i = 0; i < rowIds.length; i++) {
|
||||
var id = rowIds[i].fromCSSIdentifier();
|
||||
var url = (URLForFolderID(Contact.currentAddressBook)
|
||||
+ "/" + encodeURIComponent(id) + "/" + method);
|
||||
+ "/" + rowIds[i] + "/" + method);
|
||||
url += "?category=" + encodeURIComponent(this.category);
|
||||
triggerAjaxRequest(url, onCategoriesMenuItemCallback,
|
||||
{ 'addressBook' : Contact.currentAddressBook, 'id' : id });
|
||||
{ 'addressBook' : Contact.currentAddressBook, 'id' : rowIds[i] });
|
||||
if (set) {
|
||||
setCategoryOnNode($(rowIds[i]), this.category);
|
||||
}
|
||||
@@ -1501,7 +1497,7 @@ function onCategoriesMenuItemCallback(http) {
|
||||
|
||||
function setCategoryOnNode(contactNode, category) {
|
||||
var catList = contactNode.getAttribute("categories");
|
||||
var catsArray = catList? catList.split(",") : [];
|
||||
var catsArray = catList.split(",");
|
||||
if (catsArray.indexOf(category) == -1) {
|
||||
catsArray.push(category);
|
||||
contactNode.setAttribute("categories", catsArray.join(","));
|
||||
@@ -1611,9 +1607,9 @@ function dropSelectedContacts(action, toId) {
|
||||
if ((!currentFolderIsRemote() || action != "move")
|
||||
&& fromId.substring(1) != toId) {
|
||||
|
||||
var url = ApplicationBaseURL + fromId + "/" + action;
|
||||
var uids = contactIds.collect(function(id) {
|
||||
return encodeURIComponent(id.fromCSSIdentifier());
|
||||
var url = ApplicationBaseURL + "/" + fromId + "/" + action;
|
||||
var uids = contactIds.collect(function (s) {
|
||||
return encodeURIComponent(s.unescapeHTML());
|
||||
}).join('&uid=');
|
||||
triggerAjaxRequest(url, actionContactCallback, fromId,
|
||||
('folder='+ toId + '&uid=' + uids),
|
||||
|
||||
@@ -73,10 +73,6 @@ String.prototype.decodeEntities = function() {
|
||||
});
|
||||
};
|
||||
|
||||
String.prototype.unescapeHTMLEntities = function() {
|
||||
return this.unescapeHTML().replace(/"/g,'"');
|
||||
};
|
||||
|
||||
String.prototype.asDate = function () {
|
||||
var newDate;
|
||||
var date = this.split("/");
|
||||
@@ -98,39 +94,20 @@ String.prototype.asDate = function () {
|
||||
return newDate;
|
||||
};
|
||||
|
||||
RegExp.escape = function(text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
var css_invalid_characters = [ '_' , '.', '#' , '@' , '*', ':' , ';' , ',' , ' ',
|
||||
'(', ')', '[', ']', '{', '}',
|
||||
"'", '"', '&', '+' ];
|
||||
var css_escape_characters = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_SC_', '_CO_', '_SP_',
|
||||
'_LP_', '_RP_', '_LS_', '_RQ_', '_LC_', '_RC_',
|
||||
'_SQ_', '_DQ_', '_AM_', '_P_' ];
|
||||
|
||||
String.prototype.asCSSIdentifier = function() {
|
||||
var characters = [ '_' , '\\.', '#' , '@' , '\\*', ':' , ',' , ' '
|
||||
, "'", '&', '\\+' ];
|
||||
var escapeds = [ '_U_', '_D_', '_H_', '_A_', '_S_', '_C_', '_CO_',
|
||||
'_SP_', '_SQ_', '_AM_', '_P_' ];
|
||||
|
||||
var newString = this;
|
||||
for (var i = 0; i < css_invalid_characters.length; i++) {
|
||||
var re = new RegExp(RegExp.escape(css_invalid_characters[i]), 'g');
|
||||
newString = newString.replace(re, css_escape_characters[i]);
|
||||
for (var i = 0; i < characters.length; i++) {
|
||||
var re = new RegExp(characters[i], 'g');
|
||||
newString = newString.replace(re, escapeds[i]);
|
||||
}
|
||||
|
||||
if (/^\d/.test(newString))
|
||||
if (/^\d+/.test(newString)) {
|
||||
newString = '_' + newString;
|
||||
|
||||
return newString;
|
||||
};
|
||||
|
||||
String.prototype.fromCSSIdentifier = function() {
|
||||
var newString = this;
|
||||
|
||||
if (/^_\d/.test(newString))
|
||||
newString = newString.substring(1);
|
||||
|
||||
for (var i = 0; i < css_escape_characters.length; i++) {
|
||||
var re = new RegExp(css_escape_characters[i], 'g');
|
||||
newString = newString.replace(re, css_invalid_characters[i]);
|
||||
}
|
||||
|
||||
return newString;
|
||||
|
||||
@@ -1015,32 +1015,6 @@ function eventsListCallback(http) {
|
||||
|
||||
if (http.responseText.length > 0) {
|
||||
var data = http.responseText.evalJSON(true);
|
||||
|
||||
// [0] Event ID
|
||||
// [1] Calendar ID
|
||||
// [2] Calendar name
|
||||
// [3] Status
|
||||
// [4] Title
|
||||
// [5] Start date
|
||||
// [6] End date
|
||||
// [7] Location
|
||||
// [8] Is all day?
|
||||
// [9] Classification (0 = public, 1, = private, 2 = confidential)
|
||||
// [10] Category
|
||||
// [11] Participants email addresses
|
||||
// [12] Participants states
|
||||
// [13] Owner
|
||||
// [14] Is cyclic?
|
||||
// [15] Next alarm
|
||||
// [16] recurrence-id
|
||||
// [17] isException
|
||||
// [18] Editable?
|
||||
// [19] Erasable?
|
||||
// [20] Owner is organizer?
|
||||
// [21] Description
|
||||
// [22] Formatted start date
|
||||
// [23] Formatted end date
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var row = createElement("tr");
|
||||
table.tBodies[0].appendChild(row);
|
||||
@@ -1082,12 +1056,12 @@ function eventsListCallback(http) {
|
||||
td = createElement("td");
|
||||
row.appendChild(td);
|
||||
td.observe("mousedown", listRowMouseDownHandler, true);
|
||||
td.update(data[i][22]); // start date
|
||||
td.update(data[i][21]); // start date
|
||||
|
||||
td = createElement("td");
|
||||
row.appendChild(td);
|
||||
td.observe("mousedown", listRowMouseDownHandler, true);
|
||||
td.update(data[i][23]); // end date
|
||||
td.update(data[i][22]); // end date
|
||||
|
||||
td = createElement("td");
|
||||
row.appendChild(td);
|
||||
@@ -1191,9 +1165,8 @@ function tasksListCallback(http) {
|
||||
// [12] Owner
|
||||
// [13] recurrence-id
|
||||
// [14] isException
|
||||
// [15] Description
|
||||
// [16] Status CSS class (duelater, completed, etc)
|
||||
// [17] Due date (formatted)
|
||||
// [15] Status CSS class (duelater, completed, etc)
|
||||
// [16] Due date (formatted)
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var row = createElement("tr");
|
||||
@@ -1209,12 +1182,16 @@ function tasksListCallback(http) {
|
||||
if (rTime)
|
||||
id += "-" + escape(rTime);
|
||||
row.setAttribute("id", id);
|
||||
//row.cname = escape(data[i][0]);
|
||||
//row.calendar = calendar;
|
||||
if (rTime)
|
||||
row.recurrenceTime = escape(rTime);
|
||||
row.isException = data[i][14];
|
||||
|
||||
|
||||
//row.setAttribute("id", calendar + "-" + cname);
|
||||
//listItem.addClassName(data[i][5]); // Classification
|
||||
row.addClassName(data[i][16]); // status
|
||||
//row.addClassName(data[i][14]); // status
|
||||
row.addClassName("taskRow");
|
||||
row.calendar = calendar;
|
||||
row.cname = cname;
|
||||
@@ -1259,8 +1236,8 @@ function tasksListCallback(http) {
|
||||
|
||||
cell = createElement("td");
|
||||
row.appendChild(cell);
|
||||
if (data[i][17])
|
||||
cell.update(data[i][17]); // end date
|
||||
if (data[i][16])
|
||||
cell.update(data[i][16]); // end date
|
||||
|
||||
cell = createElement("td");
|
||||
row.appendChild(cell);
|
||||
|
||||
Reference in New Issue
Block a user