mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
Add Popover menu and subitems such as URL and JS items.
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Combodo\iTop\Application\UI\Component\PopoverMenu;
|
||||
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem\PopupMenuItemFactory;
|
||||
use Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
|
||||
use Dict;
|
||||
use JSPopupMenuItem;
|
||||
use MetaModel;
|
||||
@@ -87,7 +87,7 @@ class PopoverMenuFactory
|
||||
$aAllowedPortal['url'],
|
||||
'_blank'
|
||||
);
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem($oPopupMenuItem);
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem($oPopupMenuItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class PopoverMenuFactory
|
||||
$aItems = [];
|
||||
|
||||
// Preferences
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:Preferences',
|
||||
Dict::S('UI:Preferences'),
|
||||
@@ -117,7 +117,7 @@ class PopoverMenuFactory
|
||||
// Archive mode
|
||||
if(true === utils::IsArchiveMode())
|
||||
{
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new JSPopupMenuItem(
|
||||
'UI:ArchiveModeOff',
|
||||
Dict::S('UI:ArchiveModeOff'),
|
||||
@@ -127,7 +127,7 @@ class PopoverMenuFactory
|
||||
}
|
||||
elseif(UserRights::CanBrowseArchive())
|
||||
{
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new JSPopupMenuItem(
|
||||
'UI:ArchiveModeOn',
|
||||
Dict::S('UI:ArchiveModeOn'),
|
||||
@@ -139,7 +139,7 @@ class PopoverMenuFactory
|
||||
// Logoff
|
||||
if(utils::CanLogOff())
|
||||
{
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:LogOffMenu',
|
||||
Dict::S('UI:LogOffMenu'),
|
||||
@@ -151,7 +151,7 @@ class PopoverMenuFactory
|
||||
// Change password
|
||||
if (UserRights::CanChangePassword())
|
||||
{
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:ChangePwdMenu',
|
||||
Dict::S('UI:ChangePwdMenu'),
|
||||
@@ -175,7 +175,7 @@ class PopoverMenuFactory
|
||||
$aItems = [];
|
||||
|
||||
// Online documentation
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:Help',
|
||||
Dict::S('UI:Help'),
|
||||
@@ -185,7 +185,7 @@ class PopoverMenuFactory
|
||||
);
|
||||
|
||||
// About box
|
||||
$aItems[] = PopupMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new JSPopupMenuItem(
|
||||
'UI:AboutBox',
|
||||
Dict::S('UI:AboutBox'),
|
||||
|
||||
@@ -20,14 +20,38 @@
|
||||
namespace Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
use JSPopupMenuItem;
|
||||
|
||||
/**
|
||||
* Class JsPopoverMenuItem
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem
|
||||
* @property \JSPopupMenuItem $oPopupMenuItem
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class JsPopoverMenuItem extends PopoverMenuItem
|
||||
{
|
||||
const HTML_TEMPLATE_REL_PATH = 'components/popover-menu/item/mode_js';
|
||||
|
||||
public function GetJsCode()
|
||||
{
|
||||
return $this->oPopupMenuItem->GetJSCode();
|
||||
}
|
||||
|
||||
/** @ignore */
|
||||
public function GetUrl()
|
||||
{
|
||||
return $this->oPopupMenuItem->GetUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetJsFilesUrlRecursively($bAbsoluteUrl = false)
|
||||
{
|
||||
$aJsFiles = array_merge(parent::GetJsFilesUrlRecursively($bAbsoluteUrl), $this->oPopupMenuItem->GetLinkedScripts());
|
||||
return $aJsFiles;
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ use URLPopupMenuItem;
|
||||
* @internal
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class PopupMenuItemFactory
|
||||
class PopoverMenuItemFactory
|
||||
{
|
||||
/**
|
||||
* Make a standard NavigationMenu layout for backoffice pages
|
||||
@@ -25,9 +25,22 @@ namespace Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem;
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenuItem
|
||||
* @property \URLPopupMenuItem $oPopupMenuItem
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class UrlPopoverMenuItem extends PopoverMenuItem
|
||||
{
|
||||
const HTML_TEMPLATE_REL_PATH = 'components/popover-menu/item/mode_url';
|
||||
|
||||
/** @ignore */
|
||||
public function GetUrl()
|
||||
{
|
||||
return $this->oPopupMenuItem->GetUrl();
|
||||
}
|
||||
|
||||
/** @ignore */
|
||||
public function GetTarget()
|
||||
{
|
||||
return $this->oPopupMenuItem->GetTarget();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user