SharePoint Blog - René Hézser

Anmelden  RSS Feed RSS Feed
Startet die Suche

Archive

Kategorien

Links

Andere Blogs



Add to Technorati Favorites


Navigation for Wikis  

May 222009

image

The Wiki functionality SharePoint offers is great for quickly writing down stuff. It is often used for Server documentation.

Creating new pages is easy, and you can link pages. The ability to format the text is nothing fancy, but most of the time enough :-)

Uploading images can be done with my custom field type, which stores images and documents in existing libraries. After the upload, a link is inserted into the Wiki body. –> Custom Field – Upload Files and Images

Now I want to introduce the navigation for SharePoint Wikis.

I realized the navigation through a control adapter. It extends the history button, which is shown on every Wiki page. The advantage is, that the navigation will have to be activated only per web application. Every Wiki page within that web application then has a navigation control beneath the Quick launch. You can see the navigation in action in my Wiki.

How does it work?

The start page in a Wiki library is used as root for the navigation. The text “Wiki Navigation” is linked to this start page.

Every link on this start page which points to another Wiki page is followed to create the navigation tree.

The navigation is cached for 20 minutes. But if a page changes within this time, the navigation will be rebuild and cached automatically.

The Wiki Navigation uses the same CSS as the Quick launch TreeView. This way it does not break the layout, if a node text is too long.

If you Wiki was created from the Wiki site template, it will use the same page for the navigation root you see when you browser to your page (usually the home.aspx).
But if you created a Wiki library on e.g. an empty Teamsite template, the Navigation uses the first Wiki page it will find inside the Wiki library. This is usually the "How to use this wiki library" page. You have to manually delete this page, so the homepage is the page with the lowest ID (see in the url if you edit a Wiki page).

URL Parameters

The Wiki Navigation can take three URL Parameters, to change the way it renders the navigation.

  1. Refresh=true
    This parameter will clear the cached data, reload it and store it in the cache again
  2. ExpandDepth=x
    Controls the depth TreeNodes are expanded. The path to the currently selected TreeNode is always expanded.
  3. MaxLength=x
    Shorten the TreeNode text to this length and add “…”

Requirements

WSS and .NET 3.5 (SP1)

WSPBuilder Extensions for the Visual Studio if you want to user the source code

Installation

Add the solution via stsadm. Deploy it to the web application where you want to use the navigation. Then activate the web application feature.

Download

SharePoint Solution RH.WikiNavigation.wsp

Source code RH.WikiNavigation-Source.zip

Update 7/20/2009

Fixed a bug with Wiki Libraries created without the Wiki page template

Update 8/10/2009

More Trace output during feature activation/deactivation.
The control adapter is now available on every UrlZone configured in Alternate Access Mappings.

 
Posted by René Hézser | 15  Comments | Trackback Url  | 0  Links to this post | Bookmark this post with:        
Tags: Development, Navigation
Technorati Tags: ,

Links to this post

Comments

commented on  Thursday, May 28, 2009  2:52 PM  by  Josef
Hello,
I have searched a long time for this web part. I have installed, but now nothing except Wiki Navigation is visible. So it doesn't work. Do you have a explanation for that?

Greets and thanks
Josef

commented on  Thursday, May 28, 2009  7:48 PM  by  René Hézser
Hi Josef,
send me an email through the "Kontakt" link at the top of the page. Then I have you email address. We can then figure something out.

René

commented on  Friday, June 26, 2009  9:06 AM  by  Martin
Hi Rene,

I've added and deployed the solution via stsadm.

I then activated the webapplication feature, but the wiki-naviagtion does not appear on my wiki-site.

Will I have to do something else for the navigation to appear ?

Regards,

Martin

commented on  Friday, June 26, 2009  9:16 AM  by  Martin
Hi Rene,

I can now see the wiki navigation.
I had activated the webapplication feature for the wrong site
But now the navigation shows the following error message:

Error in OnPreRender: System.InvalidCastException: Das Objekt des Typs "System.DBNull" kann nicht in Typ "System.String" umgewandelt werden. bei RH.WikiNavigation.DataClasses.WikiData..ctor(WikiData parent, DataRow row, String listUrl) bei RH.WikiNavigation.WikiNavigationAdapter.AddLinkedWikiPages(WikiData item) bei RH.WikiNavigation.WikiNavigationAdapter.GetListItems(SPWeb web, SPList list, String wikiDataCacheName, String cacheTime) bei RH.WikiNavigation.WikiNavigationAdapter.<>c__DisplayClassb.b__9() bei Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) bei Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() bei Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) bei Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) bei Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) bei RH.WikiNavigation.WikiNavigationAdapter.CacheData(SPWeb web, SPList list) bei RH.WikiNavigation.WikiNavigationAdapter.OnPreRender(EventArgs e)

What might be the problem ?

Regards,

Martin

commented on  Friday, June 26, 2009  10:59 AM  by  Martin
I now installed it on a different server with the same effect.

commented on  Wednesday, July 08, 2009  10:32 AM  by  Wolfgang
Hallo,

ich wollte heute das Modul in Betrieb nehmen. Nach Installation, Aktivierung und Verteilung (global) erhalte ich auf unserer Wiki-Seite folgende Fehlermeldung:
Error in OnPreRender: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei RH.WikiNavigation.WikiNavigationAdapter.AddLinkedWikiPages(WikiData item) bei RH.WikiNavigation.WikiNavigationAdapter.GetListItems(SPWeb web, SPList list, String wikiDataCacheName, String cacheTime) bei RH.WikiNavigation.WikiNavigationAdapter.<>c__DisplayClassb.b__9() bei Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) bei Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() bei Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) bei Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) bei Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) bei RH.WikiNavigation.WikiNavigationAdapter.CacheData(SPWeb web, SPList list) bei RH.WikiNavigation.WikiNavigationAdapter.OnPreRender(EventArgs e)

Was mache ich falsch?
Besten Dank für eine Info,

MfG
Wolfgang Meyscheider
CTG

commented on  Sunday, July 12, 2009  9:50 AM  by  René Hézser
Hallo Wolfgang,
an diesem Problem arbeite ich gerade mit einem anderen Leser meines Blogs. Wenn wir eine Lösung gefunden haben, werde ich es hier schreiben.

Gruß
René

commented on  Monday, July 20, 2009  9:01 PM  by  Danny G
I can only install as a global solution. When i try to deploy into a specific url I get "This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application"

commented on  Tuesday, July 21, 2009  8:02 PM  by  René Hézser
Hi Danny,
that's right. The solution is global.
Please activate the webapplication feature.
http://www.hezser.de/blog/archive/2008/08/31/installation-deployment-activation-of-features.aspx

René

commented on  Thursday, September 24, 2009  4:37 PM  by  Yuri Verbowski
Installed, activated and cannot figure out how to make this show on the sharepoint wiki - please help.

WSS 3.0 Win2k3 SP2.

commented on  Thursday, November 19, 2009  7:28 AM  by  Hans-Werner
Hallo René

gibt es schon Neuigkeiten bzgl. dieses Webparts?
Ich habe es über stsadm installiert und über die Zentraladministration global freigegeben. Leider ist in meinen Wiki-Bibliotheken nichts ersichtlich :O(

commented on  Tuesday, December 15, 2009  8:02 AM  by  Hans-Werner
Hallo René

wie kann ich die Breite Deines WebParts anpassen?
Meine linke NavBar ist 200 Breit, die Wiki-Navigation jedoch wesentlich schmaler :O(

commented on  Tuesday, March 23, 2010  7:42 AM  by  Ivan
Does it work for 2010???

please see here....

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/fb813d03-6e09-480b-82b9-a1cebeb7a052

thanks

Vit


commented on  Tuesday, March 30, 2010  2:30 PM  by  René Hézser
I haven't tested yet.

commented on  Saturday, April 17, 2010  3:09 AM  by  George
Hello Rene. The solution is working as you described. But I do need some guidance on how to apply the URL parameters. I'm do not know where to edit the code to modify these parameters.

Thanks, George

Name *:
URL:
Email:
Kommentar:


CAPTCHA Image Validation