Indentation in JavaScript files

pull/51/head
Francis Lachapelle 2014-07-30 10:31:25 -04:00
parent ea44308aa3
commit bd5c05cca2
6 changed files with 726 additions and 726 deletions

View File

@ -9,21 +9,21 @@ var usersRightsWindowWidth = 450;
function onSearchFormSubmit(panel) {
var searchValue = panel.down('[name="search"]');
var encodedValue = encodeURI(searchValue.value);
if (encodedValue.blank()) {
checkAjaxRequestsState();
checkAjaxRequestsState();
}
else {
var url = (UserFolderURL
+ "usersSearch?search=" + encodedValue);
if (document.userFoldersRequest) {
document.userFoldersRequest.aborted = true;
document.userFoldersRequest.abort();
}
document.userFoldersRequest
= triggerAjaxRequest(url, usersSearchCallback);
var url = (UserFolderURL
+ "usersSearch?search=" + encodedValue);
if (document.userFoldersRequest) {
document.userFoldersRequest.aborted = true;
document.userFoldersRequest.abort();
}
document.userFoldersRequest
= triggerAjaxRequest(url, usersSearchCallback);
}
return false;
}
@ -31,11 +31,11 @@ function usersSearchCallback(http) {
document.userFoldersRequest = null;
var div = $("administrationContent");
if (http.status == 200) {
var response = http.responseText.evalJSON();
buildUsersTree(div, response)
}
var response = http.responseText.evalJSON();
buildUsersTree(div, response)
}
else if (http.status == 404)
div.update();
div.update();
}
function buildUsersTree(treeDiv, response) {
@ -57,10 +57,10 @@ function buildUsersTree(treeDiv, response) {
d.icon.empty = ResourcesURL + '/empty.gif';
d.preload ();
d.add(0, -1, '');
var isUserDialog = false;
var multiplier = ((isUserDialog) ? 1 : 2);
for (var i = 0; i < response.length; i++)
addUserLineToTree(d, 1 + i * multiplier, response[i]);
treeDiv.innerHTML = "";
@ -78,10 +78,10 @@ function buildUsersTree(treeDiv, response) {
function addUserLineToTree(tree, parent, line) {
var icon = ResourcesURL + '/busy.gif';
var email = line[1] + " &lt;" + line[2] + "&gt;";
if (line[3] && !line[3].empty())
email += ", " + line[3]; // extra contact info
email += ", " + line[3]; // extra contact info
tree.add(parent, 0, email, 0, '#', line[0], 'person',
'', '',
ResourcesURL + '/abcard.png',
@ -92,57 +92,57 @@ function addUserLineToTree(tree, parent, line) {
function onTreeItemClick(event) {
preventDefault(event);
var topNode = $("d");
if (topNode.selectedEntry)
topNode.selectedEntry.deselect();
topNode.selectedEntry.deselect();
this.selectElement();
topNode.selectedEntry = this;
}
function onUserNodeToggle(event) {
this.stopObserving("click", onUserNodeToggle);
var person = this.parentNode.getAttribute("dataname");
var url = (UserFolderURLForUser(person) + "foldersSearch");
var nodeId = this.getAttribute("id").substr(3);
triggerAjaxRequest(url, foldersSearchCallback,
{ nodeId: nodeId, user: person });
{ nodeId: nodeId, user: person });
}
function foldersSearchCallback(http) {
if (http.status == 200) {
var response = http.responseText;
var nodeId = parseInt(http.callbackData["nodeId"]);
var dd = $("dd" + (nodeId + 2));
var indentValue = (dd ? 1 : 0);
d.aIndent.push(indentValue);
var dd = $("dd" + nodeId);
if (response.length) {
var folders = response.split(";");
var user = http.callbackData["user"];
dd.innerHTML = '';
for (var i = 1; i < folders.length - 1; i++)
var response = http.responseText;
var nodeId = parseInt(http.callbackData["nodeId"]);
var dd = $("dd" + (nodeId + 2));
var indentValue = (dd ? 1 : 0);
d.aIndent.push(indentValue);
var dd = $("dd" + nodeId);
if (response.length) {
var folders = response.split(";");
var user = http.callbackData["user"];
dd.innerHTML = '';
for (var i = 1; i < folders.length - 1; i++)
dd.appendChild(addFolderBranchToTree (d, user, folders[i], nodeId, i, false));
dd.appendChild (addFolderBranchToTree (d, user, folders[folders.length-1], nodeId,
dd.appendChild (addFolderBranchToTree (d, user, folders[folders.length-1], nodeId,
(folders.length - 1), true));
for (var i = 1; i < folders.length; i++) {
var sd = $("sd" + (nodeId + i));
sd.observe("click", onTreeItemClick);
sd.observe("dblclick", onFolderOpen);
}
}
else {
dd.innerHTML = '';
dd.appendChild (addFolderNotFoundNode (d, nodeId, null));
var sd = $("sd" + (nodeId + 1));
sd.observe("click", onTreeItemClick);
}
d.aIndent.pop();
for (var i = 1; i < folders.length; i++) {
var sd = $("sd" + (nodeId + i));
sd.observe("click", onTreeItemClick);
sd.observe("dblclick", onFolderOpen);
}
}
else {
dd.innerHTML = '';
dd.appendChild (addFolderNotFoundNode (d, nodeId, null));
var sd = $("sd" + (nodeId + 1));
sd.observe("click", onTreeItemClick);
}
d.aIndent.pop();
}
}
@ -150,19 +150,19 @@ function addFolderBranchToTree(tree, user, folder, nodeId, subId, isLast) {
var folderInfos = folder.split(":");
var icon = ResourcesURL + '/';
if (folderInfos[2] == 'Contact')
icon += 'tb-mail-addressbook-flat-16x16.png';
icon += 'tb-mail-addressbook-flat-16x16.png';
else
icon += 'calendar-folder-16x16.png';
icon += 'calendar-folder-16x16.png';
var folderId = user + ":" + folderInfos[1];
var name = folderInfos[0]; // name has the format "Folername (Firstname Lastname <email>)"
var pos = name.lastIndexOf(' (');
if (pos > -1)
name = name.substring(0, pos); // strip the part with fullname and email
name = name.substring(0, pos); // strip the part with fullname and email
var node = new dTreeNode(subId, nodeId, name, 0, '#', folderId,
folderInfos[2] + '-folder', '', '', icon, icon);
node._ls = isLast;
var content = tree.node(node, (nodeId + subId), null);
return content;
}

View File

@ -53,7 +53,7 @@ function contactsListCallback(http) {
if (http.readyState == 4) {
if (http.status == 200) {
document.contactsListAjaxRequest = null;
var div = $("contactsListContent");
var table = $("contactsList");
var tbody = table.tBodies[0];
@ -173,13 +173,13 @@ function contactsListCallback(http) {
sortHeader = $("phoneHeader");
else
sortHeader = null;
if (sortHeader) {
var sortImages = $(table.tHead).select(".sortImage");
$(sortImages).each(function(item) {
item.remove();
});
var sortImage = createElement("img", "messageSortImage", "sortImage");
sortHeader.insertBefore(sortImage, sortHeader.firstChild);
if (sorting["ascending"])
@ -433,7 +433,7 @@ function onContactSelectionChange(event) {
}
if (contactView) {
var rows = this.parentNode.getSelectedRowsId();
if (rows.length == 1) {
var node = $(rows[0]);
loadContact(node.getAttribute('id'));
@ -499,7 +499,7 @@ function onToolbarWriteToSelectedContacts(event) {
if (document.body.hasClassName("popup"))
window.close();
}
return false;
}
@ -664,7 +664,7 @@ function onConfirmContactSelection(event) {
var currentAddressBookName = folder.textContent;
var selectorList = null;
var initialValues = null;
var contactsList = $("contactsList");
var rows = contactsList.getSelectedRows();
for (i = 0; i < rows.length; i++) {
@ -787,7 +787,7 @@ function onFolderUnsubscribeCB(folderId) {
var node = $(folderId);
node.deselect();
node.parentNode.removeChild(node);
var personal = $("/personal");
personal.selectElement();
onFolderSelectionChange();
@ -924,7 +924,7 @@ function deletePersonalAddressBookCallback(http) {
if (http.readyState == 4) {
if (isHttpStatus204(http.status)) {
var ul = $("contactFolders");
var children = ul.childNodesWithTag("li");
var i = 0;
var done = false;
@ -1002,7 +1002,7 @@ function configureAddressBooks() {
contactFolders.on("dblclick", onAddressBookModify);
contactFolders.on("selectstart", listRowMouseDownHandler);
contactFolders.attachMenu("contactFoldersMenu");
lookupDeniedFolders();
configureDroppables();
@ -1041,16 +1041,16 @@ function updateAddressBooksMenus() {
var menuDIV = $(menuId);
if (menuDIV)
menuDIV.parentNode.removeChild(menuDIV);
menuDIV = document.createElement("div");
pageContent.appendChild(menuDIV);
var menu = document.createElement("ul");
menuDIV.appendChild(menu);
$(menuDIV).addClassName("menu");
menuDIV.setAttribute("id", menuId);
var submenuIds = new Array();
for (var i = 0; i < contactFolders.length; i++) {
if (contactFolders[i].hasClassName("local")) {
@ -1067,7 +1067,7 @@ function updateAddressBooksMenus() {
}
}
}
function onAddressBookModify(event) {
var folders = $("contactFolders");
var selected = folders.getSelectedNodes()[0];
@ -1076,12 +1076,12 @@ function onAddressBookModify(event) {
var windowID = sanitizeWindowName(addressBookID + " properties");
var width = 410;
var height = 410;
$(function() {
var properties = window.open(url, windowID, "width="+width+",height="+height+",resizable=0");
properties.focus();
}).delay(0.1);
}
function onMenuSharing(event) {
@ -1253,14 +1253,14 @@ getMenus = function() {
"moveContactMenu", "copyContactMenu",
onMenuExportContact, onMenuRawContact);
menus["searchMenu"] = new Array(setSearchCriteria, setSearchCriteria, setSearchCriteria);
var contactFoldersMenu = $("contactFoldersMenu");
if (contactFoldersMenu)
contactFoldersMenu.prepareVisibility = onAddressBooksMenuPrepareVisibility;
var contactMenu = $("contactMenu");
if (contactMenu)
contactMenu.prepareVisibility = onContactMenuPrepareVisibility;
if (originalGetMenus) {
var originalMenus = originalGetMenus();
if (originalMenus)
@ -1306,7 +1306,7 @@ function onDocumentKeydown(event) {
nextRow = row.previous("tr");
if (nextRow) {
row.up().deselectAll();
// Adjust the scollbar
var viewPort = $("contactsListContent");
var divDimensions = viewPort.getDimensions();
@ -1319,7 +1319,7 @@ function onDocumentKeydown(event) {
viewPort.scrollTop += rowBottom - divBottom;
else if (rowScrollOffset.top > rowPosition.top)
viewPort.scrollTop -= rowScrollOffset.top - rowPosition.top;
// Select and load the next message
nextRow.selectElement();
loadContact(nextRow.readAttribute("id"));
@ -1358,7 +1358,7 @@ function initContacts(event) {
}
Event.observe(document, "keydown", onDocumentKeydown);
configureAddressBooks();
configureDraggables();
updateAddressBooksMenus();
@ -1378,7 +1378,7 @@ function initContacts(event) {
}
configureSortableTableHeaders(table);
}
if (typeof onWindowResize != 'function') {
// When loaded from the mail editor, onWindowResize is
// already registered

View File

@ -34,13 +34,13 @@ var deleteMessageRequestCount = 0;
var messageCheckTimer;
/* We need to override this method since it is adapted to GCS-based folder
references, which we do not use here */
references, which we do not use here */
function URLForFolderID(folderID, application) {
if (application)
application = UserFolderURL + application + "/";
else
application = ApplicationBaseURL;
var url = application + encodeURI(folderID);
if (url[url.length-1] == '/')
@ -100,7 +100,7 @@ function onMenuSharing(event) {
if (type == "additional")
showAlertDialog(clabels["The user rights cannot be"
+ " edited for this object!"]);
+ " edited for this object!"]);
else {
var urlstr = URLForFolderID(folderID) + "/acls";
openAclWindow(urlstr);
@ -280,7 +280,7 @@ function mailListToggleMessagesRead(row, force_mark_as_read) {
markMailInWindow(window, msguid, markread);
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/"
+ msguid + "/" + action;
+ msguid + "/" + action;
var data = { "msguid": msguid };
triggerAjaxRequest(url, mailListMarkMessageCallback, data);
@ -289,14 +289,14 @@ function mailListToggleMessagesRead(row, force_mark_as_read) {
}
/*
function mailListMarkMessage(event) {
mailListToggleMessagesRead();
function mailListMarkMessage(event) {
mailListToggleMessagesRead();
preventDefault(event);
preventDefault(event);
return false;
}
*/
return false;
}
*/
function mailListMarkMessageCallback(http) {
var data = http.callbackData;
@ -305,7 +305,7 @@ function mailListMarkMessageCallback(http) {
}
else {
log("Message Mark Failed (" + http.status + "): " + http.statusText);
Mailer.dataTable.invalidate(data["msguid"], false);
Mailer.dataTable.invalidate(data["msguid"], false);
}
}
@ -343,7 +343,7 @@ function mailListToggleMessagesFlagged(row) {
flagMailInWindow(window, msguid, flagged);
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/"
+ msguid + "/" + action;
+ msguid + "/" + action;
var data = { "msguid": msguid };
triggerAjaxRequest(url, mailListToggleMessageFlaggedCallback, data);
@ -363,11 +363,11 @@ function onUnload(event) {
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/expunge";
new Ajax.Request(url, {
asynchronous: false,
method: 'get',
onFailure: function(transport) {
log("Can't expunge current folder: " + transport.status);
}
asynchronous: false,
method: 'get',
onFailure: function(transport) {
log("Can't expunge current folder: " + transport.status);
}
});
return true;
@ -383,12 +383,12 @@ function onDocumentKeydown(event) {
keyCode = "A".charCodeAt(0);
}
}
if (keyCode == Event.KEY_DELETE ||
if (keyCode == Event.KEY_DELETE ||
keyCode == Event.KEY_BACKSPACE) {
deleteSelectedMessages();
Event.stop(event);
}
else if (keyCode == Event.KEY_DOWN ||
else if (keyCode == Event.KEY_DOWN ||
keyCode == Event.KEY_UP) {
if (Mailer.currentMessages[Mailer.currentMailbox]) {
var row = $("row_" + Mailer.currentMessages[Mailer.currentMailbox]);
@ -411,7 +411,7 @@ function onDocumentKeydown(event) {
if (divBottom < rowBottom)
viewPort.scrollTop += rowBottom - divBottom + centerOffset;
else if (viewPort.scrollTop > nextRow.offsetTop)
else if (viewPort.scrollTop > nextRow.offsetTop)
viewPort.scrollTop -= rowScrollOffset.top - nextRow.offsetTop + centerOffset;
// Select and load the next message
@ -419,12 +419,12 @@ function onDocumentKeydown(event) {
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
// from generic.js
lastClickedRow = nextRow.rowIndex;
lastClickedRowId = nextRow.id;
lastClickedRowId = nextRow.id;
}
Event.stop(event);
}
}
else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1))
else if (((isMac() && event.metaKey == 1) || (!isMac() && event.ctrlKey == 1))
&& keyCode == "A".charCodeAt(0)) { // Ctrl-A
$("messageListBody").down("TBODY").selectAll();
Event.stop(event);
@ -449,18 +449,18 @@ function deleteSelectedMessages(sender) {
if (rowIds && rowIds.length > 0) {
messageList.deselectAll();
for (var i = 0; i < rowIds.length; i++) {
if (unseenCount < 1) {
var rows = messageList.select('#' + rowIds[i]);
if (rows.length > 0) {
var row = rows.first();
row.hide();
if (row.hasClassName("mailer_unreadmail"))
unseenCount--;
}
else {
unseenCount = 1;
}
}
if (unseenCount < 1) {
var rows = messageList.select('#' + rowIds[i]);
if (rows.length > 0) {
var row = rows.first();
row.hide();
if (row.hasClassName("mailer_unreadmail"))
unseenCount--;
}
else {
unseenCount = 1;
}
}
var uid = rowIds[i].substr(4); // drop "row_"
var path = Mailer.currentMailbox + "/" + uid;
uids.push(uid);
@ -508,7 +508,7 @@ function deleteSelectedMessages(sender) {
if (nextRow) {
// from generic.js
lastClickedRow = nextRow.rowIndex;
lastClickedRowId = nextRow.id;
lastClickedRowId = nextRow.id;
}
if (Mailer.currentMailboxType != "trash")
deleteCachedMailboxByType("trash");
@ -545,10 +545,10 @@ function deleteSelectedMessagesCallback(http) {
if (rdata.quotas && data["mailbox"].startsWith('/0/'))
updateQuotas(rdata.quotas);
}
if (data["refreshUnseenCount"])
if (data["refreshUnseenCount"])
// TODO : the unseen count should be returned when calling the batchDelete remote action,
// in order to avoid this extra AJAX call.
getUnseenCountForFolder(data["mailbox"]);
getUnseenCountForFolder(data["mailbox"]);
if (data["refreshFolder"])
Mailer.dataTable.refresh();
}
@ -572,7 +572,7 @@ function deleteMessagesWithoutTrash(data) {
var parameters = "uid=" + data["id"].join(",") + '&withoutTrash=1';
data["withoutTrash"] = true;
triggerAjaxRequest(url, deleteSelectedMessagesCallback, data, parameters,
{ "Content-type": "application/x-www-form-urlencoded" });
{ "Content-type": "application/x-www-form-urlencoded" });
disposeDialog();
}
@ -685,9 +685,9 @@ function onMailboxMenuMove(event) {
for (var i = 0; i < rowIds.length; i++) {
var uid = rowIds[i].substr(4);
var path = Mailer.currentMailbox + "/" + uid;
var rows = messageList.select('#' + rowIds[i]);
if (rows.length > 0)
rows.first().hide();
var rows = messageList.select('#' + rowIds[i]);
if (rows.length > 0)
rows.first().hide();
uids.push(uid);
paths.push(path);
// Remove references to closed popups
@ -803,8 +803,8 @@ function openMailbox(mailbox, reload) {
if (sortHeader) {
var sortImages = sortHeader.up('THEAD').select(".sortImage");
$(sortImages).each(function(item) {
item.remove();
});
item.remove();
});
var sortImage = createElement("img", "messageSortImage", "sortImage");
sortHeader.insertBefore(sortImage, sortHeader.firstChild);
if (sorting["ascending"])
@ -865,13 +865,13 @@ function openMailbox(mailbox, reload) {
Mailer.unseenCountMailboxes.push(mailbox);
}
// Restore previous selection
// Restore previous selection
var currentMessage = Mailer.currentMessages[mailbox];
if (currentMessage) {
if (!reload) {
loadMessage(currentMessage);
}
}
}
}
}
@ -887,7 +887,7 @@ function messageListCallback(row, data, isNew) {
// Restore previous selection
if (data['uid'] == currentMessage)
row.addClassName('_selected');
row.addClassName('_selected');
if (data['Thread'])
row.addClassName('openedThread');
@ -968,10 +968,10 @@ function updateUnseenCount(node, count, isDelta) {
counterSpan.removeChild(counterSpan.firstChild);
}
counterSpan.appendChild(document.createTextNode(" (" + count + ")"));
if (count > 0) {
if (count > 0) {
counterSpan.removeClassName("hidden");
unseenSpan.addClassName("unseen");
}
}
else {
counterSpan.addClassName("hidden");
unseenSpan.removeClassName("unseen");
@ -1019,9 +1019,9 @@ function onMessageListRender(event) {
// Restore previous selection
var currentMessage = Mailer.currentMessages[Mailer.currentMailbox];
if (currentMessage) {
var rows = this.select("TR#row_" + currentMessage);
if (rows.length == 1)
rows[0].selectElement();
var rows = this.select("TR#row_" + currentMessage);
if (rows.length == 1)
rows[0].selectElement();
}
// Update message counter in folder name
updateMessageListCounter(event.memo, false);
@ -1105,7 +1105,7 @@ function deleteCachedMailboxByType(type) {
function deleteCachedMailbox(mailboxPath) {
var keys = Mailer.dataSources.keys();
for (var i = 0; i < keys.length; i++) {
if (keys[i] == mailboxPath || keys[i].startsWith(mailboxPath + "?"))
if (keys[i] == mailboxPath || keys[i].startsWith(mailboxPath + "?"))
Mailer.dataSources.unset(keys[i]);
}
}
@ -1121,8 +1121,8 @@ function deleteCachedMessage(messageId) {
Mailer.cachedMessages.splice(counter, 1);
done = true;
}
else
counter++;
else
counter++;
}
function getCachedMessage(idx) {
@ -1134,8 +1134,8 @@ function getCachedMessage(idx) {
if (Mailer.cachedMessages[counter]
&& Mailer.cachedMessages[counter]['idx'] == Mailer.currentMailbox + '/' + idx)
message = Mailer.cachedMessages[counter];
else
counter++;
else
counter++;
return message;
}
@ -1223,8 +1223,8 @@ function loadMessage(msguid) {
+ msguid + "/view?noframe=1");
div.innerHTML = '';
document.messageAjaxRequest = triggerAjaxRequest(url,
loadMessageCallback,
{ 'mailbox': Mailer.currentMailbox,
loadMessageCallback,
{ 'mailbox': Mailer.currentMailbox,
'msguid': msguid,
'seenStateHasChanged': seenStateHasChanged });
}
@ -1251,13 +1251,13 @@ function loadMessage(msguid) {
/**
* Hide the "Load Images" button when there's no unsafe content
*/
*/
function configureLoadImagesButton() {
var loadImagesButton = $("loadImagesButton");
if (typeof(loadImagesButton) == "undefined" ||
loadImagesButton == null ) {
return;
}
return;
}
var content = $("messageContent");
var unsafeElements = content.select('[unsafe-src], [unsafe-data], [unsafe-classid], [unsafe-background], [unsafe-style]');
if (unsafeElements.length == 0) {
@ -1272,7 +1272,7 @@ function configureSignatureFlagImage() {
var signedPart = $("signedMessage");
if (signedPart) {
var supportsSMIME
= parseInt(signedPart.getAttribute("supports-smime"));
= parseInt(signedPart.getAttribute("supports-smime"));
if (supportsSMIME) {
var loadImagesButton = $("loadImagesButton");
@ -1320,7 +1320,7 @@ function showSignatureMessage () {
function hideSignatureMessage () {
var div = $("signatureFlagMessage");
if (div)
div.style.display = "none";
div.style.display = "none";
}
function configureLinksInMessage() {
@ -1398,10 +1398,10 @@ function configureiCalLinksInMessage() {
// The user delegates the invitation
editDelegate.stopObserving("click");
editDelegate.observe("click", function(event) {
$("delegateEditor").show();
$("delegatedTo").focus();
this.hide();
});
$("delegateEditor").show();
$("delegatedTo").focus();
this.hide();
});
}
var delegatedToLink = $("delegatedToLink");
@ -1410,12 +1410,12 @@ function configureiCalLinksInMessage() {
// to change the delegated attendee
delegatedToLink.stopObserving("click");
delegatedToLink.observe("click", function(event) {
$("delegatedTo").show();
$("iCalendarDelegate").show();
$("delegatedTo").focus();
this.hide();
Event.stop(event);
});
$("delegatedTo").show();
$("iCalendarDelegate").show();
$("delegatedTo").focus();
this.hide();
Event.stop(event);
});
}
}
}
@ -1428,7 +1428,7 @@ function onICalendarDelegate(event) {
currentMsg = mailboxName + "/" + messageName;
else
currentMsg = Mailer.currentMailbox + "/"
+ Mailer.currentMessages[Mailer.currentMailbox];
+ Mailer.currentMessages[Mailer.currentMailbox];
delegateInvitation(link, ICalendarButtonCallback, currentMsg);
}
this.blur(); // required by IE
@ -1500,19 +1500,19 @@ function resizeMailContent() {
var contentDiv = document.getElementsByClassName('mailer_mailcontent')[0];
contentDiv.setStyle({ 'top':
(Element.getHeight(headerTable) + headerTable.offsetTop) + 'px' });
(Element.getHeight(headerTable) + headerTable.offsetTop) + 'px' });
// Show expand buttons if necessary
var spans = $$("TABLE TR.mailer_fieldrow TD.mailer_fieldvalue SPAN");
spans.each(function(span) {
var row = span.up("TR");
if (span.getWidth() > row.getWidth()) {
var cell = row.select("TD.mailer_fieldname").first();
var link = cell.down("img");
link.show();
link.observe("click", toggleDisplayHeader);
}
});
var row = span.up("TR");
if (span.getWidth() > row.getWidth()) {
var cell = row.select("TD.mailer_fieldname").first();
var link = cell.down("img");
link.show();
link.observe("click", toggleDisplayHeader);
}
});
}
function toggleDisplayHeader(event) {
@ -1621,7 +1621,7 @@ function loadMessageCallback(http) {
if (http.status == 200) {
if (http.callbackData) {
document.messageAjaxRequest = null;
var msguid = http.callbackData.msguid;
var msguid = http.callbackData.msguid;
var mailbox = http.callbackData.mailbox;
if (Mailer.currentMailbox == mailbox &&
Mailer.currentMessages[Mailer.currentMailbox] == msguid) {
@ -1646,8 +1646,8 @@ function loadMessageCallback(http) {
}
else if (http.status == 404) {
showAlertDialog (_("The message you have selected doesn't exist anymore."));
Mailer.dataTable.remove(http.callbackData.msguid);
Mailer.currentMessages[Mailer.currentMailbox] = null;
Mailer.dataTable.remove(http.callbackData.msguid);
Mailer.currentMessages[Mailer.currentMailbox] = null;
}
else
log("messageCallback: problem during ajax request: " + http.status);
@ -1843,7 +1843,7 @@ function refreshMessage(mailbox, messageUID) {
if (Mailer.currentMailboxType == 'sent' || Mailer.currentMailboxType == 'draft')
refreshCurrentFolder();
else if (mailbox == Mailer.currentMailbox) {
Mailer.dataTable.invalidate(messageUID);
Mailer.dataTable.invalidate(messageUID);
}
}
@ -1960,13 +1960,13 @@ function initMailer(event) {
Event.observe(document, "keydown", onDocumentKeydown);
/* Perform an expunge when leaving the webmail */
// if (isSafari()) {
// $('calendarBannerLink').observe("click", onUnload);
// $('contactsBannerLink').observe("click", onUnload);
// $('logoff').observe("click", onUnload);
// }
// else
Event.observe(window, "beforeunload", onUnload);
// if (isSafari()) {
// $('calendarBannerLink').observe("click", onUnload);
// $('contactsBannerLink').observe("click", onUnload);
// $('logoff').observe("click", onUnload);
// }
// else
Event.observe(window, "beforeunload", onUnload);
onMessageListResize();
}
@ -2003,7 +2003,7 @@ function initMailboxTree() {
mailboxTree.config.hideRoot = true;
mailboxTree.icon.root = ResourcesURL + "/tbtv_account_17x17.png";
mailboxTree.icon.folder = ResourcesURL + "/tbtv_leaf_corner_17x17.png";
mailboxTree.icon.folderOpen = ResourcesURL + "/tbtv_leaf_corner_17x17.png";
mailboxTree.icon.folderOpen = ResourcesURL + "/tbtv_leaf_corner_17x17.png";
mailboxTree.icon.node = ResourcesURL + "/tbtv_leaf_corner_17x17.png";
mailboxTree.icon.line = ResourcesURL + "/tbtv_line_17x22.png";
mailboxTree.icon.join = ResourcesURL + "/tbtv_junction_17x22.png";
@ -2021,7 +2021,7 @@ function initMailboxTree() {
var chainRq = new AjaxRequestsChain(initMailboxTreeCB);
for (var i = 0; i < mailAccounts.length; i++) {
var url = ApplicationBaseURL + "/" + i + "/mailboxes";
var url = ApplicationBaseURL + "/" + i + "/mailboxes";
chainRq.requests.push([url, onLoadMailboxesCallback, i]);
}
chainRq.start();
@ -2331,7 +2331,7 @@ function onMenuDeleteFolder(event) {
var urlstr = URLForFolderID(folderID) + "/delete";
var errorLabel = _("The folder could not be deleted.");
showConfirmDialog(_("Confirmation"),
_("Do you really want to move this folder into the trash ?"),
_("Do you really want to move this folder into the trash ?"),
function(event) {
triggerAjaxRequest(urlstr, folderOperationCallback, errorLabel);
disposeDialog();
@ -2448,25 +2448,25 @@ function onMenuLabelNone() {
else if (Object.isArray(document.menuTarget))
// Menu called from multiple selection in messages list view
$(document.menuTarget).collect(function(row) {
messages.push(row.getAttribute("id").substr(4));
});
messages.push(row.getAttribute("id").substr(4));
});
else
// Menu called from one selection in messages list view
messages.push(document.menuTarget.getAttribute("id").substr(4));
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/";
messages.each(function(id) {
triggerAjaxRequest(url + id + "/removeAllLabels",
messageFlagCallback,
{ mailbox: Mailer.currentMailbox, msg: id, label: null } );
});
triggerAjaxRequest(url + id + "/removeAllLabels",
messageFlagCallback,
{ mailbox: Mailer.currentMailbox, msg: id, label: null } );
});
}
function onMenuLabelFlag() {
var messages = new Hash();
var flag = this.readAttribute("data-name");
if (document.menuTarget.tagName == "DIV")
// Menu called from message content view
messages.set(Mailer.currentMessages[Mailer.currentMailbox],
@ -2483,15 +2483,15 @@ function onMenuLabelFlag() {
// Menu called from one selection in messages list view
messages.set(document.menuTarget.getAttribute("id").substr(4),
document.menuTarget.getAttribute("labels"));
var url = ApplicationBaseURL + encodeURI(Mailer.currentMailbox) + "/";
messages.keys().each(function(id) {
var flags = messages.get(id).split(" ");
var operation = "add";
if (flags.indexOf(flag) > -1)
operation = "remove";
triggerAjaxRequest(url + id + "/" + operation + "Label?flag=" + flag.asCSSIdentifier(),
messageFlagCallback,
{ mailbox: Mailer.currentMailbox, msg: id,
@ -2517,7 +2517,7 @@ function folderRefreshCallback(http) {
var oldMailbox = http.callbackData.mailbox;
if (http.callbackData.refresh
&& oldMailbox == Mailer.currentMailbox) {
getUnseenCountForFolder(oldMailbox);
getUnseenCountForFolder(oldMailbox);
if (http.callbackData.id) {
var s = http.callbackData.id + "";
var uids = s.split(",");
@ -2542,8 +2542,8 @@ function folderRefreshCallback(http) {
log ("folderRefreshCallback failed for UIDs " + s);
for (var i = 0; i < uids.length; i++) {
var row = $("row_" + uids[i]);
if (row)
row.show();
if (row)
row.show();
}
}
var msg = /<p>(.*)<\/p>/m.exec(http.responseText);
@ -2607,7 +2607,7 @@ function onMessageListMenuPrepareVisibility() {
function onAccountIconMenuPrepareVisibility() {
/* This methods disables or enables the "Delegation..." menu option on
mail accounts. */
if (document.menuTarget) {
if (document.menuTarget) {
var mbx = document.menuTarget.getAttribute("dataname");
if (mbx) {
var lis = this.getElementsByTagName("li");
@ -2656,8 +2656,8 @@ function onLabelMenuPrepareVisibility() {
var rows = messageList.getSelectedRows();
for (var i = 0; i < rows.length; i++) {
$w(rows[i].getAttribute("labels")).each(function(flag) {
flags[flag] = true;
});
flags[flag] = true;
});
}
}
@ -2675,7 +2675,7 @@ function onLabelMenuPrepareVisibility() {
// We bind the event handlers if we need to
if (lis[i].menuCallback == null) {
lis[i].menuCallback = onMenuLabelFlag;
lis[i].on("mousedown", onMenuClickHandler);
lis[i].on("mousedown", onMenuClickHandler);
lis[i].removeClassName("disabled");
}
@ -2854,9 +2854,9 @@ document.observe("dom:loaded", initMailer);
function Mailbox(type, name, unseen, displayName) {
this.type = type;
if (displayName)
this.displayName = displayName;
this.displayName = displayName;
else
this.displayName = name;
this.displayName = name;
// log("name: " + name + "; dn: " + displayName);
this.name = name;
this.unseen = unseen;
@ -2893,8 +2893,8 @@ Mailbox.prototype = {
if (this.children[i].name == name
|| this.children[i].displayName == name)
mailbox = this.children[i];
else
i++;
else
i++;
return mailbox;
},
@ -2923,7 +2923,7 @@ function configureDraggables() {
function configureDroppables() {
jQuery('#mailboxTree .dTreeNode[datatype!="account"][datatype!="additional"] .node .nodeName').droppable({
hoverClass: 'genericHoverClass',
drop: dropAction });
drop: dropAction });
}
function startDragging(event, ui) {

File diff suppressed because it is too large Load Diff

View File

@ -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 (/</, "&lt;");
tmp = tmp.replace (/>/, "&gt;");
@ -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

View File

@ -3,21 +3,21 @@
Copyright (C) 2005 SKYRIX Software AG
Copyright (C) 2006-2012 Inverse
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public
License along with SOGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
You should have received a copy of the GNU Lesser General Public
License along with SOGo; see the file COPYING. If not, write to the
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
var logConsole;
var logWindow = null;
@ -49,10 +49,10 @@ var emailRE = /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-
/* This function enables the execution of a wrapper function just before the
user callback is executed. The wrapper in question executes "preventDefault"
to the event parameter if and only when "this" is a link. The goal of this
operation is to prevent links with attached even handlers to be followed,
including those with an href set to "#". */
user callback is executed. The wrapper in question executes "preventDefault"
to the event parameter if and only when "this" is a link. The goal of this
operation is to prevent links with attached even handlers to be followed,
including those with an href set to "#". */
function clickEventWrapper(functionRef) {
function button_clickEventWrapper(event) {
if (this.tagName == "A") {
@ -91,7 +91,7 @@ function createElement(tagName, id, classes, attributes, htmlAttributes, parentN
function URLForFolderID(folderID) {
var folderInfos = folderID.split(":");
var url;
if (folderInfos.length > 1) {
url = UserFolderURL + "../" + encodeURI(folderInfos[0]);
if (!(folderInfos[0].endsWith('/')
@ -132,7 +132,7 @@ function extractEmailName(mailTo) {
tmpMailTo = tmpMailTo.replace("&gt;", ">");
tmpMailTo = tmpMailTo.replace("&amp;", "&");
var emailNamere = /([ ]+)?(.+)\ </;
var emailNamere = /([ ]+)?(.+)\ </;
if (emailNamere.test(tmpMailTo)) {
emailNamere.exec(tmpMailTo);
emailName = RegExp.$2;
@ -210,7 +210,7 @@ function openGenericWindow(url, wId) {
var iframe = div.down("iframe");
iframe.src = url;
if (!wId)
wId = "genericFrame";
wId = "genericFrame";
iframe.id = wId;;
var bgDiv = $("bgFrameDiv");
if (bgDiv) {
@ -347,12 +347,12 @@ function onEmailTo(event) {
function deleteDraft(url) {
/* this is called by UIxMailEditor with window.opener */
new Ajax.Request(url, {
asynchronous: false,
method: 'post',
onFailure: function(transport) {
log("draftDeleteCallback: problem during ajax request: " + transport.status);
}
});
asynchronous: false,
method: 'post',
onFailure: function(transport) {
log("draftDeleteCallback: problem during ajax request: " + transport.status);
}
});
}
function refreshFolderByType(type) {
@ -383,12 +383,12 @@ function onCASRecoverIFrameLoaded(event) {
var request = this.request;
if (request.attempt == 0) {
window.setTimeout(function() {
triggerAjaxRequest(request.url,
request.callback,
request.callbackData,
request.content,
request.paramHeaders,
1); },
triggerAjaxRequest(request.url,
request.callback,
request.callbackData,
request.content,
request.paramHeaders,
1); },
100);
}
else {
@ -727,8 +727,8 @@ function onRowClick(event, target) {
$(node).selectElement();
}
if (rowIndex != null) {
lastClickedRow = rowIndex;
lastClickedRowId = node.getAttribute("id");
lastClickedRow = rowIndex;
lastClickedRowId = node.getAttribute("id");
}
return true;
@ -1531,7 +1531,7 @@ function initMenu(menuDIV, callbacks) {
}
else {
node.menuCallback = callback;
node.on("mousedown", onMenuClickHandler);
node.on("mousedown", onMenuClickHandler);
}
}
else
@ -2090,12 +2090,12 @@ function _showConfirmDialog(title, label, callbackYes, callbackNo, yesLabel, noL
if (dialog) {
$("bgDialogDiv").show();
// Update callbacks on buttons
var buttons = dialog.getElementsByTagName("a");
buttons[0].stopObserving();
buttons[0].on("click", callbackYes);
buttons[1].stopObserving();
buttons[1].on("click", callbackNo || disposeDialog);
// Update callbacks on buttons
var buttons = dialog.getElementsByTagName("a");
buttons[0].stopObserving();
buttons[0].on("click", callbackYes);
buttons[1].stopObserving();
buttons[1].on("click", callbackNo || disposeDialog);
}
else {
var fields = createElement("p");
@ -2127,19 +2127,19 @@ function _showPromptDialog(title, label, callback, defaultValue) {
v = defaultValue?defaultValue:"";
if (dialog) {
$("bgDialogDiv").show();
dialog.down("input").value = v;
dialog.down("input").value = v;
}
else {
var fields = createElement("p", null, ["prompt"]);
fields.appendChild(document.createTextNode(label));
fields.appendChild(document.createTextNode(label));
var input = createElement("input", null, "textField",
{ type: "text", "value": v },
{ previousValue: v });
fields.appendChild(input);
{ type: "text", "value": v },
{ previousValue: v });
fields.appendChild(input);
fields.appendChild(createButton(null,
_("OK"),
callback.bind(input)));
fields.appendChild(createButton(null,
fields.appendChild(createButton(null,
_("Cancel"),
disposeDialog));
dialog = createDialog(null,
@ -2174,9 +2174,9 @@ function _showSelectDialog(title, label, options, button, callbackFcn, callbackA
}
else {
var fields = createElement("p", null, []);
fields.update(label);
fields.update(label);
var select = createElement("select"); //, null, null, { cname: name } );
fields.appendChild(select);
fields.appendChild(select);
var values = $H(options).keys();
for (var i = 0; i < values.length; i++) {
var option = createElement("option", null, null,
@ -2188,7 +2188,7 @@ function _showSelectDialog(title, label, options, button, callbackFcn, callbackA
fields.appendChild(createButton(null,
button,
callbackFcn.bind(select, callbackArg)));
fields.appendChild(createButton(null,
fields.appendChild(createButton(null,
_("Cancel"),
disposeDialog));
dialog = createDialog(null,
@ -2200,7 +2200,7 @@ function _showSelectDialog(title, label, options, button, callbackFcn, callbackA
dialogs[title+label] = dialog;
}
if (defaultValue)
defaultOption = dialog.down('option[value="'+defaultValue+'"]').selected = true;
defaultOption = dialog.down('option[value="'+defaultValue+'"]').selected = true;
if (Prototype.Browser.IE)
jQuery('#bgDialogDiv').css('opacity', 0.4);
jQuery(dialog).fadeIn('fast');
@ -2225,19 +2225,19 @@ function _showAuthenticationDialog(label, callback) {
}
else {
var fields = createElement("p", null, ["prompt"]);
fields.appendChild(document.createTextNode(_("Username:")));
fields.appendChild(document.createTextNode(_("Username:")));
var un_input = createElement("input", null, "textField",
{ type: "text", "value": "" });
fields.appendChild(un_input);
fields.appendChild(document.createTextNode(_("Password:")));
{ type: "text", "value": "" });
fields.appendChild(un_input);
fields.appendChild(document.createTextNode(_("Password:")));
var pw_input = createElement("input", null, "textField",
{ type: "password", "value": "" });
fields.appendChild(pw_input);
{ type: "password", "value": "" });
fields.appendChild(pw_input);
function callbackWrapper() {
callback(un_input.value, pw_input.value);
}
fields.appendChild(createButton(null, _("OK"), callbackWrapper));
fields.appendChild(createButton(null, _("Cancel"), disposeDialog));
fields.appendChild(createButton(null, _("Cancel"), disposeDialog));
dialog = createDialog(null, label, null, fields, "none");
document.body.appendChild(dialog);
dialogs[label] = dialog;