N°3207 - Global search: Add possibility to open history items in a new tab

This commit is contained in:
Molkobain
2021-01-21 15:50:04 +01:00
parent 63c1a1d2d3
commit fa0ea7ed77
3 changed files with 16 additions and 12 deletions

View File

@@ -107,18 +107,22 @@ class GlobalSearchHelper
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
static::TruncateHistory($aHistoryEntries);
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
{
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html']))
{
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($aHistoryEntries[$iIdx]['query']);
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++){
$sRawQuery = $aHistoryEntries[$iIdx]['query'];
// Make icon URL absolute
if(isset($aHistoryEntries[$iIdx]['icon_url'])){
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
}
// Set absolute URL
if(isset($aHistoryEntries[$iIdx]['icon_url']))
{
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
// Add HTML label if missing
if(!isset($aHistoryEntries[$iIdx]['label_html'])) {
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($sRawQuery);
}
// Add URL
if(!isset($aHistoryEntries[$iIdx]['target_url'])){
$aHistoryEntries[$iIdx]['target_url'] = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=full_text&text='.urlencode($sRawQuery);
}
}

View File

@@ -111,7 +111,7 @@ class QuickCreateHelper
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml(MetaModel::GetName($sClass));
}
// Add url
// Add URL
if(!isset($aHistoryEntries[$iIdx]['target_url']))
{
$aHistoryEntries[$iIdx]['target_url'] = DBObject::ComputeStandardUIPage($sClass).'?operation=new&class='.$sClass;

View File

@@ -22,7 +22,7 @@
</div>
{% elseif oUIBlock.GetLastQueries()|length > 0 %}
{% for aQuery in oUIBlock.GetLastQueries() %}
<a href="#" class="ibo-global-search--compartment-element" data-role="ibo-global-search--compartment-element" data-query-raw="{{ aQuery.query }}" title="{{ aQuery.query }}">
<a href="{{ aQuery.target_url }}" class="ibo-global-search--compartment-element" data-role="ibo-global-search--compartment-element" data-query-raw="{{ aQuery.query }}" title="{{ aQuery.query }}">
{% if aQuery.icon_url is defined %}
<img src="{{ aQuery.icon_url}}" class="ibo-global-search--compartment-element-image">
{% endif %}