N°3191 - Introduce summary cards for objects hyperlinks (#476)

This commit is contained in:
Stephen Abello
2023-04-17 12:20:49 +02:00
committed by GitHub
parent e645e9b006
commit cf74431543
33 changed files with 573 additions and 69 deletions

View File

@@ -110,6 +110,7 @@ function DisplayPreferences($oP)
$oMiscOptionsFieldset = FieldSetUIBlockFactory::MakeStandard(Dict::S('UI:FavoriteOtherSettings'), 'ibo-fieldset-for-misc-options');
$oSecondColumn->AddSubBlock($oMiscOptionsFieldset);
$oMiscOptionsFieldset->AddSubBlock(GetObsoleteDataFieldBlock());
$oMiscOptionsFieldset->AddSubBlock(GetSummaryCardsFieldBlock());
$oP->add_script(
<<<JS
@@ -674,6 +675,33 @@ HTML;
return new Html($sHtml);
}
/**
* @return \Combodo\iTop\Application\UI\Base\iUIBlock
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MySQLException
* @since 3.1.0
*/
function GetSummaryCardsFieldBlock(): iUIBlock
{
$bShow = appUserPreferences::GetPref('show_summary_cards', true);
$sSelectedForHtmlAttribute = $bShow ? 'checked="checked"' : '';
$sLabel = Dict::S('UI:Favorites:General:ShowSummaryCards');
$sLabelDescription = Dict::S('UI:Favorites:General:ShowSummaryCards+');
$sHtml = <<<HTML
<p>
<label data-tooltip-content="{$sLabelDescription}">
<span>{$sLabel}</span>
<input type="checkbox" name="show_summary_cards" value="1" {$sSelectedForHtmlAttribute}>
</label>
</p>
HTML;
return new Html($sHtml);
}
/////////////////////////////////////////////////////////////////////////////
//
// Main program
@@ -766,6 +794,10 @@ try {
// - Obsolete data
$bShowObsoleteData = (bool)utils::ReadParam('show_obsolete_data', 0);
appUserPreferences::SetPref('show_obsolete_data', $bShowObsoleteData);
// - Summary cards
$bShowSummaryCards = (bool)utils::ReadParam('show_summary_cards', 0);
appUserPreferences::SetPref('show_summary_cards', $bShowSummaryCards);
// Redirect to force a reload/display of the page in case language has been changed
$oAppContext = new ApplicationContext();