FAQ: How to Remove “Show All”, “Hide All” and “Full Screen” in the SPELL Tabs Gratis Version

TabsSections

 

 

Haven’t tried out the gratis version of the SPELL Tabs yet? Fill out the contact form with your company information, and you’ll receive the solution within 48 hours.

The SPELL Tabs interface includes 3 sections:

  • tabs for inline content (bound to Web Parts, similar to the Easy Tabs)
  • tabs for links (navigate to other pages)
  • controls

When I started sharing samples from the SPELL program, last year, the most frequent question I got was: “How can I remove the link to Path to SharePoint from the tabs?”. That’s right, one of the tabs was a link to this blog (cf. above screenshot), a friendly reminder that I brought the solution to your home.

Not so friendly as it turned out, as seeing that tab systematically in any tabbed interface was more than a user can bear. Lesson learned, when I released the gratis version 1.1 earlier this year, I made sure the Path to SharePoint link was removed.

To date, more than 200 companies have adopted or are evaluating v1.1, and I am not getting questions about links anymore… here’s what I get now: “I don’t need the Show All (+), Hide All (-) and Full Screen ([ ]) controls, how can I remove them?”.

 

Why these controls?

First, let me explain the main reason why I added these controls in the first place: printing. Users sometimes like or need paper or pdf copies of the zone content. In such cases, they usually need to make all the Web Parts visible, and sometimes hide the rest of the page. In some cases, I have implemented custom interfaces where the user can pick which Web Parts he/she wants to print. Such implementations are usually combined with stylesheets that include media types.

So think about it before deciding to remove the controls!

 

How to modify or remove the controls?

In the full version, you can manage the controls via the Tabs editor. In the gratis version however, you need to do it manually:

1. Follow the general instructions in the documentation. You’ll end up with a URL that looks like this:

SPELL1.1.0TabsGratisVersion.aspx

SPELL1.1.0TabsGratisVersion.aspx#css.activeBackground=Orange

2. Append the custom control settings

SPELL1.1.0TabsGratisVersion.aspx#controls.viewAll=;controls.hideAll=;controls.fullScreen=

SPELL1.1.0TabsGratisVersion.aspx#css.activeBackground=Orange;controls.viewAll=;controls.hideAll=;controls.fullScreen=

 

Instead of removing the controls, you can also change their look, for example:

SPELL1.1.0TabsGratisVersion.aspx#controls.viewAll=Expand;controls.hideAll=Collapse

 

Get SPELL Cascading Selects 1.1 from my Office 365 site

Cascading Selects EditorAfter the SPELL Tabs two weeks ago, I am now adding a Cascading Selects package to my Office 365 site.

I already mentioned the Cascading Selects back in November. It was initially created for demo purposes, to showcase the capabilities of SPELL Form, a module designed to enhance SharePoint out of the box forms.

In light of recent events (and in particular this update from the Microsoft Office team), I have repackaged it, and I am making a gratis version available to teams and small businesses. If you are interested, fill out the contact form with your company information, and you’ll receive both gratis versions – Tabs and Cascading Selects.

These packages are end user solutions, and come with an “editor view” (cf. screenshot). The full versions are more sophisticated, with tools for power users and front end developers. SPELL works in SharePoint 2007, 2010, 2013, and Office 365 (version 16).

If you are one of the 100 users who already registered their company to get the Tabs, the link to the Cascading Selects should already be in your mailbox!

Trick or treat? Group items by month

OrderedMonthsIt’s that time of the year again when the unnatural becomes the norm, so let’s continue the tradition started last year with the SPELL program. Our goal today will be to display list or library items grouped by month, as shown in the screenshot.

The deal is that we don’t want any custom code or workflow here, just the regular out of the box UI features. We’ll be creating two calculated columns, called Year and Month, where we’ll insert the appropriate formulas. I chose the “Modified” column for my sample formulas, but of course any other date column would work too.

The YEAR and MONTH functions

YearNumber

A quick review of the SharePoint date functions gives you YEAR and MONTH that should fit the bill:

Year:  =YEAR(Modified)
Month: =MONTH(Modified)

The result is less than satisfactory though (see screenshot), as the year is displayed with a thousands separator. and months are displayed as numbers.

The magical TEXT function

MixedMonthsFurther exploration will take you to the TEXT function. It is not very well documented in SharePoint, fortunately you can rely on the Excel documentation and come out with the following formulas:
Year:  =TEXT(Modified,"yyyy")
Month: =TEXT(Modified,"mmmm")

Still not happy with the result? Right, the months are displayed in alphabetical order, not sequential order, not yet an ideal experience for our end user.

So let’s pull our last trick, and use the following formula for the calculated month:
Month: =REPT(" ",13-MONTH(Modified))&TEXT(Modified,"mmmm")

You can see the final result live on this page.

What’s the trick? We are still relying on the out of the box alphabetical sorting, but to force the order, we are adding a bunch of white spaces before the month name. The calculated Month actually contains the following values (each _ represents a white space):
____________January
___________February
__________March

__November
_December

Now, why don’t we see these spaces on the Web page? What makes the magic work is that when you insert multiple spaces in a Web page, the html specification says that

user agents should collapse input white space sequences

That’s it!

If you want to get really fancy, you could even use the zero-width space character. The best part is that people who edit your formula won’t even understand the trick, as the zero-width space won’t be visible (there’s however a good chance that they break your cool formula).

To take this further

You can apply this trick to other situations. A typical example is a color code. The alphabetical order will give you Green-Red-Yellow or Amber-Green-Red, you can address that by adding the appropriate leading spaces.

Be careful with this technique though: even if the rendering looks fine, the spaces are indeed stored in the field, and this might break other customizations. So this trick is better kept in a calculated column that will be exclusively used for rendering purposes.

More pocketSOAP examples: Pie and Bubble Charts

A couple weeks ago, I introduced pocketSOAP, an experimental JavaScript library that facilitates interactions with SharePoint SOAP services.

Today let me share two more examples built on SOAP and the templating engine, combined with Google Visualization Charts, to render charts from SharePoint lists.

If you have subscribed to the SPELL newsletter, you’ll find pocketSOAP in your mailbox this week. Keep in mind that it is an experimental library, only the full SPELL library is meant for production environments (cf. disclaimer in the previous post).

I am not expecting you to be impressed by the screenshots below. After all, I’ve been publishing client side charting demos in this blog since 2008, and since then many others have followed. The real kicker here is how compact and versatile the code is. Even if you are not interested in client side scripting for a production environment, a tool like SPELL/pocketSOAP could prove really useful in a prototyping phase, and save you many hours of hardcore (re)programming!

Example 1: Pie Chart
PieChart
For this first example, I used the same SharePoint list as in the previous post, with two columns:

  • the default “Title” for the item name
  • “Priority” as a choice field with 3 options (high/medium/low)

The code:

<div id="results"></div>
<script type="text/javascript" src="pocketSOAP.min.js"></script>
<script type="text/javascript" src="//www.google.com/jsapi"></script>

<script type="text/javascript">
// Load the Google charting library
google.load("visualization", "1", {packages:["corechart"]});
// Get items from the Projects list
var promisedItems = pS.soap({
 // Service info
 site:"https://usermanaged.sharepoint.com/TestZone",
 service:"Lists",
 operation:"GetListItems",
 // Service parameters
 listName:"Projects",
 viewFields:"<ViewFields><FieldRef Name='Title' /><FieldRef Name='Priority' /></ViewFields>"
});
pS.when(promisedItems)
.then(function(request){
 // When ready, run the charting function
 google.setOnLoadCallback(function(){drawChart(request);});
});
 function drawChart(request) {
 // The templating engine formats the data string according to Google format
 var dataString=pS.applyTemplate({
 template:'[["Project","Priority"][<|,["|Title|","|Priority|"]|>]]',
 prefix:"ows_",
 data:pS.byTagNS(request.responseXML,"row","z")
 });
 var dataTable = google.visualization.arrayToDataTable(JSON.parse(dataString));

// Group by priority. Priority is the second column (index = 1)
 var data = google.visualization.data.group(dataTable, [1], [{'column': 1, 'type': 'number', 'aggregation': google.visualization.data.count}]);
 var chartOptions = {'title':'Priority','width':400,'height':300,colors:['red','#FFC200','green']}; // #FFC200 is the color code for amber
 var chart = new google.visualization.PieChart(document.getElementById('results'));
 chart.draw(data, chartOptions);
}
</script>

The SOAP call is almost the same as in the previous post. The only difference is that I have explicitly told SharePoint which fields I want to retrieve, via the viewFields option. This is not mandatory but it will reduce the size of the dataset and improve performance.

The use of the templating pattern (pS.applyTemplate) to convert data formats is unusual – as a matter of fact I have never seen this used elsewhere. I am not advertising it as a best practice, and more traditional object manipulation could be used here to the same effect. But I really like how templating makes the code easier to maintain.

Templating is a very popular pattern in modern JavaScript, and can be found in many libraries, like jQuery, mustache, handlebars and others. The SPELL/pocketSOAP flavor might not be as powerful as those big names, but in just 1 kb of code it still has a lot to offer, and – as you would expect – it is well adapted to work with SharePoint Web Services, for both XML and JSON output (to use it with JSON instead of XML, simply replace the [< >] notation with [{ }]).

Example 2: Bubble Chart

BubbleChart

For this second example, I created a SharePoint list with 5 columns:

  • the default “Title” for the product name
  • “Risk” as a choice field with 3 options (low/medium/high)
  • “Cost” and “Revenue” are numbers
  • “Profit” is a calculated column:
    [Profit]=[Revenue]-{Cost]

The code:

<div id="results"></div>
<script type="text/javascript" src="pocketSOAP.min.js"></script>
<script type="text/javascript" src="//www.google.com/jsapi"></script>

<script type="text/javascript">
// Load the Google charting library
google.load("visualization", "1", {packages:["corechart"]});

// Get items from the PMO list
var promisedItems = pS.soap({
 // Service info
 site:"https://usermanaged.sharepoint.com/TestSite",
 service:"Lists",
 operation:"GetListItems",
 // Service parameters
 listName:"PMO"
});

pS.when(promisedItems)
.then(function(request){
 // When ready, run the charting function
 google.setOnLoadCallback(function(){drawChart(request);});
});

function drawChart(request) {
 // The templating engine formats the data string according to Google format
 var dataString=pS.applyTemplate({
 template:'[["Product","Cost","Revenue","Risk","Profit"][<|,["|Title|",|Cost|,|Revenue|,"|Risk|",|Profit|]|>]]',
 prefix:"ows_",
 data:pS.byTagNS(request.responseXML,"row","z"),
 sanitize:function(string){return string.replace(/float;#/,"");}
 });

var dataTable = google.visualization.arrayToDataTable(JSON.parse(dataString));

var chartOptions = {
 title: 'PMO',
 width:500,
 height:400,
 colors:['green','#FFC200','red'], // #FFC200 is the color code for amber
 legend:{position:'top'},
 hAxis:{title: 'Cost',maxValue:100},
 vAxis:{title: 'Revenue',maxValue:100}
 };

var chart = new google.visualization.BubbleChart(document.getElementById('results'));
 chart.draw(dataTable, chartOptions);
}
</script>

Note in the template the difference between text fields (for example “|Title|”) and number fields (for example |Cost|). Also, this time I had to include a sanitize function to remove the weird “float;#” string that SharePoint prepends to calculated columns.

The above code samples could easily be tweaked to work with other client side charting libraries, like Dojo, HighCharts, or [name-your-own]. If you are interested in a demo, leave a comment with the name of your favorite charting tool!

SPELL Nav, the successor of the Easy Tabs

The SPELL library is reaching version 0.8 this month. My main achievement in this release is the completion of the “Inline Navigation” module.

SPELL supports SharePoint 2007, 2010, 2013 and Office 365, and to demonstrate it I have updated all my sites:

All pages run the same version of SPELL, and the look of each menu is controlled via options. The idea is the same as with the original Easy Tabs – reuse the Web Part titles to automatically generate the navigation – but the code has been completely refactored. It is now more solid, for example when it comes to synchronization with the rest of the page, styling, print preview, and inclusion in wiki pages. It also offers more features:

  • Option to have more than one Web Part per tab
  • Compatible with display forms (this is especially useful if like me you are a fan of the “Related Items” feature)
  • Direct link to activate a specific tab (for example access the SharePoint Hosting section on the UMS home page)
  • Can be implemented in the middle of a zone, not necessarily at the top
  • Can include hyperlinks to external page (see the demos)
  • etc.

If you have subscribed to the SPELL interest list, you’ll receive a code sample by the end of this month.

As I have already mentioned, I consider that the Easy Tabs code is obsolete and I won’t update it. Also, it has become more and more time consuming to support such UI widgets because of the increasing number of SharePoint versions, browsers and supported devices (for example tablets and mobile), so I am more careful than before when it comes to releasing such tools.

That said, I understand that not everybody is willing to subscribe to the SPELL program. To allow end users to enjoy a smooth upgrade to SP 2013, in the next couple months I’ll publish in the SharePoint User Toolkit a lightweight version of the SPELL Nav that will cover most of the features offered by the current Easy Tabs.

[Update] SPELL Tabs: commercial and free versions now available

Pie and Bar Charts (Google connector)

Pie

I already mentioned it briefly in an earlier post: the SharePoint User Toolkit now includes a tool that allows you to add simple pie or bar charts to your SharePoint pages.

The code is actually a connector that points to the powerful Google Visualization interface. For this reason, Internet access is required.

A common concern with online tools is data security. In this case, we are safe, Google’s privacy policy explicitly states that no data is sent to the server. The charts are directly rendered in your browser. This is a major difference with the Google Image Chart API, where data is sent in clear to the server, which uses it to build and return an image.

Under the hood, the code works the same way as the Image Rotator: it retrieves data from a specific view of your SharePoint list.

Tutorial: build a simple slideshow with the Easy Tabs

Environments: SharePoint 2007 (wss, MOSS), SharePoint 2010 (Foundation, MSS), Office 365

Audience: Power user.

Permission level: design or full control.

Estimated time: 10 minutes.

Last year, I added to the Easy Tabs an Autoplay feature. It seems that not many people use it, so today let me show you how it can help you build a simple slideshow.

1- Add your images to your SharePoint page

2- Add the Easy Tabs

3- Looking for fancier slides?

4- A warning about performance

1- Add images to your SharePoint page

Adding images to your SharePoint page is easy with Image Web Parts. Each Web Part will become a slide in our slideshow. The Web Part title will become a tab, so if you want to create an index simply use  a number – 1, 2, 3, etc. – as your Web Part title. Make sure you place all your Image Web Parts in the same Web Part zone.

Your images can reside anywhere, not necessarily in the same library, or on the same server, not even on SharePoint. Just make sure that your users have read permissions to the images location.

2- Add the Easy Tabs

The Easy Tabs are added at the bottom of the Web Part zone, following the usual procedure. For detailed instructions, check out the SharePoint User Toolkit. For our slideshow, we’ll check the “Autoplay” option and enter the interval in seconds between two slides.

3- Looking for fancier slides?

Maybe you’d like something more sophisticated than a simple image per slide? In this case, instead of an Image Web Part you can use a Content Editor Web Part or a Form Web Part, and enter your own html code.

For example, to show images with a caption overlay, follow this tutorial. If you need more detailed instructions let me know!

4- A warning about performance

Images can significantly impact the load time of your page.

If your images are stored in a SharePoint picture library, remember to take advantage of the Web friendly formats that SharePoint automatically generates for you.

If you have more than 5-10 images in your slideshow, you should consider using an Image Rotator instead. The image rotator will offer better performance, as the images are loaded on demand, one at a time.

Build Your Own School Site (part IV) -Getting Started

Trudy Hutzler   Guest Author-Trudy Hutzler

Welcome to the fourth installment of the series on my School Site, in the first three posts we walked through the site looking at all the functionality that was built into it and briefly discussed how everything fit together.  Now we get to the fun stuff, I am going to start walking through how I created each part of the school site.  I am going to create a brand new Demo site so you can follow along each step of the way and see exactly what I did to create each part.  Along the way, I will provide you with all the information and formulas you need to recreate these solutions in your own environment.  So let’s get started!
First thing we need to do is create a new site for our demo.  I am using the Team Site template as the foundation for my new School Site.  For the Title I am using “School Site-Demo”.  The URL for the Web Site Address will look something like http://<server name>/<Site name>, so mine will be http://xmas/demo.
Next, we need to add a Picture Library titled “School Pictures”, and a new Document Library called “Formulas”.  This will be where I will place all the formulas and any other files you need to recreate these solutions in your own environment.  When it is all said and done I hope to provide users with a site template they can download, and this document library will be included. Now our site is ready for us to start adding our solutions.

Default Team Site

Create site using default Team site template

For the first solution, I wanted to start with something fun.  Therefore, I decided to start with the Image-Rotator solution which can be found in the SharePoint User’s Toolkit.  The Image-Rotator allows you to display a picture on your page randomly selected from a SharePoint picture library.   The Image-Rotator is a quick and easy way to add interest to your site, catch your users’ attention, and maybe even wow the boss.  But first, we need some pictures.
Now my daughter often downloads pictures for use in reports and such, and I don’t necessarily want those to be displayed by the Image-Rotator so I need to separate the pictures I want to display from the others.   So what I did in this instance is created another Picture Library I called “Rotator Pics”.    However, for this library I chose not to display it on the quick launch.  This way the typical user will even be aware that the library is there.  To further ensure no users try anything funny with the images I used unique permissions for this library restricting everyone, but the Site Collection administrators and owners, to read permissions.  This way if they do find the library they can’t change anything.
Picutre Library Permissions

Now we have a place to store our pictures we need to upload some pictures into the folder.

 On the Action Menu click on “Upload File”.  You can either upload each picture one at a time by selecting Upload file, or you can upload several files at one time by selecting “Upload Multiple Files”.

Now that we have the library and the pictures are uploaded, we need to find the URL for the picture library to use with the Image Rotator.  For the Image Rotator we need to find the edit view URL.

  • To do this first select the view of your picture library you want to use.  The view should not contain any folders.
  • Click on the down arrow of on the View Selector, and select “Modify this View”
  • When the “Picture Library Setting –>Edit View” page opens you will want to copy the URL from the address bar.

Now browse to SharePoint User’s Toolkit, and click on the Image-Rotator link.  The Image-Rotator configuration page will open, and you simply choose the options you want to use as follows:

  • First paste the URL we just copied above into the “Picture Library (Edit View)” text box.  This tells the Image-Rotator where to find the pictures to display.
    Choose a “Picture Format”.  In my case I want the pictures to be bigger than a thumbnail image so I am going with “Optimized for web display”
  • For “Picture Size” I will stay with the default option of “Forced Height” 200 px.
  • For “Alternate Text” the Image-Rotator we can either use the Picture Name from the library, or if you have added a description to each of your pictures when adding it to the library you can choose to use the description column instead.  I am going to stick with the picture name.
  • Under the “Description” section you can choose whether to display the information stored in the Description column or not.  I don’t want to clutter up the view too much so I am choosing not to display the description.
  • The next section is “Hyperlink”.  You options here are to NOT use a hyperlink, which is what I am going to use, you can also link to the full-sized picture, or you can use a link you have specified in a text column in your picture library.

I wanted to take a moment before we continue and talk about some of the neat extras the “Hyperlink” section provides.  Let’s say you are wanting to use the Image-Rotator to attract users to your site, you could allow your users to submit some of their own photos to be displayed, then using the Link to full-sized picture option you could allow users to click on a picture they particularly liked and see it full-sized view.

On the other hand, you might want to use the Image-Rotator as part of your new product announcement plan.  You could display pictures of new products in the Image-Rotator and then by choosing the “Open link specified in the following text column” option users to click on an image and be redirected to a product information page.  To do this create a custom text column in the picture Library where you can enter the URL for the Product information page, then enter the name of the column that holds the link in the text box for this option.

The possibilities are endless once you start thinking about it, and that is why I say this particular option packs a lot of nice extras that can give your site a polished look and feel.

  • The “Refresh Frequency” option allows you to choose how often the picture changes.  You can choose change the picture only once, each time the page uploads or refreshes. This way each time the users views the page the picture will be different, but will stay the same until they leave the page.  Or you can choose to change the picture on a regular set interval.  The default is 120 seconds, but since my Image-Rotator part is only going to be used as eye-candy I want mine to change more often so I am going to set it to 15 seconds.
  • The “Display Order” section is next, and here you can choose to display the images in a random order, or in a sequential order move from one to another on down the list.  I like to mix things up a bit so I am going with random.
  • You can even choose a “Progress Icon”.  This is a small image that displays when a picture is loading to show the progress.  You can use the built-in gears icon, no progress icon at all, or choose your own image by providing a URL where the image is stored.
  • Want to be alerted if there is an error with the Image-Rotator?  Then check the “Debugging” box to get alert messages on errors.
  • Finally you need to accept the license terms by Checking the ” I have read, understood, and I agree to the license terms.” box.  This is a free license folks, so no worries about checking the box.

Now that you have agreed to the terms the code for the Image-Rotator, including all the options you select will be visible in the text box at the bottom of the page.  To save the code to a text file click on the “Save To Disk” button which will save the code in a text file.  The default file name is “ImageRotator-2.0.txt”, but you can clear out the name and give it whatever name you like, such as “KentRotator.txt”.

Now we have our code, so let’s put it to use.  I want to replace the standard picture that comes with the default Team site template with my Image-Rotator so first I need to get rid of that picture.

  • Open up the SharePoint page where you want to display the Image-Rotator.
  • Next click on the “Page” tab of the ribbon and then click on “Edit” which will be the very first icon.
  • Click on the image to select it, then press the delete key

Now your site will look like the figure below.  Notice the large picture is now missing, and in its place, we will deploy our Image-Rotator.

Follow the steps below to deploy your Image-Rotator:

  • Open up the SharePoint page where you want to display the Image-Rotator.
  • Click on Site Actions –> View All Site Content
  • Once the “All Site Content” page opens look for Site Assets under Document Libraries, and click on it.
  • Click on the “Add New Document” link, this will open the Upload document dialog box.
  • Click on the Browse button to browse to the location where you saved your code text file.
  • Once the file has been uploaded click on the file to open it.
  • A message box may open asking you if you want to open the file as “Read Only” or “Edit” choose “Read Only” then click OK
  • This will open the file in a browser window.  Copy the URL form the address bar.
  • Then click the back button until you return to your site page.

The next part of deploying the Image-Rotator is to add a Content Editor Web Part to the page.  To do so follow these steps:

  • Browse to the page where you want to deploy the Image Rotator
  • Next click on the “Page” tab of the ribbon and then click on “Edit” which will be the very first icon.
  • Go to the web part zone where you want to display your images and place you cursor where you want to insert the CEWP
  • On the Ribbon, under the “Editing Tools” tab, click on “Insert”
  • Next on the Insert Ribbon, click on Web Parts which is part of the Web Parts group on the ribbon.
  • Under Categories select the Media and Content folder
  • Then under Web Parts select the Content Editor
  • Then click the Add Button.  This will add the CEWP to the page in the same place that your cursor was placed.

c

Now you are back on your page, still in Edit mode.

  • Select the Content Editor you just added and click on the down arrow
  • Select Edit Web Part

  • When the Web Part Editor opens paste the URL for the code text file we copied in the Content Link box.
  • Expand the Title section
  • Add in a title that will display above the images.  I am using “Kent State-You Belong Here!”
  • Leave the Height and Width section set to their default selections.
  • And for a cleaner look on the page I have set the Chrome Type to “None”
  • Then click on the OK button to save your changes.
  • You will now be taken back to the page, still in edit mode.  You will see the CEWP with its new Title but no pictures yet.
  • On the ribbon, click on the “Page” tab
  • Then click on “Save” which will be the very first icon

Once the page is saved and refreshed you should start to see your pictures in our new web part.

So we now have a little WOW factor added to our site, something to attract the users attention and get them looking around.  You can easily change things up by adding, changing, or deleting the pictures stored in the picture library.  You can also make changes to the options you selected by returning to the Image-Rotator page in the SharePoint User’s Toolkit and making different selections.  Then save the file to disk using the same name as you did above.  Finally upload the new text file to the Site Assets library, overwriting the original file.  The changes will take effect as soon as you refresh your page.

As we discussed earlier you can use the Image-Rotator part in a variety of different ways.  You can use it to promote new products, make SharePoint feel more like a community by displaying photos submitted by users, or just display picutres from the last office party.  The possiblities are endless!  How will you use the Image-Rotator?  I would love to hear from readers about the different ways you have put the Image-Rotator to use.  And stay tuned for the next installement ” Tracking the What, When and Where-Customizing Contacts and Calendar”