diff --git a/doc/API/centreon-api-v21.10.yaml b/doc/API/centreon-api-v21.10.yaml index eb31ff25907..f8e38eb0dab 100644 --- a/doc/API/centreon-api-v21.10.yaml +++ b/doc/API/centreon-api-v21.10.yaml @@ -559,6 +559,10 @@ paths: nullable: true description: Locale of the current user example: en_US + useDeprecatedPages: + type: boolean + description: Indicates if user wants to use deprecated monitoring pages + example: false '403': $ref: '#/components/responses/Forbidden' '500': diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po index 5e71bbe960d..e58836a2db2 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/help.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/help.po @@ -7238,4 +7238,13 @@ msgid "" msgstr "" "Non: Vous ne consentez pas à partager les informations de votre plateforme. Détails du Contact: Vous consentez" "à partager les informations de votre plateforme, y compris votre alias et email. Anonymisé: Vous consentez à partager" -"les informations de votre plateforme, mais votre alias et votre email seront anonymisés." \ No newline at end of file +"les informations de votre plateforme, mais votre alias et votre email seront anonymisés." + +msgid "" +"If checked this option will restore the use of the deprecated pages." +"This includes display of the deprecated pages and internal redirections between pages" +"If not checked this option will enable the full use of the new Monitoring page Resource Status" +msgstr "" +"Si l'option est activée l'utilisation des pages dépréciées sera totalement rétablie" +"Cela inclu: l'affichage des pages mais également toutes les redirections entre pages dépréciées" +"Si l'option n'est pas activée l'utilisation de la nouvelle page de Monitoring Resource Status sera pleinement activée" diff --git a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po index cddade307eb..87bdcc836ef 100644 --- a/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po +++ b/lang/fr_FR.UTF-8/LC_MESSAGES/messages.po @@ -15868,8 +15868,8 @@ msgstr "Erreur lors de la recherche d'hôtes et de modèles de service liés" msgid "deprecated" msgstr "déprécié" -msgid "Show deprecated pages" -msgstr "Afficher les pages dépréciées" +msgid "Use deprecated pages" +msgstr "Utiliser les pages dépréciées" msgid "Error when adding services to the host %d" msgstr "Erreur lors de l'ajout de services à l'hôte %d" diff --git a/src/Centreon/Application/Controller/MonitoringResourceController.php b/src/Centreon/Application/Controller/MonitoringResourceController.php index 1f256078ec1..c9749599a07 100644 --- a/src/Centreon/Application/Controller/MonitoringResourceController.php +++ b/src/Centreon/Application/Controller/MonitoringResourceController.php @@ -862,6 +862,31 @@ public function buildServiceUri(int $hostId, int $serviceId, string $tab = self: ]); } + /** + * Build uri to access meta service panel + * + * @param integer $metaId + * @param string $tab tab name + * @return string + */ + public function buildMetaServiceDetailsUri(int $metaId, string $tab = self::TAB_DETAILS_NAME): string + { + if (!in_array($tab, static::ALLOWED_TABS)) { + throw new ResourceException(sprintf(_('Cannot build uri to unknown tab : %s'), $tab)); + } + + return $this->buildListingUri([ + 'details' => json_encode([ + 'parentType' => null, + 'parentId' => null, + 'type' => ResourceEntity::TYPE_META, + 'id' => $metaId, + 'tab' => $tab, + 'uuid' => 'm' . $metaId + ]), + ]); + } + /** * Build uri to access listing page of resources with specific parameters * diff --git a/src/Centreon/Application/Controller/UserController.php b/src/Centreon/Application/Controller/UserController.php index 0a280e3f594..95d3b32fd98 100644 --- a/src/Centreon/Application/Controller/UserController.php +++ b/src/Centreon/Application/Controller/UserController.php @@ -86,7 +86,8 @@ public function getUserParameters(): View 'alias' => $user->getAlias(), 'email' => $user->getEmail(), 'timezone' => $user->getTimezone()->getName(), - 'locale' => $user->getLocale() + 'locale' => $user->getLocale(), + 'use_deprecated_pages' => $user->isUsingDeprecatedPages() ]); } diff --git a/src/Centreon/Domain/Contact/Contact.php b/src/Centreon/Domain/Contact/Contact.php index 5990675a9ef..e46317a8c12 100644 --- a/src/Centreon/Domain/Contact/Contact.php +++ b/src/Centreon/Domain/Contact/Contact.php @@ -158,6 +158,13 @@ class Contact implements UserInterface, ContactInterface */ private $defaultPage; + /** + * Indicates if user uses deprecated pages + * + * @var bool + */ + private $useDeprecatedPages; + /** * @return int */ @@ -574,4 +581,25 @@ public function getDefaultPage(): ?Page { return $this->defaultPage; } + + /** + * Indicates if user uses deprecated pages + * + * @return bool + */ + public function isUsingDeprecatedPages() + { + return $this->useDeprecatedPages; + } + + /** + * @param bool $useDeprecatedPages Indicates if user uses deprecated pages + * @return self + */ + public function setUseDeprecatedPages(bool $useDeprecatedPages) + { + $this->useDeprecatedPages = $useDeprecatedPages; + + return $this; + } } diff --git a/src/Centreon/Infrastructure/Contact/ContactRepositoryRDB.php b/src/Centreon/Infrastructure/Contact/ContactRepositoryRDB.php index 54d2b61d33a..28a4084ce35 100644 --- a/src/Centreon/Infrastructure/Contact/ContactRepositoryRDB.php +++ b/src/Centreon/Infrastructure/Contact/ContactRepositoryRDB.php @@ -1,6 +1,7 @@ setAccessToApiConfiguration($contact['reach_api'] === '1') ->setTimezone(new \DateTimeZone($contactTimezoneName)) ->setLocale($contactLocale) - ->setDefaultPage($page); + ->setDefaultPage($page) + ->setUseDeprecatedPages($contact['show_deprecated_pages'] === '1'); } /** diff --git a/www/include/Administration/myAccount/formMyAccount.ihtml b/www/include/Administration/myAccount/formMyAccount.ihtml index e1f3ddc76ea..bc7d75c9005 100644 --- a/www/include/Administration/myAccount/formMyAccount.ihtml +++ b/www/include/Administration/myAccount/formMyAccount.ihtml @@ -44,7 +44,7 @@ {$form.default_page.label}{$form.default_page.html} - {$form.show_deprecated_pages.label}{$form.show_deprecated_pages.html} + {$form.show_deprecated_pages.label}{$form.show_deprecated_pages.html} {$form.contact_js_effects.label}{$form.contact_js_effects.html} {$form.contact_platform_data_sending.label}{$form.contact_platform_data_sending.html} @@ -118,4 +118,5 @@ {$form.hidden} +{$helptext} diff --git a/www/include/Administration/myAccount/formMyAccount.php b/www/include/Administration/myAccount/formMyAccount.php index 9f7c12b8f59..9f55de61f8c 100644 --- a/www/include/Administration/myAccount/formMyAccount.php +++ b/www/include/Administration/myAccount/formMyAccount.php @@ -143,7 +143,7 @@ array('onclick' => 'generatePassword("aKey");', 'class' => 'btc bt_info') ); $form->addElement('select', 'contact_lang', _("Language"), $langs); -$form->addElement('checkbox', 'show_deprecated_pages', _("Show deprecated pages"), null, $attrsText); +$form->addElement('checkbox', 'show_deprecated_pages', _("Use deprecated pages"), null, $attrsText); $form->addElement('checkbox', 'contact_js_effects', _("Animation effects"), null, $attrsText); $platformDataSendingRadios = [ @@ -466,6 +466,16 @@ function myReplace() $tpl->assign('cct', $cct); $tpl->assign('o', $o); $tpl->assign('featuresFlipping', (count($features) > 0)); + +/* + * prepare help texts + */ +$helptext = ""; +include_once("help.php"); +foreach ($help as $key => $text) { + $helptext .= '' . "\n"; +} +$tpl->assign("helptext", $helptext); $tpl->display("formMyAccount.ihtml"); ?> diff --git a/www/include/Administration/myAccount/help.php b/www/include/Administration/myAccount/help.php new file mode 100644 index 00000000000..fee474d1f8d --- /dev/null +++ b/www/include/Administration/myAccount/help.php @@ -0,0 +1,17 @@ +user->doesShowDeprecatedPages(); + /** * Language informations init */ @@ -887,19 +893,30 @@ } $buffer->writeElement("service_description", $log["service_description"], false); $buffer->writeElement("real_service_name", $log["service_description"], false); - $buffer->writeElement( - "s_timeline_uri", - $resourceController->buildServiceUri( + + $serviceTimelineRedirectionUri = $useDeprecatedPages + ? 'main.php?p=20201&o=svcd&host_name=' . $log['host_name'] . '&service_description=' + . $log['service_description'] + : $resourceController->buildServiceUri( $log['host_id'], $log['service_id'], $resourceController::TAB_TIMELINE_NAME - ) + ); + + $buffer->writeElement( + "s_timeline_uri", + $serviceTimelineRedirectionUri ); } $buffer->writeElement("real_name", $log["host_name"], false); + + $hostTimelineRedirectionUri = $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $log['host_name'] + : $resourceController->buildHostUri($log['host_id'], $resourceController::TAB_TIMELINE_NAME); + $buffer->writeElement( "h_timeline_uri", - $resourceController->buildHostUri($log['host_id'], $resourceController::TAB_TIMELINE_NAME) + $hostTimelineRedirectionUri ); $buffer->writeElement("class", $tab_class[$cpts % 2]); $buffer->writeElement("poller", $log["instance_name"]); diff --git a/www/include/monitoring/comments/listComment.php b/www/include/monitoring/comments/listComment.php index 68b21d902ce..7acec1b0bd9 100755 --- a/www/include/monitoring/comments/listComment.php +++ b/www/include/monitoring/comments/listComment.php @@ -1,4 +1,5 @@ getMyGMTFromSession(session_id(), $pearDB); +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + /* * Smarty template Init */ @@ -155,12 +162,20 @@ $tab_comments_svc[$i]['data'], ['a', 'br', 'hr'] ); - $tab_comments_svc[$i]['h_details_uri'] = $resourceController->buildHostDetailsUri($data['host_id']); + $tab_comments_svc[$i]['h_details_uri'] = $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $data['host_name'] + : $resourceController->buildHostDetailsUri($data['host_id']); + if ($data['service_description'] != '') { - $tab_comments_svc[$i]['s_details_uri'] = $resourceController->buildServiceDetailsUri( - $data['host_id'], - $data['service_id'] - ); + $tab_comments_svc[$i]['s_details_uri'] = $useDeprecatedPages + ? 'main.php?p=202&o=svcd&host_name=' + . $data['host_name'] + . '&service_description=' + . $data['service_description'] + : $resourceController->buildServiceDetailsUri( + $data['host_id'], + $data['service_id'] + ); $tab_comments_svc[$i]['service_description'] = htmlentities($data['service_description'], ENT_QUOTES, 'UTF-8'); $tab_comments_svc[$i]['comment_type'] = 'SVC'; } else { diff --git a/www/include/monitoring/downtime/listDowntime.php b/www/include/monitoring/downtime/listDowntime.php index 78587f9698f..9d339bc1bd7 100644 --- a/www/include/monitoring/downtime/listDowntime.php +++ b/www/include/monitoring/downtime/listDowntime.php @@ -1,7 +1,8 @@ getMyGMTFromSession(session_id(), $pearDB); +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + include_once "./class/centreonDB.class.php"; $kernel = \App\Kernel::createForWeb(); @@ -223,9 +230,16 @@ } } else { $tab_downtime_svc[$i]['host_name'] = $data['host_name']; - $tab_downtime_svc[$i]['h_details_uri'] = $resourceController->buildHostDetailsUri($data['host_id']); + $tab_downtime_svc[$i]['h_details_uri'] = $useDeprecatedPages + ? './main.php?p=20202&o=hd&host_name=' . $data['host_name'] + : $resourceController->buildHostDetailsUri($data['host_id']); if ($data['service_description'] !== '') { - $tab_downtime_svc[$i]['s_details_uri'] = $resourceController->buildServiceDetailsUri( + $tab_downtime_svc[$i]['s_details_uri'] = $useDeprecatedPages + ? './main.php?p=202&o=svcd&host_name=' + . $data['host_name'] + . '&service_description=' + . $data['service_description'] + : $resourceController->buildServiceDetailsUri( $data['host_id'], $data['service_id'] ); diff --git a/www/include/monitoring/status/HostGroups/xml/hostGroupXML.php b/www/include/monitoring/status/HostGroups/xml/hostGroupXML.php index 71069b17ecd..addd1b2c857 100644 --- a/www/include/monitoring/status/HostGroups/xml/hostGroupXML.php +++ b/www/include/monitoring/status/HostGroups/xml/hostGroupXML.php @@ -1,6 +1,7 @@ session_id) || !CentreonSession::checkSession($obj->session_id, $obj->DB)) { print "Bad Session ID"; exit(); } +$centreon = $_SESSION['centreon']; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + // Set Default Poller $obj->getDefaultFilters(); @@ -252,7 +260,8 @@ if (isset($stats)) { foreach ($stats as $name => $stat) { - if (($i < (($num + 1) * $limit) && $i >= (($num) * $limit)) + if ( + ($i < (($num + 1) * $limit) && $i >= (($num) * $limit)) && ((isset($converTable[$name]) && isset($acl[$convertTable[$name]])) || (!isset($acl))) && $name != "meta_hostgroup" ) { @@ -286,17 +295,22 @@ $obj->XML->writeElement("skc", $obj->colorService[0]); $obj->XML->writeElement("sp", $stat["s"][4]); $obj->XML->writeElement("spc", $obj->colorService[4]); + $hostgroupDeprecatedUri = CentreonUtils::escapeSecure("main.php?p=20201&o=svc&hg=" . $hostgroup['id']); $obj->XML->writeElement( 'hg_listing_uri', - $buildHostgroupUri([$hostgroup], [], []) + $useDeprecatedPages ? $hostgroupDeprecatedUri : $buildHostgroupUri([$hostgroup], [], []) ); $obj->XML->writeElement( "hg_listing_h_up", - $buildHostgroupUri([$hostgroup], [$hostType], [$upStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=h_up' + : $buildHostgroupUri([$hostgroup], [$hostType], [$upStatus]) ); $obj->XML->writeElement( "hg_listing_h_down", - $buildHostgroupUri([$hostgroup], [$hostType], [$upStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=h_down' + : $buildHostgroupUri([$hostgroup], [$hostType], [$downStatus]) ); $obj->XML->writeElement( "hg_listing_h_unreachable", @@ -304,27 +318,39 @@ ); $obj->XML->writeElement( "hg_listing_h_pending", - $buildHostgroupUri([$hostgroup], [$hostType], [$pendingStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=h_pending' + : $buildHostgroupUri([$hostgroup], [$hostType], [$pendingStatus]) ); $obj->XML->writeElement( "hg_listing_s_ok", - $buildHostgroupUri([$hostgroup], [$serviceType], [$okStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=svc&statusFilter=ok' + : $buildHostgroupUri([$hostgroup], [$serviceType], [$okStatus]) ); $obj->XML->writeElement( "hg_listing_s_warning", - $buildHostgroupUri([$hostgroup], [$serviceType], [$warningStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=svc&statusFilter=warning' + : $buildHostgroupUri([$hostgroup], [$serviceType], [$warningStatus]) ); $obj->XML->writeElement( "hg_listing_s_critical", - $buildHostgroupUri([$hostgroup], [$serviceType], [$criticalStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=svc&statusFilter=critical' + : $buildHostgroupUri([$hostgroup], [$serviceType], [$criticalStatus]) ); $obj->XML->writeElement( "hg_listing_s_unknown", - $buildHostgroupUri([$hostgroup], [$serviceType], [$unknownStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=svc&statusFilter=unknown' + : $buildHostgroupUri([$hostgroup], [$serviceType], [$unknownStatus]) ); $obj->XML->writeElement( "hg_listing_s_pending", - $buildHostgroupUri([$hostgroup], [$serviceType], [$pendingStatus]) + $useDeprecatedPages + ? $hostgroupDeprecatedUri . '&o=svc&statusFilter=pending' + : $buildHostgroupUri([$hostgroup], [$serviceType], [$pendingStatus]) ); $obj->XML->endElement(); } diff --git a/www/include/monitoring/status/Services/xml/serviceGridXML.php b/www/include/monitoring/status/Services/xml/serviceGridXML.php index 420933b8edc..59bf252bb37 100644 --- a/www/include/monitoring/status/Services/xml/serviceGridXML.php +++ b/www/include/monitoring/status/Services/xml/serviceGridXML.php @@ -1,6 +1,7 @@ user->doesShowDeprecatedPages(); + // Set Default Poller $obj->getDefaultFilters(); @@ -194,7 +203,9 @@ $obj->XML->writeElement("svc_id", $serviceId); $obj->XML->writeElement( "s_details_uri", - $resourceController->buildServiceDetailsUri($tab["hid"], $serviceId) + $useDeprecatedPages + ? 'main.php?o=svcd&p=202&host_name=' . $host_name . '&service_description=' . $svc + : $resourceController->buildServiceDetailsUri($tab["hid"], $serviceId) ); $obj->XML->endElement(); } @@ -206,16 +217,23 @@ $obj->XML->writeElement("hnl", CentreonUtils::escapeSecure(urlencode($host_name))); $obj->XML->writeElement("hs", _($obj->statusHost[$tab["cs"]]), false); $obj->XML->writeElement("hc", $obj->colorHost[$tab["cs"]]); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($tab["hid"])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $host_name + : $resourceController->buildHostDetailsUri($tab["hid"]) + ); $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $host_name . '$', - ], - ]), - ]) + $useDeprecatedPages + ? 'main.php?o=svc&p=20201&statusFilter=;host_search=' . $host_name + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $host_name . '$', + ], + ]), + ]) ); $obj->XML->endElement(); } diff --git a/www/include/monitoring/status/Services/xml/serviceSummaryXML.php b/www/include/monitoring/status/Services/xml/serviceSummaryXML.php index 4f4592537e4..03ec3ce115f 100644 --- a/www/include/monitoring/status/Services/xml/serviceSummaryXML.php +++ b/www/include/monitoring/status/Services/xml/serviceSummaryXML.php @@ -1,6 +1,7 @@ getDefaultFilters(); +$centreon = $_SESSION['centreon']; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + // Check Arguments From GET tab $o = filter_input(INPUT_GET, 'o', FILTER_SANITIZE_STRING, ['options' => ['default' => 'h']]); $p = filter_input(INPUT_GET, 'p', FILTER_VALIDATE_INT, ['options' => ['default' => 2]]); @@ -217,16 +226,24 @@ $obj->XML->writeElement("hn", CentreonUtils::escapeSecure($host_name), false); $obj->XML->writeElement("hnl", CentreonUtils::escapeSecure(urlencode($host_name))); $obj->XML->writeElement("hid", $tab["host_id"], false); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($tab["host_id"])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $host_name + : $resourceController->buildHostDetailsUri($tab["host_id"]) + ); + $serviceListingDeprecatedUri = 'main.php?p=20201&o=svc&host_search=' . $host_name; $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $host_name . '$', - ], - ]), - ]) + $useDeprecatedPages + ? 'main.php?o=svc&p=20201&statusFilter=&host_search=' . $host_name + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $host_name . '$', + ], + ]), + ]) ); $obj->XML->writeElement("ico", $tabIcone[$host_name]); $obj->XML->writeElement("hs", _($obj->statusHost[$tab["cs"]]), false); @@ -241,11 +258,36 @@ $obj->XML->writeElement("skc", $obj->colorService[0]); $obj->XML->writeElement("sp", $tab["nb_service_p"]); $obj->XML->writeElement("spc", $obj->colorService[4]); - $obj->XML->writeElement("s_listing_ok", $buildServicesUri($host_name, [$okStatus])); - $obj->XML->writeElement("s_listing_warning", $buildServicesUri($host_name, [$warningStatus])); - $obj->XML->writeElement("s_listing_critical", $buildServicesUri($host_name, [$criticalStatus])); - $obj->XML->writeElement("s_listing_unknown", $buildServicesUri($host_name, [$unknownStatus])); - $obj->XML->writeElement("s_listing_pending", $buildServicesUri($host_name, [$pendingStatus])); + $obj->XML->writeElement( + "s_listing_ok", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=ok' + : $buildServicesUri($host_name, [$okStatus]) + ); + $obj->XML->writeElement( + "s_listing_warning", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=warning' + : $buildServicesUri($host_name, [$warningStatus]) + ); + $obj->XML->writeElement( + "s_listing_critical", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=critical' + : $buildServicesUri($host_name, [$criticalStatus]) + ); + $obj->XML->writeElement( + "s_listing_unknown", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=unknown' + : $buildServicesUri($host_name, [$unknownStatus]) + ); + $obj->XML->writeElement( + "s_listing_pending", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=pending' + : $buildServicesUri($host_name, [$pendingStatus]) + ); $obj->XML->endElement(); } diff --git a/www/include/monitoring/status/ServicesHostGroups/xml/serviceGridByHGXML.php b/www/include/monitoring/status/ServicesHostGroups/xml/serviceGridByHGXML.php index c6034f72b1d..78e87ff6d34 100644 --- a/www/include/monitoring/status/ServicesHostGroups/xml/serviceGridByHGXML.php +++ b/www/include/monitoring/status/ServicesHostGroups/xml/serviceGridByHGXML.php @@ -1,6 +1,7 @@ getDefaultFilters(); +/** + * @var Centreon $centreon + */ +$centreon = $_SESSION["centreon"]; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + /* * Check Arguments From GET request */ @@ -270,7 +282,9 @@ $obj->XML->writeElement("svc_id", $serviceId); $obj->XML->writeElement( "s_details_uri", - $resourceController->buildServiceDetailsUri($tabH[$host_name], $serviceId) + $useDeprecatedPages + ? 'main.php?o=svcd&p=202&host_name=' . $host_name . '&service_description=' . $svc + : $resourceController->buildServiceDetailsUri($tabH[$host_name], $serviceId) ); $obj->XML->endElement(); } @@ -287,16 +301,23 @@ $obj->XML->writeElement("hs", $obj->statusHost[$tab["cs"]]); $obj->XML->writeElement("hc", $obj->colorHost[$tab["cs"]]); $obj->XML->writeElement("hcount", $count); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($tabH[$host_name])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20201&o=hd&host_name=' . $host_name + : $resourceController->buildHostDetailsUri($tabH[$host_name]) + ); $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $host_name . '$', - ], - ]), - ]) + $useDeprecatedPages + ? 'main.php?o=svc&p=20201&statusFilter=&host_search=' . $host_name + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $host_name . '$', + ], + ]), + ]) ); $obj->XML->endElement(); $count++; diff --git a/www/include/monitoring/status/ServicesHostGroups/xml/serviceSummaryByHGXML.php b/www/include/monitoring/status/ServicesHostGroups/xml/serviceSummaryByHGXML.php index b09630090bf..fdb700bffb1 100644 --- a/www/include/monitoring/status/ServicesHostGroups/xml/serviceSummaryByHGXML.php +++ b/www/include/monitoring/status/ServicesHostGroups/xml/serviceSummaryByHGXML.php @@ -1,6 +1,7 @@ getDefaultFilters(); +/** + * @var Centreon $centreon + */ +$centreon = $_SESSION["centreon"]; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + /* * Check Arguments From GET request */ @@ -254,22 +266,55 @@ $obj->XML->writeElement("hcount", $count); $obj->XML->writeElement("hs", $obj->statusHost[$tab["cs"]]); $obj->XML->writeElement("hc", $obj->colorHost[$tab["cs"]]); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($tab["hid"])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $host_name + : $resourceController->buildHostDetailsUri($tab["hid"]) + ); + $serviceListingDeprecatedUri = 'main.php?p=20201&o=svc&host_search=' . $host_name; $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $host_name . '$', - ], - ]), - ]) + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=' + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $host_name . '$', + ], + ]), + ]) + ); + $obj->XML->writeElement( + "s_listing_ok", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=ok' + : $buildServicesUri($host_name, [$okStatus]) + ); + $obj->XML->writeElement( + "s_listing_warning", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=warning' + : $buildServicesUri($host_name, [$warningStatus]) + ); + $obj->XML->writeElement( + "s_listing_critical", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=critical' + : $buildServicesUri($host_name, [$criticalStatus]) + ); + $obj->XML->writeElement( + "s_listing_unknown", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=unknown' + : $buildServicesUri($host_name, [$unknownStatus]) + ); + $obj->XML->writeElement( + "s_listing_pending", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=pending' + : $buildServicesUri($host_name, [$pendingStatus]) ); - $obj->XML->writeElement("s_listing_ok", $buildServicesUri($host_name, [$okStatus])); - $obj->XML->writeElement("s_listing_warning", $buildServicesUri($host_name, [$warningStatus])); - $obj->XML->writeElement("s_listing_critical", $buildServicesUri($host_name, [$criticalStatus])); - $obj->XML->writeElement("s_listing_unknown", $buildServicesUri($host_name, [$unknownStatus])); - $obj->XML->writeElement("s_listing_pending", $buildServicesUri($host_name, [$pendingStatus])); $obj->XML->endElement(); $count++; } diff --git a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php index 33cc525a4df..869d08d6268 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php +++ b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceGridBySGXML.php @@ -1,6 +1,7 @@ getDefaultFilters(); +/** + * @var Centreon $centreon + */ +$centreon = $_SESSION["centreon"]; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + // Check Arguments From GET tab $o = filter_input(INPUT_GET, 'o', FILTER_SANITIZE_STRING, ['options' => ['default' => 'h']]); $p = filter_input(INPUT_GET, 'p', FILTER_VALIDATE_INT, ['options' => ['default' => 2]]); @@ -302,16 +314,23 @@ $obj->XML->writeElement("hcount", $host['hcount']); $obj->XML->writeElement("hs", $host['hs']); $obj->XML->writeElement("hc", $host['hc']); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($host['hid'])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $host['hn'] + : $resourceController->buildHostDetailsUri($host['hid']) + ); $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $host['hn'] . '$', - ], - ]), - ]) + $useDeprecatedPages + ? 'main.php?o=svc&p=20201&statusFilter=&host_search=' . $host['hn'] + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $host['hn'] . '$', + ], + ]), + ]) ); foreach ($host['service'] as $service) { $obj->XML->startElement("svc"); @@ -321,7 +340,12 @@ $obj->XML->writeElement("svc_id", $service['svc_id']); $obj->XML->writeElement( "s_details_uri", - $resourceController->buildServiceDetailsUri($host['hid'], $service['svc_id']) + $useDeprecatedPages + ? 'main.php?o=svcd&p=202&host_name=' + . $host['hn'] + . '&service_description=' + . $service['sn'] + : $resourceController->buildServiceDetailsUri($host['hid'], $service['svc_id']) ); $obj->XML->endElement(); } diff --git a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceSummaryBySGXML.php b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceSummaryBySGXML.php index e81ac0dadb0..d679b50b8ee 100644 --- a/www/include/monitoring/status/ServicesServiceGroups/xml/serviceSummaryBySGXML.php +++ b/www/include/monitoring/status/ServicesServiceGroups/xml/serviceSummaryBySGXML.php @@ -1,6 +1,7 @@ getDefaultFilters(); +/** + * @var Centreon $centreon + */ +$centreon = $_SESSION["centreon"]; + +/** + * true: URIs will correspond to deprecated pages + * false: URIs will correspond to new page (Resource Status) + */ +$useDeprecatedPages = $centreon->user->doesShowDeprecatedPages(); + /* * Check Arguments From GET tab */ @@ -297,22 +309,55 @@ $obj->XML->writeElement("hid", $hostInfos['host_id']); $obj->XML->writeElement("hs", _($obj->statusHost[$hostInfos['host_state']])); $obj->XML->writeElement("hc", $obj->colorHost[$hostInfos['host_state']]); - $obj->XML->writeElement("h_details_uri", $resourceController->buildHostDetailsUri($hostInfos['host_id'])); + $obj->XML->writeElement( + "h_details_uri", + $useDeprecatedPages + ? 'main.php?p=20202&o=hd&host_name=' . $hostName + : $resourceController->buildHostDetailsUri($hostInfos['host_id']) + ); + $serviceListingDeprecatedUri = 'main.php?p=20201&o=svc&host_search=' . $hostName; $obj->XML->writeElement( "s_listing_uri", - $resourceController->buildListingUri([ - 'filter' => json_encode([ - 'criterias' => [ - 'search' => 'h.name:^' . $hostName . '$', - ], - ]), - ]) + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '$statusFilter=' + : $resourceController->buildListingUri([ + 'filter' => json_encode([ + 'criterias' => [ + 'search' => 'h.name:^' . $hostName . '$', + ], + ]), + ]) + ); + $obj->XML->writeElement( + "s_listing_ok", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=ok' + : $buildServicesUri($host_name, [$okStatus]) + ); + $obj->XML->writeElement( + "s_listing_warning", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=warning' + : $buildServicesUri($host_name, [$warningStatus]) + ); + $obj->XML->writeElement( + "s_listing_critical", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=critical' + : $buildServicesUri($host_name, [$criticalStatus]) + ); + $obj->XML->writeElement( + "s_listing_unknown", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=unknown' + : $buildServicesUri($host_name, [$unknownStatus]) + ); + $obj->XML->writeElement( + "s_listing_pending", + $useDeprecatedPages + ? $serviceListingDeprecatedUri . '&statusFilter=pending' + : $buildServicesUri($host_name, [$pendingStatus]) ); - $obj->XML->writeElement("s_listing_ok", $buildServicesUri($hostName, [$okStatus])); - $obj->XML->writeElement("s_listing_warning", $buildServicesUri($hostName, [$warningStatus])); - $obj->XML->writeElement("s_listing_critical", $buildServicesUri($hostName, [$criticalStatus])); - $obj->XML->writeElement("s_listing_unknown", $buildServicesUri($hostName, [$unknownStatus])); - $obj->XML->writeElement("s_listing_pending", $buildServicesUri($hostName, [$pendingStatus])); foreach ($hostInfos['states'] as $state => $count) { $obj->XML->writeElement($state, $count); diff --git a/www/include/monitoring/status/monitoringService.php b/www/include/monitoring/status/monitoringService.php index b0b61742fd3..0462415c24d 100644 --- a/www/include/monitoring/status/monitoringService.php +++ b/www/include/monitoring/status/monitoringService.php @@ -1,6 +1,7 @@