Managing application specific configuration is mostly done within an application page (aka layouts page). Navigating to these pages is done via custom actions, which adds links to for example the Site Settings page. The challenge starts when the number of application pages grows. Do you keep adding them to the Site Settings page? Do you show them on all Site Settings pages in the web application of every web?
What you need is a centralized administration, like the Central Administration, controlling your application configuration. The Central Administration in SharePoint has two sorts of pages. The homepage (default.aspx) providing an overview and pages like Application Management showing a collection of links related to Application Management.
It’s easy to build your own custom administration site. The image below shows my own administration site. Do you see the resemblance?
Creating these pages is pretty straightforward when using the FeatureLinkSections class together with “LinkSectionLevel1.ascx” and “LinkSectionLevel2.ascx” controls. This web control handles the rendering of the links based on enabled features in the current context. The links are provisioned by custom actions as part of a (enabled) feature.
<SharePoint:FeatureLinkSections Runat="server" Id="SettingLinksV4" CellPadding="4" CellSpacing="4" Location="Contoso.SharePoint.AdminPage" LinkSectionControl="LinkSectionLevel1.ascx" />
The Location attribute is an unique identifier indicating the location where links are provisioned. The location is used in the custom action XML (shown below) to point to the location in the FeatureLinkSections control.
<!-- Admin Page - Security --> <CustomActionGroup Id="ContosoSecurity" Title="Contoso Security" Location="Contoso.SharePoint.AdminPage" Sequence="10" Description="" ImageUrl="/_layouts/images/ SiteSettings_UsersAndPermissions_48x48.png" /> <CustomAction Id="ContosoAdmins" GroupId="ContosoSecurity" Location="Contoso.SharePoint.AdminPage" Rights="EnumeratePermissions,BrowseUserInfo" Sequence="10" Title="Contoso Administrators" Description="..."> <UrlAction Url="_layouts/people.aspx" /> </CustomAction>
The FeatureLinkSections control uses two views controlled by the LinkSectionControl attribute.
Shows a 48×48 icon for the group and links are placed below each other.
Visual Studio solution
I included the Visual Studio project containing the following components:
- AdminPages_Web feature: Web scoped feature with event receiver updating the welcome page and quicklaunch. The feature contains the following components:
- AdminPage module
- AdminPageActions custom actions
- PBWebTemplate element
- Event receiver
- AdminSite_Site feature: Site collection scoped feature containing the web template for creating the web. The feature contains the following components:
- AdminWebTemplate web template
- AdminPageActions custom actions: All custom actions containing all links displayed in the central adminstration.
- AdminPages module: Provisions the adminpage.aspx and security.aspx pages in the web root folder.
- AdminWebTemplate web template: Contains the web template for creating the web.
- PBWebTemplate element: Property bag element with unique web template id
You can download the WSP package and source code at http://sp2010admin.codeplex.com/.