Monotone-Parent: 54c85a5614fa048abcccf4fa8fca5d26070fe53f

Monotone-Revision: aff338d65b5e579727f2177355e636b8689e074d

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-10-18T21:53:47
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-10-18 21:53:47 +00:00
parent df35bb01fd
commit b21593277d
7 changed files with 88 additions and 48 deletions

View File

@@ -1,5 +1,9 @@
2006-10-18 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* UI/WebServerResources/UIxMailEditor.js: update the algorithm
that handles the creation of new fields with the new APIs and the
new node structure on the page.
* UI/Scheduler/UIxAppointmentEditor.m,
UI/Scheduler/UIxTaskEditor.m:
refactored to user UIxComponentEditor as parent class.

View File

@@ -15,6 +15,9 @@ var cachedDateSelectors = new Array();
var contactSelectorAction = 'calendars-contacts';
var eventsToDelete = new Array();
var ownersOfEventsToDelete = new Array();
function newEvent(sender, type) {
var day = sender.getAttribute("day");
if (!day)
@@ -61,19 +64,14 @@ function editEvent() {
return false; /* stop following the link */
}
function _batchDeleteEvents(events, owner) {
function _batchDeleteEvents() {
var events = eventsToDelete.shift();
var owner = ownersOfEventsToDelete.shift();
var urlstr = (UserFolderURL + "../" + owner + "/Calendar/batchDelete?ids="
+ events.join('/'));
if (document.deleteEventAjaxRequest) {
document.deleteEventAjaxRequest.nextUrls.push(urlstr);
document.deleteEventAjaxRequest.callbackData.push(events);
} else {
document.deleteEventAjaxRequest = triggerAjaxRequest(urlstr,
deleteEventCallback,
events);
document.deleteEventAjaxRequest.nextUrls = new Array();
document.deleteEventAjaxRequest.callbackData = new Array();
}
document.deleteEventAjaxRequest = triggerAjaxRequest(urlstr,
deleteEventCallback,
events);
}
function deleteEvent()
@@ -83,20 +81,26 @@ function deleteEvent()
if (nodes.length > 0) {
if (confirm(labels["appointmentDeleteConfirmation"].decodeEntities())) {
if (document.deleteEventAjaxRequest) {
document.deleteEventAjaxRequest.aborted = true;
document.deleteEventAjaxRequest.abort();
}
var sortedNodes = new Array();
var owners = new Array();
for (var i = 0; i < nodes.length; i++) {
var owner = nodes[i].getAttribute("owner");
if (!sortedNodes[owner])
{
if (!sortedNodes[owner]) {
sortedNodes[owner] = new Array();
owners.push(owner);
}
}
sortedNodes[owner].push(nodes[i].getAttribute("id"));
}
for (var i = 0; i < owners.length; i++)
_batchDeleteEvents(sortedNodes[owners[i]], owners[i]);
for (var i = 0; i < owners.length; i++) {
ownersOfEventsToDelete.push(owners[i]);
eventsToDelete.push(sortedNodes[owners[i]]);
}
_batchDeleteEvents();
}
}
}
@@ -104,32 +108,23 @@ function deleteEvent()
return false;
}
/* ugly piece of non-working code.
If you want to implement chained ajax events, implement it correctly!! */
function deleteEventCallback(http)
{
if (http.readyState == 4
&& http.status == 200) {
var nodes = null;
if (document.deleteEventAjaxRequest.nextUrls.length) {
var nextUrls = document.deleteEventAjaxRequest.nextUrls;
var nextCBd = document.deleteEventAjaxRequest.callbackData;
nodes = $(nextCBd.shift());
document.deleteEventAjaxRequest
= triggerAjaxRequest(nextUrls.shift(),
deleteEventCallback,
nextCBd);
document.deleteEventAjaxRequest.nextUrls = nextUrls;
document.deleteEventAjaxRequest.callbackData = nextCBd;
} else {
document.deleteEventAjaxRequest = null;
nodes = $(http.callbackData);
}
var nodes = $(http.callbackData);
for (var i = 0; i < nodes.length; i++) {
var node = $(nodes[i]);
node.parentNode.removeChild(node);
}
if (eventsToDelete.length)
_batchDeleteEvents();
else {
document.deleteEventAjaxRequest = null;
refreshAppointments();
refreshTasks();
changeCalendarDisplay();
}
}
else
log ("ajax fuckage");
@@ -428,7 +423,7 @@ function calendarDisplayCallback(http)
currentDay = http.callbackData["day"];
var hour = null;
if (http.callbackData["hour"])
hour = http.callbackData["hour"]
hour = http.callbackData["hour"];
scrollDayView(hour);
}
else
@@ -549,6 +544,12 @@ function refreshTasks() {
return _loadTasksHref("taskslist?hide-completed=" + hideCompletedTasks);
}
function refreshAppointmentsAndDisplay()
{
refreshAppointments();
changeCalendarDisplay();
}
function onListFilterChange() {
var node = $("filterpopup");

View File

@@ -19,7 +19,7 @@
02111-1307, USA.
*/
var contactSelectorAction = 'scheduler-contacts';
var contactSelectorAction = 'calendars-contacts';
function uixEarlierDate(date1, date2) {
// can this be done in a sane way?

View File

@@ -8,14 +8,13 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail)
neededOptionValue = 1;
else if (tag == "bcc")
neededOptionValue = 2;
var rows = $("addressList").childNodes;
var stop = false;
var counter = 0;
var currentRow = $('row_' + counter);
while (currentRow
&& !stop) {
var currentValue = currentRow.childNodes[0].childNodes[0].value;
var currentValue = currentRow.childNodesWithTag("span")[1].childNodesWithTag("input")[0].value;
if (currentValue == neededOptionValue) {
stop = true;
insertContact($("addr_" + counter), contactName, contactEmail);
@@ -26,7 +25,7 @@ function addContact(tag, fullContactName, contactId, contactName, contactEmail)
if (!stop) {
fancyAddRow(false, "");
$("row_" + counter).childNodes[0].childNodes[0].value
$("row_" + counter).childNodesWithTag("span")[0].childNodesWithTag("select")[0].value
= neededOptionValue;
insertContact($("addr_" + counter), contactName, contactEmail);
}
@@ -70,3 +69,36 @@ function insertContact(inputNode, contactName, contactEmail) {
inputNode.value = value;
}
function toggleAttachments() {
var div = $("attachmentsArea");
if (div.style.display)
div.style.display = "";
else
div.style.display = "block;";
return false;
}
function updateInlineAttachmentList(sender, attachments) {
var count = 0;
var div = $("attachmentsArea");
if (attachments)
count = attachments.length;
if (count)
{
var text = "";
for (var i = 0; i < count; i++) {
text = text + attachments[i];
text = text + '<br />';
}
var e = $('compose_attachments_list');
e.innerHTML = text;
if (!div.style.display)
div.style.display = "block;";
}
else
div.style.display = "";
}

View File

@@ -87,7 +87,7 @@ function fancyAddRow(shouldEdit, text) {
addr = $('addr_' + lastIndex);
if (addr && addr.value == '') {
input = $('compose_subject_input');
input = $('subjectField');
if (input && input.value != '') {
input.focus();
input.select();
@@ -95,19 +95,20 @@ function fancyAddRow(shouldEdit, text) {
}
}
addressList = $("addressList");
lastChild = $('row_last');
lastChild = $("lastRow");
currentIndex++;
proto = $('row_' + lastIndex);
row = proto.cloneNode(true);
row.id = 'row_' + currentIndex;
// select popup
select = row.childNodes[0].childNodes[0];
var rowNodes = row.childNodesWithTag("span");
select = rowNodes[0].childNodesWithTag("select")[0];
select.name = 'popup_' + currentIndex;
select.value = proto.childNodes[0].childNodes[0].value;
input = row.childNodes[1];
// select.value = row.childNodesWithTag("span")[0].childNodesWithTag("select")[0].value;
input = rowNodes[1].childNodesWithTag("input")[0];
input.name = 'addr_' + currentIndex;
input.id = 'addr_' + currentIndex;
input.value = text;

View File

@@ -19,7 +19,7 @@
02111-1307, USA.
*/
var contactSelectorAction = 'scheduler-contacts';
var contactSelectorAction = 'calendars-contacts';
function uixEarlierDate(date1, date2) {
// can this be done in a sane way?

View File

@@ -892,10 +892,12 @@ function initCriteria()
function onContactAdd(node)
{
var selector = node.parentNode.parentNode;
var selector = null;
var selectorUrl = '?popup=YES';
if (node)
if (node) {
selector = node.parentNode.parentNode;
selectorUrl += ("&selectorId=" + selector.getAttribute("id"));
}
urlstr = ApplicationBaseURL;
if (urlstr[urlstr.length-1] != '/')