License Tool

The DNR maintains several license agreements that are important when we provide or consume information from our users. The General Data & Software License Agreement should be used when users download data or software for their own use (e.g. GPS data). Our Community Guidelines should be used when data are collected from users for DNR use (e.g. photo uploads).

We have developed a very simple license tool to make it easy to add "click-though" license acceptance functionality to a web page. Here's an example.

Basic Setup

First, you need to include supporting javascript source (we use JQuery) in your page. Paste the following text in the metadata section section of your page.

<script language="javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script language="javascript" src="https://files.dnr.state.mn.us/sitetools/license.js">></script>
<script language="javascript" src="https://files.dnr.state.mn.us/sitetools/fixedCenter.jQuery.js"></script>

Deployment Options

Forcing license acceptance before following a link. Often you would like to have a license "click-through" as part of a standard HTML link (e.g a link to a download page). The license tool API allows this by just altering the link to the page. For example:

<a href="https://www.dnr.state.mn.us/">download</a> becomes
<a href="javascript:showLicense('gds', 'https://mndnr.gov/', 'self')">download</a>

The showLicense() function takes 3 arguments:

  1. License type [string]: only 'gds' (general data software) is currently supported, others are forthcoming.
  2. (optional) Link [string]: URL to send the user to upon acceptance.
  3. (optional) Target [string]: Window name to open the URL in. Default target is the current window. Use 'new' to create a new browser window or tab.

 

Overriding default callbacks. Sometimes you'll want to use the license tool programatically. You do this by overriding the default callback functions defined by the API. They are called acceptLicense() and declineLicense(). The example on this page does just this. Instead of forwarding you to a link, it displays an alert and then hides the license. View the document source for an example.

Adding License Types

Adding a license types is straightforward but will require help from the webteam. Basically there are 3 steps:

  1. Create a stripped-down license file with just basic HTML. The page must use the 'ajax' page template. To do this just replace the default template of content_menu with ajax.(example)
  2. Create a printable version. Note that most often this will just re-use the version created in step 1 and wrap it with a bit of javascript. (example)
  3. Register the new license with the license API. This involves a small edit to the license.js file and can only be made by the webteam.

 

Back to top