More progress on service messages
This commit is contained in:
parent
c00d5641e4
commit
a8abfcd4a1
@ -57,6 +57,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-right">
|
||||
<button id="create-button" class="btn btn-success">
|
||||
<i class="fa fa-plus-circle"></i>
|
||||
<?php echo $hesklang['create_new']; ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<?php
|
||||
|
||||
@ -96,163 +102,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
<tbody id="table-body">
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4><a name="new_article"></a><?php echo hesk_SESSION('edit_sm') ? $hesklang['edit_sm'] : $hesklang['new_sm']; ?></h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form action="service_messages.php" method="post" name="form1" role="form" class="form-horizontal" data-toggle="validator">
|
||||
<div class="form-group">
|
||||
<label for="style"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_style']; ?></label>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="radio alert pad-5" style="box-shadow: none; border-radius: 4px;">
|
||||
<label>
|
||||
<input type="radio" name="style" value="0" onclick="setIcon('')"
|
||||
<?php if (!isset($_SESSION['new_sm']['style']) || (isset($_SESSION['new_sm']['style']) && $_SESSION['new_sm']['style'] == 0)) {
|
||||
echo 'checked';
|
||||
} ?>>
|
||||
<?php echo $hesklang['sm_none']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio alert alert-success pad-5">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="1"
|
||||
onclick="setIcon('fa fa-check-circle')"
|
||||
<?php if (isset($_SESSION['new_sm']['style']) && $_SESSION['new_sm']['style'] == 1) {
|
||||
echo 'checked';
|
||||
} ?>>
|
||||
<?php echo $hesklang['sm_success']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio alert alert-info pad-5" onclick="setIcon('fa fa-comment')">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="2"
|
||||
<?php if (isset($_SESSION['new_sm']['style']) && $_SESSION['new_sm']['style'] == 2) {
|
||||
echo 'checked';
|
||||
} ?>>
|
||||
<?php echo $hesklang['sm_info']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio alert alert-warning pad-5"
|
||||
onclick="setIcon('fa fa-exclamation-triangle')">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="3"
|
||||
<?php if (isset($_SESSION['new_sm']['style']) && $_SESSION['new_sm']['style'] == 3) {
|
||||
echo 'checked';
|
||||
} ?>>
|
||||
<?php echo $hesklang['sm_notice']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio alert alert-danger pad-5" onclick="setIcon('fa fa-times-circle')">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="4"
|
||||
<?php if (isset($_SESSION['new_sm']['style']) && $_SESSION['new_sm']['style'] == 4) {
|
||||
echo 'checked';
|
||||
} ?> >
|
||||
<?php echo $hesklang['sm_error']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="icon" class="col-md-2 control-label"><?php echo $hesklang['sm_icon']; ?></label>
|
||||
<?php
|
||||
$icon = '';
|
||||
if (isset($_SESSION['new_sm']['icon'])) {
|
||||
$icon = $_SESSION['new_sm']['icon'];
|
||||
}
|
||||
?>
|
||||
<div class="col-md-10">
|
||||
<p style="display:none" id="no-icon"><?php echo $hesklang['sm_no_icon']; ?></p>
|
||||
|
||||
<p style="display:none" id="search-icon"><?php echo $hesklang['sm_search_icon']; ?></p>
|
||||
|
||||
<p style="display:none"
|
||||
id="footer-icon"><?php echo $hesklang['sm_iconpicker_footer_label']; ?></p>
|
||||
|
||||
<div name="icon" class="btn btn-default iconpicker-container" data-toggle="iconpicker"
|
||||
data-icon="<?php echo $icon; ?>"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type" class="col-md-2 control-label"><?php echo $hesklang['sm_type']; ?></label>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="radio pad-5">
|
||||
<label>
|
||||
<input type="radio" name="type" value="0"
|
||||
<?php if (!isset($_SESSION['new_sm']['type']) || (isset($_SESSION['new_sm']['type']) && $_SESSION['new_sm']['type'] == 0)) {
|
||||
echo 'checked';
|
||||
} ?> >
|
||||
<?php echo $hesklang['sm_published']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio pad-5">
|
||||
<label>
|
||||
<input type="radio" name="type" value="1"
|
||||
<?php if (isset($_SESSION['new_sm']['type']) && $_SESSION['new_sm']['type'] == 1) {
|
||||
echo 'checked';
|
||||
} ?> >
|
||||
<?php echo $hesklang['sm_draft']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="title"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_mtitle']; ?></label>
|
||||
|
||||
<div class="col-md-10">
|
||||
<input class="form-control"
|
||||
placeholder="<?php echo htmlspecialchars($hesklang['sm_mtitle']); ?>"
|
||||
type="text" name="title" size="70" maxlength="255"
|
||||
<?php if (isset($_SESSION['new_sm']['title'])) {
|
||||
echo 'value="' . $_SESSION['new_sm']['title'] . '"';
|
||||
} ?> data-error="<?php echo htmlspecialchars($hesklang['sm_e_title']); ?>" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_msg']; ?></label>
|
||||
|
||||
<div class="col-md-10">
|
||||
<textarea placeholder="<?php echo htmlspecialchars($hesklang['sm_msg']); ?>"
|
||||
class="form-control" name="message" rows="25" cols="70" id="content">
|
||||
<?php if (isset($_SESSION['new_sm']['message'])) {
|
||||
echo $_SESSION['new_sm']['message'];
|
||||
} ?>
|
||||
</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<?php echo isset($_SESSION['edit_sm']) ? '<input type="hidden" name="a" value="save_sm" /><input type="hidden" name="id" value="' . intval($_SESSION['new_sm']['id']) . '" />' : '<input type="hidden" name="a" value="new_sm" />'; ?>
|
||||
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
|
||||
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="submit" name="sm_save" value="<?php echo $hesklang['sm_save']; ?>"
|
||||
class="btn btn-primary">
|
||||
<input type="submit" name="sm_preview"
|
||||
value="<?php echo $hesklang['sm_preview']; ?>" class="btn btn-default">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -262,10 +111,156 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div class="modal fade" id="service-message-modal" tabindex="-1" role="dialog" style="overflow: hidden">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<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">
|
||||
<span id="edit-label"><?php echo $hesklang['edit_sm']; ?></span>
|
||||
<span id="create-label"><?php echo $hesklang['new_sm']; ?></span>
|
||||
</h4>
|
||||
</div>
|
||||
<form id="manage-category" class="form-horizontal" data-toggle="validator" method="post">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<label for="style"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_style']; ?></label>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="radio alert pad-5" style="box-shadow: none; border-radius: 4px;">
|
||||
<label>
|
||||
<input type="radio" name="style" value="0" onclick="setIcon('')">
|
||||
<?php echo $hesklang['sm_none']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="radio alert alert-success pad-5">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="1" onclick="setIcon('fa fa-check-circle')">
|
||||
<?php echo $hesklang['sm_success']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="radio alert alert-info pad-5" onclick="setIcon('fa fa-comment')">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="2">
|
||||
<?php echo $hesklang['sm_info']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-md-offset-2">
|
||||
<div class="radio alert alert-warning pad-5">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="3"
|
||||
onclick="setIcon('fa fa-exclamation-triangle')">
|
||||
<?php echo $hesklang['sm_notice']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="radio alert alert-danger pad-5">
|
||||
<label style="margin-top: -5px">
|
||||
<input type="radio" name="style" value="4" onclick="setIcon('fa fa-times-circle')">
|
||||
<?php echo $hesklang['sm_error']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="icon" class="col-md-2 control-label"><?php echo $hesklang['sm_icon']; ?></label>
|
||||
<div class="col-md-10">
|
||||
<p style="display:none" id="no-icon"><?php echo $hesklang['sm_no_icon']; ?></p>
|
||||
|
||||
<p style="display:none" id="search-icon"><?php echo $hesklang['sm_search_icon']; ?></p>
|
||||
|
||||
<p style="display:none"
|
||||
id="footer-icon"><?php echo $hesklang['sm_iconpicker_footer_label']; ?></p>
|
||||
|
||||
<div name="icon" class="btn btn-default iconpicker-container" data-toggle="iconpicker"
|
||||
data-search="false" data-icon=""></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type" class="col-md-2 control-label"><?php echo $hesklang['sm_type']; ?></label>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="radio pad-5">
|
||||
<label>
|
||||
<input type="radio" name="type" value="0">
|
||||
<?php echo $hesklang['sm_published']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="radio pad-5">
|
||||
<label>
|
||||
<input type="radio" name="type" value="1">
|
||||
<?php echo $hesklang['sm_draft']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="title"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_mtitle']; ?></label>
|
||||
<div class="col-md-10">
|
||||
<input class="form-control"
|
||||
placeholder="<?php echo htmlspecialchars($hesklang['sm_mtitle']); ?>"
|
||||
type="text" name="title" size="70" maxlength="255"
|
||||
data-error="<?php echo htmlspecialchars($hesklang['sm_e_title']); ?>" required>
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message"
|
||||
class="col-md-2 control-label"><?php echo $hesklang['sm_msg']; ?></label>
|
||||
|
||||
<div class="col-md-10">
|
||||
<textarea placeholder="<?php echo htmlspecialchars($hesklang['sm_msg']); ?>"
|
||||
class="form-control" name="message" rows="25" cols="70" id="content"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-10 col-md-offset-2">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="submit" name="sm_save" value="<?php echo $hesklang['sm_save']; ?>"
|
||||
class="btn btn-primary">
|
||||
<input type="submit" name="sm_preview"
|
||||
value="<?php echo $hesklang['sm_preview']; ?>" class="btn btn-default">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="hidden" name="id">
|
||||
<input type="hidden" name="cat-order">
|
||||
<div id="action-buttons" class="btn-group">
|
||||
<button type="button" class="btn btn-default cancel-button 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 save-button">
|
||||
<i class="fa fa-check-circle"></i>
|
||||
<span><?php echo $hesklang['save']; ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
echo mfh_get_hidden_fields_for_language(array(
|
||||
'sm_published',
|
||||
'sm_draft',
|
||||
'no_sm',
|
||||
));
|
||||
|
||||
echo '<script>var users = [];';
|
||||
|
@ -6,7 +6,6 @@ use BusinessLogic\Security\UserContext;
|
||||
use BusinessLogic\ServiceMessages\ServiceMessage;
|
||||
use BusinessLogic\ServiceMessages\ServiceMessageHandler;
|
||||
use Controllers\JsonRetriever;
|
||||
use Symfony\Component\EventDispatcher\Tests\Service;
|
||||
|
||||
class ServiceMessagesController extends \BaseClass {
|
||||
function get() {
|
||||
|
@ -3,7 +3,6 @@ var serviceMessages = [];
|
||||
$(document).ready(function() {
|
||||
loadTable();
|
||||
bindEditModal();
|
||||
bindModalCancelCallback();
|
||||
bindFormSubmit();
|
||||
bindDeleteButton();
|
||||
bindCreateModal();
|
||||
@ -24,7 +23,7 @@ function loadTable() {
|
||||
$tableBody.html('');
|
||||
|
||||
if (data.length === 0) {
|
||||
// TODO "No Service Messages Found"
|
||||
$tableBody.append('<tr><td colspan="4">' + mfhLang.text('no_sm') + '</td></tr>');
|
||||
$('#overlay').hide();
|
||||
return;
|
||||
}
|
||||
@ -63,15 +62,10 @@ function loadTable() {
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
mfhAlert.errorWithLog(mfhLang.text('error_retrieving_categories'), data.responseJSON);
|
||||
mfhAlert.errorWithLog(mfhLang.text('error_retrieving_sm'), data.responseJSON);
|
||||
console.error(data);
|
||||
},
|
||||
complete: function() {
|
||||
refreshBackgroundVolatileItems();
|
||||
$('[data-toggle="popover"]').popover({
|
||||
trigger: 'hover',
|
||||
container: 'body'
|
||||
});
|
||||
$('#overlay').hide();
|
||||
}
|
||||
});
|
||||
@ -184,49 +178,19 @@ function bindEditModal() {
|
||||
|
||||
function bindCreateModal() {
|
||||
$('#create-button').click(function() {
|
||||
var $modal = $('#category-modal');
|
||||
$modal.find('#edit-label').hide();
|
||||
$modal.find('#create-label').show();
|
||||
|
||||
$modal.find('input[name="name"]').val('');
|
||||
$modal.find('select[name="priority"]').val(3); // Low priority
|
||||
$modal.find('select[name="usage"]').val(0); // Tickets and events
|
||||
$modal.find('input[name="id"]').val(-1);
|
||||
$modal.find('textarea[name="description"]').val('');
|
||||
$modal.find('input[name="cat-order"]').val('');
|
||||
$modal.find('input[name="type"][value="0"]').prop('checked', 'checked');
|
||||
$modal.find('input[name="autoassign"][value="0"]').prop('checked', 'checked');
|
||||
$modal.find('input[name="display-border"][value="0"]')
|
||||
.prop('checked', 'checked');
|
||||
|
||||
var colorpickerOptions = {
|
||||
format: 'hex',
|
||||
color: '#fff'
|
||||
};
|
||||
$modal.find('input[name="background-color"]')
|
||||
.colorpicker(colorpickerOptions).end().modal('show');
|
||||
$modal.find('input[name="background-color"]').val('');
|
||||
$modal.find('input[name="foreground-color"]')
|
||||
.colorpicker(colorpickerOptions).end().modal('show');
|
||||
$modal.find('input[name="foreground-color"]').val('');
|
||||
var $modal = $('#service-message-modal');
|
||||
$modal.find('#edit-label').hide().end()
|
||||
.find('#create-label').show().end()
|
||||
.find('input[name="style"][value="0"]').prop('checked', 'checked').end() // "None" style
|
||||
.find('input[name="type"][value="0"]').prop('checked', 'checked').end() // Published
|
||||
.find('input[name="title"]').val('').end();
|
||||
setIcon('');
|
||||
tinyMCE.get('content').setContent('');
|
||||
|
||||
$modal.modal('show');
|
||||
});
|
||||
}
|
||||
|
||||
function bindModalCancelCallback() {
|
||||
$('.cancel-callback').click(function() {
|
||||
var $editCategoryModal = $('#category-modal');
|
||||
|
||||
$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
|
||||
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
|
||||
$editCategoryModal.find('input[name="display-border"][value="1"]').prop('checked');
|
||||
$editCategoryModal.find('input[name="display-border"][value="0"]').prop('checked');
|
||||
$editCategoryModal.find('input[name="autoassign"][value="1"]').prop('checked');
|
||||
$editCategoryModal.find('input[name="autoassign"][value="0"]').prop('checked');
|
||||
});
|
||||
}
|
||||
|
||||
function bindFormSubmit() {
|
||||
$('form#manage-category').submit(function(e) {
|
||||
e.preventDefault();
|
||||
|
@ -2215,5 +2215,8 @@ $hesklang['audit_due_date_changed'] = '%s changed due date to %s';
|
||||
$hesklang['audit_linked_ticket'] = '%s linked ticket %s to this ticket';
|
||||
$hesklang['audit_unlinked_ticket'] = '%s unlinked ticket %s';
|
||||
|
||||
// Added or modified in Mods for HESK 3.3.0
|
||||
$hesklang['error_retrieving_sm'] = 'An error occurred retrieving service messages!';
|
||||
|
||||
// DO NOT CHANGE BELOW
|
||||
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user