March 17, 2008

Workaround for the MOSS 2007 This Week In Pictures Web Part Slideshow Function

Most of my clients want to incorporate a rotating-image web part on their intranet home pages, and most of them dislike the MOSS 2007 out-of-box This Week In Pictures web part because when you click the link for "View Slideshow," the slideshow opens to display the first picture in the image library, not the image the web part currently displays. Aside from developing your own web part or purchasing one from a third-party vendor, there is no way to make that slideshow link point to the currently-displayed picture (There is no view choice field on the web part, and changing the sort order of the "all items" view has no effect on the slideshow).

One of my clients recently designed a workaround to this issue. She asked me to put a workflow on her Picture of the Week image library which would move past pictures to a second picture library. This workflow is a simple one to build in SharePoint Designer; see screenshot below. When she adds a new picture, she changes a metadata field on the previous picture from "Active" to "Past." This change kicks off the workflow, which automatically copies the previous picture to the Past Pictures library and then deletes it from the current picture library. The result is that the "view slideshow" link always points to the picture that is displayed.

Blog_picture_of_the_week_solution_2

This way you can upload multiple photos that are associated with the main picture (for example, a series of pictures from a company outing), and they will be shown together in the slideshow. We put a "View Past Pictures" link under the web part so that employees have easy access to the archive of previous pictures.

February 22, 2008

How to make the SharePoint I Need To web part sort alphabetically

If you have implemented the I Need To… web part on a SharePoint page, either using the Sites list or your own list of links, you may find that the topics appear in the web part in the order they were created, and there is no GUI-based way to control this order. My colleague Florin discovered this way to make the topics sort alphabetically (and until he gets a blog of his own, I blog this on his behalf):
  1. Export the web part to your desktop.

2. Open the web part file in Notepad.

3. Find this piece of code:

          <xsl:param name="Rows"/>

          <xsl:for-each select="$Rows">

          <xsl:variable name="GroupStyle" select="'auto'"/>

4. Edit the code as follows:

          <xsl:param name="Rows"/>

          <xsl:for-each select="$Rows[@Title]" >

                        <xsl:sort select="@Title"/>

          <xsl:variable name="GroupStyle" select="'auto'"/>

5. Save the web part file and close it.

6. Import the modified web part back to your SharePoint page – Choose Site Actions / Edit Page

7. Click the "Add a Web Part" bar

8. Click the link for "Advanced Web Part Gallery and Options"

9. In the "Add Web Parts" pane, click the Browse drop-down and choose Import:

10. Browse to the web part file on your desktop, upload it, and then drag it onto the page. (You will need to delete the I Need To web part which is already on the page.)

Your list should now sort alphabetically.

January 18, 2008

How to display lists and libraries at the top of the “Add Web Parts” menu

MOSS 2007 has improved its "Add Web Parts" menu by showing lists and libraries for the current site at the top of the menu – no more need to scroll through the alphabetical list to find the site-specific web part you want to add. However, this is only the case for team or "system" sites. The web part menu for Publishing sites displays "Suggested Web Parts for Top Zone," which means you have to go to the Advanced Web Part Gallery and wade through the list of all web parts for your list or library, just as in SPS 2003.

Blog_showlistsandlibraries_webpar_2

This functionality is coded at the Zone level (in the same way that the Chrome Type default is set at the zone level) and cannot be changed in Site Settings; but there is an easy change you can make in SharePoint Designer so that the web part menus on publishing pages will act the same way as they do on team / system sites.

Open the home page in SharePoint Designer (check out if necessary), and change the property "QuickAdd-ShowListsAndLibraries" from "false" to "true." You may want to change this for more than one zone, in which case you could do a find and replace for the property for all zones. The code section where this property appears is shown below. Just save your page (and check back in if necessary), and you're done.