Archive for November, 2007

DUMMY’S Introduction to Concept of Sites and Site Collection

Today going through files on my hard disk, I came across this tutorial which I wrote about 2-3 months back for one of my very close friend Salman, who was interested in learning SharePoint so I thought I should share this tutorial on my blog for benefit of those people who get themselves confused between Sites and Site Collection concepts in SharePoint 2007.

———————————————————————————————————————————

Most people find it difficult to grasp the concept of sites and site collections when they first begin with SharePoint. Today I would discuss in detail both of these concepts and then we will also see how we can create some sample sites and site collection. Before we proceed further lets define a few things.

Site:

  • Site typically would store lists of documents, events, tasks, discussions and many other types of information.
  • Sites may also contain pages and web parts that provide access to information that is either on stored within the site or in some external locations.
  • Sites would also control access and define permissions levels for users and groups within a site (We will discuss this further in Security Authorization section)

Site Template:

The initial configuration of lists, pages and web parts constitutes a site template.

Site Collection:

A site collection is a set of sites connected together, and of course there is a relation between sites and that is that one site is the parent site (also known as the Root Site) and the rest are sub-sites or child sites.

 

Site Type:

When you create a site the site creation page allows you to select a site template for the site which would determine the functionality and the initial configuration of content on the site

Create a site collection

Now let’s create a new Site Collection step by step.

1) Log in to windows using the Admin Account.

2) Go to Start –>Administrative Tools–> SharePoint 3.0 Central Administration

3) This would open the Central Administration Page. On the Central Administration page click on the top navigation bar, click Application Management.

4) On the Application management page, in the SharePoint Management Section click on Create Site Collection.

To download the complete document please click here.

Comments (4)

Customizing Context Menu in SharePoint 2007


A couple of days back I got an email request from one of my friends who wanted to know that how can he customize the context menu for items in the document library for WSS 3.0, and the very next day I was assigned a project at my job in which I had to do exactly this as one of the requirements. So today I am writing this post to put a little light on how we can customize the context menu for items in a document library. Ok I am going to illustrate this with the help of an example problem.

Problem Statement:
Whenever we upload an excel file in the document library, the context menu should have an extra item in named as lets say "View Excel Sheet as a webpage" ofcourse in this post I am not going to illustrate how we would render that excel sheet as webpage to the user but this is just to give you an idea of how things are done. This menu item would also have an "excel" like icon along site it and whenever we will click on the menu item it would just alert the user the location of the excel file .i.e. where it is stored with reference to the site.

Ok now having stated the problem lets get to some basics first.

The context menu is itself a javascript program means that the context menu is generated by a javascript code . This javascript program can be found at

\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\Core.js

Yes the name of the file has changed to Core.js from ows.js, menus in Windows SharePoint Services and SharePoint Portal Server 2003 were located in a javascript files at the following location

\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033\ows.js

Ok now lets dig in a bit in the Core.js file, in the Core.js file the main function responsible for the document library drop down menus is AddDocLibMenuItems(m, ctx) and this provides a hook by which we can insert additional menu items.

The first few lines of the function are as follows

if (typeof(Custom_AddDocLibMenuItems) !="undefined")
    {
        if (Custom_AddDocLibMenuItems(m, ctx))
            return;
    }

Ok now what this piece of code does? it is basically looking as to whether a function named Custom_AddDocLibMenuItems is defined or not, if it is defined then it simply calls it. So the main idea here is to override this Custom_AddDocLibMenuItems function by our own script which we can use to extend the context menu, adding new items.

Note: It is recommended that you make a copy of your Core.js before you make any changes to it.

Ok now we can override the Custom_AddDocLibMenuItems function in core.js adding our own script as follows.

function Custom_AddDocLibMenuItems(m, ctx)
{
    var strDisplayTextCustom = ‘View Excel Sheet in Browser’;

    setDocType();

    if(currentItemAppName.toLowerCase() == "microsoft office excel")
    {
          strAction="alert(ctx.HttpRoot+unescapeProperly(currentItemFileUrl))";
  
           var strImagePath = ctx.imagesPath+"XLS16.GIF";
         
           // Add menu item
           CAMOpt(m, strDisplayTextCustom, strAction, strImagePath);
 
          // add a separator to the menu

           CAMSep(m);
   }
    return false;
}

How does the function above works?

The Custom_AddDocLibMenuItems function takes two parameters m and ctx, the first parameter m is basically representing the menu object itself, where as ctx provides HTTP context information about the web request. To add an item to the menu only one function call is needed.

CAMOpt(m, strDisplayTextCustom, strAction, strImagePath);

The CAMOpt function takes 4 parameters which are as follows:

1) The menu object to add item to.
2) The display text of the menu item.
3) Javascript action to perform when item is clicked.
4) Path to an image associated with the menu item.

CAMSep function simply adds a separator bar to the menu. Finally the function returns a false which means that standard menu items should also be included, if we had returned true then standard menu items would not have been included.

Having done all this simply save the Core.js file and open your sharepoint site and a few excel sheets to the document library and check its context menu. The context menu should be as shown in the image below.



      


Comments (39)

My New Apple IPHONE- 8 GB

Today I am not going to write about SharePoint, rather I will discuss about my new Mobile phone–Apple IPHONE (8-GB). I have been really excited to get this amazing product from Apple in my hands ever since its launch and finally the day has arrived and I have one of these revolutionary mobile phone of the future, all for myself.

Having spent a good amount of hours exploring the various features of  Iphone I thought to share them with you all.

1) Activation:

Iphones recently came to pakistan, and most of its vendors sell a cracked version of the apple software so you dont really need to activate your set which is a good thing but still one drop act that comes with it is that if you try to install an update for the phone software your set would be eventually locked and you will have to totally get the firmware reinstalled..which ofcourse would cost you more money.

2) Synchronization:

Syncing is really really FAST. The iPhone automatically syncs your contacts,
calendars, and mail accounts. It also will sync your Bookmarks from
Internet Explorer or Safari; sorry no Firefox option. Syncing is easy,
and that is really all there is to it.

3) Design:

I seriously have no words to describe its amazing looks, if you are looking for a best looking mobile phone then I think Iphone should be your top most choice. You only have one button and thats the home button which will take you to the home menu.

4) iPod

The iPod on the
iPhone is awesome. I love flicking through my music, and when turned
horizontally, the cover flow is cool. Just like Steve Jobs said
himself, you can touch your music.


As I explore more n more this amazing mobile phone + IPOD…I will keep posting.

Comments (3)

LIVE MOSS 2007 Based Site


If you are looking for a LIVE MOSS 2007 based site, you can find an excellent collection here

http://www.wssdemo.com/Pages/websites.aspx

Comments (1)

Application pages VS Safe Pages

Application Pages: is a template page from _layouts virtual directory and has the following the characteristics

1) It is available within every site.
2) Only one copy of the page is there on the server.
3) NOT accessible via the designer.
4) Accessible through the IIS.

Safe Pages: Template page that comes from site definitions and has the following characteristics.

1) Exists only on sites where it has been specified by a template or created by a user.
2) More than one copies can exist on the server.
3) Accessible via designer.
4) NOT accessible via IIS.

Comments (2)