Thursday, January 14, 2010

Managing Links with the “I need to…” Web Part

Author: Nicola Young

It’s time to decide the best way to display your links on a page.
If you are using MOSS, you have what I consider five options: Links List, Content Editor Web Part, Content Query Web Part, Summary Links Web Part, and I Need to.. Web Part. It really comes down to how many links are you trying to display.
Maybe you only have 2-5 links and one of the first four options will be fine. But if you have any more than that all of sudden your page is just covered with links.
While I think the first four options listed all have value, the biggest problem I have with them is screen real estate which is why I choose the fifth option frequently, the I Need to… web part. For this article I am going to assume you know how to use the first four and we are going to walk through how to turn the I Need to… web part into a drop down links list.
The “I need to…” web part can help
The I Need to… web part was originally intended to connect to the Site list in the Sites Directory as an easy way for your users to navigate. However it works well as a links drop down for any type of links whether they are internal or external.
In order to do this, you need to create a custom links list. This is because the built in links list does not have a title column which is what is displayed in the dropdown nor does it have a choice column which the web part uses for filtering.
The first three steps listed below will walk you through setting up the list.
Create a Custom List with the following Columns.
Title
Type
Title (should be created by default)
Single line of text
URL
Hyperlink
Yes/No
Choice column; yes, no should be the choices
Add a couple of items filling in all three columns. The web part is going to ask you to filter the choice column, so if you would like all of the items to show up make sure you are selecting Yes for the Yes/No column.
Go to the homepage of your site, in the right hand column add the I Need to.. web part. When you have the web part in edit mode configure it as follows: (Note: the list name should be the custom list you created in the first step)
If you would like to change the width of the web part, you can do it with the width option seen above. This would allow you to accommodate links with a lot of characters.
Now your web part should look similar to this
After I demonstrate the above functionality of a links drop down clients frequently ask how do I customize the fact that the web part says “Choose a task”. The following are the steps you will need to take to accomplish this.
The next step is to change the text in the web part from “Choose task” to “Choose Link”, to do this on the drop down of the web part select export. Save the web part to your desktop.
Click Open and Use SharePoint Designer or Notepad to open the file. To change the word task to link in the default text of the web part, Locate this line of code approximately line 75
<option selected="true" value="0">Choose task</option> Change “Task” to “Link”
To change the tooltip, Locate this line of code approximately line 74
<select id="{$TasksAndToolsDDID}" class="ms-selwidth" style="width:{$tasksAndTools_Width}" size="1" title="Choose a task that you need to perform" >Change “task” to “link”; you may want to delete “that you need to perform” or reword the tooltip altogether.
Save the File
Go back to the homepage of your site. Put the page in edit mode and click add a web part. In the bottom right hand corner of the web part gallery click Advanced Web Part Gallery and Options.
Select the drop down arrow in the top right hand corner of the web part task pane. On the drop down select import.
Browse to the file you just saved and click upload.
Click Import.
Be sure to delete the first I need to… web part off of the page.
Conclusion
So that is it, with a few simple changes to the code you can customize the web part and create a very functional efficient drop down list of links with custom messages and tooltips.
The same simple steps used here to customize the web part can be used with other web parts that have been exported. This may help you to start thinking about other problems you can fix with this type of solution. Hopefully you will at least find this useful when you get the request for everyone’s link on the homepage as I frequently do when I am designing a new homepage layout.
As always, we are happy to receive any feedback from you regarding topics you would like us to address. Leave it in the comments below.


REF: http://www.endusersharepoint.com/2009/01/29/managing-links-with-the-i-need-to-web-part/

No comments:

Post a Comment