if (field.value == "")
errortext = errortext + labels.error_missingsubject + "\n";
- if (!UIxRecipientSelectorHasRecipients())
+ if (!hasRecipients())
errortext = errortext + labels.error_missingrecipients + "\n";
if (errortext.length > 0) {
var rows = contactsList.getSelectedRowsId();
var rowsWithEmail = 0;
+ if (rows.length == 0)
+ return false;
+
for (var i = 0; i < rows.length; i++) {
var emailCell = $(rows[i]).down('td', 1);
if (emailCell.firstChild) { // .nodeValue is the contact email address
+ "/" + rows[i] + "/write");
}
}
-
+
if (rowsWithEmail == 0) {
window.alert(labels["The selected contact has no email address."]);
}
}
function onMenuSharing(event) {
+ if ($(this).hasClassName("disabled"))
+ return;
+
var folders = $("contactFolders");
var selected = folders.getSelectedNodes()[0];
var owner = selected.getAttribute("owner");
}
}
+function onContactFoldersMenuPrepareVisibility() {
+ var folders = $("contactFolders");
+ var selected = folders.getSelectedNodes();
+
+ if (selected.length > 0) {
+ var folderOwner = selected[0].getAttribute("owner");
+ var sharingOption = $(this).down("ul").childElements().last();
+ // Disable the "Sharing" option when address book is not owned by user
+ if (folderOwner == UserLogin || IsSuperUser)
+ sharingOption.removeClassName("disabled");
+ else
+ sharingOption.addClassName("disabled");
+ }
+}
+
function getMenus() {
var menus = {};
menus["contactFoldersMenu"] = new Array(onMenuModify, "-", null,
onMenuWriteToContact, null, "-",
onMenuDeleteContact);
menus["searchMenu"] = new Array(setSearchCriteria);
-
+
+ var contactFoldersMenu = $("contactFoldersMenu");
+ if (contactFoldersMenu)
+ contactFoldersMenu.prepareVisibility = onContactFoldersMenuPrepareVisibility;
+
return menus;
}
var table = $("contactsList");
if (table) {
// Initialize contacts table
+ table.multiselect = true;
configureSortableTableHeaders(table);
TableKit.Resizable.init(table, {'trueResize' : true, 'keepWidth' : true});
}
}
-addEvent(window, 'load', initContacts);
+FastInit.addOnLoad(initContacts);