mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-19 04:46:42 +02:00
@@ -921,7 +921,7 @@ export abstract class EgwApp
|
|||||||
let fileSelect = <Et2MergeDialog><unknown>loadWebComponent('et2-merge-dialog', {
|
let fileSelect = <Et2MergeDialog><unknown>loadWebComponent('et2-merge-dialog', {
|
||||||
application: this.appname,
|
application: this.appname,
|
||||||
path: dirs.pop() || ""
|
path: dirs.pop() || ""
|
||||||
}, et2.widgetContainer);
|
}, et2?.widgetContainer ?? null);
|
||||||
if(!et2)
|
if(!et2)
|
||||||
{
|
{
|
||||||
document.body.append(fileSelect);
|
document.body.append(fileSelect);
|
||||||
|
@@ -153,70 +153,73 @@ class calendar_merge extends Api\Storage\Merge
|
|||||||
$ids = json_decode($_REQUEST['id'], true);
|
$ids = json_decode($_REQUEST['id'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to make time span into appropriate ranges to match
|
foreach($_REQUEST['document'] as &$document)
|
||||||
$template = $ids['view'] ?: '';
|
|
||||||
if(stripos($_REQUEST['document'], 'month') !== false || stripos($_REQUEST['document'], lang('month')) !== false)
|
|
||||||
{
|
{
|
||||||
$template = 'month';
|
// Try to make time span into appropriate ranges to match
|
||||||
}
|
$template = $ids['view'] ?: '';
|
||||||
if(stripos($_REQUEST['document'], 'week') !== false || stripos($_REQUEST['document'], lang('week')) !== false)
|
if(stripos($document, 'month') !== false || stripos($document, lang('month')) !== false)
|
||||||
{
|
{
|
||||||
$template = 'week';
|
$template = 'month';
|
||||||
}
|
}
|
||||||
|
if(stripos($document, 'week') !== false || stripos($document, lang('week')) !== false)
|
||||||
|
{
|
||||||
|
$template = 'week';
|
||||||
|
}
|
||||||
|
|
||||||
//error_log("Detected template $template");
|
//error_log("Detected template $template");
|
||||||
$date = $ids['date'];
|
$date = $ids['date'];
|
||||||
$first = $ids['first'];
|
$first = $ids['first'];
|
||||||
$last = $ids['last'];
|
$last = $ids['last'];
|
||||||
|
|
||||||
// Pull dates from session if they're not in the request
|
// Pull dates from session if they're not in the request
|
||||||
if(!array_key_exists('first', $ids))
|
if(!array_key_exists('first', $ids))
|
||||||
{
|
{
|
||||||
$ui = new calendar_ui();
|
$ui = new calendar_ui();
|
||||||
$date = $ui->date;
|
$date = $ui->date;
|
||||||
$first = $ui->first;
|
$first = $ui->first;
|
||||||
$last = $ui->last;
|
$last = $ui->last;
|
||||||
}
|
}
|
||||||
switch($template)
|
switch($template)
|
||||||
{
|
{
|
||||||
case 'month':
|
case 'month':
|
||||||
// Trim to _only_ the month, do not pad to week start / end
|
// Trim to _only_ the month, do not pad to week start / end
|
||||||
$time = new Api\DateTime($date);
|
$time = new Api\DateTime($date);
|
||||||
$timespan = array(array(
|
$timespan = array(array(
|
||||||
'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'),
|
'start' => Api\DateTime::to($time->format('Y-m-01 00:00:00'), 'ts'),
|
||||||
'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts')
|
'end' => Api\DateTime::to($time->format('Y-m-t 23:59:59'), 'ts')
|
||||||
));
|
));
|
||||||
break;
|
|
||||||
case 'week':
|
|
||||||
$timespan = array();
|
|
||||||
$start = new Api\DateTime($first);
|
|
||||||
$end = new Api\DateTime($last);
|
|
||||||
$t = clone $start;
|
|
||||||
$t->modify('+1 week')->modify('-1 second');
|
|
||||||
if($t < $end)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
$timespan[] = array(
|
|
||||||
'start' => $start->format('ts'),
|
|
||||||
'end' => $t->format('ts')
|
|
||||||
);
|
|
||||||
$start->modify('+1 week');
|
|
||||||
$t->modify('+1 week');
|
|
||||||
}
|
|
||||||
while($start < $end);
|
|
||||||
break;
|
break;
|
||||||
}
|
case 'week':
|
||||||
// Fall through
|
$timespan = array();
|
||||||
default:
|
$start = new Api\DateTime($first);
|
||||||
$timespan = array(array(
|
$end = new Api\DateTime($last);
|
||||||
'start' => $first,
|
$t = clone $start;
|
||||||
'end' => $last
|
$t->modify('+1 week')->modify('-1 second');
|
||||||
));
|
if($t < $end)
|
||||||
}
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$timespan[] = array(
|
||||||
|
'start' => $start->format('ts'),
|
||||||
|
'end' => $t->format('ts')
|
||||||
|
);
|
||||||
|
$start->modify('+1 week');
|
||||||
|
$t->modify('+1 week');
|
||||||
|
}
|
||||||
|
while($start < $end);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// Fall through
|
||||||
|
default:
|
||||||
|
$timespan = array(array(
|
||||||
|
'start' => $first,
|
||||||
|
'end' => $last
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// Add path into document
|
// Add path into document
|
||||||
static::check_document($_REQUEST['document'], $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
|
static::check_document($document, $GLOBALS['egw_info']['user']['preferences']['calendar']['document_dir']);
|
||||||
|
}
|
||||||
|
|
||||||
return parent::merge_entries(array_key_exists('0', $ids) ? $ids : $timespan, $document_merge, $options, $return);
|
return parent::merge_entries(array_key_exists('0', $ids) ? $ids : $timespan, $document_merge, $options, $return);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user