Fixed bugs linked to the bookmark creation:

- There must be a user specific menu entry in the list of menuNodes
- The asynchronous ajax page must use the authentication stored in the session
- The query must be stored in OQL instead of sibusQL

SVN:0.7[57]
This commit is contained in:
Denis Flaven
2009-04-28 11:52:38 +00:00
parent bf864bee78
commit fa9c92c8d8
4 changed files with 55 additions and 15 deletions

View File

@@ -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();
}
}