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 = egw_json_response::get();
|
||||||
//$response->addAlert(__METHOD__.'('.array2string($edit_content).')');
|
//$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'])
|
if ($edit_content['duration'])
|
||||||
{
|
{
|
||||||
$edit_content['end'] = $edit_content['start'] + $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 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
|
//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];
|
var editWindowObj = window.opener.etemplate2.getByApplication('calendar')[0];
|
||||||
if (typeof editWindowObj != "undefined")
|
if (typeof editWindowObj != "undefined")
|
||||||
@ -854,8 +848,9 @@ app.classes.calendar = AppJS.extend(
|
|||||||
var endTime = editWindowObj.widgetContainer.getWidgetById('end');
|
var endTime = editWindowObj.widgetContainer.getWidgetById('end');
|
||||||
if (startTime && endTime)
|
if (startTime && endTime)
|
||||||
{
|
{
|
||||||
startTime.set_value(str);
|
startTime.set_value(sTime.get_value());
|
||||||
endTime.set_value(end);
|
endTime.set_value(sTime.get_value());
|
||||||
|
endTime.set_value('+'+content['duration']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,3 +628,7 @@ e.g. the div with class calendar_calTimeGrid is generated by the timeGridWidget
|
|||||||
#calendar-list_undelete_popup, #calendar-list_delete_popup {
|
#calendar-list_undelete_popup, #calendar-list_delete_popup {
|
||||||
display: none;
|
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>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row class="dialogHeader">
|
<row class="dialogHeader">
|
||||||
<description class="calendar_size120b" value="Freetime Search"/>
|
<description class="calendar_freetime_header" value="Freetime Search" span="all"/>
|
||||||
<description class="message" no_lang="1" id="msg"/>
|
|
||||||
</row>
|
</row>
|
||||||
<row class="dialogOperators high">
|
<row >
|
||||||
<description value="Startdate / -time"/>
|
<description value="Startdate / -time"/>
|
||||||
<date-time id="start" statustext="Startdate and -time of the search"/>
|
<date-time id="start" statustext="Startdate and -time of the search"/>
|
||||||
</row>
|
</row>
|
||||||
<row class="dialogOperators">
|
<row>
|
||||||
<description value="Duration"/>
|
<description value="Duration"/>
|
||||||
<hbox>
|
<hbox>
|
||||||
<menulist>
|
<menulist>
|
||||||
@ -51,17 +50,17 @@
|
|||||||
<date-time id="end" statustext="Enddate / -time of the meeting, eg. for more then one day"/>
|
<date-time id="end" statustext="Enddate / -time of the meeting, eg. for more then one day"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</row>
|
</row>
|
||||||
<row class="dialogOperators">
|
<row>
|
||||||
<description value="Timeframe"/>
|
<description value="Timeframe"/>
|
||||||
<hbox>
|
<hbox class="calendar_freetime_timeframe">
|
||||||
<date-timeonly id="start_time" statustext="Timeframe to search"/>
|
<date-timeonly id="start_time" statustext="Timeframe to search"/>
|
||||||
<description value="til"/>
|
<description value="til"/>
|
||||||
<date-timeonly id="end_time" statustext="Timeframe to search"/>
|
<date-timeonly id="end_time" statustext="Timeframe to search"/>
|
||||||
<description value="Weekdays"/>
|
<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>
|
</hbox>
|
||||||
</row>
|
</row>
|
||||||
<row class="dialogOperators">
|
<row>
|
||||||
<button label="New search" id="search" statustext="new search with the above parameters"/>
|
<button label="New search" id="search" statustext="new search with the above parameters"/>
|
||||||
<hbox>
|
<hbox>
|
||||||
<menulist>
|
<menulist>
|
||||||
@ -70,14 +69,13 @@
|
|||||||
<button id="cancel" label="Cancel" statustext="Close the window" onclick="window.close();"/>
|
<button id="cancel" label="Cancel" statustext="Close the window" onclick="window.close();"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</row>
|
</row>
|
||||||
<row class="dialogOperators">
|
<row>
|
||||||
<template content="freetime" span="all" id="calendar.freetimesearch.rows"/>
|
<template content="freetime" span="all" id="calendar.freetimesearch.rows"/>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<styles>
|
<styles>
|
||||||
.calendar_size120b { text-size: 120%; font-weight: bold; }
|
body { background-color: white; }
|
||||||
.end_hide { visibility: hidden; }
|
|
||||||
</styles>
|
</styles>
|
||||||
</template>
|
</template>
|
||||||
</overlay>
|
</overlay>
|
@ -11,7 +11,7 @@
|
|||||||
* @package calendar
|
* @package calendar
|
||||||
* @version $Id$
|
* @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 */
|
/* Header classes */
|
||||||
tr.dialogHeader td,
|
tr.dialogHeader td,
|
||||||
tr.dialogHeader2 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 {
|
#calendar-list_delete_popup {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
.calendar_freetime_header {
|
||||||
|
font-size: 120%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.calendar_freetime_timeframe {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.calendar_freetime_dow {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
/*generell*/
|
/*generell*/
|
||||||
.egw_fw_content_browser_iframe img[src$="svg"] {
|
.egw_fw_content_browser_iframe img[src$="svg"] {
|
||||||
background-color: #828282 !important;
|
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) {
|
set_value: function(_value) {
|
||||||
var old_value = this._oldValue;
|
var old_value = this._oldValue;
|
||||||
if(_value === null || _value === "" || _value === undefined ||
|
if(_value === null || _value === "" || _value === undefined ||
|
||||||
@ -211,9 +220,17 @@ var et2_date = et2_inputWidget.extend(
|
|||||||
} else if (typeof _value == 'object' && _value.valueOf) {
|
} else if (typeof _value == 'object' && _value.valueOf) {
|
||||||
this.date = _value;
|
this.date = _value;
|
||||||
} else if (typeof _value == 'number' || !isNaN(_value)) {
|
} else if (typeof _value == 'number' || !isNaN(_value)) {
|
||||||
// Timestamp
|
// string starting with + or - --> add/substract number of seconds from current value
|
||||||
// JS dates use milliseconds
|
if (typeof _value == 'string' && (_value[0] == '+' || _value[0] == '-'))
|
||||||
this.date.setTime(parseInt(_value)*1000);
|
{
|
||||||
|
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
|
// Update input - popups do, but framework doesn't
|
||||||
|
Loading…
Reference in New Issue
Block a user