Merge branch 'calendar-planning' into '2-6-0'
Calendar planning Adds the calendar planning module to MFH. See merge request !1
This commit is contained in:
commit
78b1c9933b
@ -552,6 +552,14 @@ if (defined('HESK_DEMO')) {
|
|||||||
<li class="active"><a href="#general" data-toggle="tab"><?php echo $hesklang['tab_1']; ?></a></li>
|
<li class="active"><a href="#general" data-toggle="tab"><?php echo $hesklang['tab_1']; ?></a></li>
|
||||||
<li><a href="#helpdesk" data-toggle="tab"><?php echo $hesklang['tab_2']; ?></a></li>
|
<li><a href="#helpdesk" data-toggle="tab"><?php echo $hesklang['tab_2']; ?></a></li>
|
||||||
<li><a href="#knowledgebase" data-toggle="tab"><?php echo $hesklang['tab_3']; ?></a></li>
|
<li><a href="#knowledgebase" data-toggle="tab"><?php echo $hesklang['tab_3']; ?></a></li>
|
||||||
|
<li>
|
||||||
|
<a href="#calendar" data-toggle="tab"><?php echo $hesklang['calendar_title_case']; ?>
|
||||||
|
<span class="label label-primary" data-toggle="tooltip"
|
||||||
|
title="<?php echo $hesklang['added_in_mods_for_hesk']; ?>">
|
||||||
|
<?php echo $hesklang['mods_for_hesk_acronym']; ?>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a href="#customFields" data-toggle="tab"><?php echo $hesklang['tab_4']; ?></a></li>
|
<li><a href="#customFields" data-toggle="tab"><?php echo $hesklang['tab_4']; ?></a></li>
|
||||||
<li><a href="#email" data-toggle="tab"><?php echo $hesklang['tab_6']; ?></a></li>
|
<li><a href="#email" data-toggle="tab"><?php echo $hesklang['tab_6']; ?></a></li>
|
||||||
<li><a href="#ticket-list" data-toggle="tab"><?php echo $hesklang['tab_7']; ?></a></li>
|
<li><a href="#ticket-list" data-toggle="tab"><?php echo $hesklang['tab_7']; ?></a></li>
|
||||||
@ -1970,6 +1978,85 @@ if (defined('HESK_DEMO')) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Calendar Tab -->
|
||||||
|
<div class="tab-pane fade in" id="calendar">
|
||||||
|
<h6 class="bold"><?php echo $hesklang['calendar_settings']; ?></h6>
|
||||||
|
<div class="footerWithBorder blankSpace"></div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="enable_calendar" class="col-sm-4 col-xs-12 control-label">
|
||||||
|
<?php echo $hesklang['enable_calendar']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
|
||||||
|
title="<?php echo $hesklang['enable_calendar']; ?>"
|
||||||
|
data-content="<?php echo $hesklang['enable_calendar_help']; ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-8 form-inline">
|
||||||
|
<?php
|
||||||
|
$on = $modsForHesk_settings['enable_calendar'] == 1 ? 'checked="checked"' : '';
|
||||||
|
$off = $modsForHesk_settings['enable_calendar'] ? '' : 'checked="checked"';
|
||||||
|
$only = $modsForHesk_settings['enable_calendar'] == 2 ? 'checked="checked"' : '';
|
||||||
|
echo '
|
||||||
|
<div class="radio"><label><input type="radio" name="enable_calendar" value="1" ' . $on . ' /> ' . $hesklang['yes_enable_calendar'] . '</label></div><br>
|
||||||
|
<div class="radio"><label><input type="radio" name="enable_calendar" value="2" ' . $only . ' /> ' . $hesklang['yes_enable_calendar_staff_only'] . '</label></div><br>
|
||||||
|
<div class="radio"><label><input type="radio" name="enable_calendar" value="0" ' . $off . ' /> ' . $hesklang['no_disable_calendar'] . '</label></div>';
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="first-day-of-week" class="col-sm-4 col-xs-12 control-label">
|
||||||
|
<?php echo $hesklang['first_day_of_week']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
|
||||||
|
title="<?php echo $hesklang['first_day_of_week']; ?>"
|
||||||
|
data-content="<?php echo $hesklang['first_day_of_week_help']; ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-8 col-xs-12">
|
||||||
|
<select name="first-day-of-week" class="form-control">
|
||||||
|
<option value="0" <?php if ($modsForHesk_settings['first_day_of_week'] == '0') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d0']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="1" <?php if ($modsForHesk_settings['first_day_of_week'] == '1') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d1']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="2" <?php if ($modsForHesk_settings['first_day_of_week'] == '2') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d2']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="3" <?php if ($modsForHesk_settings['first_day_of_week'] == '3') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d3']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="4" <?php if ($modsForHesk_settings['first_day_of_week'] == '4') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d4']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="5" <?php if ($modsForHesk_settings['first_day_of_week'] == '5') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d5']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="6" <?php if ($modsForHesk_settings['first_day_of_week'] == '6') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['d6']; ?>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="default-view" class="col-sm-4 col-xs-12 control-label">
|
||||||
|
<?php echo $hesklang['default_view']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
|
||||||
|
title="<?php echo $hesklang['default_view']; ?>"
|
||||||
|
data-content="<?php echo $hesklang['default_view_help']; ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-8 col-xs-12">
|
||||||
|
<select name="default-view" class="form-control">
|
||||||
|
<option value="month" <?php if ($modsForHesk_settings['default_calendar_view'] == 'month') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['month']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="agendaWeek" <?php if ($modsForHesk_settings['default_calendar_view'] == 'week') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['week']; ?>
|
||||||
|
</option>
|
||||||
|
<option value="agendaDay" <?php if ($modsForHesk_settings['default_calendar_view'] == 'agenda') { echo 'selected'; } ?>>
|
||||||
|
<?php echo $hesklang['calendar_day']; ?>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Custom Fields Tab -->
|
<!-- Custom Fields Tab -->
|
||||||
<div class="tab-pane fade in" id="customFields">
|
<div class="tab-pane fade in" id="customFields">
|
||||||
<h6 class="bold"><?php echo $hesklang['custom_use']; ?> <a href="Javascript:void(0)"
|
<h6 class="bold"><?php echo $hesklang['custom_use']; ?> <a href="Javascript:void(0)"
|
||||||
|
@ -497,6 +497,9 @@ $set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort'
|
|||||||
$set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments');
|
$set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments');
|
||||||
$set['display_user_agent_information'] = empty($_POST['display_user_agent_information']) ? 0 : 1;
|
$set['display_user_agent_information'] = empty($_POST['display_user_agent_information']) ? 0 : 1;
|
||||||
$set['navbar_title_url'] = hesk_POST('navbar_title_url');
|
$set['navbar_title_url'] = hesk_POST('navbar_title_url');
|
||||||
|
$set['enable_calendar'] = hesk_checkMinMax(intval(hesk_POST('enable_calendar')), 0, 2, 2);
|
||||||
|
$set['first_day_of_week'] = hesk_POST('first-day-of-week', 0);
|
||||||
|
$set['default_view'] = hesk_POST('default-view', 'month');
|
||||||
|
|
||||||
if ($set['customer-email-verification-required']) {
|
if ($set['customer-email-verification-required']) {
|
||||||
//-- Don't allow multiple emails if verification is required
|
//-- Don't allow multiple emails if verification is required
|
||||||
@ -544,6 +547,9 @@ mfh_updateSetting('navbar_title_url', $set['navbar_title_url'], true);
|
|||||||
mfh_updateSetting('mailgun_api_key', $set['mailgun_api_key'], true);
|
mfh_updateSetting('mailgun_api_key', $set['mailgun_api_key'], true);
|
||||||
mfh_updateSetting('mailgun_domain', $set['mailgun_domain'], true);
|
mfh_updateSetting('mailgun_domain', $set['mailgun_domain'], true);
|
||||||
mfh_updateSetting('use_mailgun', $set['use_mailgun'], false);
|
mfh_updateSetting('use_mailgun', $set['use_mailgun'], false);
|
||||||
|
mfh_updateSetting('enable_calendar', $set['enable_calendar'], false);
|
||||||
|
mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false);
|
||||||
|
mfh_updateSetting('default_calendar_view', $set['default_view'], true);
|
||||||
|
|
||||||
// Prepare settings file and save it
|
// Prepare settings file and save it
|
||||||
$settings_file_content = '<?php
|
$settings_file_content = '<?php
|
||||||
|
@ -244,6 +244,7 @@ $tmpvar['latitude'] = hesk_POST('latitude', 'E-4');
|
|||||||
$tmpvar['longitude'] = hesk_POST('longitude', 'E-4');
|
$tmpvar['longitude'] = hesk_POST('longitude', 'E-4');
|
||||||
|
|
||||||
$tmpvar['html'] = $modsForHesk_settings['rich_text_for_tickets'];
|
$tmpvar['html'] = $modsForHesk_settings['rich_text_for_tickets'];
|
||||||
|
$tmpvar['due_date'] = hesk_POST('due-date');
|
||||||
|
|
||||||
// Set user agent and screen res to null
|
// Set user agent and screen res to null
|
||||||
$tmpvar['user_agent'] = NULL;
|
$tmpvar['user_agent'] = NULL;
|
||||||
|
@ -33,6 +33,8 @@ define('HESK_PATH', '../');
|
|||||||
define('WYSIWYG', 1);
|
define('WYSIWYG', 1);
|
||||||
define('VALIDATOR', 1);
|
define('VALIDATOR', 1);
|
||||||
|
|
||||||
|
define('EXTRA_JS', '<script src="'.HESK_PATH.'internal-api/js/admin-ticket.js"></script>');
|
||||||
|
|
||||||
/* Get all the required files and functions */
|
/* Get all the required files and functions */
|
||||||
require(HESK_PATH . 'hesk_settings.inc.php');
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
require(HESK_PATH . 'inc/common.inc.php');
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
@ -550,7 +552,7 @@ require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
|
|||||||
|
|
||||||
/* List of categories */
|
/* List of categories */
|
||||||
$orderBy = $modsForHesk_settings['category_order_column'];
|
$orderBy = $modsForHesk_settings['category_order_column'];
|
||||||
$result = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
|
$result = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 2 ORDER BY `" . $orderBy . "` ASC");
|
||||||
$categories_options = '';
|
$categories_options = '';
|
||||||
while ($row = hesk_dbFetchAssoc($result)) {
|
while ($row = hesk_dbFetchAssoc($result)) {
|
||||||
$selected = '';
|
$selected = '';
|
||||||
@ -657,15 +659,47 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
?>
|
?>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong><?php echo $hesklang['created_on']; ?></strong><br/>
|
<strong><?php echo $hesklang['created_on']; ?></strong><br>
|
||||||
<?php echo hesk_date($ticket['dt'], true); ?>
|
<?php echo hesk_date($ticket['dt'], true); ?>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong><?php echo $hesklang['last_update']; ?></strong><br/>
|
<strong><?php echo $hesklang['last_update']; ?></strong><br>
|
||||||
<?php echo hesk_date($ticket['lastchange'], true); ?>
|
<?php echo hesk_date($ticket['lastchange'], true); ?>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<strong><?php echo $hesklang['last_replier']; ?></strong><br/>
|
<strong><?php echo $hesklang['due_date']; ?></strong><br>
|
||||||
|
<div id="readonly-due-date">
|
||||||
|
<span id="due-date">
|
||||||
|
<?php
|
||||||
|
$due_date = $hesklang['none'];
|
||||||
|
if ($ticket['due_date'] != null) {
|
||||||
|
$due_date = hesk_date($ticket['due_date'], false, true, false);
|
||||||
|
$due_date = date('Y-m-d', $due_date);
|
||||||
|
}
|
||||||
|
echo $due_date;
|
||||||
|
?></span><!--<span id="overdue">
|
||||||
|
<?php
|
||||||
|
/*if ($due_date < $current_date) {
|
||||||
|
echo ' <i class="fa fa-exclamation-triangle dark-orange" data-toggle="tooltip" title="Ticket overdue!"></i>';
|
||||||
|
}*/
|
||||||
|
?>
|
||||||
|
</span>-->
|
||||||
|
<br>
|
||||||
|
<button id="due-date-button" class="btn btn-default btn-sm"><?php echo $hesklang['chg']; ?></button>
|
||||||
|
</div>
|
||||||
|
<div id="editable-due-date" style="display: none">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control datepicker" name="due-date" value="<?php echo $due_date == $hesklang['none'] ? '' : $due_date; ?>">
|
||||||
|
<p class="help-block"><?php echo $hesklang['clear_for_no_due_date']; ?></p>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button id="submit" class="btn btn-primary"><?php echo $hesklang['save']; ?></button>
|
||||||
|
<button id="cancel" class="btn btn-default"><?php echo $hesklang['cancel']; ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<strong><?php echo $hesklang['last_replier']; ?></strong><br>
|
||||||
<?php echo $ticket['repliername']; ?>
|
<?php echo $ticket['repliername']; ?>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
@ -1473,6 +1507,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php // TODO BEGIN HIDDEN FIELDS FOR LANGUAGE STRINGS ?>
|
||||||
|
<div style="display: none">
|
||||||
|
<p id="lang_ticket_due_date_updated"><?php echo $hesklang['ticket_due_date_updated']; ?></p>
|
||||||
|
<p id="lang_none"><?php echo $hesklang['none']; ?></p>
|
||||||
|
<p id="lang_error_updating_ticket_due_date"><?php echo $hesklang['error_updating_ticket_due_date']; ?></p>
|
||||||
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
518
admin/calendar.php
Normal file
518
admin/calendar.php
Normal file
@ -0,0 +1,518 @@
|
|||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Title: Help Desk Software HESK
|
||||||
|
* Version: 2.6.5 from 28th August 2015
|
||||||
|
* Author: Klemen Stirn
|
||||||
|
* Website: http://www.hesk.com
|
||||||
|
********************************************************************************
|
||||||
|
* COPYRIGHT AND TRADEMARK NOTICE
|
||||||
|
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
|
||||||
|
* HESK is a registered trademark of Klemen Stirn.
|
||||||
|
* The HESK may be used and modified free of charge by anyone
|
||||||
|
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
|
||||||
|
* By using this code you agree to indemnify Klemen Stirn from any
|
||||||
|
* liability that might arise from it's use.
|
||||||
|
* Selling the code for this program, in part or full, without prior
|
||||||
|
* written consent is expressly forbidden.
|
||||||
|
* Using this code, in part or full, to create derivate work,
|
||||||
|
* new scripts or products is expressly forbidden. Obtain permission
|
||||||
|
* before redistributing this software over the Internet or in
|
||||||
|
* any other medium. In all cases copyright and header must remain intact.
|
||||||
|
* This Copyright is in full effect in any country that has International
|
||||||
|
* Trade Agreements with the United States of America or
|
||||||
|
* with the European Union.
|
||||||
|
* Removing any of the copyright notices without purchasing a license
|
||||||
|
* is expressly forbidden. To remove HESK copyright notice you must purchase
|
||||||
|
* a license for this script. For more information on how to obtain
|
||||||
|
* a license please visit the page below:
|
||||||
|
* https://www.hesk.com/buy.php
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
define('VALIDATOR', 1);
|
||||||
|
define('HESK_PATH', '../');
|
||||||
|
define('PAGE_TITLE', 'ADMIN_CALENDAR');
|
||||||
|
|
||||||
|
/* Get all the required files and functions */
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/admin_functions.inc.php');
|
||||||
|
hesk_load_database_functions();
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_dbConnect();
|
||||||
|
hesk_isLoggedIn();
|
||||||
|
|
||||||
|
// Define required constants
|
||||||
|
if (hesk_checkPermission('can_man_calendar', 0)) {
|
||||||
|
define('MFH_CALENDAR', 1);
|
||||||
|
} else {
|
||||||
|
define('MFH_CALENDAR_READONLY', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Is the calendar enabled?
|
||||||
|
$modsForHesk_settings = mfh_getSettings();
|
||||||
|
if ($modsForHesk_settings['enable_calendar'] == '0') {
|
||||||
|
hesk_error($hesklang['calendar_disabled']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get categories for the dropdown
|
||||||
|
$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 1 ORDER BY `cat_order`");
|
||||||
|
$categories = [];
|
||||||
|
while ($row = hesk_dbFetchAssoc($rs)) {
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000' : 'background: ' . $row['color'];
|
||||||
|
$categories[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print header */
|
||||||
|
require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
|
||||||
|
|
||||||
|
/* Print main manage users page */
|
||||||
|
require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="row pad-20">
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4><?php echo $hesklang['calendar_categories']; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<?php foreach ($categories as $category): ?>
|
||||||
|
<li class="move-down-20 move-right-20">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
|
||||||
|
</div>
|
||||||
|
<span class="label background-volatile category-label" style="<?php echo $category['css_style']; ?>">
|
||||||
|
<?php echo $category['name']; ?>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-9">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4>
|
||||||
|
<?php
|
||||||
|
echo $hesklang['calendar_title_case'];
|
||||||
|
if (hesk_checkPermission('can_man_calendar', 0)):
|
||||||
|
?>
|
||||||
|
<span class="nu-floatRight panel-button">
|
||||||
|
<button class="btn btn-success" id="create-event-button">
|
||||||
|
<i class="fa fa-plus-circle"></i>
|
||||||
|
<?php echo $hesklang['new_event']; ?>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="calendar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="create-event-modal" tabindex="-1" role="dialog" style="overflow: hidden">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="cursor: move">
|
||||||
|
<button type="button" class="close cancel-callback" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel">
|
||||||
|
<?php echo $hesklang['create_event']; ?>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<form id="create-form" class="form-horizontal" data-toggle="validator">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_title']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_title_tooltip']); ?>"></i></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="name" class="form-control" placeholder="<?php echo htmlspecialchars($hesklang['event_title']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="location" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_location']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_location_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="location" class="form-control"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_location']); ?>">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="category" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['category']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_category_toolip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select name="category" class="form-control"
|
||||||
|
pattern="[0-9]+"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['sel_app_cat']); ?>" required>
|
||||||
|
<?php
|
||||||
|
if ($hesk_settings['select_cat']) {
|
||||||
|
echo '<option value="">'.$hesklang['select'].'</option>';
|
||||||
|
}
|
||||||
|
foreach ($categories as $category): ?>
|
||||||
|
<option value="<?php echo $category['id']; ?>" data-color="<?php echo htmlspecialchars($category['color']); ?>">
|
||||||
|
<?php echo $category['name']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start-date" class="col-sm-6 control-label">
|
||||||
|
<?php echo $hesklang['event_start']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_start_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" name="start-date" class="form-control datepicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_start_date']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<input type="text" name="start-time" class="form-control clockpicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_start_time']); ?>"
|
||||||
|
data-placement="left" data-align="top" data-autoclose="true">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="all-day"> <?php echo $hesklang['event_all_day']; ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end-date" class="col-sm-6 control-label">
|
||||||
|
<?php echo $hesklang['event_end']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_end_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" name="end-date" class="form-control datepicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_end_date']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<input type="text" name="end-time" class="form-control clockpicker"
|
||||||
|
data-placement="left"
|
||||||
|
data-align="top"
|
||||||
|
data-autoclose="true"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_end_time']); ?>">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="reminder" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_reminder']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_reminder_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<input type="text" name="reminder-value" class="form-control" placeholder="#">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="reminder-unit" class="form-control">
|
||||||
|
<option value="0"><?php echo $hesklang['event_min_before_event']; ?></option>
|
||||||
|
<option value="1"><?php echo $hesklang['event_hours_before_event']; ?></option>
|
||||||
|
<option value="2"><?php echo $hesklang['event_days_before_event']; ?></option>
|
||||||
|
<option value="3"><?php echo $hesklang['event_weeks_before_event']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="comments" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_comments']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_comments_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea name="comments" class="form-control" placeholder="<?php echo htmlspecialchars($hesklang['event_comments']); ?>"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="action" value="create">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-default cancel-callback" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
<span><?php echo $hesklang['cancel']; ?></span>
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-success callback-btn">
|
||||||
|
<i class="fa fa-check-circle"></i>
|
||||||
|
<span><?php echo $hesklang['save']; ?></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php // End create modal, begin edit modal ?>
|
||||||
|
<div class="modal fade" id="edit-event-modal" tabindex="-1" role="dialog" style="overflow: hidden">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="cursor: move">
|
||||||
|
<button type="button" class="close cancel-callback" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel">Edit Event</h4>
|
||||||
|
</div>
|
||||||
|
<form id="edit-form" class="form-horizontal" data-toggle="validator">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_title']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_title_tooltip']); ?>"></i></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="name" class="form-control"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_title']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="location" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_location']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_location_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="location" class="form-control"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_location']); ?>">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="category" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['category']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_category_toolip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select name="category" class="form-control"
|
||||||
|
pattern="[0-9]+"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['sel_app_cat']); ?>" required>
|
||||||
|
<?php
|
||||||
|
if ($hesk_settings['select_cat']) {
|
||||||
|
echo '<option value="">'.$hesklang['select'].'</option>';
|
||||||
|
}
|
||||||
|
foreach ($categories as $category): ?>
|
||||||
|
<option value="<?php echo $category['id']; ?>" data-color="<?php echo $category['color']; ?>">
|
||||||
|
<?php echo $category['name']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="start-date" class="col-sm-6 control-label">
|
||||||
|
<?php echo $hesklang['event_start']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_start_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" name="start-date" class="form-control datepicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_start_date']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<input type="text" name="start-time" class="form-control clockpicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_start_time']); ?>"
|
||||||
|
data-placement="left" data-align="top" data-autoclose="true">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="all-day"> <?php echo $hesklang['event_all_day']; ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="end-date" class="col-sm-6 control-label">
|
||||||
|
<?php echo $hesklang['event_end']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_end_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" name="end-date" class="form-control datepicker"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_end_date']); ?>"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<input type="text" name="end-time" class="form-control clockpicker"
|
||||||
|
data-placement="left" data-align="top" data-autoclose="true"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['event_end_time']); ?>">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="reminder" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_reminder']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_reminder_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<input type="text" name="reminder-value" class="form-control" placeholder="#">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select name="reminder-unit" class="form-control">
|
||||||
|
<option value="0"><?php echo $hesklang['event_min_before_event']; ?></option>
|
||||||
|
<option value="1"><?php echo $hesklang['event_hours_before_event']; ?></option>
|
||||||
|
<option value="2"><?php echo $hesklang['event_days_before_event']; ?></option>
|
||||||
|
<option value="3"><?php echo $hesklang['event_weeks_before_event']; ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="comments" class="col-sm-3 control-label">
|
||||||
|
<?php echo $hesklang['event_comments']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['event_comments_tooltip']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea name="comments" class="form-control" placeholder="<?php echo htmlspecialchars($hesklang['event_comments']); ?>"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-danger" id="delete-button">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
<span><?php echo $hesklang['delete']; ?></span>
|
||||||
|
</button>
|
||||||
|
<a href="#" class="btn btn-primary" id="create-ticket-button">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
<span><?php echo $hesklang['event_create_ticket']; ?></span>
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-default cancel-callback" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
<span><?php echo $hesklang['cancel']; ?></span>
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-success callback-btn">
|
||||||
|
<i class="fa fa-check-circle"></i>
|
||||||
|
<span><?php echo $hesklang['save']; ?></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="popover-template" style="display: none">
|
||||||
|
<div>
|
||||||
|
<div class="popover-location">
|
||||||
|
<strong><?php echo $hesklang['event_location']; ?></strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-category">
|
||||||
|
<strong><?php echo $hesklang['category']; ?></strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-from">
|
||||||
|
<strong><?php echo $hesklang['from']; ?></strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-to">
|
||||||
|
<strong><?php echo $hesklang['to_title_case']; ?></strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="display: none">
|
||||||
|
<p id="lang_error_loading_events"><?php echo $hesklang['error_loading_events']; ?></p>
|
||||||
|
<p id="lang_error_deleting_event"><?php echo $hesklang['error_deleting_event']; ?></p>
|
||||||
|
<p id="lang_event_deleted"><?php echo $hesklang['event_deleted']; ?></p>
|
||||||
|
<p id="lang_event_created"><?php echo $hesklang['event_created']; ?></p>
|
||||||
|
<p id="lang_error_creating_event"><?php echo $hesklang['error_creating_event']; ?></p>
|
||||||
|
<p id="lang_event_updated"><?php echo $hesklang['event_updated']; ?></p>
|
||||||
|
<p id="lang_error_updating_event"><?php echo $hesklang['error_updating_event']; ?></p>
|
||||||
|
<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
|
||||||
|
|
||||||
|
require_once(HESK_PATH . 'inc/footer.inc.php');
|
||||||
|
exit();
|
||||||
|
|
||||||
|
|
||||||
|
/*** START FUNCTIONS ***/
|
@ -62,8 +62,6 @@ if ($action = hesk_REQUEST('a')) {
|
|||||||
hesk_process_messages($hesklang['ddemo'], 'manage_categories.php', 'NOTICE');
|
hesk_process_messages($hesklang['ddemo'], 'manage_categories.php', 'NOTICE');
|
||||||
} elseif ($action == 'new') {
|
} elseif ($action == 'new') {
|
||||||
new_cat();
|
new_cat();
|
||||||
} elseif ($action == 'rename') {
|
|
||||||
rename_cat();
|
|
||||||
} elseif ($action == 'remove') {
|
} elseif ($action == 'remove') {
|
||||||
remove();
|
remove();
|
||||||
} elseif ($action == 'order') {
|
} elseif ($action == 'order') {
|
||||||
@ -72,10 +70,8 @@ if ($action = hesk_REQUEST('a')) {
|
|||||||
toggle_autoassign();
|
toggle_autoassign();
|
||||||
} elseif ($action == 'type') {
|
} elseif ($action == 'type') {
|
||||||
toggle_type();
|
toggle_type();
|
||||||
} elseif ($action == 'priority') {
|
} elseif ($action == 'edit') {
|
||||||
change_priority();
|
update_category();
|
||||||
} elseif ($action == 'manager') {
|
|
||||||
change_manager();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,21 +108,15 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
?>
|
?>
|
||||||
<div class="row move-down-20">
|
<div class="row move-down-20">
|
||||||
<div align="left" class="col-md-4">
|
<div align="left" class="col-md-4">
|
||||||
<ul class="nav nav-tabs">
|
<div class="panel panel-default">
|
||||||
<li class="active"><a href="#addCat" data-toggle="tab"><?php echo $hesklang['add_cat']; ?></a></li>
|
<div class="panel-heading">
|
||||||
<li><a href="#renameCat" data-toggle="tab"><?php echo $hesklang['ren_cat']; ?></a></li>
|
<?php echo $hesklang['add_cat']; ?>
|
||||||
<li><a href="#changePriority" data-toggle="tab"><?php echo $hesklang['ch_cat_pri']; ?></a></li>
|
</div>
|
||||||
</ul>
|
<div class="panel-body">
|
||||||
<div class="tab-content summaryList tabPadding">
|
|
||||||
<div class="tab-pane fade in active" id="addCat">
|
|
||||||
<!-- CONTENT -->
|
|
||||||
<form action="manage_categories.php" method="post" role="form" class="form-horizontal" data-toggle="validator">
|
<form action="manage_categories.php" method="post" role="form" class="form-horizontal" data-toggle="validator">
|
||||||
<h4><?php echo $hesklang['add_cat']; ?></h4>
|
|
||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<p class="col-sm-4 control-label" style="font-size: .87em">
|
<p class="col-sm-4 control-label" style="font-size: .87em">
|
||||||
<b><?php echo $hesklang['cat_name']; ?>:</b> (<?php echo $hesklang['max_chars']; ?>)</p>
|
<b><?php echo $hesklang['cat_name']; ?></b> (<?php echo $hesklang['max_chars']; ?>)</p>
|
||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input class="form-control"
|
<input class="form-control"
|
||||||
@ -166,7 +156,30 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="options" class="col-sm-4 control-label"><?php echo $hesklang['opt']; ?>:</label>
|
<label for="color" class="col-sm-4 control-label">
|
||||||
|
<?php echo $hesklang['category_color']; ?>
|
||||||
|
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
|
||||||
|
title="<?php echo htmlspecialchars($hesklang['category_color']); ?>"
|
||||||
|
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i>
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input class="form-control"
|
||||||
|
placeholder="<?php echo htmlspecialchars($hesklang['category_color']); ?>" type="text"
|
||||||
|
name="color" maxlength="7">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="usage" class="col-sm-4 control-label">Usage</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select name="usage" class="form-control">
|
||||||
|
<option value="0">Tickets and events</option>
|
||||||
|
<option value="1">Tickets only</option>
|
||||||
|
<option value="2">Events only</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="options" class="col-sm-4 control-label"><?php echo $hesklang['opt']; ?></label>
|
||||||
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<?php
|
<?php
|
||||||
@ -196,89 +209,16 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="renameCat">
|
|
||||||
<form action="manage_categories.php" method="post" role="form" class="form-horizontal" data-toggle="validator">
|
|
||||||
<h4><?php echo $hesklang['ren_cat']; ?></h4>
|
|
||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="catid" class="col-sm-4 control-label"><?php echo $hesklang['oln']; ?></label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<select class="form-control" name="catid"><?php echo $options; ?></select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="name" class="col-sm-4 control-label"><?php echo $hesklang['nen']; ?></label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input class="form-control"
|
|
||||||
placeholder="<?php echo htmlspecialchars($hesklang['cat_name']); ?>" type="text"
|
|
||||||
name="name" size="40" maxlength="40" <?php if (isset($_SESSION['catname2'])) {
|
|
||||||
echo ' value="' . hesk_input($_SESSION['catname2']) . '" ';
|
|
||||||
} ?>
|
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['enter_cat_name']); ?>"
|
|
||||||
required>
|
|
||||||
<div class="help-block with-errors"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group text-center">
|
|
||||||
<input type="hidden" name="a" value="rename"/>
|
|
||||||
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
|
|
||||||
<input type="submit" value="<?php echo $hesklang['ren_cat']; ?>" class="btn btn-default"/>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane fade" id="changePriority">
|
|
||||||
<form action="manage_categories.php" method="post" role="form" class="form-horizontal">
|
|
||||||
<h4><?php echo $hesklang['ch_cat_pri']; ?></h4>
|
|
||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="catid" class="col-sm-4 control-label"><?php echo $hesklang['category']; ?></label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<select name="catid" class="form-control"><?php echo $options; ?></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="priority"
|
|
||||||
class="col-sm-4 control-label"><?php echo $hesklang['priority']; ?></label>
|
|
||||||
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<select name="priority" class="form-control">
|
|
||||||
<?php
|
|
||||||
// Default priority: low
|
|
||||||
if (!isset($_SESSION['cat_ch_priority'])) {
|
|
||||||
$_SESSION['cat_ch_priority'] = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// List possible priorities
|
|
||||||
foreach ($priorities as $value => $info) {
|
|
||||||
echo '<option value="' . $value . '"' . ($_SESSION['cat_ch_priority'] == $value ? ' selected="selected"' : '') . '>' . $info['text'] . '</option>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-sm-8 col-sm-offset-4">
|
|
||||||
<input type="hidden" name="a" value="priority"/>
|
|
||||||
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
|
|
||||||
<input type="submit" value="<?php echo $hesklang['ch_cat_pri']; ?>" class="btn btn-default">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(function () {
|
|
||||||
$('#addCat a:last').tab('show')
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<?php echo $hesklang['manage_cat']; ?> <a href="javascript:void(0)"
|
||||||
|
onclick="javascript:alert('<?php echo hesk_makeJsString($hesklang['cat_intro']); ?>')"><i
|
||||||
|
class="fa fa-question-circle settingsquestionmark"></i></a>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
<?php
|
<?php
|
||||||
/* This will handle error, success and notice messages */
|
/* This will handle error, success and notice messages */
|
||||||
hesk_handle_messages();
|
hesk_handle_messages();
|
||||||
@ -287,19 +227,15 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
hesk_show_notice($hesklang['cat_pri_info'] . ' ' . $hesklang['cpri']);
|
hesk_show_notice($hesklang['cat_pri_info'] . ' ' . $hesklang['cpri']);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<h3><?php echo $hesklang['manage_cat']; ?> <a href="javascript:void(0)"
|
|
||||||
onclick="javascript:alert('<?php echo hesk_makeJsString($hesklang['cat_intro']); ?>')"><i
|
|
||||||
class="fa fa-question-circle settingsquestionmark"></i></a></h3>
|
|
||||||
|
|
||||||
<div class="footerWithBorder blankSpace"></div>
|
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $hesklang['id']; ?></th>
|
<th style="display: none"><?php echo $hesklang['id']; ?></th>
|
||||||
<th><?php echo $hesklang['cat_name']; ?></th>
|
<th><?php echo $hesklang['cat_name']; ?></th>
|
||||||
<th><?php echo $hesklang['priority']; ?></th>
|
<th><?php echo $hesklang['priority']; ?></th>
|
||||||
<th><?php echo $hesklang['not']; ?></th>
|
<th><?php echo $hesklang['not']; ?></th>
|
||||||
<th><?php echo $hesklang['graph']; ?></th>
|
<th><?php echo $hesklang['graph']; ?></th>
|
||||||
<th><?php echo $hesklang['manager'] ?></th>
|
<th><?php echo 'Usage'; ?></th>
|
||||||
|
<th><?php echo $hesklang['manager']; ?></th>
|
||||||
<th><?php echo $hesklang['opt']; ?></th>
|
<th><?php echo $hesklang['opt']; ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -326,6 +262,13 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
$j = 0;
|
$j = 0;
|
||||||
$num = hesk_dbNumRows($res);
|
$num = hesk_dbNumRows($res);
|
||||||
|
|
||||||
|
$usage = array(
|
||||||
|
0 => '<i class="fa fa-fw fa-ticket icon-link" data-toggle="tooltip" title="Tickets"></i>
|
||||||
|
<i class="fa fa-fw fa-calendar icon-link" data-toggle="tooltip" title="Events"></i>',
|
||||||
|
1 => '<i class="fa fa-fw fa-ticket icon-link" data-toggle="tooltip" title="Tickets"></i><i class="fa fa-fw"></i>',
|
||||||
|
2 => '<i class="fa fa-fw icon-link"> </i> <i class="fa fa-fw fa-calendar icon-link" data-toggle="tooltip" title="Events"></i>'
|
||||||
|
);
|
||||||
|
|
||||||
while ($mycat = hesk_dbFetchAssoc($res)) {
|
while ($mycat = hesk_dbFetchAssoc($res)) {
|
||||||
$j++;
|
$j++;
|
||||||
|
|
||||||
@ -337,7 +280,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tmp = $i ? 'White' : 'Blue';
|
$tmp = $i ? 'White' : 'Blue';
|
||||||
$style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"';
|
$style = '';
|
||||||
|
if ($mycat['color'] == null) {
|
||||||
|
$style .= 'color: black; border: solid 1px #000';
|
||||||
|
} else {
|
||||||
|
$style .= 'background: ' . $mycat['color'];
|
||||||
|
}
|
||||||
$i = $i ? 0 : 1;
|
$i = $i ? 0 : 1;
|
||||||
|
|
||||||
/* Number of tickets and graph width */
|
/* Number of tickets and graph width */
|
||||||
@ -373,19 +321,22 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<tr>
|
<tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '"
|
||||||
<td>' . $mycat['id'] . '</td>
|
data-color="'. htmlspecialchars($mycat['color']) . '" data-priority="' . $mycat['priority'] . '"
|
||||||
<td>' . $mycat['name'] . '</td>
|
data-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'">
|
||||||
|
<td style="display: none">' . $mycat['id'] . '</td>
|
||||||
|
<td><span class="label background-volatile category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
|
||||||
<td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td>
|
<td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td>
|
||||||
<td><a href="show_tickets.php?category=' . $mycat['id'] . '&s_all=1&s_my=1&s_ot=1&s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td>
|
<td><a href="show_tickets.php?category=' . $mycat['id'] . '&s_all=1&s_my=1&s_ot=1&s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '">
|
<div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '" data-toggle="tooltip">
|
||||||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%">
|
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%">
|
||||||
<span class="sr-only">40% Complete (success)</span>
|
<span class="sr-only">40% Complete (success)</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>' . output_user_dropdown($mycat['id'], $mycat['manager'], $users) . '</td>
|
<td>' . $usage[$mycat['usage']] . '</td>
|
||||||
|
<td>' . get_manager($mycat['manager'], $users) . '</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'manage_categories.php?a=linkcode&catid=' . $mycat['id'] . '&p=' . $mycat['type'] . '\',\'200\',\'500\')" id="tooltip"><i class="fa fa-code icon-link" style="color: ' . ($mycat['type'] ? 'gray' : 'green') . '" data-toggle="tooltip" data-placement="top" title="' . $hesklang['geco'] . '"></i></a>
|
<a href="Javascript:void(0)" onclick="Javascript:hesk_window(\'manage_categories.php?a=linkcode&catid=' . $mycat['id'] . '&p=' . $mycat['type'] . '\',\'200\',\'500\')" id="tooltip"><i class="fa fa-code icon-link" style="color: ' . ($mycat['type'] ? 'gray' : 'green') . '" data-toggle="tooltip" data-placement="top" title="' . $hesklang['geco'] . '"></i></a>
|
||||||
' . $autoassign_code . '
|
' . $autoassign_code . '
|
||||||
@ -393,7 +344,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
|
|
||||||
if ($orderBy != 'name' && $num > 1) {
|
if ($orderBy != 'name' && $num > 1) {
|
||||||
if ($j == 1) {
|
if ($j == 1) {
|
||||||
echo '<img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" /> <a href="manage_categories.php?a=order&catid=' . $mycat['id'] . '&move=15&token=' . hesk_token_echo(0) . '"><i class="fa fa-arrow-down icon-link green" data-toggle="tooltip" data-placement="top" title="' . $hesklang['move_dn'] . '"></i></a>';
|
echo '<img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" /> <a href="manage_categories.php?a=order&catid=' . $mycat['id'] . '&move=15&token=' . hesk_token_echo(0) . '"><i class="fa fa-arrow-down icon-link green" data-toggle="tooltip" data-placement="top" title="' . $hesklang['move_dn'] . '"></i></a> ';
|
||||||
} elseif ($j == $num) {
|
} elseif ($j == $num) {
|
||||||
echo '<a href="manage_categories.php?a=order&catid=' . $mycat['id'] . '&move=-15&token=' . hesk_token_echo(0) . '"><i class="fa fa-arrow-up icon-link green" data-toggle="tooltip" data-placement="top" title="' . $hesklang['move_up'] . '"></i></a> <img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" />';
|
echo '<a href="manage_categories.php?a=order&catid=' . $mycat['id'] . '&move=-15&token=' . hesk_token_echo(0) . '"><i class="fa fa-arrow-up icon-link green" data-toggle="tooltip" data-placement="top" title="' . $hesklang['move_up'] . '"></i></a> <img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" />';
|
||||||
} else {
|
} else {
|
||||||
@ -403,7 +354,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
';
|
';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
echo '<a href="javascript:;" class="category-modal-trigger" data-category-id="' . $mycat['id'] . '"><i class="fa fa-pencil icon-link orange" data-toggle="tooltip" title="Edit"></i></a>';
|
||||||
echo $remove_code . '</td>
|
echo $remove_code . '</td>
|
||||||
</tr>
|
</tr>
|
||||||
';
|
';
|
||||||
@ -413,7 +364,116 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
|
|||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Edit category modal -->
|
||||||
|
<div class="modal fade" id="edit-category-modal" tabindex="-1" role="dialog" style="overflow: hidden">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="cursor: move">
|
||||||
|
<button type="button" class="close cancel-callback" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel">Edit Category</h4>
|
||||||
|
</div>
|
||||||
|
<form action="manage_categories.php" class="form-horizontal" data-toggle="validator" method="post">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name" class="col-sm-3 control-label">Name</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="name" class="form-control" placeholder="Name"
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="color" class="col-sm-3 control-label">Color</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input type="text" name="color" class="form-control" placeholder="Color">
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="priority" class="col-sm-3 control-label">Priority</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select name="priority" class="form-control">
|
||||||
|
<?php
|
||||||
|
// List possible priorities
|
||||||
|
foreach ($priorities as $value => $info) {
|
||||||
|
echo '<option value="' . $value . '">' . $info['text'] . '</option>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="manager" class="col-sm-3 control-label">
|
||||||
|
Manager
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<?php echo output_user_dropdown($users); ?>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="usage" class="col-sm-3 control-label">
|
||||||
|
Usage
|
||||||
|
</label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select name="usage" class="form-control">
|
||||||
|
<option value="0">Tickets and events</option>
|
||||||
|
<option value="1">Tickets only</option>
|
||||||
|
<option value="2">Events only</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="a" value="edit">
|
||||||
|
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-default cancel-callback" data-dismiss="modal">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
<span>Cancel</span>
|
||||||
|
</button>
|
||||||
|
<button type="submit" class="btn btn-success callback-btn">
|
||||||
|
<i class="fa fa-check-circle"></i>
|
||||||
|
<span>Save</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.category-modal-trigger').click(function() {
|
||||||
|
var $row = $('tr[data-category-id="' + $(this).attr('data-category-id') + '"]');
|
||||||
|
var name = $row.attr('data-name');
|
||||||
|
var id = $row.attr('data-category-id');
|
||||||
|
var color = $row.attr('data-color');
|
||||||
|
var priority = $row.attr('data-priority');
|
||||||
|
var manager = $row.attr('data-manager');
|
||||||
|
var usage = $row.attr('data-usage');
|
||||||
|
|
||||||
|
var $modal = $('#edit-category-modal');
|
||||||
|
$modal.find('input[name="name"]').val(name).end()
|
||||||
|
.find('input[name="color"]').val(color).end()
|
||||||
|
.find('select[name="priority"]').val(priority).end()
|
||||||
|
.find('select[name="manager"]').val(manager).end()
|
||||||
|
.find('input[name="id"]').val(id).end()
|
||||||
|
.find('select[name="usage"]').val(usage).end()
|
||||||
|
.modal('show');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once(HESK_PATH . 'inc/footer.inc.php');
|
require_once(HESK_PATH . 'inc/footer.inc.php');
|
||||||
@ -535,6 +595,12 @@ function new_cat()
|
|||||||
/* Category name */
|
/* Category name */
|
||||||
$catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');
|
$catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');
|
||||||
|
|
||||||
|
$color = hesk_POST('color', null);
|
||||||
|
$color = str_replace('#', '', $color);
|
||||||
|
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL';
|
||||||
|
|
||||||
|
$usage = hesk_POST('usage', 0);
|
||||||
|
|
||||||
/* Do we already have a category with this name? */
|
/* Do we already have a category with this name? */
|
||||||
$res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1");
|
$res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1");
|
||||||
if (hesk_dbNumRows($res) != 0) {
|
if (hesk_dbNumRows($res) != 0) {
|
||||||
@ -547,7 +613,7 @@ function new_cat()
|
|||||||
$row = hesk_dbFetchRow($res);
|
$row = hesk_dbFetchRow($res);
|
||||||
$my_order = $row[0] + 10;
|
$my_order = $row[0] + 10;
|
||||||
|
|
||||||
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}')");
|
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`, `color`, `usage`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', {$color}, " . intval($usage) . ")");
|
||||||
|
|
||||||
hesk_cleanSessionVars('catname');
|
hesk_cleanSessionVars('catname');
|
||||||
hesk_cleanSessionVars('cat_autoassign');
|
hesk_cleanSessionVars('cat_autoassign');
|
||||||
@ -560,7 +626,7 @@ function new_cat()
|
|||||||
} // End new_cat()
|
} // End new_cat()
|
||||||
|
|
||||||
|
|
||||||
function rename_cat()
|
function update_category()
|
||||||
{
|
{
|
||||||
global $hesk_settings, $hesklang;
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
@ -569,29 +635,32 @@ function rename_cat()
|
|||||||
|
|
||||||
$_SERVER['PHP_SELF'] = 'manage_categories.php?catid=' . intval(hesk_POST('catid'));
|
$_SERVER['PHP_SELF'] = 'manage_categories.php?catid=' . intval(hesk_POST('catid'));
|
||||||
|
|
||||||
$catid = hesk_isNumber(hesk_POST('catid'), $hesklang['choose_cat_ren'], $_SERVER['PHP_SELF']);
|
$catid = hesk_isNumber(hesk_POST('id'), $hesklang['choose_cat_ren'], $_SERVER['PHP_SELF']);
|
||||||
$_SESSION['selcat'] = $catid;
|
$_SESSION['selcat'] = $catid;
|
||||||
$_SESSION['selcat2'] = $catid;
|
$_SESSION['selcat2'] = $catid;
|
||||||
|
|
||||||
$catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']);
|
$catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']);
|
||||||
$_SESSION['catname2'] = $catname;
|
$_SESSION['catname2'] = $catname;
|
||||||
|
|
||||||
$res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1");
|
$color = hesk_POST('color', null);
|
||||||
if (hesk_dbNumRows($res) != 0) {
|
$color = str_replace('#', '', $color);
|
||||||
$old = hesk_dbFetchAssoc($res);
|
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL';
|
||||||
if ($old['id'] == $catid) {
|
$manager = hesk_POST('manager', 0);
|
||||||
hesk_process_messages($hesklang['noch'], $_SERVER['PHP_SELF'], 'NOTICE');
|
$priority = hesk_POST('priority', 0);
|
||||||
} else {
|
$usage = hesk_POST('usage', 0);
|
||||||
hesk_process_messages($hesklang['cndupl'], $_SERVER['PHP_SELF']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "' WHERE `id`='" . intval($catid) . "' LIMIT 1");
|
|
||||||
|
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "',
|
||||||
|
`priority` = '" . hesk_dbEscape($priority) . "',
|
||||||
|
`manager` = " . intval($manager) . ",
|
||||||
|
`color` = " . $color . ",
|
||||||
|
`usage` = " . intval($usage) . "
|
||||||
|
WHERE `id`='" . intval($catid) . "' LIMIT 1");
|
||||||
|
|
||||||
unset($_SESSION['selcat']);
|
unset($_SESSION['selcat']);
|
||||||
unset($_SESSION['catname2']);
|
unset($_SESSION['catname2']);
|
||||||
|
|
||||||
hesk_process_messages($hesklang['cat_renamed_to'] . ' <i>' . stripslashes($catname) . '</i>', $_SERVER['PHP_SELF'], 'SUCCESS');
|
hesk_process_messages(sprintf($hesklang['category_updated'], stripslashes($catname)), $_SERVER['PHP_SELF'], 'SUCCESS');
|
||||||
} // End rename_cat()
|
} // End rename_cat()
|
||||||
|
|
||||||
|
|
||||||
@ -708,59 +777,42 @@ function toggle_type()
|
|||||||
|
|
||||||
} // End toggle_type()
|
} // End toggle_type()
|
||||||
|
|
||||||
function output_user_dropdown($catId, $selectId, $userArray)
|
function output_user_dropdown($userArray)
|
||||||
{
|
{
|
||||||
global $hesklang;
|
global $hesklang;
|
||||||
|
|
||||||
if (!hesk_checkPermission('can_set_manager', 0)) {
|
if (!hesk_checkPermission('can_set_manager', 0)) {
|
||||||
foreach ($userArray as $user) {
|
foreach ($userArray as $user) {
|
||||||
if ($user['id'] == $selectId) {
|
if ($user['id'] == $selectId) {
|
||||||
return '<p>' . $user['name'] . '</p>';
|
return '<p>' . $user['name'] . '</p><input type="hidden" name="manager">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return '<p>' . $hesklang['no_manager'] . '</p>';
|
return '<p>' . $hesklang['no_manager'] . '</p><input type="hidden" name="manager">';
|
||||||
} else {
|
} else {
|
||||||
$dropdownMarkup = '<select class="form-control input-sm" name="managerid">
|
$dropdownMarkup = '<select class="form-control" name="manager">
|
||||||
<option value="0">' . $hesklang['no_manager'] . '</option>';
|
<option value="0">' . $hesklang['no_manager'] . '</option>';
|
||||||
foreach ($userArray as $user) {
|
foreach ($userArray as $user) {
|
||||||
$select = $selectId == $user['id'] ? 'selected' : '';
|
$dropdownMarkup .= '<option value="' . $user['id'] . '">' . $user['name'] . '</option>';
|
||||||
$dropdownMarkup .= '<option value="' . $user['id'] . '" ' . $select . '>' . $user['name'] . '</option>';
|
|
||||||
}
|
}
|
||||||
$dropdownMarkup .= '</select>';
|
$dropdownMarkup .= '</select>';
|
||||||
|
|
||||||
|
|
||||||
return '<form role="form" id="manager_form_' . $catId . '" action="manage_categories.php" method="post" class="form-inline" onchange="document.getElementById(\'manager_form_' . $catId . '\').submit();">
|
return $dropdownMarkup;
|
||||||
<input type="hidden" name="a" value="manager">
|
|
||||||
<input type="hidden" name="catid" value="' . $catId . '">
|
|
||||||
' . $dropdownMarkup . '
|
|
||||||
</form>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_manager()
|
function get_manager($user_id, $user_array) {
|
||||||
{
|
global $hesklang;
|
||||||
global $hesklang, $hesk_settings;
|
|
||||||
|
|
||||||
$catid = hesk_POST('catid');
|
if ($user_id == 0) {
|
||||||
$newManagerId = hesk_POST('managerid');
|
return $hesklang['no_manager'];
|
||||||
|
|
||||||
hesk_dbQuery('UPDATE `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` SET `manager` = ' . intval($newManagerId) . ' WHERE `id` = ' . intval($catid));
|
|
||||||
if (hesk_dbAffectedRows() != 1) {
|
|
||||||
hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php');
|
|
||||||
}
|
|
||||||
if ($newManagerId == 0) {
|
|
||||||
// There is no new manager.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Add the category to the user's categories list, if not already present
|
|
||||||
$currentCatRs = hesk_dbQuery('SELECT `categories` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` WHERE `id` = ' . intval($newManagerId));
|
|
||||||
$currentCategories = hesk_dbFetchAssoc($currentCatRs);
|
|
||||||
$categories = explode(',', $currentCategories['categories']);
|
|
||||||
if (!in_array($catid, $categories)) {
|
|
||||||
hesk_dbQuery('UPDATE `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` SET `categories` = \'' . $currentCategories['categories'] . ',' . $catid . '\' WHERE `id` = ' . intval($newManagerId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hesk_process_messages($hesklang['manager_updated'], './manage_categories.php', 'SUCCESS');
|
foreach ($user_array as $user) {
|
||||||
|
if ($user['id'] == $user_id) {
|
||||||
|
return $user['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -49,6 +49,13 @@ hesk_checkPermission('can_man_users');
|
|||||||
|
|
||||||
/* Possible user features */
|
/* Possible user features */
|
||||||
$hesk_settings['features'] = hesk_getFeatureArray();
|
$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 */
|
/* Set default values */
|
||||||
$default_userdata = array(
|
$default_userdata = array(
|
||||||
@ -78,6 +85,7 @@ $default_userdata = array(
|
|||||||
'notify_customer_new' => 1,
|
'notify_customer_new' => 1,
|
||||||
'notify_customer_reply' => 1,
|
'notify_customer_reply' => 1,
|
||||||
'show_suggested' => 1,
|
'show_suggested' => 1,
|
||||||
|
'default_calendar_view' => $default_view,
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
'notify_new_unassigned' => 1,
|
'notify_new_unassigned' => 1,
|
||||||
@ -88,9 +96,9 @@ $default_userdata = array(
|
|||||||
'notify_note' => 1,
|
'notify_note' => 1,
|
||||||
'notify_pm' => 1,
|
'notify_pm' => 1,
|
||||||
'notify_note_unassigned' => 1,
|
'notify_note_unassigned' => 1,
|
||||||
|
'notify_overdue_unassigned' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
$modsForHesk_settings = mfh_getSettings();
|
|
||||||
/* A list of all categories */
|
/* A list of all categories */
|
||||||
$orderBy = $modsForHesk_settings['category_order_column'];
|
$orderBy = $modsForHesk_settings['category_order_column'];
|
||||||
$hesk_settings['categories'] = array();
|
$hesk_settings['categories'] = array();
|
||||||
@ -515,8 +523,10 @@ function new_user()
|
|||||||
`notify_pm`,
|
`notify_pm`,
|
||||||
`notify_note`,
|
`notify_note`,
|
||||||
`notify_note_unassigned`,
|
`notify_note_unassigned`,
|
||||||
|
`notify_overdue_unassigned`,
|
||||||
`autorefresh`,
|
`autorefresh`,
|
||||||
`permission_template`) VALUES (
|
`permission_template`,
|
||||||
|
`default_calendar_view`) VALUES (
|
||||||
'" . hesk_dbEscape($myuser['user']) . "',
|
'" . hesk_dbEscape($myuser['user']) . "',
|
||||||
'" . hesk_dbEscape($myuser['pass']) . "',
|
'" . hesk_dbEscape($myuser['pass']) . "',
|
||||||
'" . intval($myuser['isadmin']) . "',
|
'" . intval($myuser['isadmin']) . "',
|
||||||
@ -539,8 +549,10 @@ function new_user()
|
|||||||
'" . ($myuser['notify_pm']) . "',
|
'" . ($myuser['notify_pm']) . "',
|
||||||
'" . ($myuser['notify_note']) . "',
|
'" . ($myuser['notify_note']) . "',
|
||||||
'" . ($myuser['notify_note_unassigned']) . "',
|
'" . ($myuser['notify_note_unassigned']) . "',
|
||||||
|
'" . ($myuser['notify_overdue_unassigned']) . "',
|
||||||
" . intval($myuser['autorefresh']) . ",
|
" . intval($myuser['autorefresh']) . ",
|
||||||
" . intval($myuser['template']) . ")");
|
" . intval($myuser['template']) . ",
|
||||||
|
" . intval($myuser['default_calendar_view']) . ")");
|
||||||
|
|
||||||
$_SESSION['seluser'] = hesk_dbInsertID();
|
$_SESSION['seluser'] = hesk_dbInsertID();
|
||||||
|
|
||||||
@ -581,6 +593,7 @@ function update_user()
|
|||||||
$myuser['notify_pm'] = 0;
|
$myuser['notify_pm'] = 0;
|
||||||
$myuser['notify_note'] = 0;
|
$myuser['notify_note'] = 0;
|
||||||
$myuser['notify_note_unassigned'] = 0;
|
$myuser['notify_note_unassigned'] = 0;
|
||||||
|
$myuser['notify_overdue_unassigned'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for duplicate usernames */
|
/* Check for duplicate usernames */
|
||||||
@ -662,8 +675,10 @@ function update_user()
|
|||||||
`notify_pm`='" . ($myuser['notify_pm']) . "',
|
`notify_pm`='" . ($myuser['notify_pm']) . "',
|
||||||
`notify_note`='" . ($myuser['notify_note']) . "',
|
`notify_note`='" . ($myuser['notify_note']) . "',
|
||||||
`notify_note_unassigned`='" . ($myuser['notify_note_unassigned']) . "',
|
`notify_note_unassigned`='" . ($myuser['notify_note_unassigned']) . "',
|
||||||
|
`notify_overdue_unassigned`='" . ($myuser['notify_overdue_unassigned']) . "',
|
||||||
`autorefresh`=" . intval($myuser['autorefresh']) . ",
|
`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");
|
WHERE `id`='" . intval($myuser['id']) . "' LIMIT 1");
|
||||||
|
|
||||||
// If they are now inactive, remove any manager rights
|
// If they are now inactive, remove any manager rights
|
||||||
@ -764,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_new'] = isset($_POST['notify_customer_new']) ? 1 : 0;
|
||||||
$myuser['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0;
|
$myuser['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0;
|
||||||
$myuser['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0;
|
$myuser['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0;
|
||||||
|
$myuser['default_calendar_view'] = hesk_POST('default-calendar-view', 0);
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
$myuser['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) ? 0 : 1;
|
$myuser['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) ? 0 : 1;
|
||||||
@ -774,6 +790,7 @@ function hesk_validateUserInfo($pass_required = 1, $redirect_to = './manage_user
|
|||||||
$myuser['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
|
$myuser['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
|
||||||
$myuser['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
|
$myuser['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
|
||||||
$myuser['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
|
$myuser['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
|
||||||
|
$myuser['notify_overdue_unassigned'] = empty($_POST['notify_overdue_unassigned']) ? 0 : 1;
|
||||||
|
|
||||||
/* Save entered info in session so we don't loose it in case of errors */
|
/* Save entered info in session so we don't loose it in case of errors */
|
||||||
$_SESSION['userdata'] = $myuser;
|
$_SESSION['userdata'] = $myuser;
|
||||||
@ -890,7 +907,7 @@ function toggle_active()
|
|||||||
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser));
|
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `manager` = 0 WHERE `manager` = " . intval($myuser));
|
||||||
|
|
||||||
$notificationSql = ", `autoassign` = 0, `notify_new_unassigned` = 0, `notify_new_my` = 0, `notify_reply_unassigned` = 0,
|
$notificationSql = ", `autoassign` = 0, `notify_new_unassigned` = 0, `notify_new_my` = 0, `notify_reply_unassigned` = 0,
|
||||||
`notify_reply_my` = 0, `notify_assigned` = 0, `notify_pm` = 0, `notify_note` = 0, `notify_note_unassigned` = 0";
|
`notify_reply_my` = 0, `notify_assigned` = 0, `notify_pm` = 0, `notify_note` = 0, `notify_note_unassigned` = 0, `notify_overdue_unassigned` = 0";
|
||||||
}
|
}
|
||||||
|
|
||||||
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `active` = '" . $active . "'" . $notificationSql . " WHERE `id` = '" . intval($myuser) . "'");
|
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` SET `active` = '" . $active . "'" . $notificationSql . " WHERE `id` = '" . intval($myuser) . "'");
|
||||||
|
@ -263,7 +263,7 @@ if (!$show['show']) {
|
|||||||
|
|
||||||
// List categories
|
// List categories
|
||||||
$orderByColumn = $modsForHesk_settings['category_order_column'];
|
$orderByColumn = $modsForHesk_settings['category_order_column'];
|
||||||
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` ORDER BY `' . $orderByColumn . '` ASC');
|
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` WHERE `usage` <> 2 ORDER BY `' . $orderByColumn . '` ASC');
|
||||||
while ($row = hesk_dbFetchAssoc($result)) {
|
while ($row = hesk_dbFetchAssoc($result)) {
|
||||||
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {
|
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {
|
||||||
$selected = ' selected="selected"';
|
$selected = ' selected="selected"';
|
||||||
@ -730,6 +730,15 @@ elseif (hesk_checkPermission('can_man_ticket_tpl', 0)) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="due-date" class="col-sm-3 control-label"><?php echo $hesklang['due_date']; ?></label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input class="form-control datepicker" name="due-date" placeholder="<?php echo htmlspecialchars($hesklang['due_date']); ?>"
|
||||||
|
value="<?php if (isset($_GET['due_date'])) { echo $_GET['due_date']; } ?>">
|
||||||
|
<span class="help-block"><?php echo $hesklang['date_format']; ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php if (in_array('subject', $_SESSION['iserror'])) {
|
<?php if (in_array('subject', $_SESSION['iserror'])) {
|
||||||
echo '<div class="form-group has-error">';
|
echo '<div class="form-group has-error">';
|
||||||
} else {
|
} else {
|
||||||
|
@ -230,10 +230,15 @@ function update_profile()
|
|||||||
/* Auto-start ticket timer */
|
/* Auto-start ticket timer */
|
||||||
$_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0;
|
$_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 */
|
/* Update auto-refresh time */
|
||||||
$_SESSION['new']['autorefresh'] = isset($_POST['autorefresh']) ? $_POST['autorefresh'] : 0;
|
$_SESSION['new']['autorefresh'] = isset($_POST['autorefresh']) ? $_POST['autorefresh'] : 0;
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
if (!(!$_SESSION[$session_array]['isadmin'] && isset($_SESSION[$session_array]['heskprivileges'])
|
||||||
|
&& strpos($_SESSION[$session_array]['heskprivileges'], 'can_change_notification_settings') === false)) {
|
||||||
$_SESSION['new']['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) || !$can_view_unassigned ? 0 : 1;
|
$_SESSION['new']['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) || !$can_view_unassigned ? 0 : 1;
|
||||||
$_SESSION['new']['notify_new_my'] = empty($_POST['notify_new_my']) ? 0 : 1;
|
$_SESSION['new']['notify_new_my'] = empty($_POST['notify_new_my']) ? 0 : 1;
|
||||||
$_SESSION['new']['notify_reply_unassigned'] = empty($_POST['notify_reply_unassigned']) || !$can_view_unassigned ? 0 : 1;
|
$_SESSION['new']['notify_reply_unassigned'] = empty($_POST['notify_reply_unassigned']) || !$can_view_unassigned ? 0 : 1;
|
||||||
@ -242,6 +247,8 @@ function update_profile()
|
|||||||
$_SESSION['new']['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
|
$_SESSION['new']['notify_note'] = empty($_POST['notify_note']) ? 0 : 1;
|
||||||
$_SESSION['new']['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
|
$_SESSION['new']['notify_note_unassigned'] = empty($_POST['notify_note_unassigned']) ? 0 : 1;
|
||||||
$_SESSION['new']['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
|
$_SESSION['new']['notify_pm'] = empty($_POST['notify_pm']) ? 0 : 1;
|
||||||
|
$_SESSION['new']['notify_overdue_unassigned'] = empty($_POST['notify_overdue_unassigned']) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Any errors? */
|
/* Any errors? */
|
||||||
if (strlen($hesk_error_buffer)) {
|
if (strlen($hesk_error_buffer)) {
|
||||||
@ -272,7 +279,9 @@ function update_profile()
|
|||||||
`notify_note_unassigned`='" . intval($_SESSION['new']['notify_note_unassigned']) . "',
|
`notify_note_unassigned`='" . intval($_SESSION['new']['notify_note_unassigned']) . "',
|
||||||
`notify_customer_new`='" . $_SESSION['new']['notify_customer_new'] . "',
|
`notify_customer_new`='" . $_SESSION['new']['notify_customer_new'] . "',
|
||||||
`notify_customer_reply`='" . $_SESSION['new']['notify_customer_reply'] . "',
|
`notify_customer_reply`='" . $_SESSION['new']['notify_customer_reply'] . "',
|
||||||
`show_suggested`='" . $_SESSION['new']['show_suggested'] . "'
|
`notify_overdue_unassigned`='" . $_SESSION['new']['notify_overdue_unassigned'] . "',
|
||||||
|
`show_suggested`='" . $_SESSION['new']['show_suggested'] . "',
|
||||||
|
`default_calendar_view`=" . intval($_SESSION['new']['default_calendar_view']) . "
|
||||||
WHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1"
|
WHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
127
calendar.php
Normal file
127
calendar.php
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Title: Help Desk Software HESK
|
||||||
|
* Version: 2.6.5 from 28th August 2015
|
||||||
|
* Author: Klemen Stirn
|
||||||
|
* Website: http://www.hesk.com
|
||||||
|
********************************************************************************
|
||||||
|
* COPYRIGHT AND TRADEMARK NOTICE
|
||||||
|
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
|
||||||
|
* HESK is a registered trademark of Klemen Stirn.
|
||||||
|
* The HESK may be used and modified free of charge by anyone
|
||||||
|
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
|
||||||
|
* By using this code you agree to indemnify Klemen Stirn from any
|
||||||
|
* liability that might arise from it's use.
|
||||||
|
* Selling the code for this program, in part or full, without prior
|
||||||
|
* written consent is expressly forbidden.
|
||||||
|
* Using this code, in part or full, to create derivate work,
|
||||||
|
* new scripts or products is expressly forbidden. Obtain permission
|
||||||
|
* before redistributing this software over the Internet or in
|
||||||
|
* any other medium. In all cases copyright and header must remain intact.
|
||||||
|
* This Copyright is in full effect in any country that has International
|
||||||
|
* Trade Agreements with the United States of America or
|
||||||
|
* with the European Union.
|
||||||
|
* Removing any of the copyright notices without purchasing a license
|
||||||
|
* is expressly forbidden. To remove HESK copyright notice you must purchase
|
||||||
|
* a license for this script. For more information on how to obtain
|
||||||
|
* a license please visit the page below:
|
||||||
|
* https://www.hesk.com/buy.php
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
define('HESK_PATH', './');
|
||||||
|
define('PAGE_TITLE', 'CUSTOMER_CALENDAR');
|
||||||
|
define('MFH_CUSTOMER_CALENDAR', 1);
|
||||||
|
|
||||||
|
/* Get all the required files and functions */
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
|
||||||
|
// Are we in maintenance mode?
|
||||||
|
hesk_check_maintenance();
|
||||||
|
|
||||||
|
hesk_load_database_functions();
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
/* Connect to database */
|
||||||
|
hesk_dbConnect();
|
||||||
|
$modsForHesk_settings = mfh_getSettings();
|
||||||
|
|
||||||
|
// Is the calendar enabled?
|
||||||
|
if ($modsForHesk_settings['enable_calendar'] != '1') {
|
||||||
|
hesk_error($hesklang['calendar_disabled']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = [];
|
||||||
|
$orderBy = $modsForHesk_settings['category_order_column'];
|
||||||
|
$categorySql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 1 AND `type` = '0' ORDER BY '" . $orderBy . "'";
|
||||||
|
$categoryRs = hesk_dbQuery($categorySql);
|
||||||
|
while ($row = hesk_dbFetchAssoc($categoryRs))
|
||||||
|
{
|
||||||
|
$row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000' : 'background: ' . $row['color'];
|
||||||
|
$categories[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once(HESK_PATH . 'inc/header.inc.php');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="row pad-20">
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4><?php echo $hesklang['calendar_categories']; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<?php foreach ($categories as $category): ?>
|
||||||
|
<li class="move-down-20 move-right-20">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" name="category-toggle" value="<?php echo $category['id']; ?>" checked>
|
||||||
|
</div>
|
||||||
|
<span class="label background-volatile category-label" style="<?php echo $category['css_style']; ?>">
|
||||||
|
<?php echo $category['name']; ?>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-9">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h4>
|
||||||
|
<?php echo $hesklang['calendar_title_case']; ?>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="calendar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="popover-template" style="display: none">
|
||||||
|
<div>
|
||||||
|
<div class="popover-location">
|
||||||
|
<strong>Location</strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-category">
|
||||||
|
<strong>Category</strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-from">
|
||||||
|
<strong>From</strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
<div class="popover-to">
|
||||||
|
<strong>To</strong>
|
||||||
|
<span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</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>
|
182
cron/calendar_reminders.php
Normal file
182
cron/calendar_reminders.php
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
#!/usr/bin/php -q
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('IN_SCRIPT',1);
|
||||||
|
define('HESK_PATH', dirname(dirname(__FILE__)) . '/');
|
||||||
|
$LOCATION = 'Calendar Reminders Cron Job';
|
||||||
|
|
||||||
|
#echo HESK_PATH."\n";
|
||||||
|
|
||||||
|
// Get required files and functions
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
|
||||||
|
if (defined('HESK_DEMO')) {
|
||||||
|
echo '>>>>>>> DEMO MODE IS ENABLED. CRON JOBS CANNOT BE EXECUTED WHILE IN DEMO MODE! <<<<<<<';
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hesk_check_maintenance(false)) {
|
||||||
|
// If Debug mode is ON show "Maintenance mode" message
|
||||||
|
$message = $hesk_settings['debug_mode'] ? $hesklang['mm1'] : '';
|
||||||
|
$message .= "\n";
|
||||||
|
die($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all reminders that have a reminder date that is now or earlier, and an email has not been sent for the event yet.
|
||||||
|
/*
|
||||||
|
* Reminder units:
|
||||||
|
* 0 - minutes
|
||||||
|
* 1 - hours
|
||||||
|
* 2 - days
|
||||||
|
* 3 - weeks
|
||||||
|
*/
|
||||||
|
$case_statement = "CASE
|
||||||
|
WHEN `unit` = '0' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` MINUTE)
|
||||||
|
WHEN `unit` = '1' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` HOUR)
|
||||||
|
WHEN `unit` = '2' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` DAY)
|
||||||
|
WHEN `unit` = '3' THEN DATE_SUB(`event`.`start`, INTERVAL `reminder`.`amount` WEEK)
|
||||||
|
END";
|
||||||
|
$sql = "SELECT `reminder`.`id` AS `reminder_id`, `reminder`.`user_id` AS `user_id`, `reminder`.`event_id` AS `event_id`,
|
||||||
|
`event`.`name` AS `event_name`, `event`.`location` AS `event_location`, `event`.`comments` AS `event_comments`,
|
||||||
|
`category`.`name` AS `event_category`, `event`.`start` AS `event_start`, `event`.`end` AS `event_end`,
|
||||||
|
`event`.`all_day` AS `event_all_day`, `user`.`language` AS `user_language`, `user`.`email` AS `user_email`,
|
||||||
|
" . $case_statement . " AS `reminder_date`, 'EVENT' AS `type`
|
||||||
|
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` AS `reminder`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` AS `event`
|
||||||
|
ON `reminder`.`event_id` = `event`.`id`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` AS `category`
|
||||||
|
ON `event`.`category` = `category`.`id`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` AS `user`
|
||||||
|
ON `reminder`.`user_id` = `user`.`id`
|
||||||
|
WHERE (" . $case_statement . ") <= NOW()
|
||||||
|
AND `email_sent` = '0'";
|
||||||
|
|
||||||
|
$rs = hesk_dbQuery($sql);
|
||||||
|
$reminders_to_flag = [];
|
||||||
|
$tickets_to_flag = [];
|
||||||
|
|
||||||
|
$included_email_functions = false;
|
||||||
|
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) && !$skip_events) {
|
||||||
|
if (mfh_sendCalendarReminder($row, $modsForHesk_settings)) {
|
||||||
|
$reminders_to_flag[] = $row['reminder_id'];
|
||||||
|
$successful_emails++;
|
||||||
|
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
|
$debug_msg = "Sent e-mail reminder for event: {$row['event_name']} to {$row['user_email']}\n";
|
||||||
|
echo $debug_msg;
|
||||||
|
mfh_log_debug($LOCATION, $debug_msg, 'CRON');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$failed_emails++;
|
||||||
|
|
||||||
|
$warning_text = "Failed to send reminder e-mail for event: {$row['event_name']} to {$row['user_email']}. This will be re-sent next time reminders are processed.\n";
|
||||||
|
mfh_log_warning($LOCATION, $warning_text, 'CRON');
|
||||||
|
echo $warning_text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($reminders_to_flag) > 0) {
|
||||||
|
foreach ($reminders_to_flag as $reminder_id) {
|
||||||
|
$sql = "UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` SET `email_sent` = '1' WHERE `id` = " . intval($reminder_id);
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
|
$debug_msg = "Finished Calendar Reminders. {$successful_emails} reminder e-mails sent. {$failed_emails} emails failed to send.\n";
|
||||||
|
echo $debug_msg;
|
||||||
|
mfh_log_debug($LOCATION, $debug_msg, 'CRON');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overdue tickets
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
|
echo "Starting Overdue Tickets...\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT `ticket`.`id` AS `id`, `ticket`.`trackid` AS `trackid`, `ticket`.`name` AS `name`, `ticket`.`subject` AS `subject`,
|
||||||
|
`ticket`.`message` AS `message`, `ticket`.`category` AS `category`, `ticket`.`priority` AS `priority`,
|
||||||
|
`ticket`.`owner` AS `owner`, `ticket`.`status` AS `status`, `ticket`.`email` AS `email`, `ticket`.`dt` AS `dt`,
|
||||||
|
`ticket`.`lastchange` AS `lastchange`, `ticket`.`due_date` AS `due_date`, `user`.`language` AS `user_language`, `user`.`email` AS `user_email`,
|
||||||
|
`ticket`.`custom1` AS `custom1`, `ticket`.`custom2` AS `custom2`, `ticket`.`custom3` AS `custom3`, `ticket`.`custom4` AS `custom4`,
|
||||||
|
`ticket`.`custom5` AS `custom5`, `ticket`.`custom6` AS `custom6`, `ticket`.`custom7` AS `custom7`, `ticket`.`custom8` AS `custom8`,
|
||||||
|
`ticket`.`custom9` AS `custom9`, `ticket`.`custom10` AS `custom10`, `ticket`.`custom11` AS `custom11`, `ticket`.`custom12` AS `custom12`,
|
||||||
|
`ticket`.`custom13` AS `custom13`, `ticket`.`custom14` AS `custom14`, `ticket`.`custom15` AS `custom15`, `ticket`.`custom16` AS `custom16`,
|
||||||
|
`ticket`.`custom17` AS `custom17`, `ticket`.`custom18` AS `custom19`, `ticket`.`custom19` AS `custom19`, `ticket`.`custom20` AS `custom20`,
|
||||||
|
`ticket`.`html` AS `html`
|
||||||
|
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `ticket`
|
||||||
|
LEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` AS `user`
|
||||||
|
ON `ticket`.`owner` = `user`.`id`
|
||||||
|
WHERE `due_date` IS NOT NULL
|
||||||
|
AND `due_date` <= NOW()
|
||||||
|
AND `overdue_email_sent` = '0'";
|
||||||
|
|
||||||
|
$successful_emails = 0;
|
||||||
|
$failed_emails = 0;
|
||||||
|
$rs = hesk_dbQuery($sql);
|
||||||
|
|
||||||
|
if (hesk_dbNumRows($rs) > 0 && !$included_email_functions) {
|
||||||
|
require(HESK_PATH . 'inc/email_functions.inc.php');
|
||||||
|
$included_email_functions = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_rs = hesk_dbQuery("SELECT `id`, `isadmin`, `categories`, `email`,
|
||||||
|
CASE WHEN `heskprivileges` LIKE '%can_view_unassigned%' THEN 1 ELSE 0 END AS `can_view_unassigned`
|
||||||
|
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `notify_overdue_unassigned` = '1'
|
||||||
|
AND (`heskprivileges` LIKE '%can_view_tickets%' OR `isadmin` = '1')");
|
||||||
|
|
||||||
|
$users = [];
|
||||||
|
while ($row = hesk_dbFetchAssoc($user_rs)) {
|
||||||
|
$users[] = $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tickets_to_flag = [];
|
||||||
|
while ($row = hesk_dbFetchAssoc($rs)) {
|
||||||
|
if (mfh_sendOverdueTicketReminder($row, $users, $modsForHesk_settings)) {
|
||||||
|
$tickets_to_flag[] = $row['id'];
|
||||||
|
$successful_emails++;
|
||||||
|
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
|
$debug_msg = "Sent overdue e-mail for ticket: {$row['trackid']} to user id: {$row['owner']}\n";
|
||||||
|
mfh_log_debug($LOCATION, $debug_msg, 'CRON');
|
||||||
|
echo $debug_msg;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$failed_emails++;
|
||||||
|
|
||||||
|
$warning_text = "Failed to send overdue reminder for ticket: {$row['trackid']} to user id: {$row['owner']}. This will be re-sent next time overdue tickets are processed.\n";\
|
||||||
|
mfh_log_warning($LOCATION, $warning_text, 'CRON');
|
||||||
|
echo $warning_text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($tickets_to_flag) > 0) {
|
||||||
|
foreach ($tickets_to_flag as $ticket_id) {
|
||||||
|
$sql = "UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `overdue_email_sent` = '1' WHERE `id` = " . intval($ticket_id);
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
|
$debug_msg = "Finished Overdue Tickets. {$successful_emails} e-mails sent. {$failed_emails} emails failed to send.\n";
|
||||||
|
echo $debug_msg;
|
||||||
|
mfh_log_debug($LOCATION, $debug_msg, 'CRON');
|
||||||
|
}
|
248
cron/core/database.inc.php
Executable file
248
cron/core/database.inc.php
Executable file
@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Title: Help Desk Software HESK
|
||||||
|
* Version: 2.6.1 from 26th February 2015
|
||||||
|
* Author: Klemen Stirn
|
||||||
|
* Website: http://www.hesk.com
|
||||||
|
********************************************************************************
|
||||||
|
* COPYRIGHT AND TRADEMARK NOTICE
|
||||||
|
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
|
||||||
|
* HESK is a registered trademark of Klemen Stirn.
|
||||||
|
|
||||||
|
* The HESK may be used and modified free of charge by anyone
|
||||||
|
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
|
||||||
|
* By using this code you agree to indemnify Klemen Stirn from any
|
||||||
|
* liability that might arise from it's use.
|
||||||
|
|
||||||
|
* Selling the code for this program, in part or full, without prior
|
||||||
|
* written consent is expressly forbidden.
|
||||||
|
|
||||||
|
* Using this code, in part or full, to create derivate work,
|
||||||
|
* new scripts or products is expressly forbidden. Obtain permission
|
||||||
|
* before redistributing this software over the Internet or in
|
||||||
|
* any other medium. In all cases copyright and header must remain intact.
|
||||||
|
* This Copyright is in full effect in any country that has International
|
||||||
|
* Trade Agreements with the United States of America or
|
||||||
|
* with the European Union.
|
||||||
|
|
||||||
|
* Removing any of the copyright notices without purchasing a license
|
||||||
|
* is expressly forbidden. To remove HESK copyright notice you must purchase
|
||||||
|
* a license for this script. For more information on how to obtain
|
||||||
|
* a license please visit the page below:
|
||||||
|
* https://www.hesk.com/buy.php
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/* Check if this is a valid include */
|
||||||
|
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbSetNames()
|
||||||
|
{
|
||||||
|
global $hesk_settings, $hesk_db_link;
|
||||||
|
|
||||||
|
if ($hesk_settings['db_vrsn'])
|
||||||
|
{
|
||||||
|
mysql_set_charset('utf8', $hesk_db_link);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hesk_dbQuery("SET NAMES 'utf8'");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbSetNames()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFormatEmail($email, $field = 'email')
|
||||||
|
{
|
||||||
|
global $hesk_settings;
|
||||||
|
|
||||||
|
$email = hesk_dbLike($email);
|
||||||
|
|
||||||
|
if ($hesk_settings['multi_eml'])
|
||||||
|
{
|
||||||
|
return " (`".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email)."' OR `".hesk_dbEscape($field)."` LIKE '%,".hesk_dbEscape($email)."' OR `".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email).",%' OR `".hesk_dbEscape($field)."` LIKE '%,".hesk_dbEscape($email).",%') ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return " `".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email)."' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbFormatEmail()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbTime()
|
||||||
|
{
|
||||||
|
$res = hesk_dbQuery("SELECT NOW()");
|
||||||
|
return strtotime(hesk_dbResult($res,0,0));
|
||||||
|
} // END hesk_dbTime()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbEscape($in)
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
$in = mysql_real_escape_string(stripslashes($in), $hesk_db_link);
|
||||||
|
$in = str_replace('`','`',$in);
|
||||||
|
|
||||||
|
return $in;
|
||||||
|
} // END hesk_dbEscape()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbLike($in)
|
||||||
|
{
|
||||||
|
return str_replace( array('_', '%'), array('\\\\_', '\\\\%'), $in);
|
||||||
|
} // END hesk_dbLike()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbConnect()
|
||||||
|
{
|
||||||
|
global $hesk_settings;
|
||||||
|
global $hesk_db_link;
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
// Is mysql supported?
|
||||||
|
if ( ! function_exists('mysql_connect') )
|
||||||
|
{
|
||||||
|
die($hesklang['emp']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect to the database
|
||||||
|
$hesk_db_link = @mysql_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass']);
|
||||||
|
|
||||||
|
// Errors?
|
||||||
|
if ( ! $hesk_db_link)
|
||||||
|
{
|
||||||
|
if ($hesk_settings['debug_mode'])
|
||||||
|
{
|
||||||
|
$message = $hesklang['mysql_said'] . ': ' . mysql_error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
|
}
|
||||||
|
echo $hesklang['cant_connect_db'] . ': ' . $message;
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! @mysql_select_db($hesk_settings['db_name'], $hesk_db_link))
|
||||||
|
{
|
||||||
|
if ($hesk_settings['debug_mode'])
|
||||||
|
{
|
||||||
|
$message = $hesklang['mysql_said'] . ': ' . mysql_error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $hesklang['cant_connect_db'] . ': ' . $message;
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check MySQL/PHP version and set encoding to utf8
|
||||||
|
hesk_dbSetNames();
|
||||||
|
|
||||||
|
return $hesk_db_link;
|
||||||
|
|
||||||
|
} // END hesk_dbConnect()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbClose()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
return @mysql_close($hesk_db_link);
|
||||||
|
|
||||||
|
} // END hesk_dbClose()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbQuery($query)
|
||||||
|
{
|
||||||
|
global $hesk_last_query;
|
||||||
|
global $hesk_db_link;
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
if ( ! $hesk_db_link && ! hesk_dbConnect())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hesk_last_query = $query;
|
||||||
|
|
||||||
|
if ($res = @mysql_query($query, $hesk_db_link))
|
||||||
|
{
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
elseif ($hesk_settings['debug_mode'])
|
||||||
|
{
|
||||||
|
$message = $hesklang['mysql_said'] . mysql_error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
|
}
|
||||||
|
mfh_log_error('CRON', $hesklang['cant_sql'] . ': ' . $message, 'CRON');
|
||||||
|
die();
|
||||||
|
|
||||||
|
} // END hesk_dbQuery()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFetchAssoc($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysql_fetch_assoc($res);
|
||||||
|
|
||||||
|
} // END hesk_FetchAssoc()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFetchRow($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysql_fetch_row($res);
|
||||||
|
|
||||||
|
} // END hesk_FetchRow()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbResult($res, $row = 0, $column = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysql_result($res, $row, $column);
|
||||||
|
|
||||||
|
} // END hesk_dbResult()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbInsertID()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
if ($lastid = @mysql_insert_id($hesk_db_link))
|
||||||
|
{
|
||||||
|
return $lastid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbInsertID()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFreeResult($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return mysql_free_result($res);
|
||||||
|
|
||||||
|
} // END hesk_dbFreeResult()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbNumRows($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysql_num_rows($res);
|
||||||
|
|
||||||
|
} // END hesk_dbNumRows()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbAffectedRows()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
return @mysql_affected_rows($hesk_db_link);
|
||||||
|
|
||||||
|
} // END hesk_dbAffectedRows()
|
256
cron/core/database_mysqli.inc.php
Executable file
256
cron/core/database_mysqli.inc.php
Executable file
@ -0,0 +1,256 @@
|
|||||||
|
<?php
|
||||||
|
/*******************************************************************************
|
||||||
|
* Title: Help Desk Software HESK
|
||||||
|
* Version: 2.6.1 from 26th February 2015
|
||||||
|
* Author: Klemen Stirn
|
||||||
|
* Website: http://www.hesk.com
|
||||||
|
********************************************************************************
|
||||||
|
* COPYRIGHT AND TRADEMARK NOTICE
|
||||||
|
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
|
||||||
|
* HESK is a registered trademark of Klemen Stirn.
|
||||||
|
|
||||||
|
* The HESK may be used and modified free of charge by anyone
|
||||||
|
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
|
||||||
|
* By using this code you agree to indemnify Klemen Stirn from any
|
||||||
|
* liability that might arise from it's use.
|
||||||
|
|
||||||
|
* Selling the code for this program, in part or full, without prior
|
||||||
|
* written consent is expressly forbidden.
|
||||||
|
|
||||||
|
* Using this code, in part or full, to create derivate work,
|
||||||
|
* new scripts or products is expressly forbidden. Obtain permission
|
||||||
|
* before redistributing this software over the Internet or in
|
||||||
|
* any other medium. In all cases copyright and header must remain intact.
|
||||||
|
* This Copyright is in full effect in any country that has International
|
||||||
|
* Trade Agreements with the United States of America or
|
||||||
|
* with the European Union.
|
||||||
|
|
||||||
|
* Removing any of the copyright notices without purchasing a license
|
||||||
|
* is expressly forbidden. To remove HESK copyright notice you must purchase
|
||||||
|
* a license for this script. For more information on how to obtain
|
||||||
|
* a license please visit the page below:
|
||||||
|
* https://www.hesk.com/buy.php
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/* Check if this is a valid include */
|
||||||
|
if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbSetNames()
|
||||||
|
{
|
||||||
|
global $hesk_settings, $hesk_db_link;
|
||||||
|
|
||||||
|
if ($hesk_settings['db_vrsn'])
|
||||||
|
{
|
||||||
|
mysqli_set_charset($hesk_db_link, 'utf8');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hesk_dbQuery("SET NAMES 'utf8'");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbSetNames()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFormatEmail($email, $field = 'email')
|
||||||
|
{
|
||||||
|
global $hesk_settings;
|
||||||
|
|
||||||
|
$email = hesk_dbLike($email);
|
||||||
|
|
||||||
|
if ($hesk_settings['multi_eml'])
|
||||||
|
{
|
||||||
|
return " (`".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email)."' OR `".hesk_dbEscape($field)."` LIKE '%,".hesk_dbEscape($email)."' OR `".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email).",%' OR `".hesk_dbEscape($field)."` LIKE '%,".hesk_dbEscape($email).",%') ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return " `".hesk_dbEscape($field)."` LIKE '".hesk_dbEscape($email)."' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbFormatEmail()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbTime()
|
||||||
|
{
|
||||||
|
$res = hesk_dbQuery("SELECT NOW()");
|
||||||
|
return strtotime(hesk_dbResult($res,0,0));
|
||||||
|
} // END hesk_dbTime()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbEscape($in)
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
$in = mysqli_real_escape_string($hesk_db_link, stripslashes($in));
|
||||||
|
$in = str_replace('`','`',$in);
|
||||||
|
|
||||||
|
return $in;
|
||||||
|
} // END hesk_dbEscape()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbLike($in)
|
||||||
|
{
|
||||||
|
return str_replace( array('_', '%'), array('\\\\_', '\\\\%'), $in);
|
||||||
|
} // END hesk_dbLike()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbConnect()
|
||||||
|
{
|
||||||
|
global $hesk_settings;
|
||||||
|
global $hesk_db_link;
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
// Is mysqli supported?
|
||||||
|
if ( ! function_exists('mysqli_connect') )
|
||||||
|
{
|
||||||
|
die($hesklang['emp']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do we need a special port? Check and connect to the database
|
||||||
|
if ( strpos($hesk_settings['db_host'], ':') )
|
||||||
|
{
|
||||||
|
list($hesk_settings['db_host'], $hesk_settings['db_port']) = explode(':', $hesk_settings['db_host']);
|
||||||
|
$hesk_db_link = @mysqli_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name'], intval($hesk_settings['db_port']) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$hesk_db_link = @mysqli_connect($hesk_settings['db_host'], $hesk_settings['db_user'], $hesk_settings['db_pass'], $hesk_settings['db_name']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Errors?
|
||||||
|
if ( ! $hesk_db_link)
|
||||||
|
{
|
||||||
|
if ($hesk_settings['debug_mode'])
|
||||||
|
{
|
||||||
|
$message = $hesklang['mysql_said'] . ': (' . mysqli_connect_errno() . ') ' . mysqli_connect_error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
|
}
|
||||||
|
$error_message = $hesklang['cant_connect_db'] . ': ' . $message;
|
||||||
|
mfh_log_error('CRON', $error_message, 'CRON');
|
||||||
|
echo $error_message;
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check MySQL/PHP version and set encoding to utf8
|
||||||
|
hesk_dbSetNames();
|
||||||
|
|
||||||
|
return $hesk_db_link;
|
||||||
|
|
||||||
|
} // END hesk_dbConnect()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbClose()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
return @mysqli_close($hesk_db_link);
|
||||||
|
|
||||||
|
} // END hesk_dbClose()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbQuery($query)
|
||||||
|
{
|
||||||
|
global $hesk_last_query;
|
||||||
|
global $hesk_db_link;
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
if ( ! $hesk_db_link && ! hesk_dbConnect())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hesk_last_query = $query;
|
||||||
|
|
||||||
|
#echo "<p>EXPLAIN $query</p>\n";
|
||||||
|
|
||||||
|
if ($res = @mysqli_query($hesk_db_link, $query))
|
||||||
|
{
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
elseif ($hesk_settings['debug_mode'])
|
||||||
|
{
|
||||||
|
$message = 'Error executing SQL: ' . $query . '; ' . $hesklang['mysql_said'] . ': ' . mysqli_error($hesk_db_link);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
|
}
|
||||||
|
mfh_log_error($_SERVER['HTTP_REFERER'], $message, $_SESSION['id']);
|
||||||
|
echo $hesklang['cant_sql'] . ': ' . $message;
|
||||||
|
die();
|
||||||
|
} // END hesk_dbQuery()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFetchAssoc($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysqli_fetch_assoc($res);
|
||||||
|
|
||||||
|
} // END hesk_FetchAssoc()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFetchRow($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysqli_fetch_row($res);
|
||||||
|
|
||||||
|
} // END hesk_FetchRow()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbResult($res, $row = 0, $column = 0)
|
||||||
|
{
|
||||||
|
$i=0;
|
||||||
|
$res->data_seek(0);
|
||||||
|
|
||||||
|
while ($tmp = @mysqli_fetch_array($res, MYSQLI_NUM))
|
||||||
|
{
|
||||||
|
if ($i==$row)
|
||||||
|
{
|
||||||
|
return $tmp[$column];
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
|
||||||
|
} // END hesk_dbResult()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbInsertID()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
if ($lastid = @mysqli_insert_id($hesk_db_link))
|
||||||
|
{
|
||||||
|
return $lastid;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // END hesk_dbInsertID()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbFreeResult($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysqli_free_result($res);
|
||||||
|
|
||||||
|
} // END hesk_dbFreeResult()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbNumRows($res)
|
||||||
|
{
|
||||||
|
|
||||||
|
return @mysqli_num_rows($res);
|
||||||
|
|
||||||
|
} // END hesk_dbNumRows()
|
||||||
|
|
||||||
|
|
||||||
|
function hesk_dbAffectedRows()
|
||||||
|
{
|
||||||
|
global $hesk_db_link;
|
||||||
|
|
||||||
|
return @mysqli_affected_rows($hesk_db_link);
|
||||||
|
|
||||||
|
} // END hesk_dbAffectedRows()
|
5
css/bootstrap-clockpicker.min.css
vendored
Executable file
5
css/bootstrap-clockpicker.min.css
vendored
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
/*!
|
||||||
|
* ClockPicker v0.0.7 for Bootstrap (http://weareoutman.github.io/clockpicker/)
|
||||||
|
* Copyright 2014 Wang Shenwei.
|
||||||
|
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
|
||||||
|
*/.clockpicker .input-group-addon{cursor:pointer}.clockpicker-moving{cursor:move}.clockpicker-align-left.popover>.arrow{left:25px}.clockpicker-align-top.popover>.arrow{top:17px}.clockpicker-align-right.popover>.arrow{left:auto;right:25px}.clockpicker-align-bottom.popover>.arrow{top:auto;bottom:6px}.clockpicker-popover .popover-title{background-color:#fff;color:#999;font-size:24px;font-weight:700;line-height:30px;text-align:center}.clockpicker-popover .popover-title span{cursor:pointer}.clockpicker-popover .popover-content{background-color:#f8f8f8;padding:12px}.popover-content:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.clockpicker-plate{background-color:#fff;border:1px solid #ccc;border-radius:50%;width:200px;height:200px;overflow:visible;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.clockpicker-canvas,.clockpicker-dial{width:200px;height:200px;position:absolute;left:-1px;top:-1px}.clockpicker-minutes{visibility:hidden}.clockpicker-tick{border-radius:50%;color:#666;line-height:26px;text-align:center;width:26px;height:26px;position:absolute;cursor:pointer}.clockpicker-tick.active,.clockpicker-tick:hover{background-color:#c0e5f7;background-color:rgba(0,149,221,.25)}.clockpicker-button{background-image:none;background-color:#fff;border-width:1px 0 0;border-top-left-radius:0;border-top-right-radius:0;margin:0;padding:10px 0}.clockpicker-button:hover{background-image:none;background-color:#ebebeb}.clockpicker-button:focus{outline:0!important}.clockpicker-dial{-webkit-transition:-webkit-transform 350ms,opacity 350ms;-moz-transition:-moz-transform 350ms,opacity 350ms;-ms-transition:-ms-transform 350ms,opacity 350ms;-o-transition:-o-transform 350ms,opacity 350ms;transition:transform 350ms,opacity 350ms}.clockpicker-dial-out{opacity:0}.clockpicker-hours.clockpicker-dial-out{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2)}.clockpicker-minutes.clockpicker-dial-out{-webkit-transform:scale(.8,.8);-moz-transform:scale(.8,.8);-ms-transform:scale(.8,.8);-o-transform:scale(.8,.8);transform:scale(.8,.8)}.clockpicker-canvas{-webkit-transition:opacity 175ms;-moz-transition:opacity 175ms;-ms-transition:opacity 175ms;-o-transition:opacity 175ms;transition:opacity 175ms}.clockpicker-canvas-out{opacity:.25}.clockpicker-canvas-bearing,.clockpicker-canvas-fg{stroke:none;fill:#0095dd}.clockpicker-canvas-bg{stroke:none;fill:#c0e5f7}.clockpicker-canvas-bg-trans{fill:rgba(0,149,221,.25)}.clockpicker-canvas line{stroke:#0095dd;stroke-width:1;stroke-linecap:round}.clockpicker-button.am-button{margin:1px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}.clockpicker-button.pm-button{margin:1px 1px 1px 136px;padding:5px;border:1px solid rgba(0,0,0,.2);border-radius:4px}
|
5
css/fullcalendar.min.css
vendored
Executable file
5
css/fullcalendar.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
1
css/jquery.jgrowl.min.css
vendored
Executable file
1
css/jquery.jgrowl.min.css
vendored
Executable file
@ -0,0 +1 @@
|
|||||||
|
.jGrowl{z-index:9999;color:#fff;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:fixed}.jGrowl.top-left{left:0;top:0}.jGrowl.top-right{right:0;top:0}.jGrowl.bottom-left{left:0;bottom:0}.jGrowl.bottom-right{right:0;bottom:0}.jGrowl.center{top:0;width:50%;left:25%}.jGrowl.center .jGrowl-closer,.jGrowl.center .jGrowl-notification{margin-left:auto;margin-right:auto}.jGrowl-notification{background-color:#000;opacity:.9;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100));-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100));zoom:1;width:250px;padding:10px;margin:10px;text-align:left;display:none;border-radius:5px;min-height:40px}.jGrowl-notification .ui-state-highlight,.jGrowl-notification .ui-widget-content .ui-state-highlight,.jGrowl-notification .ui-widget-header .ui-state-highlight{border:1px solid #000;background:#000;color:#fff}.jGrowl-notification .jGrowl-header{font-weight:700;font-size:.85em}.jGrowl-notification .jGrowl-close{background-color:transparent;color:inherit;border:none;z-index:99;float:right;font-weight:700;font-size:1em;cursor:pointer}.jGrowl-closer{background-color:#000;opacity:.9;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100));-ms-filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100));zoom:1;width:250px;padding:10px;margin:10px;display:none;border-radius:5px;padding-top:4px;padding-bottom:4px;cursor:pointer;font-size:.9em;font-weight:700;text-align:center}.jGrowl-closer .ui-state-highlight,.jGrowl-closer .ui-widget-content .ui-state-highlight,.jGrowl-closer .ui-widget-header .ui-state-highlight{border:1px solid #000;background:#000;color:#fff}@media print{.jGrowl{display:none}}
|
@ -295,6 +295,10 @@ div.setupButtons {
|
|||||||
color: blue;
|
color: blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.black {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
.pad-down-20 {
|
.pad-down-20 {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
@ -316,3 +320,12 @@ div.setupButtons {
|
|||||||
.no-bottom-border {
|
.no-bottom-border {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.category-label {
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fc-content {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
@ -179,6 +179,16 @@ function hesk_load_internal_api_database_functions()
|
|||||||
}
|
}
|
||||||
} // END hesk_load_database_functions()
|
} // END hesk_load_database_functions()
|
||||||
|
|
||||||
|
function hesk_load_cron_database_functions()
|
||||||
|
{
|
||||||
|
if (function_exists('mysqli_connect')) {
|
||||||
|
require(HESK_PATH . 'cron/core/database_mysqli.inc.php');
|
||||||
|
} // Default to MySQL
|
||||||
|
else {
|
||||||
|
require(HESK_PATH . 'cron/core/database.inc.php');
|
||||||
|
}
|
||||||
|
} // END hesk_load_cron_database_functions()
|
||||||
|
|
||||||
function hesk_unlink($file, $older_than = 0)
|
function hesk_unlink($file, $older_than = 0)
|
||||||
{
|
{
|
||||||
return (is_file($file) && (!$older_than || (time() - filectime($file)) > $older_than) && @unlink($file)) ? true : false;
|
return (is_file($file) && (!$older_than || (time() - filectime($file)) > $older_than) && @unlink($file)) ? true : false;
|
||||||
@ -1762,6 +1772,7 @@ function hesk_getFeatureArray()
|
|||||||
'can_man_settings', /* User can manage helpdesk settings */
|
'can_man_settings', /* User can manage helpdesk settings */
|
||||||
'can_change_notification_settings', /* User can change notification settings */
|
'can_change_notification_settings', /* User can change notification settings */
|
||||||
'can_view_logs', /* User can view the message logs */
|
'can_view_logs', /* User can view the message logs */
|
||||||
|
'can_man_calendar', /* User can manage calendar events */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1820,10 +1831,16 @@ function mfh_log($location, $message, $severity, $user) {
|
|||||||
$sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` (`username`, `message`, `severity`, `location`, `timestamp`)
|
$sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "logging` (`username`, `message`, `severity`, `location`, `timestamp`)
|
||||||
VALUES ('" . hesk_dbEscape($user) . "',
|
VALUES ('" . hesk_dbEscape($user) . "',
|
||||||
'" . hesk_dbEscape($message) . "', " . intval($severity) . ", '" . hesk_dbEscape($location) . "', NOW())";
|
'" . hesk_dbEscape($message) . "', " . intval($severity) . ", '" . hesk_dbEscape($location) . "', NOW())";
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mfh_log_debug($location, $message, $user) {
|
function mfh_log_debug($location, $message, $user) {
|
||||||
|
global $hesk_settings;
|
||||||
|
|
||||||
|
if ($hesk_settings['debug_mode']) {
|
||||||
mfh_log($location, $message, 0, $user);
|
mfh_log($location, $message, 0, $user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mfh_log_info($location, $message, $user) {
|
function mfh_log_info($location, $message, $user) {
|
||||||
|
@ -255,6 +255,108 @@ function hesk_notifyStaff($email_template, $sql_where, $modsForHesk_settings, $i
|
|||||||
|
|
||||||
} // END hesk_notifyStaff()
|
} // END hesk_notifyStaff()
|
||||||
|
|
||||||
|
function mfh_sendCalendarReminder($reminder_data, $modsForHesk_settings) {
|
||||||
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
|
if (defined('HESK_DEMO')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_setLanguage($reminder_data['user_language']);
|
||||||
|
|
||||||
|
$valid_emails = hesk_validEmails();
|
||||||
|
$subject = NULL;
|
||||||
|
if (!isset($valid_emails['calendar_reminder'])) {
|
||||||
|
hesk_error($hesklang['inve']);
|
||||||
|
} else {
|
||||||
|
$subject = $valid_emails['calendar_reminder'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format email subject and message
|
||||||
|
$subject = str_replace('%%TITLE%%', $reminder_data['event_name'], $subject);
|
||||||
|
$message = hesk_getEmailMessage('calendar_reminder', NULL, $modsForHesk_settings, 1, 0, 1);
|
||||||
|
$message = mfh_processCalendarTemplate($message, $reminder_data);
|
||||||
|
$htmlMessage = hesk_getHtmlMessage('calendar_reminder', NULL, $modsForHesk_settings, 1, 0, 1);
|
||||||
|
$htmlMessage = mfh_processCalendarTemplate($htmlMessage, $reminder_data);
|
||||||
|
|
||||||
|
hesk_mail($reminder_data['user_email'], $subject, $message, $htmlMessage, $modsForHesk_settings);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mfh_processCalendarTemplate($message, $reminder_data) {
|
||||||
|
global $hesk_settings;
|
||||||
|
|
||||||
|
if ($reminder_data['event_all_day'] == '1') {
|
||||||
|
$format = 'Y-m-d';
|
||||||
|
} else {
|
||||||
|
$format = $hesk_settings['timeformat'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$start_date = strtotime($reminder_data['event_start']);
|
||||||
|
$formatted_start_date = date($format, $start_date);
|
||||||
|
$formatted_end_date = '';
|
||||||
|
|
||||||
|
if ($reminder_data['event_start'] != $reminder_data['event_end']) {
|
||||||
|
$end_date = strtotime($reminder_data['event_end']);
|
||||||
|
$formatted_end_date = ' - ' . date($format, $end_date);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process replaced fields
|
||||||
|
$message = str_replace('%%TITLE%%', $reminder_data['event_name'], $message);
|
||||||
|
$message = str_replace('%%LOCATION%%', $reminder_data['event_location'], $message);
|
||||||
|
$message = str_replace('%%CATEGORY%%', $reminder_data['event_category'], $message);
|
||||||
|
$message = str_replace('%%WHEN%%', $formatted_start_date . $formatted_end_date, $message);
|
||||||
|
$message = str_replace('%%COMMENTS%%', $reminder_data['event_comments'], $message);
|
||||||
|
|
||||||
|
return $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function mfh_sendOverdueTicketReminder($ticket, $users, $modsForHesk_settings) {
|
||||||
|
global $hesk_settings, $hesklang;
|
||||||
|
|
||||||
|
if (defined('HESK_DEMO')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_setLanguage($ticket['user_language']);
|
||||||
|
|
||||||
|
$valid_emails = hesk_validEmails();
|
||||||
|
$subject = NULL;
|
||||||
|
if (!isset($valid_emails['overdue_ticket'])) {
|
||||||
|
hesk_error($hesklang['inve']);
|
||||||
|
} else {
|
||||||
|
$subject = $valid_emails['overdue_ticket'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format email subject and message
|
||||||
|
$subject = str_replace('%%TITLE%%', $ticket['subject'], $subject);
|
||||||
|
$subject = str_replace('%%TRACKID%%', $ticket['trackid'], $subject);
|
||||||
|
$message = hesk_getEmailMessage('overdue_ticket', NULL, $modsForHesk_settings, 1, 0, 1);
|
||||||
|
$message = hesk_processMessage($message, $ticket, 1, 1, 0, $modsForHesk_settings);
|
||||||
|
$htmlMessage = hesk_getHtmlMessage('overdue_ticket', NULL, $modsForHesk_settings, 1, 0, 1);
|
||||||
|
$htmlMessage = hesk_processMessage($htmlMessage, $ticket, 1, 1, 0, $modsForHesk_settings, 1);
|
||||||
|
|
||||||
|
$emails = [];
|
||||||
|
if ($ticket['user_email'] != NULL) {
|
||||||
|
$emails[] = $ticket['user_email'];
|
||||||
|
}
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$categories = explode(',', $user['categories']);
|
||||||
|
if ($user['email'] != $ticket['user_email']
|
||||||
|
&& ($user['isadmin'] || in_array($ticket['category'], $categories))) {
|
||||||
|
$emails[] = $user['email'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
hesk_mail($email, $subject, $message, $htmlMessage, $modsForHesk_settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function hesk_validEmails()
|
function hesk_validEmails()
|
||||||
{
|
{
|
||||||
@ -303,6 +405,12 @@ function hesk_validEmails()
|
|||||||
// --> Staff password reset email
|
// --> Staff password reset email
|
||||||
'reset_password' => $hesklang['reset_password'],
|
'reset_password' => $hesklang['reset_password'],
|
||||||
|
|
||||||
|
// --> Calendar reminder
|
||||||
|
'calendar_reminder' => $hesklang['calendar_reminder'],
|
||||||
|
|
||||||
|
// --> Overdue Ticket reminder
|
||||||
|
'overdue_ticket' => $hesklang['overdue_ticket'],
|
||||||
|
|
||||||
);
|
);
|
||||||
} // END hesk_validEmails()
|
} // END hesk_validEmails()
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone.min.css">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone.min.css">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone-basic.min.css">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone-basic.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/fullcalendar.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-clockpicker.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/jquery.jgrowl.min.css">
|
||||||
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
|
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
|
||||||
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
|
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
|
||||||
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
|
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
|
||||||
@ -109,6 +112,7 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
|
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
|
||||||
<script language="JavaScript" type="text/javascript"
|
<script language="JavaScript" type="text/javascript"
|
||||||
src="<?php echo HESK_PATH; ?>js/bootstrap-datepicker.js"></script>
|
src="<?php echo HESK_PATH; ?>js/bootstrap-datepicker.js"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-clockpicker.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-fontawesome-4.3.0.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-fontawesome-4.3.0.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
||||||
@ -116,6 +120,7 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core.php"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core.php"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.jgrowl.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.navbar-default {
|
.navbar-default {
|
||||||
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
|
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
|
||||||
@ -239,6 +244,14 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/validation-scripts.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/validation-scripts.js"></script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined('MFH_CUSTOMER_CALENDAR')) {
|
||||||
|
?>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/moment.js"></script>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/fullcalendar.min.js"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/calendar/mods-for-hesk-calendar-readonly.js"></script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
@ -302,7 +315,17 @@ if ($modsForHesk_settings['show_icons']) {
|
|||||||
?>
|
?>
|
||||||
<li <?php echo $active; ?>><a href="<?php echo HESK_PATH; ?>knowledgebase.php"><i
|
<li <?php echo $active; ?>><a href="<?php echo HESK_PATH; ?>knowledgebase.php"><i
|
||||||
class="fa fa-book" <?php echo $iconDisplay; ?>></i> <?php echo $hesklang['kb_text'] ?>
|
class="fa fa-book" <?php echo $iconDisplay; ?>></i> <?php echo $hesklang['kb_text'] ?>
|
||||||
</a></li> <?php } ?>
|
</a></li> <?php }
|
||||||
|
$active = '';
|
||||||
|
if (defined('PAGE_TITLE') && PAGE_TITLE == 'CUSTOMER_CALENDAR') {
|
||||||
|
$active = ' active';
|
||||||
|
}
|
||||||
|
if ($modsForHesk_settings['enable_calendar'] == 1):
|
||||||
|
?>
|
||||||
|
<li class="<?php echo $active; ?>">
|
||||||
|
<a href="<?php echo HESK_PATH; ?>calendar.php"><i class="fa fa-calendar" <?php echo $iconDisplay; ?>></i> Calendar</a>
|
||||||
|
</li>
|
||||||
|
<?php endif; ?>
|
||||||
<?php include('custom/header-custom.inc.php'); ?>
|
<?php include('custom/header-custom.inc.php'); ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php if ($hesk_settings['can_sel_lang']) { ?>
|
<?php if ($hesk_settings['can_sel_lang']) { ?>
|
||||||
|
@ -77,6 +77,9 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone.min.css">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone.min.css">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone-basic.min.css">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/dropzone-basic.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/fullcalendar.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-clockpicker.min.css">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/jquery.jgrowl.min.css">
|
||||||
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
|
<script src="<?php echo HESK_PATH; ?>js/jquery-1.10.2.min.js"></script>
|
||||||
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
|
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript.js"></script>
|
||||||
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
|
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap.min.js"></script>
|
||||||
@ -85,13 +88,15 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
|
src="<?php echo HESK_PATH; ?>js/modsForHesk-javascript.js"></script>
|
||||||
<script language="JavaScript" type="text/javascript"
|
<script language="JavaScript" type="text/javascript"
|
||||||
src="<?php echo HESK_PATH; ?>js/bootstrap-datepicker.js"></script>
|
src="<?php echo HESK_PATH; ?>js/bootstrap-datepicker.js"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-clockpicker.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-fontawesome-4.3.0.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-fontawesome-4.3.0.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core.php"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core-admin.php"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.jgrowl.min.js"></script>
|
||||||
<?php
|
<?php
|
||||||
if (defined('EXTRA_JS')) {
|
if (defined('EXTRA_JS')) {
|
||||||
echo EXTRA_JS;
|
echo EXTRA_JS;
|
||||||
@ -214,7 +219,16 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
$onload .= "ss();";
|
$onload .= "ss();";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
if (defined('MFH_CALENDAR')) { ?>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/moment.js"></script>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/fullcalendar.min.js"></script>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/mods-for-hesk-calendar.js"></script>
|
||||||
|
<?php } else if (defined('MFH_CALENDAR_READONLY')) { ?>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/moment.js"></script>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/fullcalendar.min.js"></script>
|
||||||
|
<script src="<?php echo HESK_PATH; ?>js/calendar/mods-for-hesk-calendar-admin-readonly.js"></script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body onload="<?php echo $onload;
|
<body onload="<?php echo $onload;
|
||||||
|
@ -54,6 +54,11 @@ function hesk_newTicket($ticket, $isVerified = true)
|
|||||||
|
|
||||||
$ticket['message'] = htmLawed($ticket['message'], array('safe' => 1, 'deny_attribute' => 'style'));
|
$ticket['message'] = htmLawed($ticket['message'], array('safe' => 1, 'deny_attribute' => 'style'));
|
||||||
|
|
||||||
|
$due_date = 'NULL';
|
||||||
|
if ($ticket['due_date'] != '') {
|
||||||
|
$due_date = "'" . hesk_dbEscape($ticket['due_date']) . "'";
|
||||||
|
}
|
||||||
|
|
||||||
// Insert ticket into database
|
// Insert ticket into database
|
||||||
hesk_dbQuery("
|
hesk_dbQuery("
|
||||||
INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . $tableName . "`
|
INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . $tableName . "`
|
||||||
@ -101,7 +106,8 @@ function hesk_newTicket($ticket, $isVerified = true)
|
|||||||
`html`,
|
`html`,
|
||||||
`user_agent`,
|
`user_agent`,
|
||||||
`screen_resolution_height`,
|
`screen_resolution_height`,
|
||||||
`screen_resolution_width`
|
`screen_resolution_width`,
|
||||||
|
`due_date`
|
||||||
)
|
)
|
||||||
VALUES
|
VALUES
|
||||||
(
|
(
|
||||||
@ -148,7 +154,8 @@ function hesk_newTicket($ticket, $isVerified = true)
|
|||||||
'" . hesk_dbEscape($ticket['html']) . "',
|
'" . hesk_dbEscape($ticket['html']) . "',
|
||||||
'" . hesk_dbEscape($ticket['user_agent']) . "',
|
'" . hesk_dbEscape($ticket['user_agent']) . "',
|
||||||
" . hesk_dbEscape($ticket['screen_resolution_height']) . ",
|
" . hesk_dbEscape($ticket['screen_resolution_height']) . ",
|
||||||
" . hesk_dbEscape($ticket['screen_resolution_width']) . "
|
" . hesk_dbEscape($ticket['screen_resolution_width']) . ",
|
||||||
|
{$due_date}
|
||||||
)
|
)
|
||||||
");
|
");
|
||||||
|
|
||||||
@ -169,7 +176,8 @@ function hesk_newTicket($ticket, $isVerified = true)
|
|||||||
'lastchange' => hesk_date(),
|
'lastchange' => hesk_date(),
|
||||||
'id' => hesk_dbInsertID(),
|
'id' => hesk_dbInsertID(),
|
||||||
'language' => $language,
|
'language' => $language,
|
||||||
'html' => $ticket['html']
|
'html' => $ticket['html'],
|
||||||
|
'due_date' => $ticket['due_date']
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add custom fields to the array
|
// Add custom fields to the array
|
||||||
|
@ -319,12 +319,31 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?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">
|
<div class="form-group">
|
||||||
<label for="autoRefresh"
|
<label for="autoRefresh"
|
||||||
class="col-sm-3 control-label"><?php echo $hesklang['ticket_auto_refresh']; ?></label>
|
class="col-sm-3 control-label"><?php echo $hesklang['ticket_auto_refresh']; ?></label>
|
||||||
|
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input type="text" class="form-control" id="autorefresh" name="autorefresh"
|
<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']; ?>">
|
value="<?php echo $_SESSION[$session_array]['autorefresh']; ?>">
|
||||||
<span class="help-block"><?php echo $hesklang['autorefresh_restrictions']; ?></span>
|
<span class="help-block"><?php echo $hesklang['autorefresh_restrictions']; ?></span>
|
||||||
</div>
|
</div>
|
||||||
@ -431,17 +450,6 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
|
|||||||
echo ' ' . $disabledText ?> /> <?php echo $hesklang['npms']; ?></label></div>
|
echo ' ' . $disabledText ?> /> <?php echo $hesklang['npms']; ?></label></div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if ($disabledText == 'disabled') { ?>
|
|
||||||
<input type="hidden" name="notify_reply_my"
|
|
||||||
value="<?php echo !empty($_SESSION[$session_array]['notify_reply_my']) ? '1' : '0'; ?>">
|
|
||||||
<input type="hidden" name="notify_assigned"
|
|
||||||
value="<?php echo !empty($_SESSION[$session_array]['notify_assigned']) ? '1' : '0'; ?>">
|
|
||||||
<input type="hidden" name="notify_note"
|
|
||||||
value="<?php echo !empty($_SESSION[$session_array]['notify_note']) ? '1' : '0'; ?>">
|
|
||||||
<input type="hidden" name="notify_pm"
|
|
||||||
value="<?php echo !empty($_SESSION[$session_array]['notify_pm']) ? '1' : '0'; ?>">
|
|
||||||
<?php }
|
|
||||||
|
|
||||||
if ($_SESSION['isadmin']) { ?>
|
if ($_SESSION['isadmin']) { ?>
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-9 col-md-offset-3">
|
||||||
<div class="checkbox"><label><input type="checkbox" name="notify_note_unassigned"
|
<div class="checkbox"><label><input type="checkbox" name="notify_note_unassigned"
|
||||||
@ -450,8 +458,15 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti
|
|||||||
} ?>> <?php echo $hesklang['notify_note_unassigned']; ?></label></div>
|
} ?>> <?php echo $hesklang['notify_note_unassigned']; ?></label></div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
} ?>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<div class="checkbox"><label><input type="checkbox" name="notify_overdue_unassigned"
|
||||||
|
value="1" <?php if (!empty($_SESSION[$session_array]['notify_overdue_unassigned'])) {
|
||||||
|
echo 'checked="checked"';
|
||||||
}
|
}
|
||||||
}
|
echo ' ' . $disabledText ?> /> <?php echo $hesklang['notify_overdue_unassigned']; ?></label></div>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</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> ' . $hesklang['menu_kb'] . '</a></li>';
|
echo '<li'.$active.'><a href="knowledgebase_private.php"><i class="fa fa-book" ' . $iconDisplay . '></i> ' . $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> ' . $hesklang['calendar_title_case'] . '</a></li>';
|
||||||
|
}
|
||||||
if (hesk_checkPermission('can_run_reports', 0)) {
|
if (hesk_checkPermission('can_run_reports', 0)) {
|
||||||
$active = '';
|
$active = '';
|
||||||
if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_REPORTS') {
|
if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_REPORTS') {
|
||||||
|
29
index.php
29
index.php
@ -262,7 +262,7 @@ function print_add_ticket()
|
|||||||
// Get categories
|
// Get categories
|
||||||
hesk_dbConnect();
|
hesk_dbConnect();
|
||||||
$orderBy = $modsForHesk_settings['category_order_column'];
|
$orderBy = $modsForHesk_settings['category_order_column'];
|
||||||
$res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' ORDER BY `" . $orderBy . "` ASC");
|
$res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' AND `usage` <> 2 ORDER BY `" . $orderBy . "` ASC");
|
||||||
|
|
||||||
if (hesk_dbNumRows($res) == 1) {
|
if (hesk_dbNumRows($res) == 1) {
|
||||||
// Only 1 public category, no need for a select box
|
// Only 1 public category, no need for a select box
|
||||||
@ -1348,11 +1348,11 @@ function print_start()
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row default-row-margins">
|
||||||
<?php
|
<?php
|
||||||
if ($hesk_settings['kb_enable'])
|
if ($hesk_settings['kb_enable'])
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="row default-row-margins">
|
|
||||||
<div class="col-sm-6 col-xs-12">
|
<div class="col-sm-6 col-xs-12">
|
||||||
<a href="knowledgebase.php" class="button-link">
|
<a href="knowledgebase.php" class="button-link">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
@ -1370,11 +1370,34 @@ function print_start()
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
if ($hesk_settings['kb_enable'])
|
||||||
|
{
|
||||||
hesk_kbTopArticles($hesk_settings['kb_index_popart']);
|
hesk_kbTopArticles($hesk_settings['kb_index_popart']);
|
||||||
hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
|
hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
|
||||||
}?>
|
}
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="blankSpace"></div>
|
<div class="blankSpace"></div>
|
||||||
|
@ -720,5 +720,30 @@ function execute260Scripts()
|
|||||||
`size` INT(10) UNSIGNED NOT NULL,
|
`size` INT(10) UNSIGNED NOT NULL,
|
||||||
`type` ENUM('0','1') NOT NULL,
|
`type` ENUM('0','1') NOT NULL,
|
||||||
`date_uploaded` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
`date_uploaded` TIMESTAMP NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`start` DATETIME,
|
||||||
|
`end` DATETIME,
|
||||||
|
`all_day` ENUM('0','1') NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`location` VARCHAR(255),
|
||||||
|
`comments` MEDIUMTEXT,
|
||||||
|
`category` INT NOT NULL) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
`user_id` INT NOT NULL,
|
||||||
|
`event_id` INT NOT NULL,
|
||||||
|
`amount` INT NOT NULL,
|
||||||
|
`unit` INT NOT NULL,
|
||||||
|
`email_sent` ENUM('0', '1') NOT NULL DEFAULT '0') ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
|
||||||
|
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME");
|
||||||
|
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `overdue_email_sent` ENUM('0','1')");
|
||||||
|
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')");
|
||||||
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.6.0' WHERE `Key` = 'modsForHeskVersion'");
|
executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.6.0' WHERE `Key` = 'modsForHeskVersion'");
|
||||||
}
|
}
|
84
internal-api/admin/calendar/index.php
Normal file
84
internal-api/admin/calendar/index.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
define('HESK_PATH', '../../../');
|
||||||
|
define('INTERNAL_API_PATH', '../../');
|
||||||
|
require_once(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/attachments.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||||
|
require_once(INTERNAL_API_PATH . 'core/output.php');
|
||||||
|
require_once(INTERNAL_API_PATH . 'dao/calendar_dao.php');
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_load_internal_api_database_functions();
|
||||||
|
hesk_dbConnect();
|
||||||
|
|
||||||
|
$modsForHesk_settings = mfh_getSettings();
|
||||||
|
|
||||||
|
// Routing
|
||||||
|
$request_method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
if ($request_method === 'GET') {
|
||||||
|
$start = hesk_GET('start');
|
||||||
|
$end = hesk_GET('end');
|
||||||
|
$events = get_events($start, $end, $hesk_settings);
|
||||||
|
|
||||||
|
return output($events);
|
||||||
|
} elseif ($request_method === 'POST') {
|
||||||
|
$action = hesk_POST('action');
|
||||||
|
|
||||||
|
if ($action === 'create') {
|
||||||
|
$event['title'] = hesk_POST('title');
|
||||||
|
$event['location'] = hesk_POST('location');
|
||||||
|
$event['start'] = hesk_POST('startTime');
|
||||||
|
$event['end'] = hesk_POST('endTime');
|
||||||
|
$event['all_day'] = hesk_POST('allDay') === 'true';
|
||||||
|
$event['comments'] = hesk_POST('comments');
|
||||||
|
$event['category'] = hesk_POST('categoryId');
|
||||||
|
$event['reminder_amount'] = hesk_POST('reminderValue');
|
||||||
|
$event['reminder_amount'] = $event['reminder_amount'] == '' ? null : $event['reminder_amount'];
|
||||||
|
$event['reminder_units'] = hesk_POST('reminderUnits');
|
||||||
|
$event['reminder_user'] = $_SESSION['id'];
|
||||||
|
|
||||||
|
$id = create_event($event, $hesk_settings);
|
||||||
|
|
||||||
|
return output($id);
|
||||||
|
} elseif ($action === 'update') {
|
||||||
|
if (!isset($_POST['id'])) {
|
||||||
|
mfh_log_error('internal-api/admin/calendar', 'Unable to update an event as it has no ID.', $_SESSION['id']);
|
||||||
|
return http_response_code(400);
|
||||||
|
}
|
||||||
|
$event['id'] = hesk_POST('id');
|
||||||
|
$event['title'] = hesk_POST('title');
|
||||||
|
$event['location'] = hesk_POST('location');
|
||||||
|
$event['start'] = hesk_POST('startTime');
|
||||||
|
$event['end'] = hesk_POST('endTime');
|
||||||
|
$event['all_day'] = hesk_POST('allDay') === 'true';
|
||||||
|
$event['comments'] = hesk_POST('comments');
|
||||||
|
$event['category'] = hesk_POST('categoryId');
|
||||||
|
$event['reminder_amount'] = hesk_POST('reminderValue');
|
||||||
|
$event['reminder_amount'] = $event['reminder_amount'] == '' ? null : $event['reminder_amount'];
|
||||||
|
$event['reminder_units'] = hesk_POST('reminderUnits');
|
||||||
|
$event['reminder_user'] = $_SESSION['id'];
|
||||||
|
|
||||||
|
update_event($event, $hesk_settings);
|
||||||
|
|
||||||
|
return http_response_code(200);
|
||||||
|
} elseif ($action === 'delete') {
|
||||||
|
$id = hesk_POST('id');
|
||||||
|
|
||||||
|
delete_event($id, $hesk_settings);
|
||||||
|
return http_response_code(200);
|
||||||
|
} elseif ($action === 'update-ticket') {
|
||||||
|
$ticket['due_date'] = hesk_POST('dueDate');
|
||||||
|
if ($ticket['due_date'] == '') {
|
||||||
|
$ticket['due_date'] = NULL;
|
||||||
|
}
|
||||||
|
$ticket['trackid'] = hesk_POST('trackingId');
|
||||||
|
|
||||||
|
update_ticket_due_date($ticket, $hesk_settings);
|
||||||
|
|
||||||
|
return http_response_code(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return http_response_code(400);
|
28
internal-api/calendar/index.php
Normal file
28
internal-api/calendar/index.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
define('HESK_PATH', '../../');
|
||||||
|
define('INTERNAL_API_PATH', '../');
|
||||||
|
require_once(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/attachments.inc.php');
|
||||||
|
require_once(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||||
|
require_once(INTERNAL_API_PATH . 'core/output.php');
|
||||||
|
require_once(INTERNAL_API_PATH . 'dao/calendar_dao.php');
|
||||||
|
|
||||||
|
hesk_session_start();
|
||||||
|
hesk_load_internal_api_database_functions();
|
||||||
|
hesk_dbConnect();
|
||||||
|
|
||||||
|
$modsForHesk_settings = mfh_getSettings();
|
||||||
|
|
||||||
|
// Routing
|
||||||
|
$request_method = $_SERVER['REQUEST_METHOD'];
|
||||||
|
if ($request_method === 'GET') {
|
||||||
|
$start = hesk_GET('start');
|
||||||
|
$end = hesk_GET('end');
|
||||||
|
$events = get_events($start, $end, $hesk_settings, false);
|
||||||
|
|
||||||
|
return output($events);
|
||||||
|
}
|
||||||
|
|
||||||
|
return http_response_code(400);
|
@ -171,12 +171,13 @@ function hesk_dbQuery($query)
|
|||||||
}
|
}
|
||||||
elseif ($hesk_settings['debug_mode'])
|
elseif ($hesk_settings['debug_mode'])
|
||||||
{
|
{
|
||||||
$message = $hesklang['mysql_said'] . ': ' . mysqli_error($hesk_db_link);
|
$message = 'Error executing SQL: ' . $query . '; ' . $hesklang['mysql_said'] . ': ' . mysqli_error($hesk_db_link);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
$message = $hesklang['contact_webmaster'] . $hesk_settings['webmaster_email'];
|
||||||
}
|
}
|
||||||
|
mfh_log_error($_SERVER['HTTP_REFERER'], $message, $_SESSION['id']);
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
print_error($hesklang['cant_sql'], $message);
|
print_error($hesklang['cant_sql'], $message);
|
||||||
die(http_response_code(500));
|
die(http_response_code(500));
|
||||||
|
173
internal-api/dao/calendar_dao.php
Normal file
173
internal-api/dao/calendar_dao.php
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function get_events($start, $end, $hesk_settings, $staff = true) {
|
||||||
|
$sql = "SELECT `events`.*, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color` ";
|
||||||
|
|
||||||
|
if ($staff) {
|
||||||
|
$sql .= ",`reminders`.`amount` AS `reminder_value`, `reminders`.`unit` AS `reminder_unit` ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= "FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` AS `events`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` AS `categories`
|
||||||
|
ON `events`.`category` = `categories`.`id` ";
|
||||||
|
|
||||||
|
if ($staff) {
|
||||||
|
$sql .= "LEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` AS `reminders` ON
|
||||||
|
`reminders`.`user_id` = " . intval($_SESSION['id']) . " AND `reminders`.`event_id` = `events`.`id`";
|
||||||
|
}
|
||||||
|
$sql .= "WHERE `start` >= FROM_UNIXTIME(" . hesk_dbEscape($start)
|
||||||
|
. " / 1000) AND `end` <= FROM_UNIXTIME(" . hesk_dbEscape($end) . " / 1000) AND `categories`.`usage` <> 1";
|
||||||
|
|
||||||
|
if (!$staff) {
|
||||||
|
$sql .= " AND `categories`.`type` = '0'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = hesk_dbQuery($sql);
|
||||||
|
|
||||||
|
$events = [];
|
||||||
|
while ($row = hesk_dbFetchAssoc($rs)) {
|
||||||
|
// Skip the event if the user does not have access to it
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($row['category'], $_SESSION['categories'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mfh_log_debug('Calendar', "Creating event with id: {$row['id']}", '');
|
||||||
|
|
||||||
|
$event['type'] = 'CALENDAR';
|
||||||
|
$event['id'] = intval($row['id']);
|
||||||
|
$event['startTime'] = $row['start'];
|
||||||
|
$event['endTime'] = $row['end'];
|
||||||
|
$event['allDay'] = $row['all_day'] ? true : false;
|
||||||
|
$event['title'] = $row['name'];
|
||||||
|
$event['location'] = $row['location'];
|
||||||
|
$event['comments'] = $row['comments'];
|
||||||
|
$event['categoryId'] = $row['category'];
|
||||||
|
$event['categoryName'] = $row['category_name'];
|
||||||
|
$event['categoryColor'] = $row['category_color'];
|
||||||
|
|
||||||
|
if ($staff) {
|
||||||
|
$event['reminderValue'] = $row['reminder_value'];
|
||||||
|
$event['reminderUnits'] = $row['reminder_unit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$events[] = $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($staff) {
|
||||||
|
$sql = "SELECT `trackid`, `subject`, `due_date`, `category`, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color`,
|
||||||
|
CASE WHEN `due_date` < CURDATE() THEN 1 ELSE 0 END AS `overdue`
|
||||||
|
FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `tickets`
|
||||||
|
INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` AS `categories`
|
||||||
|
ON `categories`.`id` = `tickets`.`category`
|
||||||
|
AND `categories`.`usage` <> 1
|
||||||
|
WHERE `due_date` >= FROM_UNIXTIME(" . intval($start) . " / 1000)
|
||||||
|
AND `due_date` <= FROM_UNIXTIME(" . intval($end) . " / 1000)
|
||||||
|
AND `status` IN (SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `IsClosed` = 0) ";
|
||||||
|
|
||||||
|
$rs = hesk_dbQuery($sql);
|
||||||
|
while ($row = hesk_dbFetchAssoc($rs)) {
|
||||||
|
// Skip the ticket if the user does not have access to it
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($row['category'], $_SESSION['categories'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event['type'] = 'TICKET';
|
||||||
|
$event['trackingId'] = $row['trackid'];
|
||||||
|
$event['title'] = '[' . $row['trackid'] . '] ' . $row['subject'];
|
||||||
|
$event['startTime'] = $row['due_date'];
|
||||||
|
$event['url'] = $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/admin_ticket.php?track=' . $event['trackingId'];
|
||||||
|
$event['categoryId'] = $row['category'];
|
||||||
|
$event['categoryName'] = $row['category_name'];
|
||||||
|
$event['categoryColor'] = $row['overdue'] ? '#dd0000' : $row['category_color'];
|
||||||
|
$events[] = $event;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
function create_event($event, $hesk_settings) {
|
||||||
|
// Make sure the user can create events in this category
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($event['category'], $_SESSION['categories'])) {
|
||||||
|
print_error('Access Denied', 'You cannot create an event in this category');
|
||||||
|
}
|
||||||
|
|
||||||
|
$event['start'] = date('Y-m-d H:i:s', strtotime($event['start']));
|
||||||
|
$event['end'] = date('Y-m-d H:i:s', strtotime($event['end']));
|
||||||
|
$event['all_day'] = $event['all_day'] ? 1 : 0;
|
||||||
|
|
||||||
|
$sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` (`start`, `end`, `all_day`,
|
||||||
|
`name`, `location`, `comments`, `category`) VALUES (
|
||||||
|
'" . hesk_dbEscape($event['start']) . "', '" . hesk_dbEscape($event['end']) . "', '" . hesk_dbEscape($event['all_day']) . "',
|
||||||
|
'" . hesk_dbEscape($event['title']) . "', '" . hesk_dbEscape($event['location']) . "', '" . hesk_dbEscape($event['comments']) . "',
|
||||||
|
" . intval($event['category']) . ")";
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
$event_id = hesk_dbInsertID();
|
||||||
|
|
||||||
|
if ($event['reminder_amount'] != null) {
|
||||||
|
$sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` (`user_id`, `event_id`,
|
||||||
|
`amount`, `unit`) VALUES (" . intval($event['reminder_user']) . ", " . intval($event_id) . ", " . intval($event['reminder_amount']) . ",
|
||||||
|
" . intval($event['reminder_units']) . ")";
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $event_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_event($event, $hesk_settings) {
|
||||||
|
// Make sure the user can edit events in this category
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($event['category'], $_SESSION['categories'])) {
|
||||||
|
print_error('Access Denied', 'You cannot edit an event in this category');
|
||||||
|
}
|
||||||
|
|
||||||
|
$event['start'] = date('Y-m-d H:i:s', strtotime($event['start']));
|
||||||
|
$event['end'] = date('Y-m-d H:i:s', strtotime($event['end']));
|
||||||
|
if ($event['create_ticket_date'] != null) {
|
||||||
|
$event['create_ticket_date'] = date('Y-m-d H:i:s', strtotime($event['create_ticket_date']));
|
||||||
|
}
|
||||||
|
$event['all_day'] = $event['all_day'] ? 1 : 0;
|
||||||
|
$event['assign_to'] = $event['assign_to'] != null ? intval($event['assign_to']) : 'NULL';
|
||||||
|
|
||||||
|
$sql = "UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` SET `start` = '" . hesk_dbEscape($event['start'])
|
||||||
|
. "', `end` = '" . hesk_dbEscape($event['end']) . "', `all_day` = '" . hesk_dbEscape($event['all_day']) . "', `name` = '"
|
||||||
|
. hesk_dbEscape($event['title']) . "', `location` = '" . hesk_dbEscape($event['location']) . "', `comments` = '"
|
||||||
|
. hesk_dbEscape($event['comments']) . "', `category` = " . intval($event['category']) . " WHERE `id` = " . intval($event['id']);
|
||||||
|
|
||||||
|
if ($event['reminder_amount'] != null) {
|
||||||
|
$delete_sql = "DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` WHERE `event_id` = " . intval($event['id'])
|
||||||
|
. " AND `user_id` = " . intval($event['reminder_user']);
|
||||||
|
hesk_dbQuery($delete_sql);
|
||||||
|
$insert_sql = "INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder` (`user_id`, `event_id`,
|
||||||
|
`amount`, `unit`) VALUES (" . intval($event['reminder_user']) . ", " . intval($event['id']) . ", " . intval($event['reminder_amount']) . ",
|
||||||
|
" . intval($event['reminder_units']) . ")";
|
||||||
|
hesk_dbQuery($insert_sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_event($id, $hesk_settings) {
|
||||||
|
// Make sure the user can delete events in this category
|
||||||
|
$categoryRs = hesk_dbQuery('SELECT `category` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'calendar_event` WHERE `id` = ' . intval($id));
|
||||||
|
$category = hesk_dbFetchAssoc($categoryRs);
|
||||||
|
if (!$_SESSION['isadmin'] && !in_array($category['category'], $_SESSION['categories'])) {
|
||||||
|
print_error('Access Denied', 'You cannot delete events in this category');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event` WHERE `id` = " . intval($id);
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_ticket_due_date($ticket, $hesk_settings) {
|
||||||
|
$due_date = 'NULL';
|
||||||
|
if ($ticket['due_date'] != NULL) {
|
||||||
|
$due_date = "'" . date('Y-m-d H:i:s', strtotime($ticket['due_date'])) . "'";
|
||||||
|
}
|
||||||
|
$sql = "UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `due_date` = {$due_date}, `overdue_email_sent` = '0'
|
||||||
|
WHERE `trackid` = '" . hesk_dbEscape($ticket['trackid']) . "'";
|
||||||
|
|
||||||
|
hesk_dbQuery($sql);
|
||||||
|
}
|
40
internal-api/js/admin-ticket.js
Normal file
40
internal-api/js/admin-ticket.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
var $readonlyDueDateContainer = $('#readonly-due-date');
|
||||||
|
var $editableDueDateContainer = $('#editable-due-date');
|
||||||
|
var $dueDateButton = $('#due-date-button');
|
||||||
|
$dueDateButton.click(function() {
|
||||||
|
$readonlyDueDateContainer.hide();
|
||||||
|
$editableDueDateContainer.show();
|
||||||
|
if ($readonlyDueDateContainer.find('span#due-date').text().trim() == 'None') {
|
||||||
|
$editableDueDateContainer.find('input[type="text"][name="due-date"]').text('').val('');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$editableDueDateContainer.find('#cancel').click(function() {
|
||||||
|
$editableDueDateContainer.hide();
|
||||||
|
$editableDueDateContainer.find('input[name="due-date"]').val($readonlyDueDateContainer.find('span#due-date').text().trim());
|
||||||
|
$readonlyDueDateContainer.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$editableDueDateContainer.find('#submit').click(function() {
|
||||||
|
var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val();
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: {
|
||||||
|
trackingId: $('input[type="hidden"][name="track"]').val(),
|
||||||
|
action: 'update-ticket',
|
||||||
|
dueDate: newDueDate
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
$.jGrowl($('#lang_ticket_due_date_updated').text(), { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
$readonlyDueDateContainer.find('span#due-date').text(newDueDate == '' ? $('#lang_none').text() : newDueDate);
|
||||||
|
$readonlyDueDateContainer.show();
|
||||||
|
$editableDueDateContainer.hide();
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl($('#lang_error_updating_ticket_due_date').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
15
internal-api/js/core-admin.php
Normal file
15
internal-api/js/core-admin.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
require_once('../../hesk_settings.inc.php');
|
||||||
|
header('Content-Type: application/javascript');
|
||||||
|
echo "
|
||||||
|
var g_isInAdmin = true;
|
||||||
|
|
||||||
|
function getHelpdeskUrl() {
|
||||||
|
return '".$hesk_settings['hesk_url']."';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAdminDirectory() {
|
||||||
|
return '".$hesk_settings['admin_dir']."';
|
||||||
|
}
|
||||||
|
";
|
@ -3,6 +3,8 @@ define('IN_SCRIPT', 1);
|
|||||||
require_once('../../hesk_settings.inc.php');
|
require_once('../../hesk_settings.inc.php');
|
||||||
header('Content-Type: application/javascript');
|
header('Content-Type: application/javascript');
|
||||||
echo "
|
echo "
|
||||||
|
var g_isInAdmin = false;
|
||||||
|
|
||||||
function getHelpdeskUrl() {
|
function getHelpdeskUrl() {
|
||||||
return '".$hesk_settings['hesk_url']."';
|
return '".$hesk_settings['hesk_url']."';
|
||||||
}
|
}
|
||||||
|
6
js/bootstrap-clockpicker.min.js
vendored
Executable file
6
js/bootstrap-clockpicker.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
9
js/calendar/fullcalendar.min.js
vendored
Executable file
9
js/calendar/fullcalendar.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
149
js/calendar/mods-for-hesk-calendar-admin-readonly.js
Normal file
149
js/calendar/mods-for-hesk-calendar-admin-readonly.js
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
$('#calendar').fullCalendar({
|
||||||
|
header: {
|
||||||
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'month,agendaWeek,agendaDay'
|
||||||
|
},
|
||||||
|
editable: false,
|
||||||
|
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/admin/calendar/?start=' + start + '&end=' + end,
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
var events = [];
|
||||||
|
$(data).each(function() {
|
||||||
|
events.push(buildEvent(this.id, this));
|
||||||
|
});
|
||||||
|
callback(events);
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
console.error(data);
|
||||||
|
$.jGrowl($('#lang_error_loading_events').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
eventMouseover: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// Don't build a popover for tickets
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contents = $('.popover-template').html();
|
||||||
|
var $contents = $(contents);
|
||||||
|
|
||||||
|
var format = 'dddd, MMMM Do YYYY';
|
||||||
|
var endDate = event.end == null ? event.start : event.end;
|
||||||
|
|
||||||
|
if (!event.allDay) {
|
||||||
|
format += ', HH:mm';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.location === '') {
|
||||||
|
$contents.find('.popover-location').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents.find('.popover-category span').text(event.categoryName).end()
|
||||||
|
.find('.popover-location span').text(event.location).end()
|
||||||
|
.find('.popover-from span').text(event.start.format(format)).end()
|
||||||
|
.find('.popover-to span').text(endDate.format(format));
|
||||||
|
var $eventMarkup = $(this);
|
||||||
|
$eventMarkup.popover({
|
||||||
|
title: event.title,
|
||||||
|
html: true,
|
||||||
|
content: $contents,
|
||||||
|
animation: true,
|
||||||
|
container: 'body',
|
||||||
|
placement: 'auto'
|
||||||
|
}).popover('show');
|
||||||
|
},
|
||||||
|
eventMouseout: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// There's no popover to destroy
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).popover('destroy');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="category-toggle"]').change(updateCategoryVisibility);
|
||||||
|
});
|
||||||
|
|
||||||
|
function buildEvent(id, dbObject) {
|
||||||
|
if (dbObject.type == 'TICKET') {
|
||||||
|
return {
|
||||||
|
title: dbObject.title,
|
||||||
|
trackingId: dbObject.trackingId,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
url: dbObject.url,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
allDay: true,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: id,
|
||||||
|
title: dbObject.title,
|
||||||
|
allDay: dbObject.allDay,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
end: moment(dbObject.endTime),
|
||||||
|
comments: dbObject.comments,
|
||||||
|
location: dbObject.location,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
categoryName: dbObject.categoryName,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor),
|
||||||
|
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
|
||||||
|
reminderUnits: dbObject.reminderUnits
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTextColor(color) {
|
||||||
|
if (color === null || color === '') {
|
||||||
|
return 'black';
|
||||||
|
}
|
||||||
|
|
||||||
|
var red = 0;
|
||||||
|
var green = 0;
|
||||||
|
var blue = 0;
|
||||||
|
|
||||||
|
// If hex value is 3 characters, take each value and concatenate it to itself
|
||||||
|
if (color.length === 3) {
|
||||||
|
red = parseInt(color.substring(1, 2), 16);
|
||||||
|
green = parseInt(color.substring(2, 3), 16);
|
||||||
|
blue = parseInt(color.substring(3, 4), 16);
|
||||||
|
} else {
|
||||||
|
red = parseInt(color.substring(1, 3), 16);
|
||||||
|
green = parseInt(color.substring(3, 5), 16);
|
||||||
|
blue = parseInt(color.substring(5, 7), 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
var gray = red * 0.299 + green * 0.587 + blue * 0.114;
|
||||||
|
|
||||||
|
return gray > 186 ? 'black' : 'white';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCategoryVisibility() {
|
||||||
|
$('input[name="category-toggle"]').each(function() {
|
||||||
|
$this = $(this);
|
||||||
|
|
||||||
|
if ($this.is(':checked')) {
|
||||||
|
$('.category-' + $this.val()).show();
|
||||||
|
} else {
|
||||||
|
$('.category-' + $this.val()).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
149
js/calendar/mods-for-hesk-calendar-readonly.js
Normal file
149
js/calendar/mods-for-hesk-calendar-readonly.js
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
$('#calendar').fullCalendar({
|
||||||
|
header: {
|
||||||
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'month,agendaWeek,agendaDay'
|
||||||
|
},
|
||||||
|
editable: false,
|
||||||
|
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,
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
var events = [];
|
||||||
|
$(data).each(function() {
|
||||||
|
events.push(buildEvent(this.id, this));
|
||||||
|
});
|
||||||
|
callback(events);
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
console.error(data);
|
||||||
|
$.jGrowl($('#lang_error_loading_events').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
eventMouseover: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// Don't build a popover for tickets
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contents = $('.popover-template').html();
|
||||||
|
var $contents = $(contents);
|
||||||
|
|
||||||
|
var format = 'dddd, MMMM Do YYYY';
|
||||||
|
var endDate = event.end == null ? event.start : event.end;
|
||||||
|
|
||||||
|
if (!event.allDay) {
|
||||||
|
format += ', HH:mm';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.location === '') {
|
||||||
|
$contents.find('.popover-location').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents.find('.popover-category span').text(event.categoryName).end()
|
||||||
|
.find('.popover-location span').text(event.location).end()
|
||||||
|
.find('.popover-from span').text(event.start.format(format)).end()
|
||||||
|
.find('.popover-to span').text(endDate.format(format));
|
||||||
|
var $eventMarkup = $(this);
|
||||||
|
$eventMarkup.popover({
|
||||||
|
title: event.title,
|
||||||
|
html: true,
|
||||||
|
content: $contents,
|
||||||
|
animation: true,
|
||||||
|
container: 'body',
|
||||||
|
placement: 'auto'
|
||||||
|
}).popover('show');
|
||||||
|
},
|
||||||
|
eventMouseout: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// There's no popover to destroy
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).popover('destroy');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="category-toggle"]').change(updateCategoryVisibility);
|
||||||
|
});
|
||||||
|
|
||||||
|
function buildEvent(id, dbObject) {
|
||||||
|
if (dbObject.type == 'TICKET') {
|
||||||
|
return {
|
||||||
|
title: dbObject.title,
|
||||||
|
trackingId: dbObject.trackingId,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
url: dbObject.url,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
allDay: true,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: id,
|
||||||
|
title: dbObject.title,
|
||||||
|
allDay: dbObject.allDay,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
end: moment(dbObject.endTime),
|
||||||
|
comments: dbObject.comments,
|
||||||
|
location: dbObject.location,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
categoryName: dbObject.categoryName,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor),
|
||||||
|
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
|
||||||
|
reminderUnits: dbObject.reminderUnits
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTextColor(color) {
|
||||||
|
if (color === null || color === '') {
|
||||||
|
return 'black';
|
||||||
|
}
|
||||||
|
|
||||||
|
var red = 0;
|
||||||
|
var green = 0;
|
||||||
|
var blue = 0;
|
||||||
|
|
||||||
|
// If hex value is 3 characters, take each value and concatenate it to itself
|
||||||
|
if (color.length === 3) {
|
||||||
|
red = parseInt(color.substring(1, 2), 16);
|
||||||
|
green = parseInt(color.substring(2, 3), 16);
|
||||||
|
blue = parseInt(color.substring(3, 4), 16);
|
||||||
|
} else {
|
||||||
|
red = parseInt(color.substring(1, 3), 16);
|
||||||
|
green = parseInt(color.substring(3, 5), 16);
|
||||||
|
blue = parseInt(color.substring(5, 7), 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
var gray = red * 0.299 + green * 0.587 + blue * 0.114;
|
||||||
|
|
||||||
|
return gray > 186 ? 'black' : 'white';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCategoryVisibility() {
|
||||||
|
$('input[name="category-toggle"]').each(function() {
|
||||||
|
$this = $(this);
|
||||||
|
|
||||||
|
if ($this.is(':checked')) {
|
||||||
|
$('.category-' + $this.val()).show();
|
||||||
|
} else {
|
||||||
|
$('.category-' + $this.val()).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
443
js/calendar/mods-for-hesk-calendar.js
Normal file
443
js/calendar/mods-for-hesk-calendar.js
Normal file
@ -0,0 +1,443 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
$('#calendar').fullCalendar({
|
||||||
|
header: {
|
||||||
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
|
center: 'title',
|
||||||
|
right: 'month,agendaWeek,agendaDay'
|
||||||
|
},
|
||||||
|
editable: true,
|
||||||
|
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/admin/calendar/?start=' + start + '&end=' + end,
|
||||||
|
method: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
var events = [];
|
||||||
|
$(data).each(function() {
|
||||||
|
events.push(buildEvent(this.id, this));
|
||||||
|
});
|
||||||
|
callback(events);
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
console.error(data);
|
||||||
|
$.jGrowl($('#lang_error_loading_events').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dayClick: function(date, jsEvent, view) {
|
||||||
|
displayCreateModal(date, view.name);
|
||||||
|
},
|
||||||
|
eventClick: function(event) {
|
||||||
|
if (event.url) {
|
||||||
|
window.open(event.url, "_blank");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (event.type !== 'TICKET') {
|
||||||
|
displayEditModal(event);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
eventDrop: respondToDragAndDrop,
|
||||||
|
eventResize: respondToDragAndDrop,
|
||||||
|
eventMouseover: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// Don't build a popover for tickets
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var contents = $('.popover-template').html();
|
||||||
|
var $contents = $(contents);
|
||||||
|
|
||||||
|
var format = 'dddd, MMMM Do YYYY';
|
||||||
|
var endDate = event.end == null ? event.start : event.end;
|
||||||
|
|
||||||
|
if (!event.allDay) {
|
||||||
|
format += ', HH:mm';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.location === '') {
|
||||||
|
$contents.find('.popover-location').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents.find('.popover-category span').text(event.categoryName).end()
|
||||||
|
.find('.popover-location span').text(event.location).end()
|
||||||
|
.find('.popover-from span').text(event.start.format(format)).end()
|
||||||
|
.find('.popover-to span').text(endDate.format(format));
|
||||||
|
var $eventMarkup = $(this);
|
||||||
|
$eventMarkup.popover({
|
||||||
|
title: event.title,
|
||||||
|
html: true,
|
||||||
|
content: $contents,
|
||||||
|
animation: true,
|
||||||
|
container: 'body',
|
||||||
|
placement: 'auto'
|
||||||
|
}).popover('show');
|
||||||
|
},
|
||||||
|
eventMouseout: function(event) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
// There's no popover to destroy
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(this).popover('destroy');
|
||||||
|
},
|
||||||
|
dayRender: function(date, cell) {
|
||||||
|
var $cell = $(cell);
|
||||||
|
$cell.attr('title', 'Click to add event');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#create-event-button').click(function() {
|
||||||
|
// Hard-code the view name so the modal treats this as an "all-day" event.
|
||||||
|
var viewName = 'month';
|
||||||
|
displayCreateModal(moment(), viewName);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$('#create-form input[name="all-day"]').change(function() {
|
||||||
|
var hideTimeFields = $(this).is(':checked');
|
||||||
|
|
||||||
|
$('#create-form .clockpicker').css('display', hideTimeFields ? 'none' : 'block');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit-form input[name="all-day"]').change(function() {
|
||||||
|
var hideTimeFields = $(this).is(':checked');
|
||||||
|
|
||||||
|
$('#edit-form .clockpicker').css('display', hideTimeFields ? 'none' : 'block');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit-form #delete-button').click(function() {
|
||||||
|
var id = $('#edit-form').find('input[name="id"]').val();
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: id,
|
||||||
|
action: 'delete'
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: data,
|
||||||
|
success: function() {
|
||||||
|
removeFromCalendar(data.id);
|
||||||
|
$.jGrowl($('#lang_event_deleted').text(), { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
$('#edit-event-modal').modal('hide');
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
$.jGrowl($('#lang_error_deleting_event').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#create-form').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var start = $('#create-form input[name="start-date"]').val();
|
||||||
|
var end = $('#create-form input[name="end-date"]').val();
|
||||||
|
var dateFormat = 'YYYY-MM-DD';
|
||||||
|
var allDay = $('#create-form input[name="all-day"]').is(':checked');
|
||||||
|
|
||||||
|
if (!allDay) {
|
||||||
|
start += ' ' + $('#create-form input[name="start-time"]').val();
|
||||||
|
end += ' ' + $('#create-form input[name="end-time"]').val();
|
||||||
|
dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
title: $('#create-form input[name="name"]').val(),
|
||||||
|
location: $('#create-form input[name="location"]').val(),
|
||||||
|
startTime: moment(start).format(dateFormat),
|
||||||
|
endTime: moment(end).format(dateFormat),
|
||||||
|
allDay: allDay,
|
||||||
|
comments: $('#create-form textarea[name="comments"]').val(),
|
||||||
|
categoryId: $('#create-form select[name="category"]').val(),
|
||||||
|
action: 'create',
|
||||||
|
type: 'CALENDAR',
|
||||||
|
categoryColor: $('#create-form select[name="category"] :selected').attr('data-color'),
|
||||||
|
categoryName: $('#create-form select[name="category"] :selected').text().trim(),
|
||||||
|
reminderValue: $('#create-form input[name="reminder-value"]').val(),
|
||||||
|
reminderUnits: $('#create-form select[name="reminder-unit"]').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: data,
|
||||||
|
success: function(id) {
|
||||||
|
addToCalendar(id, data, $('#lang_event_created').text());
|
||||||
|
$('#create-event-modal').modal('hide');
|
||||||
|
updateCategoryVisibility();
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl($('#lang_error_creating_event').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit-form').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var $form = $('#edit-form');
|
||||||
|
var start = $form.find('input[name="start-date"]').val();
|
||||||
|
var end = $form.find('input[name="end-date"]').val();
|
||||||
|
var dateFormat = 'YYYY-MM-DD';
|
||||||
|
var allDay = $form.find('input[name="all-day"]').is(':checked');
|
||||||
|
|
||||||
|
if (!allDay) {
|
||||||
|
start += ' ' + $form.find('input[name="start-time"]').val();
|
||||||
|
end += ' ' + $form.find('input[name="end-time"]').val();
|
||||||
|
dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $form.find('input[name="id"]').val(),
|
||||||
|
title: $form.find('input[name="name"]').val(),
|
||||||
|
location: $form.find('input[name="location"]').val(),
|
||||||
|
startTime: moment(start).format(dateFormat),
|
||||||
|
endTime: moment(end).format(dateFormat),
|
||||||
|
allDay: allDay,
|
||||||
|
comments: $form.find('textarea[name="comments"]').val(),
|
||||||
|
categoryId: $form.find('select[name="category"]').val(),
|
||||||
|
categoryColor: $form.find('select[name="category"] :selected').attr('data-color'),
|
||||||
|
categoryName: $form.find('select[name="category"] :selected').text().trim(),
|
||||||
|
action: 'update',
|
||||||
|
reminderValue: $form.find('input[name="reminder-value"]').val(),
|
||||||
|
reminderUnits: $form.find('select[name="reminder-unit"]').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: data,
|
||||||
|
success: function() {
|
||||||
|
removeFromCalendar(data.id);
|
||||||
|
addToCalendar(data.id, data, $('#lang_event_updated').text());
|
||||||
|
$('#edit-event-modal').modal('hide');
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl($('#lang_error_updating_event').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[name="category-toggle"]').change(updateCategoryVisibility);
|
||||||
|
});
|
||||||
|
|
||||||
|
function addToCalendar(id, event, successMessage) {
|
||||||
|
var eventObject = buildEvent(id, event);
|
||||||
|
$('#calendar').fullCalendar('renderEvent', eventObject);
|
||||||
|
$.jGrowl(successMessage, { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFromCalendar(id) {
|
||||||
|
$('#calendar').fullCalendar('removeEvents', id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildEvent(id, dbObject) {
|
||||||
|
if (dbObject.type == 'TICKET') {
|
||||||
|
return {
|
||||||
|
title: dbObject.title,
|
||||||
|
trackingId: dbObject.trackingId,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
url: dbObject.url,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
allDay: true,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: id,
|
||||||
|
title: dbObject.title,
|
||||||
|
allDay: dbObject.allDay,
|
||||||
|
start: moment(dbObject.startTime),
|
||||||
|
end: moment(dbObject.endTime),
|
||||||
|
comments: dbObject.comments,
|
||||||
|
location: dbObject.location,
|
||||||
|
type: dbObject.type,
|
||||||
|
categoryId: dbObject.categoryId,
|
||||||
|
categoryName: dbObject.categoryName,
|
||||||
|
className: 'category-' + dbObject.categoryId,
|
||||||
|
color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor,
|
||||||
|
textColor: calculateTextColor(dbObject.categoryColor),
|
||||||
|
reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue,
|
||||||
|
reminderUnits: dbObject.reminderUnits
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTextColor(color) {
|
||||||
|
if (color === null || color === '') {
|
||||||
|
return 'black';
|
||||||
|
}
|
||||||
|
|
||||||
|
var red = 0;
|
||||||
|
var green = 0;
|
||||||
|
var blue = 0;
|
||||||
|
|
||||||
|
// If hex value is 3 characters, take each value and concatenate it to itself
|
||||||
|
if (color.length === 3) {
|
||||||
|
red = parseInt(color.substring(1, 2), 16);
|
||||||
|
green = parseInt(color.substring(2, 3), 16);
|
||||||
|
blue = parseInt(color.substring(3, 4), 16);
|
||||||
|
} else {
|
||||||
|
red = parseInt(color.substring(1, 3), 16);
|
||||||
|
green = parseInt(color.substring(3, 5), 16);
|
||||||
|
blue = parseInt(color.substring(5, 7), 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
var gray = red * 0.299 + green * 0.587 + blue * 0.114;
|
||||||
|
|
||||||
|
return gray > 186 ? 'black' : 'white';
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayCreateModal(date, viewName) {
|
||||||
|
var $form = $('#create-form');
|
||||||
|
$form.find('input[name="name"]').val('').end()
|
||||||
|
.find('input[name="location"]').val('').end()
|
||||||
|
.find('textarea[name="comments"]').val('').end()
|
||||||
|
.find('select[name="category"]').val('').end()
|
||||||
|
.find('select[name="reminder-unit"]').val(0).end()
|
||||||
|
.find('input[name="reminder-value"]').val('').end();
|
||||||
|
|
||||||
|
var $modal = $('#create-event-modal');
|
||||||
|
var formattedDate = date.format('YYYY-MM-DD');
|
||||||
|
$modal.find('input[name="start-date"]').val(formattedDate).end()
|
||||||
|
.find('input[name="end-date"]').val(formattedDate).end();
|
||||||
|
if (viewName === 'month') {
|
||||||
|
// Select "All Day"
|
||||||
|
$form.find('input[name="all-day"]').prop('checked', true).end()
|
||||||
|
.find('.clockpicker').hide();
|
||||||
|
} else {
|
||||||
|
$form.find('input[name="all-day"]').prop('checked', false).end()
|
||||||
|
.find('.clockpicker').show();
|
||||||
|
var formattedTime = date.format('HH:mm:ss');
|
||||||
|
var selectedHour = date.hour();
|
||||||
|
$modal.find('input[name="start-time"]').val(formattedTime).end()
|
||||||
|
.find('input[name="end-time"]').val(date.hour(selectedHour + 1).format('HH:mm:ss'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$modal.modal('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayEditModal(date) {
|
||||||
|
var $form = $('#edit-form');
|
||||||
|
|
||||||
|
if (date.end === null) {
|
||||||
|
// FullCalendar will set the end date to null if it is the same as the start date.
|
||||||
|
date.end = date.start.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (date.allDay) {
|
||||||
|
$form.find('input[name="all-day"]').prop('checked', true).end()
|
||||||
|
.find('input[name="start-time"]').hide().end()
|
||||||
|
.find('input[name="end-time"]').hide().end();
|
||||||
|
} else {
|
||||||
|
$form.find('input[name="all-day"]').prop('checked', false).end()
|
||||||
|
.find('.clockpicker').show().end()
|
||||||
|
.find('input[name="start-time"]').val(date.start.format('HH:mm:ss')).end()
|
||||||
|
.find('input[name="end-time"]').val(date.end.format('HH:mm:ss')).end();
|
||||||
|
}
|
||||||
|
|
||||||
|
$form.find('input[name="name"]').val(date.title).end()
|
||||||
|
.find('input[name="location"]').val(date.location).end()
|
||||||
|
.find('textarea[name="comments"]').val(date.comments).end()
|
||||||
|
.find('input[name="start-date"]').val(date.start.format('YYYY-MM-DD')).end()
|
||||||
|
.find('input[name="end-date"]').val(date.end.format('YYYY-MM-DD')).end()
|
||||||
|
.find('input[name="id"]').val(date.id).end()
|
||||||
|
.find('input[name="reminder-value"]').val(date.reminderValue).end();
|
||||||
|
|
||||||
|
if (date.reminderUnits != null) {
|
||||||
|
$form.find('select[name="reminder-unit"]').val(date.reminderUnits).end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var createTicketLink = getHelpdeskUrl() + '/' + getAdminDirectory() + '/new_ticket.php?subject=';
|
||||||
|
createTicketLink += encodeURI('[' + date.start.format('YYYY-MM-DD') + '] ' + date.title);
|
||||||
|
if (date.location != '') {
|
||||||
|
createTicketLink += encodeURI(' @ ' + date.location);
|
||||||
|
}
|
||||||
|
createTicketLink += encodeURI('&message=' + date.comments);
|
||||||
|
createTicketLink += encodeURI('&category=' + date.categoryId);
|
||||||
|
createTicketLink += encodeURI('&due_date=' + date.end.format('YYYY-MM-DD'));
|
||||||
|
|
||||||
|
$form.find('#create-ticket-button').prop('href', createTicketLink);
|
||||||
|
|
||||||
|
$form.find('select[name="category"] option[value="' + date.categoryId + '"]').prop('selected', true);
|
||||||
|
|
||||||
|
$('#edit-event-modal').modal('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCategoryVisibility() {
|
||||||
|
$('input[name="category-toggle"]').each(function() {
|
||||||
|
$this = $(this);
|
||||||
|
|
||||||
|
if ($this.is(':checked')) {
|
||||||
|
$('.category-' + $this.val()).show();
|
||||||
|
} else {
|
||||||
|
$('.category-' + $this.val()).hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function respondToDragAndDrop(event, delta, revertFunc) {
|
||||||
|
if (event.type === 'TICKET') {
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: {
|
||||||
|
trackingId: event.trackingId,
|
||||||
|
action: 'update-ticket',
|
||||||
|
dueDate: event.start.format('YYYY-MM-DD')
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
$.jGrowl($('#lang_ticket_due_date_updated').text(), { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl($('#lang_error_updating_ticket_due_date').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
revertFunc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var start = event.start.format('YYYY-MM-DD');
|
||||||
|
if (event.end === null) {
|
||||||
|
event.end = event.start.clone();
|
||||||
|
}
|
||||||
|
var end = event.end.format('YYYY-MM-DD');
|
||||||
|
if (!event.allDay) {
|
||||||
|
start += ' ' + event.start.format('HH:mm:ss');
|
||||||
|
end += ' ' + event.end.format('HH:mm:ss');
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
id: event.id,
|
||||||
|
title: event.title,
|
||||||
|
location: event.location,
|
||||||
|
startTime: start,
|
||||||
|
endTime: end,
|
||||||
|
allDay: event.allDay,
|
||||||
|
comments: event.comments,
|
||||||
|
categoryId: event.categoryId,
|
||||||
|
action: 'update',
|
||||||
|
reminderValue: event.reminderValue,
|
||||||
|
reminderUnits: event.reminderUnits
|
||||||
|
};
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
||||||
|
data: data,
|
||||||
|
success: function() {
|
||||||
|
$.jGrowl($('#lang_event_updated').text(), { theme: 'alert-success', closeTemplate: '' });
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
$.jGrowl($('#lang_error_updating_event').text(), { theme: 'alert-danger', closeTemplate: '' });
|
||||||
|
revertFunc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
3606
js/calendar/moment.js
Normal file
3606
js/calendar/moment.js
Normal file
File diff suppressed because it is too large
Load Diff
2
js/jquery.jgrowl.min.js
vendored
Executable file
2
js/jquery.jgrowl.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@ -28,7 +28,7 @@ var loadJquery = function()
|
|||||||
html: 'true'
|
html: 'true'
|
||||||
});
|
});
|
||||||
|
|
||||||
//-- Activate jQuery's date picker
|
//-- Activate Bootstrap Datepicker
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
todayBtn: "linked",
|
todayBtn: "linked",
|
||||||
@ -46,8 +46,36 @@ var loadJquery = function()
|
|||||||
searchText: $('#search-icon').text(),
|
searchText: $('#search-icon').text(),
|
||||||
labelFooter: $('#footer-icon').text()
|
labelFooter: $('#footer-icon').text()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.clockpicker').clockpicker();
|
||||||
|
|
||||||
|
// Set the proper text color for background-volatile elements
|
||||||
|
$('.background-volatile').each(function() {
|
||||||
|
$this = $(this);
|
||||||
|
var background = $this.css('background-color');
|
||||||
|
|
||||||
|
if (background !== 'rgba(0, 0, 0, 0)'
|
||||||
|
&& background !== 'transparent') {
|
||||||
|
var grayCount = calculateGrayCount(background);
|
||||||
|
|
||||||
|
if (grayCount > 186) {
|
||||||
|
$this.css('color', '#000');
|
||||||
|
} else {
|
||||||
|
$this.css('color', '#fff');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function calculateGrayCount(background) {
|
||||||
|
var parts = background.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||||
|
var red = parts[1];
|
||||||
|
var green = parts[2];
|
||||||
|
var blue = parts[3];
|
||||||
|
|
||||||
|
return red*0.299 + green*0.587 + blue*0.114;
|
||||||
|
}
|
||||||
|
|
||||||
var setIcon = function(icon) {
|
var setIcon = function(icon) {
|
||||||
$('[data-toggle="iconpicker"]').iconpicker('setIcon', icon);
|
$('[data-toggle="iconpicker"]').iconpicker('setIcon', icon);
|
||||||
}
|
}
|
||||||
|
7
language/en/emails/calendar_reminder.txt
Normal file
7
language/en/emails/calendar_reminder.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
An event is coming up soon!
|
||||||
|
----
|
||||||
|
Title: %%TITLE%%
|
||||||
|
Location: %%LOCATION%%
|
||||||
|
Category: %%CATEGORY%%
|
||||||
|
When: %%WHEN%%
|
||||||
|
Comments: %%COMMENTS%%
|
7
language/en/emails/html/calendar_reminder.txt
Normal file
7
language/en/emails/html/calendar_reminder.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<h3>An event is coming up soon!</h3>
|
||||||
|
<hr>
|
||||||
|
<b>Title:</b> %%TITLE%%
|
||||||
|
<br><b>Location:</b> %%LOCATION%%
|
||||||
|
<br><b>Category:</b> %%CATEGORY%%
|
||||||
|
<br><b>When:</b> %%WHEN%%
|
||||||
|
<br><b>Comments:</b> %%COMMENTS%%
|
9
language/en/emails/html/overdue_ticket.txt
Normal file
9
language/en/emails/html/overdue_ticket.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<p>Hello,</p>
|
||||||
|
<p>A ticket is overdue! Ticket details:</p>
|
||||||
|
<p>Ticket subject: %%SUBJECT%%</p>
|
||||||
|
<p>Tracking ID: %%TRACK_ID%%</p>
|
||||||
|
<p>You can manage this ticket here:
|
||||||
|
%%TRACK_URL%%</p>
|
||||||
|
<p>Regards,</p>
|
||||||
|
%%SITE_TITLE%% <br>
|
||||||
|
%%SITE_URL%%
|
17
language/en/emails/overdue_ticket.txt
Executable file
17
language/en/emails/overdue_ticket.txt
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
Hello,
|
||||||
|
|
||||||
|
A ticket is overdue! Ticket details:
|
||||||
|
|
||||||
|
Ticket subject: %%SUBJECT%%
|
||||||
|
Tracking ID: %%TRACK_ID%%
|
||||||
|
|
||||||
|
You can manage this ticket here:
|
||||||
|
%%TRACK_URL%%
|
||||||
|
|
||||||
|
|
||||||
|
Regards,
|
||||||
|
|
||||||
|
%%SITE_TITLE%%
|
||||||
|
%%SITE_URL%%
|
||||||
|
|
||||||
|
%%MESSAGE%%
|
@ -39,6 +39,66 @@ $hesklang['attachment_too_large'] = 'This attachment is larger than the max file
|
|||||||
$hesklang['attachment_cancel'] = 'Cancel';
|
$hesklang['attachment_cancel'] = 'Cancel';
|
||||||
$hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?';
|
$hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?';
|
||||||
$hesklang['attachment_remove'] = 'Remove attachment';
|
$hesklang['attachment_remove'] = 'Remove attachment';
|
||||||
|
$hesklang['due_date'] = 'Due Date';
|
||||||
|
$hesklang['category_color'] = 'Color';
|
||||||
|
$hesklang['category_color_help'] = 'The hex code for the color to be used on the view ticket screen and calendar. Leave blank for no color';
|
||||||
|
$hesklang['category_updated'] = 'Changes to <i>%s</i> have been saved';
|
||||||
|
$hesklang['new_event'] = 'New Event';
|
||||||
|
$hesklang['create_event'] = 'Create Event';
|
||||||
|
$hesklang['event_title'] = 'Title';
|
||||||
|
$hesklang['event_title_tooltip'] = 'The title of the event';
|
||||||
|
$hesklang['event_location'] = 'Location';
|
||||||
|
$hesklang['event_location_tooltip'] = 'The location of the event';
|
||||||
|
$hesklang['event_category_tooltip'] = 'Category for the event';
|
||||||
|
$hesklang['event_start'] = 'Start';
|
||||||
|
$hesklang['event_start_tooltip'] = 'The starting date (and time) of the event';
|
||||||
|
$hesklang['event_start_date'] = 'Start Date';
|
||||||
|
$hesklang['event_start_time'] = 'Start Time';
|
||||||
|
$hesklang['event_all_day'] = 'All day';
|
||||||
|
$hesklang['event_end'] = 'End';
|
||||||
|
$hesklang['event_end_tooltip'] = 'The ending date (and time) of the event';
|
||||||
|
$hesklang['event_end_date'] = 'End Date';
|
||||||
|
$hesklang['event_end_time'] = 'End Time';
|
||||||
|
$hesklang['event_reminder'] = 'Reminder';
|
||||||
|
$hesklang['event_reminder_tooltip'] = 'Receive an e-mail reminder for this event. Only you will receive this reminder email.';
|
||||||
|
$hesklang['event_min_before_event'] = 'minutes before event';
|
||||||
|
$hesklang['event_hours_before_event'] = 'hours before event';
|
||||||
|
$hesklang['event_days_before_event'] = 'days before event';
|
||||||
|
$hesklang['event_weeks_before_event'] = 'weeks before event';
|
||||||
|
$hesklang['event_comments'] = 'Comments';
|
||||||
|
$hesklang['event_comments_tooltip'] = 'Additional comments about the event';
|
||||||
|
$hesklang['event_create_ticket'] = 'Create Ticket';
|
||||||
|
$hesklang['to_title_case'] = 'To';
|
||||||
|
$hesklang['clear_for_no_due_date'] = 'Clear for no due date';
|
||||||
|
$hesklang['ticket_due_date_updated'] = 'Ticket due date successfully updated';
|
||||||
|
$hesklang['error_updating_ticket_due_date'] = 'An error occurred when trying to update the ticket due date';
|
||||||
|
$hesklang['error_loading_events'] = 'An error occurred when trying to load events';
|
||||||
|
$hesklang['error_deleting_event'] = 'An error occurred when trying to delete the event';
|
||||||
|
$hesklang['event_deleted'] = 'Event successfully deleted';
|
||||||
|
$hesklang['event_created'] = 'Event successfully created';
|
||||||
|
$hesklang['error_creating_event'] = 'An error occurred when trying to create the event';
|
||||||
|
$hesklang['event_updated'] = 'Event successfully updated';
|
||||||
|
$hesklang['error_updating_event'] = 'An error occurred when trying to update the event';
|
||||||
|
$hesklang['calendar_title_case'] = 'Calendar';
|
||||||
|
$hesklang['calendar_categories'] = 'Categories';
|
||||||
|
$hesklang['can_man_calendar'] = 'Can manage calendar events';
|
||||||
|
$hesklang['calendar_reminder'] = 'Upcoming Event: %%TITLE%%';
|
||||||
|
$hesklang['overdue_ticket'] = '[%%TRACKID%%] Ticket Overdue!';
|
||||||
|
$hesklang['notify_overdue_unassigned'] = 'A ticket is overdue not assigned to me';
|
||||||
|
$hesklang['calendar_settings'] = 'Calendar Settings';
|
||||||
|
$hesklang['enable_calendar'] = 'Enable calendar';
|
||||||
|
$hesklang['enable_calendar_help'] = 'Setting to enable / disable the calendar. The calendar can be shown to everyone, staff only, or disable the calendar entirely.';
|
||||||
|
$hesklang['yes_enable_calendar'] = '<b>YES</b>, enable calendar';
|
||||||
|
$hesklang['yes_enable_calendar_staff_only'] = '<b>YES</b>, enable calendar, but only for staff';
|
||||||
|
$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 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['calendar_day'] = 'Day';
|
||||||
|
$hesklang['calendar_index'] = 'View upcoming events';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
|
// ADDED OR MODIFIED IN Mods for HESK 2.5.2
|
||||||
$hesklang['manage_statuses'] = 'Manage Statuses';
|
$hesklang['manage_statuses'] = 'Manage Statuses';
|
||||||
@ -1617,7 +1677,7 @@ $hesklang['set_pri_to']='Set priority to:'; // Action below the ticket list
|
|||||||
$hesklang['pri_set_to']='Priority has been set to:';
|
$hesklang['pri_set_to']='Priority has been set to:';
|
||||||
$hesklang['cat_pri']='The category priority will be used when customers are not allowed to select priority and a ticket is submitted from the customer interface.';
|
$hesklang['cat_pri']='The category priority will be used when customers are not allowed to select priority and a ticket is submitted from the customer interface.';
|
||||||
$hesklang['cat_pri_info']='Your customers are allowed to select priority, so category priority will be ignored.<br /><br />To use category priority instead, turn OFF the following feature in HESK settings:';
|
$hesklang['cat_pri_info']='Your customers are allowed to select priority, so category priority will be ignored.<br /><br />To use category priority instead, turn OFF the following feature in HESK settings:';
|
||||||
$hesklang['def_pri']='Category priority:';
|
$hesklang['def_pri']='Category priority';
|
||||||
$hesklang['ch_cat_pri']='Set category priority';
|
$hesklang['ch_cat_pri']='Set category priority';
|
||||||
$hesklang['cat_pri_ch']='Category priority has been set to:';
|
$hesklang['cat_pri_ch']='Category priority has been set to:';
|
||||||
$hesklang['err_dbversion']='Too old MySQL version:'; // %s will be replaced with MySQL version
|
$hesklang['err_dbversion']='Too old MySQL version:'; // %s will be replaced with MySQL version
|
||||||
|
Loading…
x
Reference in New Issue
Block a user