forked from extern/egroupware
* 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
This commit is contained in:
parent
4147215b0a
commit
977c0bf482
@ -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'];
|
||||
|
@ -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']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
.calendar_freetime_header { font-size: 120%; font-weight: bold; }
|
||||
.calendar_freetime_timeframe { position: relative;}
|
||||
.calendar_freetime_dow { position: absolute; }
|
||||
|
@ -35,14 +35,13 @@
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="dialogHeader">
|
||||
<description class="calendar_size120b" value="Freetime Search"/>
|
||||
<description class="message" no_lang="1" id="msg"/>
|
||||
<description class="calendar_freetime_header" value="Freetime Search" span="all"/>
|
||||
</row>
|
||||
<row class="dialogOperators high">
|
||||
<row >
|
||||
<description value="Startdate / -time"/>
|
||||
<date-time id="start" statustext="Startdate and -time of the search"/>
|
||||
</row>
|
||||
<row class="dialogOperators">
|
||||
<row>
|
||||
<description value="Duration"/>
|
||||
<hbox>
|
||||
<menulist>
|
||||
@ -51,17 +50,17 @@
|
||||
<date-time id="end" statustext="Enddate / -time of the meeting, eg. for more then one day"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="dialogOperators">
|
||||
<row>
|
||||
<description value="Timeframe"/>
|
||||
<hbox>
|
||||
<hbox class="calendar_freetime_timeframe">
|
||||
<date-timeonly id="start_time" statustext="Timeframe to search"/>
|
||||
<description value="til"/>
|
||||
<date-timeonly id="end_time" statustext="Timeframe to search"/>
|
||||
<description value="Weekdays"/>
|
||||
<listbox type="select-dow" rows="3" id="weekdays" statustext="Weekdays to use in search"/>
|
||||
<select-dow rows="10" id="weekdays" statustext="Weekdays to use in search" class="calendar_freetime_dow"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="dialogOperators">
|
||||
<row>
|
||||
<button label="New search" id="search" statustext="new search with the above parameters"/>
|
||||
<hbox>
|
||||
<menulist>
|
||||
@ -70,14 +69,13 @@
|
||||
<button id="cancel" label="Cancel" statustext="Close the window" onclick="window.close();"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="dialogOperators">
|
||||
<row>
|
||||
<template content="freetime" span="all" id="calendar.freetimesearch.rows"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<styles>
|
||||
.calendar_size120b { text-size: 120%; font-weight: bold; }
|
||||
.end_hide { visibility: hidden; }
|
||||
body { background-color: white; }
|
||||
</styles>
|
||||
</template>
|
||||
</overlay>
|
@ -11,7 +11,7 @@
|
||||
* @package calendar
|
||||
* @version $Id$
|
||||
*/
|
||||
/* $Id: app.css 47456 2014-07-01 12:03:39Z hnategh $ */
|
||||
/* $Id: app.css 48162 2014-08-21 12:20:44Z hnategh $ */
|
||||
/* Header classes */
|
||||
tr.dialogHeader td,
|
||||
tr.dialogHeader2 td,
|
||||
@ -631,6 +631,16 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
|
||||
#calendar-list_delete_popup {
|
||||
display: none;
|
||||
}
|
||||
.calendar_freetime_header {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
}
|
||||
.calendar_freetime_timeframe {
|
||||
position: relative;
|
||||
}
|
||||
.calendar_freetime_dow {
|
||||
position: absolute;
|
||||
}
|
||||
/*generell*/
|
||||
.egw_fw_content_browser_iframe img[src$="svg"] {
|
||||
background-color: #828282 !important;
|
||||
|
@ -106,6 +106,15 @@ var et2_date = et2_inputWidget.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Setting date
|
||||
*
|
||||
* @param {string|number|Date} _value supported are the following formats:
|
||||
* - Date object with usertime as UTC value
|
||||
* - string like Date.toJSON()
|
||||
* - string or number with timestamp in usertime like server-side uses it
|
||||
* - string starting with + or - to add/substract given number of seconds from current value, "+600" to add 10 minutes
|
||||
*/
|
||||
set_value: function(_value) {
|
||||
var old_value = this._oldValue;
|
||||
if(_value === null || _value === "" || _value === undefined ||
|
||||
@ -211,9 +220,17 @@ var et2_date = et2_inputWidget.extend(
|
||||
} else if (typeof _value == 'object' && _value.valueOf) {
|
||||
this.date = _value;
|
||||
} else if (typeof _value == 'number' || !isNaN(_value)) {
|
||||
// Timestamp
|
||||
// JS dates use milliseconds
|
||||
this.date.setTime(parseInt(_value)*1000);
|
||||
// string starting with + or - --> add/substract number of seconds from current value
|
||||
if (typeof _value == 'string' && (_value[0] == '+' || _value[0] == '-'))
|
||||
{
|
||||
this.date.setTime(this.date.getTime()+1000*parseInt(_value));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Timestamp in usertime need to be corrected with timezoneoffset as we internally use UTC for egw usertime
|
||||
// JS dates use milliseconds
|
||||
this.date.setTime(1000*(parseInt(_value)-60*this.date.getTimezoneOffset()));
|
||||
}
|
||||
}
|
||||
|
||||
// Update input - popups do, but framework doesn't
|
||||
|
Loading…
Reference in New Issue
Block a user