mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-01 07:04:16 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa9c92c8d8 | ||
|
|
bf864bee78 |
@@ -270,6 +270,29 @@ class UserRightsMatrix extends UserRightsAddOnAPI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Create the "My Bookmarks" menu item (parent_id = 0, rank = 6)
|
||||||
|
if ($bNewUser)
|
||||||
|
{
|
||||||
|
$bAddMenu = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT menuNode WHERE type = 'user' AND parent_id = 0 AND user_id = $iUserId"));
|
||||||
|
$bAddMenu = ($oSet->Count() < 1);
|
||||||
|
}
|
||||||
|
if ($bAddMenu)
|
||||||
|
{
|
||||||
|
$oMenu = MetaModel::NewObject('menuNode');
|
||||||
|
$oMenu->Set('type', 'user');
|
||||||
|
$oMenu->Set('parent_id', 0); // It's a toplevel entry
|
||||||
|
$oMenu->Set('rank', 6); // Located just above the Admin Tools section (=7)
|
||||||
|
$oMenu->Set('name', 'My Bookmarks');
|
||||||
|
$oMenu->Set('label', 'My Favorite Items');
|
||||||
|
$oMenu->Set('hyperlink', 'UI.php');
|
||||||
|
$oMenu->Set('template', '<p></p><p></p><p style="text-align:center; font-family:Georgia, Times, serif; font-size:32px;">My bookmarks</p><p style="text-align:center; font-family:Georgia, Times, serif; font-size:14px;"><i>This section contains my most favorite search results</i></p>');
|
||||||
|
$oMenu->Set('user_id', $iUserId);
|
||||||
|
$oMenu->DBInsert();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -89,14 +89,17 @@ class menuNode extends DBObject
|
|||||||
return $this->Get('hyperlink')."?".implode("&", $aParams);
|
return $this->Get('hyperlink')."?".implode("&", $aParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetChildNodesSet($sType)
|
public function GetChildNodesSet($sType = null)
|
||||||
{
|
{
|
||||||
$oSearchFilter = new DBObjectSearch("menuNode");
|
$oSearchFilter = new DBObjectSearch("menuNode");
|
||||||
$oSearchFilter->AddCondition('parent_id', $this->GetKey(), '=');
|
$oSearchFilter->AddCondition('parent_id', $this->GetKey(), '=');
|
||||||
$oSearchFilter->AddCondition('type', $sType, '=');
|
if ($sType != null)
|
||||||
if ($sType == 'user')
|
|
||||||
{
|
{
|
||||||
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
$oSearchFilter->AddCondition('type', $sType, '=');
|
||||||
|
if ($sType == 'user')
|
||||||
|
{
|
||||||
|
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$oSet = new CMDBObjectSet($oSearchFilter, array('rank' => true));
|
$oSet = new CMDBObjectSet($oSearchFilter, array('rank' => true));
|
||||||
return $oSet;
|
return $oSet;
|
||||||
@@ -184,10 +187,13 @@ class menuNode extends DBObject
|
|||||||
{
|
{
|
||||||
$oSearchFilter = new DbObjectSearch("menuNode");
|
$oSearchFilter = new DbObjectSearch("menuNode");
|
||||||
$oSearchFilter->AddCondition('parent_id', 0, '=');
|
$oSearchFilter->AddCondition('parent_id', 0, '=');
|
||||||
$oSearchFilter->AddCondition('type', $sType, '=');
|
if ($sType != null)
|
||||||
if ($sType == 'user')
|
|
||||||
{
|
{
|
||||||
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
$oSearchFilter->AddCondition('type', $sType, '=');
|
||||||
|
if ($sType == 'user')
|
||||||
|
{
|
||||||
|
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$oRootSet = new CMDBObjectSet($oSearchFilter, array('rank' => true));
|
$oRootSet = new CMDBObjectSet($oSearchFilter, array('rank' => true));
|
||||||
while($oNode = $oRootSet->Fetch())
|
while($oNode = $oRootSet->Fetch())
|
||||||
@@ -207,10 +213,13 @@ class menuNode extends DBObject
|
|||||||
$oSearchFilter = new DBObjectSearch("menuNode");
|
$oSearchFilter = new DBObjectSearch("menuNode");
|
||||||
$oSearchFilter->AddCondition('parent_id', $this->Get('parent_id'));
|
$oSearchFilter->AddCondition('parent_id', $this->Get('parent_id'));
|
||||||
$oSearchFilter->AddCondition('rank', $this->Get('rank'), '>');
|
$oSearchFilter->AddCondition('rank', $this->Get('rank'), '>');
|
||||||
$oSearchFilter->AddCondition('type', $sType, '=');
|
if ($sType != null)
|
||||||
if ($sType == 'user')
|
|
||||||
{
|
{
|
||||||
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
$oSearchFilter->AddCondition('type', $sType, '=');
|
||||||
|
if ($sType == 'user')
|
||||||
|
{
|
||||||
|
$oSearchFilter->AddCondition('user_id', UserRights::GetUserId(), '=');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$oSet = new DBObjectSet($oSearchFilter, array('rank'=> true)); // Order by rank (true means ascending)
|
$oSet = new DBObjectSet($oSearchFilter, array('rank'=> true)); // Order by rank (true means ascending)
|
||||||
return $oSet;
|
return $oSet;
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ if ($oFilter != null)
|
|||||||
$oResultBlock->RenderContent($oP);
|
$oResultBlock->RenderContent($oP);
|
||||||
|
|
||||||
// Menu node
|
// Menu node
|
||||||
$sFilter = $oFilter->ToSibusQL();
|
$sFilter = $oFilter->ToOQL();
|
||||||
$sMenuNodeContent = <<<EOF
|
$sMenuNodeContent = <<<EOF
|
||||||
<div id="TopPane">
|
<div id="TopPane">
|
||||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">$sFilter</itopblock>
|
<itopblock BlockClass="DisplayBlock" type="search" asynchronous="false" encoding="text/oql">$sFilter</itopblock>
|
||||||
</div>
|
</div>
|
||||||
<div id="BottomPane">
|
<div id="BottomPane">
|
||||||
<p></p>
|
<p></p>
|
||||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">$sFilter</itopblock>
|
<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">$sFilter</itopblock>
|
||||||
</div>
|
</div>
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,18 @@ require_once('../application/wizardhelper.class.inc.php');
|
|||||||
require_once('../application/ui.linkswidget.class.inc.php');
|
require_once('../application/ui.linkswidget.class.inc.php');
|
||||||
|
|
||||||
require_once('../application/startup.inc.php');
|
require_once('../application/startup.inc.php');
|
||||||
if (isset($_SERVER['PHP_AUTH_USER']))
|
session_start();
|
||||||
|
if (isset($_SESSION['auth_user']))
|
||||||
{
|
{
|
||||||
|
$sAuthUser = $_SESSION['auth_user'];
|
||||||
|
$sAuthPwd = $_SESSION['auth_pwd'];
|
||||||
// Attempt to login, fails silently
|
// Attempt to login, fails silently
|
||||||
UserRights::Login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
|
UserRights::Login($sAuthUser, $sAuthPwd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No session information
|
||||||
|
echo "<p>No session information</p>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$oPage = new ajax_page("");
|
$oPage = new ajax_page("");
|
||||||
|
|||||||
Reference in New Issue
Block a user