Making changes directly to ows.js is not supported by Microsoft. To
alter all document libraries, I would modify my custom JavaScript file
identified in the ONET.XML Project element's CustomJSUrl attribute in
the Site Definition. This is an optional attribute that is not initially
implemented and it specifies a custom JavaScript file that I place into
my Custom directory in the 60 hive (..\60\TEMPLATE\LAYOUTS\1033\Custom).
This custom JavaScript file contains script to execute within a site
created from the site definition and must be in place before the site is
templatized on the Template Picker Page.
The ONET Project element in all of my Site Definitions looks like this:
<Project xmlns:ows="Microsoft SharePoint"
AlternateCSS="/_layouts/<%=System.Threading.Thread.CurrentThread.Current
UICulture.LCID%>/Custom/ows.css"
AlternateHeader="/_layouts/<%=System.Threading.Thread.CurrentThread.Curr
entUICulture.LCID%>/Custom/Header.aspx"
CustomJSUrl="/_layouts/<%=System.Threading.Thread.CurrentThread.CurrentU
ICulture.LCID%>/Custom/ows.js"
ListDir="Lists"
Title="Todd Web Site"
>
If you only want to alter one or even just a few document libraries, I
would suggest adding a Content Editor Web Part to the Web Part List View
page (see my blog post about adding Web Parts in the browser even when
there isn't a Modify Shared Page link in the top right hand corner:
mindsharpblogs.com/.../285.aspx). Then place
JavaScript that overrides the built-in functionality into the Source
Editor.
For instance, you could drop in this code:
<script language="JavaScript">
function Custom_AddDocLibMenuItems(m, ctx)
{
var L_AuditInfo = "Display Audit Info";
var strDisplayText = L_AuditInfo;
var strAction = "STSNavigate('" + ctx.HttpRoot +
"/_layouts/1033/Custom/LnTDesignWorkflow.aspx?list=" + ctx.listName +
"&item=" + currentItemID + GetRootFolder(ctx) + "')";
strImagePath = ctx.imagesPath + "checkin.gif";
//Add your new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);
//Add a separator to the menu
CAMSep(m);
//Returning false will render the standard menu items
return false;
}
</script>
I think that will do what you are trying to accomplish. I had to define
some text for L_AuditInfo. I also took out L_Testpath and replaced it
with my default Custom subdirectory.
You can check out the SDK details about altering the context menu here:
msdn.microsoft.com/.../spptsdk
/html/tsptAddingContextMenu_SV01068564.asp
Also, see my blog post about the AlternateCSS attribute for common
details about implementing this solution:
mindsharpblogs.com/.../342.aspx