N°1070: Enhance ergonomics of "Add To Dashboard..." popup window

* Larger window to avoid the scrollbar.
* Check the dashboards root parent access rights to generate the dashboards list proposed in the popup.

SVN:trunk[5185]
This commit is contained in:
Eric Espié
2018-01-02 13:08:14 +00:00
parent fe23e099fe
commit f73ca10b6c

View File

@@ -765,11 +765,35 @@ EOF
$sRootMenuId = ApplicationMenu::GetRootMenuId($sContextMenuId); $sRootMenuId = ApplicationMenu::GetRootMenuId($sContextMenuId);
$aAllowedDashboards = array(); $aAllowedDashboards = array();
$sDefaultDashboard = null; $sDefaultDashboard = null;
// Store the parent menus for acces check
$aParentMenus = array();
foreach($aAllMenus as $idx => $aMenu)
{
/** @var MenuNode $oMenu */
$oMenu = $aMenu['node'];
if (count(ApplicationMenu::GetChildren($oMenu->GetIndex())) > 0)
{
$aParentMenus[$oMenu->GetMenuId()] = $aMenu;
}
}
foreach($aAllMenus as $idx => $aMenu) foreach($aAllMenus as $idx => $aMenu)
{ {
$oMenu = $aMenu['node']; $oMenu = $aMenu['node'];
if ($oMenu instanceof DashboardMenuNode)
{
// Get the root parent for access check
$sParentId = $aMenu['parent']; $sParentId = $aMenu['parent'];
if (($oMenu instanceof DashboardMenuNode) && ($oMenu->IsEnabled())) $aParentMenu = $aParentMenus[$sParentId];
while (isset($aParentMenus[$aParentMenu['parent']]))
{
// grand parent exists
$sParentId = $aParentMenu['parent'];
$aParentMenu = $aParentMenus[$sParentId];
}
$oParentMenu = $aParentMenu['node'];
if ($oMenu->IsEnabled() && $oParentMenu->IsEnabled())
{ {
$sMenuLabel = $oMenu->GetTitle(); $sMenuLabel = $oMenu->GetTitle();
$sParentLabel = Dict::S('Menu:'.$sParentId); $sParentLabel = Dict::S('Menu:'.$sParentId);
@@ -786,6 +810,7 @@ EOF
$sDefaultDashboard = $oMenu->GetMenuId(); $sDefaultDashboard = $oMenu->GetMenuId();
} }
} }
}
} }
asort($aAllowedDashboards); asort($aAllowedDashboards);
@@ -849,7 +874,7 @@ EOF
$oPage->add_ready_script( $oPage->add_ready_script(
<<<EOF <<<EOF
$('#dashlet_creation_dlg').dialog({ $('#dashlet_creation_dlg').dialog({
width: 500, width: 600,
modal: true, modal: true,
title: '$sDialogTitle', title: '$sDialogTitle',
buttons: [ buttons: [