Difference between revisions of "JsWidget"

From Creative Commons
Jump to: navigation, search
 
Line 4: Line 4:
  
 
== Sample Usage ==
 
== Sample Usage ==
 +
 +
The following is a simple example of how the widget would be included in a page to create a license selector, similar to the one used at the [http://labs.creativecommons.org/dhtmllicense/ DHTML License selector] demo.
 +
  
 
   <html>
 
   <html>
 
     <head>
 
     <head>
       <script src="http://example.creativecommons.org/widget/1.0/source.js"></script>
+
       <title>Example Widget Page</title>
      <script>
 
        function init_widget() {
 
            // generate the Creative Commons license selector as a form element
 
            // with the name "selected_license"
 
            var license_selector = new CC_selector();
 
            document.getElementById("widget_container").innerHTML = license_selector.html("selected_license");
 
        } // init_widget
 
      </script>
 
 
     </head>
 
     </head>
     <body onload="init_widget();">
+
     <body>
 
       .
 
       .
 
       .
 
       .
 
       .
 
       .
 
         &lt;div id="widget_container">
 
         &lt;div id="widget_container">
 +
          <script src="http://example.creativecommons.org/widget/1.0/source.js"></script>
 
         </div>
 
         </div>
 
       .
 
       .
Line 37: Line 33:
 
* Provide up to date license information by either:
 
* Provide up to date license information by either:
 
** Utilizing the [[Creative Commons Web Services]], or
 
** Utilizing the [[Creative Commons Web Services]], or
** Utilizing licenses.xml to generate the appropriate Javascript on the server side
+
** Utilizing licenses.xml to generate the appropriate Javascript on the server side.  This may be done using a dynamic language such as PHP or through pre-processing to a static file when licenses are updated.
 
* Provide a robust, scalable serving solution (if any server-side processing is needed) in order to support CC-hosted Javascript resources for the general public
 
* Provide a robust, scalable serving solution (if any server-side processing is needed) in order to support CC-hosted Javascript resources for the general public
  

Revision as of 16:38, 14 June 2007

Creative Commons currently provides two methods for integrating license selection into applications: the Partner Interface and the web service API. The CC Javascript Widget will provide an additional, lightweight method for integrating license selection into web applications. When complete the widget will be used in WpLicense as well.

Note that the JsWidget is currently under development and is not yet available.

Sample Usage

The following is a simple example of how the widget would be included in a page to create a license selector, similar to the one used at the DHTML License selector demo.


  <html>
    <head>
      <title>Example Widget Page</title>
    </head>
    <body>
     .
     .
     .
        <div id="widget_container">
          <script src="http://example.creativecommons.org/widget/1.0/source.js"></script>
     .
     .
     .
    </body>
  </html>

Requirements

We have identified the following requirements for the Javascript widget:

  • Generate HTML suitable for use in a form which presents the basic license selector
  • Provide compatibility with all A-grade browsers
  • Provide up to date license information by either:
    • Utilizing the Creative Commons Web Services, or
    • Utilizing licenses.xml to generate the appropriate Javascript on the server side. This may be done using a dynamic language such as PHP or through pre-processing to a static file when licenses are updated.
  • Provide a robust, scalable serving solution (if any server-side processing is needed) in order to support CC-hosted Javascript resources for the general public

Resources