Highlighting tabs in the top navigation

We’ve got a customer who’s top navigation tabs aren’t being used as links to content in SharePoint. Instead, these tabs take users to other parts of their system, which is maybe fair enough given that the left navigation also gives them the same sort of access; indeed this duplication of navigation is often a source of consternation with clients.

Anyway, they’ve now added site that they do want linked from the top navigation bar. Therefore, if you click on this tab, they want it to appear highlighted – and it’s the only tab that would.

The site in question isn’t a subsite of the root site of the site collection, so I must confess, I didn’t think you could do this. They emailed and asked, though, and I suggested that the full URL that they were using (e.g. http://sharepoint/somesite/tabsite) wasn’t a good idea – as if they extend their web app for an extranet that link won’t work. As it transpired though, they’d thought to try a relative URL (e.g. /somesite/tabsite) and that worked nicely!

I had to check:

nav-link

showing:

highlighted-top-nav

There we go, a site 2 levels down, highlighted in the top nav correctly!

I suppose it makes sense that the relative URL might work – but I’d sort of assumed that the manual links wouldn’t undergo the same checks as the ‘show subsites’ links would.

Advertisements
Highlighting tabs in the top navigation

Personalization Sites, Links, and Two Tabs

I came across an interesting problem today. I’m building a demo, and I wanted to use personalization site to ‘push’ a dashboard page to a certain set of users. I created a Personalization site (using the Personalization Site tempate), and then went to my SSP to set up a Personalization Link to it:

I then logged in as a user who belongs to the audience it was configured to show for:

Everything looked good – I had my ICT link that I’d just set up, so the audience was working correctly. However, when I clicked on it, things didn’t work so well…

Yup, two tabs were being shown. One was my Personalization Site link that I’d configured in the SSP, and the other was the navigation tab for the site itself. I only noticed ‘cos the name on the tab I’d added in the SSP (ICT) and the name of the site (ICT Dashboard) were different. Also, the Site’s own tab gave me the ‘Pin/Unpin Site’ option.

It’s a bit of a digression, but what’s the pin/unpin site stuff about then? Well, you don’t have to push personalization site links out to users (via the SSP). Instead, users can go to a personalization site and choose to add it to their My Site tabs; this is ‘pinning’ the site. After they’ve done this, they can remove the link (‘unpinning’).

However, that’s not what I wanted – I want the ICT audience to always have that link, and I don’t want another tab, or any pin/unpin options. So how do I get rid of that? There must be a way; it’s obvious that if I’m pushing a personalization site to a bunch of users that they shouldn’t get those options.

After much head scratching, I figured it out. My personalization site link in the SSP only pointed to the site, not to the actual page. I changed it to point to the page (default.aspx).

When I then navigated via that tab, I was shown only one tab – with no pin/unpin options:

Hurrah! What I think happens, then, is that the top navigation compares the URL of the current page in the personalization site with the URLs for the tabs in the user’s My Site. If none of them exactly match, then it adds a tab for the site itself, including the pin/unpin menu. Although my personalization site’s url did resolve to the same page (default.aspx) the URLs were not the same – and hence I was getting two tabs!

Personalization Sites, Links, and Two Tabs

WSS3 Pages – what's with all the sucky layouts?

Okay, so I’m not a huge fan of the out-of-box publishing layouts. I’ll be honest – I reckon that there should be about half of the layouts, and I don’t like the ‘Welcome Page’ as a description. ‘Generic Page’ perhaps?

Anyway, some of them have pretty cacky layouts, often with Summary Links built into the page (why? Can’t I just add a web part?) – but as a rule, they keep the left hand navigation for the site. This is good – users get confused when their navigation isn’t how they expect.

New WSS Pages, however, do not keep the left hand navigation.

This has led to more than one customer asking “where has my left hand nav gone?” Not an unreasonable question – after all, did someone think that users wouldn’t need standard navigation in team site pages? Don’t get me wrong, I like that you can get rid of the left navigation menu if you want – but I think this will be the exception, not the rule.

You can get the left navigation back using SharePoint Designer (and some cynics might suggest it’s a ploy to set SPD licenses, though I don’t think so). However, I shouldn’t have to! Can’t I have a couple of out-of-box layouts that are like, well, the one used in Default.aspx on my team sites? Is there a Codeplex project for such a thing, maybe?

Even better would be if Default.aspx existed inside a library like any newly created pages I build are. I don’t like that it is separate to the other pages in a WSS3 site.

WSS3 Pages – what's with all the sucky layouts?

Navigation from a 'My Site' back to a Site Collection

I don’t normally do much with My Sites to be honest – usually I’m building applications, and they’re not usually in My Sites. One of our customers asked me ‘How do users navigate back to the Intranet?’ and I’ve got to admit, I was baffled.

Well, SharePoint’s My Sites have a site-collection setting for ‘Portal Site Collection’. This setting modifies the Global Breadcrumb, and inserts another link there – so you can have a link back to your site-collection.

There a number of issues with that, though… Continue reading “Navigation from a 'My Site' back to a Site Collection”

Navigation from a 'My Site' back to a Site Collection

My Sites links HoverCellActive doesn't show the top border

This has caught me out three times now – I build style, but the top border for the global links ‘My Links’ link didn’t show:

I checked my style, and there it was. So I tried adding a margin, or padding in the cell that contained it.

Wrong. It needs it’s height to be set to 100%.

.ms-globalbreadcrumb .ms-HoverCellActive,
.ms-globalbreadcrumb .ms-HoverCellInctive,
.ms-globalbreadcrumb .ms-HoverCellActiveDark{
height:100%;
padding-top:1px;
}

My Sites links HoverCellActive doesn't show the top border

Putting a web part zone below the quick navigation menu

Previously, I’d been asked to put a web part zone below the quick nav for SharePoint pages. As it transpires, you can’t put web part zones on master pages – but there is no reason why you shouldn’t put one in an asp:Content control (indeed, that’s how you have to place them on pages). And I’d noticed this PlaceHolderLeftActions content placeholder. So I figured, why not put my web part zone into that?

To do this, I need to modify the page that I want this zone to appear for. It could be a Page Layout for publishing pages, or just a normal default.aspx on a team site. I’m using a blank site for this. I simply added a Content control, and dropped a web part zone into it:

<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
<WebPartPages:WebPartZone id="g_5AD648BF053647678E80875B48A60593" runat="server" title="Zone 1">
</WebPartPages:WebPartZone>
</asp:Content>

I saved the changes, and now when I go to edit that page I see:

Great! I can drop in web parts – here I’ve used a summary links web part:

But you may find the styling leaves something to be desired – but you can design that in!

Sure, you could find that you have to do this a lot of times if you want to do this for many pages, but if you’re using the publishing features, you only have to modify each Page Layout once, which is very handy.

Putting a web part zone below the quick navigation menu

Updating the Navigation Settings in a Publishing Site

I’ve got a brand that I’m activating via a Feature Receiver – it’s a theme and masterpage combination, and I want it to work on Team sites too, so it does actually make sense to do it this way!

Part of the brand is that the tabs have rounded corners, and these don’t work very well with the dynamic drop down menus. You can turn this off in the master page for the site pages, but not for the applications pages. Instead, I figured I’d use a feature receiver to turn off the ‘Show Subsites’ and ‘Show Pages’ in a publishing site.

So, the code I had was this:

if (PublishingWeb.IsPublishingWeb(site))
{
PublishingWeb pwSite = PublishingWeb.GetPublishingWeb(site);
site.Properties[ORIG_PUB_SITES] = pwSite.IncludeSubSitesInNavigation.ToString();
site.Properties[ORIG_PUB_PAGES] = pwSite.IncludePagesInNavigation.ToString();
site.Properties.Update();

pwSite.IncludePagesInNavigation = false;
pwSite.IncludeSubSitesInNavigation = false;
pwSite.Update();
pwSite.Close();
}

However, this didn’t work. To describe the code, first, we check to see if the page is a PublishingWeb. If it is, I record original settings in the site properties (so I can restore them when the feature is deactivated). I turn off those navigation check boxes, update the record on the server and close the object.

After much investigation, I realised that updating the properties was invalidating the PublishingWeb object, somehow, and that my changes weren’t being recorded. In the end I had to change my code to:

if (PublishingWeb.IsPublishingWeb(site))
{
PublishingWeb pwSite = PublishingWeb.GetPublishingWeb(site);
bool showPages = pwSite.IncludePagesInNavigation;
bool showSub = pwSite.IncludeSubSitesInNavigation;

pwSite.IncludePagesInNavigation = false;
pwSite.IncludeSubSitesInNavigation = false;
pwSite.Update();
pwSite.Close();

site.Properties[ORIG_PUB_SITES] = showPages.ToString() ;
site.Properties[ORIG_PUB_PAGES] = showSub.ToString() ;
site.Properties.Update();
}
This worked nicely!

Updating the Navigation Settings in a Publishing Site