Monotone-Parent: bd6b8b8b6b9626985ced43786ab71d976da25933
Monotone-Revision: c3158529cb4ab65ea318a0f12e4853921d68d6ed Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-23T14:56:58 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
3913382a10
commit
262d341af3
|
@ -1,184 +1,188 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2005 SKYRIX Software AG
|
Copyright (C) 2005 SKYRIX Software AG
|
||||||
|
|
||||||
This file is part of OpenGroupware.org.
|
This file is part of SOGo.
|
||||||
|
|
||||||
OGo is free software; you can redistribute it and/or modify it under
|
OGo 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
|
the terms of the GNU Lesser General Public License as published by the
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
Free Software Foundation; either version 2, or (at your option) any
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
License for more details.
|
License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with OGo; see the file COPYING. If not, write to the
|
License along with OGo; see the file COPYING. If not, write to the
|
||||||
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||||
02111-1307, USA.
|
02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var contactSelectorAction = 'calendars-contacts';
|
var contactSelectorAction = 'calendars-contacts';
|
||||||
|
|
||||||
function uixEarlierDate(date1, date2) {
|
function uixEarlierDate(date1, date2) {
|
||||||
// can this be done in a sane way?
|
// can this be done in a sane way?
|
||||||
// cuicui = 'year';
|
// cuicui = 'year';
|
||||||
if (date1.getYear() < date2.getYear()) return date1;
|
if (date1 && date2) {
|
||||||
if (date1.getYear() > date2.getYear()) return date2;
|
if (date1.getYear() < date2.getYear()) return date1;
|
||||||
// same year
|
if (date1.getYear() > date2.getYear()) return date2;
|
||||||
// cuicui += '/month';
|
// same year
|
||||||
if (date1.getMonth() < date2.getMonth()) return date1;
|
// cuicui += '/month';
|
||||||
if (date1.getMonth() > date2.getMonth()) return date2;
|
if (date1.getMonth() < date2.getMonth()) return date1;
|
||||||
// // same month
|
if (date1.getMonth() > date2.getMonth()) return date2;
|
||||||
// cuicui += '/date';
|
// // same month
|
||||||
if (date1.getDate() < date2.getDate()) return date1;
|
// cuicui += '/date';
|
||||||
if (date1.getDate() > date2.getDate()) return date2;
|
if (date1.getDate() < date2.getDate()) return date1;
|
||||||
// same day
|
if (date1.getDate() > date2.getDate()) return date2;
|
||||||
return null;
|
}
|
||||||
|
// same day
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateDate(date, label) {
|
||||||
|
var result, dateValue;
|
||||||
|
|
||||||
|
dateValue = date.calendar.prs_date(date.value);
|
||||||
|
if (date.value.length != 10 || !dateValue) {
|
||||||
|
alert(label.decodeEntities());
|
||||||
|
result = false;
|
||||||
|
} else
|
||||||
|
result = dateValue;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateAptEditor() {
|
function validateAptEditor() {
|
||||||
var e, startdate, enddate, tmpdate;
|
var e, startdate, enddate, tmpdate;
|
||||||
|
|
||||||
e = document.getElementById('summary');
|
e = document.getElementById('summary');
|
||||||
if (e.value.length == 0) {
|
if (e.value.length == 0
|
||||||
if (!confirm(labels.validate_notitle.decodeEntities()))
|
&& !confirm(labels.validate_notitle.decodeEntities()))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
e = document.getElementById('startTime_date');
|
e = document.getElementById('startTime_date');
|
||||||
if (!e.disabled) {
|
if (!e.disabled) {
|
||||||
if (e.value.length != 10) {
|
startdate = validateDate(e, labels.validate_invalid_startdate);
|
||||||
alert(labels.validate_invalid_startdate.decodeEntities());
|
if (!startdate)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
startdate = e.calendar.prs_date(e.value);
|
|
||||||
if (startdate == null) {
|
e = document.getElementById('dueTime_date');
|
||||||
alert(labels.validate_invalid_startdate.decodeEntities());
|
if (!e.disabled) {
|
||||||
return false;
|
enddate = validateDate(e, labels.validate_invalid_enddate);
|
||||||
}
|
if (!enddate)
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
e = document.getElementById('dueTime_date');
|
|
||||||
if (!e.disabled) {
|
if (startdate && enddate) {
|
||||||
if (e.value.length != 10) {
|
tmpdate = uixEarlierDate(startdate, enddate);
|
||||||
alert(labels.validate_invalid_enddate.decodeEntities());
|
if (tmpdate == enddate) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
enddate = e.calendar.prs_date(e.value);
|
|
||||||
if (enddate == null) {
|
|
||||||
alert(labels.validate_invalid_enddate.decodeEntities());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// cuicui = '';
|
|
||||||
tmpdate = uixEarlierDate(startdate, enddate);
|
|
||||||
if (tmpdate == enddate) {
|
|
||||||
// window.alert(cuicui);
|
// window.alert(cuicui);
|
||||||
alert(labels.validate_endbeforestart.decodeEntities());
|
alert(labels.validate_endbeforestart.decodeEntities());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (tmpdate == null /* means: same date */) {
|
else if (tmpdate == null /* means: same date */) {
|
||||||
// TODO: check time
|
// TODO: check time
|
||||||
var start, end;
|
var start, end;
|
||||||
|
|
||||||
start = parseInt(document.forms[0]['startTime_time_hour'].value);
|
start = parseInt(document.forms[0]['startTime_time_hour'].value);
|
||||||
end = parseInt(document.forms[0]['dueTime_time_hour'].value);
|
end = parseInt(document.forms[0]['dueTime_time_hour'].value);
|
||||||
|
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
alert(labels.validate_endbeforestart.decodeEntities());
|
alert(labels.validate_endbeforestart.decodeEntities());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (start == end) {
|
else if (start == end) {
|
||||||
start = parseInt(document.forms[0]['startTime_time_minute'].value);
|
start = parseInt(document.forms[0]['startTime_time_minute'].value);
|
||||||
end = parseInt(document.forms[0]['dueTime_time_minute'].value);
|
end = parseInt(document.forms[0]['dueTime_time_minute'].value);
|
||||||
if (start > end) {
|
if (start > end) {
|
||||||
alert(labels.validate_endbeforestart.decodeEntities());
|
alert(labels.validate_endbeforestart.decodeEntities());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleDetails() {
|
function toggleDetails() {
|
||||||
var div = $("details");
|
var div = $("details");
|
||||||
var buttons = $("buttons");
|
var buttons = $("buttons");
|
||||||
var buttonsHeight = buttons.clientHeight * 3;
|
var buttonsHeight = buttons.clientHeight * 3;
|
||||||
|
|
||||||
if (div.style.visibility) {
|
if (div.style.visibility) {
|
||||||
div.style.visibility = null;
|
div.style.visibility = null;
|
||||||
window.resizeBy(0, -(div.clientHeight + buttonsHeight));
|
window.resizeBy(0, -(div.clientHeight + buttonsHeight));
|
||||||
$("detailsButton").innerHTML = labels["Show Details"];
|
$("detailsButton").innerHTML = labels["Show Details"];
|
||||||
} else {
|
} else {
|
||||||
div.style.visibility = 'visible;';
|
div.style.visibility = 'visible;';
|
||||||
window.resizeBy(0, (div.clientHeight + buttonsHeight));
|
window.resizeBy(0, (div.clientHeight + buttonsHeight));
|
||||||
$("detailsButton").innerHTML = labels["Hide Details"];
|
$("detailsButton").innerHTML = labels["Hide Details"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleCycleVisibility(node, nodeName, hiddenValue) {
|
function toggleCycleVisibility(node, nodeName, hiddenValue) {
|
||||||
var spanNode = $(nodeName);
|
var spanNode = $(nodeName);
|
||||||
var newVisibility = ((node.value == hiddenValue) ? null : 'visible;');
|
var newVisibility = ((node.value == hiddenValue) ? null : 'visible;');
|
||||||
spanNode.style.visibility = newVisibility;
|
spanNode.style.visibility = newVisibility;
|
||||||
|
|
||||||
if (nodeName == 'cycleSelectionFirstLevel') {
|
if (nodeName == 'cycleSelectionFirstLevel') {
|
||||||
var otherSpanNode = $('cycleSelectionSecondLevel');
|
var otherSpanNode = $('cycleSelectionSecondLevel');
|
||||||
if (!newVisibility)
|
if (!newVisibility)
|
||||||
{
|
{
|
||||||
otherSpanNode.superVisibility = otherSpanNode.style.visibility;
|
otherSpanNode.superVisibility = otherSpanNode.style.visibility;
|
||||||
otherSpanNode.style.visibility = null;
|
otherSpanNode.style.visibility = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
otherSpanNode.style.visibility = otherSpanNode.superVisibility;
|
otherSpanNode.style.visibility = otherSpanNode.superVisibility;
|
||||||
otherSpanNode.superVisibility = null;
|
otherSpanNode.superVisibility = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addContact(tag, fullContactName, contactId, contactName, contactEmail)
|
function addContact(tag, fullContactName, contactId, contactName, contactEmail)
|
||||||
{
|
{
|
||||||
var uids = $('uixselector-participants-uidList');
|
var uids = $('uixselector-participants-uidList');
|
||||||
log ("contactId: " + contactId);
|
log ("contactId: " + contactId);
|
||||||
if (contactId)
|
if (contactId)
|
||||||
{
|
{
|
||||||
var re = new RegExp("(^|,)" + contactId + "($|,)");
|
var re = new RegExp("(^|,)" + contactId + "($|,)");
|
||||||
|
|
||||||
log ("uids: " + uids);
|
log ("uids: " + uids);
|
||||||
if (!re.test(uids.value))
|
if (!re.test(uids.value))
|
||||||
{
|
{
|
||||||
log ("no match... realling adding");
|
log ("no match... realling adding");
|
||||||
if (uids.value.length > 0)
|
if (uids.value.length > 0)
|
||||||
uids.value += ',' + contactId;
|
uids.value += ',' + contactId;
|
||||||
else
|
else
|
||||||
uids.value = contactId;
|
uids.value = contactId;
|
||||||
|
|
||||||
log ('values: ' + uids.value);
|
log ('values: ' + uids.value);
|
||||||
var names = $('uixselector-participants-display');
|
var names = $('uixselector-participants-display');
|
||||||
names.innerHTML += ('<li onmousedown="return false;"'
|
names.innerHTML += ('<li onmousedown="return false;"'
|
||||||
+ ' onclick="onRowClick(event);"><img src="'
|
+ ' onclick="onRowClick(event);"><img src="'
|
||||||
+ ResourcesURL + '/abcard.gif" />'
|
+ ResourcesURL + '/abcard.gif" />'
|
||||||
+ contactName + '</li>');
|
+ contactName + '</li>');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log ("match... ignoring contact");
|
log ("match... ignoring contact");
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTimeControlCheck(checkBox) {
|
function onTimeControlCheck(checkBox) {
|
||||||
var inputs = checkBox.parentNode.getElementsByTagName("input");
|
var inputs = checkBox.parentNode.getElementsByTagName("input");
|
||||||
var selects = checkBox.parentNode.getElementsByTagName("select");
|
var selects = checkBox.parentNode.getElementsByTagName("select");
|
||||||
for (var i = 0; i < inputs.length; i++)
|
for (var i = 0; i < inputs.length; i++)
|
||||||
if (inputs[i] != checkBox)
|
if (inputs[i] != checkBox)
|
||||||
inputs[i].disabled = !checkBox.checked;
|
inputs[i].disabled = !checkBox.checked;
|
||||||
for (var i = 0; i < selects.length; i++)
|
for (var i = 0; i < selects.length; i++)
|
||||||
if (selects[i] != checkBox)
|
if (selects[i] != checkBox)
|
||||||
selects[i].disabled = !checkBox.checked;
|
selects[i].disabled = !checkBox.checked;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue