Closes #141 Show correct icon for each service message

This commit is contained in:
Mike Koch 2015-05-08 12:05:16 -04:00
parent f4c6588e41
commit 33dc2c3a9c
3 changed files with 9 additions and 13 deletions

View File

@ -196,24 +196,20 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
while ($sm=hesk_dbFetchAssoc($res)) while ($sm=hesk_dbFetchAssoc($res))
{ {
$faIcon = ""; $faIcon = $sm['icon'];
switch ($sm['style']) switch ($sm['style'])
{ {
case 1: case 1:
$sm_style = "alert alert-success"; $sm_style = "alert alert-success";
$faIcon = "fa fa-check-circle";
break; break;
case 2: case 2:
$sm_style = "alert alert-info"; $sm_style = "alert alert-info";
$faIcon = "fa fa-comment";
break; break;
case 3: case 3:
$sm_style = "alert alert-warning"; $sm_style = "alert alert-warning";
$faIcon = "fa fa-exclamation-triangle";
break; break;
case 4: case 4:
$sm_style = "alert alert-danger"; $sm_style = "alert alert-danger";
$faIcon = "fa fa-times-circle";
break; break;
default: default:
$sm_style = "none"; $sm_style = "none";
@ -434,6 +430,7 @@ function save_sm()
} }
$type = empty($_POST['type']) ? 0 : 1; $type = empty($_POST['type']) ? 0 : 1;
$icon = hesk_POST('icon');
$title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title']; $title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title'];
$message = hesk_getHTML( hesk_POST('message') ); $message = hesk_getHTML( hesk_POST('message') );
@ -448,6 +445,7 @@ function save_sm()
'style' => $style, 'style' => $style,
'type' => $type, 'type' => $type,
'title' => $title, 'title' => $title,
'icon' => $icon,
'message' => hesk_input( hesk_POST('message') ), 'message' => hesk_input( hesk_POST('message') ),
); );
@ -475,6 +473,7 @@ function save_sm()
'type' => $type, 'type' => $type,
'title' => $title, 'title' => $title,
'message' => $message, 'message' => $message,
'icon' => $icon,
); );
header('Location: service_messages.php'); header('Location: service_messages.php');
@ -487,7 +486,8 @@ function save_sm()
`title` = '".hesk_dbEscape($title)."', `title` = '".hesk_dbEscape($title)."',
`message` = '".hesk_dbEscape($message)."', `message` = '".hesk_dbEscape($message)."',
`style` = '{$style}', `style` = '{$style}',
`type` = '{$type}' `type` = '{$type}',
`icon` = '{$icon}'
WHERE `id`={$id} LIMIT 1"); WHERE `id`={$id} LIMIT 1");
$_SESSION['smord'] = $id; $_SESSION['smord'] = $id;

View File

@ -65,24 +65,20 @@ hesk_getLanguage();
function hesk_service_message($sm) function hesk_service_message($sm)
{ {
$faIcon = ""; $faIcon = $sm['icon'];
switch ($sm['style']) switch ($sm['style'])
{ {
case 1: case 1:
$style = "alert alert-success"; $style = "alert alert-success";
$faIcon = "fa fa-check-circle";
break; break;
case 2: case 2:
$style = "alert alert-info"; $style = "alert alert-info";
$faIcon = "fa fa-comment";
break; break;
case 3: case 3:
$style = "alert alert-warning"; $style = "alert alert-warning";
$faIcon = "fa fa-exclamation-triangle";
break; break;
case 4: case 4:
$style = "alert alert-danger"; $style = "alert alert-danger";
$faIcon = "fa fa-times-circle";
break; break;
default: default:
$style = "none"; $style = "none";
@ -90,7 +86,7 @@ function hesk_service_message($sm)
?> ?>
<div class="<?php echo $style; ?>"> <div class="<?php echo $style; ?>">
<?php echo $style == 'none' ? '' : '<i class="'.$faIcon.'"></i> '; ?> <?php echo $faIcon == '' ? '' : '<i class="'.$faIcon.'"></i> '; ?>
<b><?php echo $sm['title']; ?></b><?php echo $sm['message']; ?> <b><?php echo $sm['title']; ?></b><?php echo $sm['message']; ?>
</div> </div>
<br /> <br />

View File

@ -1054,7 +1054,7 @@ function print_start()
</ol> </ol>
<?php <?php
// Service messages // Service messages
$res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` WHERE `type`='0' ORDER BY `order` ASC"); $res = hesk_dbQuery('SELECT `title`, `message`, `style`, `icon` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` WHERE `type`='0' ORDER BY `order` ASC");
if (hesk_dbNumRows($res) > 0) if (hesk_dbNumRows($res) > 0)
{ {
?> ?>