Convert JS alerts to CSS dialogs in aptmt editor

pull/17/head
Francis Lachapelle 2014-02-03 12:03:51 -05:00
parent a6424680cc
commit f1cb87aa02
4 changed files with 33 additions and 22 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ Enhancements
- encode messages in quoted-printable when content is bigger than 72 bytes
- we now use binary encoding in memcached (#2587)
- warn user when overbooking a resource by creating an event in its calendar (#2541)
- converted JavaScript alerts to inline CSS dialogs in appointment editor
Bug fixes
- don't load 'background' attribute (#2437)

View File

@ -54,29 +54,29 @@ function validateAptEditor() {
e = $('startTime_date');
if (e.value.length != 10) {
alert(labels.validate_invalid_startdate);
showAlertDialog(labels.validate_invalid_startdate);
return false;
}
startdate = getStartDate();
if (startdate == null) {
alert(labels.validate_invalid_startdate);
showAlertDialog(labels.validate_invalid_startdate);
return false;
}
e = $('endTime_date');
if (e.value.length != 10) {
alert(labels.validate_invalid_enddate);
showAlertDialog(labels.validate_invalid_enddate);
return false;
}
enddate = getEndDate();
if (enddate == null) {
alert(labels.validate_invalid_enddate);
showAlertDialog(labels.validate_invalid_enddate);
return false;
}
tmpdate = uixEarlierDate(startdate, enddate);
if (tmpdate == enddate) {
alert(labels.validate_endbeforestart);
showAlertDialog(labels.validate_endbeforestart);
return false;
}
else if (tmpdate == null /* means: same date */) {
@ -93,23 +93,23 @@ function validateAptEditor() {
endMinute = parseInt(matches[2], 10);
if (startHour > endHour) {
alert(labels.validate_endbeforestart);
showAlertDialog(labels.validate_endbeforestart);
return false;
}
else if (startHour == endHour) {
if (startMinute > endMinute) {
alert(labels.validate_endbeforestart);
showAlertDialog(labels.validate_endbeforestart);
return false;
}
}
}
else {
alert(labels.validate_invalid_enddate);
showAlertDialog(labels.validate_invalid_enddate);
return false;
}
}
else {
alert(labels.validate_invalid_startdate);
showAlertDialog(labels.validate_invalid_startdate);
return false;
}
}
@ -208,7 +208,7 @@ function onEventPostComplete(response) {
}
else {
var message = jsonResponse["message"];
alert(jsonResponse["message"]);
showAlertDialog(jsonResponse["message"]);
}
}
}
@ -326,7 +326,7 @@ function onAdjustTime(event) {
else {
var delta = endDate.valueOf() - startDate.valueOf();
if (delta < 0) {
alert(labels.validate_endbeforestart);
showAlertDialog(labels.validate_endbeforestart);
var oldEndDate = window.getShadowEndDate();
window.setEndDate(oldEndDate);
@ -487,7 +487,7 @@ function initializeAttendeesHref() {
}
function onAttendeesHrefClick(event) {
popupToolbarMenu(this, 'attendeesMenu');
popupMenu(event, 'attendeesMenu', this);
preventDefault(event);
return false;
}
@ -536,6 +536,7 @@ function onAppointmentEditorLoad() {
// Extend JSON representation of attendees
attendees = $H(attendees);
initializeAttendeesHref();
}

View File

@ -1323,17 +1323,19 @@ function onEditorOkClick(event) {
var endDate = getEndDate();
var listener = {
onRequestComplete: function eCH_l_onRequestComplete(handlers, code) {
var label = ("A time conflict exists with one or more attendees.\n"
+ "Would you like to keep the current settings anyway?");
if (code || window.confirm(_(label))) {
_confirmEditorOkClick();
}
}
onRequestComplete: function eCH_l_onRequestComplete(handlers, code) {
if (code) {
_confirmEditorOkClick();
}
else {
var label = ("A time conflict exists with one or more attendees.\n"
+ "Would you like to keep the current settings anyway?");
showConfirmDialog(_('Warning'), _(label), _confirmEditorOkClick);
}
}
};
var conflictHandler = new editorConflictHandler(uids, startDate,
endDate, listener);
var conflictHandler = new editorConflictHandler(uids, startDate, endDate, listener);
conflictHandler.start();
}
@ -1684,7 +1686,7 @@ function onAdjustTime(event) {
// End date was changed
var delta = endDate.valueOf() - startDate.valueOf();
if (delta < 0) {
alert(labels.validate_endbeforestart);
showAlertDialog(labels.validate_endbeforestart);
var oldEndDate = window.getShadowEndDate();
window.setEndDate(oldEndDate);

View File

@ -1,3 +1,10 @@
form[name="editform"]
{ position: absolute;
top: 48px;
left: 0;
right: 0;
bottom: 0; }
SELECT#calendarList,
SELECT#categoryList,
SELECT#priorityList,