Modify the context menu of items in the document library and list Library

Source: Internet
Author: User

First, find the 2052 directory under the directory c: Program Files \ common files \ microsoft shared \ Web Server Extensions \ 12 \ template \ layouts (this is the path of the Chinese version by default, the English version of moss is the 1033 directory), where there is a core. in the JS file of JS, Ms has reserved custom interfaces for us to implement our own menu definition, which are the following two functions:

Funtion addlistmenuitems (M, CTX)
{
If (typeof (custom_addlistmenuitems )! = "Undefined ")
{
If (custom_addlistmenuitems (M, CTX ))
}
}

Funtion adddoclibmenuitems (M, CTX)
{
If (typeof (custom_addlistmenuitems )! = "Undefined ")
{
If (custom_addlistmenuitems (M, CTX ))
}
}

We implement User-Defined FunctionsCustom_addlistmenuitems(List Library) orCustom_addlistmenuitems(Document Library)
Function custom_addlistmenuitems (M, CTX)
{
If (hasrights (0x0, 0x4 ))
{

VaR strdisplaytext = "Modify status ";

VaR straction = "stsnavigate ('" + CTX. editformurl + "? Id = "+ currentitemid +" & source = "+ getsource () + "')";

VaR strimagepath = CTX. imagespath + "edititem.gif ";

// If there is a level-2 menu, change the Parameter m of the following function to the corresponding parent menu
VaR menuoption = camopt (M, strdisplaytext, straction, strimagepath, null, 220 );

Menuoption. ID = "id_edititemupdate ";

}
}

 

Put the aboveCodeAdded to the corresponding list or document library to implement the right-click Menu customization

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.