Thursday, October 16, 2008

Opening Document Library Items in MOSS 2007 in a New Window

One issue that came up during a recent project was how to open items sitting in document libraries in Microsoft Office SharePoint Server (MOSS) 2007 in a new window. I had found various neat ways on how to do this in SharePoint Portal Server (SPS) 2003, including Todd Bleeker’s awesome Content Editor Web Part solution which entails adding a normal content editor web part with some slick JavaScript to a doc lib page that where upon the page loading most “A” tags on the page are modified to open in a new window.

This web part solution is great, and even works in MOSS 2007 interestingly, but my customer on this project was looking for an even easier solution that did not involve having to manually touch each document library at some point. After some further searching I found the steps to modify site definition files to change the inherit behavior of document libraries so that each time one is created it will automatically have this “new window opening” behavior. Andrew Connell had a great blog post on this.

All of this info was helpful, however the problem of course is that the site definition structure in MOSS 2007 is quite different from SPS 2003 and so the steps to make these granular modifications have changed. After some tinkering around I finally figured it out (or so it seems, the behavior seems expected so far, no weirdness has yet emerged!).

Steps to modify the site definition files in MOSS 2007 to open document library items in a new window:

1. Open the folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML

Apparently there is now a “global” folder for site definition files, I am still trying to understand the mapping of things from SPS 2003 and MOSS 2007.


2. Find and open the file named “ONET.XML” in your favorite XML/text editor (good old notepad for me please)


3. On line 693 you will find this line of XML:



Changing this line to as shown below will change the behavior of the textual links to open in a new window




4. On line 838 you will find this similar line of XML:



Changing this line to as shown below will change the behavior of the image icon links to open in a new window




5. Save changes do an IISRESET and you should be good to go. Of course if you are in a medium or large farm scenario you will need to perform these steps for each front-end web server

Source: http://www.jjfblog.com/2006/12/one-issue-that-came-up-during-recent.html

No comments: