Recycle Bin.. Continued..End Game

After all this, one thing still remains - the javascript function mentioned in the install instructions. So here goes.

<script language=javascript>
function Custom_AddDocLibMenuItems(m, ctx)
{
var RootFolder = GetRootFolder(ctx);
setupMenuContext(ctx);

   if (currentItemFileUrl == null)
currentItemFileUrl = itemTable.ServerUrl;
if (currentItemFSObjType == null)
currentItemFSObjType = itemTable.FSObjType;
var currentItemEscapedFileUrl =
escapeProperly(unescapeProperly(currentItemFileUrl));

// document library might contain folders; thus we need to enable
// default delete on the folder
if (currentItemFSObjType == 1)
{
strDisplayText = L_DeleteDocItem_Text;
strAction = "DeleteDocLibItem('" +
ctx.HttpPath + "&Cmd=Delete&List=" + ctx.listName +
"&ID=" + currentItemID + "&owsfileref=" +
currentItemEscapedFileUrl + "&NextUsing=" + GetSource() + "')";
strImagePath = ctx.imagesPath + "delitem.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
else // build custom menus for the files
{
// build restore menu item and wire it to trigger Update
var L_Restore_Text = "Restore File";
strDisplayText = L_Restore_Text;
strAction = "SubmitFormPost('" +
ctx.HttpPath + "&Cmd=Save&List=" + ctx.listName +
"&ID=" + currentItemID + "&owsfileref=" +
currentItemEscapedFileUrl + "&NextUsing=" + GetSource() + "')";

       // reused approval image, but custom image can be
// associated with the menu item
strImagePath = ctx.imagesPath + "APPROVE.GIF";
CAMOpt(m, strDisplayText, strAction, strImagePath);

// build regular delete menu item to trigger a complete delete
// of the file
strDisplayText = L_DeleteDocItem_Text;
strAction = "DeleteDocLibItem('" +
ctx.HttpPath + "&Cmd=Delete&List=" + ctx.listName +
"&ID=" + currentItemID + "&owsfileref=" +
currentItemEscapedFileUrl + "&NextUsing=" + GetSource() + "')";
strImagePath = ctx.imagesPath + "delitem.gif";
CAMOpt(m, strDisplayText, strAction, strImagePath);
}
return true;
}

</script>

Now, I have not indulged in much explainations of the code, here, because the explaination remains essentially the same as that mentioned in the MSDN article mentioned in the first post. Of course there's another elegant implementation, that I chanced upon courtesy Ryan Rogers Blog. This article can also be found independently at : http://mindsharpblogs.com/todd/archive/2005/10/06/719.aspx

So enjoy the implementation!

Ciao,

Harsh