Adding a navigation bar item

You can add new navigation bar entries to Act! Premium (access via web) using the UILayoutManager class found in Act.Web.Controls.Layouts. You can manipulate the navigation bar using the IWebNavBar interface defined in the Act.Web.Framework assembly. Plug-ins access the navigation bar via the NavBar property of the ACTSessionManager.

You add new items at runtime, and you add them to the plug-ins Init() method.

To add a navigation bar item

  1. In Init(), use the AddCustomNavBarItemProvider() method to provide Act! Premium (access via web) with a callback function used to initialize the navigation bar item:

session.NavBar.AddCustomNavBarItemProvider(new Act.Web.Framework.CustomNavBarItemProvider(this.ServeCustomNavBarItem));

  1. Implement the navigation bar item provider to return all the information needed to build the new entry in the navigation bar (the text displayed on the tab and the location of the tab page). You must set the "tabURL" parameter to the full path of the tab page. To get the APFW path, use the session.AppPath property, and then append the location of the plug-in page relative to the root APFW folder.

private bool

ServeCustomNavBarItem(Act.Web.Framework.ACTSessionManager session, out string id, out string action, out string cssclass, out string imageUrl, out string width, out string height, out string caption)

{

//the custom navigation bar item id
id = "today";

//the action to perform when clicking on the custom navigation item
action = "SaveAndNavigate(\"" + session.AppPath + "Plugins/Content/SamplePlugin/Today.aspx\");";

//css class
cssclass = "hand";

//the URL to the image to use in the custom navigation bar item
imageUrl = session.AppPath + "Plugins/Content/SamplePlugin/today.gif";

//dimensions
width = "44"; height = "38";

//the caption on the item
caption = "Today"; return true;

}

  1. Since Act! Premium (access via web) uses Masterpages, you must add a dummy master page file (.master) to the project.
  2. Add the web form the new custom navigation bar item is going to redirect to when clicked. You must copy the ASPX file and the code behind file to the location specified in the ServeCustomNavBarItem method.

This page should inherit from Act.Web.Framework.Page or Act.Web.Framework.EmailPage (if you need email sending capabilities) to gain access to the ACTSessionManager. This is how plug-in pages gain access to the ActFramework as well as other APFW SDK methods.

  1. Add a reference to the master page file created in step 4:

<%@ Page MasterPageFile="Dummy.master" …

  1. Override the OnPreInit method on the web form you added in the previous step to use the proper master page:

protected override void OnPreInit(EventArgs e)

{

//change the Master Page affiliation
this.MasterPageFile = "~/MasterPages/ListViewMasterPage.master";

base.OnPreInit(e);

}

How do I...?

Add a tab

Add a plug-in

Edit the menu

Edit a toolbar