Fix planner events

- Createing event by clicking on row had wrong end date
- Display problems from previous commit
This commit is contained in:
Nathan Gray 2015-11-17 17:59:23 +00:00
parent 676a576dbc
commit 0df5d6f207
4 changed files with 19 additions and 12 deletions

View File

@ -116,11 +116,18 @@ class calendar_uiforms extends calendar_ui
// by default include the owner as participant (the user can remove him)
$extra_participants[] = $owner;
$start = $this->bo->date2ts(array(
'full' => isset($_GET['date']) && (int) $_GET['date'] ? (int) $_GET['date'] : $this->date,
'hour' => (int) (isset($_GET['hour']) && (int) $_GET['hour'] ? $_GET['hour'] : $this->bo->cal_prefs['workdaystarts']),
'minute' => (int) $_GET['minute'],
));
if(isset($_GET['start']))
{
$start = egw_time::to($_GET['start'], 'ts');
}
else
{
$start = $this->bo->date2ts(array(
'full' => isset($_GET['date']) && (int) $_GET['date'] ? (int) $_GET['date'] : $this->date,
'hour' => (int) (isset($_GET['hour']) && (int) $_GET['hour'] ? $_GET['hour'] : $this->bo->cal_prefs['workdaystarts']),
'minute' => (int) $_GET['minute'],
));
}
//echo "<p>_GET[date]=$_GET[date], _GET[hour]=$_GET[hour], _GET[minute]=$_GET[minute], this->date=$this->date ==> start=$start=".date('Y-m-d H:i',$start)."</p>\n";
$participant_types['u'] = $participant_types = $participants = array();
@ -1393,8 +1400,8 @@ foreach($recur_event as $_k => $_v) error_log($_k . ': ' . array2string($_v));
}
}
// set new start and end if given by $_GET
if(isset($_GET['start'])) { $event['start'] = $_GET['start']; }
if(isset($_GET['end'])) { $event['end'] = $_GET['end']; }
if(isset($_GET['start'])) { $event['start'] = egw_time::to($_GET['start'],'ts'); }
if(isset($_GET['end'])) { $event['end'] = egw_time::to($_GET['end'],'ts'); }
if(isset($_GET['non_blocking'])) { $event['non_blocking'] = (bool)$_GET['non_blocking']; }
// check if the event is the whole day
$start = $this->bo->date2array($event['start']);

View File

@ -482,7 +482,7 @@ var et2_calendar_event = et2_valueWidget.extend([et2_IDetachedDOM],
_sameday_check: function(event)
{
// Event somehow got orphaned
if(!this._parent || !this._parent.instanceOf(et2_calendar_daycol))
if(!this._parent)
{
return false;
}

View File

@ -1842,7 +1842,7 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
var row = $j(_ev.target).closest('.calendar_plannerRowWidget');
var data = row.length ? row[0].dataset : {};
this.egw().open(null, 'calendar', 'add', jQuery.extend({
date: date.toJSON(),
start: date.toJSON(),
hour: date.getUTCHours(),
minute: date.getUTCMinutes()
},data) , '_blank');

View File

@ -228,7 +228,7 @@ var et2_calendar_planner_row = et2_valueWidget.extend([et2_IDetachedDOM],
{
// Create event
var event = et2_createWidget('calendar-event',{
id:events[c].app_id||events[c].id,
id:events[c].id,
value: events[c]
},this);
if(this.isInTree())
@ -241,9 +241,9 @@ var et2_calendar_planner_row = et2_valueWidget.extend([et2_IDetachedDOM],
}
// Seperate loop so column sorting finds all children in the right place
for(var c = 0; c < events.length; c++)
for(var c = 0; c < events.length && c < this._children.length; c++)
{
this._children[c].set_value(events[c]);
this.getWidgetById(events[c].id).set_value(events[c]);
}
},