mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-09 10:25:08 +00:00
Monotone-Parent: 10716bba581bb0dd4ad881e814040b2adb37ba10
Monotone-Revision: 305966069ea6e632bec9f09e6fd85e54295efb03 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2008-07-04T09:43:28 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -17,6 +17,8 @@ var attendeesEditor = {
|
||||
states: null
|
||||
};
|
||||
|
||||
/* address completion */
|
||||
|
||||
function onContactKeydown(event) {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
this.focussed = true;
|
||||
@@ -55,50 +57,58 @@ function onContactKeydown(event) {
|
||||
hideMenu(document.currentPopupMenu);
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 38) { // Up arrow
|
||||
if (attendeesEditor.selectedIndex > 0) {
|
||||
var attendees = $('attendeesMenu').select("li");
|
||||
attendees[attendeesEditor.selectedIndex--].removeClassName("selected");
|
||||
this.value = attendees[attendeesEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
attendees[attendeesEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 40) { // Down arrow
|
||||
var attendees = $('attendeesMenu').select("li");
|
||||
if (attendees.size() - 1 > attendeesEditor.selectedIndex) {
|
||||
if (attendeesEditor.selectedIndex >= 0)
|
||||
attendees[attendeesEditor.selectedIndex].removeClassName("selected");
|
||||
attendeesEditor.selectedIndex++;
|
||||
this.value = attendees[attendeesEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
attendees[attendeesEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 13) {
|
||||
preventDefault(event);
|
||||
if (this.confirmedValue)
|
||||
this.value = this.confirmedValue;
|
||||
if (this.uid)
|
||||
this.blur(); // triggers checkAttendee function call
|
||||
$(this).selectText(0, this.value.length);
|
||||
if (document.currentPopupMenu)
|
||||
hideMenu(document.currentPopupMenu);
|
||||
attendeesEditor.selectedIndex = -1;
|
||||
}
|
||||
else if ($('attendeesMenu').getStyle('visibility') == 'visible') {
|
||||
attendeesEditor.currentField = this;
|
||||
if (event.keyCode == 38) { // Up arrow
|
||||
if (attendeesEditor.selectedIndex > 0) {
|
||||
var attendees = $('attendeesMenu').select("li");
|
||||
attendees[attendeesEditor.selectedIndex--].removeClassName("selected");
|
||||
attendees[attendeesEditor.selectedIndex].addClassName("selected");
|
||||
this.value = this.confirmedValue = attendees[attendeesEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
this.uid = attendees[attendeesEditor.selectedIndex].uid;
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 40) { // Down arrow
|
||||
var attendees = $('attendeesMenu').select("li");
|
||||
if (attendees.size() - 1 > attendeesEditor.selectedIndex) {
|
||||
if (attendeesEditor.selectedIndex >= 0)
|
||||
attendees[attendeesEditor.selectedIndex].removeClassName("selected");
|
||||
attendeesEditor.selectedIndex++;
|
||||
attendees[attendeesEditor.selectedIndex].addClassName("selected");
|
||||
this.value = this.confirmedValue = attendees[attendeesEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
this.uid = attendees[attendeesEditor.selectedIndex].uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function performSearch() {
|
||||
if (attendeesEditor.currentField) {
|
||||
if (document.contactLookupAjaxRequest) {
|
||||
// Abort any pending request
|
||||
document.contactLookupAjaxRequest.aborted = true;
|
||||
document.contactLookupAjaxRequest.abort();
|
||||
}
|
||||
if (attendeesEditor.currentField.value.trim().length > 0) {
|
||||
var urlstr = ( UserFolderURL + "Contacts/contactSearch?search="
|
||||
+ escape(attendeesEditor.currentField.value) );
|
||||
document.contactLookupAjaxRequest =
|
||||
triggerAjaxRequest(urlstr, performSearchCallback, attendeesEditor.currentField);
|
||||
}
|
||||
}
|
||||
attendeesEditor.delayedSearch = false;
|
||||
// Perform address completion
|
||||
if (attendeesEditor.currentField) {
|
||||
if (document.contactLookupAjaxRequest) {
|
||||
// Abort any pending request
|
||||
document.contactLookupAjaxRequest.aborted = true;
|
||||
document.contactLookupAjaxRequest.abort();
|
||||
}
|
||||
if (attendeesEditor.currentField.value.trim().length > 0) {
|
||||
var urlstr = ( UserFolderURL + "Contacts/contactSearch?search="
|
||||
+ escape(attendeesEditor.currentField.value) );
|
||||
document.contactLookupAjaxRequest =
|
||||
triggerAjaxRequest(urlstr, performSearchCallback, attendeesEditor.currentField);
|
||||
}
|
||||
}
|
||||
attendeesEditor.delayedSearch = false;
|
||||
}
|
||||
|
||||
function performSearchCallback(http) {
|
||||
@@ -111,6 +121,7 @@ function performSearchCallback(http) {
|
||||
if (http.status == 200) {
|
||||
var start = input.value.length;
|
||||
var data = http.responseText.evalJSON(true);
|
||||
|
||||
if (data.length > 1) {
|
||||
$(list.childNodesWithTag("li")).each(function(item) {
|
||||
item.remove();
|
||||
@@ -163,6 +174,8 @@ function performSearchCallback(http) {
|
||||
input.confirmedValue = completeEmail;
|
||||
var end = input.value.length;
|
||||
$(input).selectText(start, end);
|
||||
|
||||
attendeesEditor.selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,6 +289,8 @@ function onTextMouseDown(event) {
|
||||
}
|
||||
}
|
||||
|
||||
/* address completion */
|
||||
|
||||
function onContactKeydown(event) {
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
this.focussed = true;
|
||||
@@ -316,24 +318,6 @@ function onContactKeydown(event) {
|
||||
hideMenu(document.currentPopupMenu);
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 38) { // Up arrow
|
||||
if (MailEditor.selectedIndex > 0) {
|
||||
var contacts = $('contactsMenu').select("li");
|
||||
contacts[MailEditor.selectedIndex--].removeClassName("selected");
|
||||
this.value = contacts[MailEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
contacts[MailEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 40) { // Down arrow
|
||||
var contacts = $('contactsMenu').select("li");
|
||||
if (contacts.size() - 1 > MailEditor.selectedIndex) {
|
||||
if (MailEditor.selectedIndex >= 0)
|
||||
contacts[MailEditor.selectedIndex].removeClassName("selected");
|
||||
MailEditor.selectedIndex++;
|
||||
this.value = contacts[MailEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
contacts[MailEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 13) {
|
||||
preventDefault(event);
|
||||
if (this.confirmedValue)
|
||||
@@ -343,6 +327,26 @@ function onContactKeydown(event) {
|
||||
hideMenu(document.currentPopupMenu);
|
||||
MailEditor.selectedIndex = -1;
|
||||
}
|
||||
else if ($('contactsMenu').getStyle('visibility') == 'visible') {
|
||||
if (event.keyCode == 38) { // Up arrow
|
||||
if (MailEditor.selectedIndex > 0) {
|
||||
var contacts = $('contactsMenu').select("li");
|
||||
contacts[MailEditor.selectedIndex--].removeClassName("selected");
|
||||
this.value = contacts[MailEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
contacts[MailEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
else if (event.keyCode == 40) { // Down arrow
|
||||
var contacts = $('contactsMenu').select("li");
|
||||
if (contacts.size() - 1 > MailEditor.selectedIndex) {
|
||||
if (MailEditor.selectedIndex >= 0)
|
||||
contacts[MailEditor.selectedIndex].removeClassName("selected");
|
||||
MailEditor.selectedIndex++;
|
||||
this.value = contacts[MailEditor.selectedIndex].firstChild.nodeValue.trim();
|
||||
contacts[MailEditor.selectedIndex].addClassName("selected");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function performSearch() {
|
||||
@@ -354,7 +358,7 @@ function performSearch() {
|
||||
document.contactLookupAjaxRequest.abort();
|
||||
}
|
||||
if (MailEditor.currentField.value.trim().length > 0) {
|
||||
var urlstr = ( UserFolderURL + "Contacts/contactSearch?search="
|
||||
var urlstr = ( UserFolderURL + "Contacts/allContactSearch?search="
|
||||
+ escape(MailEditor.currentField.value) );
|
||||
document.contactLookupAjaxRequest =
|
||||
triggerAjaxRequest(urlstr, performSearchCallback, MailEditor.currentField);
|
||||
@@ -371,20 +375,21 @@ function performSearchCallback(http) {
|
||||
var input = http.callbackData;
|
||||
|
||||
if (http.status == 200) {
|
||||
var start = input.value.length; log(http.responseText);
|
||||
var start = input.value.length;
|
||||
var data = http.responseText.evalJSON(true);
|
||||
|
||||
if (data.length > 1) {
|
||||
$(list.childNodesWithTag("li")).each(function(item) {
|
||||
list.select("li").each(function(item) {
|
||||
item.remove();
|
||||
});
|
||||
|
||||
// Populate popup menu
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var contact = data[i];
|
||||
var completeEmail = contact["name"] + " <" + contact["email"] + ">";
|
||||
var completeEmail = contact["displayName"] + " <" + contact["mail"] + ">";
|
||||
var node = document.createElement("li");
|
||||
list.appendChild(node);
|
||||
node.uid = contact["uid"];
|
||||
node.uid = contact["c_uid"];
|
||||
node.appendChild(document.createTextNode(completeEmail));
|
||||
$(node).observe("mousedown", onAddressResultClick);
|
||||
}
|
||||
@@ -413,18 +418,21 @@ function performSearchCallback(http) {
|
||||
if (data.length == 1) {
|
||||
// Single result
|
||||
var contact = data[0];
|
||||
if (contact["uid"].length > 0)
|
||||
input.uid = contact["uid"];
|
||||
var completeEmail = contact["name"] + " <" + contact["email"] + ">";
|
||||
if (contact["name"].substring(0, input.value.length).toUpperCase()
|
||||
if (contact["c_uid"].length > 0)
|
||||
input.uid = contact["c_uid"];
|
||||
var completeEmail = contact["displayName"] + " <" + contact["mail"] + ">";
|
||||
if (contact["displayName"].substring(0, input.value.length).toUpperCase()
|
||||
== input.value.toUpperCase())
|
||||
input.value = completeEmail;
|
||||
else
|
||||
// The result matches email address, not user name
|
||||
input.value += ' >> ' + completeEmail;
|
||||
input.confirmedValue = completeEmail;
|
||||
|
||||
var end = input.value.length;
|
||||
$(input).selectText(start, end);
|
||||
|
||||
MailEditor.selectedIndex = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,8 @@ SPAN.toolbarButton:active
|
||||
|
||||
/* popups */
|
||||
|
||||
.menu
|
||||
.menu,
|
||||
.popupMenu
|
||||
{ visibility: hidden;
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
@@ -310,7 +311,11 @@ SPAN.toolbarButton:active
|
||||
border-right: 1px solid #424142;
|
||||
border-bottom: 1px solid #424142; }
|
||||
|
||||
.menu UL
|
||||
.popupMenu
|
||||
{ background-color: #fff; }
|
||||
|
||||
.menu UL,
|
||||
.popupMenu UL
|
||||
{ cursor: default;
|
||||
list-style-type: none;
|
||||
list-style-image: none;
|
||||
@@ -322,7 +327,8 @@ SPAN.toolbarButton:active
|
||||
border-right: 1px solid #9e9a92;
|
||||
border-bottom: 1px solid #9e9a92; }
|
||||
|
||||
.menu LI
|
||||
.menu LI,
|
||||
.popupMenu LI
|
||||
{ padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
padding-top: .15em;
|
||||
@@ -332,7 +338,9 @@ SPAN.toolbarButton:active
|
||||
white-space: nowrap; }
|
||||
|
||||
.menu LI.disabled,
|
||||
.menu LI.disabled:hover
|
||||
.popuMenu LI.disabled,
|
||||
.menu LI.disabled:hover,
|
||||
.popupMenu LI.disabled:hover
|
||||
{ color: #999; }
|
||||
|
||||
.menu LI IMG
|
||||
@@ -354,11 +362,14 @@ UL.choiceMenu LI._chosen
|
||||
UL.choiceMenu LI._chosen:hover
|
||||
{ list-style-image: url("menu-check-hover.gif"); }
|
||||
|
||||
.menu LI:hover, .menu LI.selected, .menu LI.submenu-selected
|
||||
.menu LI:hover,
|
||||
.menu LI.selected,
|
||||
.menu LI.submenu-selected
|
||||
{ background-color: #4b6983;
|
||||
color: #fff; }
|
||||
|
||||
.menu LI.separator, .menu LI.separator:hover
|
||||
.menu LI.separator,
|
||||
.menu LI.separator:hover
|
||||
{ padding: 0px;
|
||||
margin: 2px 0px;
|
||||
height: 0px;
|
||||
@@ -621,6 +632,8 @@ LI.denied
|
||||
font-style: italic;
|
||||
color: #f33; }
|
||||
|
||||
.popupMenu LI:hover,
|
||||
.popupMenu LI.selected,
|
||||
LI._selected,
|
||||
TR._selected > TD,
|
||||
TD._selected
|
||||
|
||||
Reference in New Issue
Block a user