tasktype: 'incomplete',
growls: 0,
alarms: [],
+ wrongFormat: $H(),
mapMarker: null,
map: null,
mapInitialized: false,
*/
saveTask: function()
{
+ if (this.wrongFormat.size()) {
+ this.showNotifications([{ type: 'horde.warning', message: Kronolith.text.fix_form_values }]);
+ return;
+ }
+
var tasklist = $F('kronolithTaskList'),
taskid = $F('kronolithTaskId');
this.startLoading('tasks:' + ($F('kronolithTaskCompleted') ? 'complete' : 'incomplete') + tasklist, this.tasktype);
*/
saveEvent: function()
{
+ if (this.wrongFormat.size()) {
+ this.showNotifications([{ type: 'horde.warning', message: Kronolith.text.fix_form_values }]);
+ return;
+ }
+
var cal = $F('kronolithEventTarget'),
eventid = $F('kronolithEventId'),
viewDates = this.viewDates(this.date, this.view),
}
},
+ checkDate: function(e) {
+ var elm = e.element();
+ if ($F(elm)) {
+ var date = Date.parseExact($F(elm), Kronolith.conf.date_format) || Date.parse($F(elm));
+ if (date) {
+ elm.setValue(date.toString(Kronolith.conf.date_format));
+ this.wrongFormat.unset(elm.id);
+ } else {
+ this.showNotifications([{ type: 'horde.warning', message: Kronolith.text.wrong_date_format.interpolate({ wrong: $F(elm), right: new Date().toString(Kronolith.conf.date_format) }) }]);
+ this.wrongFormat.set(elm.id, true);
+ }
+ }
+ },
+
+ checkTime: function(e) {
+ var elm = e.element();
+ if ($F(elm)) {
+ var time = Date.parseExact(new Date().toString(Kronolith.conf.date_format) + ' ' + $F(elm), Kronolith.conf.date_format + ' ' + Kronolith.conf.time_format) || Date.parse(new Date().toString('yyyy-MM-dd ') + $F(elm));
+ if (time) {
+ elm.setValue(time.toString(Kronolith.conf.time_format));
+ this.wrongFormat.unset(elm.id);
+ } else {
+ this.showNotifications([{ type: 'horde.warning', message: Kronolith.text.wrong_time_format.interpolate({ wrong: $F(elm), right: new Date().toString(Kronolith.conf.time_format) }) }]);
+ this.wrongFormat.set(elm.id, true);
+ }
+ }
+ },
+
_closeRedBox: function()
{
var content = RedBox.getWindowContents();
}
});
+ $('kronolithEventStartDate').observe('blur', this.checkDate.bind(this));
+ $('kronolithEventEndDate').observe('blur', this.checkDate.bind(this));
+ $('kronolithTaskDueDate').observe('blur', this.checkDate.bind(this));
+ $('kronolithEventStartTime').observe('blur', this.checkTime.bind(this));
+ $('kronolithEventEndTime').observe('blur', this.checkTime.bind(this));
+ $('kronolithTaskDueTime').observe('blur', this.checkTime.bind(this));
+
// Mouse wheel handler.
[ 'kronolithEventStartDate', 'kronolithEventEndDate' ].each(function(field) {
$(field).observe(Prototype.Browser.Gecko ? 'DOMMouseScroll' : 'mousewheel', function(e) {
'no_url' => _("You must specify a URL."),
'wrong_auth' => _("The authentication information you specified wasn't accepted."),
'geocode_error' => _("Unable to locate requested address"),
+ 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'),
+ 'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'),
+ 'fix_form_values' => _("Please enter correct values in the form first."),
);
for ($i = 1; $i <= 12; ++$i) {
$code['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));