Fixed export and import visual consoles

This commit is contained in:
danielmaya 2018-06-04 15:56:17 +02:00
parent b620c1e7d9
commit 89aa85626c
2 changed files with 19 additions and 9 deletions

View File

@ -247,12 +247,10 @@ function output_xml_visual_console($id) {
echo "<other_id>" . $item['id'] . "</other_id>\n"; //OLD ID USE FOR parent item
$agent = '';
if ($item['id_agent'] != 0) {
$agent = db_get_value ("alias","tagente","id_agente",$item['id_agent']);
$agent = db_get_value ("nombre","tagente","id_agente",$item['id_agent']);
}
if (!empty($item['label'])) {
$aux = explode("-",$item['label']);
$label = $agent .' -'. $aux[1];
echo "<label><![CDATA[" . io_safe_output($label) . "]]></label>\n";
echo "<label><![CDATA[" . io_safe_output($item['label']) . "]]></label>\n";
}
echo "<x>" . $item['pos_x'] . "</x>\n";
echo "<y>" . $item['pos_y'] . "</y>\n";
@ -273,7 +271,7 @@ function output_xml_visual_console($id) {
if ($item['id_agente_modulo'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$id_agent = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $item['id_agente_modulo']);
$agent = db_get_value ("alias","tagente","id_agente",$id_agent);
$agent = db_get_value ("nombre","tagente","id_agente",$id_agent);
echo "<module><![CDATA[" . io_safe_output($module) . "]]></module>\n";
}
@ -287,6 +285,10 @@ function output_xml_visual_console($id) {
if ($item['parent_item'] != 0) {
echo "<parent_item>" . $item['parent_item'] . "</parent_item>\n";
}
if ($item['type'] == 19) {
echo "<clock_animation>" . $item['clock_animation'] . "</clock_animation>\n";
echo "<fill_color>" . $item['fill_color'] . "</fill_color>\n";
}
echo "</item>\n";
}
echo "</visual_map>\n";

View File

@ -455,13 +455,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$agents_in_item = array();
foreach ($agents as $id => $agent) {
if ($regular_expresion) {
if ((bool)preg_match("/" . $agent_clean . "/", io_safe_input($agent))) {
if ((bool)preg_match("/" . $agent_clean . "/", io_safe_output($agent))) {
$agents_in_item[$id]['name'] = $agent;
$no_agents = false;
}
}
else {
if ($agent_clean == io_safe_input($agent)) {
if ($agent_clean == io_safe_output($agent)) {
$agents_in_item[$id]['name'] = $agent;
$no_agents = false;
break;
@ -482,13 +482,13 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$modules_in_item = array();
foreach ($modules as $module) {
if ($regular_expresion) {
if ((bool)preg_match("/" . $module_clean . "/", io_safe_input($module['nombre']))) {
if ((bool)preg_match("/" . $module_clean . "/", io_safe_output($module['nombre']))) {
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
$no_modules = false;
}
}
else {
if ($module_clean == io_safe_input($module['nombre'])) {
if ($module_clean == io_safe_output($module['nombre'])) {
$modules_in_item[$module['id_agente_modulo']] = $module['nombre'];
$no_modules = false;
break;
@ -527,6 +527,14 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$values['id_layout_linked'] = (string)$item->map_linked;
if (isset($item->type))
$values['type'] = (string)$item->type;
if (isset($item->clock_animation)) {
$values['clock_animation'] = (string)$item->clock_animation;
}
if (isset($item->fill_color)) {
$values['fill_color'] = (string)$item->fill_color;
}
if ($no_agents) {
$id_item = db_process_sql_insert('tlayout_data', $values);