Domanda

Non mi permetto di modificare Core.js modo che non è la mia opzione. Mi permetto di aggiungere un editor di contenuti. Ho solo bisogno di rimuovere il "scaricare una copia" dal sottomenu. (Questo è solo per una particolare libreria). Il codice rimuove l'intero "Invia a". Qualsiasi suggesion?

<script language="javascript">
function AddSendSubMenu(m,ctx)
{
menuOption = CAMOpt("", L_DownloadACopy_Text, strAction, "");
menuOption.id = "ID_DownloadACopy";
}
</script>
È stato utile?

Soluzione 3

Questa cosa l'ho messo nella mia pagina master personalizzata. Non ho potuto pasticciare con Core.js perché ci sono molti più raccolta sito all'interno della stessa applicazione web.

<script type="text/javascript">

_spBodyOnLoadFunctionNames.push("resetAddSendSubMenu()");

function resetAddSendSubMenu() {
    AddSendSubMenu = function (m, ctx) {
        strDisplayText = L_Send_Text;
        var currentItemUrl = GetAttributeFromItemTable(itemTable, "Url", "ServerUrl");
        var currentItemEscapedFileUrl;
        var currentItenUnescapedUrl;
        var strExtension;
        if (currentItemFileUrl != null) {
            currentItenUnescapedUrl = unescapeProperly(currentItemFileUrl);
            currentItemEscapedFileUrl = escapeProperly(currentItenUnescapedUrl);
            strExtension = SzExtension(currentItenUnescapedUrl);
            if (strExtension != null && strExtension != "")
                strExtension = strExtension.toLowerCase();
        }
        var sm = CASubM(m, strDisplayText, "", "", 400);
        sm.id = "ID_Send";
        var menuOption;
        var serverFileRedirect = itemTable.getAttribute("SRed");
        if (currentItemProgId != "SharePoint.WebPartPage.Document" &&
        (serverFileRedirect == null || serverFileRedirect == "" || HasRights(0x0, 0x20)) && strExtension != "aspx") {
            if (typeof (ctx.SendToLocationName) != "undefined" &&
            ctx.SendToLocationName != null &&
            ctx.SendToLocationName != "" &&
            typeof (ctx.SendToLocationUrl) != "undefined" &&
            ctx.SendToLocationUrl != null &&
            ctx.SendToLocationUrl != "") {
                strAction = "STSNavigate('" + ctx.HttpRoot + "/_layouts/copy.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "&FldUrl=" + escapeProperly(ctx.SendToLocationUrl) + "')";
                menuOption = CAMOpt(sm,
                                ctx.SendToLocationName,
                                strAction,
                                "");
            }
            if (typeof (itemTable.getAttribute("HCD")) != "undefined" && itemTable.getAttribute("HCD") == "1") {
                strDisplayText = L_ExistingCopies_Text;
                strAction = "STSNavigate('" + ctx.HttpRoot + "/_layouts/updatecopies.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "')";
                strImagePath = ctx.imagesPath + "existingLocations.gif";
                menuOption = CAMOpt(sm, strDisplayText, strAction, strImagePath);
                menuOption.id = "ID_ExistingCopies";
            }
            strDisplayText = L_OtherLocation_Text;
            strAction = "STSNavigate('" + ctx.HttpRoot + "/_layouts/copy.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "')";
            strImagePath = ctx.imagesPath + "sendOtherLoc.gif";
            menuOption = CAMOpt(sm, strDisplayText, strAction, strImagePath);
            menuOption.id = "ID_OtherLocation";
            if (ctx.OfficialFileName != null && ctx.OfficialFileName != "") {
                strDisplayText = ctx.OfficialFileName;
                strAction = "STSNavigate('" + ctx.HttpRoot + "/_layouts/SendToOfficialFile.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "')";
                strImagePath = "";
                CAMOpt(sm, strDisplayText, strAction, strImagePath);
            }
            CAMSep(sm);
        }
        if (HasRights(0x10, 0x0)) {
            strDisplayText = L_SendToEmail_Text;
            var currentItemUrl = GetAttributeFromItemTable(itemTable, "Url", "ServerUrl");
            var httpRootWithSlash = ctx.HttpRoot.substr(0);
            if (httpRootWithSlash[httpRootWithSlash.length - 1] != '/')
                httpRootWithSlash += '/';
            var slashLoc = -1;
            var fileUrl = "";
            slashLoc = httpRootWithSlash.substring(8).indexOf('/') + 8;
            fileUrl = escapeProperly(httpRootWithSlash.substr(0, slashLoc)) + currentItemUrl;
            var serverFileRedir = itemTable.getAttribute("SRed");
            if ((serverFileRedir != null) &&
            (serverFileRedir != "") &&
            (serverFileRedir != "1")) {
                if (serverFileRedir.substring(0, 1) != "1") {
                    fileUrl = serverFileRedir;
                }
                else {
                    fileUrl = serverFileRedir.substring(1);
                }
            }
            strAction = "javascript:navigateMailToLink('mailto:?body=" + fileUrl + "')";
            strImagePath = ctx.imagesPath + "gmailnew.gif";
            menuOption = CAMOpt(sm, strDisplayText, strAction, strImagePath);
            menuOption.id = "ID_SendToEmail";
        }
        var serverFileRedirect = itemTable.getAttribute("SRed");
        if (currentItemFSObjType != 1 &&
        ctx.listBaseType == 1 &&
        (serverFileRedirect == null || serverFileRedirect == ""
           || HasRights(0x0, 0x20))) {
            if (ctx.listTemplate != 109 &&
            ctx.listTemplate != 119)
                AddWorkspaceMenuItem(sm, ctx);
            var strExt  = GetAttributeFromItemTable(itemTable, "Ext", "FileType"); 
            //alert("Extension: " + strExt);
            if (!(strExt == 'mp3' || strExt == 'wmv' || strExt=='wav' || strExt =='avi'))
                {
                    strAction = "STSNavigate('" + ctx.HttpRoot + "/_layouts/download.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "&FldUrl=" + escapeProperly(ctx.SendToLocationUrl) + "')"; ;
                    menuOption = CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
                    menuOption.id = "ID_DownloadACopy";
                }
            }
        }

    }


</script>

Altri suggerimenti

Il modo corretto per ottenere questo è attraverso una soluzione SharePoint con una caratteristica che nasconde l'azione. Hai bisogno di trovare l'ID della scaricare una copia, quindi creare un nodo per esso all'interno della Elements.xml. È possibile indirizzare ad un elenco specifico per il suo nome.

Le istruzioni sono qui:

http://msdn.microsoft. com / it-it / library / ms473643% 28v = office.12% 29.aspx

http://msdn.microsoft. com / it-it / library / ms414790% 28v = office.12% 29.aspx

<script type="text/javascript">
function CAMOpt(p,wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc)
{
    if (wzText === L_DownloadACopy_Text) {
        return {};
    }
    var mo=CMOpt(wzText,wzAct,wzISrc,wzIAlt,wzISeq,wzDesc);
    if(!mo)return null;
    AChld(p,mo);
    return mo;
}
</script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top