From dce6a5763d925e6bf70c6a293be079a05269ce36 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 29 Apr 2019 11:45:55 +0200 Subject: calendar merge: d&d support and some minor cleanup and fixes --- view/tpl/cdav_calendar.tpl | 114 +++++++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 36 deletions(-) (limited to 'view/tpl') diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl index 5c2f0080b..dd0f3ff7b 100644 --- a/view/tpl/cdav_calendar.tpl +++ b/view/tpl/cdav_calendar.tpl @@ -69,13 +69,15 @@ $(document).ready(function() { eventClick: function(info) { + + //reset categories $('#id_categories').tagsinput('removeAll'); var event = info.event._def; var dtstart = new Date(info.event._instance.range.start); var dtend = new Date(info.event._instance.range.end); - console.log(event.extendedProps.categories); + if(event.extendedProps.plink) { if(! $('#l2s').length) $('#id_title_wrapper').prepend(''); @@ -137,8 +139,7 @@ $(document).ready(function() { $('#id_description').attr('disabled', false); $('#id_location').attr('disabled', false); - if(calendar_id == 'channel_calendar' && !event.extendedProps.is_editable) { - console.log(calendar_id) + if(calendar_id == 'channel_calendar' && !event.ui.startEditable) { $('#event_submit').hide(); } } @@ -161,7 +162,7 @@ $(document).ready(function() { }, eventResize: function(info) { - + var event = info.event._def; var dtstart = new Date(info.event._instance.range.start); var dtend = new Date(info.event._instance.range.end); @@ -170,16 +171,41 @@ $(document).ready(function() { $('#id_dtstart').val(dtstart.toUTCString()); $('#id_dtend').val(dtend.toUTCString()); - $.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(); - }); + event_id = event.extendedProps.item ? event.extendedProps.item.id : 0; + + if(event.extendedProps.calendar_id === 'channel_calendar') { + $.post( 'channel_calendar', { + 'event_id': event_id, + 'event_hash': event_uri, + 'xchan': '{{$channel_hash}}', + //'mid': mid, + '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) { @@ -191,17 +217,42 @@ $(document).ready(function() { $('#id_title').val(event.title); $('#id_dtstart').val(dtstart.toUTCString()); $('#id_dtend').val(dtend.toUTCString()); - - $.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(); - }); + + event_id = event.extendedProps.item ? event.extendedProps.item.id : 0; + + if(event.extendedProps.calendar_id === 'channel_calendar') { + $.post( 'channel_calendar', { + 'event_id': event_id, + 'event_hash': event_uri, + 'xchan': '{{$channel_hash}}', + //'mid': mid, + '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) { @@ -332,21 +383,12 @@ function on_submit() { 'categories': $('#id_categories').val(), 'desc': $('#id_description').val(), 'location': $('#id_location').val(), - 'submit': $('#event_submit').val(), + //'submit': $('#event_submit').val(), 'contact_allow[]': contact_allow, 'group_allow[]': group_allow, 'contact_deny[]': contact_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() { var eventSource = calendar.getEventSourceById('channel_calendar'); -- cgit v1.2.3 From e80c99ad744f675ff193802fa2fe91d1c1207d01 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 29 Apr 2019 23:29:16 +0200 Subject: Add 'reply to comment' button --- view/tpl/conv_item.tpl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'view/tpl') diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 428529de2..29401a35c 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -102,6 +102,11 @@ {{/if}} + {{if $item.reply_to}} + + {{/if}} {{if $item.isevent}}
{{/if}} {{if $item.reply_to}} - {{/if}} -- cgit v1.2.3 From 9594ce9a8a1295a1e085bc53ab93a77055de2a77 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 1 May 2019 15:35:20 +0200 Subject: calendar merge: fix event_xchan mixup --- view/tpl/cdav_calendar.tpl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'view/tpl') diff --git a/view/tpl/cdav_calendar.tpl b/view/tpl/cdav_calendar.tpl index 827c57b96..9641e2ab5 100644 --- a/view/tpl/cdav_calendar.tpl +++ b/view/tpl/cdav_calendar.tpl @@ -6,6 +6,7 @@ var views = {'dayGridMonth' : '{{$month}}', 'timeGridWeek' : '{{$week}}', 'timeG var event_id; var event_uri; +var event_xchan; var contact_allow = []; var group_allow = []; @@ -128,6 +129,7 @@ $(document).ready(function() { $('#event_submit').val('update_event').html('{{$update}}'); $('#dbtn-acl').addClass('d-none'); event_id = event.extendedProps.item ? event.extendedProps.item.id : 0; + event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : ''; contact_allow = event.extendedProps.contact_allow || []; group_allow = event.extendedProps.group_allow || []; @@ -144,7 +146,7 @@ $(document).ready(function() { $('#id_description').attr('disabled', false); $('#id_location').attr('disabled', false); - if(calendar_id == 'channel_calendar' && !event.ui.startEditable) { + if(calendar_id === 'channel_calendar' && !event.ui.startEditable) { $('#event_submit').hide(); } } @@ -177,12 +179,13 @@ $(document).ready(function() { $('#id_dtend').val(dtend.toUTCString()); event_id = event.extendedProps.item ? event.extendedProps.item.id : 0; + event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : ''; if(event.extendedProps.calendar_id === 'channel_calendar') { $.post( 'channel_calendar', { 'event_id': event_id, 'event_hash': event_uri, - 'xchan': '{{$channel_hash}}', + 'xchan': event_xchan, //'mid': mid, 'type': 'event', 'preview': 0, @@ -224,12 +227,13 @@ $(document).ready(function() { $('#id_dtend').val(dtend.toUTCString()); event_id = event.extendedProps.item ? event.extendedProps.item.id : 0; + event_xchan = event.extendedProps.item ? event.extendedProps.item.event_xchan : ''; if(event.extendedProps.calendar_id === 'channel_calendar') { $.post( 'channel_calendar', { 'event_id': event_id, 'event_hash': event_uri, - 'xchan': '{{$channel_hash}}', + 'xchan': event_xchan, //'mid': mid, 'type': 'event', 'preview': 0, @@ -315,6 +319,8 @@ $(document).ready(function() { event_id = resource.id; event_uri = resource.event_hash; + event_xchan = resource.event_xchan; + $('#calendar_select').val('channel_calendar').attr('disabled', true); $('#id_title').val(resource.summary); $('#id_dtstart').val(new Date(resource.dtstart).toUTCString()); @@ -323,7 +329,7 @@ $(document).ready(function() { $('#id_description').val(resource.description); $('#id_location').val(resource.location); - if(resource.event_xchan !== '{{$channel_hash}}') + if(event_xchan !== '{{$channel_hash}}') $('#event_submit').hide(); else $('#event_submit').html('{{$update}}'); @@ -380,7 +386,7 @@ function updateSize() { } function on_submit() { - if($('#calendar_select').val() == 'channel_calendar') { + if($('#calendar_select').val() === 'channel_calendar') { if(new_event_id) { $("input[name='contact_allow[]']").each(function() { contact_allow.push($(this).val()); @@ -399,7 +405,7 @@ function on_submit() { $.post( 'channel_calendar', { 'event_id': event_id, 'event_hash': event_uri, - 'xchan': '{{$channel_hash}}', + 'xchan': event_xchan, //'mid': mid, 'type': 'event', 'preview': 0, @@ -447,7 +453,7 @@ function on_submit() { } function on_delete() { - if($('#calendar_select').val() == 'channel_calendar') { + if($('#calendar_select').val() === 'channel_calendar') { $.get('channel_calendar/drop/' + event_uri, function() { var eventSource = calendar.getEventSourceById('channel_calendar'); eventSource.refetch(); -- cgit v1.2.3