diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index e23b148c68..a14e2b80c4 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -3346,7 +3346,8 @@ class NetworkMap node_radius: node_radius, holding_area_dimensions: networkmap_holding_area_dimensions, url_background_grid: url_background_grid, - font_size: '.$this->mapOptions['font_size'].' + font_size: '.$this->mapOptions['font_size'].', + base_url_homedir: "'.ui_get_full_url(false).'" }); init_drag_and_drop(); init_minimap(); diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index e3a00cb90a..bb306ccd66 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -159,7 +159,7 @@ function set_center(id) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php" + url: window.base_url_homedir + "/ajax.php" }); } @@ -208,7 +208,7 @@ function delete_link( data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { if (data["correct"]) { var found = -1; @@ -266,7 +266,7 @@ function update_fictional_node(id_db_node) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { if (data["correct"]) { $("#dialog_node_edit").dialog("close"); @@ -306,7 +306,7 @@ function update_node_name(id_db_node) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { if (data["correct"]) { $("#dialog_node_edit").dialog("close"); @@ -352,7 +352,7 @@ function change_shape(id_db_node) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { $("#shape_icon_in_progress").css("display", "none"); if (data["correct"]) { @@ -629,7 +629,7 @@ function update_link(row_index, id_link) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { $(".edit_icon_progress_" + row_index).css("display", "none"); @@ -756,7 +756,7 @@ function move_to_networkmap(node) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { if (data["correct"]) { window.location = @@ -831,7 +831,7 @@ function edit_node(data_node, dblClick) { data: params.join("&"), dataType: "json", type: "POST", - url: "ajax.php", + url: window.base_url_homedir + "/ajax.php", success: function(data) { $("#node_details-0-1").html( 'publicLink = false; // Check user access. if ($hash === false) { check_login(); @@ -201,6 +209,12 @@ class Manager include 'general/noaccess.php'; exit; } + + $this->publicLink = true; + } + + if (empty(get_parameter('auth_hash', '')) === false) { + $this->publicLink = true; } // User is admin. @@ -411,7 +425,8 @@ class Manager $this->widgetId, $width, $height, - $gridWidth + $gridWidth, + $this->publicLink ); return $instance; @@ -992,6 +1007,7 @@ class Manager 'url' => $this->url, 'dashboardName' => $this->dashboardFields['name'], 'hash' => self::generatePublicHash(), + 'publicLink' => $this->publicLink, ] ); } else { @@ -1185,6 +1201,7 @@ class Manager $cellData = $cellClass->get(); $instance = ''; + if ((int) $cellData['id_widget'] !== 0 || $this->widgetId !== 0) { $instance = $this->instanceWidget( $newWidth, diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 90c863472e..8c896aa75f 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -104,6 +104,13 @@ class EventsListWidget extends Widget */ protected $gridWidth; + /** + * Public Link. + * + * @var boolean + */ + protected $publicLink; + /** * Construct. @@ -114,6 +121,7 @@ class EventsListWidget extends Widget * @param integer|null $width New width. * @param integer|null $height New height. * @param integer|null $gridWidth Grid width. + * @param boolean|null $publicLink Public Link. */ public function __construct( int $cellId, @@ -121,7 +129,8 @@ class EventsListWidget extends Widget int $widgetId=0, ?int $width=0, ?int $height=0, - ?int $gridWidth=0 + ?int $gridWidth=0, + ?bool $publicLink=false ) { global $config; @@ -146,6 +155,9 @@ class EventsListWidget extends Widget // Grid Width. $this->gridWidth = $gridWidth; + // Grid Width. + $this->publicLink = $publicLink; + // Options. $this->values = $this->decoders($this->getOptionsWidget()); @@ -564,13 +576,18 @@ class EventsListWidget extends Widget ] ); - $data[2] = ''; + if ($this->publicLink === false) { + $data[2] = ''; + } + $data[2] .= substr(io_safe_output($event['evento']), 0, 150); if (strlen($event['evento']) > 150) { $data[2] .= '...'; } - $data[2] .= ''; + if ($this->publicLink === false) { + $data[2] .= ''; + } $data[3] = ui_print_timestamp($event['timestamp'], true); diff --git a/pandora_console/include/lib/Dashboard/Widgets/network_map.php b/pandora_console/include/lib/Dashboard/Widgets/network_map.php index 4c9eeb0010..b5457659f2 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/network_map.php +++ b/pandora_console/include/lib/Dashboard/Widgets/network_map.php @@ -380,12 +380,7 @@ class NetworkMapWidget extends Widget [ 'cellId' => $this->cellId, 'page' => 'enterprise/include/ajax/map_enterprise.ajax', - 'url' => ui_get_full_url( - 'ajax.php', - false, - false, - false - ), + 'url' => ui_get_full_url('ajax.php'), 'networkmap_id' => $id_networkmap, 'x_offset' => $x_offset, 'y_offset' => $y_offset, diff --git a/pandora_console/views/dashboard/header.php b/pandora_console/views/dashboard/header.php index 257acb3aab..f54a7c04b6 100644 --- a/pandora_console/views/dashboard/header.php +++ b/pandora_console/views/dashboard/header.php @@ -130,8 +130,8 @@ if ($config['public_dashboard'] === true) { $urlRefresh = $url.'&'.http_build_query($queryRefresh); } -$comboRefresh['text'] = ''; -$comboRefresh['text'] .= ''; if ($config['public_dashboard'] === true) { $buttons = [ 'combo_refresh_one_dashboard' => $comboRefresh, - // 'slides' => $slides, + 'combo_refresh_countdown' => $comboRefreshCountdown, ]; } else if ($config['pure']) { if (check_acl($config['id_user'], 0, 'RW') === 0) { @@ -200,16 +200,25 @@ if ($config['public_dashboard'] === true) { 'normalscreen' => $normalscreen, 'combo_refresh_one_dashboard' => $comboRefresh, 'slides' => $slides, + 'combo_refresh_countdown' => $comboRefreshCountdown, ]; } else { - $buttons = [ - 'back_to_dashboard_list' => $back_to_dashboard_list, - 'save_layout' => $save_layout_dashboard, - 'normalscreen' => $normalscreen, - 'combo_refresh_one_dashboard' => $comboRefresh, - 'slides' => $slides, - 'options' => $options, - ]; + if ($publicLink === true) { + $buttons = [ + 'combo_refresh_one_dashboard' => $comboRefresh, + 'combo_refresh_countdown' => $comboRefreshCountdown, + ]; + } else { + $buttons = [ + 'back_to_dashboard_list' => $back_to_dashboard_list, + 'save_layout' => $save_layout_dashboard, + 'normalscreen' => $normalscreen, + 'combo_refresh_one_dashboard' => $comboRefresh, + 'slides' => $slides, + 'options' => $options, + 'combo_refresh_countdown' => $comboRefreshCountdown, + ]; + } } } else { if (check_acl($config['id_user'], 0, 'RW') === 0) { @@ -235,11 +244,23 @@ if ($config['public_dashboard'] === true) { } } -ui_print_page_header( - $dashboardName, - '', - false, - '', - false, - $buttons -); +if ($publicLink === false) { + ui_print_page_header( + $dashboardName, + '', + false, + '', + false, + $buttons + ); +} else { + $output = '