Quick launch bar in portal area missing

Sometimes you think “asjemenou” when you run into a very obvious bug. I had such an experience with Sharepoint today.


When you create for example a document library in a portal area there is a section in which you can select the document library to “display on the quick launch bar”. However when you select this, it doesn’t show up there! While searching newgroups I found out that this behaviour is due to the fact that this isn’t specified in the portal area templates. It is in the WSS (STS) template though.


As a fix some people suggested to use Frontpage to put it in the portal area. I like it more to fix this in the templates (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tsptCustomNavBar_SV01016232.asp). I tried this and it seems to work.


Keith Richie from Microsoft wrote some time ago in the portalserver newsgroup:


Allthough Portal 2003 Areas are based on WSS Webs, the concept of the quick launch bar is not necassarily the same.
The “Portal Navigation” bar is highly controlled by Portal, and selecting for a doc lib to show up on “Quick Launch” will not work for the Portal Navigation bar without edits to the page.
I recommend using a “Portal Listing” if you can.

How does the Sharepoint Text Editor work?


For things like the content editor webpart and the add listing functionality, Sharepoint has a Text Editor. As you might have noticed, the text editor isn’t the same everywhere. It looks more or less the same but it is supplying different functionality at every different location.


To change the default Text Editor, it is necessary to first understand how the current is working. This post tries to explain this.


First of all the Text Editor is a plain DHTML editor. It uses a TextArea and an IFrame, just like the well known DHTML editor.


The Text Editor is wrapped in a user control:



When the page is rendered, the Text Editor is converted into a TextArea:


<TEXTAREA id=TextEditor style=”WIDTH: 600px; HEIGHT: 800px” name=TextEditor>….</TEXTAREA>


Also at the bottom of the page the following Javascript is added:


RTE_ConvertTextAreaToRichEdit (“TextEditor”, …)


This function is located in the ows.js and does exactly what it looks like it does. It looks up the TextArea and converts it into the DHTML control. It leaves the TextArea alone but adds an IFrame and toolbars for the editor.


The function RTE_GiveEditorFirstFocus(“TextEditor”) moves the focus to the just created editor. Also an event is attached to the IFrame which makes sure that the content in the editor is moved to the text area after the user presses the submit button. It uses the following function for that:


RTE_TransferIFrameContentsToTextArea(“TextEditor”)

 

All Javascript is located in the ows.js file.

 

To change the default implementation of the text editor, the best approach is to make sure the content of the adjusted editor ends up in the text editor text area afterwards. For the add listing version it is also necessary to leave the SPSWC:TextEditor in place because the button calling ‘ShowTextEditor’ counts on it. If that is removed, it is much more difficult to display the editor and save the content using default available functionality. I was not able to determine the implementation of ‘ShowTextEditor’, so if someone can explain it to me……..

Order Sharepoint areas like the portal hierarchy


A few weeks ago I was working on a web part which had to display the area hierarchy, much like the way topics are displayed.


When implementing I found out that the areas in the AreaCollection were returned in alphabetical order and not in the hiearchical order that Sharepoint uses. It turned out that other people also ran into this. Using the ‘HonorOrder’ property didn’t help a lot and in fact it is unclear what that property actually does.


I built my own AreaCollection, very easy but very useful. One thing to be aware of:  when an area is removed from the collection Sharepoint doesn’t renumber the other areas. This means that you can have 3 areas with order numbers like 2, 5 and 9. This implementation is taking that into account.


int tmpAreaCnt = 0;


int nbrOfVisibleAreas = 0;


 


// Determine the highest order number


foreach(Area thisArea in SomeArea.Areas)


{


       if(thisArea.Order > tmpAreaCnt)


       {


              tmpAreaCnt = thisArea.Order;


       }


}


 


// Create temp and real array objects to contain the sorted areas


// Increase the counter by one, the array is 0-based


tmpAreaCnt++;


Area[] tmpPortalAreaColl = new Area[tmpAreaCnt];


 


foreach(Area thisArea in SomeArea.Areas)


{


       if(thisArea.Navigation == AreaNavigation.Show)


       {


              tmpPortalAreaColl[thisArea.Order] = thisArea;


              nbrOfVisibleAreas++;


       }


}


 


// Now we only have to remove the empty entries


int areaCnt = 0;


Area[] portalAreaColl = new Area[nbrOfVisibleAreas];


for(int i=0; i<tmpAreaCnt; i++)


{


       if(tmpPortalAreaColl[i] != null)


       {


              portalAreaColl[areaCnt++] = tmpPortalAreaColl[i];


       }


}


 


New blogger in town

Last month I received an invitation from LogicaCMG to start a weblog at BloggingAbout.NET. This invitation was based on my visit to the LogicaCMG booth on the Microsoft DevDays 2005 earlier this year. I left my business card there to be able to win something which I didn’t of course. 😉 


The invitation was sent the moment I was looking for another hosting party for my blog which is currently hosted by XS4ALL, so I decided to accept the offer. I would like to thank Dennis and Petra from LogicaCMG for this opportunity.


I work at a company called Macaw. Macaw is a Microsoft Gold Partner in Intranets and e-commerce. I work on a variety of projects with of course .NET and Mircosoft server products like Sharepoint 2003 and Biztalk 2004.


You’ll find postings here in one of these areas most of the time.


Happy reading and please leave your comments if I write something completely stupid 😉