Make all AJAX calls relative
This commit is contained in:
parent
13d7b70ac5
commit
4a49c8c510
@ -1506,6 +1506,7 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)
|
|||||||
$replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"';
|
$replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($ticket['email'] !== '') {
|
||||||
$options .= '
|
$options .= '
|
||||||
<button class="btn btn-default" data-action="resend-email-notification" ' . $replyDataAttribute . ' data-ticket-id="' . $ticket['id'] . '">
|
<button class="btn btn-default" data-action="resend-email-notification" ' . $replyDataAttribute . ' data-ticket-id="' . $ticket['id'] . '">
|
||||||
<i class="fa fa-envelope navy-blue"></i> ' . $hesklang['resend_email_notification'] . '
|
<i class="fa fa-envelope navy-blue"></i> ' . $hesklang['resend_email_notification'] . '
|
||||||
@ -1513,6 +1514,7 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)
|
|||||||
<span id="lang_email_notification_sent" style="display: none">' . $hesklang['email_notification_sent'] . '</span>
|
<span id="lang_email_notification_sent" style="display: none">' . $hesklang['email_notification_sent'] . '</span>
|
||||||
<span id="lang_email_notification_resend_failed" style="display: none">' . $hesklang['email_notification_resend_failed'] . '</span>
|
<span id="lang_email_notification_resend_failed" style="display: none">' . $hesklang['email_notification_resend_failed'] . '</span>
|
||||||
';
|
';
|
||||||
|
}
|
||||||
|
|
||||||
/* Edit post */
|
/* Edit post */
|
||||||
if ($can_edit) {
|
if ($can_edit) {
|
||||||
|
@ -93,7 +93,6 @@ if (is_dir(HESK_PATH . 'install')) {
|
|||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core.php?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-colorpicker.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-colorpicker.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/toastr.min.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/toastr.min.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.magnific-popup.min.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.magnific-popup.min.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
||||||
@ -349,3 +348,5 @@ if ($modsForHesk_settings['show_icons']) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
<?php // GLOBAL JAVASCRIPT IDs ?>
|
||||||
|
<p style="display: none" id="hesk-path"><?php echo HESK_PATH; ?></p>
|
||||||
|
@ -67,7 +67,6 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/core-admin.php?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-colorpicker.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-colorpicker.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.slimscroll.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.slimscroll.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/toastr.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/toastr.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
@ -305,7 +304,8 @@ if (defined('MFH_PAGE_LAYOUT') && MFH_PAGE_LAYOUT == 'TOP_ONLY') {
|
|||||||
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js">
|
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js">
|
||||||
|
|
||||||
<?php // GLOBAL JAVASCRIPT IDs ?>
|
<?php // GLOBAL JAVASCRIPT IDs ?>
|
||||||
<p style="display: none" id="heskUrl"><?php echo $hesk_settings['hesk_url']; ?></p>
|
<p style="display: none" id="hesk-path"><?php echo HESK_PATH; ?></p>
|
||||||
|
<p style="display: none" id="admin-dir"><?php echo $hesk_settings['admin_dir']; ?></p>
|
||||||
<p style="display: none" id="lang_alert_success"><?php echo $hesklang['alert_success']; ?></p>
|
<p style="display: none" id="lang_alert_success"><?php echo $hesklang['alert_success']; ?></p>
|
||||||
<p style="display: none" id="lang_alert_error"><?php echo $hesklang['alert_error']; ?></p>
|
<p style="display: none" id="lang_alert_error"><?php echo $hesklang['alert_error']; ?></p>
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
|
|
||||||
var $readonlyDueDateContainer = $('#readonly-due-date');
|
var $readonlyDueDateContainer = $('#readonly-due-date');
|
||||||
var $changeButton = $readonlyDueDateContainer.find('#change-button');
|
var $changeButton = $readonlyDueDateContainer.find('#change-button');
|
||||||
var $editableDueDateContainer = $('#editable-due-date');
|
var $editableDueDateContainer = $('#editable-due-date');
|
||||||
@ -20,7 +22,7 @@ $(document).ready(function() {
|
|||||||
var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val();
|
var newDueDate = $editableDueDateContainer.find('input[type="text"][name="due-date"]').val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: {
|
data: {
|
||||||
trackingId: $('input[type="hidden"][name="track"]').val(),
|
trackingId: $('input[type="hidden"][name="track"]').val(),
|
||||||
action: 'update-ticket',
|
action: 'update-ticket',
|
||||||
@ -48,8 +50,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var ticketId = $this.data('ticket-id');
|
var ticketId = $this.data('ticket-id');
|
||||||
var replyId = $this.data('reply-id');
|
var replyId = $this.data('reply-id');
|
||||||
var heskUrl = $('span#heskUrl').text();
|
var apiUrl = heskPath + 'api/index.php/v1-internal/staff/tickets/' + ticketId + '/resend-email';
|
||||||
var apiUrl = heskUrl + '/api/index.php/v1-internal/staff/tickets/' + ticketId + '/resend-email';
|
|
||||||
|
|
||||||
if (replyId !== undefined) {
|
if (replyId !== undefined) {
|
||||||
apiUrl += '?replyId=' + replyId;
|
apiUrl += '?replyId=' + replyId;
|
||||||
|
@ -8,8 +8,8 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function updatePublicApi(enable) {
|
function updatePublicApi(enable) {
|
||||||
var endpoint = getHelpdeskUrl();
|
var heskPath = $('p#hesk-path').text();
|
||||||
endpoint += '/internal-api/admin/api-settings/';
|
var endpoint = heskPath + 'internal-api/admin/api-settings/';
|
||||||
var data = {
|
var data = {
|
||||||
key: 'public_api',
|
key: 'public_api',
|
||||||
value: enable
|
value: enable
|
||||||
@ -66,8 +66,8 @@ function markFailure(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateToken(userId) {
|
function generateToken(userId) {
|
||||||
var endpoint = getHelpdeskUrl();
|
var heskPath = $('p#hesk-path').text();
|
||||||
endpoint += '/internal-api/admin/api-authentication/';
|
var endpoint = heskPath + 'internal-api/admin/api-authentication/';
|
||||||
markSaving('token-' + userId);
|
markSaving('token-' + userId);
|
||||||
$('#token-' + userId + '-reset').addClass('hide');
|
$('#token-' + userId + '-reset').addClass('hide');
|
||||||
$('#token-' + userId + '-created').addClass('hide');
|
$('#token-' + userId + '-created').addClass('hide');
|
||||||
@ -94,8 +94,8 @@ function generateToken(userId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearTokens(userId) {
|
function clearTokens(userId) {
|
||||||
var endpoint = getHelpdeskUrl();
|
var heskPath = $('p#hesk-path').text();
|
||||||
endpoint += '/internal-api/admin/api-authentication/';
|
var endpoint = heskPath + 'internal-api/admin/api-authentication/';
|
||||||
markSaving('token-' + userId);
|
markSaving('token-' + userId);
|
||||||
$('#token-' + userId + '-reset').addClass('hide');
|
$('#token-' + userId + '-reset').addClass('hide');
|
||||||
$('#token-' + userId + '-created').addClass('hide');
|
$('#token-' + userId + '-created').addClass('hide');
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<?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']."';
|
|
||||||
}
|
|
||||||
";
|
|
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
define('IN_SCRIPT', 1);
|
|
||||||
require_once('../../hesk_settings.inc.php');
|
|
||||||
header('Content-Type: application/javascript');
|
|
||||||
echo "
|
|
||||||
var g_isInAdmin = false;
|
|
||||||
|
|
||||||
function getHelpdeskUrl() {
|
|
||||||
return '".$hesk_settings['hesk_url']."';
|
|
||||||
}
|
|
||||||
";
|
|
@ -20,8 +20,8 @@ function getNullableField(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchLogs(location, fromDate, toDate, severity) {
|
function searchLogs(location, fromDate, toDate, severity) {
|
||||||
var endpoint = getHelpdeskUrl();
|
var heskPath = $('p#hesk-path').text();
|
||||||
endpoint += '/internal-api/admin/message-log/';
|
var endpoint = heskPath + 'internal-api/admin/message-log/';
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: endpoint,
|
url: endpoint,
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
|
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
header: {
|
header: {
|
||||||
left: 'prevYear,prev,next,nextYear today',
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
@ -13,7 +15,7 @@ $(document).ready(function() {
|
|||||||
defaultView: $('#setting_default_view').text().trim(),
|
defaultView: $('#setting_default_view').text().trim(),
|
||||||
events: function(start, end, timezone, callback) {
|
events: function(start, end, timezone, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/?start=' + start + '&end=' + end,
|
url: heskPath + 'internal-api/admin/calendar/?start=' + start + '&end=' + end,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
|
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
header: {
|
header: {
|
||||||
left: 'prevYear,prev,next,nextYear today',
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
@ -13,7 +15,7 @@ $(document).ready(function() {
|
|||||||
defaultView: $('#setting_default_view').text().trim(),
|
defaultView: $('#setting_default_view').text().trim(),
|
||||||
events: function(start, end, timezone, callback) {
|
events: function(start, end, timezone, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: getHelpdeskUrl() + '/internal-api/calendar/?start=' + start + '&end=' + end,
|
url: heskPath + 'internal-api/calendar/?start=' + start + '&end=' + end,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
|
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
header: {
|
header: {
|
||||||
left: 'prevYear,prev,next,nextYear today',
|
left: 'prevYear,prev,next,nextYear today',
|
||||||
@ -13,7 +15,7 @@ $(document).ready(function() {
|
|||||||
defaultView: $('#setting_default_view').text().trim(),
|
defaultView: $('#setting_default_view').text().trim(),
|
||||||
events: function(start, end, timezone, callback) {
|
events: function(start, end, timezone, callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/?start=' + start + '&end=' + end,
|
url: heskPath + 'internal-api/admin/calendar/?start=' + start + '&end=' + end,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
@ -165,7 +167,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: data,
|
data: data,
|
||||||
success: function() {
|
success: function() {
|
||||||
removeFromCalendar(data.id);
|
removeFromCalendar(data.id);
|
||||||
@ -210,7 +212,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: data,
|
data: data,
|
||||||
success: function(id) {
|
success: function(id) {
|
||||||
addToCalendar(id, data, $('#lang_event_created').text());
|
addToCalendar(id, data, $('#lang_event_created').text());
|
||||||
@ -256,7 +258,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: data,
|
data: data,
|
||||||
success: function() {
|
success: function() {
|
||||||
removeFromCalendar(data.id);
|
removeFromCalendar(data.id);
|
||||||
@ -308,7 +310,7 @@ function buildEvent(id, dbObject) {
|
|||||||
if (dbObject.allDay) {
|
if (dbObject.allDay) {
|
||||||
endTime.add(1, 'days');
|
endTime.add(1, 'days');
|
||||||
}
|
}
|
||||||
console.log(dbObject);
|
|
||||||
return {
|
return {
|
||||||
id: id,
|
id: id,
|
||||||
title: dbObject.title,
|
title: dbObject.title,
|
||||||
@ -432,7 +434,9 @@ function displayEditModal(date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var createTicketLink = getHelpdeskUrl() + '/' + getAdminDirectory() + '/new_ticket.php?subject=';
|
var heskPath = $('p#hesk-path').text();
|
||||||
|
var adminDir = $('p#admin-dir').text();
|
||||||
|
var createTicketLink = heskPath + adminDir + '/new_ticket.php?subject=';
|
||||||
createTicketLink += encodeURI('[' + date.start.format('YYYY-MM-DD') + '] ' + date.title);
|
createTicketLink += encodeURI('[' + date.start.format('YYYY-MM-DD') + '] ' + date.title);
|
||||||
if (date.location != '') {
|
if (date.location != '') {
|
||||||
createTicketLink += encodeURI(' @ ' + date.location);
|
createTicketLink += encodeURI(' @ ' + date.location);
|
||||||
@ -467,10 +471,11 @@ function updateCategoryVisibility() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function respondToDragAndDrop(event, delta, revertFunc) {
|
function respondToDragAndDrop(event, delta, revertFunc) {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
if (event.type === 'TICKET') {
|
if (event.type === 'TICKET') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: {
|
data: {
|
||||||
trackingId: event.trackingId,
|
trackingId: event.trackingId,
|
||||||
action: 'update-ticket',
|
action: 'update-ticket',
|
||||||
@ -518,7 +523,7 @@ function respondToDragAndDrop(event, delta, revertFunc) {
|
|||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: getHelpdeskUrl() + '/internal-api/admin/calendar/',
|
url: heskPath + 'internal-api/admin/calendar/',
|
||||||
data: data,
|
data: data,
|
||||||
success: function() {
|
success: function() {
|
||||||
mfhAlert.success(mfhLang.text('event_updated'));
|
mfhAlert.success(mfhLang.text('event_updated'));
|
||||||
|
@ -300,9 +300,10 @@ function outputAttachmentIdHolder(value, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeAttachment(id) {
|
function removeAttachment(id) {
|
||||||
|
var heskPath = $('p#hesk-path').text();
|
||||||
$('input[name="attachment-ids[]"][value="' + id + '"]').remove();
|
$('input[name="attachment-ids[]"][value="' + id + '"]').remove();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: getHelpdeskUrl() + '/internal-api/ticket/delete-attachment.php?id=' + id,
|
url: heskPath + 'internal-api/ticket/delete-attachment.php?id=' + id,
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user