Tuesday, 12 June 2007

Camping

Took a few days off, packed up the land rover with bare necessities (some tins of food, half a sack of potatoes, a few bottles of water, the dogs, and the girlfriend - not necessarily in that order :) ), and went off to Selmun. This is a small picturesque bay which is not very accessible unless you have a 4*4, and is usually quite quiet. Especially during weekdays, or when there are no long weekends ...

Random observations from this camp:

  • Having your dog named Bubbles is not guarantee that he will like bubbles (or any water) ...
  • Making a bonfire on limestone will cause the limestone to explode (first small pieces, and then larger and larger pieces ... )
  • Biodiesel smells like donut stands ...
  • After you've spent an age trying to teach your dogs not to be afraid of water, trying splashing a large stone into the water, they might get curious and go to investigate ... leading you to wonder what kind of crazy dog you have :)
  • Some land rovers can take very serious punishment without sustaining any injuries ...
  • ... whilst others break down before even starting the punishment
  • Making shade using cloth is not enough to avoid sunburn in Malta ...
  • A V8 engine (we don't have many of these in Malta) sounds great, whether just idling or revving hard ...
  • You can actually go for a number of days without ever feeling the need to check your email, or wondering how many hits your blog is getting ...

Looking forward to the next session!

SharePoint 2007: Blank Master Page

<%-- Identifies this page as a .master page written in C# and registers tag prefixes, namespaces, assemblies, and controls. --%>
<%@ Master language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
<%-- Uses the Microsoft Office namespace and schema. --%>
<html>
<SharePoint:RobotsMetaTag runat="server"/>

<%-- The head section includes a content placeholder for the page title and links to CSS and ECMAScript (JScript, JavaScript) files that run on the server. --%>
<head runat="server">
<asp:ContentPlaceHolder runat="server" id="head">
<title>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
</title>
</asp:ContentPlaceHolder>
<Sharepoint:CssLink runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
</head>

<%-- When loading the body of the .master page, SharePoint Server 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. --%>
<body onload="javascript:_spBodyOnLoadWrapper();">
<%-- The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. --%>
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">

<WebPartPages:SPWebPartManager runat="server"/>

<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
<PublishingConsole:Console runat="server" />
</PublishingWebControls:AuthoringContainer>
<%-- The PlaceHolderMain content placeholder defines where to place the page content for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. --%>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
<asp:Panel visible="false" runat="server">
<%-- These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%><asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/><asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/><asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/><asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/><asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/><asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" /><asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/><asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/><asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/><asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/><asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server"/></asp:Panel>
</form>
</body>
</html>

Friday, 8 June 2007

SharePoint 2007 - Tweaking the Data View with XSL

Following the Data View Basic Printing Page a small tip to show the use XSL in a Data View. What we will di is change status items e.g. High / Medium / Low into images in a Data View. These is nice to beautify your DataViews

Find the xsl:value for the column containing your status field.

<td class="ms-vb" style="width: 50px">
< xsl:value-of select="@Status"/>
</td >

and change it to an xsl:choose

<xsl:choose>
<xsl:when test="@Status = 'Low'"><img src="/PublishingImages/Green.png"/></xsl:when>
<xsl:when test="@Status = 'Medium'"><img src="/PublishingImages/Blue.png"/></xsl:when>
<xsl:when test="@Status = 'High'"><img src="/PublishingImages/Red.png"/></xsl:when>
</xsl:choose>

This checks the Status and displays an small icon according to the choosen status item.

Wednesday, 6 June 2007

SharePoint 2007 - Basic Printing page - listing of master / detail lists

Data Views are something which is quite standard in terms of SharePoint Designer, however, it gives you lots of flexibility, and I thought I'd bring this to the attention of those who still have not used it.

DataViews can satisfy a request which we get often is the ability to print information in SharePoint. The normal pages usually contain too many non-content items that simply make a printout of them too cluttered. Therefore we need to create a clean-sheet page (no navigation items etc), with information only.

For this example we have created two lists, one with Supplier names, and with the details of Contact Persons of each supplier. The contacts list uses a lookup of the Suppliers list, so that we have a master / detail link.

We will now create a information only page with just the merged details of the two lists.
Create a minimal master page
To do this we will create a minimal master page. I have tweaked the minimal master page even further to contain no controls at all (not even the username control). You can download the file from: Blank Master Page. We can either use SharePoint Designer to create this or you can actually save the page as minimal.master using Notepad and then upload it to the masterpage library (_catalogs/masterpage).

Create a new page from the master page
Using SharePoint Designer we then create a new page from the master page we have just uploaded.

Create a Linked DataSource
Click on the DataView menu and click Manage Data Sources. Scroll to the bottom of the Data Source Library until you find Linked Sources and click on Create a new Linked Source. Click on Configured Linked Source and choose the two lists you want to print information from, click next and choose Join the contents of the data sources.




Create custom content in the PlaceHolderMain
Click on the PlaceHolderMain click on the small arrow to bring up the Common Content Tasks, and click on create Custom Content. This will allow us to create content in this PlaceHolder.


Insert Data View
Open the Linked Data source which you have created above and click on Show Data. Choose the Fields you want to show, and drag them into the custom content area you have created in the previous step. You will now get a list of the items in your first list.

Merge the information from the two lists
Click on the first line (important that this you choose the first line so that we create a template). Right click > Insert > Row Below. This will create a new row for us to insert a new table containing the information of the second list. Place the cursor in the new line, and go to the Data Source Library again, scroll down to find the second list's information, choose the fields you want to populate and click on Insert Selected Fields As > Joined Subview. When you are prompted choose the column which is the link (lookup) between the two lists.



You can now play around with the table, format it as you please (merge cells as necessary for correct formatting), insert a new row below (after the details and put a horinzontal rule, etc. etc.).

Result

This example can be tweaked further to include three or more linked lists.
Remeber that if any of your lists contain divs or other html, you need to disable output escaping. Also, if you are going to export your page to a different SharePoint you need to edit your datasources to solve the GUID problem.