One of the big requests when using SharpForge is being able to insert your own menu items in to the portal and project menus. To demonstrate how to do this we will create a link to the popular bookmarking site http://del.icio.us to display all of the bookmarks tagged with each project’s code.
Its very easy to do with the following steps:
- 1. Create a BookmarksSiteMapExt ( just like SFWebChatSiteMapExt )
- 2. Implement BuildingProjectSiteMap
if (context.Project == null)
return;
string url = "http://del.icio.us/tag/" + context.Project.ProjectCode;
SiteMapNode cc = dynamicSiteMap.FindSiteMapNode(url);
if (cc == null) {
cc = dynamicSiteMap.Stack("Bookmarks", url, projectRootNode);
}
- 3. Modify the web.config
Add the extension to the SiteMap configuration section
Append the extension name to the useExtensions list
<SiteMap defaultProvider="SFSiteMap" useExtensions="..., Bookmarks">
....
<extensions>
<add name="Bookmarks"
type="SharpForge...BookmarksSiteMapExt, SharpForge.Web"
description="A link to bookmarks tagged with the projectcode"
enabled="True" />
....
</extensions>
Note: The order the extensions appear in “useExtensions” is the order they will appear in the project menu. So in this example Bookmarks will be at the end.
The example demonstrates how to add additional items into the project menu. This technique also works for the portal menu which is displayed in the top left of the page.