Calendar is finished... I think.

merge-requests/1/head
Mike Koch 8 years ago
parent 7f4f5fff23
commit a801a64f93

@ -2046,11 +2046,11 @@ if (defined('HESK_DEMO')) {
<option value="month" <?php if ($modsForHesk_settings['default_calendar_view'] == 'month') { echo 'selected'; } ?>>
<?php echo $hesklang['month']; ?>
</option>
<option value="week" <?php if ($modsForHesk_settings['default_calendar_view'] == 'week') { echo 'selected'; } ?>>
<option value="agendaWeek" <?php if ($modsForHesk_settings['default_calendar_view'] == 'week') { echo 'selected'; } ?>>
<?php echo $hesklang['week']; ?>
</option>
<option value="agenda" <?php if ($modsForHesk_settings['default_calendar_view'] == 'agenda') { echo 'selected'; } ?>>
<?php echo $hesklang['agenda']; ?>
<option value="agendaDay" <?php if ($modsForHesk_settings['default_calendar_view'] == 'agenda') { echo 'selected'; } ?>>
<?php echo $hesklang['calendar_day']; ?>
</option>
</select>
</div>

@ -31,7 +31,7 @@
define('IN_SCRIPT', 1);
define('VALIDATOR', 1);
define('HESK_PATH', '../');
define('PAGE_TITLE', 'ADMIN_TOOLS');
define('PAGE_TITLE', 'ADMIN_CALENDAR');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
@ -494,6 +494,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<p id="lang_ticket_due_date_updated"><?php echo $hesklang['ticket_due_date_updated']; ?></p>
<p id="lang_error_updating_ticket_due_date"><?php echo $hesklang['error_updating_ticket_due_date']; ?></p>
<p id="setting_first_day_of_week"><?php echo $modsForHesk_settings['first_day_of_week']; ?></p>
<p id="setting_default_view">
<?php
$view_array = array(
0 => 'month',
1 => 'agendaWeek',
2 => 'agendaDay',
);
echo $view_array[$_SESSION['default_calendar_view']];
?>
</p>
</div>
<?php

@ -49,6 +49,13 @@ hesk_checkPermission('can_man_users');
/* Possible user features */
$hesk_settings['features'] = hesk_getFeatureArray();
$modsForHesk_settings = mfh_getSettings();
$calendar_view_array = array(
'month' => 0,
'agendaWeek' => 1,
'agendaDay' => 2,
);
$default_view = $calendar_view_array[$modsForHesk_settings['default_calendar_view']];
/* Set default values */
$default_userdata = array(
@ -78,6 +85,7 @@ $default_userdata = array(
'notify_customer_new' => 1,
'notify_customer_reply' => 1,
'show_suggested' => 1,
'default_calendar_view' => $default_view,
// Notifications
'notify_new_unassigned' => 1,
@ -91,7 +99,6 @@ $default_userdata = array(
'notify_overdue_unassigned' => 0,
);
$modsForHesk_settings = mfh_getSettings();
/* A list of all categories */
$orderBy = $modsForHesk_settings['category_order_column'];
$hesk_settings['categories'] = array();
@ -518,7 +525,8 @@ function new_user()
`notify_note_unassigned`,
`notify_overdue_unassigned`,
`autorefresh`,
`permission_template`) VALUES (
`permission_template`,
`default_calendar_view`) VALUES (
'" . hesk_dbEscape($myuser['user']) . "',
'" . hesk_dbEscape($myuser['pass']) . "',
'" . intval($myuser['isadmin']) . "',
@ -543,7 +551,8 @@ function new_user()
'" . ($myuser['notify_note_unassigned']) . "',
'" . ($myuser['notify_overdue_unassigned']) . "',
" . intval($myuser['autorefresh']) . ",
" . intval($myuser['template']) . ")");
" . intval($myuser['template']) . ",
" . intval($myuser['default_calendar_view']) . ")");
$_SESSION['seluser'] = hesk_dbInsertID();
@ -668,7 +677,8 @@ function update_user()
`notify_note_unassigned`='" . ($myuser['notify_note_unassigned']) . "',
`notify_overdue_unassigned`='" . ($myuser['notify_overdue_unassigned']) . "',
`autorefresh`=" . intval($myuser['autorefresh']) . ",
`permission_template`=" . intval($myuser['template']) . "
`permission_template`=" . intval($myuser['template']) . ",
`default_calendar_view`=" . intval($myuser['default_calendar_view']) . "
WHERE `id`='" . intval($myuser['id']) . "' LIMIT 1");
// If they are now inactive, remove any manager rights
@ -769,6 +779,7 @@ function hesk_validateUserInfo($pass_required = 1, $redirect_to = './manage_user
$myuser['notify_customer_new'] = isset($_POST['notify_customer_new']) ? 1 : 0;
$myuser['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0;
$myuser['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0;
$myuser['default_calendar_view'] = hesk_POST('default-calendar-view', 0);
/* Notifications */
$myuser['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) ? 0 : 1;

@ -230,6 +230,9 @@ function update_profile()
/* Auto-start ticket timer */
$_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0;
/* Default calendar view */
$_SESSION['new']['default_calendar_view'] = hesk_POST('default-calendar-view', 0);
/* Update auto-refresh time */
$_SESSION['new']['autorefresh'] = isset($_POST['autorefresh']) ? $_POST['autorefresh'] : 0;
@ -277,7 +280,8 @@ function update_profile()
`notify_customer_new`='" . $_SESSION['new']['notify_customer_new'] . "',
`notify_customer_reply`='" . $_SESSION['new']['notify_customer_reply'] . "',
`notify_overdue_unassigned`='" . $_SESSION['new']['notify_overdue_unassigned'] . "',
`show_suggested`='" . $_SESSION['new']['show_suggested'] . "'
`show_suggested`='" . $_SESSION['new']['show_suggested'] . "',
`default_calendar_view`=" . intval($_SESSION['new']['default_calendar_view']) . "
WHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1"
);

@ -122,4 +122,6 @@ require_once(HESK_PATH . 'inc/header.inc.php');
</div>
<div style="display: none">
<p id="lang_error_loading_events"><?php echo $hesklang['error_loading_events']; ?></p>
<p id="setting_default_view"><?php echo $modsForHesk_settings['default_calendar_view']; ?></p>
<p id="setting_first_day_of_week"><?php echo $modsForHesk_settings['first_day_of_week']; ?></p>
</div>

@ -26,6 +26,9 @@ if (hesk_check_maintenance(false)) {
hesk_load_cron_database_functions();
hesk_dbConnect();
$modsForHesk_settings = mfh_getSettings();
$skip_events = $modsForHesk_settings['enable_calendar'] == 0;
if ($hesk_settings['debug_mode']) {
echo "Starting Calendar Reminders...\n";
}
@ -60,19 +63,18 @@ $sql = "SELECT `reminder`.`id` AS `reminder_id`, `reminder`.`user_id` AS `user_i
AND `email_sent` = '0'";
$rs = hesk_dbQuery($sql);
$modsForHesk_settings = mfh_getSettings();
$reminders_to_flag = [];
$tickets_to_flag = [];
$included_email_functions = false;
if (hesk_dbNumRows($rs) > 0) {
if (hesk_dbNumRows($rs) > 0 && !$skip_events) {
require(HESK_PATH . 'inc/email_functions.inc.php');
$included_email_functions = true;
}
$successful_emails = 0;
$failed_emails = 0;
while ($row = hesk_dbFetchAssoc($rs)) {
while ($row = hesk_dbFetchAssoc($rs) && !$skip_events) {
if (mfh_sendCalendarReminder($row, $modsForHesk_settings)) {
$reminders_to_flag[] = $row['reminder_id'];
$successful_emails++;

@ -295,6 +295,10 @@ div.setupButtons {
color: blue;
}
.black {
color: black;
}
.pad-down-20 {
padding-top: 20px;
}

@ -320,10 +320,12 @@ if ($modsForHesk_settings['show_icons']) {
if (defined('PAGE_TITLE') && PAGE_TITLE == 'CUSTOMER_CALENDAR') {
$active = ' active';
}
if ($modsForHesk_settings['enable_calendar'] == 1):
?>
<li class="dropdown<?php echo $active; ?>">
<li class="<?php echo $active; ?>">
<a href="<?php echo HESK_PATH; ?>calendar.php"><i class="fa fa-calendar" <?php echo $iconDisplay; ?>></i>&nbsp;Calendar</a>
</li>
<?php endif; ?>
<?php include('custom/header-custom.inc.php'); ?>
</ul>
<?php if ($hesk_settings['can_sel_lang']) { ?>

@ -319,12 +319,31 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
</div>
</div>
<?php } ?>
<div class="form-group">
<label for="default-calendar-view" class="col-sm-3 control-label">
<?php echo $hesklang['default_view']; ?>
</label>
<div class="col-sm-9">
<select class="form-control" name="default-calendar-view">
<option value="0" <?php if ($_SESSION[$session_array]['default_calendar_view'] == 0) { echo 'selected'; } ?>>
<?php echo $hesklang['month']; ?>
</option>
<option value="1" <?php if ($_SESSION[$session_array]['default_calendar_view'] == 1) { echo 'selected'; } ?>>
<?php echo $hesklang['week']; ?>
</option>
<option value="2" <?php if ($_SESSION[$session_array]['default_calendar_view'] == 2) { echo 'selected'; } ?>>
<?php echo $hesklang['calendar_day']; ?>
</option>
</select>
</div>
</div>
<div class="form-group">
<label for="autoRefresh"
class="col-sm-3 control-label"><?php echo $hesklang['ticket_auto_refresh']; ?></label>
<div class="col-sm-9">
<input type="text" class="form-control" id="autorefresh" name="autorefresh"
placeholder="<?php echo htmlspecialchars($hesklang['ticket_auto_refresh']); ?>"
value="<?php echo $_SESSION[$session_array]['autorefresh']; ?>">
<span class="help-block"><?php echo $hesklang['autorefresh_restrictions']; ?></span>
</div>

@ -145,6 +145,13 @@ if (hesk_check_kb_only(false)) {
echo '<li'.$active.'><a href="knowledgebase_private.php"><i class="fa fa-book" ' . $iconDisplay . '></i>&nbsp;' . $hesklang['menu_kb'] . '</a></li>';
}
}
if ($modsForHesk_settings['enable_calendar'] != 0) {
$active = '';
if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_CALENDAR') {
$active = ' class="active"';
}
echo '<li'.$active.'><a href="calendar.php"><i class="fa fa-calendar" ' . $iconDisplay . '></i>&nbsp;' . $hesklang['calendar_title_case'] . '</a></li>';
}
if (hesk_checkPermission('can_run_reports', 0)) {
$active = '';
if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_REPORTS') {

@ -1348,11 +1348,11 @@ function print_start()
</a>
</div>
</div>
<div class="row default-row-margins">
<?php
if ($hesk_settings['kb_enable'])
{
?>
<div class="row default-row-margins">
<div class="col-sm-6 col-xs-12">
<a href="knowledgebase.php" class="button-link">
<div class="panel panel-default">
@ -1370,11 +1370,34 @@ function print_start()
</div>
</a>
</div>
<?php } if ($modsForHesk_settings['enable_calendar'] == 1): ?>
<div class="col-sm-6 col-xs-12">
<a href="calendar.php" class="button-link">
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-xs-1">
<i class="fa fa-calendar black" style="font-size: 32px"
title="<?php echo $hesklang['calendar_title_case']; ?>"></i>
</div>
<div class="col-xs-11">
<b><?php echo $hesklang['calendar_title_case']; ?></b><br>
<?php echo $hesklang['calendar_index']; ?>
</div>
</div>
</div>
</div>
</a>
</div>
<?php endif; ?>
</div>
<?php
if ($hesk_settings['kb_enable'])
{
hesk_kbTopArticles($hesk_settings['kb_index_popart']);
hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
}?>
}
?>
</div>
</div>
<div class="blankSpace"></div>

@ -741,6 +741,7 @@ function execute260Scripts()
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`");
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_calendar_view` INT NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')");
executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')");

@ -9,6 +9,8 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
$.ajax({
url: getHelpdeskUrl() + '/internal-api/calendar/?start=' + start + '&end=' + end,

@ -9,6 +9,8 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
$.ajax({
url: getHelpdeskUrl() + '/internal-api/calendar/?start=' + start + '&end=' + end,

@ -10,6 +10,7 @@ $(document).ready(function() {
timeFormat: 'H:mm',
axisFormat: 'H:mm',
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
$.ajax({
url: getHelpdeskUrl() + '/internal-api/admin/calendar/?start=' + start + '&end=' + end,

@ -94,10 +94,11 @@ $hesklang['no_disable_calendar'] = '<b>NO</b>, disable calendar';
$hesklang['first_day_of_week'] = 'First day of week';
$hesklang['first_day_of_week_help'] = 'This setting decides which day of the week to show first per week.';
$hesklang['calendar_disabled'] = 'The calendar is disabled';
$hesklang['default_view'] = 'Default view';
$hesklang['default_view'] = 'Default Calendar View';
$hesklang['default_view_help'] = 'Decide which view will be shown to customers and staff by default when viewing the calendar. Staff can change this setting via their own profile.';
$hesklang['week'] = 'Week';
$hesklang['agenda'] = 'Agenda';
$hesklang['calendar_day'] = 'Day';
$hesklang['calendar_index'] = 'View upcoming events';
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
$hesklang['manage_statuses'] = 'Manage Statuses';

Loading…
Cancel
Save