Skip to content

Commit

Permalink
feat: Improve browser tabs names
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault authored Dec 16, 2021
1 parent e075fef commit 58a9b04
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
39 changes: 32 additions & 7 deletions front/issue.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,43 @@
PluginFormcreatorCommon::saveLayout();
$_SESSION['glpilayout'] = "lefttab";

if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader(__('Service catalog', 'formcreator'));
} else {
Html::header(__('Service catalog', 'formcreator'));
}
/** @var PluginFormcreatorIssue $issue */
$issue = PluginFormcreatorIssue::getById((int) $_REQUEST['id']);
if ($issue === false) {

if ($issue) {
$itemtype = $issue->fields['itemtype'];

// Trick to change the displayed id as Html::includeHeader() rely on request data
$old_id = $_GET['id'];
$_GET['id'] = $issue->fields['display_id'];

// Specific case, viewing a ticket from a formanswer result
if ($itemtype == PluginFormcreatorFormAnswer::class && isset($_GET['tickets_id'])) {
$itemtype = Ticket::class;
$_GET['id'] = "f_$_GET[tickets_id]";
}

$header = $itemtype::getTypeName(1);
if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader($header);
} else {
Html::header($header);
}

// Reset request param in case some other code depends on it
$_GET['id'] = $old_id;

$issue->display($_REQUEST);
} else {
$header = __('Item not found');
if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader($header);
} else {
Html::header($header);
}
PluginFormcreatorCommon::restoreLayout();
Html::displayNotFoundError();
}
$issue->display($_REQUEST);

if (Session::getCurrentInterface() == "helpdesk") {
Html::helpFooter();
Expand Down
9 changes: 7 additions & 2 deletions inc/issue.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,13 @@ public static function giveItem($itemtype, $option_id, $data, $num) {
default:
$content = '';
}
$link = self::getFormURLWithID($id) . "&itemtype=".$data['raw']['itemtype'];
$link = self::getFormURLWithID($data['id']);
$link = self::getFormURLWithID($data['id']);

// Show "final" item id in the URL
if (Toolbox::isCommonDBTM($subItemtype)) {
$link .= "&" . $subItemtype::getForeignKeyField() . "=$id";
}

$key = 'id';
$tooltip = Html::showToolTip(nl2br(RichText::getTextFromHtml($content)), [
'applyto' => $itemtype.$data['raw'][$key],
Expand Down

0 comments on commit 58a9b04

Please sign in to comment.