Monday, June 29, 2009

World Clock Webpart


Today, I have released world clock webpart on codeplex.
You can download it from below link.
http://worldclock.codeplex.com/

After download, read document and installed it on MOSS Server.

It looks like below.








Friday, June 26, 2009

Free - SharePoint Text Size Zoom Feature

Sharepoint Text Size zoom functionality is useful in organization for low resolution projector.

Here i have mentions step to integrate with sharepoint site.
(1) Open Sharepoint Site in sharepoint Designer .
(2) Open _catalogs folder and create new folder "JS"
(3) Add new javascript into that rename as TextSize.js
(4)Open Javascript and add below code into js and save it.


function FontSizeChange_SetAllDocumentFontSize(size)
{
FontSizeChange_ChangeAllElements(document, size);

for(var i = 0; i < document.frames.length; i++)
{
FontSizeChange_ChangeAllElements(document.frames[i].document, size)
}
}

function FontSizeChange_RestoreDefault()
{


FontSizeChange_ReloadWindow(true);
}

function FontSizeChange_ReloadWindow(refresh)
{
if(refresh)
{
var url = window.location.href;
if(url.indexOf("#") == url.length - 1)
{
window.location.href = url.substring(0, url.length - 1)
}
else
{
window.location.href = url;
}
}
else
{
window.location.reload();
}
}
function FontSizeChange_ChangeAllElements(doc, size)
{
FontSizeChange_SetFontSizeByTagName(doc, "div", size);
FontSizeChange_SetFontSizeByTagName(doc, "span", size);
FontSizeChange_SetFontSizeByTagName(doc, "input", size);
FontSizeChange_SetFontSizeByTagName(doc, "a", size);
FontSizeChange_SetFontSizeByTagName(doc, "td", size);
FontSizeChange_SetFontSizeByTagName(doc, "th", size);
FontSizeChange_SetFontSizeByTagName(doc, "select", size);
FontSizeChange_SetFontSizeByTagName(doc, "font", size);
FontSizeChange_SetFontSizeByTagName(doc, "textarea", size);
FontSizeChange_SetFontSizeByTagName(doc, "IE:MENUITEM", size);
}

function FontSizeChange_Increase()
{
var font=document.getElementById('txtFont').value;
if(font <20)
{
document.getElementById('txtFont').value=parseInt(document.getElementById('txtFont').value) + 1;
}

var fontSize = font.toString() + "px";
FontSizeChange_SetFontSize(fontSize);


}

function FontSizeChange_SetFontSize(size)
{
FontSizeChange_SetAllDocumentFontSize(size);

}

function FontSizeChange_Decrease()
{
var font=document.getElementById('txtFont').value;
if(font > 8)
{
document.getElementById('txtFont').value=parseInt(document.getElementById('txtFont').value) - 1;
}

var fontSize = font.toString() + "px";
FontSizeChange_SetFontSize(fontSize);

}


function FontSizeChange_SetFontSizeByTagName(doc, tag, size)
{
var elements = doc.getElementsByTagName(tag);
for(var i = 0; i < elements.length; i ++)
{
elements[i].style.fontSize = size;
}
}


(5) Open Master page and add below script.

<script language="javascript" src="../JS/TextSize.js" type="text/javascript"></script>

(6) Also add below code into master page top corner.

<a title="Decrease Text Size" href="javascript:FontSizeChange_Decrease();"><asp:image runat="server" ID="imgdecrease" ImageUrl="_layouts/IMAGES/_size_small.gif" ></asp:image></a>

<a title="Default Text Size" href="javascript:FontSizeChange_RestoreDefault()"><asp:Image ID="imgdefault" runat="server" ImageUrl="_layouts/IMAGES/_size_medium.gif"></asp:Image></a>

<a title="Increase Text Size" href="javascript:FontSizeChange_Increase();"><asp:Image ID="imgincrease" runat="server" ImageUrl="_layouts/IMAGES/font_size_large.gif" ></asp:Image></a>

<input id="txtfont" type="hidden" value="12" >


Add image as per your requirement.

After complete this procedure, feature is look like below.






Cheers it and enjoy it.

Wednesday, June 17, 2009

Hide Sharepoint Site Action for non authentic user group

Sharepoint Site Action hiding is easy for non authenticate user. It is possible using sharepoint designer and after that only administrator's view Site Action button in sharepoint web application.

Open Sharepoint Designer and find SiteAction control in master page. Add
SPSecurityTrimmedControl before that.


<SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageWeb" >


<SharePoint:SiteActions runat="server" AccessKey="<%$Resources:wss,tb_SiteActions_AK%>" id="SiteActionsMenuMain" ..........>
............
</SharePoint:SiteActions>

</SharePoint:SPSecurityTrimmedControl>

Tuesday, June 16, 2009

SharePoint DateTime Control Validation

<wssawc:DateTimeControl ID="dteDemo" runat="server" DateOnly="true" ></wssawc:DateTimeControl>


<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please select activity date." ControlToValidate="dteDemo$dteDemoDate" ValidationGroup="Activity" Display="None"></asp:RequiredFieldValidator>

<asp:CompareValidator id="vdate" Display="None" runat="server" ControlToValidate="dteDemo$dteDemoDate" Type="date" Operator="dataTypeCheck" ErrorMessage="Please enter an valid date." vallidationGroup="Activity"></asp:CompareValidator>

Automatic take sharepoint site backup using batch file and scheduler

It is not possible to schedule sharepoint backup from sharepoint central admin site.
Below is process to take backup using batch file and after running schedule on specific time.

1. Open notepad and paste below code.

@echo off

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"

cd c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

@echo off

md "%DATE:/=_%"

stsadm -o backup -url "http://localhost:8080" -filename "E:\MOSS_Backup\%DATE:/=_%.bak"

echo completed

2. Save it as AutoBackup.bat (Change your site name )

Set Task schedular for this batch file and take backup on schedule time.