Feeds:
Posts
Comments

Archive for the ‘Branding, Layout, look and feel’ Category

Introduction

Language packs only translate the default SharePoint functionality. Your own lists, content types, fields, etc.. are not translated. Since SharePoint 2010 there is an option in SharePoint to translate elements in the user interface and export them. This export can then be imported again on another server. In my case this is mainly between development, test and production machines (DEV, TST, PRD)

The following items can be translated

  • Website title and description
  • List title and description
  • Contenttype name and description
  • Field name and description
    • field names are also used in the columns of your lists

How to enable?

  • First you need to install the SharePoint Server language packs for the desired language(s)
    • Note: since SharePoint 2013 you do not need to install the “Foundation language packs”  anymore on a SharePoint Server
  • After the language pack is installed. Go to site (Site Settings -> Language Settings)
    lang01
  • Enable the desired languages (in my sample: French and Dutch)
    lang02
  • To translate, sign-in with a user with the correct language set and start changing the titles, descriptions by using the default SharePoint interface.
    • you can set the user language by simply setting the browser language
    • or overrule the browser setting by editing the language settings in the user profile (User Profile is the new name of the “mySite”)
  • When all the translations are done go to Site Settings- > “Export Translations”  (or  ”Import Translations”)
    lang01
  • Select the desired options to create an export file (which is actually an XML based resource file (.resx))
    lang03
  • Save the file on your harddrive
  • Repeat the above step on your target server but now you select “Import Translations”

Note:  for easier testing/validating I always use 2 users with a different language setting. One user I sign-in while using the Google Chrome browser. With the other user I sign-in while using IE browser.

It’s all about the ids!

It’s important to know that the  translation seems to work with the ID of your SharePoint elements. This means that if you want to use this translations functionality, the id’s of your lists , websites, contentypes, fields, etc.. on both environments (source and target) must be the same!

So what will not work?
If you create your SharePoint elements manually in both ( source and target) environments. All the elements will have different id’s. The translation will not happen.

What will work.

  • If you have deployed your content types and fields with a SharePoint solution.  On every server where you deploy this solution the id’s of the content types and fields will be the same. You can translate them on one server and bring the translation over to another server.
  • If you build your sites on one server, create a content backup of this and restore the backup on another server.
    • The restore will use the same id’s on the target server.
    • Note: If you delete for example a list on the target server and manually recreate it it will not be translated anymore since the new list has a new id (even if you used the same name etc..)

How do I use it?

I always deploy my content types and fields with a SharePoint solution. This way all the ids stay the same on every server (DEV, TST, PRD) where the solution is installed. I do not bother with translating them in my (Visual Studio) SharePoint solution.

Why do I do this? Two main reasons:  my experience is that names of content types and fields get changed a lot during the development process. Often even the day before going live.  The other reason is that I find it too complex to manage resource files for n amount of languages in Visual Studio. I prefer that the content editors do the translations for me.

We simply build the other items (lists, websites, ….) on a dedicated web application and do a backup / restore from this to DEV, TST and even PRD. This is very workable in a development situation. When your solution is alive and kicking in PRD, the restore to PRD is not an option anymore of course.

Read Full Post »

The problem

How do you add a custom control to your master page (or page layout) using the Design manager? In my first attempts I continuously got ‘Unknown server tag ‘uc1:FeedbackControl’

Quick introduction

Using the new way of creating and deploying your branding with the Design Manager needs some getting used to. The idea is:

  1. You start with a plain html page
  2. SharePoint automatically converts it to a master page (or layout page)
  3. You only edit the html page. SharePoint pushes your changes to the master page
  4. Most of the SharePoint controls and web parts can be configured and added by copy + pasting snippets into your html
  5. .NET server controls can also be placed on your page by using snippets.

In fact snippets is nothing more than a special kind of mark-up to put server controls in your html page.

But how to you add a custom control?
I created my branding with the Design Manager. I also have a Visual Studio 2012 solution with custom web parts and custom user controls.
After deploying the Visual Studio solution to my server I tried to add some of my custom user controls to the master page.  All attempts I made resulted in “Unknown server tag”

Defining your control.
<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/FeedbackControl.ascx" TagPrefix="uc1" TagName="FeedbackControl" %>-->
Putting your control on your page.
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<uc1:FeedbackControl runat="server" id="FeedbackControl" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

The solution

The trick is easy. Instead of registering your control on top of the html together with all the default SharePoint controls. You need to put the @Register statement and your code together

<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/FeedbackControl.ascx" TagPrefix="uc1" TagName="FeedbackControl" %>-->
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<uc1:FeedbackControl runat="server" id="FeedbackControl" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

So you do NOT place the @Register-statement before the DOCTYPE declaration. Embed it directly into your html page together with your snippet.

One other tip.

I had some problems / errors with defining multiple controls with the same tag prefix. If you have multiple controls on a page give them all a different TagPrefix and you will be fine.

<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/FeedbackControl.ascx" TagPrefix="uc1" TagName="FeedbackControl" %>-->
<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/Notification.ascx" TagPrefix="uc2" TagName="Notification" %>-->
<!--SPM:<%@ Register Src="~/_controltemplates/15/AmToPm.Client.Intranet/DisplayStatus.ascx" TagPrefix="uc3" TagName="DisplayStatus" %>-->
<!--CS: Start Create Snippets From Custom ASP.NET Markup Snippet-->
<!--SPM:<uc1:FeedbackControl runat="server" id="FeedbackControl1" />-->
<!--SPM:<uc2:Notification runat="server" id="Notification1" />-->
<!--SPM:<uc3:DisplayStatus runat="server" id="DisplayStatus1" />-->
<!--CE: End Create Snippets From Custom ASP.NET Markup Snippet-->

 

Read Full Post »

The content search web part is just brilliant. Not only does it let you aggregate, filter and find content and their metadata. The new way of styling with the new display templates is a huge relieve after all the xslt horror in the SharePoint 2007 and SharePoint 2010 versions.

One word of caution: I learned the hard way today that the Content Search Web Part is only available in the SharePoint Enterprise (on-premise) installation.

CSWPFeature

I hope that the nice  folk @Redmond change their mind about this and also make it available for the SharePoint Standard and SharePoint online versions.

The on-premise feature matrix can be found here:
http://technet.microsoft.com/en-us/library/jj819267.aspx#bkmk_FeaturesOnPremise

The online feature matrix can be found here:
http://technet.microsoft.com/en-us/library/jj819267.aspx

Back to the drawing board…

Read Full Post »

For some reason breadcrumbs are disabled in the default SharePoint master pages.  Luckily it is very easy to add them.

Add breadcrumb

Simply add this snippet to your master page or page layout

<!--MS:<asp:sitemappath runat="server" sitemapproviders="SPSiteMapProvider,SPXmlContentMapProvider" rendercurrentnodeaslink="false" hideinteriorrootnodes="true">-->
<!--ME:</asp:sitemappath>-->

And when loading your page again you should see something similar like this:
Crumb

Navigate up (breadcrumb fly-out)

If you are used to SP2010 or SP2007 you might also know the navigate up icon.  When you click it, a flyout appears with the breadcrumb

To add this one to your SP2013: edit the master page (or actually the html). Look for a div with the css class ‘ms-breadcrumb-top‘. In this div you find a SharePoint control called PopoutMenu.

Crumb2

For some reason this ‘PopoutMenu’ control has the  attribute ‘visible’ set to ‘false’. Remove the complete attribute or replace the visible=”false”  by Visible=”true”

The result will be an icon that when clicked results in a breadcrumb popout.

Crumb3

Read Full Post »

Introduction

If you ever had to implement some kind of visual change in SharePoint, you know that, with previous SharePoint versions, this could be a challenge. Even SharePoint 2010 is spitting out HTML that makes website designers cry.

I installed SharePoint 2013 Foundation Preview this week. And I decided to take a look at the changes in HTML with some of my past branding projects in mind

Notice: Although I’ve implemented quite a few custom look and feels in SharePoint. I do not consider myself an expert in CSS, HTML 5 or SEO. But I do recognize bad HTML code. ;-)

<head>

First thing you notice is that the <head> section is much cleaner. It is better aligned, I only counted 2 JavaScript script blocks. All the other JavaScript code is nicely stored in external JavaScript files and (dynamically) referenced on the page.

There seems to be a lot of this dynamic registering of JavaScript files going on ( RegisterSodDep ). These JavaScript files only load when they are requested. This significantly reduces the load time of a web page. This function was also available in SP2010 but to my knowledge it was not used this much.

I’m also missing some hidden input fields. I’m not sure if this is by design or if it’s due to my freshly installed SharePoint and my lack of enabled features.

The _layouts/15/

They have added an extra version number in the /_layouts path.
Examples:

<img src="/_layouts/15/images/spcommon.png" />
<link rel="stylesheet" type="text/css" href="/_layouts/15/1033/styles/Themable/corev15.css"/>
<script type="text/javascript" src="/_layouts/15/init.js"></script>

A good move as it will probably make future backward compatibility easier to maintain.

Web parts

In previous SharePoint versions, adding web parts to your page results in nested <table> elements embedded in the page. Styling these nested tables is a handful. Luckily the tables made way for <div> elements.

One word of warning though. The web part title and body are still wrapped in 4 levels of divs. IMHO They could have simplified it even further.

Another example is that the HTML of the web part title is rather complex.

<div>
  <span>
    <h1>
    <nobr>
      <span>A web part title</span>
    </nobr>
    </h1>
  </span>
</div>.

Personally I see no reason for this complex HTML structure. Except maybe for some compatibility issues with some older browsers?

The body

No funky load scripts anymore on the body element. They are still there though. They are probably replaced with jQuery alternatives. For example the “#s4-workspace” style attribute is still updated dynamically with each screen resize.

The HTML in the body is cleaner. SP2013 clearly steps away from the table layout which is a good thing. I did notice some <div> elements with css classes like ms-table and ms-tablecell. ;-)

The deep nesting of HTML elements is still present in SharePoint 2013. Probably due to the extreme flexibility that SharePoint offers to modify and extend almost everything that is on your page.

Conclusion

In general the SharePoint 2013 HTML code makes a big leap forward. The nested <table> elements that were over present in older versions of SharePoint are gone.

Huge clean-up in the head section, controls are rewritten to use HTML best practice guidelines (example <ul> instead of <tables>) .

Yes there is still some optimisation possible but overall designers will have it a lot easier when applying a corporate identity on SharePoint site.

Read Full Post »

Introduction

This article explains how to manage the layout of your site pages (= wiki pages) with the standard SharePoint 2010 Foundation functionality .
Default SharePoint pages are stored in a “Site Pages” library which is basically a wiki page library.

This article assumes you know how to create SharePoint 2010 projects in Visual Studio 2010 and how to deploy them.

The issue

The layout of your Site Pages is controlled by the “Text Layout” button in the ribbon control. SharePoint 2010 has a few default layouts defined. But there is no way to extend this functionality like you can with page layouts and the publishing feature.
A customer wanted to have the 2 column layout by default when creating a new page. He also wanted to have a logo and some web parts on the page as well.

The solution.. huh hack?

What the “Text Layout” button does is simply saving some HTML code into a property of the page. We can do this ourselves every time a new page is created by I adding an event receiver to the wiki library.

Open your SharePoint 2010 project.

Add resource file

  • Add a resource file to your project.
    This is needed to contain the actual HTML that will define your layout.
  • Here is my resource file with the HTML.
  • The HTML I used in the above screenshot is
    </pre>
    <div class="ExternalClass1E4D6ECE06C64E0C84066BDC723BF78D">
    <table id="layoutsTable" style="width: 100%;">
    <tbody>
    <tr style="vertical-align: top;">
    <td style="width: 66.6%;"></td>
    <td style="width: 33.3%;">
    <div class="ms-rte-layoutszone-outer" style="width: 100%;">
    <div class="ms-rte-layoutszone-inner">
    <div style="text-align: right;"><img src="/_layouts/images/AmToPm.SharePoint/logo.png" alt="logo" border="0" /></div>
    </div>
    </div></td>
    </tr>
    </tbody>
    </table>
    <span id="layoutsData" style="display: none;">false,false,2</span></div>
    <pre>
    

Add an Event receiver

  • Right click on your project and an event receiver
  • Click add. In the next page make sure to select the Wikipage library and “item added”
  • You now have your event handler. It will trigger every time a new wiki page is added to a wiki page library.
  • Add the following code to your event receiver
    ///
    <summary> /// An item was added.
    /// </summary>
    public override void ItemAdded(SPItemEventProperties properties)
    {
       base.ItemAdded(properties);
    
       // TODO: if needed do some checks here
    
       try
       {
    	   SPListItem item = properties.ListItem;
    
    	   this.EventFiringEnabled = false;
    	   item[SPBuiltInFieldId.WikiField] = ResourceFile.Wiki2ColumnMarkup;
    	   item.SystemUpdate(false);
    	   this.EventFiringEnabled = true;
       }
       catch (Exception ex)
       {
    	   Log.ErrorException("Updating the wikipage layout failed.", ex);
       }
    }
    

Make sure to disable the event firing before you update your page.

Read Full Post »

Introduction

When in a (localized) variations site, certain “list templates” do not show when trying to create a new list. The “list template” is only available in the master variation with the locale set to English.

Including list templates in your SharePoint (Visual Studio) projects can be straight forward. On a list do a “save as template”, download the ‘stp’ file and add it to your project. However they need to be localized to show in a localized (variations) site.

For information about localization see here : http://msdn.microsoft.com/en-us/goglobal/bb688174

The Solution

To localize the stp files :

  • Download the list template to your local computer.
  • Change the extension of the file from ‘stp’ to ‘cab’.
  • Open the cab file with your compression tool of choice (I use WinRar)
  • Extract the manifest.xml to your hard drive.
  • Open the manifest.xml with Notepad
  • You will notice that there is a <language> tag is defined.
    In my sample this is:
    <Language>1033</Language>
  • Simply change the number between the language tags to the desired ‘locale’.
    Examples:
    Dutch is number 1043
    French is number 1036.

    For a full list of the defined locale numbers look here:
    http://msdn.microsoft.com/en-us/goglobal/bb964664

  • Save the manifest.xml
  • Create new stp file

  • Now we will recreate the cab file with CABARC. See details below.
  • Open the command prompt and type the following command:
    CABARC.EXE N “CarouselTemplateNL.cab” C:\Temp\Project1\CarouselTemplateNL\*.*

  • This will result in a new cab file called: “CarouselTemplateNL.cab”
  • Rename the file back to .stp
  • Upload the file into your list templates gallery
    Site Actions -> Site settings -> Galleries -> List templates -> Upload document

CABARC

“CABARC” is a program from Microsoft to create cab files. Lately it has been replaced by a new program called “makecab”.

CABARC did the job for me but you probably can achieve the same result with makecab

You can download CABARC by downloading the Windows XP Service Pack 2 Support Tools
http://www.microsoft.com/download/en/details.aspx?id=18546
There is no need to install this package. Just unzip the file (and it’s cab files) to your locale machine. One of the unzipped files is CABARC.

Tip for when you don’t know what locales are installed on your SharePoint server.
The quickest way is go to the SharePoint installation folder (aka ’14 hive’) and look in the /TEMPLATE/LAYOUTS folder.

Read Full Post »

When using a custom master page and editing a page in SharePoint 2010 I received a dialog box the following error:

“You must specify a value for this required field”.

This error is caused when you set the contentplaceholder ‘PlaceHolderPageTitleInTitleArea’ to: Visible=”False”. After removing the Visible=False attribute from the contentplaceholder the error disappeared.

As a workaround you can wrap the contentplaceholder in a <div> and hide the div with a little CSS. That way the contentplaceholder is still in place but hidden for the user.

<div style="display: none;">
    <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" >&nbsp;</asp:ContentPlaceHolder>
</div>

Hope it helps.

Read Full Post »

To format data in SharePoint I often use xslt. The default formatting of dates however is pretty useless

<xsl:value-of select="@YourDateParam"/>

Results in : 2009-03-23 00:00:00

 

You can also use a predefined locale like this:

<xsl:value-of select="ddwrt:FormatDate(@YourDateParam, 1033, 15)"/>

Results in : Thursay, August 24, 2011 09:00:00 PM

 

If your required date time format is not available, you can also define a custom date time formatting.

<xsl:value-of select="ddwrt:FormatDateTime(string(@YourDateParam) ,1033 ,'dd-MMM-yyyy')" />

Results in : 22-03-2011

<xsl:value-of select="ddwrt:FormatDateTime(string(@YourDateParam) ,1033 ,'dd/MMM/yyyy')" />

Results in: 22/Sep/2011

Other formats

Output Locale Format
3/23/2009 1033 1
3/23/2009 12:00 AM 1033 2
Monday, March 23 2009 1033 3
12:00 AM 1033 4
Monday, March 23, 2009 12:00 AM 1033 7
3/23/2009 12:00:00 AM 1033 13
Monday, March 23, 2009 12:00:00 AM 1033 15
23/03/2009 2057 1
3/23/2009 12:00 AM 2057 2
23 March 2009 2057 3
00:00 2057 4
23/03/2009 00:00 2057 5
23 March 2009 00:00 2057 7
00:00:00 2057 12
23/03/2009 00:00:00 2057 13
23 March 2009 00:00:00 2057 15

Read Full Post »

Introduction.

In SharePoint 2010 you can use Google Maps without having to download extra webparts or third party tools. In this article I will explain how you can insert “Google Maps” maps in your SharePoint 2011 site with only using standard out of the box SharePoint 2010 features.

It’s a generic solution which can also be used to store HTML code that defines Flash and Silverlight HTML ‘assets’.

1. Get your Google map code.

  • Go to Google maps
  • Find the location you want.
  • In the right hand corner of the map click on “Link”
  • Next click on “Customize and preview embedded map”.
  • Enter the desired options.
  • Copy the HTML code that Google generates for you.
  • Paste the HTML code in a text file (use notepad).
  • Save the text file to your hard drive.

So you have the Google Map HTML code sitting in a text file now. Next step is to upload this file in SharePoint

2. Store the HTML code in SharePoint.

  • Go to your SharePoint site.
  • Click on ‘Site Actions’ =>’More Options’.
  • Click create and create a new Document Library “
  • When the library is created. Click on “Add document”.
  • And upload the Google Map text file you created in the previous step

Your Google Maps HTML code is in SharePoint now.  Next step: display it.

Note 1: An asset might be a more appropiate naming.  So an “Asset Library” might be a better choice. For simplicity sake we stick with a standard “Document Library”
Note 2: Feel free to add your custom content types to the library and fill out out the required meta data.

3. Display the Google Map.

Get the document url :

  • Go the library from the previous step.
  • Click on the Google Maps document you want to display.
  • SharePoint opens this file as plain text in your browser.
  • Copy the url of this file from your browsers address bar.

Add the Google Map to a page :

  • Open the a SharePoint page.
  • Edit the page.
  • Add the Content Editor web part
  • Clicking on “Edit Web part” in the web part context menu
  • Insert the document url, of the Google Maps text document, in the “Content Link” box.
  • Click on OK
  • Save the page.
  • If needed check-in and approve the page.

That’s it. Your Google Map is now visible on the SharePoint site.

The nice thing is that you can reuse this map in your SharePoint site. And when the map changes (change of address, etc…) you only need to change the text file in your Document Library.

Regards,
W0ut

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.