diff --git a/Layout/default/Calendar/View.php b/Layout/default/Calendar/View.php index a52f39e77..914b6363e 100644 --- a/Layout/default/Calendar/View.php +++ b/Layout/default/Calendar/View.php @@ -102,18 +102,20 @@ endforeach;
-

Kalender +

Kalender

groups) : ?> + if ($Calendar[0]->groups) : + $Rights = $rights; + + ?>
groups, true); foreach ($groups as $group) : - ?>
@@ -131,7 +133,10 @@ endforeach;
- + +
user->name) ?: $specialCalendars[$calendar['calendar_id']] ?>
- + $calendar): + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + user->name) ?: $specialCalendars[$calendar['calendar_id']] + ?> + + +
@@ -248,24 +295,26 @@ endforeach;
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
-
- -
-
+
+ Typ
+
+ +
@@ -361,11 +411,10 @@ endforeach;
-
- -
-
-
+
+
+
-
@@ -439,7 +487,6 @@ endforeach;
-
diff --git a/application/Api/v1/CalendarApicontroller.php b/application/Api/v1/CalendarApicontroller.php index 4bf247b28..e9570b0e6 100644 --- a/application/Api/v1/CalendarApicontroller.php +++ b/application/Api/v1/CalendarApicontroller.php @@ -152,6 +152,7 @@ class CalendarApicontroller extends mfBaseApicontroller $now = floor(microtime(true) * 1000); $timenow = time(); while (true) { + $colors = $redis->get('thetool_calendar_usercolors_' . $decstring); if ($colors) { $calendarColors = json_decode($colors, true); @@ -172,11 +173,15 @@ class CalendarApicontroller extends mfBaseApicontroller $message[0]['start_time'] = date('Y-m-d H:i', $json['start_time']); $message[0]['end_time'] = date('Y-m-d H:i', $json['end_time']); } + $message[0]['name']= $Calendarevent['data'][0]['category']['category']; + $message[0]['description'] = $Calendarevent['data'][0]['description']['description']; + $message[0]['location'] = $Calendarevent['data'][0]['location']['location']; $message[0]['event_type'] = $Calendarevent['data'][0]['event_type']['event_type']; $message[0]['attachment'] = $Calendarevent['data'][0]['attachment']['attachment']; $message[0]['attachments'] = $Calendarevent['data'][0]['attachments']['attachments']; $message[0]['calendar_name'] = $Calendarevent['data'][0]['calendar_name']['calendar_name']; $message[0]['isorganizer'] = $Calendarevent['data'][0]['isorganizer']['isorganizer']; + $message[0]['privateflag'] = $Calendarevent['data'][0]['privateflag']['privateflag']; $message[0]['rrule'] = $Calendarevent['data'][0]['rrule']['rrule']; $message[0]['duration'] = $Calendarevent['data'][0]['duration']['duration']; $message[0]['mtime'] = $Calendarevent['data'][0]['mtime']['mtime']; @@ -189,6 +194,7 @@ class CalendarApicontroller extends mfBaseApicontroller $message[0]['bgColor'] = $calendarColors[$json['calendar_id']]['bgcolor']; $message[0]['txtColor'] = $calendarColors[$json['calendar_id']]['txtcolor']; $message[0]['rights'] = $rights[$json['calendar_id']]; + $message[0]['me'] = $decstring; $result = json_encode($message); if (in_array($message[0]['calendar_id'], $allowedCalendar)) { diff --git a/application/Calendar/CalendarModel.php b/application/Calendar/CalendarModel.php index 62a13db1c..2303b08d6 100644 --- a/application/Calendar/CalendarModel.php +++ b/application/Calendar/CalendarModel.php @@ -237,9 +237,20 @@ class CalendarModel $txtcolor = "#000"; $colorCounter++; } + $location=$data['location']; + $eventtype=$data['event_type']; + $description=$data['description']; if ($calenderRights[$data['calendar_id']]) { $rights = $calenderRights[$data['calendar_id']]; $CalendarUsers[$data['calendar_id']] = $data['calendar_name']; + if ($data['private']==1 && $calendar[0]->go_calendar_id != $data['calendar_id']) { + $name = "Privat"; + $attachment = 0; + $attachmentLinks = ""; + $location=""; + $eventtype="1"; + $description=""; + } $rows[] = array( 'id' => array('id' => $data['id']), 'cstart' => array('cstart' => $starttime), @@ -250,14 +261,15 @@ class CalendarModel 'bgColor' => array('bgColor' => $bgcolor), 'txtColor' => array('txtColor' => $txtcolor), 'rights' => array('rights' => $rights, 'order' => $rights), - 'location' => array('location' => $data['location']), + 'location' => array('location' => $location), 'busy' => array('busy' => $data['busy']), + 'privateflag' => array('privateflag' => $data['private']), 'allDay' => array('allDay' => $data['all_day_event']), 'rrule' => array('rrule' => $rrule), 'rrule_events' => array('rrule_events' => $rrule_events), 'duration' => array('duration' => $duration), - 'event_type' => array('event_type' => $data['event_type']), - 'description' => array('description' => ($data['description'])), + 'event_type' => array('event_type' => $eventtype), + 'description' => array('description' => ($description)), 'attachment' => array('attachment' => $attachment), 'attachments' => array('attachments' => $attachmentLinks), 'calendar_name' => array('calendar_name' => $data['calendar_name']), @@ -466,6 +478,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda 'customer_info' => array('customer_info' => $data['customer_info']), 'customer_info_send' => array('customer_info_send' => $data['customer_info_send']), 'customer_info_reminder' => array('customer_info_reminder' => $data['customer_info_reminder']), + 'privateflag' => array('privateflag' => $data['private'], 'order' => $data['private']), 'isorganizer' => array('isorganizer' => $data['is_organizer']), 'attendees' => array('attendees' => json_encode($AttendeeArray)), 'organizer' => array('organizer' => $data['organizer']), @@ -539,6 +552,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda $busy = ($r->busy); $users = ($r->users); $attendees = ($r->attendees); + $privateflag=($r->privateflag); foreach ($users as $key => $value) { $user_id = $value; } @@ -573,6 +587,9 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda if (isset($allday)) $updateArray['all_day_event'] = $allday; + if (isset($privateflag)) + $updateArray['private'] = $privateflag; + if (isset($reminder)) { if ($reminder == 'NULL') $updateArray['reminder'] = NULL; @@ -733,6 +750,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda $users = ($r->users); $customer_info_reminder_check = 0; $attendees = ($r->attendees); + $privateflag=($r->privateflag); date_default_timezone_set('Europe/Berlin'); header('Content-Type: application/json'); foreach ($users as $key => $value) { @@ -771,7 +789,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda $customer_info_send = NULL; } - $dataarray = array("start_time" => $start, 'end_time' => $end, 'name' => $title, 'description' => $description, 'location' => $location, 'calendar_id' => $user_id, 'uuid' => "a5eb79b3-fca7-5378-a09e-" . rand(100000000000, 999999999999), 'user_id' => 1, 'timezone' => 'Europe/Amsterdam', 'all_day_event' => 0, 'repeat_end_time' => 0, 'reminder' => $reminder, 'ctime' => time(), 'cname' => $me->name, 'mtime' => time(), 'mname' => $me->name, 'user_id' => 1, 'busy' => $busy, 'status' => 'CONFIRMED', 'resource_event_id' => 0, 'private' => 0, 'rrule' => '', 'background' => 'EBF1E2', 'files_folder_id' => 0, 'read_only' => 0, 'exception_for_event_id' => 0, 'recurrence_id' => 0, 'is_organizer' => 1, 'event_type' => $type, 'customer' => $customer, 'customer_info' => $customer_info, 'customer_info_send' => $customer_info_send, 'customer_info_reminder' => $customer_info_reminder_check); + $dataarray = array("start_time" => $start, 'end_time' => $end, 'name' => $title, 'description' => $description, 'location' => $location, 'calendar_id' => $user_id, 'uuid' => "a5eb79b3-fca7-5378-a09e-" . rand(100000000000, 999999999999), 'user_id' => 1, 'timezone' => 'Europe/Amsterdam', 'all_day_event' => 0, 'repeat_end_time' => 0, 'reminder' => $reminder, 'ctime' => time(), 'cname' => $me->name, 'mtime' => time(), 'mname' => $me->name, 'user_id' => 1, 'busy' => $busy, 'status' => 'CONFIRMED', 'resource_event_id' => 0, 'private' => $privateflag, 'rrule' => '', 'background' => 'EBF1E2', 'files_folder_id' => 0, 'read_only' => 0, 'exception_for_event_id' => 0, 'recurrence_id' => 0, 'is_organizer' => 1, 'event_type' => $type, 'customer' => $customer, 'customer_info' => $customer_info, 'customer_info_send' => $customer_info_send, 'customer_info_reminder' => $customer_info_reminder_check); $db->insert("cal_events", $dataarray); $event_id = $dataarray['uuid']; diff --git a/public/css/pages/Calendar/View.css b/public/css/pages/Calendar/View.css index 90c88e704..f5c8e190b 100644 --- a/public/css/pages/Calendar/View.css +++ b/public/css/pages/Calendar/View.css @@ -7,11 +7,13 @@ padding: 1px 5px; text-align: center; } + .fc-timegrid-event-short .fc-event-main-frame { flex-direction: row; overflow: hidden; margin-left: 10px; } + .fc-toolbar { @media (max-width: 767px) { flex-direction: column; @@ -311,6 +313,12 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion { top: 0; } +.fc-event-attachment-mr { + position: absolute; + right: 11px; + top: 0; +} + .fc-event-type { position: absolute; top: 0; @@ -322,6 +330,15 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion { bottom: -4px; left: -4px; } + +.fc-event-private { + position: absolute; + top: 0px; + right: -2px; +} + + + .fc-timegrid-event-short .fc-event-time::after { content: ""; } @@ -611,4 +628,23 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion { .fa-arrow-right-from-bracket { color: #0600ff; cursor: pointer; +} + +.fa-unlock:after { + color: #000; + opacity: 0.7; +} + +.fa-unlock:before { + color: #cd0909; + +} + +.fa-lock:after { + color: #000; + opacity: 0.7; +} + +.modal-body .fa-lock:before { + color: #0ab900; } \ No newline at end of file diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index f700af3c4..0c3079f49 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -63,6 +63,7 @@ function getOffset(unixTimestamp) { document.addEventListener('DOMContentLoaded', function () { let checkbox = $(".form-check-input"); let visibleCalendars = []; + let mycalendar_id = $('#calendar-id').data('calendarid'); visibleCalendars.push(0); checkbox.each(function () { if ($(this).prop('checked')) { @@ -116,6 +117,12 @@ document.addEventListener('DOMContentLoaded', function () { } else { rights = false; } + if (value.privateflag.privateflag == '1' && mycalendar_id!=value.calendar_id.calendar_id) { + rights = false; + + } + + if (value.isorganizer.isorganizer == '1' && rights) { movable = true; } else { @@ -150,6 +157,7 @@ document.addEventListener('DOMContentLoaded', function () { classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id], textColor: value.txtColor.txtColor, backgroundColor: value.bgColor.bgColor, + privateflag: value.privateflag.privateflag, editable: rights, rruleflag: rruleflag, dates: rrule, @@ -186,6 +194,7 @@ document.addEventListener('DOMContentLoaded', function () { classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id], textColor: value.txtColor.txtColor, backgroundColor: value.bgColor.bgColor, + privateflag: value.privateflag.privateflag, editable: rights, rruleflag: rruleflag, dates: rrule, @@ -370,6 +379,13 @@ document.addEventListener('DOMContentLoaded', function () { } else { $('#reminder').val('NULL'); } + if (data.data.privateflag.privateflag == 1) { + $('.privacy-click').removeClass('fa-unlock'); + $('.privacy-click').removeClass('fa-lock'); + $('.privacy-click').addClass('fa-lock'); + } + + $('#type').val(data.data.type.type); $('#busy').val(data.data.busy.busy); isOrganizer = data.data.isorganizer.isorganizer; @@ -611,16 +627,24 @@ document.addEventListener('DOMContentLoaded', function () { title += '
geändert von ' + info.event.extendedProps['mname'] + '
'; } if ($('.fc-button-active').hasClass('fc-timeGridWeek-button') || $('.fc-button-active').hasClass('fc-timeGridDay-button')) { - if (info.event.extendedProps['attachment']) { - info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); - } + if (info.event.extendedProps['event_type'] == '2') { info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); } + if (info.event.extendedProps['privateflag'] == 1) { + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } + if (info.event.extendedProps['attachment'] && info.event.extendedProps['privateflag'] == 1) { + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } else if (info.event.extendedProps['attachment']) { + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } if (info.event.extendedProps['rruleflag']) { info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); } + + } var tooltip = new Tooltip(info.el, { @@ -784,6 +808,7 @@ if (typeof (EventSource) !== 'undefined') { // document.getElementById('result').innerHTML += e.data + '
'; let checkbox = $(".form-check-input"); let visibleCalendars = []; + let mycalendar_id = $('#calendar-id').data('calendarid'); visibleCalendars.push(0); checkbox.each(function () { if ($(this).prop('checked')) { @@ -817,6 +842,11 @@ if (typeof (EventSource) !== 'undefined') { } else { movable = false; } + if (event.privateflag == '1' && mycalendar_id!=event.calendar_id_check) { + rights = false; + movable = false; + + } } if (event.change_type == '2' && cevent) { @@ -838,6 +868,7 @@ if (typeof (EventSource) !== 'undefined') { attachment: event.attachment, attachments: event.attachments, editable: movable, + privateflag: event.privateflag, rruleflag: rruleflag, rrule: rrule, duration: duration, @@ -868,6 +899,7 @@ if (typeof (EventSource) !== 'undefined') { attachments: event.attachments, calendar_id: event.calendar_id_check, resourceId: event.calendar_id, + privateflag: event.privateflag, calendar_name: event.calendar_name, clickable: rights, mtime: event.mtime, @@ -892,6 +924,7 @@ if (typeof (EventSource) !== 'undefined') { textColor: event.txtColor, backgroundColor: event.bgColor, location: event.location, + privateflag: event.privateflag, event_type: event.event_type, classNames: ['cal-class-group-' + event.calendar_id, 'cal-class-id-' + event.cal_events_id], attachment: event.attachment, @@ -918,6 +951,7 @@ if (typeof (EventSource) !== 'undefined') { color: '#ab0000', editable: false, location: event.location, + privateflag: event.privateflag, event_type: event.event_type, classNames: ['cal-class-group-' + event.calendar_id, 'cal-class-id-' + event.cal_events_id], attachment: event.attachment, @@ -986,6 +1020,9 @@ $(document).ready(function () { $('.attachment-div').empty(); $('#reminder').val('NULL'); $('#type').val('1'); + $('.privacy-click').removeClass('fa-lock'); + $('.privacy-click').removeClass('fa-unlock'); + $('.privacy-click').addClass('fa-unlock'); $('#customer-info-check-info').empty(); $('#customer-info-type').val('1'); $('#customer').val(''); @@ -1061,6 +1098,11 @@ $(document).ready(function () { var customer_info_type; var customer_info_type_text; var customer_info_reminder_check = 0; + var private = $('.privacy-click'); + var privateflag = 0; + if (private.hasClass('fa-lock')) { + privateflag = 1; + } var users = []; if ($('#allday').is(':checked')) { @@ -1095,6 +1137,7 @@ $(document).ready(function () { description: description, attachments: attachments, users: users, + privateflag: privateflag, attendees: $('#calendar-attendees').val(), customer: customer, customer_info_check: customer_info_check, @@ -1149,6 +1192,11 @@ $(document).ready(function () { var customer_info_type; var customer_info_type_text; var customer_info_reminder_check = 0; + var private = $('.privacy-click'); + var privateflag = 0; + if (private.hasClass('fa-lock')) { + privateflag = 1; + } var users = []; if ($('#allday').is(':checked')) { @@ -1175,7 +1223,6 @@ $(document).ready(function () { users.push($(this).val()); }); - $.post(requestUpdateUrl, { id: id, start: start, @@ -1189,6 +1236,7 @@ $(document).ready(function () { description: description, attachments: attachments, users: users, + privateflag: privateflag, attendees: $('#calendar-attendees').val(), customer: customer, customer_info_check: customer_info_check, @@ -1650,6 +1698,18 @@ Xinon GMbH`; }); + $("body").on("click", ".privacy-click", function (e) { + if ($(this).hasClass('fa-unlock')) { + $(this).removeClass('fa-unlock'); + $(this).addClass('fa-lock'); + $(this).prop('title', 'Privat'); + } else { + $(this).removeClass('fa-lock'); + $(this).addClass('fa-unlock'); + $(this).prop('title', 'Normal'); + } + }); + $("body").on("keyup", ".cal-group-name-input", function (e) { if (e.keyCode === 13) { let groupname = $.trim($(this).val()); @@ -1794,6 +1854,7 @@ Xinon GMbH`; calendar.removeAllEvents(); let checkbox = $(".calendar-check"); let visibleCalendars = []; + let mycalendar_id = $('#calendar-id').data('calendarid'); visibleCalendars.push(0); checkbox.each(function () { if ($(this).prop('checked')) { @@ -1856,6 +1917,12 @@ Xinon GMbH`; } else { movable = false; } + if (value.privateflag.privateflag == '1' && mycalendar_id!=value.calendar_id.calendar_id) { + rights = false; + movable = false; + + } + if (value.allDay.allDay == "1") { allDAy = true; } @@ -1886,6 +1953,7 @@ Xinon GMbH`; textColor: value.txtColor.txtColor, backgroundColor: value.bgColor.bgColor, editable: rights, + privateflag: value.privateflag.privateflag, rruleflag: rruleflag, dates: rrule, duration: duration, @@ -1922,6 +1990,7 @@ Xinon GMbH`; textColor: value.txtColor.txtColor, backgroundColor: value.bgColor.bgColor, editable: rights, + privateflag: value.privateflag.privateflag, rruleflag: rruleflag, dates: rrule, duration: duration,