Tag: User Interface (UI)

  • Easily add jQuery tabs using the “Reusable Content” feature

    Easily add jQuery tabs using the “Reusable Content” feature

    This post is quite a fun one. Whilst I was working with a customer today someone came up to me and asked if it was possible to add tabs to their content pages to which I gave it a few seconds thought and I responded “sure that’s absolutely possible – leave it with me!”.

    I then spent my commute home thinking about how tabs could be delivered for end-users to make use of without them having to meddle around with any code. Sure getting tabs to work in SharePoint is pretty straight forward and is something we’ve all done at least on a couple of occasions but I give more thought about making it easier for the end-users to consume rather than just meeting the customer’s requirement by putting in a solution that isn’t pretty nor easy to use.

    Solution

    I eventually decided to use, what I thought was a very simple approach to giving users the option to use tabs. My solution makes use of the tabs from the jQuery UI (http://jqueryui.com/tabs/) library. It starts with a small modification to the master page that is currently being used. The following code should be added before the closing </head> tag.

    <link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
    // <![CDATA[
    $(function() {
    $("#tabs").tabs();
    });
    // ]]>
    </script>

    I then added the following to the “Reusable Content” list in the root site of the Site Collection where I was adding tabs. Make sure that the “Automatic Update” is unchecked for this piece of reusable content.

    Reusable Content item
    Reusable Content item
    Reusable Content Lists
    Reusable Content Lists

    Below is the code that should be added to the Reusable HTML field.

    <div id="tabs">
    <ul>
    <li><a href="#tabs-1">Overtype tab 1 title here</a></li>
    <li><a href="#tabs-2">Overtype tab 2 title here</a></li>
    <li><a href="#tabs-3">Overtype tab 3 title here</a></li>
    </ul>
    <div id="tabs-1">Overtype tab 1 content here.</div>
    <div id="tabs-2">Overtype tab 2 content here.</div>
    <div id="tabs-3">Overtype tab 3 content here.</div>
    </div>

    To add the tabs onto a content page you can simply select the item that has just been added to “Reusable Content” list by clicking on the “Insert” tab whilst editing the page and expanding the “Resumable Content” menu.

    Reusable Content menu
    Reusable Content menu

    Rich text that represents the HTML markup for the tabs is then added onto the page. Each tab is represented by a bullet list item “<li>” and a content area “<div>”. The names of tabs you require can then be added by carefully overtyping the existing tab names. You must be careful not to introduce or remove any markup as this might prevent the tabs from working correctly.

    Once you have entered the names of the tabs you can then add the appropriate content by overtyping the content that you wish to include in that tab. This content can consist of rich text such as tables, images and also web parts. Again you must be careful not to introduce or remove any markup. Any tabs that are no longer required can be carefully removed by deleting the bullet list item and content area.

    Tabs demonstration
    Tabs demonstration

    There are other ways to achieve the same result but I thought this was a simple approach using out-of-the-box functionality. Happy tabbing!

     
  • The Sign in as Different User option is missing in SharePoint 2013

    The Sign in as Different User option is missing in SharePoint 2013

    I’ve been exploring SharePoint 2013 in recent days and noticed that the ‘Sign in as Different User’ option or action from the welcome control (user menu) seems to have been removed or forgotten from the user interface in this build.

    Sign in as Different User in SharePoint 2010
    Sign in as Different User in SharePoint 2010
    No sign in as different user missing in SharePoint 2013
    No sign in as different user missing in SharePoint 2013

    For someone who works with SharePoint as I do, any kind of administration, developing or testing that requires you to sign in as another you will now become convoluted from the previous version and is somewhat frustrating and annoying. Others such as Nick Grattan have discussed this issue and possible workarounds.

    Of all the workarounds currently available such as browsing to the closeConnection page directly, modifying the welcome control and adding the control back (I do not recommend this approach), creating a javascript bookmark, embedding jQuery into the master page to insert the option back in the menu and lastly launching the browser with the RunAs option my preference will remain to browse directly to the closeConnection page:

    /_layouts/closeConnection.aspx?loginasanotheruser=true

    Or alternatively, use the javascript bookmark Cory Peters has kindly created:

    javascript:window.location.href=”http://”+window.location.host+”/_layouts/closeConnection.aspx?loginasanotheruser=true”;

    It will be interesting to see what others do and as to whether or not the option gets added back by Microsoft in a future update.

  • Adding a Yes, No, Cancel prompt to a PowerShell script

    When I write PowerShell scripts, I often want to step through sections. This allows me to decided whether to proceed with parts of my script or not. I achieve this by using the ChoiceDescription class as demonstrated below.

    More information about using prompts in PowerShell can be found in the following article and tip on Microsoft TechNet.