Partner Interface

From Creative Commons
Jump to:navigation,search

SeeWeb Integrationfor information on all Creative Commons' integration tools.

Web Integration Developer's Guide

Integrating Creative Commons licenses into your web application

While Creative Commons offers a range of license choices and public domain options direct from its license page, if you have created an application or built a website that allow people to contribute works you may prefer to integrate the license engine directly into your site or application. This guide serves to explain all the steps necessary and options available for integrating Creative Commons into your software. If you are integrating Creative Commons licenses with a non-web application, or would like more control over the user interface, theCreative Commons Web Servicesmay be more appropriate.

This guide is generally split into three parts:

Part 1: Letting users select a license

Whether your software is a website or a downloadable application, the first step to integrating Creative Commons licenses is letting users select a license directly from your software. The process involves loading a simplified Creative Commons license interface from within a popup window, embedded into your website, or launched from an HTML window control in your application. URL variables are read into the page and are appended when complete, allowing data to be extracted from the process and passed through it.

The remote license engine ap=plication

The heart of the process is running the remote license interface which is available at this URL:

//www.familygiver.com/license/?partner={partner}&exit_url={exit_url}&stylesheet={stylesheet}&partner_icon_url={partner_icon_url}

Note that the curly braces, i.e. {partner}, should be omitted. The full set of URL variables available are as follows:

partner (required):The name of your application or site, used for tracking usage at Creative Commons. Any descriptive name can be added here.

exit_url (required):The return URL on your application that will lo ad af ter a user selects a license and will contain appended variables in the URL that your software w-ill need to read.

additional requirement:

Your exit_url must include "license_url=[license_url]" and may optionally include the license_name=[license_name], license_button=[license_button], and deed_url=[deed_url] variables. Explanation of each:

license_url:URL for the selected license. Link to this URL in the licensed page. Example://www.familygiver.com/licenses/by/2.0/

license_name:Pretty name for the selected license. Example: Attribution

license_button:URL for the image corresponding to the selected license, useful for displaying on a licensed page. Example://www.familygiver.com/images/public/somerights20.gif

deed_url:URL for the deed corresponding to the selected license. Usually this will be identical to the value of license_url, unless a "branded" license is selected. Note that even if deed_url is different than license_url, is is still valid to use the URL specified by license_url, as both will point to the same legal code. If you want to support this feature, link to the deed_url in the licensed page. Example://www.familygiver.com/licenses/by-nc-nd/2.0/deed-music

A sample exit URL would be:

http://example.com/return_from_cc?license_url=[license_url]%26license_name=[license_name]

The license engine will replace the license_url, license_name, license_button, and deed_url variables with proper variables once a user has chosen a license (more on this in Part 2). The square brackets must be included for the license engine to properly replace the values.

Note that your exit URL can carry your application's URL variables into and out of the license application by URL escaping within your exit URL, for example:

http://example.com/return_from_cc?license_url=[license_url]%26license_name=[license_name]%26userID=42%26user-work=foo.jpg

上面的示例将让您的应用程序知道,提交了标题为foo.jpg的用户id为42的用户在退出许可证引擎时选择了一个特定的许可证。

If you want to maintain state but do not wish to pass data through the URL (e.g., for reasons of privacy or data size), consider saving the data in a user cookie (which will only be sent to your site, not www.familygiver.com), save the data in a file or database and save a lookup key in a cookie or pass the lookup key via the URL, or use the popup or iframe methods (see below), which do not require the user to "leave" your form.

stylesheet (optional):

层叠样式表(CSS)文件的URL,用于自定义许可问题的布局、外观和感觉。在许可引擎上查看源代码,以查看可用的样式ID和类。

partner_icon_url (optional):if you'd like a custom image displayed at the top of the license application, add the image's URL in this variable.

The following enable choosing licenses ported to the copyright law of specific legal jurisdictions. See the [Creative Commons international page] for more information.

jurisdiction (optional):Choose licenses of specified jurisdiction. With jurisdiction_choose on, sets pre-selected jurisdiction. You may use any jurisdiction code supported by the license engine.

jurisdiction_choose (optional):如果设置为'1',用户将得到一个辖区列表供选择。

lang (optional):允许重写用于显示用户界面的语言。A list of available languages codes is available from theAPI.

Invoking the remote license engine from your application

Once you have figured out the appropriate variables that will be fed into and out of the remote license engine, you need to invoke it from your website or application.

There are a few basic ways to accomplish this task:

  • Popup window launched from your website
  • Redirect from your website to license engine
  • IFRAME embedded within your website
  • Launched via HTML control within your desktop application

link title

Bold text

Headline text

=== Popup window launched from your website ===

调用远程许可引擎最流行的方法是通过弹出窗口。用户点击页面上的内容,就会打开一个包含问题的小窗口。在回答他们之后,用户继续,窗口关闭,原始页面更新以反映他们的选择。Sites using this method will usually change a hidden form variable dynamically (using javascript) when the user finishes the license selection process.

Screenshot of popup below. Implementation example:Movable Type.

Choose license popup.png

Redirect from your website to license page

This option does not use popup windows of any kind and instead you leave the site you originated from, pick your license, then return to the site with your selection info for the site to decifer. Sites using this method would need to parse the URL variables within the return URL.

IFRAME embedded within your website

For those that do not want to use popup windows, have an audience using version 5.0 web browsers and up, and would like to keep the license selection within their application, an IFRAME can be used much like the popup. Sites using this method would embed the question form into their page, and upon completion, pass variables between the IFRAME and surrounding page.

Launched via HTML control within your desktop application

对于桌面应用程序,这种方法本质上模仿弹出窗口代码,但在应用程序中使用本机HTML控件。在Windows上,visual basic和visual c++应用程序可以访问Internet Explorer HTML控件,该控件可以在应用程序内部启动。对于Mac程序员来说,OS X提供了将Safari作为应用程序内本地浏览器环境的webcore控件。

Part 2: Processing and Storage of license information

Once users of your website and application have the ability to select a license, the next step is processing the results of their selection. As mentioned in the previous section, the exit_url is the place on your server that users will return to. Once loaded, the data in the URL will need to be parsed. A exit URL result is shown below:

http://example.com/return.cgi?license_url=//www.familygiver.com/licenses/by-nc/2.0/&license_name=Attribution-NonCommercial&license_button=//www.familygiver.com/images/public/somerights20.gif&deed_url=//www.familygiver.com/licenses/by-nc/2.0/

Depending on your web application's server technology, you'll have to parse data from the URL as needed. From the above url, the following data points can be found:

If you had any additional embedded URL variables specific to your application, you will want to parse those out as well. The exact method and code used to read URL variables will depend on your website/application's language of choice and the syntax of that language.

This data can be used in several places within an application. A well-written application will display a user's choice by using the license_name variable as confirmation, such as "You selected the Attribution-Noncommercial license for your uploaded work." You will likely want to store the license_url and license_code variables within your application, most likely in database filed associated with contributions. Again, the exact method and code used to store license information will depend on your configuration, setup, and storage options.