Use mobile navitagion in VC items while using mobile view

This commit is contained in:
fbsanchez 2020-12-22 14:40:04 +01:00
parent 025288d9fe
commit ac8af7ee52
1 changed files with 38 additions and 0 deletions

View File

@ -1058,6 +1058,16 @@ class Item extends CachedModel
{
global $config;
$mobile_navigation = false;
if (isset($_SERVER['PHP_SELF']) === true
&& (strstr($_SERVER['PHP_SELF'], 'mobile/') !== false
|| strstr($_SERVER['HTTP_REFERER'], 'mobile/') !== false)
) {
$mobile_navigation = true;
}
error_log(obhd($_SERVER['PHP_SELF']));
// Load side libraries.
include_once $config['homedir'].'/include/functions_ui.php';
if (\is_metaconsole()) {
@ -1070,6 +1080,7 @@ class Item extends CachedModel
$linkedAgent = static::extractLinkedAgent($data);
$baseUrl = \ui_get_full_url('index.php');
$mobileUrl = \ui_get_full_url('mobile/index.php');
// TODO: There's a feature to get the link from the label.
if (static::$useLinkedVisualConsole === true
@ -1117,6 +1128,15 @@ class Item extends CachedModel
* We are in a regular console.
*/
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'visualmap',
'id' => $vcId,
]
);
}
return $baseUrl.'?'.http_build_query(
[
'sec' => 'network',
@ -1190,6 +1210,15 @@ class Item extends CachedModel
];
}
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'module_graph',
'id' => $moduleId,
]
);
}
return $baseUrl.'?'.http_build_query($queryParams);
} else if (\is_metaconsole() && \can_user_access_node()) {
/*
@ -1265,6 +1294,15 @@ class Item extends CachedModel
* We are in a regular console.
*/
if ($mobile_navigation === true) {
return $mobileUrl.'?'.http_build_query(
[
'page' => 'agent',
'id' => $agentId,
]
);
}
return $baseUrl.'?'.http_build_query(
[
'sec' => 'estado',