Monday, June 29, 2009

UmAlQura Calendar in SharePoint

I was working on a calendar webpart that is used to display events stored in a MOSS list, each item in the list will have a start date and end date, when this webpart is added in an English site it shows Gregorian calendar and on an Arabic site is shows the Hijri calendar based on the regional settings for each site, but the problem was that the Hijri calendar is not accurate and the admin must go the regional settings page to add or subtract day or two to show the right dates.

On the other side there is the UmAlQura calendar which is based on an array that relate the start of each Hijri month to a Gregorian calendar day, It can be used for dates in range between 1318/01/01 and 1450/12/29 which is good to be used for articles dates and events and birthdates and so on.

So I changed the calendar format for my culture to be UmAlQura and it works perfect, but the problem is that the events are added in the list that is using Hijri calendar as a default for the Arabic site, and there is no UmAlQura calendar option in the regional settings to select, so I searched for how to make and add a custom calendar to SharePoint and found this link but still can’t find the answer

The other thing I found and it was very weird when I write e.Day.Date in the calendar cell (in the Arabic site) it gives me a full Hijri date (27/09/1430) but when adding e.Day.Date.Day it gives me the equivalent day number from the Gregorian calendar

Wednesday, June 17, 2009

Alternate Styling

Want to make alternate styling in a DataViewWebPart or ContentQueryWebPart? Here is the way:

<tr>
    <xsl:if test="position() mod 2 = 0">
        <xsl:attribute name="class">AlternatingClass</xsl:attribute>
    </xsl:if>

    <td ...>
    ...
</tr>

Where AlternatingClass: is the alternating class name that will be the value of the class attribute of the TR tag.

Saturday, June 13, 2009

Separate XSL files for Content Query Webpart (CQWP) - Part 2

We have talked before on how to Separate XSL files for Content Query Webpart (CQWP), but we didn’t go in details for how to make your own Main.xsl file that can be used as the ContentQueryMain.xsl, the steps in the previous post will be used, we will create a new XSL file and name it for example “usefulLinksMain.xsl” and add its path to the “MainXslLink” property in the webpart file.

The next step is to have a look on the minimal main xsl file:

<xsl:stylesheet
version="1.0"
exclude-result-prefixes="x xsl cmswrt cbq"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime"
xmlns:cbq="urn:schemas-microsoft-com:ContentByQueryWebPart">


<xsl:include href="/Style Library/XSL Style Sheets/ContentQueryMain.xsl"/>


<xsl:template match="/">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
<xsl:variable name="RowCount" select="count($Rows)" />
<xsl:variable name="IsEmpty" select="$RowCount = 0" />
<xsl:choose>
<xsl:when test="$IsEmpty">
<xsl:call-template name="OuterTemplate.Empty" >
<xsl:with-param name="EditMode" select="$cbq_iseditmode" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:choose>

<xsl:when test="dsQueryResponse/Rows/Row/@Style='UsefulLinks'">

<xsl:for-each select="$Rows">
<xsl:variable name="CurPosition" select="position()" />
<xsl:call-template name="MyMain.CallItemTemplate">
<xsl:with-param name="CurPosition" select="$CurPosition" />
</xsl:call-template>
</xsl:for-each>

</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="MyMain.CallItemTemplate">
<xsl:param name="CurPosition" />
<xsl:apply-templates select="." mode="itemstyle">
<xsl:with-param name="CurPos" select="$CurPosition" />
</xsl:apply-templates>
</xsl:template>

</xsl:stylesheet>



You can also update the three values to point to the same xsl file like that:

<xsl:stylesheet version="1.0"
exclude-result-prefixes="x d xsl msxsl cmswrt"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">

<xsl:template match="/">
<xsl:call-template name="MyTemplateName" />
</xsl:template>

<xsl:template name="MyTemplateName">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>

<table border="0" cellpadding="0" cellspacing="0" width="100%">

<xsl:for-each select="dsQueryResponse/Rows/Row">
<tr>
<td><a href="{@LinkUrl}" ><xsl:value-of select="@Title"/></a></td>
</tr>
</xsl:for-each>


</table>

</xsl:template>
</xsl:stylesheet>

The two solutions are the same idea, but in the first one you can select the ItemStyle you want from the content query web part tool part.

Sunday, June 07, 2009

MCTS: Microsoft Office SharePoint Server 2007 – Configuration

I have attended a five days course “50047A: Advanced IT Pro Course for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0” at Microsoft Innovation Center – Al-Yamama University , The instructor was Muhannad Omar. At the end of the course Muhannad gave me a book “Microsoft Office 2007 – Best practice” and it was very nice from him.

And today, Al-Hamd Lellah, I passed the exam “70:630 - Configuring Microsoft Office SharePoint Server 2007” and now I’m Microsoft Certified Technology Specialist: Microsoft Office SharePoint Server 2007 – Configuration.

أمي ... أبي

كتبت هذه الاسطر في الصف الأول الثانوي لأهديها لأمي وأبي:

أمــــي أبــــي ، قــط وليــث عــنـدنـا و حـبـذا الأبـويـن في الحيـوان
فـالـقـط معـروف بتربية الصغار والـلـه قـد خلقه لكون حـــــــــــنان

الناسُ قـد شهدوا النظافة للقطط، أحـرص عليها فإنها لإيــــــــــمـان
والأًســدُ تـرعى م الـمـخـاوف شبلهـا والـلـه قـد خلقه لكون أمــــان
إن كنت تعرف في الأسود شجاعة، فالشبل يعرف في الأسود حنان

How to Install and Use RTSP Simple Server

  How to Install and Use RTSP Simple Server   1.   Create a folder to store the app mkdir /etc/rtsp-server cd /etc/rtsp-server   2.  Downloa...