|
1 | 1 | DNN JavaScript Libraries |
2 | 2 | =============== |
3 | 3 |
|
4 | | -This repository contains DNN JavaScript Library extensions, wrapping some common |
5 | | -JavaScript libraries for use in DNN. |
| 4 | +Version 7.2 of the [DNN Platform](http://www.dnnsoftware.com) introduced the |
| 5 | +JavaScript Library extension type. This allows common JavaScript libraries to |
| 6 | +exist in a single place within a DNN site, instead of every module, skin, and |
| 7 | +piece of content that wants to include them using their own. DNN presently |
| 8 | +comes with libraries for jQuery, jQuery UI, jQuery Migrate, Knockout, and |
| 9 | +Knockout Mapping. |
| 10 | +In addition to these built-in libraries, new libraries can be installed into |
| 11 | +DNN, and used by various components. DNN allows multiple versions of a |
| 12 | +JavaScript library to be used, so one module can request a particular version |
| 13 | +of a script, while another requests another. So long as they aren't on the same |
| 14 | +page, they will get what they requested; otherwise, DNN will use the higher |
| 15 | +version. |
| 16 | + |
| 17 | +Goal |
| 18 | +=============== |
| 19 | + |
| 20 | +The main benefits in using JavaScript Libraries are realized when they are used |
| 21 | +by many separate components within a DNN site (i.e. when there is one common |
| 22 | +set of libraries and separate, unrelated DNN skins and modules use those |
| 23 | +libraries instead of packaging scripts directly into the extension). In order |
| 24 | +to aid in that goal, we are attempting to create a central repository |
| 25 | +of common JavaScript Libraries that can be used by many different DNN extension |
| 26 | +developers. |
| 27 | + |
| 28 | +Usage |
| 29 | +=============== |
| 30 | + |
| 31 | +Skins |
| 32 | +--------------- |
| 33 | +Starting in DNN 7.3, there is a skin object called `JavaScriptLibraryInclude` |
| 34 | +which can be used to request a JavaScript library (including jQuery, but also |
| 35 | +any 3rd party library) from a skin. To do that, you need to register the skin |
| 36 | +object at the top of your skin: |
| 37 | + |
| 38 | + <%@ Register TagPrefix="dnn" TagName="JavaScriptLibraryInclude" Src="~/admin/Skins/JavaScriptLibraryInclude.ascx" %> |
| 39 | + |
| 40 | +Then, in the body of the skin, use the skin object to request the library: |
| 41 | + |
| 42 | + <dnn:JavaScriptLibraryInclude runat="server" Name="jQuery" /> |
| 43 | + <dnn:JavaScriptLibraryInclude runat="server" Name="jQuery-UI" Version="1.10.3" /> |
| 44 | + <dnn:JavaScriptLibraryInclude runat="server" Name="jQuery-Migrate" Version="1.2.1" SpecificVersion="LatestMajor" /> |
| 45 | + |
| 46 | +HTML Skins |
| 47 | +--------------- |
| 48 | +The skin object mentioned above can also be used from HTML skins. It would look something like this: |
| 49 | + |
| 50 | + <object codetype="dotnetnuke/server" codebase="JavaScriptLibraryInclude"> |
| 51 | + <param name="Name" value="jQuery" /> |
| 52 | + <param name="Version" value="1.9.1" /> |
| 53 | + </object> |
6 | 54 |
|
7 | 55 | License |
8 | | -------- |
| 56 | +--------------- |
9 | 57 |
|
10 | 58 | This code is released under the [MIT license](LICENSE.md). |
11 | | -However, the individual libraries are licensed by their respective owners. |
| 59 | +However, the individual libraries are licensed by their respective owners. |
0 commit comments