Monday, August 31, 2009

SharePoint ActiveX controls background color

Problem: a SharePoint skin with a dark background color. All the ActiveX controls (multiple file upload, Datasheet view) inherit the background color.

Solution: to keep the background you want, but not affect the ActiveX controls, include this fix:

body
{
background-color: white;
}
form#aspnetForm
{
background-color:#YOUR_DARK_COLOR#;
height:100%;
}

I found this extremely useful tip here.

Posted by Madalina at 18:17:22 | Permalink | No Comments »

Friday, April 3, 2009

SharePoint Designer 2007 Free!

For a while now there has been talk that starting April 1st, SPD would be free to download. Everyone took it as an April Fool’s Day joke, but it is true! Starting this April, SPD 2007 is free to download on the Microsoft site. 
 
Is it because so many people are now using it, or maybe because a new an improved version is on its way? :)

 
Posted by Madalina at 07:37:00 | Permalink | No Comments »

Monday, March 16, 2009

Designing SharePoint MasterPages - Taking advantage of SharePoint capabilities

I was reading the last MSDN Magazine the other day and, among some interesting Silverlight articles, I found one very nice SharePoint article - very real and to the point.
This article talks about SharePoint best practices - what to use, what not to forget and what to think about first when you implement something. In my opinion, the most important point of the article is that we always must take advantage of the Sharepoint capabilities and even try hard to do it.

SharePoint is a very large application/system/portal and it takes a very long time to learn all its features, strong and weak points and even just to learn how to work with it. We may very easily get lost in it and even though we read books and articles about it, we will soon forget all the interesting things we’ve learned if we don’t actually use them in the real world.

Taking all this into consideration, it may sometimes be easier for us to think about custom-made functionality when we have to implement something, rather than to think about how we can achieve what we want with what SharePoint has to offer.

The article also says that, when a new functionality in a portal is discussed, it pays off to think about how you can achieve it with a custom-made solution, but also how SharePoint existing features would achieve it and to compare the 2 solutions, having in mind the fact that SharePoint existing functionality brings many advantages, as security, speed and unity.

These ideas also apply to Master Pages, as they are also a customization of a SharePoint existing feature.
Have you ever received the request to eliminate some functionality from a masterpage - such as the dropdown list of the Search control, or the My Site link ? You definitely have, especially if the design you had to implement was not created by you, but by a designer with no knowledge of SharePoint. And have you ever did that in order to implement the design as provided, to later see the Search functionality replaced with a custom control? I am sure you have done that or at least witnessed it at a point.

As SharePoint Master Page designers and developers, we are the first ones that can draw the attention on this issue - we are the ones that can prevent the occurrence of the above mentioned mistakes and watch over the implementation of best practices. We must draw attention to the fact that SharePoint functionality is there for a reason and not only to that. SharePoint users must not be confused by the design customization - being used to the default SharePoint interface, they must not find the new design hard to use and tricky. All the SharePoint controls must remain in the custom design. If they are moved around on the page, their layout must be consistent between all the pages and sites and also, easy to spot.

The design is the first thing a user sees on a page and its 2 goals (equal in importance) are to skin the page and make the usage easy and painless.

In conclusion, best practices start on day 1 of the project and every single element of customization must oblige to them, even at the cost of not following the Master Page design by the letter. 

We all know all of this. Face to face with the project, we must not freak out and start writing code :)
 

Posted by Madalina at 09:56:32 | Permalink | No Comments »

Monday, March 9, 2009

Enabling Silverlight 2 in SharePoint / The easiest sample

Silverlight promises to give SharePoint exactly what it doesn’t have: glam :).
SharePoint is a very powerful tool, but it comes a time in the life of such a powerful tool when it needs a little dosage of eye-candy design. Right now, that can be very easily achieved with Silverlight.
As the two are siblings of the same technology (plain old ASP .NET :) ) they work very nicely together.
But first of all, some SharePoint configuration element are needed.

Configure SharePoint to run Silverlight

The needed configuration elements are:
1.
Silverlight 2 plug-in.
2. .NET 3.5 framework installed on the server.
3. Service Pack 1 installed for WSS 3.0/MOSS 2007.
4. System.Web.Silverlight.dll added in the Global Assembly Cache (GAC).
5. New 
Web.config elements in the web.config of the Web application you are planning to run Silverlight on.
6. The .xap extension registered as a MIME type (application/x-silverlight-app) in IIS.
7. [Development requirements:
Silverlight Tools for Visual Studio 2008 SP1, Install Microsoft Expression Blend 2 and Microsoft Expression Blend 2 Service Pack 1]

Easiest test - Silverlight on SharePoint

To test if Silverlight actually works, open a site in the web application that you configured to run Silverlight controls (point 5 above).
Silverlight can easily be added in a Content Editor Web Part. For that, you will need, first of all, a Silverlight control to add. You can find a simple Silverlight control on the Internet, or
here.

1. Create a document library in the site you just opened. I named mine XAPS.
2. Navigate to this library and upload the Silverlight control.
3. On the site Home page (for example) add a new Content Editor Web Part.
4. Open the Edit panel and select Source Editor.
5. In the content text box enter the following:

<object width=”100%” height=”200″
    data=”data:application/x-silverlight-2″
    type=”application/x-silverlight-2″ >
    <param name=”source” value=”/xaps/SilverlightControl1.xap”/>
</object>

6. Click Save and then OK and the Web Part should load the following:

A very good place to start with Silverlight and SharePoint is CodePlex’s Silverlight Blueprint for SharePoint.
 

Posted by Madalina at 10:26:49 | Permalink | No Comments »

Monday, January 19, 2009

AlternateCssUrl - what is it useful for?

When you design a SharePoint MasterPage or Theme, you usually include the CSS style sheet references in the .master file or in the Theme folder. And those style sheets contain all the styling you need.

If you work with a masterpage, you will probably set in code values for DefaultMasterPageURL and CustomMasterPageURL.

There is one more property of a SharePoint site called AlternateCssUrl. You would use this property if you don’t want to create a MasterPage or a Theme, but just apply a skin on the SharePoint default look - by specifying a value for this property, you make SharePoint include your style sheet in its pages.
 
Although it would look like the AlernateCssUrl property has a very limited use, you could not be more mistaken. There are pages in SharePoint that do not implement any masterpage - not the default.master, not the application.master. One example is the Picture Slideshow page.

This is the case where the AlternateCssUrl property comes in handy - by initializing this property value with your custom css style sheet, you can rest assured that all the SharePoint pages in a site will be skinned.
 

Posted by Madalina at 17:33:51 | Permalink | No Comments »

Wednesday, January 7, 2009

SharePoint System MasterPage - hide the Search control or delete it?

It is a known fact that SharePoint can skin its system pages.
When designing a system masterpage for SharePoint, there are 2 ways that you can follow: take the generic application.master and customize it, or start from the existing masterpage of the site, supposing you are working on a skinned site.

I usually start from the main masterpage of the site and take into account the fact that the system masterpage needs a few tweaks.
The 3 main differences between the regular site pages and system pages in SharePoint are:
1. The Search control is missing on the system pages.
2. The Breadcrumb is different on the system pages.
3. The left navigation placeholder is empty.

Letting the Breadcrumb tweak for you to discover :), I will make you now aware of the fact that the Search control is not needed on the system pages master.
When you don’t want use certain controls (ContentPlaceHolders) on a SharePoint masterpage, you generally choose to hide them, not delete them, by placing them in a hidden panel. SharePoint will still find them and so not retrieve an error, but they will not show up in the page design, giving the site the look of your choice.
Following this pattern, I first hid the Search control on the system page in a panel. Everything worked fine until I tried to Check In/ Check Out a file and i got this error:
“Unable to validate data. at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) “

This error did not appear when the site was skinned with the SharePoint Default theme. So the problem laid in the customized application.master file. The only difference between the application.master and my system.master pages was that in my master I had the Search control place holder hidden (but present).
After deleting it, everything worked fine. Except… WIki Sites - History of a page retrieved an error: “Search PlaceHolder not found”.

So the answer to the question in the title is - Delete the Search control, leave the PlaceHolder:
< asp:ContentPlaceHolder id=”PlaceHolderSearchArea” runat=”server” >
< / asp:ContentPlaceHolder >
  

Posted by Madalina at 18:00:00 | Permalink | Comments (2)

Thursday, November 27, 2008

SharePoint Breadcrumb - fit it in the design as a unitary control

When a designer creates a mockup for a SharePoint site, (s)he almost never includes the breadcrumb(s). In my experience, that is not a very good option - as the breadcrumbs are vital to the navigation, especially if the site top navigation is not inherited in the subsites.
There are 2 breadcrumb controls in a site: the one on the top of the page, that maps from the root site down to the current site and the breadcrumb below the top navigation, that maps the current site.
 

 
Generally, if I am going to include them in the design, I prefer to have them both in one place. But as you can see, the last node of the first breadcrumb is the first node of the second. So just placing them one after the other won’t do - one node will repeat itself in the middle of the breadcrumb.
There is a simple solution to that. The Breadcrumb control allows for a separate css class dedicated to its root node. 
So going in the master page html code and setting a value for that attribute of the second breadcrumb is the first step. Name it as you like.
The second step is to define that class in the styling css file. The ‘display’ attribute with the ‘none’ value will do the trick. You have just hidden the root node of the second breadcrumb.
This way, you can list the two breadcrumbs and make it look like you only have one breadcrumb.
 
Posted by Madalina at 08:12:36 | Permalink | No Comments »

Tuesday, June 24, 2008

SharePoint customization - applying a theme programmatically

SharePoint sites can be customized through MasterPages and/or Themes. There are 2 main differences between these two methods:
1. masterpages allow you to rebuild the design from scratch - as in move the elements around on the page as you like - but do not affect system pages
2. themes are made up of css files only, allowing you just to skin a SharePoint site, but are also applied on the system pages.

Customizing a site generally means skinning all its pages. So that the user doesn’t get confused as of why some pages look different than others, or at least to give the system pages almost the same look and feel as the rest of the pages.
Automating the masterpage install is easy -you create a feature and write code in the
FeatureActivated event, code that sets your masterpage as the default and custom master(details on that feature are to come in a future post).
But what about applying a theme? The general procedure would be to have the administrator go on the server and copy some files on the Windows drive and then modify an XML file so that SharePoint can read the theme and display it on the Site Settings > Site Theme page. One of the many posts that explains this method is
this one.

But what if you want to do this programmatically? With a feature, like you would do when you deploy a masterpage.

Well, simple enough, this is possible. As long as the theme exists in the THEMES directory, SharePoint can retrieve it. The only reason you modify the spthemes.xml is for SharePoint to display the theme in the Themes list. So if you place the theme in the Themes directory (just by copying it there in a bat file for example) you can use code to apply it:

web.ApplyTheme(“MyTHEME”);

Since we are here, the way to revert a SharePoint site to the default theme isn’t web.ApplyTheme(“Default”), but web.ApplyTheme(“none”).

And there you go - you can programmatically apply a theme to a site. And the way to make the theme “visible” to the user is to have it as a feature instead of having it in the Themes list.

Posted by Madalina at 13:56:17 | Permalink | No Comments »

Thursday, May 29, 2008

SharePoint on Windows Vista

“Are you a SharePoint developer tired of starting VirtualPC evey morning when you go to work? Are you dissapointed in remote connection speed and how Visual Studio is slow in there? Then this is the post for you!”

This sounds like a soap opera commercial :) I have Windows Vista installed on my laptop and I am kind of fond of it… Not only because it does it’s job :) but also because I have spent a while installing applications and configuring it. So when I work on a SharePoint web part or a Sharepoint MasterPage design, I need to use a remote machine.
Not any more though. The
Bomboo guys found a solution for that. I tried it and so far I installed WSS 3.0 on my Vista, created the first site, installed SPD and created a new masterpage. It all worked.

“Get it today! Available in stores now!”

Posted by Madalina at 08:17:21 | Permalink | No Comments »

Wednesday, March 12, 2008

Munca este intr-adevar amuzanta :)

Din capitolul “Toleranta este un cuvant pe care nu-l cunosc”… Subtitlul “wtf was your teacher?”
 
Am pus mana zile trecute pe un css facut de altcineva. Un css pentru un masterpage de SharePoint. Uitandu-ma prin el sa vad daca pot “fura” vreo idee, am vazut ca unele dintre imaginile folosite in clase aveau calea de forma “../../../../../../imagine.jpg”. Ok… Am instalat masterpage-ul (printr feature-ul in care a venit) ca sa inteleg si eu ce imi scapa… Bineinteles ca imaginile nu se incarcau. Am inceput sa ma intreb de unde atatea directoare imbricate.
Singurul raspuns pe care l-am gasit pana acum a fost - le cauta cumva in Google?  =))
 
Posted by Madalina at 12:37:56 | Permalink | No Comments »