Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FIX: Multiple Document Templates for a Document Library

22 views
Skip to first unread message

Strat...@gmail.com

unread,
Feb 23, 2006, 10:30:43 AM2/23/06
to
I've been researching this problem for a day or so and have come up
with a solution. Still needs a little tweaking as some paths are
hard-coded.
Feel free to rip it apart.

This solution will change the "New Document" link in the standard
AllItems view toollbar of a document library.
I copied the SPSCOMMU template so I wouldn't break any existing
functionality.

The only changes you need to make are in the SCHEMA.xml file under
<TEMPLATE NAME>/LISTS/DOCLIB/

When creating a new SubArea, use this new template. Then create a
Document Library in that area and the following changes will apply
(after a IISRESET of course).


Original SCHEMA.xml
At around line #714 you will find
<!-- Toolbar -->]]></HTML>

below that is markup for a table cell (the one we're interested in
should be line #724)
<td class="ms-toolbar"> <table cellpadding=1 cellspacing=0
border=0> <tr> <td class="ms-toolbar" nowrap> <a tabindex=2
ID=diidNewItem class="ms-toolbar" ACCESSKEY=N
href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();"
title=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[><img
src="/_layouts/images/newdoc.gif" ID="tbbutton1N"
alt=]]></HTML><HTML>"New"</HTML><HTML><![CDATA[ border=0 width=16
height=16></a></td> <td nowrap> <a tabindex=2 class="ms-toolbar"
ACCESSKEY=N ID=diidNewItem href="javascript:]]></HTML><GetVar
Name="WPQ"/><HTML><![CDATA[createNewDocument();">]]></HTML> <HTML>New
Document</HTML> <HTML><![CDATA[</a></td> </tr></table></td>


Change this entire TD block with the following code:


<td class="ms-toolbar">
<table cellpadding=1 cellspacing=0 border=0>
<tr>
<td class="ms-toolbar" nowrap>
<a tabindex=2 ID=diidNewItem class="ms-toolbar" ACCESSKEY=N
href="javascript:]]></HTML>
<GetVar Name="WPQ"/>
<HTML><![CDATA[createNewDocument();" title=]]></HTML>
<HTML>"New"</HTML>
<HTML><![CDATA[>
</a>
</td>
<td nowrap>


<!-- This HTML is used to create the New Document Menu. -->
<menu id="NewDocumentMenu" class="ms-SrvMenuUI">
<ie:menuitem id="NewDocumentMenu_Word"
title="Create a new Microsoft Office Word document"
iconSrc="/_layouts/images/icdoc.gif"
onMenuClick="JavaScript:
var strTemplate='https://<SERVER>/Template Library/template.doc';

// Need current Document Library Name for Save Location
var strSaveLocation='https://<SERVER>/Document Centre/Documents';

var strProgID='SharePoint.OpenDocuments';
createNewDocumentWithProgID(strTemplate,
makeAbsUrl(strSaveLocation), strProgID, false);
">
Microsoft Office Word document
</ie:menuitem>
<ie:menuitem id="NewDocumentMenu_Excel"
title="Create a new Microsoft Office Excel spreadsheet"
iconSrc="/_layouts/images/icxls.gif"
onMenuClick="JavaScript:
var strTemplate='https://<SERVER>/Template Library/template.xls';

// Need current Document Library Name for Save Location
var strSaveLocation='https://<SERVER>/Document Centre/Documents';

var strProgID='SharePoint.OpenDocuments';
createNewDocumentWithProgID(strTemplate,
makeAbsUrl(strSaveLocation), strProgID, false);
">
Microsoft Office Excel spreadsheet
</ie:menuitem>
<ie:menuitem id="NewDocumentMenu_PowerPoint"
title="Create a new Microsoft Office PowerPoint presentation"
iconSrc="/_layouts/images/icppt.gif"
onMenuClick="JavaScript:
var strTemplate='https://<SERVER>/Template Library/template.pot';

// Need current Document Library Name for Save Location
var strSaveLocation='https://<SERVER>/Document Centre/Documents';

var strProgID='SharePoint.OpenDocuments';
createNewDocumentWithProgID(strTemplate,
makeAbsUrl(strSaveLocation), strProgID, false);
">
Microsoft Office PowerPoint presentation
</ie:menuitem>
</menu>

<a accessKey=N alt='New Document Menu' class='ms-toolbar'
id='diidNewItem' style='cursor: hand'
tabIndex='2' title='New Document Menu'
onclick='if(!NewDocumentMenu.isOpen()) NewDocumentMenu.show(this,
true);'>
New Document
<img align='absBottom' alt='New Document Menu' border='0'
class='ms-HoverCellInActive' src='/_layouts/images/menu1.gif'
title='New Document Menu'
onmouseout=this.className='ms-HoverCellInActive'
onmouseover=this.className='ms-HoverCellActiveDark'>
</a>


]]></HTML>
<GetVarName="WPQ"/>
<HTML><![CDATA[

</td>
</tr>
</table>
</td>

In the MENU section:
- Be sure to change <SERVER> to the appropiate value.
- strTemplate points to an existing Document Library and template file.
Use whatever you want.
- strSaveLocation points to the location to save new documents

My goal in the next day or so is to have the strSaveLocation dynamic.

Hope this helps a few out there.

Laters.

Strat...@gmail.com

unread,
Feb 23, 2006, 11:16:58 AM2/23/06
to
Addition: I've corrected the strSaveLocation variable in the Menu code
as follows

Old Code:


var strSaveLocation='https://<SERVER>/Document Centre/Documents';

New Code:
var strSaveLocation = ']]></HTML><ScriptQuote
NotAddingQuote="TRUE"><ListUrlDir></ListUrlDir></ScriptQuote><HTML><![CDATA[';

Engelbert

unread,
Feb 23, 2006, 11:51:47 AM2/23/06
to
The WSS FAQ has just added a link to a solution for multiple document
libraries.

Look at the WSS FAQ section on the main page at either www.wssfaq.com or
wss.collutions.com

Engelbert

<Strat...@gmail.com> wrote in message
news:1140708643.7...@t39g2000cwt.googlegroups.com...

0 new messages