Fixed IMAP searches with non-ASCII folder names
parent
3872341a85
commit
1f167d9e82
1
NEWS
1
NEWS
|
@ -22,6 +22,7 @@ Bug fixes
|
||||||
- fixed corrupted png files (#2975)
|
- fixed corrupted png files (#2975)
|
||||||
- improved dramatically the BSON decoding speed
|
- improved dramatically the BSON decoding speed
|
||||||
- added WindowSize support for GCS collections when using EAS
|
- added WindowSize support for GCS collections when using EAS
|
||||||
|
- fixed IMAP search with non-ASCII folder names
|
||||||
|
|
||||||
2.2.9a (2014-09-29)
|
2.2.9a (2014-09-29)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
|
@ -40,26 +40,38 @@
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[item release];
|
[item release];
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setItem: (NSString *) newItem
|
- (void) setItem: (id) newItem
|
||||||
{
|
{
|
||||||
ASSIGN(item, newItem);
|
ASSIGN(item, newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) item
|
- (id) item
|
||||||
{
|
{
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) currentFolderDisplayName
|
||||||
|
{
|
||||||
|
return [[item allValues] lastObject];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *) currentFolderPath
|
||||||
|
{
|
||||||
|
return [[item allKeys] lastObject];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *) mailAccountsList
|
- (NSArray *) mailAccountsList
|
||||||
{
|
{
|
||||||
SOGoMailAccount *mAccount;
|
NSDictionary *accountName, *mailbox;
|
||||||
|
NSString *userName, *aString;
|
||||||
SOGoMailAccounts *mAccounts;
|
SOGoMailAccounts *mAccounts;
|
||||||
NSString *userName, *option, *aString;
|
SOGoMailAccount *mAccount;
|
||||||
NSArray *accountFolders;
|
NSArray *accountFolders;
|
||||||
NSMutableArray *mailboxes;
|
NSMutableArray *mailboxes;
|
||||||
NSDictionary *accountName;
|
|
||||||
int nbMailboxes, nbMailAccounts, i, j;
|
int nbMailboxes, nbMailAccounts, i, j;
|
||||||
|
|
||||||
// Number of accounts linked with the current user
|
// Number of accounts linked with the current user
|
||||||
|
@ -78,14 +90,17 @@
|
||||||
|
|
||||||
// Number of mailboxes inside the current account
|
// Number of mailboxes inside the current account
|
||||||
nbMailboxes = [accountFolders count];
|
nbMailboxes = [accountFolders count];
|
||||||
[mailboxes addObject:accountName];
|
[mailboxes addObject: [NSDictionary dictionaryWithObject: accountName forKey: accountName]];
|
||||||
|
|
||||||
for (j = 0; j < nbMailboxes; j++)
|
for (j = 0; j < nbMailboxes; j++)
|
||||||
{
|
{
|
||||||
option = [NSString stringWithFormat:@"%@%@", userName, [[accountFolders objectAtIndex:j] objectForKey:@"displayName"]];
|
mailbox = [NSDictionary dictionaryWithObject: [NSString stringWithFormat:@"%@%@", userName, [[accountFolders objectAtIndex:j] objectForKey: @"displayName"]]
|
||||||
[mailboxes addObject:option];
|
forKey: [[accountFolders objectAtIndex:j] objectForKey: @"path"]];
|
||||||
|
[mailboxes addObject: mailbox];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mailboxes;
|
return mailboxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -24,7 +24,12 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td id="mailAccountsCell">
|
<td id="mailAccountsCell">
|
||||||
<label><var:string label:value="Search messages in:" /></label>
|
<label><var:string label:value="Search messages in:" /></label>
|
||||||
<var:popup const:id="mailAccountsList" list="mailAccountsList" item="item" />
|
<var:popup const:id="mailAccountsList"
|
||||||
|
list="mailAccountsList"
|
||||||
|
item="item"
|
||||||
|
string="currentFolderDisplayName"
|
||||||
|
value="currentFolderPath"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td id="headerButtons">
|
<td id="headerButtons">
|
||||||
<a class="button" name="search" id="searchButton" onclick="onSearchClick()">
|
<a class="button" name="search" id="searchButton" onclick="onSearchClick()">
|
||||||
|
|
|
@ -30,7 +30,7 @@ function onSearchClick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < filterRows.length; i++){
|
for (i = 0; i < filterRows.length; i++) {
|
||||||
// Get the information from every filter row before triggering the AJAX call
|
// Get the information from every filter row before triggering the AJAX call
|
||||||
var filter = {};
|
var filter = {};
|
||||||
var searchByOptions = filterRows[i].down(".searchByList").options;
|
var searchByOptions = filterRows[i].down(".searchByList").options;
|
||||||
|
@ -72,47 +72,47 @@ function searchMails() {
|
||||||
var optionsList = $("mailAccountsList").options;
|
var optionsList = $("mailAccountsList").options;
|
||||||
var nbOptions = optionsList.length;
|
var nbOptions = optionsList.length;
|
||||||
var selectedIndex = optionsList.selectedIndex;
|
var selectedIndex = optionsList.selectedIndex;
|
||||||
var accountNumber, accountUser, folderPath, folderName;
|
var accountNumber, folderPath, folderName;
|
||||||
var mailAccountIndex = mailAccounts.indexOf(searchParams.searchLocation);
|
var mailAccountIndex = mailAccounts.indexOf(searchParams.searchLocation);
|
||||||
|
var root = false;
|
||||||
|
|
||||||
if (mailAccountIndex != -1) {
|
if (mailAccountIndex != -1) {
|
||||||
accountNumber = "/" + mailAccountIndex;
|
accountNumber = "/" + mailAccountIndex;
|
||||||
folderName = accountNumber + "/folderINBOX";
|
folderName = "INBOX";
|
||||||
accountUser = userNames[mailAccountIndex];
|
folderPath = accountNumber + "/folderINBOX";
|
||||||
folderPath = accountUser;
|
root = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var searchLocation = searchParams.searchLocation.split("/");
|
var searchLocation = searchParams.searchLocation.split("/");
|
||||||
accountUser = searchLocation[0];
|
accountNumber = "/" + userNames.indexOf(searchLocation[0]);
|
||||||
accountNumber = "/" + userNames.indexOf(accountUser);
|
folderName = optionsList[optionsList.selectedIndex].text.split("/").pop();
|
||||||
|
|
||||||
var position = searchLocation.length;
|
var paths = optionsList[optionsList.selectedIndex].value.split("/");
|
||||||
folderName = accountNumber + "/folder" + searchLocation[1].asCSSIdentifier();
|
folderPath = accountNumber;
|
||||||
for (i = 2; i < position; i++)
|
for (j = 1; j < paths.length; j++) {
|
||||||
folderName += "/folder" + searchLocation[i];
|
folderPath += "/folder" + paths[j];
|
||||||
|
}
|
||||||
folderPath = optionsList[selectedIndex].innerHTML;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var subfolders = [];
|
var subfolders = [];
|
||||||
if (searchParams.subfolder === true) {
|
if (searchParams.subfolder === true) {
|
||||||
for (i = 0; i < nbOptions; i++) {
|
for (i = 1; i < nbOptions; i++) {
|
||||||
if ((optionsList[i].innerHTML.search(folderPath) != -1) && (i != selectedIndex)) {
|
var paths = optionsList[i].value.split("/");
|
||||||
var splitArray = optionsList[i].innerHTML.split("/");
|
var subfolder = accountNumber;
|
||||||
// Remove the user information since it is not required
|
for (j = 1; j < paths.length; j++) {
|
||||||
splitArray.splice(0, 1);
|
subfolder += "/folder" + paths[j];
|
||||||
var subfolder = [];
|
}
|
||||||
var level = splitArray.length;
|
|
||||||
for(j = 0; j < level; j++) {
|
if (root || subfolder.indexOf(folderPath) == 0) {
|
||||||
subfolder += "/folder" + splitArray[j];
|
var keypair = {"folderPath" : subfolder,
|
||||||
}
|
"folderName" : optionsList[i].text.split("/").pop() };
|
||||||
subfolders.push(accountNumber + subfolder);
|
subfolders.push(keypair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var urlstr = (ApplicationBaseURL + folderName + "/uids");
|
var urlstr = (ApplicationBaseURL + folderPath + "/uids");
|
||||||
var callbackData = {"folderName" : folderName, "subfolders" : subfolders, "newSearch" : true};
|
var callbackData = {"folderName" : folderName, "folderPath" : folderPath, "subfolders" : subfolders, "newSearch" : true};
|
||||||
var object = {"filters":searchParams.filters, "sortingAttributes":{"match":searchParams.filterMatching}};
|
var object = {"filters":searchParams.filters, "sortingAttributes":{"match":searchParams.filterMatching}};
|
||||||
var content = Object.toJSON(object);
|
var content = Object.toJSON(object);
|
||||||
document.searchMailsAjaxRequest = triggerAjaxRequest(urlstr, searchMailsCallback, callbackData, content, {"content-type": "application/json"});
|
document.searchMailsAjaxRequest = triggerAjaxRequest(urlstr, searchMailsCallback, callbackData, content, {"content-type": "application/json"});
|
||||||
|
@ -130,8 +130,6 @@ function searchMailsCallback(http) {
|
||||||
for (var x = count; x >= 0; x--){
|
for (var x = count; x >= 0; x--){
|
||||||
$(oldEntries[x]).remove();
|
$(oldEntries[x]).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ["To", "Attachment", "Flagged", "Subject", "From", "Unread", "Priority", "Date", "Size", "rowClasses", "labels", "rowID", "uid"]
|
// ["To", "Attachment", "Flagged", "Subject", "From", "Unread", "Priority", "Date", "Size", "rowClasses", "labels", "rowID", "uid"]
|
||||||
|
@ -143,7 +141,7 @@ function searchMailsCallback(http) {
|
||||||
var row = document.createElement("tr");
|
var row = document.createElement("tr");
|
||||||
Element.addClassName(row, "resultsRow");
|
Element.addClassName(row, "resultsRow");
|
||||||
row.setAttribute("uid", response.headers[i][12]);
|
row.setAttribute("uid", response.headers[i][12]);
|
||||||
row.setAttribute("folderName", http.callbackData.folderName);
|
row.setAttribute("folderPath", http.callbackData.folderPath);
|
||||||
|
|
||||||
var cell1 = document.createElement("td");
|
var cell1 = document.createElement("td");
|
||||||
Element.addClassName(cell1, "td_table_1");
|
Element.addClassName(cell1, "td_table_1");
|
||||||
|
@ -168,10 +166,7 @@ function searchMailsCallback(http) {
|
||||||
var cell5 = document.createElement("td");
|
var cell5 = document.createElement("td");
|
||||||
Element.addClassName(cell5, "td_table_5");
|
Element.addClassName(cell5, "td_table_5");
|
||||||
cell5.setAttribute("colspan", "2");
|
cell5.setAttribute("colspan", "2");
|
||||||
var folderPath = http.callbackData.folderName.split("/");
|
cell5.innerHTML = http.callbackData.folderName;
|
||||||
var folderLocation = folderPath[folderPath.length - 1]; // get the last element of the array (location)
|
|
||||||
folderLocation = folderLocation.substr(6); // strip down the prefix folder
|
|
||||||
cell5.innerHTML = folderLocation;
|
|
||||||
row.appendChild(cell5);
|
row.appendChild(cell5);
|
||||||
|
|
||||||
table.appendChild(row);
|
table.appendChild(row);
|
||||||
|
@ -192,12 +187,13 @@ function searchMailsCallback(http) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (http.callbackData.subfolders.length > 0) {
|
if (http.callbackData.subfolders.length > 0) {
|
||||||
var folderName = http.callbackData.subfolders[0];
|
var folderName = http.callbackData.subfolders[0].folderName;
|
||||||
|
var folderPath = http.callbackData.subfolders[0].folderPath;
|
||||||
var subfolders = http.callbackData.subfolders;
|
var subfolders = http.callbackData.subfolders;
|
||||||
subfolders.splice(0, 1);
|
subfolders.splice(0, 1);
|
||||||
|
|
||||||
var urlstr = (ApplicationBaseURL + folderName + "/uids");
|
var urlstr = (ApplicationBaseURL + folderPath + "/uids");
|
||||||
var callbackData = {"folderName" : folderName, "subfolders" : subfolders, "newSearch" : false};
|
var callbackData = {"folderName" : folderName, "folderPath" : folderPath, "subfolders" : subfolders, "newSearch" : false};
|
||||||
|
|
||||||
// TODO - need to add these following contents ; asc, no-headers, sort
|
// TODO - need to add these following contents ; asc, no-headers, sort
|
||||||
var object = {"filters":searchParams.filters, "sortingAttributes":{"match":searchParams.filterMatching}};
|
var object = {"filters":searchParams.filters, "sortingAttributes":{"match":searchParams.filterMatching}};
|
||||||
|
@ -338,10 +334,10 @@ function onOpenClick(event) {
|
||||||
// This function is linked with the openButton and the doubleClick on a message
|
// This function is linked with the openButton and the doubleClick on a message
|
||||||
var selectedRow = $("searchMailFooter").down("._selected");
|
var selectedRow = $("searchMailFooter").down("._selected");
|
||||||
var msguid = selectedRow.getAttribute("uid");
|
var msguid = selectedRow.getAttribute("uid");
|
||||||
var folderName = selectedRow.getAttribute("folderName");
|
var folderPath = selectedRow.getAttribute("folderPath");
|
||||||
var accountUser = userNames[0];
|
var accountUser = userNames[0];
|
||||||
|
|
||||||
var url = "/SOGo/so/" + accountUser + "/Mail" + folderName + "/" + msguid + "/popupview";
|
var url = "/SOGo/so/" + accountUser + "/Mail" + folderPath + "/" + msguid + "/popupview";
|
||||||
if (selectedRow) {
|
if (selectedRow) {
|
||||||
openMessageWindow(msguid, url);
|
openMessageWindow(msguid, url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue