Google Search Appliance Web-Part for SharePoint Results Page

I found this code a while ago and used it in our SharePoint 2007 Intranet site.

The code worked the same when our sites migrated to SharePoint 2010, so I’d thought I’d share it here.

The search displays both results at the same time on the results page.

I don’t know where the code originated from, I’ve searched everywhere but can’t find the original Blog Post.

Once you modify the code with your own Google Appliance settings, just replace those settings in the code below.

You might have to find your Google Search Appliance settings by viewing the source-code from the Google search results page.

Once edited, just save the code to a text file, upload it to a Document library, copy the link and paste into a Content Edit Web Part on the SharePoint Search Results Page.


<div id="googleSearchResults">loading...</div>
<script type="text/javascript">
var gsaHost = 'http://googlesearch.intranet.au/search?output=xml_no_dtd';
var gsaCollection = 'default_collection';
var gsaClient = 'Intranet_frontend';
var gsaStylesheet = 'Intranet_frontend';
var gsaAccess ='p';

function getParameter ( queryString, parameterName )
{
// Add "=" to the parameter name (i.e. parameterName=value)
var parameterName = parameterName + "=";
if ( queryString.length > 0 )
{
// Find the beginning of the string
begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
if ( begin != -1 )
{
// Add the length (integer) to the beginning
begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
end = queryString.indexOf ( "&" , begin );
if ( end == -1 )
{
end = queryString.length;
}      // Return the string
return unescape ( queryString.substring ( begin, end ) );
}   // Return "null" if no parameter has been found   return "null";
}
}
function search()
{
var results = document.getElementById("googleSearchResults");
document
var iframeHTML='\<iframe id="RSIFrame" allowtransparency="true" scrolling="no" frameborder="0" style="';
iframeHTML+='border=0px;';
if (navigator.appName == 'Netscape')
{
iframeHTML+='width:98%;';
}
else
{
iframeHTML+='width:100%;';
}
var query = getParameter(window.top.location.search.substring(1),"k");
if (query == null)
{
query = '';
}

iframeHTML+='height:1500px;';
iframeHTML+='background:transparent;"';
iframeHTML+=' src="' + gsaHost + '?site=' + gsaCollection + '&client=' + gsaClient + '&access=' + gsaAccess + '&proxystylesheet=' + gsaStylesheet + '&entqr=0&ud=1&sort=date%3AD%3AL%3Ad1&output=xml_no_dtd&oe=UTF-8&ie=UTF-8&filter=0&q=' + query  + '"';
iframeHTML+='><\/iframe>';
results.innerHTML = iframeHTML;
}
search();
</script>

Advertisements

SharePoint 2007 2010 – Embed an MP3 Player for a List or Document Library

UPDATED: 14 JUNE 2016

I found an existing copy of the Yahoo Media Player in my collection of old files.

Grab the code here: http://pastebin.com/i9QMm0PN

——————————–

Found this awesome “No-Code” solution while researching how to add Audio Books to SharePoint 2007.

Requirements:

– Site Administrator

– Internet Access (from Company Intranet)

1: Upload MP3’s to a Document Library or Create a Custom List with a URL column, which points to your MP3’s.

You can have either the MP3 as a Link:  (httP://server/site/MP3/song.mp3) or as an MP3 uploaded to a Document Library.

2: Add a Content Editor Web-Part to the top or bottom of the screen and place this code in the Source:

http://mediaplayer.yahoo.com/js

3: Hide the Content Editor Web Part and Watch the Magic appear!

SharePoint 2007 Document Library with playable MP3s

You should now see a little Play Button next to each MP3 link or File     Which you can click to listen.

– Clicking the Playlist displays all MP3 files that are found on the page in a Playlist!

– Even though it detects an FLV, when played it will only play the audio NOT the video.

Tip: You could also download the Yahoo Javascript file and upload it to your Scripts Library to save load time.

For more details about the Yahoo Media Player, check out their site here

* This Pic shows the a Custom List with a Multi-Line Column showing the URL with a thumbnail.

SharePoint 2007 MP3 List

14Oct 2011 – Update

This feature has now been tested on SharePoint 2010 and works splendidly.

I had to add a reference to my local copy of JQuery for it to display

i.e: /servername/scripts/jquery-1.6.2.min.js