Store the selected icon into the DB

merge-requests/2/head
Mike Koch 9 years ago
parent 6898a5a9be
commit f4c6588e41

@ -293,7 +293,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<div class="col-md-2">
<div class="radio alert" style="box-shadow: none; padding: 5px; border-radius: 4px;">
<label>
<input type="radio" name="style" value="0"
<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>
@ -302,14 +302,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<div class="col-md-2">
<div class="radio alert alert-success" style="padding: 5px;">
<label style="margin-top: -5px">
<input type="radio" name="style" value="1"
<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" style="padding: 5px">
<div class="radio alert alert-info" style="padding: 5px" 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';} ?>>
@ -318,7 +318,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</div>
</div>
<div class="col-md-2">
<div class="radio alert alert-warning" style="padding: 5px">
<div class="radio alert alert-warning" style="padding: 5px" 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';} ?>>
@ -327,7 +327,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</div>
</div>
<div class="col-md-2">
<div class="radio alert alert-danger" style="padding: 5px">
<div class="radio alert alert-danger" style="padding: 5px" 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';} ?> >
@ -339,10 +339,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<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">
<div name="icon" class="btn btn-default iconpicker-container" data-toggle="iconpicker" data-icon="<?php //echo $icon; ?>"></button>
<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">
@ -603,6 +607,7 @@ function new_sm()
}
$type = empty($_POST['type']) ? 0 : 1;
$icon = hesk_POST('icon');
$title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title'];
$message = hesk_getHTML( hesk_POST('message') );
@ -613,6 +618,7 @@ function new_sm()
'style' => $style,
'type' => $type,
'title' => $title,
'icon' => $icon,
'message' => hesk_input( hesk_POST('message') ),
);
@ -636,6 +642,7 @@ function new_sm()
'style' => $style,
'type' => $type,
'title' => $title,
'icon' => $icon,
'message' => $message,
);
@ -649,13 +656,14 @@ function new_sm()
$my_order = intval($row[0]) + 10;
// Insert service message into database
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` (`author`,`title`,`message`,`style`,`type`,`order`) VALUES (
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` (`author`,`title`,`message`,`style`,`type`,`order`, `icon`) VALUES (
'".intval($_SESSION['id'])."',
'".hesk_dbEscape($title)."',
'".hesk_dbEscape($message)."',
'{$style}',
'{$type}',
'{$my_order}'
'{$my_order}',
'{$icon}'
)");
$_SESSION['smord'] = hesk_dbInsertID();

@ -29,6 +29,8 @@ if ($task == 'status-change') {
removePendingVerificationEmailsTable();
} elseif ($task == 'pending-verification-tickets-table') {
removeTicketsPendingVerificationTable();
} elseif ($task == 'service-message-icon') {
removeServiceMessageCustomIcon();
} elseif ($task == 'miscellaneous') {
executeMiscellaneousSql();
} else {

@ -1,7 +1,7 @@
function getTasks() {
return ['status-change', 'autorefresh', 'parent-child', 'settings-access', 'activate-user',
'notify-note-unassigned', 'user-manage-notification-settings', 'settings-table', 'verified-emails-table',
'pending-verification-emails-table', 'pending-verification-tickets-table', 'miscellaneous'];
'pending-verification-emails-table', 'pending-verification-tickets-table', 'service-message-icon', 'miscellaneous'];
}
function processUninstallation() {

@ -436,4 +436,14 @@ function execute221Scripts() {
hesk_dbConnect();
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.2.1' WHERE `Key` = 'modsForHeskVersion'");
}
// END Version 2.2.1
// END Version 2.2.1
// BEGIN Version 2.3.0
function execute230Scripts() {
global $hesk_settings;
hesk_dbConnect();
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` ADD COLUMN `icon` VARCHAR(150)");
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'");
}
// END Version 2.3.0

@ -129,6 +129,13 @@ function removeTicketsPendingVerificationTable() {
executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets`");
}
function removeServiceMessageCustomIcon() {
global $hesk_settings;
hesk_dbConnect();
executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` DROP COLUMN `icon`");
}
function executeMiscellaneousSql() {
global $hesk_settings;

@ -16,6 +16,7 @@ function echoTaskRows() {
printUninstallRow('Remove verified emails table', 'verified-emails-table');
printUninstallRow('Remove pending verification emails table', 'pending-verification-emails-table');
printUninstallRow('Remove tickets pending verification table', 'pending-verification-tickets-table');
printUninstallRow('Remove custom service messages icon', 'service-message-icon');
printUninstallRow('Miscellaneous database cleanup changes', 'miscellaneous');
}

Loading…
Cancel
Save