Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete legacy home page #18055

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front/central.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
if ($_SESSION['glpiactiveprofile']['create_ticket_on_login']) {
Html::redirect($CFG_GLPI['root_doc'] . "/ServiceCatalog");
} else {
Html::redirect($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php");
Html::redirect($CFG_GLPI['root_doc'] . "/Helpdesk");
}
}
$_SESSION['_redirected_from_profile_selector'] = true;
Expand Down
140 changes: 0 additions & 140 deletions front/helpdesk.public.php

This file was deleted.

109 changes: 0 additions & 109 deletions front/tracking.injector.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ public static function redirectIfAuthenticated($redirect = null)
if ($_SESSION['glpiactiveprofile']['create_ticket_on_login']) {
Html::redirect($CFG_GLPI['root_doc'] . "/ServiceCatalog");
}
Html::redirect($CFG_GLPI['root_doc'] . "/front/helpdesk.public.php");
Html::redirect($CFG_GLPI['root_doc'] . "/Helpdesk");
} else {
if ($_SESSION['glpiactiveprofile']['create_ticket_on_login']) {
Html::redirect(Ticket::getFormURL());
Expand Down
2 changes: 1 addition & 1 deletion src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -3066,7 +3066,7 @@ public static function getEntitySelectorTree(): array

$base_path = $CFG_GLPI['root_doc'] . "/front/central.php";
if (Session::getCurrentInterface() === 'helpdesk') {
$base_path = $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php";
$base_path = $CFG_GLPI["root_doc"] . "/Helpdesk";
}

$ancestors = getAncestorsOf('glpi_entities', $_SESSION['glpiactive_entity']);
Expand Down
2 changes: 1 addition & 1 deletion src/Glpi/Application/View/Extension/RoutingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function indexPath(): string
$index = '/index.php';
if (Session::getLoginUserID() !== false) {
$index = Session::getCurrentInterface() == 'helpdesk'
? 'front/helpdesk.public.php'
? 'Home'
: 'front/central.php';
}
return Html::getPrefixedUrl($index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use User;
use Session;

final class HomeController extends AbstractController
final class IndexController extends AbstractController
{
private TilesManager $tiles_manager;

Expand All @@ -54,19 +56,28 @@ public function __construct()

#[SecurityStrategy(Firewall::STRATEGY_HELPDESK_ACCESS)]
#[Route(
"/Home",
"/Helpdesk",
name: "glpi_selfservice_home",
methods: "GET"
)]
// Prevent old links from breaking
#[Route(
'/front/helpdesk.public.php',
name: "glpi_selfservice_home_deprecated",
methods: "GET"
)]
public function __invoke(Request $request): Response
{
$user = User::getById(Session::getLoginUserID());

// Will rename the file to "home.html.twig" later, don't want to remove
// the original file yet.
return $this->render('pages/self-service/new_home.html.twig', [
return $this->render('pages/self-service/index.html.twig', [
'title' => __("Home"),
'menu' => ['helpdesk-home'],
'tiles' => $this->tiles_manager->getTiles(),
'tabs' => new HomePageTabs(),
'password_alert' => $user->getPasswordExpirationMessage(),
]);
}
}
6 changes: 3 additions & 3 deletions src/Glpi/Form/SelfService/TilesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public function getTiles(): array
title: __("View RSS feeds"),
description: __("Checkout new data from your saved RSS feeds."),
illustration: "view-feed.svg",
// TODO: create dedicated RSS page, the only place they are
// visible is on the dashboard of the legacy home page.
link: "/front/helpdesk.public.php"
// TODO: replace this default tile by something more useful, rss
// feeds are already displayed on the home page using a tab
link: "/Helpdesk"
);

return $tiles;
Expand Down
2 changes: 1 addition & 1 deletion src/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,7 @@ public static function generateHelpMenu()

$menu = [
'home' => [
'default' => '/front/helpdesk.public.php',
'default' => '/Helpdesk',
'title' => __('Home'),
'icon' => 'fas fa-home',
],
Expand Down
6 changes: 3 additions & 3 deletions src/Toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ public static function manageRedirect($where)
if ($matches[1] !== $CFG_GLPI['url_base']) {
Session::addMessageAfterRedirect(__s('Redirection failed'));
if (Session::getCurrentInterface() === "helpdesk") {
Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk");
} else {
Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php");
}
Expand Down Expand Up @@ -1566,7 +1566,7 @@ public static function manageRedirect($where)
}
}

Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk");
// phpcs doesn't understand that the script will exit here so we need a comment to avoid the fallthrough warning

case "preference":
Expand All @@ -1578,7 +1578,7 @@ public static function manageRedirect($where)
// phpcs doesn't understand that the script will exit here so we need a comment to avoid the fallthrough warning

default:
Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
Html::redirect($CFG_GLPI["root_doc"] . "/Helpdesk");
}
// @phpstan-ignore deadCode.unreachable (defensive programming)
break;
Expand Down
2 changes: 1 addition & 1 deletion templates/layout/parts/profile_selector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

{% set target = path("front/central.php") %}
{% if get_current_interface() == "helpdesk" %}
{% set target = path("front/helpdesk.public.php") %}
{% set target = path("home") %}
{% endif %}

{% set current_entity = session('glpiactive_entity_name') %}
Expand Down
Loading