calendar merge: d&d support and some minor cleanup and fixes
This commit is contained in:
parent
0cecfceb14
commit
dce6a5763d
@ -524,6 +524,14 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$allDay = false;
|
||||||
|
|
||||||
|
// allDay event rules
|
||||||
|
if(!strpos($start, 'T') && !strpos($end, 'T'))
|
||||||
|
$allDay = true;
|
||||||
|
if(strpos($start, 'T00:00:00') && strpos($end, 'T00:00:00'))
|
||||||
|
$allDay = true;
|
||||||
|
|
||||||
$is_first = ($d !== $last_date);
|
$is_first = ($d !== $last_date);
|
||||||
|
|
||||||
$last_date = $d;
|
$last_date = $d;
|
||||||
@ -550,12 +558,13 @@ class Channel_calendar extends \Zotlabs\Web\Controller {
|
|||||||
'start'=> $start,
|
'start'=> $start,
|
||||||
'end' => $end,
|
'end' => $end,
|
||||||
'drop' => $drop,
|
'drop' => $drop,
|
||||||
'allDay' => false,
|
'allDay' => $allDay,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
|
||||||
'j' => $j,
|
'j' => $j,
|
||||||
'd' => $d,
|
'd' => $d,
|
||||||
'is_editable' => $edit ? true : false,
|
|
||||||
|
'editable' => $edit ? true : false,
|
||||||
|
|
||||||
'is_first'=>$is_first,
|
'is_first'=>$is_first,
|
||||||
'item'=>$rr,
|
'item'=>$rr,
|
||||||
|
@ -21,7 +21,8 @@ $(document).ready(function() {
|
|||||||
$('#left_aside_wrapper, #right_aside_wrapper').stick_in_parent({
|
$('#left_aside_wrapper, #right_aside_wrapper').stick_in_parent({
|
||||||
offset_top: parseInt($('aside').css('padding-top')),
|
offset_top: parseInt($('aside').css('padding-top')),
|
||||||
parent: 'main',
|
parent: 'main',
|
||||||
spacer: '.aside_spacer'
|
spacer: '.aside_spacer',
|
||||||
|
recalc_every: 10
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,13 +69,15 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
eventClick: function(info) {
|
eventClick: function(info) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//reset categories
|
//reset categories
|
||||||
$('#id_categories').tagsinput('removeAll');
|
$('#id_categories').tagsinput('removeAll');
|
||||||
|
|
||||||
var event = info.event._def;
|
var event = info.event._def;
|
||||||
var dtstart = new Date(info.event._instance.range.start);
|
var dtstart = new Date(info.event._instance.range.start);
|
||||||
var dtend = new Date(info.event._instance.range.end);
|
var dtend = new Date(info.event._instance.range.end);
|
||||||
console.log(event.extendedProps.categories);
|
|
||||||
if(event.extendedProps.plink) {
|
if(event.extendedProps.plink) {
|
||||||
if(! $('#l2s').length)
|
if(! $('#l2s').length)
|
||||||
$('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
|
$('#id_title_wrapper').prepend('<span id="l2s" class="float-right"></span>');
|
||||||
@ -137,8 +139,7 @@ $(document).ready(function() {
|
|||||||
$('#id_description').attr('disabled', false);
|
$('#id_description').attr('disabled', false);
|
||||||
$('#id_location').attr('disabled', false);
|
$('#id_location').attr('disabled', false);
|
||||||
|
|
||||||
if(calendar_id == 'channel_calendar' && !event.extendedProps.is_editable) {
|
if(calendar_id == 'channel_calendar' && !event.ui.startEditable) {
|
||||||
console.log(calendar_id)
|
|
||||||
$('#event_submit').hide();
|
$('#event_submit').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +162,7 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
eventResize: function(info) {
|
eventResize: function(info) {
|
||||||
|
|
||||||
var event = info.event._def;
|
var event = info.event._def;
|
||||||
var dtstart = new Date(info.event._instance.range.start);
|
var dtstart = new Date(info.event._instance.range.start);
|
||||||
var dtend = new Date(info.event._instance.range.end);
|
var dtend = new Date(info.event._instance.range.end);
|
||||||
@ -170,16 +171,41 @@ $(document).ready(function() {
|
|||||||
$('#id_dtstart').val(dtstart.toUTCString());
|
$('#id_dtstart').val(dtstart.toUTCString());
|
||||||
$('#id_dtend').val(dtend.toUTCString());
|
$('#id_dtend').val(dtend.toUTCString());
|
||||||
|
|
||||||
$.post( 'cdav/calendar', {
|
event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
|
||||||
'update': 'resize',
|
|
||||||
'id[]': event.extendedProps.calendar_id,
|
if(event.extendedProps.calendar_id === 'channel_calendar') {
|
||||||
'uri': event.extendedProps.uri,
|
$.post( 'channel_calendar', {
|
||||||
'dtstart': dtstart ? dtstart.toUTCString() : '',
|
'event_id': event_id,
|
||||||
'dtend': dtend ? dtend.toUTCString() : ''
|
'event_hash': event_uri,
|
||||||
})
|
'xchan': '{{$channel_hash}}',
|
||||||
.fail(function() {
|
//'mid': mid,
|
||||||
info.revert();
|
'type': 'event',
|
||||||
});
|
'preview': 0,
|
||||||
|
'summary': event.title,
|
||||||
|
'dtstart': dtstart.toUTCString(),
|
||||||
|
'dtend': dtend.toUTCString(),
|
||||||
|
'adjust': event.extendedProps.item.adjust,
|
||||||
|
'categories': event.extendedProps.categories,
|
||||||
|
'desc': event.extendedProps.description,
|
||||||
|
'location': event.extendedProps.location,
|
||||||
|
//'submit': $('#event_submit').val()
|
||||||
|
})
|
||||||
|
.fail(function() {
|
||||||
|
info.revert();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$.post( 'cdav/calendar', {
|
||||||
|
'update': 'resize',
|
||||||
|
'id[]': event.extendedProps.calendar_id,
|
||||||
|
'uri': event.extendedProps.uri,
|
||||||
|
'dtstart': dtstart ? dtstart.toUTCString() : '',
|
||||||
|
'dtend': dtend ? dtend.toUTCString() : ''
|
||||||
|
})
|
||||||
|
.fail(function() {
|
||||||
|
info.revert();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
eventDrop: function(info) {
|
eventDrop: function(info) {
|
||||||
@ -191,17 +217,42 @@ $(document).ready(function() {
|
|||||||
$('#id_title').val(event.title);
|
$('#id_title').val(event.title);
|
||||||
$('#id_dtstart').val(dtstart.toUTCString());
|
$('#id_dtstart').val(dtstart.toUTCString());
|
||||||
$('#id_dtend').val(dtend.toUTCString());
|
$('#id_dtend').val(dtend.toUTCString());
|
||||||
|
|
||||||
$.post( 'cdav/calendar', {
|
event_id = event.extendedProps.item ? event.extendedProps.item.id : 0;
|
||||||
'update': 'drop',
|
|
||||||
'id[]': event.extendedProps.calendar_id,
|
if(event.extendedProps.calendar_id === 'channel_calendar') {
|
||||||
'uri': event.extendedProps.uri,
|
$.post( 'channel_calendar', {
|
||||||
'dtstart': dtstart ? dtstart.toUTCString() : '',
|
'event_id': event_id,
|
||||||
'dtend': dtend ? dtend.toUTCString() : ''
|
'event_hash': event_uri,
|
||||||
})
|
'xchan': '{{$channel_hash}}',
|
||||||
.fail(function() {
|
//'mid': mid,
|
||||||
info.revert();
|
'type': 'event',
|
||||||
});
|
'preview': 0,
|
||||||
|
'summary': event.title,
|
||||||
|
'dtstart': dtstart.toUTCString(),
|
||||||
|
'dtend': dtend.toUTCString(),
|
||||||
|
'adjust': event.extendedProps.item.adjust,
|
||||||
|
'categories': event.extendedProps.categories,
|
||||||
|
'desc': event.extendedProps.description,
|
||||||
|
'location': event.extendedProps.location,
|
||||||
|
//'submit': $('#event_submit').val()
|
||||||
|
})
|
||||||
|
.fail(function() {
|
||||||
|
info.revert();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$.post( 'cdav/calendar', {
|
||||||
|
'update': 'drop',
|
||||||
|
'id[]': event.extendedProps.calendar_id,
|
||||||
|
'uri': event.extendedProps.uri,
|
||||||
|
'dtstart': dtstart ? dtstart.toUTCString() : '',
|
||||||
|
'dtend': dtend ? dtend.toUTCString() : ''
|
||||||
|
})
|
||||||
|
.fail(function() {
|
||||||
|
info.revert();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loading: function(isLoading, view) {
|
loading: function(isLoading, view) {
|
||||||
@ -332,21 +383,12 @@ function on_submit() {
|
|||||||
'categories': $('#id_categories').val(),
|
'categories': $('#id_categories').val(),
|
||||||
'desc': $('#id_description').val(),
|
'desc': $('#id_description').val(),
|
||||||
'location': $('#id_location').val(),
|
'location': $('#id_location').val(),
|
||||||
'submit': $('#event_submit').val(),
|
//'submit': $('#event_submit').val(),
|
||||||
'contact_allow[]': contact_allow,
|
'contact_allow[]': contact_allow,
|
||||||
'group_allow[]': group_allow,
|
'group_allow[]': group_allow,
|
||||||
'contact_deny[]': contact_deny,
|
'contact_deny[]': contact_deny,
|
||||||
'group_deny[]': group_deny
|
'group_deny[]': group_deny
|
||||||
/*
|
|
||||||
'submit': $('#event_submit').val(),
|
|
||||||
'target': $('#calendar_select').val(),
|
|
||||||
'uri': $('#event_uri').val(),
|
|
||||||
'title': $('#id_title').val(),
|
|
||||||
'dtstart': $('#id_dtstart').val(),
|
|
||||||
'dtend': $('#id_dtend').val(),
|
|
||||||
'description': $('#id_description').val(),
|
|
||||||
'location': $('#id_location').val()
|
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
.done(function() {
|
.done(function() {
|
||||||
var eventSource = calendar.getEventSourceById('channel_calendar');
|
var eventSource = calendar.getEventSourceById('channel_calendar');
|
||||||
|
Reference in New Issue
Block a user