July 31, 2009

Search Online using Various Search Engine in one part.

In regular life we wnat to search something on google or yahoo or any other search engine. For this we want to open IE, but now the following code snippet is used for add the search in your site.
It will provide the search result found at Web, Yahoo.com, Google and Various Blogs arrange in tab format.




<link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet" />
<script src="http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABQIAAAAbKU1_TiGJxAPxQNRN0Z7thQEKx5ztgmPnP8AiUB_ZtaZmH_j4xR_bAGbjyG4GamffxBhkZcRXMQE0A"
type="text/javascript">
</script>
<script type="text/javascript">
var searchControl;
window.onload = function() { onLoad(); }
function onLoad()
{ // Create a search control
searchControl = new GSearchControl(); // add a regular web search, with a custom label 'web'
var webSrearch = new GwebSearch();
webSrearch.setUserDefinedLabel("web");
searchControl.addSearcher(webSrearch); // add a site-limited web search, with a custom label
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("Yahoo.com");
siteSearch.setSiteRestriction("Yahoo.com");
searchControl.addSearcher(siteSearch); // add a site-limited web search, with a custom label
var siteSearch = new GwebSearch();
siteSearch.setUserDefinedLabel("Google.com");
siteSearch.setSiteRestriction("Google.com");
searchControl.addSearcher(siteSearch); // add a blog search, with a custom label
var blogsSrearch = new GblogSearch();
blogsSrearch.setUserDefinedLabel("weblogs");
searchControl.addSearcher(blogsSrearch); // setting the draw mode for the Google search
var drawOptions = new GdrawOptions(); // use tabbed view
drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED); // set the input field (instead of the default one)
drawOptions.setInput(document.getElementById('query')); // actually write the needed markup to the page searchControl.draw(document.getElementById("searchcontrol"), drawOptions); // set the google logo container GSearch.getBranding(document.getElementById("branding"));
}

var query = null;
document.onkeydown = function(event)
{ kd(event); };




function kd(e)
{ // make it work on FF and IE
if (!e) e = event; // use ESC to clear the search results
if (e.keyCode == 27)
searchControl.clearAllResults(); // get the input field
if (query == null) query = document.getElementById('query'); // and move the focus in there
query.focus();
}
</script>


<style type="text/css">
body { font-family: verdana; text-align: center; }
#queryContainer { margin-bottom:2em; width: 80%; margin-left:auto; margin-right:auto; }
#query { border:1px solid silver; width: 100%; }
#searchcontrol { width:80%; margin-left:auto; margin-right:auto; text-align:left; }
.gsc-control { width: 100%; }
</style>
</head>
<body>
<h1>Search</h1>
You can type anywhere on the page, and the search results will be updated. <br />
Use ESC key to clear the search results <br /> <br />
<div id="queryContainer"> <input type="text" name="query" id="query" />
<br /> <div id="branding">Powered by Google</div>
</div> <div id="searchcontrol"></div>
</body>

Script for Add Buttons for Site Action Menu.

Hi,Many folks face problem once the SharePoint portal is authorized; many eliminate the option of removing the site action menu from master page. Many occasions accrue when one is suppose the edit the web parts or the page contents, everything using designer is also not fissile. Here is a simple script which can be added in the required page as a Content Editor WebPart which can help you in further alterations in future.





< !--Code-- >

<style>

#ContentTypeToolbar table
{
background-color: #BFDBFF !important;width: 100%;
}


td button
{
padding: 3px 7px 4px 7px !important; border: 1px solid
#A0BECE; font-family: Verdana; background-color: transparent; height:auto; width:auto;
xoverflow:visible; margin: 0px 1px 0px 1px !important;
}

</style>



<div id="ContentTypeToolbar" style="background-color:#93BCF;"></div>

<script>

window.attachEvent("onload", new Function("NewButtons_OnLoad();"));

function NewButtons_OnLoad()

{

try

{
var aTags = document.getElementsByTagName("IE:MENUITEM");
var sToolbar='<table
class="ms-menutoolbar" cellSpacing="0" cellPadding="2" width="100%" border="0" >

<tr><td>';


// For Each Menu Item
for(var j=0;j< aTags.length;j++)
{
var aTag = aTags[j];
// Only Process the items from the _New And _settings Menu (ignore Actions)
if(aTag.getAttribute("id").toLowerCase().indexOf("_siteaction")>=0)
{
var BtnText=aTag.getAttributeNode("text").value;
var OnMenuClick=aTag.getAttributeNode("onMenuClick").value;
var IconSrc=aTag.getAttributeNode("iconSrc").value;
var Description=aTag.getAttributeNode("description").value; // Add the Button with
an Image.
sToolbar=sToolbar+'<button class="ms-menubuttoninactivehover"
onmouseover="MMU_EcbTableMouseOverOut(this, true)"
onClick="'+OnMenuClick+'" title="'+Description+'" hoverInactive="ms-menubuttoninactivehover"
hoverActive="ms-menubuttonactivehover">
<img style="height:22px;width:22px;" align="absmiddle" src="'+IconSrc+'">'+BtnText+'</button>';
}//end of if

if(aTag.getAttribute("id").toLowerCase().indexOf("_settings")>=0)

{
var BtnText=aTag.getAttributeNode("text").value;
var OnMenuClick=aTag.getAttributeNode("onMenuClick").value;
var IconSrc=aTag.getAttributeNode("iconSrc").value;
var Description=aTag.getAttributeNode("description").value; // Add the Button
with an Image.
sToolbar=sToolbar+'<button class="ms-menubuttoninactivehover"
onmouseover="MMU_EcbTableMouseOverOut(this, true)"
onClick="'+OnMenuClick+'" title="'+Description+'" hoverInactive="ms-menubuttoninactivehover"
hoverActive="ms-menubuttonactivehover">
<img style="height:22px;width:22px;" align="absmiddle" src="'+IconSrc+'">'+BtnText+'</button>';
}//end of if
} // End For
sToolbar=sToolbar+'<td class="ms-toolbar" noWrap width="1%" >
<img class="icon"
height="18" alt="" src="../../_layouts/images/blank.gif" width="1">
</td>
<td class="ms-toolbar" noWrap align="right">
<
button onclick="CTWPAbout()" style="background-color:transparent;border:0;cursor:hand;">
<img src="/_layouts/images/helpicon.gif"></button>
</td>
</tr>
</table>';

if (document.location.href.indexOf('codeexport') >0)
{
sToolbar='<textarea rows="5">'+sToolbar+'</textarea>';
}
document.getElementById("ContentTypeToolbar").innerHTML=sToolbar;
} // try
catch (e)
{ window.status=e.description;
} // catch
}
function CTWPAbout()
{
var sAbout='by Vinay Patil\n\nCopyright 2009\n ';
alert(sAbout);
}

Change the Style of Banner and Quick Launch

Here is the solution to change the style of NavFrame, NavWatermark, Bannerframe.
You have to enclose the following lines in
tag.

.ms-navframe
{ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0274CC', endColorstr='#FFFFFF', gradientType='0')}

.ms-navwatermark
{ display: none; }

.ms-bannerframe
{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0274CC', endColorstr='#FFFFFF', gradientType='1')}

#onetidPortalConn
{ display: none; }