From f1cb87aa02b606b7be8457bbce08128974072a09 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 3 Feb 2014 12:03:51 -0500 Subject: [PATCH] Convert JS alerts to CSS dialogs in aptmt editor --- NEWS | 1 + UI/WebServerResources/UIxAppointmentEditor.js | 25 ++++++++++--------- UI/WebServerResources/UIxAttendeesEditor.js | 22 ++++++++-------- UI/WebServerResources/UIxComponentEditor.css | 7 ++++++ 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 1ba21e5cb..8a827024f 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/UI/WebServerResources/UIxAppointmentEditor.js b/UI/WebServerResources/UIxAppointmentEditor.js index c0c451d95..98af88261 100644 --- a/UI/WebServerResources/UIxAppointmentEditor.js +++ b/UI/WebServerResources/UIxAppointmentEditor.js @@ -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(); } diff --git a/UI/WebServerResources/UIxAttendeesEditor.js b/UI/WebServerResources/UIxAttendeesEditor.js index e893129d2..a10f8174c 100644 --- a/UI/WebServerResources/UIxAttendeesEditor.js +++ b/UI/WebServerResources/UIxAttendeesEditor.js @@ -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); diff --git a/UI/WebServerResources/UIxComponentEditor.css b/UI/WebServerResources/UIxComponentEditor.css index 0344c1224..05f0d9018 100644 --- a/UI/WebServerResources/UIxComponentEditor.css +++ b/UI/WebServerResources/UIxComponentEditor.css @@ -1,3 +1,10 @@ +form[name="editform"] +{ position: absolute; + top: 48px; + left: 0; + right: 0; + bottom: 0; } + SELECT#calendarList, SELECT#categoryList, SELECT#priorityList,