From 977c0bf48222cbfb1aa810c886a83a52f51b776f Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 4 Sep 2014 14:34:06 +0000 Subject: [PATCH] * Calendar: fixed freetime search to correctly read and set times from edit window - fixed et2_date.set_value() to understand nummeric timestamps in usertime used on server-side (needed timezone offset) - added new parameter-type for et2_date.set_value() string starting with + or - to add or subtract given number of seconds from current time (to not have to code that in applications) r48463: some styling for freetime search --- calendar/inc/class.calendar_uiforms.inc.php | 10 ++++++++ calendar/js/app.js | 13 ++++------- calendar/templates/default/app.css | 6 ++++- calendar/templates/default/freetimesearch.xet | 20 ++++++++-------- calendar/templates/pixelegg/app.css | 12 +++++++++- etemplate/js/et2_widget_date.js | 23 ++++++++++++++++--- 6 files changed, 59 insertions(+), 25 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 061f0a04f8..c7ac6308da 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1920,6 +1920,16 @@ class calendar_uiforms extends calendar_ui $response = egw_json_response::get(); //$response->addAlert(__METHOD__.'('.array2string($edit_content).')'); + // convert start/end date-time values to timestamps + foreach(array('start', 'end') as $name) + { + if (!empty($edit_content[$name])) + { + $date = new egw_time($edit_content[$name]); + $edit_content[$name] = $date->format('ts'); + } + } + if ($edit_content['duration']) { $edit_content['end'] = $edit_content['start'] + $edit_content['duration']; diff --git a/calendar/js/app.js b/calendar/js/app.js index be25053d13..542e76aecd 100644 --- a/calendar/js/app.js +++ b/calendar/js/app.js @@ -838,14 +838,8 @@ app.classes.calendar = AppJS.extend( var sTime = this.et2.getWidgetById(selectedId+'start'); - var eTime = this.et2.getWidgetById(selectedId+'[end]'); - //Catches the start time from freetime content - var str = sTime.get_value(); - - var end = parseInt(str) + parseInt(content['duration']); - //check the parent window is still open before to try to access it - if (window.opener) + if (window.opener && sTime) { var editWindowObj = window.opener.etemplate2.getByApplication('calendar')[0]; if (typeof editWindowObj != "undefined") @@ -854,8 +848,9 @@ app.classes.calendar = AppJS.extend( var endTime = editWindowObj.widgetContainer.getWidgetById('end'); if (startTime && endTime) { - startTime.set_value(str); - endTime.set_value(end); + startTime.set_value(sTime.get_value()); + endTime.set_value(sTime.get_value()); + endTime.set_value('+'+content['duration']); } } } diff --git a/calendar/templates/default/app.css b/calendar/templates/default/app.css index 308a8e44df..e3ec16fe0c 100644 --- a/calendar/templates/default/app.css +++ b/calendar/templates/default/app.css @@ -627,4 +627,8 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget #calendar-list_undelete_popup, #calendar-list_delete_popup { display: none; -} \ No newline at end of file +} + +.calendar_freetime_header { font-size: 120%; font-weight: bold; } +.calendar_freetime_timeframe { position: relative;} +.calendar_freetime_dow { position: absolute; } diff --git a/calendar/templates/default/freetimesearch.xet b/calendar/templates/default/freetimesearch.xet index bf2d072f1a..ca10c54ffa 100644 --- a/calendar/templates/default/freetimesearch.xet +++ b/calendar/templates/default/freetimesearch.xet @@ -35,14 +35,13 @@ - - + - + - + @@ -51,17 +50,17 @@ - + - + - + - +