Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Restorable Document Library

  Asked By: Tim    Date: Nov 26    Category: Sharepoint    Views: 10921

I installed it and works fine. Now my question is can I hide the default document Library in the Create Page. In Detail :
Inside Document Libraries we have now (1) Document Library (2) Form Library (3) Deleted Items Document Library (STS Web).

mindsharpblogs.com/.../719.aspx

Is there a way to hide Document Library so that the user will create new document library only from Deleted Items Document Library (STS Web).
Which files do I need to modify for that. I tried to comment the entry for Document Library in create.aspx page but it didn't work. Do I have to modify some entries in files in 60\TEMPLATE\1033\STS\LISTS\DOCLIB

Share: 

 

9 Answers Found

 
Answer #1    Answered By: Tyron Calderon     Answered On: Nov 26

I haven’t done this, but this is what I think you need to do. You need to remove it from the ONET.XML file for the site definition. I have instructions on how to add a list template to the ONET here: heathersolomon.com/blog/articles/1300.aspx#3Onet. You could use those as reference on what needs to be removed to take out the default document  library.

And I would back up the ONET file before you make any edits and keep the backup in a safe place not only for access now but in the future as well.

 
Answer #2    Answered By: Irvin Foley     Answered On: Nov 26

Okay I modified the ONET.XML in STS Site Definition. I commented out the following entry
<ListTemplate Name="doclib" DisplayName="" Type="101" BaseType="1" ..........

It worked. Since Deleted Items Document Library (STS Web) is also using the same Type and the BaseType, this is also invisible on the create  page. Only Form Library is visible .

Is there anyother area I can try to figure it out ?

 
Answer #3    Answered By: Deonte Stein     Answered On: Nov 26

it is probably a good idea to remove the built-in
Document library  from the ONET.XML file for your custom Site
Definitions.

However, there isn't any evident way to remove the built-in Document
Library from the create  page of existing Web's/Area's.

If you have implemented CustomJSUrl as per my recommendations in this
SharePoint Advisor magazine article:
http://sharepointadvisor.com/doc/16799?open&p=5

then you can drop this code into the custom ows.js file and all
Webs/Areas created using your custom site definition will hide  this
option on every create page.

try
{
//Used to remove the built-in document  Library from the Create page
var doclibLink = document.getElementById('onetCreate101');
if(doclibLink)
{
//There are three rows to remove from the DOM
//The row with the link in it and two blank rows that follow it
doclibRow = doclibLink.parentNode.parentNode;
doclibRowAfter1 = doclibRow.nextSibling;
doclibRowAfter2 = doclibRowAfter1.nextSibling;

//Remove all three rows from their parentNode (TBODY of the Table)
doclibRow.parentNode.removeChild(doclibRow);
doclibRowAfter1.parentNode.removeChild(doclibRowAfter1);
doclibRowAfter2.parentNode.removeChild(doclibRowAfter2);
}
}
catch(e){}

If you haven't implemented CustomJSUrl, you can wrap this code in
<script> tags and place it at the bottom of the Create.aspx page  and the
SPCreate.aspx page in the C:\Program Files\Common Files\Microsoft
Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033 directory like
this:

<script>
try
{
//Used to remove the built-in Document Library from the Create page
var doclibLink = document.getElementById('onetCreate101');
if(doclibLink)
{
//There are three rows to remove from the DOM
//The row with the link in it and two blank rows that follow it
doclibRow = doclibLink.parentNode.parentNode;
doclibRowAfter1 = doclibRow.nextSibling;
doclibRowAfter2 = doclibRowAfter1.nextSibling;

//Remove all three rows from their parentNode (TBODY of the Table)
doclibRow.parentNode.removeChild(doclibRow);
doclibRowAfter1.parentNode.removeChild(doclibRowAfter1);
doclibRowAfter2.parentNode.removeChild(doclibRowAfter2);
}
}
catch(e){}
</script>

 
Answer #4    Answered By: Stephon Valentine     Answered On: Nov 26

Thanks for your email. I created a new Site Definition as given in the SharePoint Advisor magazine article and added the code in the custom ows.js file. The Document Library option was hidden. Then I uploaded the new Restorable Document Library Template. But I couldn't see "Deleted Items Document Library ( STS Web )" option in the create  Page. I just see Form Library Template within Documents Libraries.

I think since built-in Document Library and the Restorable Document Library are using the same Type="101" therefore hiding built-in Document Library is hiding Restorable Document Library too.

I also tried removing the entry  to built-in Document Library in the ONET.XML but I'm having the same problem. It removes both.

Is there any other way to hide  built-in Document Library and not the Deleted Items Document Library ( STS Web ).

Thanks for your inputs.

 
Answer #5    Answered By: Leif Cardenas     Answered On: Nov 26

I did have to wrap the JavaScript in a function and add it to Window onload when I put it into the custom ows.js file. But, the JavaScript code hides the built-in document  Library row based upon the first ID encountered in the HTML DOM with a specific value. It will not hide  both options.

Here is the complete code in my custom ows.js:

//Remove the built-in Document Library from the Create page

function RemoveDocLibLink()

{

try

{

//Get reference to Document Library link on the Create page

var doclibLink = document.getElementById('onetCreate101');

if(doclibLink)

{

//There are three rows to remove from the DOM

//The row with the link in it and two blank rows that follow it

doclibRow = doclibLink.parentNode.parentNode;

doclibRowAfter1 = doclibRow.nextSibling;

doclibRowAfter2 = doclibRowAfter1.nextSibling;



//Remove all three rows from their parentNode (TBODY of the Table)

doclibRow.parentNode.removeChild(doclibRow);

doclibRowAfter1.parentNode.removeChild(doclibRowAfter1);

doclibRowAfter2.parentNode.removeChild(doclibRowAfter2);

}

}

catch(e){}

}

AddToWindowOnload(RemoveDocLibLink);


//Utility to add an event to window.onload, if the browser supports it

function AddToWindowOnload(eventToAdd)

{

//First try to use attachEvent

if(typeof window.attachEvent != "undefined")

{

window.attachEvent("onload", eventToAdd);

}

//Then try to use addEventListener

else if(typeof window.addEventListener != "undefined")

{

window.addEventListener("load", eventToAdd, false);

}

//Append to existing window.onload events, if any,

//by creating a function

else if(window.onload != null)

{

var origOnload = window.onload;

window.onload = function(e)

{

origOnload(e);

eventToAdd();

};

}

//Finally, assign directly to window.onload

else

{

window.onload = eventToAdd;

}

}

 
Answer #6    Answered By: Jasper Hatfield     Answered On: Nov 26

Yes the code works  perfectly.
Thank you very much.
I did the whole thing again and it worked.

 
Answer #7    Answered By: Rashawn Hopper     Answered On: Nov 26

This is great. However I am encountering a problem. When I try to enter javascript:MSOTIPn_ShowToolPane('2'); into the browser I get an message that says Error on page  at the bottom of the browser. Is there another way to get to the Web Part Gallery page for each folder view.

 
Answer #8    Answered By: Horace Coffey     Answered On: Nov 26

would you consider posting this code to your blog for future reference? I could see this coming up a lot as a topic.

 
Answer #9    Answered By: Rigoberto Beard     Answered On: Nov 26

I thought that I did. I'll check when I have Internet again.

 
Didn't find what you were looking for? Find more on Restorable Document Library Or get search suggestion and latest updates.

Related Topics:



Tagged:      

 

Related Post