The "old" IPluginStaticJS and IPluginStaticCSS interfaces have been marked obsolete. They are still available to plugin developers, and plugins that use these interfaces will continue to function as they always have; however the developers of those plugins will now receive a warning during compilation encouraging them to move toward the new IPluginJS and IPluginCSS interfaces (respectively):
warning CS0618: 'FogCreek.FogBugz.Plugins.Interfaces.IPluginStaticJS' is obsolete: 'Use IPluginJS instead.'
warning CS0618: 'FogCreek.FogBugz.Plugins.Interfaces.IPluginStaticCSS' is obsolete: 'Use IPluginCSS instead.'
These interfaces give plugin developers more power over their JavaScript and CSS including the ability to include not only static JS/CSS, but also dynamic (i.e., inline) JS/CSS.
The new interfaces look like this:
/// <summary>
/// Interface for adding JavaScript to be included.
/// </summary>
public interface FogCreek.FogBugz.Plugins.Interfaces.IPluginJS
{
/// <summary>
/// Get the plugin's CJSInfo object
/// </summary>
/// <returns>
/// A CJSInfo object that describes the plugin's JavaScript content.
/// </returns>
FogCreek.FogBugz.CJSInfo JSInfo();
}
/// <summary>
/// Interface for adding CSS to be included.
/// </summary>
public interface FogCreek.FogBugz.Plugins.Interfaces.IPluginJS
{
/// <summary>
/// Get the plugin's CCSSInfo object
/// </summary>
/// <returns>
/// A CCSSInfo object that describes the plugin's CSS content.
/// </returns>
FogCreek.FogBugz.CCSSInfo CSSInfo();
}
And the core method of these interfaces return a CJSInfo or CCSSInfo object as appropriate:
[Serializable]
public sealed class CJSInfo
{
/// <summary>
/// A list of JavaScript files to send down. Each file must be located in the \static\ subdirectory of this plugin.
/// A file like "\static\js\plugin.js" would be returned as "js\plugin.js", for example.
/// This property should only be used for static files. The files will be sent with a long expiration, so they cannot
/// be changed on a per-page basis. A change in plugin version will reset the cache. To send down dynamic files whose
/// parameters are controlled by this plugin (i.e. files that might change on a per-page basis), use sInlineJS and
/// jQuery's getScript method:
/// $(document).ready(function() {
/// $.getScript('default.asp?pg=pgPluginRaw&sPluginID=myplugin%40example.com&P_myOtherParam=foo', function() {
/// /* things to do after the script has loaded... */
/// });
/// });
/// </summary>
public string[] rgsStaticFiles { get; set; }
/// The inline JavaScript to include at the bottom of the page.
public string sInlineJS { get; set; }
}
[Serializable]
public sealed class CCSSInfo
{
/// <summary>
/// A list of CSS files to send down. Each file must be located in the \static\ subdirectory of this plugin.
/// A file like "\static\css\plugin.css" would be returned as "css\plugin.css", for example.
/// This property should only be used for static files. The files will be sent with a long expiration, so they cannot
/// be changed on a per-page basis. A change in plugin version will reset the cache. To send down dynamic files whose
/// parameters are controlled by this plugin (i.e. files that might change on a per-page basis), use sInlineCSS and
/// @import url("paramaterized_url");
/// </summary>
public string[] rgsStaticFiles { get; set; }
/// The inline CSS to include at the top of the page.
public string sInlineCSS { get; set; }
}