mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-24 10:30:05 +02:00
calendar not editable pandora_enterprise#3943
This commit is contained in:
parent
dca70fa8ec
commit
0e0e737283
@ -700,6 +700,7 @@ if ($step == 2) {
|
|||||||
[
|
[
|
||||||
'message' => __('No alert has been scheduled yet'),
|
'message' => __('No alert has been scheduled yet'),
|
||||||
'force_style' => 'display:none;',
|
'force_style' => 'display:none;',
|
||||||
|
'force_class' => 'alert_schedule',
|
||||||
],
|
],
|
||||||
'',
|
'',
|
||||||
true
|
true
|
||||||
@ -1509,6 +1510,8 @@ if ($step == 2) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var is_management_allowed = parseInt('<?php echo (int) $is_management_allowed; ?>');
|
||||||
|
|
||||||
var eventsBBDD = $("#hidden-schedule").val();
|
var eventsBBDD = $("#hidden-schedule").val();
|
||||||
if(eventsBBDD === '') {
|
if(eventsBBDD === '') {
|
||||||
eventsBBDD = '<?php echo json_encode($default_events_calendar); ?>';
|
eventsBBDD = '<?php echo json_encode($default_events_calendar); ?>';
|
||||||
@ -1516,6 +1519,58 @@ if ($step == 2) {
|
|||||||
|
|
||||||
var events = loadEventBBDD(eventsBBDD);
|
var events = loadEventBBDD(eventsBBDD);
|
||||||
var calendarEl = document.getElementById('calendar_map');
|
var calendarEl = document.getElementById('calendar_map');
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
contentHeight: "auto",
|
||||||
|
headerToolbar: {
|
||||||
|
left: "",
|
||||||
|
center: "",
|
||||||
|
right: is_management_allowed === 0 ? '' : "timeGridWeek,dayGridWeek"
|
||||||
|
},
|
||||||
|
buttonText: {
|
||||||
|
dayGridWeek: '<?php echo __('Simple'); ?>',
|
||||||
|
timeGridWeek: '<?php echo __('Detailed'); ?>'
|
||||||
|
},
|
||||||
|
dayHeaderFormat: { weekday: "short" },
|
||||||
|
initialView: "dayGridWeek",
|
||||||
|
navLinks: false,
|
||||||
|
selectable: true,
|
||||||
|
selectMirror: true,
|
||||||
|
slotDuration: "01:00:00",
|
||||||
|
slotLabelInterval: "02:00:00",
|
||||||
|
snapDuration: "01:00:00",
|
||||||
|
slotMinTime: "00:00:00",
|
||||||
|
slotMaxTime: "24:00:00",
|
||||||
|
scrollTime: "01:00:00",
|
||||||
|
locale: "en-GB",
|
||||||
|
firstDay: 1,
|
||||||
|
eventTimeFormat: {
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: false
|
||||||
|
},
|
||||||
|
eventColor: "#82b92e",
|
||||||
|
editable: is_management_allowed === 0 ? false : true,
|
||||||
|
dayMaxEvents: 3,
|
||||||
|
dayPopoverFormat: { weekday: "long" },
|
||||||
|
defaultAllDay: false,
|
||||||
|
displayEventTime: true,
|
||||||
|
displayEventEnd: true,
|
||||||
|
selectOverlap: false,
|
||||||
|
eventOverlap: false,
|
||||||
|
allDaySlot: true,
|
||||||
|
droppable: false,
|
||||||
|
select: is_management_allowed === 0 ? false : select_alert_template,
|
||||||
|
selectAllow: is_management_allowed === 0 ? false : selectAllow_alert_template,
|
||||||
|
eventAllow: is_management_allowed === 0 ? false : eventAllow_alert_template,
|
||||||
|
eventDrop: is_management_allowed === 0 ? false : eventDrop_alert_template,
|
||||||
|
eventDragStop: is_management_allowed === 0 ? false : eventDragStop_alert_template,
|
||||||
|
eventResize: is_management_allowed === 0 ? false : eventResize_alert_template,
|
||||||
|
eventMouseEnter: is_management_allowed === 0 ? false : eventMouseEnter_alert_template,
|
||||||
|
eventMouseLeave: is_management_allowed === 0 ? false : eventMouseLeave_alert_template,
|
||||||
|
eventClick: is_management_allowed === 0 ? false : eventClick_alert_template,
|
||||||
|
};
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||||
@ -1530,12 +1585,10 @@ if ($step == 2) {
|
|||||||
userLanguage: '<?php echo get_user_language(); ?>',
|
userLanguage: '<?php echo get_user_language(); ?>',
|
||||||
loadingText: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
loadingText: '<?php echo __('Loading, this operation might take several minutes...'); ?>',
|
||||||
tooltipText: '<?php echo __('Drag out to remove'); ?>',
|
tooltipText: '<?php echo __('Drag out to remove'); ?>',
|
||||||
simple: '<?php echo __('Simple'); ?>',
|
|
||||||
detailed: '<?php echo __('Detailed'); ?>',
|
|
||||||
alert: '<?php echo __('Alert'); ?>'
|
alert: '<?php echo __('Alert'); ?>'
|
||||||
}
|
}
|
||||||
|
|
||||||
var calendar = fullCalendarPandora(calendarEl, settings, events);
|
var calendar = fullCalendarPandora(calendarEl, options, settings, events);
|
||||||
calendar.render();
|
calendar.render();
|
||||||
<?php
|
<?php
|
||||||
} else if ($step == 3) {
|
} else if ($step == 3) {
|
||||||
|
@ -251,6 +251,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||||||
$icon_image = '';
|
$icon_image = '';
|
||||||
$no_close_bool = false;
|
$no_close_bool = false;
|
||||||
$force_style = '';
|
$force_style = '';
|
||||||
|
$force_class = '';
|
||||||
if (is_array($message)) {
|
if (is_array($message)) {
|
||||||
if (!empty($message['title'])) {
|
if (!empty($message['title'])) {
|
||||||
$text_title = $message['title'];
|
$text_title = $message['title'];
|
||||||
@ -271,6 +272,10 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||||||
if (!empty($message['force_style'])) {
|
if (!empty($message['force_style'])) {
|
||||||
$force_style = $message['force_style'];
|
$force_style = $message['force_style'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($message['force_class']) === false) {
|
||||||
|
$force_class = $message['force_class'];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$text_message = $message;
|
$text_message = $message;
|
||||||
}
|
}
|
||||||
@ -319,6 +324,10 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
|
|||||||
|
|
||||||
$id = 'info_box_'.uniqid();
|
$id = 'info_box_'.uniqid();
|
||||||
|
|
||||||
|
if (empty($force_class) === false) {
|
||||||
|
$class = $class.' '.$force_class;
|
||||||
|
}
|
||||||
|
|
||||||
// Use the no_meta parameter because this image is only in the base console.
|
// Use the no_meta parameter because this image is only in the base console.
|
||||||
$output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.'
|
$output = '<table cellspacing="0" cellpadding="0" id="'.$id.'" '.$attributes.'
|
||||||
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
|
class="info_box '.$id.' '.$class.' textodialogo" style="'.$force_style.'">
|
||||||
|
@ -1,51 +1,105 @@
|
|||||||
/* globals $, FullCalendar, uniqId, confirmDialog*/
|
/* globals $, FullCalendar, uniqId, confirmDialog*/
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
function fullCalendarPandora(calendarEl, options, settings, initialEvents) {
|
||||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||||
//height: 200,
|
contentHeight: options.contentHeight,
|
||||||
contentHeight: "auto",
|
headerToolbar: options.headerToolbar,
|
||||||
headerToolbar: {
|
buttonText: options.buttonText,
|
||||||
left: "",
|
dayHeaderFormat: options.dayHeaderFormat,
|
||||||
center: "",
|
initialView: options.initialView,
|
||||||
right: "timeGridWeek,dayGridWeek"
|
navLinks: options.navLinks,
|
||||||
},
|
selectable: options.selectable,
|
||||||
buttonText: {
|
selectMirror: options.selectMirror,
|
||||||
dayGridWeek: settings.simple,
|
slotDuration: options.slotDuration,
|
||||||
timeGridWeek: settings.detailed
|
slotLabelInterval: options.slotLabelInterval,
|
||||||
},
|
snapDuration: options.snapDuration,
|
||||||
dayHeaderFormat: { weekday: "short" },
|
slotMinTime: options.slotMinTime,
|
||||||
initialView: "dayGridWeek",
|
slotMaxTime: options.slotMaxTime,
|
||||||
navLinks: false,
|
scrollTime: options.scrollTime,
|
||||||
selectable: true,
|
locale: options.locale,
|
||||||
selectMirror: true,
|
firstDay: options.firstDay,
|
||||||
slotDuration: "01:00:00",
|
eventTimeFormat: options.eventTimeFormat,
|
||||||
slotLabelInterval: "02:00:00",
|
eventColor: options.eventColor,
|
||||||
snapDuration: "01:00:00",
|
editable: options.editable,
|
||||||
//slotLabelFormat: {
|
dayMaxEvents: options.dayMaxEvents,
|
||||||
// hour: "numeric",
|
dayPopoverFormat: options.dayPopoverFormat,
|
||||||
// minute: "2-digit",
|
defaultAllDay: options.defaultAllDay,
|
||||||
// hour12: false
|
displayEventTime: options.displayEventTime,
|
||||||
//},
|
displayEventEnd: options.displayEventEnd,
|
||||||
slotMinTime: "00:00:00",
|
selectOverlap: options.selectOverlap,
|
||||||
slotMaxTime: "24:00:00",
|
eventOverlap: options.eventOverlap,
|
||||||
scrollTime: "01:00:00",
|
allDaySlot: options.allDaySlot,
|
||||||
locale: "en-GB",
|
droppable: options.droppable,
|
||||||
//timeZone: "local",
|
|
||||||
firstDay: 1,
|
|
||||||
eventTimeFormat: {
|
|
||||||
hour: "numeric",
|
|
||||||
minute: "2-digit",
|
|
||||||
hour12: false
|
|
||||||
},
|
|
||||||
eventColor: "#82b92e",
|
|
||||||
editable: true,
|
|
||||||
dayMaxEvents: 3,
|
|
||||||
dayPopoverFormat: { weekday: "long" },
|
|
||||||
events: initialEvents,
|
events: initialEvents,
|
||||||
defaultAllDay: false,
|
select:
|
||||||
displayEventTime: true,
|
options.select != undefined && typeof options.select === "function"
|
||||||
displayEventEnd: true,
|
? function(info) {
|
||||||
select: function(info) {
|
options.select(info, calendar);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
selectAllow:
|
||||||
|
options.selectAllow != undefined &&
|
||||||
|
typeof options.selectAllow === "function"
|
||||||
|
? function(info) {
|
||||||
|
return options.selectAllow(info);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventAllow:
|
||||||
|
options.eventAllow != undefined &&
|
||||||
|
typeof options.eventAllow === "function"
|
||||||
|
? function(dropInfo, draggedEvent) {
|
||||||
|
return options.eventAllow(dropInfo, draggedEvent);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventDrop:
|
||||||
|
options.eventDrop != undefined && typeof options.eventDrop === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventDrop(info, calendar);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventDragStop:
|
||||||
|
options.eventDragStop != undefined &&
|
||||||
|
typeof options.eventDragStop === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventDragStop(info, calendar);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventResize:
|
||||||
|
options.eventResize != undefined &&
|
||||||
|
typeof options.eventResize === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventResize(info, calendar);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventMouseEnter:
|
||||||
|
options.eventMouseEnter != undefined &&
|
||||||
|
typeof options.eventMouseEnter === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventMouseEnter(info, settings.tooltipText);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventMouseLeave:
|
||||||
|
options.eventMouseLeave != undefined &&
|
||||||
|
typeof options.eventMouseLeave === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventMouseLeave(info);
|
||||||
|
}
|
||||||
|
: false,
|
||||||
|
eventClick:
|
||||||
|
options.eventClick != undefined &&
|
||||||
|
typeof options.eventClick === "function"
|
||||||
|
? function(info) {
|
||||||
|
options.eventClick(info, calendar, settings);
|
||||||
|
}
|
||||||
|
: false
|
||||||
|
});
|
||||||
|
|
||||||
|
return calendar;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Specific functions Alerts templates && Correlated events.
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function select_alert_template(info, calendar) {
|
||||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||||
if (
|
if (
|
||||||
info.start.getDay() == info.end.getDay() ||
|
info.start.getDay() == info.end.getDay() ||
|
||||||
@ -55,8 +109,10 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
}
|
}
|
||||||
calendar.unselect();
|
calendar.unselect();
|
||||||
save_data_input(calendar);
|
save_data_input(calendar);
|
||||||
},
|
}
|
||||||
selectAllow: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function selectAllow_alert_template(info) {
|
||||||
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
var nextDay = info.start.getDay() === 6 ? 0 : info.start.getDay() + 1;
|
||||||
if (
|
if (
|
||||||
info.start.getDay() == info.end.getDay() ||
|
info.start.getDay() == info.end.getDay() ||
|
||||||
@ -65,13 +121,13 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
eventAllow: function(dropInfo, draggedEvent) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventAllow_alert_template(dropInfo, draggedEvent) {
|
||||||
if (dropInfo.allDay != true) {
|
if (dropInfo.allDay != true) {
|
||||||
var nextDay =
|
var nextDay =
|
||||||
draggedEvent.start.getDay() === 6
|
draggedEvent.start.getDay() === 6 ? 0 : draggedEvent.start.getDay() + 1;
|
||||||
? 0
|
|
||||||
: draggedEvent.start.getDay() + 1;
|
|
||||||
if (
|
if (
|
||||||
(draggedEvent.start.getDay() == dropInfo.start.getDay() &&
|
(draggedEvent.start.getDay() == dropInfo.start.getDay() &&
|
||||||
dropInfo.start.getDay() == dropInfo.end.getDay()) ||
|
dropInfo.start.getDay() == dropInfo.end.getDay()) ||
|
||||||
@ -82,8 +138,10 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
}
|
||||||
eventDrop: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventDrop_alert_template(info, calendar) {
|
||||||
if (info.event.allDay != true) {
|
if (info.event.allDay != true) {
|
||||||
var nextDay =
|
var nextDay =
|
||||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||||
@ -102,8 +160,10 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
save_data_input(calendar);
|
save_data_input(calendar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
eventDragStop: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventDragStop_alert_template(info, calendar) {
|
||||||
var trashEl = $("#calendar_map");
|
var trashEl = $("#calendar_map");
|
||||||
var ofs = trashEl.offset();
|
var ofs = trashEl.offset();
|
||||||
|
|
||||||
@ -122,8 +182,10 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
info.event.remove();
|
info.event.remove();
|
||||||
save_data_input(calendar);
|
save_data_input(calendar);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
eventResize: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventResize_alert_template(info, calendar) {
|
||||||
var nextDay =
|
var nextDay =
|
||||||
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
info.event.start.getDay() === 6 ? 0 : info.event.start.getDay() + 1;
|
||||||
if (
|
if (
|
||||||
@ -140,18 +202,24 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
);
|
);
|
||||||
save_data_input(calendar);
|
save_data_input(calendar);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
eventMouseEnter: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventMouseEnter_alert_template(info, tooltipText) {
|
||||||
var tooltip = '<div class="tooltipevent">';
|
var tooltip = '<div class="tooltipevent">';
|
||||||
tooltip += settings.tooltipText;
|
tooltip += tooltipText;
|
||||||
tooltip += "</div>";
|
tooltip += "</div>";
|
||||||
|
|
||||||
$(tooltip).appendTo(info.el);
|
$(tooltip).appendTo(info.el);
|
||||||
},
|
}
|
||||||
eventMouseLeave: function() {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventMouseLeave_alert_template(info) {
|
||||||
$(".tooltipevent").remove();
|
$(".tooltipevent").remove();
|
||||||
},
|
}
|
||||||
eventClick: function(info) {
|
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
function eventClick_alert_template(info, calendar, settings) {
|
||||||
var calendar_date_from = new Date(calendar.view.activeStart);
|
var calendar_date_from = new Date(calendar.view.activeStart);
|
||||||
var calendar_days = [];
|
var calendar_days = [];
|
||||||
var acum = 1;
|
var acum = 1;
|
||||||
@ -163,9 +231,7 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
acum = 0;
|
acum = 0;
|
||||||
}
|
}
|
||||||
var date_acum = new Date(calendar_date_from);
|
var date_acum = new Date(calendar_date_from);
|
||||||
calendar_days[acum] = date_acum.setDate(
|
calendar_days[acum] = date_acum.setDate(calendar_date_from.getDate() + i);
|
||||||
calendar_date_from.getDate() + i
|
|
||||||
);
|
|
||||||
acum++;
|
acum++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -263,13 +329,6 @@ function fullCalendarPandora(calendarEl, settings, initialEvents) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
selectOverlap: false,
|
|
||||||
eventOverlap: false,
|
|
||||||
allDaySlot: true
|
|
||||||
});
|
|
||||||
|
|
||||||
return calendar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function time_format(date) {
|
function time_format(date) {
|
||||||
@ -367,9 +426,9 @@ function save_data_input(calendar) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (data && Object.keys(data).length === 0) {
|
if (data && Object.keys(data).length === 0) {
|
||||||
$(".warning.textodialogo").show();
|
$(".alert_schedule.textodialogo").show();
|
||||||
} else {
|
} else {
|
||||||
$(".warning").hide();
|
$(".alert_schedule").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#hidden-schedule").val(JSON.stringify(data));
|
$("#hidden-schedule").val(JSON.stringify(data));
|
||||||
@ -378,11 +437,11 @@ function save_data_input(calendar) {
|
|||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function loadEventBBDD(events) {
|
function loadEventBBDD(events) {
|
||||||
if (events == undefined || events === null || events === "") {
|
if (events == undefined || events === null || events === "") {
|
||||||
$(".warning").show();
|
$(".alert_schedule").show();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".warning").hide();
|
$(".alert_schedule").hide();
|
||||||
|
|
||||||
var current_day = new Date();
|
var current_day = new Date();
|
||||||
|
|
||||||
|
@ -8486,6 +8486,8 @@ div#err_msg_centralised {
|
|||||||
width: 70px;
|
width: 70px;
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#select_multiple_modules_filtered > div {
|
#select_multiple_modules_filtered > div {
|
||||||
@ -8524,3 +8526,8 @@ div#err_msg_centralised {
|
|||||||
width: 95%;
|
width: 95%;
|
||||||
height: 95%;
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.resume_calendar_map {
|
||||||
|
width: 90%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user