문제

I need to add a custom action to versions of a file. Optimally, I want it on the Version History page:

enter image description here

A second best would be the version display form (the result of clicking View on the previous menu):

enter image description here

The users are already working with the version history, and want to easily copy some details from a specific version. I'd like to avoid making them select the version again in my own window.

도움이 되었습니까?

해결책

The menu is built in JavaScript in the CORE.js file. If you need to add a new menu item, you are going to have to overrides this file... Not cool.

A better approach is to use JavaScript to override the function which creates the menu in Core.js. You will just need to reference your file after the Core.js file and be careful with the defer loading.


About the version display form, the template is defined in DefaultTemplates.ascx with the id DocLibDisplayFormVersionToolBar.

I guess you could overrides the default rendering by your own.

다른 팁

I was able to add a menu item as Gilloux suggested in the comment. Here's how it's done, by overriding the method from Core.js:

// keep original version
var original_AddVersionMenuItemsCore;

// override the function from Core.js 
function Kobi_AddVersionMenuItemsCore(m, ctx) {
    // first, add the original menu items:
    original_AddVersionMenuItemsCore(m, ctx);

    // add my menu item:
    var menuOption = CAMOpt(m, "Add Version to My Project",
                            "javascript:alert('This one');",
                            "/_layouts/images/mewa_gotoNamedItems.gif");
    menuOption.id = "ID_Kobi_AddVersionToProject";
}

function Kobi_AddVersionActionsOnLoad(){
    original_AddVersionMenuItemsCore = AddVersionMenuItemsCore;
    AddVersionMenuItemsCore = Kobi_AddVersionMenuItemsCore;
}

// run the method at window load event
_spBodyOnLoadFunctionNames.push("Kobi_AddVersionActionsOnLoad");

Result:
enter image description here

Some help came from Google and these posts:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top