Various fix and improvements to Mail module

This commit is contained in:
Francis Lachapelle
2014-09-10 10:49:54 -04:00
parent 3ad9327d17
commit 8eb4212f5d
4 changed files with 74 additions and 74 deletions

View File

@@ -248,12 +248,12 @@ function mailListToggleMessageThread(row, cell) {
else
row.hide();
}
// Update the dictionnary of the collapsed threads
var mailbox = Mailer.currentMailbox;
var url = ApplicationBaseURL + encodeURI(mailbox) + "/" + msguid + "/" + action;
var callbackData = { "currentMailbox": Mailer.currentMailbox, "msguid": msguid, "action": action};
triggerAjaxRequest(url, mailListToggleMessageCollapseCallback, callbackData);
}
@@ -468,7 +468,7 @@ function onSearchMail(event) {
}
else {
var urlstr = ApplicationBaseURL + "/search";
// Return the template for the searchMail feature
triggerAjaxRequest(urlstr, displaySearchMailCallback);
}
@@ -481,10 +481,10 @@ function displaySearchMailCallback(http) {
var title = _("Search mail");
var id = _("searchMailView");
fields.innerHTML = http.responseText;
var dialog = createDialog(id, title, null, fields, "searchMail"); // (id, title, legend, content, positionClass)
document.body.appendChild(dialog);
if (Prototype.Browser.IE)
jQuery('#bgDialogDiv').css('opacity', 0.4);
jQuery(dialog).fadeIn('fast');
@@ -862,11 +862,11 @@ function openMailbox(mailbox, reload) {
searchCriteria.push("to", "cc");
else if (search["mail"]["criteria"] == "entire_message")
searchCriteria.push("body");
var filters = [];
for (i = 0; i < searchCriteria.length; i++)
filters.push({"searchBy": searchCriteria[i], "searchArgument": "doesContain", "searchInput": searchValue});
urlParams.filters = filters;
}
var sortAttribute = sorting["attribute"];
@@ -991,16 +991,16 @@ function messageListCallback(row, data, isNew) {
}
}
}
else if (data['ThreadLevel'] > 0) {
if (data['ThreadLevel'] > 10) data['ThreadLevel'] = 10;
row.addClassName('thread');
row.addClassName('thread' + data['ThreadLevel']);
if (displayThreadElement)
row.hide();
}
else
displayThreadElement = false;
@@ -2087,7 +2087,7 @@ function initRefreshViewCheckTimer() {
var refreshViewCheck = UserDefaults["SOGoMailMessageCheck"];
if (refreshViewCheck == null)
refreshViewCheck = UserDefaults["SOGoRefreshViewCheck"];
if (refreshViewCheck && refreshViewCheck != "manually") {
var interval;
if (refreshViewCheck == "once_per_hour")
@@ -2558,7 +2558,7 @@ function onMenuLabelNone() {
if (document.menuTarget.tagName == "DIV")
// Menu called from message content view
msgUIDs.push(Mailer.currentMessages[Mailer.currentMailbox]);
else
// Menu called from one selection in message list view
msgUIDs.push(document.menuTarget.getAttribute("id").substr(4));
@@ -2595,7 +2595,7 @@ function onMenuLabelFlag() {
else
// Menu called from one selection in messages list view
msgLabels = document.menuTarget.getAttribute("labels");
var flags = msgLabels.split(" ");
if (flags.indexOf(flag) > -1)
operation = "remove";
@@ -2609,7 +2609,7 @@ function onMenuLabelFlag() {
if (row) {
msgUIDs.push(rows[i].substr(4));
msgLabels = row.getAttribute("labels");
var flags = msgLabels.split(" ");
if (flags.indexOf(flag) > -1 && !blockedOperation) {
operation = "remove";

View File

@@ -42,7 +42,7 @@ TR.filterRow > TD
vertical-align:middle;
}
TR.filterRow > TD.buttonsCell
TR.filterRow > TD.buttonsCell
{
width:5%;
}
@@ -111,7 +111,7 @@ TD.sortdesc {
}
DIV#optionsButtons
{
{
position:relative;
height:22px;
}
@@ -172,7 +172,7 @@ A#deleteButton, A#openButton
top: -18px;
left: -18px; }
#filterButtons
#filterButtons
{
width:40px;
}
@@ -199,7 +199,7 @@ IMG.addFilterButton, IMG.removeFilterButton
}
/*************** Lists *****************/
.hidden
.hidden
{ display:none; }

View File

@@ -17,11 +17,11 @@ function onSearchClick() {
var filterRows = $$(".filterRow");
var searchButton = $("searchButton").down().innerHTML;
var mailAccountsList = $("mailAccountsList").options;
if (searchButton == _("Search")) {
searchParams.filters = [];
stopOngoingSearch = false;
// Get the mailboxe(s)
for (i = 0; i < mailAccountsList.length ; i++) {
if (mailAccountsList[i].selected) {
@@ -36,7 +36,7 @@ function onSearchClick() {
var searchByOptions = filterRows[i].down(".searchByList").options;
var searchArgumentsOptions = filterRows[i].down(".searchArgumentsList").options;
var searchInput = filterRows[i].down(".searchInput");
// Get the searchBy
for (j = 0; j < searchByOptions.length ; j++) {
if (searchByOptions[j].selected) {
@@ -44,7 +44,7 @@ function onSearchClick() {
break;
}
}
// Get the searchArgument
for (j = 0; j < searchArgumentsOptions.length ; j++) {
if (searchArgumentsOptions[j].selected) {
@@ -60,10 +60,10 @@ function onSearchClick() {
break;
}
}
// Get the input text
filter.searchInput = searchInput.getValue();
// Add the filter inside the searchParams.filters if the input is not empty
if (!filter.searchInput.empty())
searchParams.filters.push(filter);
@@ -89,7 +89,7 @@ function searchMails() {
var selectedIndex = optionsList.selectedIndex;
var accountNumber, accountUser, folderPath, folderName;
var mailAccountIndex = mailAccounts.indexOf(searchParams.searchLocation);
if (mailAccountIndex != -1) {
accountNumber = "/" + mailAccountIndex;
folderName = accountNumber + "/folderINBOX";
@@ -100,12 +100,12 @@ function searchMails() {
var searchLocation = searchParams.searchLocation.split("/");
accountUser = searchLocation[0];
accountNumber = "/" + userNames.indexOf(accountUser);
var position = searchLocation.length;
folderName = accountNumber + "/folder" + searchLocation[1].asCSSIdentifier();
for (i = 2; i < position; i++)
folderName += "/folder" + searchLocation[i];
folderPath = optionsList[selectedIndex].innerHTML;
}
@@ -137,7 +137,7 @@ function searchMailsCallback(http) {
if (http.readyState == 4 && http.status == 200 && !stopOngoingSearch) {
var response = http.responseText.evalJSON();
var table = $("searchMailFooter").down("tbody");
// Erase all previous entries before proceeding with the current request
if (http.callbackData.newSearch) {
var oldEntries = table.rows;
@@ -145,8 +145,8 @@ function searchMailsCallback(http) {
for (var x = count; x >= 0; x--){
$(oldEntries[x]).remove();
}
}
// ["To", "Attachment", "Flagged", "Subject", "From", "Unread", "Priority", "Date", "Size", "rowClasses", "labels", "rowID", "uid"]
@@ -159,27 +159,27 @@ function searchMailsCallback(http) {
Element.addClassName(row, "resultsRow");
row.setAttribute("uid", response.headers[i][12]);
row.setAttribute("folderName", http.callbackData.folderName);
var cell1 = document.createElement("td");
Element.addClassName(cell1, "td_table_1");
cell1.innerHTML = response.headers[i][3];
row.appendChild(cell1);
var cell2 = document.createElement("td");
Element.addClassName(cell2, "td_table_2");
cell2.innerHTML = response.headers[i][4];
row.appendChild(cell2);
var cell3 = document.createElement("td");
Element.addClassName(cell3, "td_table_3");
cell3.innerHTML = response.headers[i][0];
row.appendChild(cell3);
var cell4 = document.createElement("td");
Element.addClassName(cell4, "td_table_4");
cell4.innerHTML = response.headers[i][7];
row.appendChild(cell4);
var cell5 = document.createElement("td");
Element.addClassName(cell5, "td_table_5");
cell5.setAttribute("colspan", "2");
@@ -188,7 +188,7 @@ function searchMailsCallback(http) {
folderLocation = folderLocation.substr(6); // strip down the prefix folder
cell5.innerHTML = folderLocation;
row.appendChild(cell5);
table.appendChild(row);
}
@@ -198,22 +198,22 @@ function searchMailsCallback(http) {
var row = table.insertRow(0);
var cell = row.insertCell(0);
var element = document.createElement("span");
cell.setAttribute("id", "noSearchResults");
cell.setAttribute("colspan", "4");
element.innerHTML = _("No matches found");
cell.appendChild(element);
}
}
if (http.callbackData.subfolders.length > 0) {
var folderName = http.callbackData.subfolders[0];
var subfolders = http.callbackData.subfolders;
subfolders.splice(0, 1);
var urlstr = (ApplicationBaseURL + folderName + "/uids");
var callbackData = {"folderName" : folderName, "subfolders" : subfolders, "newSearch" : false};
// TODO - need to add these following contents ; asc, no-headers, sort
var object = {"filters":searchParams.filters, "sortingAttributes":{"match":searchParams.filterMatching}};
var content = Object.toJSON(object);
@@ -234,7 +234,7 @@ function onSearchEnd() {
$("resultsFound").innerHTML = nbResults + " " + _("results found");
else
$("resultsFound").innerHTML = "";
TableKit.reloadSortableTable($("searchMailFooter"));
$("buttonExpandHeader").addClassName("nosort");
}
@@ -243,7 +243,7 @@ function onCancelClick() {
disposeDialog();
$("searchMailView").remove();
$("toolbarSearchButton").disabled = false;
}
function onSearchSubfoldersCheck(event) {
@@ -286,7 +286,7 @@ function onAddFilter() {
element2.appendChild(option);
}
cell2.appendChild(element2);
var cell3 = row.insertCell(2);
Element.addClassName(cell3, "inputsCell");
var element3 = document.createElement("input");
@@ -295,11 +295,11 @@ function onAddFilter() {
element3.setAttribute("name", "searchInput");
element3.setAttribute("id", "searchInputRow" + rowCount);
cell3.appendChild(element3);
var cell4 = row.insertCell(3);
Element.addClassName(cell4, "buttonsCell");
cell4.setAttribute("align", "center");
var buttonsDiv = document.createElement("div");
var imageAddFilter = document.createElement("img");
var imageRemoveFilter = document.createElement("img");
@@ -316,17 +316,17 @@ function onAddFilter() {
imageRemoveFilter.setAttribute("id", "removeFilterButtonRow" + rowCount);
$(imageRemoveFilter).on("click", onRemoveFilter);
buttonsDiv.setAttribute("id", "filterButtons");
buttonsDiv.appendChild(imageAddFilter);
buttonsDiv.appendChild(imageRemoveFilter);
cell4.appendChild(buttonsDiv);
}
function onRemoveFilter() {
var rows = $("searchFiltersList").getElementsByTagName("tr");
var currentRow = this.up(".filterRow");
if(rows.length > 1)
$(currentRow).remove();
}
@@ -335,13 +335,13 @@ function onRemoveFilter() {
function onResultSelectionChange(event) {
var table = $("searchMailFooter").down("tbody");
if (event && (event.target.innerHTML != _("No matches found"))) {
var node = getTarget(event);
if (node.tagName == "SPAN")
node = node.parentNode;
// Update rows selection
onRowClick(event, node);
}
@@ -355,7 +355,7 @@ function onOpenClick(event) {
var msguid = selectedRow.getAttribute("uid");
var folderName = selectedRow.getAttribute("folderName");
var accountUser = userNames[0];
var url = "/SOGo/so/" + accountUser + "/Mail" + folderName + "/" + msguid + "/popupview";
if (selectedRow) {
openMessageWindow(msguid, url);
@@ -386,7 +386,7 @@ function onDeleteClick(event) {
uids.push(uid);
paths.push(path);
deleteMessageRequestCount++;
deleteCachedMessage(path);
if (Mailer.currentMessages[Mailer.currentMailbox] == uid) {
if (messageContent) messageContent.innerHTML = '';
@@ -448,7 +448,7 @@ function onResizeClick() {
var img = $("listCollapse").select('img').first();
var dialogWindowHeight = $("searchMailView").getHeight();
var state = "collapse";
if (searchFiltersList[0].visible()) {
state = "rise";
searchFiltersList.fadeOut(300, function() {
@@ -477,11 +477,11 @@ function adjustResultsTable(state) {
/*************** Init ********************/
function initSearchMailView () {
// Add one filterRow
onAddFilter();
adjustResultsTable("collapse");
// Observers : Event.on(element, eventName[, selector], callback)
$("searchMailFooter").down("tbody").on("mousedown", "tr", onResultSelectionChange);
$("searchMailFooter").down("tbody").on("dblclick", "tr", onOpenClick);

View File

@@ -112,8 +112,8 @@ div#header
border-bottom: 1px solid #000; }
div#header img.headerlogo
{ float: right;
width: 182px;
{ float: right;
width: 182px;
height: 30px; }
div#header div#headerhistory
@@ -184,7 +184,7 @@ DIV.linkbanner IMG
{ vertical-align: bottom;
text-align: left; }
.linkbannerimage {
.linkbannerimage {
text-align: right; }
DIV.contactSelector
@@ -228,7 +228,7 @@ DIV.contactSelector DIV.contactList
border-left: 1px solid #FFFFFF;
border-bottom: 1px solid #909090;
border-right: 1px solid #909090;
overflow: auto;
overflow: auto;
overflow-x: hidden; }
.popupMenu
@@ -410,7 +410,7 @@ TH.tbtv_headercell IMG.tbtv_sortcell
text-align: right;
border: 0px;
width: 12px;
height: 12px;
height: 12px;
top:0;}
.tableview
@@ -474,7 +474,7 @@ DIV#javascriptSafetyNet
DIV.javascriptPopupBackground
{ position: absolute;
background-color: #999;
-moz-opacity: 0.6;
-moz-opacity: 0.6;
opacity: 0.6;
z-index: 2;
top: 0px;
@@ -532,7 +532,7 @@ TD._selected
}
LI._selected.denied
{
{
background-color: #f33;
}
@@ -556,7 +556,7 @@ DIV.dTreeNode A._selected SPAN.nodeName
/* drag'n'drop */
DIV.dTreeNode SPAN._dragOver
{
{
background-color: #9ABCD8;
color: #fff;
}
@@ -659,7 +659,7 @@ DIV.dialog > DIV
top: 7px;
}
DIV.dialog.searchMail {
DIV.dialog.searchMail {
position: relative;
padding: 0px;
opacity: 1;
@@ -818,9 +818,9 @@ INPUT[name="search"]
background-color: #CCDDEC;
color: #909090; }
/* Buttons
/* Buttons
* Avoid using DIVS as buttons, they're only helpful when they have multiple
* listeners for "onclick"
* listeners for "onclick"
*/
.button, a.button {
padding: 0px 0.5em;
@@ -829,7 +829,7 @@ INPUT[name="search"]
float: right;
height: 23px;
padding-right: 3px; /* sliding doors padding */
text-decoration: none;
text-decoration: none;
text-align: center;
color: inherit;
cursor: pointer;
@@ -999,7 +999,7 @@ DIV.tabsContainer > UL LI
float: left;
height: 24px;
padding-right: 2px; /* sliding doors padding */
text-decoration: none;
text-decoration: none;
color: inherit; }
DIV.tabsContainer > UL LI SPAN
@@ -1106,15 +1106,15 @@ DIV.toolbar IMG.buttonImage
{ width: 24px;
height: 24px; }
A.toolbarButton,
A.toolbarButton,
A.toolbarButton:hover,
A.smallToolbarButton,
A.smallToolbarButton,
A.smallToolbarButton:hover {
display: inline;
float: left;
height: 49px;
padding-right: 3px; /* sliding doors padding */
text-decoration: none;
text-decoration: none;
color: inherit;
cursor: pointer;
}
@@ -1138,7 +1138,7 @@ A.toolbarButton:hover SPAN {
cursor: pointer;
}
A.smallToolbarButton SPAN,
A.smallToolbarButton SPAN,
A.smallToolbarButton:hover SPAN {
text-align: center;
display: block;
@@ -1185,7 +1185,7 @@ DIV.bottomToolbar A.bottomButton
padding: 0px;
width: 23px;
text-align: center;
text-decoration: none;
text-decoration: none;
color: inherit;
cursor: pointer;
border-bottom: 1px solid #9B9B9B;