Jan 272011

TechDays 2011 – Antwerp - Belgium

I’ll be attending my first Microsoft TechDays (Main Conference Only) April 26th and 27th, 2011!

 

I’m already looking forward to it and hope to hear a lot of interesting topics and see some good presentations about things like Visual Studio 2010, Windows Phone 7, Internet Explorer 9, HTML5, Silverlight 4, Lync 2010, Windows Azure, Exchange 2010, etc

 

For those of you that are coming too: C U @ TechDays!

 

Gr

Tom

Published: 1/27/2011  8:33 PM | 0  Comments | 0  Links to this post

Jan 272011

MOSS 2007–WSS 3.0 AspMenu

The AspMenu used by MOSS 2007 and wss 3.0 is based on the .Net 2.0 AspMenu control but has some enhancements built in. The problem is that apparently the SharePoint team sealed the class so you can’t extend the control for yourself.

What they did now is post the sourcecode for their enhanced mossmenu online here. You can just add it as a usercontrol to your masterpage and replace the Sharepoint:AspMenu tag by your custom control, which you can then extend even further.

 

I used this myself because I wanted to change the logic which menuItem is selected in a certain project. My first goal was to have multiple selected items in my menu but apparently this isn’t allowed by the control. Only 1 menuItem can be set selected = true.

 

What I did then was have the parentItem of my currentItem selected in my customMenu:

 

// if no menu item is presently selected, we need to work our way up from the current
              // node until we can find a node in the menu item dictionary
              while (selectedMenuItem == null && currentNode != null)
              {
                  this.menuItemDictionary.TryGetValue(currentNode.Url, out selectedMenuItem);
                  // if we found an item to select, go ahead and select (highlight) it
                  if (selectedMenuItem != null && selectedMenuItem.Selectable)
                  {
                      selectedMenuItem.Selected = true;
                  }
                  currentNode = currentNode.ParentNode;
              }

              if (this.selectStaticItemsOnly)
              {
                  // only static items may be selected, keep moving up until we find an item
                  // that falls within the static range
                  while (selectedMenuItem != null && selectedMenuItem.Depth >= this.StaticDisplayLevels)
                  {
                      selectedMenuItem = selectedMenuItem.Parent;
                      // if we found an item to select, go ahead and select (highlight) it
                      if (selectedMenuItem != null && selectedMenuItem.Selectable)
                      {
                          selectedMenuItem.Selected = true;
                      }
                  }

               
              }
          }

After this I could highlight the current node (of which I know the url) in javascript:

 

function ChangeClassSelectedNodes() {

//Select all links with a href att

$('a[href]').each(function(idx, item) {

//Get the current url

var url = window.location.href.toUpperCase();

//Get each items href in upperCase

var href = item.href.toUpperCase();

//If our current Url contains the items href then change it's class to your SelectedClass

if (url == href) {

item.parentNode.parentNode.className = 'TopMenuSelectedLevel1';

}

});

 

So after this I’d have my current node selected in my Dynamic flyout menu’s en the highest level parentNode selected in my static menu level.

 

Gr

Published: 1/27/2011  8:21 PM | 0  Comments | 0  Links to this post

Jan 272011

PublishingpageImage: Using field value controls and edit mode panels to tweak your page rendering

 

When using a publishingpageImage in your pagelayout it displays a border of 1px at the side of your image. This is especially annoying when you want to display a second image next to it, and you can’t get it aligned perfectly.

 

Before you drive yourself nuts for hours like I did to find out where that pixel comes from look at the following post from ECM Team.

 

It shows that this pixel is caused by the “editing” field of the PublishingPageImage and you can avoid this by using the EditModePanel. This way you add it twice to your page, once where you want to display it (without the pixel!) and once where you want it to appear when editing the page.

 

 

 

Gr

Tom

Published: 1/27/2011  7:13 PM | 0  Comments | 0  Links to this post