SP SIN Overview

Please Note SP SIN 1.2 now available. Please update. (I recommend a reinstall if you're not using this in production, but upgradesolution should work)




SP SIN (from SharePoint Script/Style INjector) solves an age-old problem for developers and administrators, how to add script and style sheet resources to SharePoint without modifying master pages.

This problem is more complex than it seems because SharePoint allows and encourages changes to systems that are in production. How can you ensure that the changes you make work before deploying them to all users? How can you create versions of script and style sheet resources so that you can maintain backwards compatibility with previous solutions?

SP SIN solves these problems by allowing site owners, or those granted permissions, to inject script or style sheet resources into pages without touching any of the pages. All of this is accomplished using SharePoint best practices and recommended approaches only.

In addition, SP SIN has an innovative plug-in model that allows developers to extend the default functionality to build injection capabilities tailored to specific situations or broad consumption.

Functionality

SP SIN provides the following features:
  • Safely inject scripts or style resources into any SharePoint page, from any external or internal URL
  • Filter injection on specific URL patterns so you deploy resources only where you need them
  • Show specific resources only to specific people or groups
  • Plug-in model based on SharePoint content types allow extensibility beyond out-of-the-box capabilities

Management of SP SIN is done through SharePoint lists by site administrators, owners, or anyone granted permissions. If you can add items to a SharePoint list, you know all you need to know about managing SP SIN.

SP SIN also supports creating configuration packages to make management even easier. For example, you can have packages that deploy the latest jQuery script version to all pages in a site, or that deploy KnockOut, Modernizr, SPServices, and jQuery only to certain pages in certain libraries.

How It works

SP SIN uses a feature of SharePoint called Delegate Controls, which allow injection of functionality on any out-of-the-box page. The SP SIN delegate control reads configuration from a SharePoint list and determines whether to inject a script for the current page.

This configuration list, available from the Site Settings page, uses SharePoint content types to create multiple types of injection capabilities, called resource types. Out-of-the-box, there are two such resource types; script injection, and style sheet injection, optionally filtered by URL.

You can also download additional resource types from this page, for example to add Google Analytics tracking to SharePoint.

Because SP SIN works using SharePoint technologies and best practices, it is also possible for third-party developers to provide configuration packages that will automatically add script and style sheet setup as part of their solution delivery. Sample packages provided with SP SIN include:
  • Latest jQuery script from code.jquery.com CDN on all pages
  • jQuery 1.8.2 and SPServices 0.7.2 from cdnjs.com CDN on all pages

Setup and Installation

TIP: Hand these instructions over to your SharePoint administrator if you've never deployed a farm solution before.
To install SP SIN, run the following command in STSADM:
c:\>stsadm -o addsolution -filename path to downloaded WSP\spsin.wsp

Then, deploy the solution either through STSADM (or PowerShell) or Central Administration.

After installation, you can activate SP SIN on any site from Site Settings->Site Features. Activate the SP SIN Setup feature to set everything up.

Please note that SP SIN will install site collection scoped content types, requiring site collection administrator privileges.

Using SP SIN

You can set up SP SIN resources from the Site Settings page, either manually through the Manage Resources link or through one of the pre-made configuration packages.

To add a configuration package, click the Configuration Packages link on the Site Settings page, find the package you want to install, and click the button for the package you want to install, as shown below.


This will add the required entries in the resources list.

You can also manually add, edit, or delete resource entries from the resources list. Follow the link to Manage Resources from the Site Settings page.

Last edited Oct 16, 2012 at 9:46 AM by furuknap, version 11