mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-14 03:54:29 +01:00
* Calendar: Create new events by dragging on empty space
This commit is contained in:
parent
5b8fd1fa92
commit
c7f63a5e0a
@ -213,12 +213,14 @@ class calendar_uiforms extends calendar_ui
|
||||
'id' => 1,
|
||||
);
|
||||
}
|
||||
$duration = isset($_GET['duration']) ? (int)$_GET['duration'] : (int) $this->bo->cal_prefs['defaultlength']*60;
|
||||
$end = isset($_GET['end']) ? Api\DateTime::to($_GET['end'], 'ts') : $start + $duration;
|
||||
return array(
|
||||
'participant_types' => $participant_types,
|
||||
'participants' => $participants,
|
||||
'owner' => $owner,
|
||||
'start' => $start,
|
||||
'end' => $start + (int) $this->bo->cal_prefs['defaultlength']*60,
|
||||
'end' => $end,
|
||||
'tzid' => $this->bo->common_prefs['tz'],
|
||||
'priority' => 2, // normal
|
||||
'public'=> $this->cal_prefs['default_private'] ? 0 : 1,
|
||||
|
@ -65,6 +65,9 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
owner: egw.user('account_id')
|
||||
},
|
||||
|
||||
/**
|
||||
* These are the keys we keep to set & remember the status, others are discarded
|
||||
*/
|
||||
states_to_save: ['owner','status_filter','filter','cat_id','view','sortby','planner_view','weekend'],
|
||||
|
||||
// If you are in one of these views and select a date in the sidebox, the view
|
||||
@ -542,7 +545,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
|
||||
if(!sortable.sortable('instance'))
|
||||
{
|
||||
sortable.sortable({
|
||||
cancel: "#divAppboxHeader, .calendar_calWeekNavHeader, .calendar_plannerHeader",
|
||||
cancel: "#divAppboxHeader, .calendar_calWeekNavHeader, .calendar_calDayColHeader, .calendar_plannerHeader",
|
||||
handle: '.calendar_calGridHeader',
|
||||
//placeholder: "srotable_cal_wk_ph",
|
||||
axis:"y",
|
||||
|
@ -129,10 +129,6 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
this._drawGrid();
|
||||
}
|
||||
|
||||
// Actions may be set on a parent, so we need to explicitly get in here
|
||||
// and get ours
|
||||
this._link_actions(this.options.actions || this._parent.options.actions || []);
|
||||
|
||||
// Automatically bind drag and resize for every event using jQuery directly
|
||||
// - no action system -
|
||||
var planner = this;
|
||||
@ -268,13 +264,26 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
planner.vertical_bar
|
||||
.html('<span>'+date(egw.preference('timeformat','calendar') == 12 ? 'h:ia' : 'H:i',formatDate)+'</span>')
|
||||
.show();
|
||||
|
||||
if(planner.drag_create.event && planner.drag_create.parent && planner.drag_create.end)
|
||||
{
|
||||
|
||||
planner.drag_create.end.date = time.toJSON()
|
||||
planner._drag_update_event();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No (valid) time, just hide
|
||||
planner.vertical_bar.hide();
|
||||
}
|
||||
});
|
||||
})
|
||||
.on('mousedown', jQuery.proxy(this._mouse_down, this))
|
||||
.on('mouseup', jQuery.proxy(this._mouse_up, this));
|
||||
|
||||
// Actions may be set on a parent, so we need to explicitly get in here
|
||||
// and get ours
|
||||
this._link_actions(this.options.actions || this._parent.options.actions || []);
|
||||
|
||||
// Customize and override some draggable settings
|
||||
this.div.on('dragcreate','.calendar_calEvent', function(event, ui) {
|
||||
@ -742,12 +751,6 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
|
||||
this.widget._drawGrid();
|
||||
|
||||
// Update actions
|
||||
if(this.widget._actionManager)
|
||||
{
|
||||
this.widget._link_actions(this.widget._actionManager.children);
|
||||
}
|
||||
|
||||
if(this.trigger)
|
||||
{
|
||||
this.widget.change();
|
||||
@ -1909,6 +1912,9 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
{
|
||||
var result = true;
|
||||
|
||||
// Drag to create in progress
|
||||
if(this.drag_create.start !== null) return;
|
||||
|
||||
// Is this click in the event stuff, or in the header?
|
||||
if(!this.options.readonly && this.gridHeader.has(_ev.target).length === 0 && !jQuery(_ev.target).hasClass('calendar_plannerRowHeader'))
|
||||
{
|
||||
|
@ -328,6 +328,27 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
})
|
||||
.on('mousemove', function(event) {
|
||||
timegrid._get_time_from_position(event.clientX, event.clientY);
|
||||
|
||||
if(timegrid.drag_create.event && timegrid.drag_create.parent && timegrid.drag_create.end)
|
||||
{
|
||||
var end = jQuery.extend({}, timegrid.gridHover[0].dataset);
|
||||
if(end.date)
|
||||
{
|
||||
timegrid.date_helper.set_year(end.date.substring(0,4));
|
||||
timegrid.date_helper.set_month(end.date.substring(4,6));
|
||||
timegrid.date_helper.set_date(end.date.substring(6,8));
|
||||
if(end.hour)
|
||||
{
|
||||
timegrid.date_helper.set_hours(end.hour);
|
||||
}
|
||||
if(end.minute)
|
||||
{
|
||||
timegrid.date_helper.set_minutes(end.minute);
|
||||
}
|
||||
timegrid.drag_create.end.date = timegrid.date_helper.get_value();
|
||||
}
|
||||
timegrid._drag_update_event();
|
||||
}
|
||||
})
|
||||
.on('mouseout', function(event) {
|
||||
if(timegrid.div.has(event.relatedTarget).length === 0)
|
||||
@ -1782,6 +1803,9 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
click: function(_ev)
|
||||
{
|
||||
var result = true;
|
||||
|
||||
// Drag to create in progress
|
||||
if(this.drag_create.start !== null) return;
|
||||
|
||||
// Drag to create in progress
|
||||
if(this.drag_create.start !== null) return;
|
||||
@ -2250,4 +2274,4 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
|
||||
}
|
||||
}
|
||||
});}).call(this);
|
||||
et2_register_widget(et2_calendar_timegrid, ["calendar-timegrid"]);
|
||||
et2_register_widget(et2_calendar_timegrid, ["calendar-timegrid"]);
|
||||
|
Loading…
Reference in New Issue
Block a user