Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Documents in a new window

  Asked By: Kelsey Benton         Date: Oct 13, 2009      Category: Sharepoint      Views: 298
 

I've seen several posts to this subject without resolution so I
thought I'd try again. Does anyone know of a way to open documents
in a new window? Example, I searh for a doc, find the doc, click on
the doc and it opens in the same window. I have to click BACK to
get back to SPS. I know how to fix this in News and Announcemnts
but how do I fix this in DOCUMENTS?

Tagged:        

 

14 Answers Found

 
Answer #1       Answered By: Aastha Tatpatti          Answered On: Oct 13, 2009       

You need to modify 3 files: CategoriesItemsPart.xsl, FolderItemsPart.xsl
and SearchResultsPart.xsl.

Open these files in notepad and do a search for </xsl:otherwise>, there
will be multiple hits. You need to find  the one that looks similar to
what is shown below:

</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of
select="dav:propstat/dav:prop/dav:displayname"/>
</xsl:attribute>

Add in the 3 red lines:

</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:if test="dav:propstat/dav:prop[dav:iscollection != '1']">
<xsl:attribute name="target">"_blank"</xsl:attribute>
</xsl:if>
<xsl:attribute name="id">
<xsl:value-of
select="dav:propstat/dav:prop/dav:displayname"/>
</xsl:attribute>

You need to do this for all 3 files.

 
Answer #2       Answered By: Roop Kapoor          Answered On: Oct 13, 2009       

You need to change this line in searchresult.xsl file
u can place on line 284 or after that the full code is pasted below

the same thing u need to do for other two files CategoriesItemsPart.xsl,
FolderItemsPart.xsl as well
hope this answers ur query

<A><xsl:attribute name="href">
<xsl:choose>

<xsl:when test="dav:propstat/dav:prop[pub:ShortcutTarget!= '']">

<xsl:value-of select="dav:propstat/dav:prop/pub:ShortcutTarget"/>

</xsl:when>

<xsl:when test="dav:propstat/dav:prop[pub:DiscussionTarget != '']">

<xsl:for-each select="dav:propstat/dav:prop/pub:DiscussionTarget">

 <xsl:eval>

 var strSub=this.text.substr("http://./msoffice/commfrms.asp?url=".length);

 strSub=strSub.replace(/http:\/\/./, "");

 strSub=canonicalizeForUrlParameter(canonicalizedUtf8FromUnicode(strSub));

 strSub="/msoffice/commfrms.asp?url=".concat(strSub);

 strSub;

 </xsl:eval>

</xsl:for-each>

</xsl:when>

<xsl:when expr="fIsAMajorVersion">

<xsl:eval>g_strActualBaseDocUrl;</xsl:eval>

</xsl:when>

<xsl:otherwise>

<xsl:eval>strSafeUnicodeDavHref;</xsl:eval>

</xsl:otherwise>

</xsl:choose>

</xsl:attribute>

<xsl:attribute name="id">

<xsl:value-of select="dav:propstat/dav:prop/dav:displayname"/>

</xsl:attribute>

<xsl:attribute name="target">_new</xsl:attribute>

<xsl:choose>

<xsl:when test="dav:propstat/dav:prop[dav:iscollection ='1']">

<B><xsl:value-of select="dav:propstat/dav:prop/dav:displayname"/></B>

</xsl:when>

<xsl:when test="dav:propstat/dav:prop[office:Title != '']">

<B><xsl:value-of select="dav:propstat/dav:prop/office:Title"/></B>

</xsl:when>

<xsl:otherwise>

<B><<xsl:value-of
select="/dav:multistatus/Strings/String[@_locID='L_ResultListNoTitleLabel_TE
XT']"/>></B>

</xsl:otherwise>

</xsl:choose>

</A>

 
Answer #3       Answered By: Kelley Obrien          Answered On: Oct 13, 2009       

I have done this change on many of the pages within my SPS install,
here's one example  (this is a copy and paste from the document I
maintain to record any changes, in case we need to reapply them when
a service pack is applied).

Change:
Edited (the new) CategoryItemsPart.xsl to make documents  load in a
new window.
Purpose:
To make documents load in a new window, we have to add a
Target=_Blank to the A links
File affected:
CategoryItemsPart.xsl
Description of changes:
At line 222 in this file, add the following code
<A><xsl:attribute name="target">_blank</xsl:attribute><xsl:attribute
name="href">
and deletethe original line, below
<A><xsl:attribute name="href">

===

This should work for you, the other ones I've changed are:

Edited SearchResultsPart.xsl to make documents load in a new window.
Purpose:
To make documents load in a new window, we have to add a
Target=_Blank to the A links
File affected:
SearchResultsPart.xsl
Description of changes:
At line 257 in this file, add the following code
<A><xsl:attribute name="target">_blank</xsl:attribute><xsl:attribute
name="href">
and deletethe original line, below
<A><xsl:attribute name="href">
The original file is called SearchResultsPart-ORIGINAL.xsl

and

Change:
Edited CategoryBestBetItemsPart.xsl to make documents load in a new
window.
Purpose:
To make documents load in a new window, we have to add a
Target=_Blank to the A links
File affected:
CategoryBestBetItemsPart.xsl
Description of changes:
At line 205 in this file, add the following code
<A><xsl:attribute name="target">_blank</xsl:attribute><xsl:attribute
name="href">
and deletethe original line, below
<A><xsl:attribute name="href">
The original file is called CategoryBestBetItemsPart-ORIGINAL.xsl

 
Answer #4       Answered By: Ashleigh Neal          Answered On: Oct 13, 2009       

I'm not sure what I'm changing.

Do I change the:

<A><xsl:attribute name="href">

and if so, to what?:

 
Answer #5       Answered By: Mitali Panchal          Answered On: Oct 13, 2009       

Have you figured out how to open  the document in a new window  for the
subscription? I think this is the SubscriptionSummaryRender.xsl file. I
have not been able to do this.

 
Answer #6       Answered By: Wanda Petersen          Answered On: Oct 13, 2009       

I tried this but keep coming up with this error under Matching documents:

Script Execution Error: Expected token ']' found 'STRING'.
dav:propstat/dav:prop[dav:iscollection =.-->'1'<--]

Do you have anymore suggestions?

 
Answer #7       Answered By: Eric Davis          Answered On: Oct 13, 2009       

first take a backup of ur files and replace
this files with them

 
Answer #8       Answered By: Giselle Glass          Answered On: Oct 13, 2009       

Ok, does anyone have the original searchresultpart.xsl file. I modified it
and undid the changes I made, but the search results still do not appear
anymore.

 
Answer #9       Answered By: Kendra Webb          Answered On: Oct 13, 2009       

Thanks, I got it to work after multiple tries. Do you by any chance know how
to open  up the News, Annoucements and recently published documents  in a new
window.
Again, I thank you for all of your help.

 
Answer #10       Answered By: Elizabeth Anderson          Answered On: Oct 13, 2009       

All u need to do is to search for this tag in the xsl content which is
embedded as content property for the announcement and news  and search for
tag <A> and change it to <A target="_new">
that all

anyways i am attaching both the news and announcement webparts

 
Answer #11       Answered By: Jerome Montgomery          Answered On: Oct 13, 2009       

If you put Announcements in a new window, what happens with the 'Go back  to the
list' link?

 
Answer #12       Answered By: Serena Schwartz          Answered On: Oct 13, 2009       

when u click  the go back  to the list it will go back to the dashboard page
in the same window  (i.e the opened window)

 
Answer #13       Answered By: Tiara Gross          Answered On: Oct 13, 2009       

IMHO that will cause problems with visitors because now they will have two
copies of the dashboard open. Different strokes.

 
Answer #14       Answered By: Frankie Figueroa          Answered On: Oct 13, 2009       

you can close the window  of the go back  to list page
i mean when u click  the link of go back that particular window will close
and the parent window still remains.

 
Didn't find what you were looking for? Find more on Documents in a new window Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].