DP_SharePoint_ReplaceLinks

The DP_SharePoint_ReplaceLinks library provides the ability to seamlessly use link protocols normally filtered by SharePoint 2007 in wiki pages and content editor web parts. It was created to support

The function:

  • Can be included directly into Content Editor Web Parts (which can then be saved as reusable Web Parts and added to Wiki pages).
  • Allows for any scheme (protocol) (Notes, RTSP, etc.) to be used within SharePoint content
  • Adds special support for Lotus Sametime prescence awareness.

The extension has been tested successfully on Internet Explorer 6+, Firefox 1+ and Opera 9+ and SharePoint 2007.

Download

This component requires a JavaScript (ECMAScript) 1.3 (or better) development environment. All downloads and code are covered by our Source Code Policy.

Usage

The library consists of a single JavaScript file with a .JS extension.

Importing the Library

The library must be imported before it is used. To import the library use the <script> tag. For example:
<script type=”text/javascript” src=”DP_SharePoint_ReplaceLinks.js”></script>.

Your path may vary depending on the location of the script on your server. The library can be imported directly before use (most common when lacking administrator access) or added to a common component (if admin/editing rights are available).

Using the Library

Assuming the library has been imported you can run the function at any time:

dpSP_ReplaceLinks();
	

This will search for specially formatted “news” links and, if found, alter them in place immediately.

The simplest way to use the function is to add a Content Editor Web Part to the bottom of your page (wiki or custom page) that both loads and runs the function similar to the following:

<script type="text/javascript" src="DP_SharePoint_ReplaceLinks.js"></script>
<script>
	dpSP_ReplaceLinks();
</script>
	

If you’d like to load the function earlier you can leverage the built-in SharePoint functionality to run the function after the “onload” event triggers:

<script type="text/javascript" src="DP_SharePoint_ReplaceLinks.js"></script>
<script>
	_spBodyOnLoadFunctionNames.push("dpSP_ReplaceLinks");
</script>
	

See the Example section for more information how to format the links.

Functions

There is only one function currently available in the library, the dpSP_ReplaceLinks function:

dpSP_ReplaceLinks()

This function, when run, will search the host page for specially formatted links using the “news://” protocol and alter them, in-place, to support otherwise filtered URLs.

Function Signature

dpSP_ReplaceLinks()

Arguments

This method has no arguments:

Return

Null. The function returns no value.

Examples

The function leverages the fact that the “news” protocol is both allowed and not often used. The page author creates specially formatted “news” links which are then modified, on-the-fly, by JavaScript after SharePoint generates and delivers the page.

Normal Links

Links are created in the following format: news://*NewProtocol*Address. Once run the funtion will replace “news” with whatever appears between the asterisks in the link and asterisks and new protocol will be deleted. Some examples:

news://*notes*DFGTA001/175479E7006436WS7//3G6EF1B738547906F3652476D000225EER
news://*FMP7*127.0.0.1/MyDatabase
news://*rtsp*www.youtube.com/somefile.3gp
	

Sametime Presence Awareness Links

For those people unfortunate enough to be subjected to Lotus Sametime the function can provide intergrated presence awareness. For this to function SameTime must be installed on the client machine. The following example demonstrate how to format such links:

<a href="*sametime*">name@company.com</a>
	

Revision History

April 14, 2012

  • Initial Release.

Share your Opinion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: