Add toastr, fix several things regarding custom nav elements
This commit is contained in:
parent
ab5840babe
commit
99c229fae7
@ -30,7 +30,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header with-border">
|
<div class="box-header with-border">
|
||||||
<h1 class="box-title">
|
<h1 class="box-title">
|
||||||
Custom Nav Menu Elements[!]
|
<?php echo $hesklang['custom_nav_menu_elements']; ?>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="box-tools pull-right">
|
<div class="box-tools pull-right">
|
||||||
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
<button type="button" class="btn btn-box-tool" data-widget="collapse">
|
||||||
@ -41,18 +41,21 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<button id="create-button" class="btn btn-success">Create New Element [!]</button>
|
<button id="create-button" class="btn btn-success">
|
||||||
|
<i class="fa fa-plus-circle"></i>
|
||||||
|
<?php echo $hesklang['create_new']; ?>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th><?php echo $hesklang['id']; ?></th>
|
||||||
<th>Text</th>
|
<th><?php echo $hesklang['custom_nav_text']; ?></th>
|
||||||
<th>Subtext</th>
|
<th><?php echo $hesklang['custom_nav_subtext']; ?></th>
|
||||||
<th>Image URL / Font Icon</th>
|
<th><?php echo $hesklang['image_url_slash_font_icon']; ?></th>
|
||||||
<th>URL</th>
|
<th><?php echo $hesklang['url']; ?></th>
|
||||||
<th>Actions</th>
|
<th><?php echo $hesklang['actions']; ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="table-body">
|
<tbody id="table-body">
|
||||||
@ -72,8 +75,11 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="cursor: move">
|
<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>
|
<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">
|
<h4 class="modal-title" id="edit-label">
|
||||||
<?php echo 'Edit Custom Nav Element[!]'; ?>
|
<?php echo $hesklang['edit_custom_nav_element_title_case']; ?>
|
||||||
|
</h4>
|
||||||
|
<h4 class="modal-title" id="create-label">
|
||||||
|
<?php echo $hesklang['create_custom_nav_element_title_case']; ?>
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<form id="manage-nav-element" class="form-horizontal" data-toggle="validator">
|
<form id="manage-nav-element" class="form-horizontal" data-toggle="validator">
|
||||||
@ -82,14 +88,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="place" class="col-md-4 col-sm-12 control-label">Place[!]</label>
|
<label for="place" class="col-md-4 col-sm-12 control-label"><?php echo $hesklang['place']; ?></label>
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<select name="place" id="place" class="form-control"
|
<select name="place" id="place" class="form-control"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
required>
|
required>
|
||||||
<option value="1">Homepage - Block</option>
|
<option value="1"><?php echo $hesklang['homepage_block']; ?></option>
|
||||||
<option value="2">Customer Navbar</option>
|
<option value="2"><?php echo $hesklang['customer_navigation']; ?></option>
|
||||||
<option value="3">Staff Navbar</option>
|
<option value="3"><?php echo $hesklang['staff_navigation']; ?></option>
|
||||||
</select>
|
</select>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -98,7 +104,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-sm-12">
|
<div class="col-md-6 col-sm-12">
|
||||||
<h4>Text[!]</h4>
|
<h4><?php echo $hesklang['custom_nav_text']; ?></h4>
|
||||||
<?php foreach ($hesk_settings['languages'] as $language => $value): ?>
|
<?php foreach ($hesk_settings['languages'] as $language => $value): ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="text[<?php echo $language; ?>]" class="col-md-4 col-sm-12 control-label">
|
<label for="text[<?php echo $language; ?>]" class="col-md-4 col-sm-12 control-label">
|
||||||
@ -107,7 +113,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<input type="text" name="text" class="form-control"
|
<input type="text" name="text" class="form-control"
|
||||||
data-text-language="<?php echo $language; ?>"
|
data-text-language="<?php echo $language; ?>"
|
||||||
id="text[<?php echo $language; ?>" placeholder="<?php echo $language; ?>"
|
id="text[<?php echo $language; ?>" placeholder="<?php echo $hesklang['custom_nav_text']; ?>"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
required>
|
required>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
@ -115,7 +121,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<div id="subtext">
|
<div id="subtext">
|
||||||
<h4>Subtext[!]</h4>
|
<h4><?php echo $hesklang['custom_nav_subtext']; ?></h4>
|
||||||
<?php foreach ($hesk_settings['languages'] as $language => $value): ?>
|
<?php foreach ($hesk_settings['languages'] as $language => $value): ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="subtext[<?php echo $language; ?>]" class="col-md-4 col-sm-12 control-label">
|
<label for="subtext[<?php echo $language; ?>]" class="col-md-4 col-sm-12 control-label">
|
||||||
@ -124,7 +130,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<input type="text" name="subtext" class="form-control"
|
<input type="text" name="subtext" class="form-control"
|
||||||
data-subtext-language="<?php echo $language; ?>"
|
data-subtext-language="<?php echo $language; ?>"
|
||||||
id="subtext[<?php echo $language; ?>" placeholder="<?php echo $language; ?>"
|
id="subtext[<?php echo $language; ?>" placeholder="<?php echo $hesklang['custom_nav_subtext']; ?>"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
required>
|
required>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
@ -134,35 +140,35 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-sm-12">
|
<div class="col-md-6 col-sm-12">
|
||||||
<h4>URL[!]</h4>
|
<h4><?php echo $hesklang['url']; ?></h4>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="image-type" class="col-md-4 col-sm-12 control-label">URL[!]</label>
|
<label for="image-type" class="col-md-4 col-sm-12 control-label"><?php echo $hesklang['url']; ?></label>
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<input type="text" name="url" class="form-control"
|
<input type="text" name="url" class="form-control"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
placeholder="<?php echo 'URL'; ?>" required>
|
placeholder="<?php echo $hesklang['url']; ?>" required>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4>Image[!]</h4>
|
<h4><?php echo $hesklang['image']; ?></h4>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="image-type" class="col-md-4 col-sm-12 control-label">Image Type[!]</label>
|
<label for="image-type" class="col-md-4 col-sm-12 control-label"><?php echo $hesklang['image_type']; ?></label>
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<select name="image-type" id="image-type" class="form-control"
|
<select name="image-type" id="image-type" class="form-control"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
required>
|
required>
|
||||||
<option value="image-url">Image URL</option>
|
<option value="image-url"><?php echo $hesklang['image_url']; ?></option>
|
||||||
<option value="font-icon">Font Icon</option>
|
<option value="font-icon"><?php echo $hesklang['font_icon']; ?></option>
|
||||||
</select>
|
</select>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" id="image-url-group">
|
<div class="form-group" id="image-url-group">
|
||||||
<label for="image-url" class="col-md-4 col-sm-12 control-label">Image URL [!]</label>
|
<label for="image-url" class="col-md-4 col-sm-12 control-label"><?php echo $hesklang['image_url']; ?></label>
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<input type="text" name="image-url" class="form-control"
|
<input type="text" name="image-url" class="form-control"
|
||||||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
placeholder="Image URL[!]" required>
|
placeholder="<?php echo $hesklang['image_url']; ?>" required>
|
||||||
<div class="help-block with-errors"></div>
|
<div class="help-block with-errors"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -173,7 +179,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
|
|
||||||
<p style="display:none"
|
<p style="display:none"
|
||||||
id="footer-icon"><?php echo $hesklang['sm_iconpicker_footer_label']; ?></p>
|
id="footer-icon"><?php echo $hesklang['sm_iconpicker_footer_label']; ?></p>
|
||||||
<label for="font-icon" class="col-md-4 col-sm-12 control-label">Font Icon [!]</label>
|
<label for="font-icon" class="col-md-4 col-sm-12 control-label"><?php echo $hesklang['font_icon']; ?></label>
|
||||||
<div class="col-md-8 col-sm-12">
|
<div class="col-md-8 col-sm-12">
|
||||||
<div class="btn btn-default iconpicker-container" data-toggle="nav-iconpicker">
|
<div class="btn btn-default iconpicker-container" data-toggle="nav-iconpicker">
|
||||||
</div>
|
</div>
|
||||||
@ -183,7 +189,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="btn-group">
|
<div class="btn-group" id="action-buttons">
|
||||||
<button type="button" class="btn btn-default cancel-button" data-dismiss="modal">
|
<button type="button" class="btn btn-default cancel-button" data-dismiss="modal">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
<span><?php echo $hesklang['cancel']; ?></span>
|
<span><?php echo $hesklang['cancel']; ?></span>
|
||||||
@ -198,9 +204,24 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p style="display: none" id="lang_edit"><?php echo $hesklang['edit']; ?></p>
|
<?php
|
||||||
<p style="display: none" id="lang_delete"><?php echo $hesklang['delete']; ?></p>
|
echo mfh_get_hidden_fields_for_language(
|
||||||
<p style="display: none" id="lang_no_custom_nav_elements_found"><?php echo $hesklang['no_custom_nav_elements_found']; ?></p>
|
array(
|
||||||
|
'edit',
|
||||||
|
'delete',
|
||||||
|
'no_custom_nav_elements_found',
|
||||||
|
'failed_to_load_custom_nav_elements',
|
||||||
|
'custom_nav_element_deleted',
|
||||||
|
'error_deleting_custom_nav_element',
|
||||||
|
'error_sorting_custom_nav_elements',
|
||||||
|
'custom_nav_element_created',
|
||||||
|
'custom_nav_element_saved',
|
||||||
|
'homepage_block',
|
||||||
|
'customer_navigation',
|
||||||
|
'staff_navigation',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
?>
|
||||||
<script type="text/html" id="nav-element-template">
|
<script type="text/html" id="nav-element-template">
|
||||||
<tr>
|
<tr>
|
||||||
<td><span data-property="id" data-value="x"></span></td>
|
<td><span data-property="id" data-value="x"></span></td>
|
||||||
@ -213,10 +234,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<td><span data-property="image-or-font"></span></td>
|
<td><span data-property="image-or-font"></span></td>
|
||||||
<td><span data-property="url"></span></td>
|
<td><span data-property="url"></span></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" data-action="edit">
|
|
||||||
<i class="fa fa-fw fa-pencil icon-link orange"
|
|
||||||
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" data-action="sort"
|
<a href="#" data-action="sort"
|
||||||
data-direction="up">
|
data-direction="up">
|
||||||
<i class="fa fa-fw fa-arrow-up icon-link green"
|
<i class="fa fa-fw fa-arrow-up icon-link green"
|
||||||
@ -227,6 +244,10 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<i class="fa fa-fw fa-arrow-down icon-link green"
|
<i class="fa fa-fw fa-arrow-down icon-link green"
|
||||||
data-toggle="tooltip" title="<?php echo $hesklang['move_dn'] ?>"></i>
|
data-toggle="tooltip" title="<?php echo $hesklang['move_dn'] ?>"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#" data-action="edit">
|
||||||
|
<i class="fa fa-fw fa-pencil icon-link orange"
|
||||||
|
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
||||||
|
</a>
|
||||||
<a href="#" data-action="delete">
|
<a href="#" data-action="delete">
|
||||||
<i class="fa fa-fw fa-times icon-link red"
|
<i class="fa fa-fw fa-times icon-link red"
|
||||||
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i>
|
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Controllers\Navigation;
|
namespace Controllers\Navigation;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Exceptions\ApiFriendlyException;
|
||||||
use BusinessLogic\Helpers;
|
use BusinessLogic\Helpers;
|
||||||
use BusinessLogic\Navigation\CustomNavElement;
|
use BusinessLogic\Navigation\CustomNavElement;
|
||||||
use BusinessLogic\Navigation\CustomNavElementHandler;
|
use BusinessLogic\Navigation\CustomNavElementHandler;
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function print_error($title, $message, $response_code = 500) {
|
function print_error($title, $message, $logId = null, $response_code = 500) {
|
||||||
require_once(__DIR__ . '/output.php');
|
require_once(__DIR__ . '/output.php');
|
||||||
|
|
||||||
$error = array();
|
$error = array();
|
||||||
$error['type'] = 'ERROR';
|
$error['type'] = 'ERROR';
|
||||||
$error['title'] = $title;
|
$error['title'] = $title;
|
||||||
$error['message'] = $message;
|
$error['message'] = $message;
|
||||||
|
$error['logId'] = $logId;
|
||||||
|
|
||||||
print output($error, $response_code);
|
print output($error, $response_code);
|
||||||
return;
|
return;
|
||||||
|
@ -98,14 +98,14 @@ function exceptionHandler($exception) {
|
|||||||
$userContext, $hesk_settings);
|
$userContext, $hesk_settings);
|
||||||
|
|
||||||
$logIdText = $logId === null ? "Additionally, the error could not be logged! :'(" : "Log ID: {$logId}";
|
$logIdText = $logId === null ? "Additionally, the error could not be logged! :'(" : "Log ID: {$logId}";
|
||||||
print_error("SQL Exception", "Fought an uncaught SQL exception. Check the logs for more information. {$logIdText}");
|
print_error("SQL Exception", "Fought an uncaught SQL exception. Check the logs for more information. {$logIdText}", $logId);
|
||||||
} else {
|
} else {
|
||||||
$logId = tryToLog(getLoggingLocation($exception),
|
$logId = tryToLog(getLoggingLocation($exception),
|
||||||
$exception->getMessage(), $exception->getTraceAsString(),
|
$exception->getMessage(), $exception->getTraceAsString(),
|
||||||
$userContext, $hesk_settings);
|
$userContext, $hesk_settings);
|
||||||
|
|
||||||
$logIdText = $logId === null ? "Additionally, the error could not be logged! :'(" : "Log ID: {$logId}";
|
$logIdText = $logId === null ? "Additionally, the error could not be logged! :'(" : "Log ID: {$logId}";
|
||||||
print_error("Exception Occurred", "Fought an uncaught exception. Check the logs for more information. {$logIdText}");
|
print_error("Exception Occurred", "Fought an uncaught exception. Check the logs for more information. {$logIdText}", $logId);
|
||||||
}
|
}
|
||||||
|
|
||||||
die();
|
die();
|
||||||
|
@ -290,4 +290,8 @@ div.ticket-info {
|
|||||||
|
|
||||||
.black {
|
.black {
|
||||||
color: black;
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#toast-container > div {
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
1
css/toastr.min.css
vendored
Normal file
1
css/toastr.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -2142,4 +2142,16 @@ function mfh_get_stars($rating) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $markup;
|
return $markup;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mfh_get_hidden_fields_for_language($keys) {
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
$output = '<div class="hide">';
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$output .= sprintf('<p id="lang_%s">%s</p>', $key, $hesklang[$key]);
|
||||||
|
}
|
||||||
|
$output .= '</div>';
|
||||||
|
|
||||||
|
return $output;
|
||||||
}
|
}
|
@ -60,11 +60,12 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-colorpicker.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/bootstrap-colorpicker.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/AdminLTE.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/AdminLTE.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/skins/_all-skins.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/skins/_all-skins.min.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/jquery.fancybox.min.css?v=<?php echo MODS_FOR_HESK_BUILD ?>">
|
||||||
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/toastr.min.css?v=<?php echo MODS_FOR_HESK_BUILD ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/mods-for-hesk-new.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/mods-for-hesk-new.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/colors.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/colors.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/positions.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/positions.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/displays.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/displays.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>">
|
||||||
<link rel="stylesheet" href="<?php echo HESK_PATH; ?>css/jquery.fancybox.min.css?v=<? echo MODS_FOR_HESK_BUILD ?>">
|
|
||||||
<?php if (defined('USE_JQUERY_2')): ?>
|
<?php if (defined('USE_JQUERY_2')): ?>
|
||||||
<script src="<?php echo HESK_PATH; ?>js/jquery-2.2.4.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script src="<?php echo HESK_PATH; ?>js/jquery-2.2.4.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
@ -89,6 +90,9 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.jgrowl.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.jgrowl.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/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; ?>internal-api/js/alerts.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>internal-api/js/lang.js?v=<?php echo MODS_FOR_HESK_BUILD ?>"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.fancybox.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/jquery.fancybox.min.js?v=<?php echo MODS_FOR_HESK_BUILD; ?>"></script>
|
||||||
<?php
|
<?php
|
||||||
if (defined('EXTRA_JS')) {
|
if (defined('EXTRA_JS')) {
|
||||||
@ -249,7 +253,11 @@ if (defined('MFH_PAGE_LAYOUT') && MFH_PAGE_LAYOUT == 'TOP_ONLY') {
|
|||||||
?>
|
?>
|
||||||
<body onload="<?php echo $onload;
|
<body onload="<?php echo $onload;
|
||||||
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js <?php echo $modsForHesk_settings['admin_color_scheme']; ?>">
|
unset($onload); ?>" class="<?php echo $layout_tag ?> fixed js <?php echo $modsForHesk_settings['admin_color_scheme']; ?>">
|
||||||
<span style="display: none" id="heskUrl"><?php echo $hesk_settings['hesk_url']; ?></span>
|
|
||||||
|
<?php // GLOBAL JAVASCRIPT IDs ?>
|
||||||
|
<p style="display: none" id="heskUrl"><?php echo $hesk_settings['hesk_url']; ?></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>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include(HESK_PATH . 'header.txt');
|
include(HESK_PATH . 'header.txt');
|
||||||
|
31
internal-api/js/alerts.js
Normal file
31
internal-api/js/alerts.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
var mfhAlert = {
|
||||||
|
success: success,
|
||||||
|
error: error,
|
||||||
|
errorWithLog: errorWithLog
|
||||||
|
};
|
||||||
|
|
||||||
|
function success(message, title) {
|
||||||
|
if (title === undefined) {
|
||||||
|
title = $('#lang_alert_success').text();
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.success(message, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
function error(message, title) {
|
||||||
|
if (title === undefined) {
|
||||||
|
title = $('#lang_alert_error').text();
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.error(message, title);
|
||||||
|
}
|
||||||
|
|
||||||
|
function errorWithLog(message, responseJSON, title) {
|
||||||
|
var displayMessage = message;
|
||||||
|
if (responseJSON !== undefined &&
|
||||||
|
responseJSON.logId !== undefined) {
|
||||||
|
displayMessage += ' (' + responseJSON.logId + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
mfhAlert.error(displayMessage, title);
|
||||||
|
}
|
5
internal-api/js/lang.js
Normal file
5
internal-api/js/lang.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
var mfhLang = {
|
||||||
|
text: function(key) {
|
||||||
|
return $('#lang_' + key).text();
|
||||||
|
}
|
||||||
|
};
|
@ -89,35 +89,51 @@ $(document).ready(function() {
|
|||||||
method = 'PUT';
|
method = 'PUT';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$modal.find('#action-buttons').find('.cancel-button').attr('disabled', 'disabled');
|
||||||
|
$modal.find('#action-buttons').find('.save-button').attr('disabled', 'disabled');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: method,
|
method: method,
|
||||||
url: url,
|
url: url,
|
||||||
headers: { 'X-Internal-Call': true },
|
headers: { 'X-Internal-Call': true },
|
||||||
data: JSON.stringify(data),
|
data: JSON.stringify(data),
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
loadTable($modal);
|
if (id === -1) {
|
||||||
|
mfhAlert.success(mfhLang.text('custom_nav_element_created'));
|
||||||
|
} else {
|
||||||
|
mfhAlert.success(mfhLang.text('custom_nav_element_saved'));
|
||||||
|
}
|
||||||
|
$modal.modal('hide');
|
||||||
|
loadTable();
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
mfhAlert.error("[!]Error saving custom nav element (" + data.responseJSON.logId + ")");
|
||||||
console.error(data);
|
console.error(data);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
$modal.find('#action-buttons').find('.cancel-button').removeAttr('disabled');
|
||||||
|
$modal.find('#action-buttons').find('.save-button').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadTable(modalToClose) {
|
function loadTable() {
|
||||||
|
$('#overlay').show();
|
||||||
var heskUrl = $('#heskUrl').text();
|
var heskUrl = $('#heskUrl').text();
|
||||||
var notFoundText = $('#lang_no_custom_nav_elements_found').text();
|
var notFoundText = mfhLang.text('no_custom_nav_elements_found');
|
||||||
var places = [];
|
var places = [];
|
||||||
places[1] = 'Homepage - Block';
|
var $tableBody = $('#table-body');
|
||||||
places[2] = 'Customer Navbar';
|
places[1] = mfhLang.text('homepage_block');
|
||||||
places[3] = 'Staff Navbar';
|
places[2] = mfhLang.text('customer_navigation');
|
||||||
|
places[3] = mfhLang.text('staff_navigation');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: heskUrl + '/api/v1-internal/custom-navigation/all',
|
url: heskUrl + '/api/v1-internal/custom-navigation/all',
|
||||||
headers: { 'X-Internal-Call': true },
|
headers: { 'X-Internal-Call': true },
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$('#table-body').html('');
|
$tableBody.html('');
|
||||||
elements = [];
|
elements = [];
|
||||||
|
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
@ -125,17 +141,12 @@ function loadTable(modalToClose) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#table-body').append('<tr><td colspan="6" class="bg-gray"><i><b>' + places[1] + '</b></i></td></tr>');
|
var currentPlace = 0;
|
||||||
var currentPlace = 1;
|
|
||||||
var addedElementToPlace = false;
|
var addedElementToPlace = false;
|
||||||
var first = true;
|
var first = true;
|
||||||
var lastElement = null;
|
var lastElement = null;
|
||||||
$.each(data, function() {
|
$.each(data, function() {
|
||||||
if (this.place !== currentPlace) {
|
if (this.place !== currentPlace) {
|
||||||
if (!addedElementToPlace) {
|
|
||||||
$('#table-body').append('<tr><td colspan="6">' + notFoundText + '</td></tr>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastElement !== null) {
|
if (lastElement !== null) {
|
||||||
//-- Hide the down arrow on the last element
|
//-- Hide the down arrow on the last element
|
||||||
$('[data-value="' + lastElement.id + '"]').parent().parent()
|
$('[data-value="' + lastElement.id + '"]').parent().parent()
|
||||||
@ -145,7 +156,6 @@ function loadTable(modalToClose) {
|
|||||||
|
|
||||||
$('#table-body').append('<tr><td colspan="6" class="bg-gray"><i><b>' + places[this.place] + '</b></i></td></tr>');
|
$('#table-body').append('<tr><td colspan="6" class="bg-gray"><i><b>' + places[this.place] + '</b></i></td></tr>');
|
||||||
currentPlace = this.place;
|
currentPlace = this.place;
|
||||||
console.log(this);
|
|
||||||
addedElementToPlace = false;
|
addedElementToPlace = false;
|
||||||
first = true;
|
first = true;
|
||||||
}
|
}
|
||||||
@ -181,7 +191,7 @@ function loadTable(modalToClose) {
|
|||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#table-body').append($template);
|
$tableBody.append($template);
|
||||||
|
|
||||||
elements[this.id] = this;
|
elements[this.id] = this;
|
||||||
|
|
||||||
@ -189,27 +199,14 @@ function loadTable(modalToClose) {
|
|||||||
lastElement = this;
|
lastElement = this;
|
||||||
});
|
});
|
||||||
|
|
||||||
//-- Add missing headers if no elements are in them
|
|
||||||
if (currentPlace === 1) {
|
|
||||||
$('#table-body').append('<tr><td colspan="6" class="bg-gray"><i><b>' + places[2] + '</b></i></td></tr>');
|
|
||||||
$('#table-body').append('<tr><td colspan="6">' + notFoundText + '</td></tr>');
|
|
||||||
}
|
|
||||||
if (currentPlace === 1 || currentPlace === 2) {
|
|
||||||
$('#table-body').append('<tr><td colspan="6" class="bg-gray"><i><b>' + places[3] + '</b></i></td></tr>');
|
|
||||||
$('#table-body').append('<tr><td colspan="6">' + notFoundText + '</td></tr>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastElement) {
|
if (lastElement) {
|
||||||
//-- Hide the down arrow on the last element
|
//-- Hide the down arrow on the last element
|
||||||
$('[data-value="' + lastElement.id + '"]').parent().parent()
|
$('[data-value="' + lastElement.id + '"]').parent().parent()
|
||||||
.find('[data-direction="down"]').css('visibility', 'hidden');
|
.find('[data-direction="down"]').css('visibility', 'hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modalToClose !== undefined) {
|
|
||||||
modalToClose.modal('hide');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
mfhAlert.errorWithLog(mfhLang.text('failed_to_load_custom_nav_elements'), data.responseJSON);
|
||||||
console.error(data);
|
console.error(data);
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
@ -229,6 +226,8 @@ function bindEditModal() {
|
|||||||
var element = elements[$(this).parent().parent().find('[data-property="id"]').text()];
|
var element = elements[$(this).parent().parent().find('[data-property="id"]').text()];
|
||||||
var $modal = $('#nav-element-modal');
|
var $modal = $('#nav-element-modal');
|
||||||
|
|
||||||
|
$modal.find('#edit-label').show();
|
||||||
|
$modal.find('#crate-label').hide();
|
||||||
$modal.find('select[name="place"]').val(element.place);
|
$modal.find('select[name="place"]').val(element.place);
|
||||||
$modal.find('input[name="id"]').val(element.id);
|
$modal.find('input[name="id"]').val(element.id);
|
||||||
$modal.find('input[name="url"]').val(element.url);
|
$modal.find('input[name="url"]').val(element.url);
|
||||||
@ -272,6 +271,8 @@ function bindEditModal() {
|
|||||||
function bindCreateModal() {
|
function bindCreateModal() {
|
||||||
$('#create-button').click(function() {
|
$('#create-button').click(function() {
|
||||||
var $modal = $('#nav-element-modal');
|
var $modal = $('#nav-element-modal');
|
||||||
|
$modal.find('#edit-label').hide();
|
||||||
|
$modal.find('#crate-label').show();
|
||||||
$modal.find('select[name="place"]').val(1);
|
$modal.find('select[name="place"]').val(1);
|
||||||
$modal.find('input[name="id"]').val(-1);
|
$modal.find('input[name="id"]').val(-1);
|
||||||
var $textLanguages = $modal.find('[data-text-language]');
|
var $textLanguages = $modal.find('[data-text-language]');
|
||||||
@ -312,10 +313,12 @@ function bindDeleteButton() {
|
|||||||
url: heskUrl + '/api/v1-internal/custom-navigation/' + element.id,
|
url: heskUrl + '/api/v1-internal/custom-navigation/' + element.id,
|
||||||
headers: { 'X-Internal-Call': true },
|
headers: { 'X-Internal-Call': true },
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log('DELETED!');
|
mfhAlert.success(mfhLang.text('custom_nav_element_deleted'));
|
||||||
loadTable();
|
loadTable();
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
$('#overlay').hide();
|
||||||
|
mfhAlert.errorWithLog(mfhLang.text('error_deleting_custom_nav_element'), data.responseJSON);
|
||||||
console.error(data);
|
console.error(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -334,10 +337,10 @@ function bindSortButtons() {
|
|||||||
url: heskUrl + '/api/v1-internal/custom-navigation/' + element.id + '/sort/' + direction,
|
url: heskUrl + '/api/v1-internal/custom-navigation/' + element.id + '/sort/' + direction,
|
||||||
headers: { 'X-Internal-Call': true },
|
headers: { 'X-Internal-Call': true },
|
||||||
success: function() {
|
success: function() {
|
||||||
console.log('Resorted');
|
|
||||||
loadTable();
|
loadTable();
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
mfhAlert.errorWithLog(mfhLang.text('error_sorting_custom_nav_elements'), data.responseJSON);
|
||||||
console.error(data);
|
console.error(data);
|
||||||
$('#overlay').hide();
|
$('#overlay').hide();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,11 @@ var loadJquery = function()
|
|||||||
$('[data-hide]').click(function() {
|
$('[data-hide]').click(function() {
|
||||||
var hide = $(this).attr('data-hide');
|
var hide = $(this).attr('data-hide');
|
||||||
$('#' + hide).hide();
|
$('#' + hide).hide();
|
||||||
})
|
});
|
||||||
|
|
||||||
|
//-- Initialize toastr properties
|
||||||
|
toastr.options.progressBar = true;
|
||||||
|
toastr.options.closeButton = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function refreshBackgroundVolatileItems() {
|
function refreshBackgroundVolatileItems() {
|
||||||
|
2
js/toastr.min.js
vendored
Normal file
2
js/toastr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -52,8 +52,30 @@ $hesklang['resend_email_notification'] = 'Re-send Email Notification';
|
|||||||
$hesklang['email_notification_sent'] = 'Email notification sent!';
|
$hesklang['email_notification_sent'] = 'Email notification sent!';
|
||||||
$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
|
$hesklang['email_notification_resend_failed'] = 'Error occurred when trying to send notification email.';
|
||||||
$hesklang['edit_category'] = 'Edit Category';
|
$hesklang['edit_category'] = 'Edit Category';
|
||||||
|
$hesklang['custom_nav_menu_elements'] = 'Custom Nav Menu Elements';
|
||||||
|
$hesklang['create_new'] = 'Create New';
|
||||||
$hesklang['custom_nav_element_deleted'] = 'Custom Navigation Element Deleted!';
|
$hesklang['custom_nav_element_deleted'] = 'Custom Navigation Element Deleted!';
|
||||||
$hesklang['no_custom_nav_elements_found'] = 'No custom nav menu elements found';
|
$hesklang['no_custom_nav_elements_found'] = 'No custom nav menu elements found';
|
||||||
|
$hesklang['alert_success'] = 'Success'; // Used for alert messages
|
||||||
|
$hesklang['alert_error'] = 'Error'; // Used for alert messages
|
||||||
|
$hesklang['failed_to_load_custom_nav_elements'] = 'Failed to load custom nav elements!';
|
||||||
|
$hesklang['custom_nav_element_deleted'] = 'Custom nav element deleted!';
|
||||||
|
$hesklang['error_deleting_custom_nav_element'] = 'Error deleting custom nav element!';
|
||||||
|
$hesklang['error_sorting_custom_nav_elements'] = 'Error sorting custom nav elements!';
|
||||||
|
$hesklang['custom_nav_element_created'] = 'Custom nav element created!';
|
||||||
|
$hesklang['custom_nav_element_saved'] = 'Custom nav element saved!';
|
||||||
|
$hesklang['homepage_block'] = 'Homepage - Block';
|
||||||
|
$hesklang['customer_navigation'] = 'Customer Navigation';
|
||||||
|
$hesklang['staff_navigation'] = 'Staff Navigation';
|
||||||
|
$hesklang['custom_nav_text'] = 'Text';
|
||||||
|
$hesklang['custom_nav_subtext'] = 'Subtext';
|
||||||
|
$hesklang['image_url_slash_font_icon'] = 'Image URL / Font Icon';
|
||||||
|
$hesklang['edit_custom_nav_element_title_case'] = 'Edit Custom Nav Element';
|
||||||
|
$hesklang['create_custom_nav_element_title_case'] = 'Create Custom Nav Element';
|
||||||
|
$hesklang['place'] = 'Place';
|
||||||
|
$hesklang['image_type'] = 'Image Type';
|
||||||
|
$hesklang['image_url'] = 'Image URL';
|
||||||
|
$hesklang['font_icon'] = 'Font Icon';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
|
// ADDED OR MODIFIED IN Mods for HESK 3.0.0
|
||||||
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #
|
$hesklang['you_have_x_messages'] = 'You have %s new %s'; // %s: Number of new messages, "message" or "messages", depending on #
|
||||||
|
Loading…
x
Reference in New Issue
Block a user