This is a Sandbox Solution. Once the solution is installed, it adds a custom ribbon (Set as Default Master) in the Share and Track group in the Documents tab of the Master Page Gallery. This ribbon button gets enabled only if a file with .master extension is selected in the gallery. It remains disabled, if a folder or any other file (file with extensions other than .master) is selected. It also remains disabled if more than one item is selected. The solution uses jQuery 1.9.1 version and gets it on run time, if jQuery is not already present on the page. If the currently set default master page is selected and the button is clicked, it will pop up a message saying "The selected master is the default. Choose a different one and try again.", after confirmation. Once clicked on OK, it will refresh the page for clearing the selection, so that the user can make another selection. Upon selecting another master page and clicking on the button, it will prompt for confirmation. Once confirmed, it will set the selected master as the default and a success message will be displayed to the user saying, "Successfully set the default master page." and once the user clicks OK, the page will refresh which will reflect the updated master page. The user performing this should be part of Site Owners group. Any user with lesser privileges will not be able to perform this and the ribbon button will be disabled. Of course, users with more privileges like Site Collection admin will be able to perform this functionality. This has been implemented in this way, to ensure users with just contributor access don't perform this action. Also, it will set the default master only on the root site of a site collection and not on all the sub sites or child sites, though it can be customized, if required.

Since its a Sandbox solution, just upload the solution (.wsp) file into the Solutions Gallery and activate it and make sure the feature (at the Site collection level) is activated. If not, go ahead and activate it. Once it is activated, you are good to go.

Last edited Nov 25, 2013 at 1:27 AM by venh123, version 2