Merge branch 'ent-10909-se-han-roto-los-iconos-de-grupo-de-agentes-en-v770' into 'develop'

Ent 10909 se han roto los iconos de grupo de agentes en v770

See merge request artica/pandorafms!5701
This commit is contained in:
Daniel Rodriguez 2023-04-12 15:29:44 +00:00
commit 7ae8f185b0
5 changed files with 64 additions and 6 deletions

View File

@ -120,6 +120,16 @@ if (is_metaconsole() === true) {
// Data before table.
$files = list_files(((is_metaconsole() === true) ? '../../' : '').'images/', '@groups.svg', 1, 0);
$files_old = list_files('images/groups_small/', 'png', 1, 0);
foreach ($files_old as $key => $f) {
// Remove from the list the non-desired .png files.
if (strpos($f, '.bad.png') !== false || strpos($f, '.default.png') !== false || strpos($f, '.ok.png') !== false || strpos($f, '.warning.png') !== false) {
unset($files_old[$key]);
}
}
$files = array_merge($files, $files_old);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filter-table-adv';
@ -133,10 +143,19 @@ $table->data[0][0] = html_print_label_input_block(
html_print_input_text('name', $name, '', 35, 100, true)
);
$extension = pathinfo($icon, PATHINFO_EXTENSION);
if (empty($extension) === true) {
$icon .= '.png';
}
$input_icon = html_print_select($files, 'icon', $icon, '', 'None', '', true, false, true, '', false, 'width: 100%;');
$input_icon .= ' <span id="icon_preview" class="mrgn_lft_05em">';
if (empty($icon) === false) {
$input_icon .= html_print_image('images/'.$icon, true);
if (empty($extension) === true || $extension === 'png') {
$input_icon .= html_print_image('images/groups_small/'.$icon, true);
} else {
$input_icon .= html_print_image('images/'.$icon, true);
}
}
$input_icon .= '</span>';
@ -304,12 +323,17 @@ echo '</form>';
function icon_changed () {
var inputs = [];
var data = this.value;
var extension = data.split('.').pop();
$('#icon_preview').fadeOut ('normal', function () {
$('#icon_preview').empty ();
if (data != "") {
var params = [];
params.push("get_image_path=1");
params.push("img_src=images/" + data);
if (extension === 'png') {
params.push("img_src=images/groups_small/" + data);
} else {
params.push("img_src=images/" + data);
}
params.push("page=include/ajax/skins.ajax");
params.push("only_src=1");
jQuery.ajax ({

View File

@ -920,8 +920,19 @@ if ($tab == 'tree') {
}
if ($group['icon'] != '') {
$extension = pathinfo($group['icon'], PATHINFO_EXTENSION);
if (empty($extension) === true) {
$group['icon'] .= '.png';
}
if (empty($extension) === true || $extension === 'png') {
$path = 'images/groups_small/'.$group['icon'];
} else {
$path = 'images/'.$group['icon'];
}
$table->data[$key][2] = html_print_image(
'images/'.$group['icon'],
$path,
true,
[
'style' => '',

View File

@ -445,6 +445,15 @@ function groups_get_icon($id_group)
} else {
$icon = (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group);
$extension = pathinfo($icon, PATHINFO_EXTENSION);
if (empty($extension) === true) {
$icon .= '.png';
}
if (empty($extension) === true || $extension === 'png') {
$icon = 'groups_small/'.$icon;
}
if (empty($icon) === true) {
$icon = 'unknown@groups.svg';
}

View File

@ -713,6 +713,10 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin
$output = '';
$icon = ($id_group > 0) ? (string) db_get_value('icon', 'tgrupo', 'id_grupo', (int) $id_group) : 'unknown@groups.svg';
$extension = pathinfo($icon, PATHINFO_EXTENSION);
if (empty($extension) === true) {
$icon .= '.png';
}
// Don't show link in metaconsole.
if (is_metaconsole() === true) {
@ -756,10 +760,14 @@ function ui_print_group_icon($id_group, $return=false, $path='', $style='', $lin
}
}
$icon = (str_contains($icon, '.svg') === true) ? $icon : $icon.'.svg';
$icon = (str_contains($icon, '.svg') === true || str_contains($icon, '.png') === true) ? $icon : $icon.'.svg';
$folder = '';
if (str_contains($icon, '.png')) {
$folder = 'groups_small/';
}
$output .= html_print_image(
'images/'.$icon,
'images/'.$folder.$icon,
true,
[
'style' => $style,

View File

@ -652,13 +652,19 @@ var TreeController = {
typeof element.icon != "undefined" &&
element.icon.length > 0
) {
var extension = element.icon.split(".").pop();
$content.append(
'<div class="node-icon"><div class="node-icon-container"><img src="' +
(controller.baseURL.length > 0 ? controller.baseURL : "") +
(controller.baseURL.indexOf("meta") !== -1
? "../../images/"
: "images/") +
element.icon +
(extension === "png" || extension === element.icon
? "groups_small/"
: "") +
(extension === element.icon
? element.icon + ".png"
: element.icon) +
'" class="invert_filter"/></div></div>'
);
} else if (