Thursday, January 21, 2010

Renaming the menu items in SharePoint Site Libraries and Lists for a Specific Site

In SharePoint document Library/List we find menu items like New, Uploads, Actions and Settings etc. At times there might be requirements to rename these menu items for a specific site. The following Javascript function can be used to achieve the objective.




The code snippet shown below can be called from inside the specific SharePoint Page.

e.g AllItems.aspx page inside a Document Library/List.

This javascript function needs to be called on Page load event using _spBodyOnLoadFunctionNames.push method.

<script language="javascript" type="text/javascript">

_spBodyOnLoadFunctionNames.push("renameMenuItem('New', 'My New')");
_spBodyOnLoadFunctionNames.push("renameMenuItem('Settings', 'My Settings')");

function renameMenuItem(oldMenuItemName, newMenuItemName)
{

var vAnchorTag;

var vAllAnchorTags = document.getElementsByTagName('a');
if(oldMenuItemName.length!=0)

{
for (var j = 0; j < vAllAnchorTags.length; j++)

{

vAnchorTag = vAllAnchorTags[j];


if (vAnchorTag.innerText.indexOf(oldMenuItemName)!=-1)

{
vAnchorTag.innerText = newMenuItemName;
try

{

if(newMenuItemName.length != 0)

{

vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt

= newMenuItemName;


}

else
{

vAnchorTag.parentNode.previousSibling.firstChild.firstChild.alt

= oldMenuItemName;

}

}
catch(err)
{
}
}
} // End For
} // End If
}// End Function
</script>

Check it out from here: http://www.mindfiresolutions.com/Renaming-the-menu-items-in-SharePoint-Site-Libraries-and-Lists-for-a-Specific-Site-209.php
Try it out and enjoy...

Create custom application page in sharepoint 2007

/*******************Test.aspx*******************************/
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>


<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
    this.Label1.Text = "Samarendra swain";
}

protected void btnSubmit_onclick(object sender, EventArgs e)
{
   this.Label1.Text = "Hi...";
   this.txtValue.Text = "click submit";
}

</script>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<h1>Testing custom application page</h1>
<asp:Label Text="Hello World" runat="server" ID="Label1"></asp:Label>
<asp:TextBox runat="server" ID="txtValue"></asp:TextBox>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_onclick" />

copy this test.aspx file in this location _layouts/Test.aspx
run with this url like http://testsite/_layouts/Test.aspx
</asp:Content>
/**********************End********************************** /
Try it out and enjoy.............

Create a Custom View for Survey List

In SharePoint, custom views are used to display the items in a list/libraries with custom look and feel.Therefore you have to choose a view format like Standard View, Calendar View, Datasheet View or Gantt View and accordingly you can customize the display style by choosing Filter condition, Sort method, Group By condition etc. SharePoint allows us to create custom views for the list and libraries. But for the Survey type list, SharePoint documentation doesn't mention anything about creating a custom view.
Below mentioned steps are can be adapted to create a custom view for Survey List.

Steps-:
1.Open a SharePoint Site......Open the Survey List.
2.Find the ListID from the URL like
List=%7BF2141E9F%2D8EA2%2D42EE%2DA965%2D52F1D7362066%7D

3.Now change the URL in the browser as
http://SiteName:PortNo/_layouts/ViewType.aspx?List=%7BF2141E9F%2D8EA2%2D42EE%2DA965%2D52F1D7362066%7D

4.Then choose a view format for the survey list.

5.Type a custom View Name.

6.In the same page open the style tab, choose a style for this view e.g Basic Table (Don't set the style as Default).

7.Then press OK to create the view.

Edit the Custom View

1.Open the Survey List
2.Go to Site Action....Click on Edit page....Click on Modify Shared Web Part
3.Now click on Edit the current view
4.It will open the view .Modify the view & save it.

Check it out