mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°1408 - Move of the dashboard menu into the dashboard
This commit is contained in:
@@ -21,6 +21,7 @@ require_once(APPROOT.'application/dashlet.class.inc.php');
|
||||
require_once(APPROOT.'core/modelreflection.class.inc.php');
|
||||
|
||||
/**
|
||||
*
|
||||
* A user editable dashboard page
|
||||
*
|
||||
* @copyright Copyright (C) 2010-2017 Combodo SARL
|
||||
@@ -357,7 +358,7 @@ abstract class Dashboard
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oPage->add('<h1>'.htmlentities(Dict::S($this->sTitle), ENT_QUOTES, 'UTF-8', false).'</h1>');
|
||||
$oPage->add('<div class="dashboard-title">'.htmlentities(Dict::S($this->sTitle), ENT_QUOTES, 'UTF-8', false).'</div>');
|
||||
$oLayout = new $this->sLayoutClass;
|
||||
/** @var \DashboardLayoutMultiCol $oLayout */
|
||||
$oLayout->Render($oPage, $this->aCells, $bEditMode, $aExtraParams);
|
||||
@@ -634,7 +635,7 @@ class RuntimeDashboard extends Dashboard
|
||||
{
|
||||
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.iframe-transport.js');
|
||||
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.fileupload.js');
|
||||
$sEditMenu = "<td><span id=\"DashboardMenu\"><ul><li><img src=\"../images/pencil-menu.png\"><ul>";
|
||||
$sEditMenu = "<div id=\"DashboardMenu\"><ul><li><img src=\"../images/pencil-menu.png\"><ul>";
|
||||
|
||||
$aActions = array();
|
||||
$oEdit = new JSPopupMenuItem('UI:Dashboard:Edit', Dict::S('UI:Dashboard:Edit'), "return EditDashboard('{$this->sId}')");
|
||||
@@ -651,10 +652,10 @@ class RuntimeDashboard extends Dashboard
|
||||
|
||||
|
||||
$sEditMenu = addslashes($sEditMenu);
|
||||
//$sEditBtn = addslashes('<div style="display: inline-block; height: 55px; width:200px;vertical-align:center;line-height:60px;text-align:left;"><button onclick="EditDashboard(\''.$this->sId.'\');">Edit This Page</button></div>');
|
||||
|
||||
$oPage->add_ready_script(
|
||||
<<<EOF
|
||||
$('#logOffBtn').parent().before('$sEditMenu');
|
||||
$('.dashboard-title').after('$sEditMenu');
|
||||
$('#DashboardMenu>ul').popupmenu();
|
||||
|
||||
EOF
|
||||
@@ -727,6 +728,7 @@ EOF
|
||||
* @param \WebPage $oPage
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function RenderEditor($oPage)
|
||||
{
|
||||
|
||||
@@ -94,6 +94,9 @@ abstract class Dashlet
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DOMElement $oDOMNode
|
||||
*/
|
||||
public function FromDOMNode($oDOMNode)
|
||||
{
|
||||
foreach ($this->aProperties as $sProperty => $value)
|
||||
@@ -107,6 +110,9 @@ abstract class Dashlet
|
||||
$this->OnUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DOMElement $oDOMNode
|
||||
*/
|
||||
public function ToDOMNode($oDOMNode)
|
||||
{
|
||||
foreach ($this->aProperties as $sProperty => $value)
|
||||
@@ -124,6 +130,11 @@ abstract class Dashlet
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DOMElement $oDOMNode
|
||||
* @param $sProperty
|
||||
* @param $value
|
||||
*/
|
||||
protected function PropertyToDOMNode($oDOMNode, $sProperty, $value)
|
||||
{
|
||||
$sXmlValue = $this->Prop2Str($value);
|
||||
@@ -157,6 +168,12 @@ abstract class Dashlet
|
||||
$this->OnUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param bool $bEnclosingDiv
|
||||
* @param array $aExtraParams
|
||||
*/
|
||||
public function DoRender($oPage, $bEditMode = false, $bEnclosingDiv = true, $aExtraParams = array())
|
||||
{
|
||||
$sCSSClasses = implode(' ', $this->aCSSClasses);
|
||||
@@ -242,9 +259,22 @@ EOF
|
||||
return $this->sId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function Render($oPage, $bEditMode = false, $aExtraParams = array());
|
||||
|
||||
/* Rendering without the real data */
|
||||
/**
|
||||
* Rendering without the real data
|
||||
*
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$this->Render($oPage, $bEditMode, $aExtraParams);
|
||||
@@ -458,6 +488,13 @@ class DashletUnknown extends Dashlet
|
||||
$this->OnUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$aInfos = static::GetInfo();
|
||||
@@ -473,6 +510,13 @@ class DashletUnknown extends Dashlet
|
||||
$oPage->add('</div>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$aInfos = static::GetInfo();
|
||||
@@ -615,6 +659,11 @@ class DashletEmptyCell extends Dashlet
|
||||
parent::__construct($oModelReflection, $sId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$oPage->add(' ');
|
||||
@@ -647,6 +696,11 @@ class DashletPlainText extends Dashlet
|
||||
$this->aProperties['text'] = Dict::S('UI:DashletPlainText:Prop-Text:Default');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$sText = htmlentities($this->aProperties['text'], ENT_QUOTES, 'UTF-8');
|
||||
@@ -920,6 +974,13 @@ abstract class DashletGroupBy extends Dashlet
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \WebPage $oPage
|
||||
* @param bool $bEditMode
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
|
||||
{
|
||||
$sTitle = $this->aProperties['title'];
|
||||
|
||||
@@ -84,7 +84,8 @@ class ApplicationMenu
|
||||
{
|
||||
// Build menus from module handlers
|
||||
//
|
||||
foreach(MetaModel::EnumPlugins('ModuleHandlerApiInterface') as $oPHPClass)
|
||||
/** @var \ModuleHandlerApiInterface $oPHPClass */
|
||||
foreach(MetaModel::EnumPlugins('ModuleHandlerApiInterface') as $oPHPClass)
|
||||
{
|
||||
$oPHPClass::OnMenuCreation();
|
||||
}
|
||||
@@ -121,9 +122,11 @@ class ApplicationMenu
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wether a menu Id is enabled or not
|
||||
* Check whether a menu Id is enabled or not
|
||||
*
|
||||
* @param $sMenuId
|
||||
* @throws DictExceptionMissingString
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
static public function CheckMenuIdEnabled($sMenuId)
|
||||
{
|
||||
@@ -163,7 +166,9 @@ class ApplicationMenu
|
||||
}
|
||||
else
|
||||
{
|
||||
$sParentId = self::$aMenusIndex[$iParentIndex]['node']->GetMenuId();
|
||||
/** @var \MenuNode $oNode */
|
||||
$oNode = self::$aMenusIndex[$iParentIndex]['node'];
|
||||
$sParentId = $oNode->GetMenuId();
|
||||
self::$aMenusIndex[$iParentIndex]['children'][] = array ('rank' => $fRank, 'index' => $index);
|
||||
}
|
||||
|
||||
@@ -177,7 +182,9 @@ class ApplicationMenu
|
||||
else
|
||||
{
|
||||
// the menu already exists, let's combine the conditions that make it visible
|
||||
self::$aMenusIndex[$index]['node']->AddCondition($oMenuNode);
|
||||
/** @var \MenuNode $oNode */
|
||||
$oNode = self::$aMenusIndex[$index]['node'];
|
||||
$oNode->AddCondition($oMenuNode);
|
||||
}
|
||||
|
||||
return $index;
|
||||
@@ -194,7 +201,7 @@ class ApplicationMenu
|
||||
|
||||
/**
|
||||
* Entry point to display the whole menu into the web page, used by iTopWebPage
|
||||
* @param $oPage
|
||||
* @param \iTopWebPage $oPage
|
||||
* @param $aExtraParams
|
||||
* @throws DictExceptionMissingString
|
||||
*/
|
||||
@@ -260,7 +267,7 @@ EOF
|
||||
|
||||
/**
|
||||
* Handles the display of the sub-menus (called recursively if necessary)
|
||||
* @param WebPage $oPage
|
||||
* @param \iTopWebPage $oPage
|
||||
* @param array $aMenus
|
||||
* @param array $aExtraParams
|
||||
* @param int $iActiveMenu
|
||||
@@ -352,6 +359,7 @@ EOF
|
||||
static public function GetMenuIndexById($sTitle)
|
||||
{
|
||||
$index = -1;
|
||||
/** @var MenuNode[] $aMenu */
|
||||
foreach(self::$aMenusIndex as $aMenu)
|
||||
{
|
||||
if ($aMenu['node']->GetMenuId() == $sTitle)
|
||||
@@ -833,7 +841,7 @@ class OQLMenuNode extends MenuNode
|
||||
|
||||
/**
|
||||
* Set some extra parameters to be passed to the display block to fine tune its appearence
|
||||
* @param Hash $aParams paramCode => value. See DisplayBlock::GetDisplay for the meaning of the parameters
|
||||
* @param array $aParams paramCode => value. See DisplayBlock::GetDisplay for the meaning of the parameters
|
||||
*/
|
||||
public function SetParameters($aParams)
|
||||
{
|
||||
@@ -946,7 +954,7 @@ class SearchMenuNode extends MenuNode
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebPage $oPage
|
||||
* @param \iTopWebPage $oPage
|
||||
* @param array $aExtraParams
|
||||
* @return mixed|void
|
||||
* @throws DictExceptionMissingString
|
||||
@@ -1050,7 +1058,9 @@ class NewObjectMenuNode extends MenuNode
|
||||
|
||||
/**
|
||||
* @param string[] $aExtraParams
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetHyperlink($aExtraParams)
|
||||
{
|
||||
@@ -1169,7 +1179,7 @@ class DashboardMenuNode extends MenuNode
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WebPage $oPage
|
||||
* @param \iTopWebPage $oPage
|
||||
* @param string[] $aExtraParams
|
||||
* @throws CoreException
|
||||
* @throws Exception
|
||||
|
||||
@@ -56,6 +56,11 @@ abstract class ModelReflection
|
||||
abstract public function GetFiltersList($sClass);
|
||||
abstract public function IsValidFilterCode($sClass, $sFilterCode);
|
||||
|
||||
/**
|
||||
* @param string $sOQL
|
||||
*
|
||||
* @return \DBObjectSearch
|
||||
*/
|
||||
abstract public function GetQuery($sOQL);
|
||||
|
||||
abstract public function DictString($sStringCode, $sDefault = null, $bUserLanguageOnly = false);
|
||||
@@ -75,6 +80,13 @@ abstract class ModelReflection
|
||||
return vsprintf($sLocalizedFormat, $aArguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sCode
|
||||
* @param string $sLabel
|
||||
* @param string $defaultValue
|
||||
*
|
||||
* @return \RunTimeIconSelectionField
|
||||
*/
|
||||
abstract public function GetIconSelectionField($sCode, $sLabel = '', $defaultValue = '');
|
||||
|
||||
abstract public function GetRootClass($sClass);
|
||||
|
||||
@@ -2241,6 +2241,23 @@ a.summary, a.summary:hover {
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
.dashboard-title {
|
||||
display: block;
|
||||
float: left;
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
margin: 10px;
|
||||
}
|
||||
.dashboard_contents {
|
||||
width: 100%;
|
||||
}
|
||||
#DashboardMenu {
|
||||
display: block;
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
margin: 10px;
|
||||
}
|
||||
#DashboardMenu > ul > li {
|
||||
list-style: none;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -2590,6 +2590,28 @@ a.summary, a.summary:hover {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.dashboard-title {
|
||||
display: block;
|
||||
float: left;
|
||||
|
||||
color: $text-color;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.dashboard_contents {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#DashboardMenu {
|
||||
display: block;
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#DashboardMenu > ul > li {
|
||||
list-style: none;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -926,6 +926,7 @@ try
|
||||
$sId = utils::ReadParam('id', '', false, 'raw_data');
|
||||
ApplicationMenu::LoadAdditionalMenus();
|
||||
$idx = ApplicationMenu::GetMenuIndexById($sId);
|
||||
/** @var \DashboardMenuNode $oMenu */
|
||||
$oMenu = ApplicationMenu::GetMenuNode($idx);
|
||||
$oMenu->RenderEditor($oPage);
|
||||
break;
|
||||
@@ -1419,7 +1420,7 @@ EOF
|
||||
$oPage->SetContentType('text/html');
|
||||
$id = (int)utils::ReadParam('id', 0);
|
||||
$iStart = (int)utils::ReadParam('start', 0);
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length', '50'));
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length'));
|
||||
$oObj = MetaModel::GetObject($sClass, $id);
|
||||
$oObj->DisplayBareHistory($oPage, false, $iCount, $iStart);
|
||||
$oPage->add_ready_script("$('#history table.listResults').tableHover(); $('#history table.listResults').tablesorter( { widgets: ['myZebra', 'truncatedList']} );");
|
||||
@@ -1429,7 +1430,7 @@ EOF
|
||||
$oPage->SetContentType('text/html');
|
||||
$oHistoryFilter = DBSearch::unserialize($sFilter);
|
||||
$iStart = (int)utils::ReadParam('start', 0);
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length', '50'));
|
||||
$iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length'));
|
||||
$oBlock = new HistoryBlock($oHistoryFilter, 'table', false);
|
||||
$oBlock->SetLimit($iCount, $iStart);
|
||||
$oBlock->Display($oPage, 'history');
|
||||
@@ -1914,7 +1915,7 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20);
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth');
|
||||
if ($sDirection == 'up')
|
||||
{
|
||||
$oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth, true, $aContexts);
|
||||
@@ -2084,7 +2085,7 @@ EOF
|
||||
}
|
||||
|
||||
// Compute the graph
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20);
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth');
|
||||
if ($sDirection == 'up')
|
||||
{
|
||||
$oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth, true, $aContexts);
|
||||
@@ -2189,7 +2190,7 @@ EOF
|
||||
}
|
||||
|
||||
// Compute the graph
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20);
|
||||
$iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth');
|
||||
if ($sDirection == 'up')
|
||||
{
|
||||
$oRelGraph = MetaModel::GetRelatedObjectsUp($sRelation, $aSourceObjects, $iMaxRecursionDepth);
|
||||
|
||||
Reference in New Issue
Block a user