Please upgrade your web browser now. Internet Explorer 6 is no longer supported.
Zac Smith
SharePoint, WSS and MOSS development.
Recently I spent a number of hours banging my head against a wall trying to customize some of the rich DHTML functionality in SharePoint. Basically I wanted to remove the Workflows option from the default list item context menu (Edit Control Block).
ECB With Workflow
 
I couldn't use a feature as this doesn't work for the built in elements and I didn't want to mess with CORE.js as it's never good practive and would effect all doc libs. So I worked out which method to override and then added this code inside PlaceHolderMain for the allitems.aspx page like so:
 
 <script type="text/javascript">
  
    function AddWorkflowsMenuItem(m, ctx)
    {
        //do nothing  
    }
 </script>
 
The idea is that it will override the defualt behaviour of adding the menu with nothing - and hence not show the menu. For some reason this didn't work, in fact when debugged, the JavaScript was throwing an error. Interestingly it worked in FireFox so I knew I wasn't doing anything wrong. Initially I thought maybe this could be a browser compat thing but overriding a method is the same in any browser.
 
Eventually it dawned on me that the problem was the core.js script had not yet been loaded. The culprit was the ScriptLink control:
<SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/>
 
Basically this control is referencing the CORE.js external javascript file. However becuase the defer tag is specified it is loaded after my function override is declared. This deferred loading is usually a good thing as the page doesn't have to halt it's loading for the script - instead it is loading in the background. This gives a perceived performance boost to the user.
 
In my case I was able to add the scriptlink without the defer tag to just the page I needed to (allitems.aspx). All other pages in the site can still benefit from the deferred loading and I get the desired functionality:
 
ECB With Out Workflow
Categories:
Last night the CKS BLog Edition went live, its an amazing enhancement to the standard SharePoint blogs and something i've been using on this blog since the first beta.
More details over at the SharePoint team blog
 
Categories:
One of my biggest gripes with SharePoint is the difficulty in branding application or layout pages. These are the pages that no matter how much you tweak your master page, remain blue.
 
EXAMPLE:
here is my nice branded site
branded
I want to upload a document, so i click upload document and get thrown back to this ugly page:
unbranded
 
ouch!
 
I discussed one possible option for the user profile pages in an article series (http://zac.provoke.co.nz/archive/2007/10/30/how-to-customize-the-user-information-page-part-3.aspx)
 
But that is a lot of work if you are going to do it for a large number of pages - it may be plausible if there are half a dozen but in a collaboration portal scenario there are dozens of these pages.
 
So what are the options currently available....
 
Customize the files in the Layouts folder
This is actually the recommended approach by MSFT. Its very simple - take a backup and then modify away.
The obvious disadvanatge is when you are hosting more than one site on the same server - the changes affect all sites in your farm. Oh and any service pack/hotifx could overwrite any of your chnages.
 
Create a custom Layouts folder
This is a little better than the last method. You take a copy of the layouts directory and update IIS to point to the copy. Now all site collections in a single web app will share any modifications which is pretty acceptable. Your files can still be overwritten and you may get some strange behaviour for anything hardcoded to the layouts dir.
 
Check this Knowledge byte article for more info on these 2 methods.
 
SuperBranding
So this definately comes closest to an acceptable solution. Its a CodePlex project that has been put together by the legendary Ted Pattison. The way it works is by running an HTTP Module that intercepts page requestsa and overrides the preinit method to attach a custom mater page. Now we have full flexibilty and MSFT won't overwrite our customizations.
The upload page with superbranding:
 
superbranded
That is a million times better!!!
Categories: