N°1350 - Audit: Title, breadcrumb, back button and link to configure

This commit is contained in:
vdumas
2023-06-09 20:13:26 +02:00
parent 4d6236cbea
commit b5a637fa11
3 changed files with 72 additions and 50 deletions

View File

@@ -760,18 +760,28 @@ We hope youll enjoy this version as much as we enjoyed imagining and creating
'UI:CSVExport:LostChars' => 'Encoding issue',
'UI:CSVExport:LostChars+' => 'The downloaded file will be encoded into %1$s. '.ITOP_APPLICATION_SHORT.' has detected some characters that are not compatible with this format. Those characters will either be replaced by a substitute (e.g. accentuated chars losing the accent), or they will be discarded. You can copy/paste the data from your web browser. Alternatively, you can contact your administrator to change the encoding (See parameter \'csv_file_default_charset\').',
'UI:Audit:Title' => ITOP_APPLICATION_SHORT.' - CMDB Audit',
'UI:Audit:InteractiveAudit' => 'Audit results',
'UI:Audit:InteractiveAudit:Back' => 'Back to audit results',
'UI:Audit:InteractiveAudit:ForCategories' => 'Audit for categories',
'UI:Audit:InteractiveAudit:Selection' => 'Audit - Domain Selection',
'UI:Audit:InteractiveAudit:Selection+' => 'Select a domain to get the result for selected domain',
'UI:Audit:InteractiveAudit:Selection:All' => 'All categories',
'UI:Audit:InteractiveAudit:AllCategories' => 'For all categories',
'UI:Audit:InteractiveAudit:SelectedCategories' => 'Restricted to %1$s categories / category',
'UI:Audit:InteractiveAudit:SelectedDomain' => 'Restricted to the domain: %1$s',
'UI:Audit:Title' => ITOP_APPLICATION_SHORT.' - CMDB Audit',
'UI:Audit:Interactive:All:Title' => 'Audit results',
'UI:Audit:Interactive:All:SubTitle' => 'Full audit: includes all rules, all categories, all domains',
'UI:Audit:Interactive:All:BreadCrumb' => 'Full audit',
'UI:Audit:Interactive:All:BreadCrumb+' => 'Audit results for all rules',
'UI:Audit:Interactive:Categories:Title' => 'Audit results for categories: %1$s',
'UI:Audit:Interactive:Categories:SubTitle' => 'Audit results for all the rules belonging to one of those %1$s categories',
'UI:Audit:Interactive:Categories:BreadCrumb' => 'Categories',
'UI:Audit:Interactive:Categories:BreadCrumb+' => 'Audit categories: %1$s',
'UI:Audit:Interactive:Domain:Title' => 'Audit results for Domain: %1$s',
'UI:Audit:Interactive:Domain:SubTitle' => 'Audit results for all the rules belonging to a category related to the domain: %1$s',
'UI:Audit:Interactive:Domain:BreadCrumb' => '%1$s',
'UI:Audit:Interactive:Domain:BreadCrumb+' => 'Audit for Domain: %1$s',
'UI:Audit:Interactive:Selection:Title' => 'Selection of an audit',
'UI:Audit:Interactive:Selection:SubTitle' => 'Select a domain to get the results limited to this domain or select "All categories" to get a full audit (can take time or even fail if too much data to audit)',
'UI:Audit:Interactive:Selection:BreadCrumb' => 'Selection',
'UI:Audit:Interactive:Selection:BreadCrumb+' => 'Selection of an Audit to run',
'UI:Audit:Interactive:Selection:BadgeAll' => 'All categories',
'UI:Audit:Interactive:Button:Back' => 'Back to the audit',
'UI:Audit:ViewRules' => 'Check the rules',
'UI:Audit:ModifyCategory' => 'Edit the audit category',
'UI:Audit:HeaderAuditRule' => 'Audit Rule',
'UI:Audit:HeaderNbObjects' => '# Objects',
'UI:Audit:HeaderNbErrors' => '# Errors',

View File

@@ -744,18 +744,28 @@ Nous espérons que vous aimerez cette version autant que nous avons eu du plaisi
'UI:CSVExport:LostChars' => 'Problème d\'encodage',
'UI:CSVExport:LostChars+' => 'Le fichier téléchargé sera encodé en %1$s. iTop a détecté des caractères incompatible avec ce format. Ces caractères seront soit remplacés par des caractères de substitution (par exemple: \'é\' transformé en \'e\'), soit perdus. Vous pouvez utiliser le copier/coller depuis votre navigateur web, ou bien contacter votre administrateur pour que l\'encodage corresponde mieux à votre besoin (Cf. paramètre \'csv_file_default_charset\').',
'UI:Audit:Title' => ITOP_APPLICATION_SHORT.' - Audit de la CMDB',
'UI:Audit:InteractiveAudit' => 'Résultats d\'audit',
'UI:Audit:InteractiveAudit:Back' => 'Retour à l\'audit complet',
'UI:Audit:InteractiveAudit:ForCategories' => 'Audit de catégories',
'UI:Audit:InteractiveAudit:Selection' => 'Sélection d\'un audit',
'UI:Audit:InteractiveAudit:Selection+' => 'Choisir un domaine pour obtenir les résultats d\'audit limités à ce domaine ou l\'"Audit intégral" mais qui peut échouer s\'il y a trop de régles et d\'objets à auditer',
'UI:Audit:InteractiveAudit:Selection:All' => 'Audit intégral',
'UI:Audit:InteractiveAudit:AllCategories' => 'Complet, incluant toutes les régles, sans limitation de domain ni de catégorie',
'UI:Audit:InteractiveAudit:SelectedCategories' => 'Limités à %1$s catégorie(s)',
'UI:Audit:InteractiveAudit:SelectedDomain' => 'Limités au domaine : %1$s',
'UI:Audit:ViewRules' => 'Vérifier les régles d\'audit',
'UI:Audit:ModifyCategory' => 'Editer la catégorie d\'audit',
'UI:Audit:Title' => ITOP_APPLICATION_SHORT.' - Audit de la CMDB',
'UI:Audit:Interactive:All:Title' => 'Résultats de tous les audits',
'UI:Audit:Interactive:All:SubTitle' => 'Audit complet, incluant toutes les régles, sans limitation de domaine ni de catégorie',
'UI:Audit:Interactive:All:BreadCrumb' => 'Audit complet',
'UI:Audit:Interactive:All:BreadCrumb+' => 'Audit de toutes les régles',
'UI:Audit:Interactive:Categories:Title' => 'Résultats d\'audit des catégories : %1$s',
'UI:Audit:Interactive:Categories:SubTitle' => 'Audit de toutes les régles appartenant à ces %1$s catégories',
'UI:Audit:Interactive:Categories:BreadCrumb' => 'Catégories',
'UI:Audit:Interactive:Categories:BreadCrumb+' => 'Audit des catégories : %1$s',
'UI:Audit:Interactive:Domain:Title' => 'Résultats d\'audit du domaine : %1$s',
'UI:Audit:Interactive:Domain:SubTitle' => 'Audit de toutes les régles dont la catégorie est reliée au domaine : %1$s',
'UI:Audit:Interactive:Domain:BreadCrumb' => '%1$s',
'UI:Audit:Interactive:Domain:BreadCrumb+' => 'Audit du domaine : %1$s',
'UI:Audit:Interactive:Selection:Title' => 'Sélection d\'un audit',
'UI:Audit:Interactive:Selection:SubTitle' => 'Choisir un domaine pour obtenir les résultats d\'audit limités à ce domaine ou "Toutes les catégories" (Peut prendre du temps, voir échouer s\'il y a trop d\'objets à auditer)',
'UI:Audit:Interactive:Selection:BreadCrumb' => 'Sélection',
'UI:Audit:Interactive:Selection:BreadCrumb+' => 'Choix d\'un Audit à exécuter',
'UI:Audit:Interactive:Selection:BadgeAll' => 'Toutes les catégories',
'UI:Audit:Interactive:Button:Back' => 'Retour à l\'audit',
'UI:Audit:ViewRules' => 'Vérifier les régles d\'audit',
'UI:Audit:HeaderAuditRule' => 'Règle d\'audit',
'UI:Audit:HeaderNbObjects' => 'Nb d\'Objets',
'UI:Audit:HeaderNbErrors' => 'Nb d\'Erreurs',
@@ -772,7 +782,6 @@ Nous espérons que vous aimerez cette version autant que nous avons eu du plaisi
'UI:Audit:Dashboard:ObjectsValidated' => 'Objets valides',
'UI:Audit:AuditCategory:Subtitle' => '%1$s en erreur sur %2$s - %3$s%% des objets sont valides',
'UI:RunQuery:Title' => ITOP_APPLICATION_SHORT.' - Evaluation de requêtes OQL',
'UI:RunQuery:QueryExamples' => 'Exemples de requêtes',
'UI:RunQuery:QueryResults' => 'Résultats de la requête',

View File

@@ -245,7 +245,7 @@ try
$sDescription = get_class($oAuditRule).": ".$oAuditRule->GetName();
$oP->SetBreadCrumbEntry('ui-tool-auditerrors', $sTitle, $sDescription, '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink());
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-chevron-left', Dict::S('UI:Audit:Interactive:Button:Back'), "./audit.php?".$oAppContext->GetForLink());
$oP->AddUiBlock($oBackButton);
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle.$oAuditRule->Get('description')));
$sBlockId = 'audit_errors';
@@ -258,9 +258,9 @@ try
break;
case 'selection':
$oP->SetBreadCrumbEntry('ui-tool-auditselection', Dict::S('Menu:Audit'), Dict::S('UI:Audit:InteractiveAudit:Selection'), '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:Audit:InteractiveAudit:Selection')));
$oP->AddUiBlock(new Text(Dict::S('UI:Audit:InteractiveAudit:Selection+')));
$oP->SetBreadCrumbEntry('ui-tool-auditselection', Dict::S('UI:Audit:Interactive:Selection:BreadCrumb'), Dict::S('UI:Audit:Interactive:Selection:BreadCrumb+'), '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:Audit:Interactive:Selection:Title')));
$oP->AddUiBlock(new Text(Dict::S('UI:Audit:Interactive:Selection:SubTitle')));
// Header block to select all audit categories
$oCategoriesSet = new DBObjectSet(new DBObjectSearch('AuditCategory'));
@@ -277,7 +277,7 @@ try
'../images/icons/icons8-audit.svg',
utils::GetAbsoluteUrlAppRoot()."pages/audit.php?operation=audit",
$iCategoryCount,
Dict::S('UI:Audit:InteractiveAudit:Selection:All')
Dict::S('UI:Audit:Interactive:Selection:BadgeAll')
));
$oDashboardColumn->AddUIBlock($oAllCategoriesDashlet);
$oP->AddUiBlock($oDashboardRow);
@@ -318,30 +318,38 @@ try
default:
$sDomainKey = utils::ReadParam('domain', '');
$sCategories = utils::ReadParam('categories', '', false, utils::ENUM_SANITIZATION_FILTER_STRING); // May contain commas
// Default case, full audit
$oCategoriesSet = new DBObjectSet(new DBObjectSearch('AuditCategory'));
$sSubTitle = Dict::S('UI:Audit:InteractiveAudit:AllCategories');
$sBreadCrumbLabel = Dict::S('Menu:Audit');
$sBreadCrumbDescription = Dict::S('UI:Audit:InteractiveAudit');
if (!empty($sCategories)) {
$sTitle = Dict::S('UI:Audit:Interactive:All:Title');
$sSubTitle = Dict::S('UI:Audit:Interactive:All:SubTitle');
$sBreadCrumbLabel = Dict::S('UI:Audit:Interactive:All:BreadCrumb');
$sBreadCrumbTooltip = Dict::S('UI:Audit:Interactive:All:BreadCrumb+');
if (!empty($sCategories)) { // Case with a set of categories
$oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory WHERE id IN (:categories)", array('categories' => explode(',', $sCategories))));
$sSubTitle = Dict::Format('UI:Audit:InteractiveAudit:SelectedCategories', $oCategoriesSet->Count());
$sBreadCrumbLabel = Dict::S('UI:Audit:InteractiveAudit:ForCategories');
} elseif (!empty($sDomainKey)) {
$sCategories = implode(", ", $oCategoriesSet->GetColumnAsArray('name'));
$oCategoriesSet->Rewind();
$sTitle = Dict::Format('UI:Audit:Interactive:Categories:Title', $sCategories);
$sSubTitle = Dict::Format('UI:Audit:Interactive:Categories:SubTitle', $oCategoriesSet->Count());
$sBreadCrumbLabel = Dict::Format('UI:Audit:Interactive:Categories:BreadCrumb', $oCategoriesSet->Count());
$sBreadCrumbTooltip = Dict::Format('UI:Audit:Interactive:Categories:BreadCrumb+', $sCategories);
} elseif (!empty($sDomainKey)) { // Case with a single Domain
$oAuditDomain = MetaModel::GetObject('AuditDomain', $sDomainKey);
$oCategoriesSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT AuditCategory AS c JOIN lnkAuditCategoryToAuditDomain AS lnk ON lnk.category_id = c.id WHERE lnk.domain_id = :domain", array('domain' => $oAuditDomain->GetKey())));
$sSubTitle = Dict::Format('UI:Audit:InteractiveAudit:SelectedDomain', $oAuditDomain->GetName());
$sBreadCrumbLabel = $oAuditDomain->GetName();
$sDomainName = $oAuditDomain->GetName();
$sTitle = Dict::Format('UI:Audit:Interactive:Domain:Title', $sDomainName);
$sSubTitle = Dict::Format('UI:Audit:Interactive:Domain:SubTitle', $sDomainName);
$sBreadCrumbLabel = Dict::Format('UI:Audit:Interactive:Domain:BreadCrumb', $sDomainName);
$sBreadCrumbTooltip = Dict::Format('UI:Audit:Interactive:Domain:BreadCrumb+', $sDomainName);
}
$oP->SetBreadCrumbEntry('ui-tool-audit', $sBreadCrumbLabel, $sSubTitle, '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$oBackButton = ButtonUIBlockFactory::MakeIconLink('fas fa-stethoscope fa-lg', Dict::S('UI:Audit:InteractiveAudit:Back'), "./audit.php?".$oAppContext->GetForLink());
$oP->SetBreadCrumbEntry('ui-tool-audit', $sBreadCrumbLabel, $sBreadCrumbTooltip, '', 'fas fa-stethoscope', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$oBackButton = ButtonUIBlockFactory::MakeLinkNeutral("./audit.php?".$oAppContext->GetForLink(), Dict::S('UI:Audit:Interactive:Button:Back'), 'fas fa-chevron-left');
$oP->AddUiBlock($oBackButton);
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:Audit:InteractiveAudit')));
$oP->AddUiBlock(TitleUIBlockFactory::MakeForPage($sTitle));
$oP->AddUiBlock(new Text($sSubTitle));
$oTotalBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-audit.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsAudited'));
$oErrorBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-delete.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsInError'));
$oWorkingBlock = DashletFactory::MakeForDashletBadge('../images/icons/icons8-checkmark.svg', '#', 0, Dict::S('UI:Audit:Dashboard:ObjectsValidated'));
@@ -374,8 +382,6 @@ try
$oP->AddUiBlock($oDashboardRow);
$oRouter = \Combodo\iTop\Service\Router\Router::GetInstance();
$aAuditCategoryPanels = [];
/** @var AuditCategory $oAuditCategory */
while ($oAuditCategory = $oCategoriesSet->fetch()) {
@@ -387,10 +393,7 @@ try
// Add a button in the above toolbar
$sAuditCategoryClass = get_class($oAuditCategory);
if (UserRights::IsActionAllowed($sAuditCategoryClass, UR_ACTION_READ)) {
$oToolbar->AddSubBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-eye', Dict::S('UI:Audit:ViewRules'), ApplicationContext::MakeObjectUrl($sAuditCategoryClass, $oAuditCategory->GetKey()).'&#ObjectProperties=tab_ClassAuditCategoryAttributerules_list'));
}
if (UserRights::IsActionAllowed($sAuditCategoryClass, UR_ACTION_MODIFY)) {
$oToolbar->AddSubBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-pen', Dict::S('UI:Audit:ModifyCategory'), $oRouter->GenerateUrl('object.modify', ['class' => $sAuditCategoryClass, 'id' => $oAuditCategory->GetKey()])));
$oToolbar->AddSubBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-wrench fa-lg', Dict::S('UI:Audit:ViewRules'), ApplicationContext::MakeObjectUrl($sAuditCategoryClass, $oAuditCategory->GetKey()).'&#ObjectProperties=tab_ClassAuditCategoryAttributerules_list'),);
}
$aResults = array();
try {