|
Microsoft Windows SharePoint Services 3.0 (WSS 3.0) the great, versatile and free technology from Microsoft provides a foundation platform for building Web-based business applications that can flex and scale easily to meet the changing and growing needs of any organization, and by little customization you can have a great collaboration or even content management portal.
First thing needed to be considered is to build a better navigation for WSS, so let’s begin. If you created a WSS team site, you will get a following page:

In this page and under Site Action Menu you will find the following items:

That is good, however I felt that this menu needs more items, what about adding View All Site Content and Recycle Bin menu items, to achieve that you need to install SharePoint Designer first, after that open the default.master from the following path: "/_catalogs/masterpage/" In the bottom design area click on Site Action control, this will highlight the source in the Source area.

Now in the appropriate position between menu items and before </SharePoint:FeatureMenuTemplate> paste the following code as shown
<SharePoint:MenuItemTemplate runat="server" id="MenuItem_Contents" Text="View All Site Contents" Description="Browse all site lists and subsites" ImageUrl="/_layouts/images/Actionscreate.gif" MenuGroupId="100" Sequence="300" UseShortId="true" ClientOnClickNavigateUrl="~site/_layouts/viewlsts.aspx" PermissionsString="EnumeratePermissions,ManageWeb,ManageSubwebs, AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData" PermissionMode="Any" /> <SharePoint:MenuItemTemplate runat="server" id="MenuItem_Recycle" Text="<%$Resources:wss,StsDefault_RecycleBin%>" Description="Manage deleted items" ImageUrl="/_layouts/images/Recycle32x32.png" MenuGroupId="100" Sequence="300" UseShortId="true" ClientOnClickNavigateUrl="~site/_layouts/recyclebin.aspx" PermissionsString="DeleteListItems,EnumeratePermissions,ManageWeb,ManageSubwebs, AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData" PermissionMode="Any" />

Then save the page and refresh the site on the explorer to get the following menu:

What we need in the next step is to enhance inside pages and sub-sites navigation, in my case I don’t need the quick launch control, and I just wanted to view inside pages and sub-sites.
There is something you already know in SharePoint Server (MOSS), the “Pages” document library, which created by default in each publishing site, the idea is to create the same library here and then we can list its pages in a new control. So at this stage we need: 1. Create a user control for inside navigation 2. List inside pages 3. List sub-sites
Creating a user control to be set on the master page is too easy: 1- Locate the following folder: “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES” 2- Create a new user control file ex: ucNavMenu.ascx having the following code:
<%@ Control Language="C#" ClassName="ucNavMenu" %>
3- Include the following line in you master page after: <@Master language="C#"%>
<%@ Register TagPrefix="isauc" TagName="NavMenu" src="~/_controltemplates/ucNavMenu.ascx" %>
4- In the appropriate place where you want this control to appear put the following code:
<asp:ContentPlaceHolder id="NavMenuPlaceHolder" runat="server"> <isauc:NavMenu id="IdIsaNavMenu" runat="server"/> </asp:ContentPlaceHolder>
Now, it is the right time to write our code for listing menu items, in my case it is decided to list pages then sites, and I found it a good idea to read sub-sites from current quick launce navigation object, here is the full code:
<%@ Control Language="C#" ClassName="ucNavMenu" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<% SPWeb currentWeb = SPContext.Current.Web; string CrLf = "\n\r"; string navContent = "";
try { //Reference subsites in quicklaunch Microsoft.SharePoint.Navigation.SPNavigationNodeCollection secNvc = currentWeb.Navigation.GetNodeById(1026).Children;
//--- List Pages ---- SPList list = currentWeb.Lists["Pages"];
if (secNvc.Count != 0 || list.Items.Count != 0) { navContent += "<ul>";
foreach (SPListItem item in list.Items) { // Exception for home page
if (currentWeb.Title == "Home") { break; } string itemUrl = currentWeb.Url.ToLower() + "/" + item.Url.ToLower();
if (item.Title != null) { if (item.Title != "") {
navContent += "<li><a href='" + itemUrl + "'>" + SPEncode.HtmlEncode(item.Title) + "</a></li>" + CrLf; } else { navContent += "<li><a href='" + itemUrl + "'>" + SPEncode.HtmlEncode(item.Name) + "</a></li>" + CrLf; } } else { navContent += "<li><a href='" + itemUrl + "'>" + SPEncode.HtmlEncode(item.Name) + "</a></li>" + CrLf; } }
//--- Subsites ----
foreach (Microsoft.SharePoint.Navigation.SPNavigationNode node in secNvc) { navContent += "<li><a href='" + node.Url + "'>" + node.Title + "</a></li>" + CrLf; }
navContent += "</ul>" + CrLf; } } catch (Exception ex) { //Response.Write(ex.Message); }
Response.Write(navContent); %>
And you can give a SharePoint default style to this menu to appear as below:

Still one issue and I guess it is very important, navigation to page properties to set page title after page creation is a problem in WSS, since we have to go to the list item and edit its properties, however we can overcome this problem by modifying the designmodeconsole.ascx user control (design mode tool which appears after editing the page) located in the same folder, the modification is to add a link to list item properties to appear like the following:

To do so add the following code to this control
<td class="ms-consolestatus"> <% string itemID = ""; try { if (SPContext.Current.Item != null) { itemID = SPContext.Current.ItemId.ToString(); Response.Write("<a href='Forms/EditForm.aspx?ID=" + itemID + "' target='_blank'><b>Click here</b></a> to set page properties "); } } catch { } %>
</td>
And this is after this portion of code:
<td class=" ms-consolestatus" > <SharePoint:PageModeIndicator id=" pmi2" runat=" server" /></td>
|