Monotone-Parent: c4392a8d8578caf8d80806e5cb77d1c4ee24ccd7

Monotone-Revision: 985f6c7ac0c60b58fa6e6745ff81be38452afa1e

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2007-12-05T17:07:40
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle 2007-12-05 17:07:40 +00:00
parent 1435638871
commit fe1c2b0d18
4 changed files with 31 additions and 47 deletions

View file

@ -255,9 +255,11 @@ function deleteSelectedMessagesCallback(http) {
// row.addClassName("deleted"); // when we'll offer "mark as deleted" // row.addClassName("deleted"); // when we'll offer "mark as deleted"
if (deleteMessageRequestCount == 0) { if (deleteMessageRequestCount == 0) {
if (nextRow) if (nextRow) {
Mailer.currentMessages[Mailer.currentMailbox] = nextRow.getAttribute("id").substr(4); Mailer.currentMessages[Mailer.currentMailbox] = nextRow.getAttribute("id").substr(4);
openMailbox(data["mailbox"], true); nextRow.select();
loadMessage(Mailer.currentMessages[Mailer.currentMailbox]);
}
} }
} }
} }
@ -522,7 +524,10 @@ function messageListCallback(http) {
if (row) { if (row) {
row.select(); row.select();
lastClickedRow = row.rowIndex - $(row).up('table').down('thead').getElementsByTagName('tr').length; lastClickedRow = row.rowIndex - $(row).up('table').down('thead').getElementsByTagName('tr').length;
div.scrollTop = row.rowIndex * row.getHeight(); // scroll to selected message var rowPosition = row.rowIndex * row.getHeight();
if ($(row).up('div').getHeight() > rowPosition)
rowPosition = 0;
div.scrollTop = rowPosition; // scroll to selected message
} }
else else
$("messageContent").update(); $("messageContent").update();
@ -715,7 +720,6 @@ function onMessageSelectionChange() {
if (rows.length == 1) { if (rows.length == 1) {
var idx = rows[0].substr(4); var idx = rows[0].substr(4);
if (Mailer.currentMessages[Mailer.currentMailbox] != idx) { if (Mailer.currentMessages[Mailer.currentMailbox] != idx) {
Mailer.currentMessages[Mailer.currentMailbox] = idx; Mailer.currentMessages[Mailer.currentMailbox] = idx;
loadMessage(idx); loadMessage(idx);

View file

@ -74,7 +74,8 @@ function _editEventId(id, calendar) {
var targetname = "SOGo_edit_" + id; var targetname = "SOGo_edit_" + id;
var win = window.open(urlstr, "_blank", var win = window.open(urlstr, "_blank",
"width=490,height=470,resizable=0"); "width=490,height=470,resizable=0");
win.focus(); if (win)
win.focus();
} }
function editEvent() { function editEvent() {
@ -346,8 +347,8 @@ function eventsListCallback(http) {
startDate.setTime(data[i][4] * 1000); startDate.setTime(data[i][4] * 1000);
row.day = startDate.getDayString(); row.day = startDate.getDayString();
row.hour = startDate.getHourString(); row.hour = startDate.getHourString();
Event.observe(row, "click", Event.observe(row, "mousedown", onRowClick);
onEventClick.bindAsEventListener(row)); Event.observe(row, "selectstart", listRowMouseDownHandler);
Event.observe(row, "dblclick", Event.observe(row, "dblclick",
editDoubleClickedEvent.bindAsEventListener(row)); editDoubleClickedEvent.bindAsEventListener(row));
Event.observe(row, "contextmenu", Event.observe(row, "contextmenu",
@ -919,21 +920,10 @@ function popupCalendar(node) {
function onEventContextMenu(event) { function onEventContextMenu(event) {
var topNode = $("eventsList"); var topNode = $("eventsList");
// log(topNode);
var menu = $("eventsListMenu"); var menu = $("eventsListMenu");
Event.observe(menu, "hideMenu", onEventContextMenuHide); Event.observe(menu, "hideMenu", onEventContextMenuHide);
popupMenu(event, "eventsListMenu", this); popupMenu(event, "eventsListMenu", this);
var topNode = $("eventsList");
var selectedNodes = topNode.getSelectedRows();
topNode.menuSelectedRows = selectedNodes;
for (var i = 0; i < selectedNodes.length; i++)
selectedNodes[i].deselect();
topNode.menuSelectedEntry = this;
this.select();
} }
function onEventContextMenuHide(event) { function onEventContextMenuHide(event) {
@ -943,20 +933,20 @@ function onEventContextMenuHide(event) {
topNode.menuSelectedEntry.deselect(); topNode.menuSelectedEntry.deselect();
topNode.menuSelectedEntry = null; topNode.menuSelectedEntry = null;
} }
if (topNode.menuSelectedRows) {
var nodeIds = topNode.menuSelectedRows;
for (var i = 0; i < nodeIds.length; i++) {
var node = $(nodeIds[i]);
node.select();
}
topNode.menuSelectedRows = null;
}
} }
function onEventsSelectionChange() { function onEventsSelectionChange() {
listOfSelection = this; listOfSelection = this;
this.removeClassName("_unfocused"); this.removeClassName("_unfocused");
$("tasksList").addClassName("_unfocused"); $("tasksList").addClassName("_unfocused");
var rows = this.tBodies[0].getSelectedNodes();
if (rows.length == 1) {
var row = rows[0];
changeCalendarDisplay( { "day": row.day,
"scrollEvent": row.getAttribute("id") } );
changeDateSelectorDisplay(row.day);
}
} }
function onTasksSelectionChange() { function onTasksSelectionChange() {
@ -1048,14 +1038,6 @@ function onListFilterChange() {
return refreshEvents(); return refreshEvents();
} }
function onEventClick(event) {
changeCalendarDisplay( { "day": this.day,
"scrollEvent": this.getAttribute("id") } );
changeDateSelectorDisplay(this.day);
return onRowClick(event);
}
function selectMonthInMenu(menu, month) { function selectMonthInMenu(menu, month) {
var entries = menu.childNodes[1].childNodesWithTag("LI"); var entries = menu.childNodes[1].childNodesWithTag("LI");
for (i = 0; i < entries.length; i++) { for (i = 0; i < entries.length; i++) {
@ -1721,9 +1703,6 @@ function configureLists() {
TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true}); TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true});
Event.observe(list, "mousedown", Event.observe(list, "mousedown",
onEventsSelectionChange.bindAsEventListener(list)); onEventsSelectionChange.bindAsEventListener(list));
var div = list.parentNode;
Event.observe(div, "contextmenu",
onEventContextMenu.bindAsEventListener(div));
} }
function initDateSelectorEvents() { function initDateSelectorEvents() {

View file

@ -140,20 +140,20 @@ function addressFieldLostFocus(sender) {
} }
function removeLastEditedRowIfEmpty() { function removeLastEditedRowIfEmpty() {
var idx, addr, addressList, senderRow; var addr, addressList, senderRow;
idx = lastIndex; addressList = $("addressList").tBodies[0];
if (idx == 0) return;
addr = $('addr_' + idx); if (lastIndex == 0 && addressList.childNodes.length <= 2) return;
addr = $('addr_' + lastIndex);
if (!addr) return; if (!addr) return;
if (addr.value.strip() != '') return; if (addr.value.strip() != '') return;
addr = this.findAddressWithIndex(idx); addr = this.findAddressWithIndex(lastIndex);
if(addr) { if(addr) {
var addresses = $('addr_addresses'); var addresses = $('addr_addresses');
addresses.removeChild(addr); addresses.removeChild(addr);
} }
addressList = $("addressList").tBodies[0]; senderRow = $("row_" + lastIndex);
senderRow = $("row_" + idx);
addressList.removeChild(senderRow); addressList.removeChild(senderRow);
} }

View file

@ -509,9 +509,10 @@ function onRowClick(event) {
} }
var initialSelection = $(node.parentNode).getSelectedNodes(); var initialSelection = $(node.parentNode).getSelectedNodes();
if (initialSelection.length > 0
if (initialSelection.length > 0 && !Event.isLeftClick(event)) && initialSelection.indexOf(node) >= 0
// Ignore non primary-click (ie right-click) && !Event.isLeftClick(event))
// Ignore non primary-click (ie right-click) inside current selection
return true; return true;
if ((event.shiftKey == 1 || event.ctrlKey == 1) if ((event.shiftKey == 1 || event.ctrlKey == 1)