Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to display a customized message on top of the "New Site" dialog window, however since it is Silverlight I'm not sure if this is even possible.

I've thought of using javascript to highjack the "New Site" click event from the "Site Actions" menu before the dialog is displayed and show the message here. Then when the user clicks OK open the dialog with the Silverlight control and proceed as normal. But this seems like quite a hack and possibly not worth investigating further. Also it will not work if you create the web through "Manage Site Structure".

Is there an easier way to do this? Like a mechanism in SharePoint similar to how you add custom actions to the site actions menu? The message does not have to be a popup, just some way of displaying custom text as the user tries to create a new web.

share|improve this question
    
Are you talking about changing default "Create" at the top to something custom? –  Kai Feb 7 '13 at 9:17
    
No, I just want to display a message to the user. A popup, label or something. I don't need to change the Silverlight control at all. I just want a message to pop up above it that the user can then dismiss and continue using the default dialog like normal. –  Thomas Feb 7 '13 at 9:24

2 Answers 2

up vote 2 down vote accepted

I think less "painful" approach for you is modifying v4 masterpage. It contains SharePoint:SiteActions control with SharePoint:MenuItemTemplate runat="server" id="MenuItem_CreateSite".

You can update code in ClientOnClickScriptContainingPrefixedUrl to perform your logic, for example showing confirmation message like I do it:

<SharePoint:MenuItemTemplate runat="server" id="MenuItem_CreateSite"
    Text="<%$Resources:wss,siteactions_createsite%>"
    Description="<%$Resources:wss,siteactions_createsitedesc%>"
    ImageUrl="/_layouts/images/newweb32.png"
    MenuGroupId="200"
    Sequence="230"
    UseShortId="true"
    ClientOnClickScriptContainingPrefixedUrl="if (confirm('Are you sure?')) { SP.UI.ModalDialog.showModalDialog({url:'~site/_layouts/AddGallery.aspx', title: 'Create', width: 1050, height: 600}); }"
    PermissionsString="ManageSubwebs,ViewFormPages"
    PermissionMode="All" />
share|improve this answer
    
Thanks. This does exactly what I want! –  Thomas Feb 7 '13 at 10:53

Not as far as I know. As you rightly commented, this is a Silverlight component. Silverlight components are wrapped in Cab files and you dont have any way of changing it. Also, you can't hack it if you wanted using Javascript. JS and Silverlight are two totally different components. JS is used to modify DOM elements. Silverlight is an Object in the DOM, but uses a client plugin which you have no control over. If you really wanted to , i'd suggest you create your own Silverlight Component which mimics the existing Silverlight window for creating sites/lists/pages and hook it up to the Site Actions > More Options link.

share|improve this answer
    
What I meant about the script was to intercept the event before the dialog is shown and display the warning. Once the user clicked ok in the message (s)he would be redirected to the regular Sharepoint dialog. –  Thomas Feb 7 '13 at 8:28
    
Creating a new Silverlight control just for a message is not something I'm willing to do, but thanks for the reply. –  Thomas Feb 7 '13 at 8:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.