Monday, November 24, 2008

Display full image on mouse click and mouse use using javascript and filters

function doImageShow(vImg)
{
if (navigator.product != "Gecko")
document.getElementById('imgCon').filters.item(0).Apply();

document.getElementById('imgShow').setAttribute('src',vImg.src);
document.getElementById('imgShow').setAttribute('alt', 'Click the image to close.');
document.getElementById('imgCon').style.display = "";
var newImg = document.getElementById('imgShow');
if (self.innerWidth)
{
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
}
else if (document.documentElement &&document.documentElement.clientWidth)
{
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
}
else
{
frameWidth = screen.availWidth;
frameHeight = screen.availHeight;
}
iWidth = newImg.width;
iHeight = newImg.height;
if(iWidth == 0) iWidth = 500;
if(iHeight == 0) iHeight = 500;
imgPosLeft = frameWidth/2 - iWidth/2 + document.body.scrollLeft;
imgPosTop = frameHeight/2 - iHeight/2 + document.body.scrollTop;
document.getElementById('imgCon').style.position = "absolute";
document.getElementById('imgCon').style.left = imgPosLeft;
document.getElementById('imgCon').style.top = imgPosTop;
if (navigator.product != "Gecko")
document.getElementById('imgCon').filters.item(0).Play();
}
function doImageClear()
{//clear the image
document.getElementById('imgShow').removeAttribute('src');
document.getElementById('imgCon').style.display = "none";
}

place the above script in head section of html

Now place one div with syle as none, and one image with fixed width and height.
when you click on the image, the showPic function will call, which will resize your image to big one.


<div id="imgCon" style="display: none; z-index: 100;filter:progid:DXImageTransform.Microsoft.Fade(duration=0.7);
left: 10px; overflow: auto; position: absolute; top: 10px">
<div class="closeLnk" onclick="doImageClear();">
close</div>
<div id="picLibImgHolder">
<img class="imageStyle" class="galleryImg" id="imgShow" style="cursor: pointer" onclick="doImageClear();"
border="0" name="imgShowN"></div>
</div>

<img class="imageStyle" src="/PublishingImages/CFMR.jpg" width='100' height='80' id="imgCF" onclick="javascript:return showPic(this);" />

Expanding image on mouseover

This code project artical is just a javascript, that will help you to animate your image or any display article, like a div from some specified size to another size. Thus enable you to make a dynamic web page were the pictures glows from thumbnail view to a full image.

http://www.codeproject.com/KB/scripting/Expanding_Image_Animator.aspx

Using BeforeProperties and AferProperties of ListItem Event Handler

Accessing Property of a list item directly

Public override void ItemAdded(SPItemEventProperties property)
{
string titlePro=properties.AfterProperties["Title"].toString();
int idProperty=conver.toInt32(properties.AfterProperties["Title"].toString());
}

Looping through property collection

Public override void ItemAdded(SPItemEventProperties property)
{
SPItemEventDataCollection propertyCollection=properties.AfterProperties;
foreach(DictionaryEntry entry in propertyCollection)
{
string filedName=entry.key.toString();
string fieldValue=entry.Value.toString();
}
}

Sharepoint SPField InternalName vs DisplayName

Following is the list of common spfieldcollection/spfield methods
and name they require (Display Name / Internal Name).

  • SPFieldCollection[name] : SPField
    name: DisplayName
  • SPFieldCollection.GetField(name) : SPField
    name: internalName, displayName or internalName and displayName from the current context
  • SPFieldCollection.GetFieldByInternalName(name) : SPField
    name: internalName
  • SPFieldCollection.ContainsField(name) : bool
    name
    : displayName or internalName
  • SPListItem[name] : object
    name: internalName, displayName or internalName and displayName from the current context
  • SPListItem.GetFormattedValue(name) : string
    name: internalName, displayName or internalName and displayName from the current context

Sunday, November 23, 2008

Whats New in Share Point Server 3.0?

Built in Breadcrumbs

Site Navigation

Security - What you see is what you've got access to. This makes it a bit easier on the admins, so they don't have to explain why a user clicks a resource, needs to enter a username and password, tries 3 times and fails and then will be shown an error page... If you don't have access to the resource it will not be shown in WSS 3.0. Whoopdie doo for us!

File-based Permissions

No deny permission, unfortunately.

Document Collaboration - This is a huge advantage with the 3.0 version (I'm not sure how it used to work with 2.0 or if it exists in that version, but in this version it rocks). It supports Major and Minor versioning which basically means that if you make a "minor" change to a document it will not be seen by the user. However, when you publish the document to a "Major" version it will become known and seen by the users. It supports Document Properties, something that can come in handy when searching. (I'll get to the search part soon). Workflows, the name says it all doesn't it. Templates (Word 2007), Policies...

Search Indexer that also indexes the Document Properties (as mentioned above). The search functionality is no longer based on the SQL Server but it's own index generated by the database. WSS 3.0 has a searchbox

WIKI. You probably know what a wiki is already and most of you probably have slightly different opinions as to what a wiki is excactly. My opinion is that it's a public "document library" (find me a better term..) that anyone can edit and add information to. You can link from one thing in the WSS 3.0 wiki to another by using real wiki-commands such as [[Tobias Zimmergren]] and it will create a link. If the link doesn't exist, it will be a link with dashed bottom-border. When you click the link it will ask you to put some info in about the link. And that's basically how it works. All you should really need to know, is that there's support for a nice wiki.

Blog. It supports your own blog. A blog is a Web-log and I bet you all know what that means. (I'm writing a blog entry right now)


For More details fine the below links.

http://office.microsoft.com/en-us/sharepointtechnology/HA100738471033.aspx

http://www.sharepointblogs.com/zimmer/archive/2006/10/06/what-s-new-in-wss-3-0-and-sharepoint-server-2007.aspx

Install Windows SharePoint Services 3.0 Tools on XP HACK

This is a hack to install SharePoint Services 3.0-Visual Studio 2005 Extensions on XP machine. For this we need to add/modify the following registry key.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0]
"Sharepoint"="Installed"


Link for Visual Studio extensions
Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions (VSeWSS)


I have tested it on XP on it is working fine. The same works fine for VISTA as well

Thursday, November 20, 2008

variables for Alerts

I'm currently creating custom alert templates for WSS 3.0 / MOSS 2007. I noticed you can use a GetVar element for obtaining properties of the item that triggered the alert, i.e.:


AlertFrequency - The time interval for sending an alert. Possible values include 0 (immediate), 1 (daily), or 2 (weekly).
EventType - The type of event. Possible values include 1 (item added), 2 (item modified), 4 (item deleted), 16 (discussion added), 32 (discussion modified), 64 (discussion deleted), 128 (discussion closed), and 256 (discussion activated).
ItemName - The title of the item.
ItemUrl - The absolute URL for the item.
ListName - The name of the list.
ListUrl - The absolute URL for the list.
ModifiedBy - The display name of the user who modified the item.
MySubsUrl - The absolute URL for the My Alerts on this Site page in Site Settings.
SiteLanguage - The locale identifier (LCID) for the language used on the site. For example, 1033 is the LCID for U.S. English.
SiteName - The title of the site.
SiteUrl - The absolute URL for the site.
TimeLastModified - The time at which the item was last modified.