Saturday, February 26, 2011

Display List In Content Query Webpart


 
    <DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV>
 
    <!-- Paste the URL of the source list below: -->
    <iframe id="SourceList" style="display:none;" src="/site/Lists/Calendar/Current%20Month%20Events.aspx" onload="DisplayThisList()"></iframe>
 
    <script type="text/javascript">
    function DisplayThisList()
    {
        var placeholder = document.getElementById("ListPlaceholder");
        var displaylist = null;
        var sourcelist = document.getElementById("SourceList");
        try {
               if(sourcelist.contentDocument)
                  // Firefox, Opera
                  {
                displaylist = sourcelist.contentDocument.getElementById("WebPartWPQ2") ;
            }
               else if(sourcelist.contentWindow)
                  // Internet Explorer
                  {
                displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ2") ;
            }
               else if(sourcelist.document)
                  // Others?
                  {
                displaylist = sourcelist.document.getElementById("WebPartWPQ2") ;
            }
        }
        catch(err)
        {
            alert ("Loading failed");
        }
        var allDescendants = displaylist.getElementsByTagName("*");
        placeholder.innerHTML = displaylist.innerHTML;
    }
    </script>
 
 

Show or Hide SharePoint 2010 ribbon based on SharePoint Groups

This SharePoint 2010 solution allow site administrator to define who can or cannot see the SharePoint ribbon.
In few words
With this solution you can on each site define if the ribbon is display or not for :
    * Everyone
    * Anonymous user
    * for one or many specific SharePoint groups
This solution can be found on codeplex.com


Sunday, February 13, 2011

Useful JavaScript global variables in SharePoint

If you’re using custom JavaScripts with SharePoint 2010 some global JavaScript variables may come in handy.
These variables work if you’re using SharePoint’s default or any other custom master page. 

L_Menu_BaseUrl – the base URL of the site / subsite. Very useful when you need to determine the absolute path of the site in JavaScript. Example: document.location = L_Menu_BaseUrl + ‘lists/calendar/allitems.aspx’ //redirects to Calendar list 

L_Menu_LCID – the LCID of the site you’re in. Useful if you need to determine the language of the site. The list of Locale IDs can be found here. 

_spUserId – the ID of the logged in user.

Thursday, February 3, 2011

Hide Recently Modified Items

Hide Recently Modified Items


In SharePoint 2010 we all are familiar with the following annoying quicklaunch menu:




Follow these steps : 
  1. Go to  "Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Template\DocumentTemplates" .
  2. Open "wkpstd.aspx" file.
  3. Search for tag "SharePoint:RecentChangesMenu".
  4. Add visible="false"  at the end of this tag.
  5. Save this file & refresh SharePoint site .