Full Stack Developer & Software Architect | Building Cloud & AI Edge Solutions | Software & Team Development
Monday, June 29, 2009
UmAlQura Calendar in SharePoint
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
<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
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: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: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
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.
أمي ... أبي
أمــــي أبــــي ، قــط وليــث عــنـدنـا و حـبـذا الأبـويـن في الحيـوان
فـالـقـط معـروف بتربية الصغار والـلـه قـد خلقه لكون حـــــــــــنان
الناسُ قـد شهدوا النظافة للقطط، أحـرص عليها فإنها لإيــــــــــمـان
والأًســدُ تـرعى م الـمـخـاوف شبلهـا والـلـه قـد خلقه لكون أمــــان
إن كنت تعرف في الأسود شجاعة، فالشبل يعرف في الأسود حنان
Tuesday, May 26, 2009
From My Site to the Portal
But still you can make a link to a preferred portal, go to Site Actions > Site Settings > Site Collection Administration > Portal Site Connection > then type the URL and the title for the portal you want the users go back to from My Site.
Monday, May 25, 2009
Absolute Paths in SharePoint
<img src="../SiteImages/MyLogo.gif" alt="SubSiteLogo " />
This is fine when you are browsing a page in the Pages list (http://www.mysite.com/subsite/pages/mypage.aspx), but what if you are browsing an overview.aspx page for example for a Survey list (http://www.mysite.com/subsite/lists/surveyname/overview.aspx), you will need to change the tag to:
<img src="../../SiteImages/MyLogo.gif" alt="SubSiteLogo " />
So how to add the image tag to make it work for both pages?
The solution is to change your tag to this:
<img src="<% $SPUrl:~Site/SiteImages/MyLogo.gif %>" alt="SubSiteLogo" runat="server"/>
Where ~Site is your absolute current site URL
Okay, now what if this image is not changed per sub site, but it is changed per SiteCollection and the url is something like this: (http://www.mysite.com/anothersitecollection/subsite/pages/mypage.aspx), in my default SiteCollection I can make the tag like this:
<img src="/SiteImages/MyLogo.gif" alt="SubSiteLogo " />
But in another site collection this will not work with me, so I can make it like this:
<img src="<% $SPUrl:~ SiteCollection/SiteImages/MyLogo.gif %>" alt="SubSiteLogo" runat="server"/>
The same thing here with the stylesheet, you can do the same:
<link rel="stylesheet" type="text/css" href="<% $SPUrl:~Site/StyleSheets/MyStyle.css %>" runat="server"/>
Wednesday, May 13, 2009
Things to ask the client about before working on My Site
1. Do you really need My Site, or can the requirements be developed?
Sometimes the user just wants to display the user information, but he heared that there is something called MY SITE and he wants it.
2. What is the expected number of users that will create My Site?
The expected number of MY SITEs is very important, as it is a factor of space and performance, as each My Site is a site collection and the default quota is 100 MB for each site. I was working on a project for a big organization that has 15000 users, but for obviously not all of those users will create My Site.
3. Will all the users be able to create "My Site"?
Some organizations like the 15k users case, for obviously not all of them will be able to create My Site as some of them are contractors that are doing a task and will leave after two or three months and may be more, but they will not be allowed to create My Site.
4. Do we need the 100MB for each site?
100MB is a very large space, and may be very small for others, but the expected or the planed size is very important to make your hardware architecture regarding the performance and the storage space and the storage place (this is another question but you will need to answer it yourself, as you may need to create a group of My Sites that belong to a group of users in a place and another group in another place).
5. Do you have only one AD domain or more?
More domains means that a username may be duplicated, so you must configure the settings to take the domain name in site URL, not just the username.
6. What is the authentication type of the OWA, In Case you will use Outlook webparts?
You will need to know this, as the forms authentication will display the login window inside each webpart iframe with a scroll if the webpart size is smaller, you may decide to pass the credentials using JavaScript and submit the form (you have to configure the trusted sites in the browser and make the OWA and the intranet site on the same domain but using a different sub-domains) , also what is the used version of the Exchange Server
7. Is the email address the same as the username?
Some organizations are using username like domain\usr24hr and the email for this user is ramy.fawzy@domain.com for security reasons. In this case take care while working on customizing Outlook webparts automatically to set the exchange server address and the email inbox name.
8. Will you allow the user to select his "My Site" language or not?
In multiple language websites it may be a needed to allow the user to select his My Site interface language. The client may imagine that it can be English/Arabic the same as his portal for example.
9. Do you need to customize in the layout or not?
Some customers ask for My Site, but they don ‘t know that it will not inherit the portal MasterPage, and they will be shocked after the site deployment, so make it clear from the beginning for him and for yourself.
Wednesday, May 06, 2009
Listing Folders, SubFolders and Items in one page
I want to save all these files in only one document library but divide them into folders and subfolders as required, and make the minimum number of pages and code to display these folders and items and without any .net coding.So my solution is to make a page in SharePoint designer and add a DataSource and a DataView then make the following steps:
1. In the SPDataSource add Scope="RecursiveAll" this will make the datasource get all the items (folders and documents) not just the folders in the first level.
2. Add parameter to the DataView, ex. Name: FolderPath, Source: QueryString, QueryStringVariable: FolderPath, DefaultValue: En/DownloadCenter/Documents (which is the path to your document library)
3. Make a filter in the DataView to have Path, Equals, [FolderPath]
4. Make a variable to be used as the page link or the document link as:
<xsl:variable name="url">
<xsl:choose>
<xsl:when test="@ContentType = 'Folder'">documents.aspx?FolderPath=<xsl:value-of select="substring(@FileRef, 2)">
</xsl:value-of>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@FileRef"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
5. The above code will check if the item is a folder so we will need the link to redirect to the same page (documents.aspx in our case), and if the item is a document so we need to redirect to the document URL.
6. substring(@FileRef, 2) is used to remove the first / character in the URL Path (not the Path), to know what is the difference between both, Path: En/DownloadCenter/Documents, URL Path: /En/DownloadCenter/Documents/Subfolder1
Tuesday, April 28, 2009
Separate XSL files for Content Query Webpart (CQWP)
But you can make an XSL file for each content query webpart and here is how to do:
- Edit the page you want to add the webpart in.
- Add a content query webpart.
- Export the webpart.
- Open the exported file.
- Search for “ItemXslLink”
- Update the line to:
<property name="ItemXslLink" type="string">/Styles/XSL/MyCQWebpart.xsl</property> - Update the property "ItemStyle" to the templete name ("UsefulLinks" in this example)
- Upload the XSL file (remember to update "CommonViewFields" as needed)
- The XSL file can be something like this to display a useful links (Title, Link):
<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 name="UsefulLinks" match="Row[@Style='UsefulLinks']" mode="itemstyle">
<xsl:param name="CurPos" />
<xsl:variable name="TitleLenght" select="string-length(@Title)" />
<xsl:variable name="RowLimit" select="40" />
<xsl:variable name="LinkURL" select="substring-before(@Link,',')" />
<xsl:variable name="LinkText" select="substring-after(@Link,',')" />
<li>
<a href="{$LinkURL}" target="_blank" title="{$LinkText}" class="newsTitle">
<xsl:value-of select="$CurPos" /> - <xsl:value-of select="@Title" />
</a>
</li>
</xsl:template>
</xsl:stylesheet> - Import the webpart and configure it to read from the right place, filtration and sorting order and so on.
- Go to the “ContentQueryMain.xsl” file and search for “OuterTemplate.CallItemTemplate”
- In <xsl:apply-templates select="." mode="itemstyle"> add <xsl:with-param name="CurPos" select="$CurPosition" /> and any other parameters you want to send to the itemstyle.
- You can also make your own ContentQueryMain XSL by updating the “MainXslLink” property in the webpart file, and the same for the header by updating the “HeaderXslLink” property.
Monday, April 27, 2009
Delete WorkItem from TFS database
Declare @DeleteThisID int set @DeleteThisID = 10000
DELETE FROM [WorkItemLongTexts] WHERE ID = @DeleteThisID
DELETE FROM [WorkItemsAre] WHERE ID = @DeleteThisID
DELETE FROM [WorkItemsWere] WHERE ID = @DeleteThisID
DELETE FROM [WorkItemsLatest] WHERE ID = @DeleteThisID
Monday, April 20, 2009
Features included in Office SharePoint Server 2007
http://technet.microsoft.com/en-us/library/cc678862.aspx
This article contains information about Microsoft Office SharePoint Server 2007 features and the level at which you can activate them.
Sunday, April 12, 2009
SPListItem: Update(), SystemUpdate() and UpdateOverwriteVersion()
If you are working with MOSS APIs to create list items and updating them, you have the option to update the item by using Update(), SystemUpdate(), SystemUpdate(false) or UpdateOverwriteVersion() methods, but what is the difference between them?
Update()
- will make a new version of the item
- Update the modified time and modified by fields
- If the item is published it will be pending again
- No new version.
- Updates the item without creating a new version of the item
- Update the modified time and modified by fields
- Nothing will be changed in the item except the fields you want to change
- No new version (You can pass false to the method just to enable generating a new version)
- The events will be fired and the modifications will be logged, but no alerts will be sent, and you can disble the event firing before using the SystemUpdate then enable it again
SystemUpdate() is very useful if you want to modify something like the rating value after the item is published without reapproving it every time.
Saturday, April 11, 2009
كان يا ما كان
رسالة كتبتها لأودع فريق العمل اللذي عملت معه بشركة لينك ديف بمصر للعمل بفرع الشركة بالسعودية
كان يا ما كان
هل سمعتم عن إمارات الأبدان؟ ليست ببغداد ولا إيران! في كل حين وآن وأوان يُحكى عن إمارة في كان يا ما كان.. العقل لها حاكما ومُستشاره القلبُ بالانسان، الشعبُ عاش خلالها لبرهة من الزمان فترة رخاءٍ وامانٍ. وفي يوم من الأيام أصدر العقل حكماً قاسياً ليس فيه رأفة ولا إحسان، لم يُستشار المُستشار في الحكم حيث أنه أول من يدان، لم يرتكب القلب جُرما بل يُخشى منه على باقي الجسمان، العقل يخشى ان تثور عليه يدٌ او اذنٌ من الاذنان، أو قد تنقلب عليه قدميه أو يعارضه اللسان، كل هذا لأنه أخذ القرار وعلى البقية السمع والطاعة للسلطان. وفي ساعة المحاكمه (الآن) وقف العقلُ مُحاكماً لكنه يعلم ان مكانه مع البقية خلف القضبان، وبعد مرافعة القلب المُستشار والبلاغة في البيان، والتي ادت لهطول امطار غزيرة بمنطقة العينان وإثارة العواصف بمنطقة الرئتان. في الحال اُصدر الفرمان وقد تناقلته وسائل الاعلام.. بتوقيع اتفاق دبلوماسي مع باقي الامارات من الزملاء والاحباب والخلان، أن يترك بكل امارة ذكرى كسفير خير عبر الايام، و يَحِقُ للمتهمين زيارة السفراء كلما كان ذلك بالإمكان، لتجديد هعد وفاء وإخاء و سلام، وفي النهاية ختم الحكم بقوله: في هذا الزمان هذا ما كان يمكن ان يكون بالإمكان، فسلام.
Tuesday, March 24, 2009
CSS best practice
So, some WEB-UI developers start making a new framework to use while making their styles without using the inline style, they develop a class for each style, ex: .Width150px { width:150px;} and another one .Red {color:red;} and use it like this class=”Red Width150px”!
For me, using inline style is better as it will be much more faster while developing than using the above way.
The better practice for using CSS is by defining a meaning full name that describes the thing that will take the style, ex: .PageTitle {color:red; width:150px;} and give the DIV class=”PageTitle”, so I can update all the pages titles just by updating the CSS file, not going to each page title and update the class name.
DIVs vs TABLES
But the right thing is: use div when you need it and use tables when you need it.
Using DIVs with CSS can make a lot of things that can’t be done by TABLEs, for example it you want to display data in rows and each row or some rows will not be aligned with the others and using TABLEs will make complicated TDs with a lot of COLSPANs, but displaying a form data can be done with TABLEs perfectly.
But it is preferred to use DIVs if you want to work with the page layouts, as you will be able to change the layout just by using the CSS.
Wednesday, March 11, 2009
setAttribute('maxlength', 5);
You have to make it setAttribute('maxLength', 5);
Monday, March 02, 2009
Team Foundation Sidekicks
Version 2.2 of Team Foundation Sidekicks includes Permission Sidekick, Code Review Sidekick, Shelveset Sidekick, Labels Sidekick, History Sidekick, Workspace Sidekick and Status Sidekick in uniform GUI stand-alone application, and Visual Studio Integraton Package providing VS integration for all sidekicks as well as additional features such as Search Items dialog, dynamic History and Build Type editing support.
Single installation package contains versions of application compatible both with Team Foundation Server 2005 and Team Foundation Server 2008.
Move site collections to a new database (split a content database) (Windows SharePoint Services 3.0)
You can also have a look on Microsoft SharePoint Administration Toolkit