25 May 2011

Hiding Inactive Ribbon Commands in SharePoint 2010

The SharePoint ribbon is still new to some end users who are still using Office 2003 or have limited knowledge about Office in general. I have on several occasions heard that the amount of options made available to the user are daunting.

In this post, I am looking at removing the ribbon commands that are unavailable for the user, or “greyed out” and also removing the entire group should none of the commands in that group be available.

The whole purpose of this is to increase usability for the end users and I am fully aware that this will not be everyone’s cup of tea, so like it or leave it. I would definitely recommend end user training over technical implementations, but the combination of these worked well for clients of mine in several occasions.

Customizing the Ribbon

First of all, you can add new tab sections, remove existing tabs, limit what options are available to the rich-text editor and add your own context-driven groups.

Chris O’Brien has an excellent series of posts on ribbon customizations, which can be read at:

For information on how to customize the editing options for the rich text editor, check out Waldek Mastykarz’s blog entries:

Hiding Inactive Commands and Groups

If a read-only user uses the ribbon on a team site, he/she will see a set of options that are not available:

image

Running a small amount of jQuery and CSS, the user is instead presented with the following options:

image

Implementation:

The inactive links in a ribbon is attributed with the CSS class “ms-cui-disabled” and we can hide these with a CSS stylesheet as:

   1: <style type="text/css">



   2: a.ms-cui-disabled



   3: {



   4:     display: none !important;



   5: }



   6: </style>




Then, a jQuery function checks to see what tab groups have only hidden content and hides these. In addition, the hidden tab actions containers are removed so that all controls are top aligned.





   1: function checkRibbon() {



   2:     // Loop the tab groups



   3:     $("div.ms-cui-tabContainer ul li.ms-cui-group").each(function () {



   4:  



   5:         var obj = $(this);



   6:  



   7:         // How many links in total in this group?



   8:         var allLinks = $("a", obj).length;



   9:         



  10:         // How many are disabled?



  11:         var disabledLinks = $("a.ms-cui-disabled", obj).length;



  12:  



  13:         // If all links are gone, hide the ribbon group



  14:         if (allLinks == disabledLinks) {



  15:             obj.hide();



  16:         }



  17:         else {



  18:             // Some are active, show the group



  19:             obj.show();



  20:  



  21:             // Remove the container for inactive controls so that all 



  22:             // controls are top aligned



  23:             $("a.ms-cui-disabled", obj).each(function () {



  24:                 if ($(this).parent().attr("class") == "ms-cui-row") {



  25:                     $(this).parent().hide();



  26:                 }



  27:             });



  28:         }



  29:  



  30:         // Personally, I do not like the pages view on the page editing 



  31:         // section and the ID is in a format that do not allow direct 



  32:         // removal in CSS. Very optional.



  33:         $("span", obj).each(function () {



  34:             if ($(this).attr("id") == 



  35:                     "Ribbon.Library.CustomViews-LargeMedium-2-2") {



  36:                 $(this).hide();



  37:             }



  38:         });



  39:     });



  40: }



  41:  



  42: // Track current selected ribbon tab



  43: var ribbonSelected;



  44:  



  45: function checkRibbonState() {



  46:     // Has the ribbon tab changed or has the ribbon never been set up?



  47:     var id = $("li.ms-cui-tt-s").attr("id");



  48:     if (ribbonSelected != id)



  49:     {



  50:         ribbonSelected = id;



  51:         checkRibbon();



  52:     }



  53: }



  54:  



  55: // Start the watcher for ribbon select. Decrease interval if you find 



  56: // client has performance issues, I found none during testing



  57: function beginCheckRibbon() {



  58:     // Increase parameter from 10 up if you have performance issues



  59:     var checkRibbonStateInterval = setInterval("checkRibbonState()", 10); 



  60: }



  61:  



  62: // Start the watcher when the page has finished loading



  63: $(document).ready(function () {



  64:     setTimeout("beginCheckRibbon()", 500);



  65: });




Last, I add a CSS style to hide the ribbon inside wrapper until the script has determined its visibility, otherwise the tab “jumps” around while the script is executed.





   1: <style type="text/css">



   2: div.ms-cui-tabContainer ul li.ms-cui-group



   3: {



   4:     display: none;



   5: }



   6: </style>


10 May 2011

Sogeti SharePoint Round Table #10 @Linköping

IMG_0634

Intro

Saab Group, the defence and security enterprise, hosts the 10th SharePoint Round Table in Linköping.

This conference has a focus on multilingual features in SharePoint 2010, current trends in Best Practices, Azure Cloud and the ongoing Governance discussion continues.

Agenda (Revised)

Day One

11:30 Lunch with meet & greet
12:15

Introduction


Anders S Berndtsson, Saab Group, opens the conference.
13:00

Kick-off


Mats Stuhrmann, Sogeti, introduces the different upcoming activities.
The attending companies introduce themselves. Anders S Berndtsson presents Saab Group and their new SharePoint project.
14:00

Mutlilingual management and features on the web


How do large global corporations manage multiple languages on their local business areas? What support are there for information distribution using the world’s different languages? Matz Söderberg, Lionbridge ( the world’s largest translation company with clients such as Microsoft) presents.
14:30

Chalmers – Enterprise Search using FAST for SharePoint


Tony Ottosson Gadd, Chalmers and Tobias Lekman, Sogeti, shares their insights and experiences from the planning phase of the Enterprise Search project and the collaboration with Microsoft Consulting Services which aims to set up FAST for SharePoint for the public website and the upcoming Intranet.
15:30

Zooma – Online


Anders Björklund from Zooma talks about the online concept and its connection to marketing and online presence. An indescribable presentation – you got to be there.
18:00

Lantmännen Goes Collaboration


Stefan Hägglund, Lantmännen, and Tobias Lekman, Sogeti, shares experiences and insights from their ongoing Intranet project where collaboration is a pillar in combination with multilingual support for 14 different languages.
19:30 Dinner

Day Two

08:30

Deep Dive Dialogs

 

    • “The Complete Picture”, Control vs. Freedom of Information
        • Dissect Saab Group’s new SharePoint solution: good and bad?
  • Extranet/Internet collaboration on one platform
  • SharePoint: areas of usage and application
  • “Social” functions and SharePoint: what’s the alternatives?
12:30 Lunch and wrap-up

Notes to self

The sessions at Round Table sparks many interesting discussions and thoughts. Amongst many light bulb, “aha!” moments and visions I had during these days, here’s the ones that stand out (in no particular order):

  • When running workshops with people with mixed IT competence/maturity, either separate the groups or raise the competence in the group
  • Must read the books “Long Tail”, “Free” and “The Thank You Economy”
  • Must view more presentations from TED
  • Finish my LinkedIn connector package for SharePoint and publish it on CodePlex
  • Make sure that there is a project budget for the project that follow yours, such as content migration, online communication, support, training or copywriting

04 May 2011

Custom Document Set Features in SharePoint 2010

Introduction

During a project we found that packaging custom document sets in SharePoint was not as straight-forward as we thought. In this post, I will share lessons learned and solutions for packaging and deploying custom document sets.

About Document Sets

“Document Sets is a new feature in SharePoint Server 2010 that enables an organization to manage a single deliverable, or work product, which can include multiple documents or files. A Document Set is a special kind of folder that combines unique Document Set attributes, the attributes and behavior of folders and documents, and provides a user interface (UI), metadata, and object model elements to help manage all aspects of the work product.

Document Sets planning (SharePoint Server 2010) (TechNet): http://technet.microsoft.com/en-us/library/ff603637.aspx

The Issue

When creating a new document set and customizing the document set properties, these work well in SharePoint but are hard to package and export.

Steps:

  1. Activate the Document Sets site collection feature
  2. Create a new document type that inherits the Document Set content type
  3. Customize the document set properties

Create and manage document sets (Microsoft): http://office.microsoft.com/en-us/sharepoint-server-help/create-and-manage-document-sets-HA101782480.aspx

You can try to export the document set as:

  • Exporting a list using the content type as a list template
  • Save the site as a sandboxed site template solution
  • Import the content type using Server Explorer in Visual Studio

None of the solutions will allow us to control the document property settings. On top of that, importing the content type in Visual Studio does not even generate XML that is valid according to the schema.

The Solution

  • First of all, we will import the Content Type ID into a new Content Type module in Visual Studio
  • Then, we customize the XML for the document set content type.
  • Last, we add a custom version of the feature event handler that provisions the document set welcome page

The issue is that, inheriting directly from this code, the web parts on the welcome page will be provisioned each time the feature is activated, making upgrades a tad hard. Also, when the feature deactivates a check is made to see if the document set content type is in use and then cancels the deactivation process. This is not what we want to do.

I have posted the solution on MSDN Snippets Gallery instead of adding all the source code in this post.

image

Provisioning Event Handler for Custom Document Set Features in SharePoint 2010 (MSDN Code Snippets) http://code.msdn.microsoft.com/Custom-Document-Set-eb3fbcfd

Tobias Lekman
Search this blog