moved warning messages to statusbar

This commit is contained in:
michael.buettner%sun.com 2006-07-31 16:24:38 +00:00
Родитель 203f000d26
Коммит 434e29c510
4 изменённых файлов: 47 добавлений и 40 удалений

Просмотреть файл

@ -55,12 +55,12 @@
<xul:vbox id="dialog-box" flex="1">
<xul:label id="read-only-item" value="&newevent.readonly.item.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="read-only-cal" value="&newevent.readonly.cal.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="end-time-warning" value="&newevent.endtime.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="task-repeat-warning" value="&newtodo.repeatstart.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="alarm-start-warning" value="&alarm.start.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="alarm-end-warning" value="&alarm.due.warning;" class="warning-text-class" hidden="true"/>
<xul:label id="read-only-item" value="&newevent.readonly.item.warning;" hidden="true"/>
<xul:label id="read-only-cal" value="&newevent.readonly.cal.warning;" hidden="true"/>
<xul:label id="end-time-warning" value="&newevent.endtime.warning;" hidden="true"/>
<xul:label id="task-repeat-warning" value="&newtodo.repeatstart.warning;" hidden="true"/>
<xul:label id="alarm-start-warning" value="&alarm.start.warning;" hidden="true"/>
<xul:label id="alarm-end-warning" value="&alarm.due.warning;" hidden="true"/>
<xul:grid flex="1">
<xul:columns>
@ -493,8 +493,6 @@
// update alarm checkbox/label/settings button
this.updateAlarm();
this.updateTaskAlarmWarnings();
this.updateURL(item.getProperty("URL"));
// hide rows based on if this is an event or todo
@ -507,9 +505,6 @@
// update datetime pickers
this.updateAllDay();
// update the accept button
this.updateAccept();
// set 'mIsReadOnly' if the calendar is read-only
if (calendar && calendar.readOnly)
this.mIsReadOnly = true;
@ -540,6 +535,9 @@
if (!this.mIsReadOnly)
this.mIsReadOnly = !this.mIsOrganizer;
// update the accept button
this.updateAccept();
if(this.mIsReadOnly) {
var list = document.getAnonymousNodes(this)[0];
var disableElements = list.getElementsByAttribute("disable-on-readonly", "true");
@ -775,9 +773,6 @@
<method name="updateTaskAlarmWarnings">
<body>
<![CDATA[
document.getElementById("alarm-start-warning").setAttribute("hidden", true);
document.getElementById("alarm-end-warning").setAttribute("hidden", true);
var alarmType = getElementValue("item-alarm");
if (!isToDo(window.calendarItem) || alarmType == "none") {
return true;
@ -789,13 +784,13 @@
var alarmRelated = document.getElementById("alarm-trigger-relation").selectedItem.value;
if ((alarmType != "custom" || alarmRelated == "START") && !hasEntryDate) {
document.getElementById("alarm-start-warning").removeAttribute("hidden");
return false;
this.showWarning("alarm-start-warning");
return false;
}
if (alarmRelated == "END" && !hasDueDate) {
document.getElementById("alarm-end-warning").removeAttribute("hidden");
return false;
this.showWarning("alarm-end-warning");
return false;
}
return true;
@ -1036,34 +1031,29 @@
endDate = getElementValue("todo-has-duedate", "checked") ?
jsDateToDateTime(getElementValue("todo-duedate")) : null;
var taskRepeatWarning = document.getElementById("task-repeat-warning");
//@@@ TODO: this needs to be addressed
/*if (!startDate && getElementValue("item-recurrence", "checked")) {
enableAccept = false;
taskRepeatWarning.removeAttribute("hidden");
} else {
taskRepeatWarning.setAttribute("hidden", "true");
}*/
//var taskRepeatWarning = document.getElementById();
//this.showWarning("task-repeat-warning");
//if (!startDate && getElementValue("item-recurrence", "checked")) {
//enableAccept = false;
//taskRepeatWarning.removeAttribute("hidden");
//}
}
var timeWarning = document.getElementById("end-time-warning");
if (endDate && startDate && endDate.compare(startDate) == -1) {
enableAccept = false;
timeWarning.removeAttribute("hidden");
} else {
timeWarning.setAttribute("hidden", "true");
this.showWarning("end-time-warning");
}
// can't add/edit items in readOnly calendars
document.getElementById("read-only-item").setAttribute("hidden", !this.mIsReadOnly);
if (this.mIsReadOnly)
this.showWarning("read-only-item");
var cal = document.getElementById("item-calendar").selectedItem.calendar;
document.getElementById("read-only-cal").setAttribute("hidden",
!cal.readOnly);
if (cal.readOnly)
this.showWarning("read-only-cal");
if (this.mIsReadOnly || cal.readOnly) {
enableAccept = false;
}
if (!this.updateTaskAlarmWarnings()) {
enableAccept = false;
}
@ -1076,6 +1066,18 @@
</body>
</method>
<method name="showWarning">
<parameter name="identifier"/>
<body>
<![CDATA[
var event = document.createEvent('Events');
event.initEvent('warning', true, false);
event.details = document.getElementById(identifier).value;
this.dispatchEvent(event);
]]>
</body>
</method>
<method name="setItemProperty">
<parameter name="item"/>
<parameter name="propertyName"/>

Просмотреть файл

@ -43,10 +43,6 @@ label.label {
text-align: right;
}
.warning-text-class {
color : red;
}
main-page
{
-moz-binding: url("chrome://calendar/content/sun-calendar-event-dialog-main.xml#main-page");

Просмотреть файл

@ -50,6 +50,7 @@ function onLoad()
document.getElementById("sun-calendar-event-dialog").getButton("accept").setAttribute("collapsed","true");
document.getElementById("sun-calendar-event-dialog").getButton("cancel").setAttribute("collapsed","true");
document.getElementById("sun-calendar-event-dialog").getButton("cancel").parentNode.setAttribute("collapsed","true");
var accept = function acceptHandler(event) {
var enableAccept = event.details;
@ -58,10 +59,18 @@ function onLoad()
acceptButton.setAttribute("disabled", "true");
} else if (acceptButton.getAttribute("disabled")) {
acceptButton.removeAttribute("disabled");
var statusbarPanel = document.getElementById("statusbarpanel");
statusbarPanel.removeAttribute("label");
}
};
window.addEventListener('accept', accept, true);
var warning = function warningHandler(event) {
var statusbarPanel = document.getElementById("statusbarpanel");
statusbarPanel.setAttribute("label",event.details);
};
window.addEventListener('warning', warning, true);
// figure out what the title of the dialog should be and set it
updateTitle();

Просмотреть файл

@ -100,7 +100,7 @@
</tabbox>
<statusbar>
<statusbarpanel label="### TODO ###" flex="1"/>
<statusbarpanel id="statusbarpanel" flex="1"/>
</statusbar>
</dialog>