Open Source Notice

All portals developed by Motorola partners and customers must be able to display the licenses for the open source components included in the STB software. The open source notice depends on which open source components are used, and is therefore generated at build time. It is possible to generate the notice in different formats, using the kreatv-finalize-opensourcenotice:type=<mime-type>. The available formats are text/html (default), text/plain and image/svg+xml.

The open source notice is placed in /usr/share/license/opensourcenotice on the rootdisk of the box and can be accessed directly or read with the Javascript function getOpenSourceNotice() which returns the file contents as a string.

One way to display the notice in the SVG Portal Application is presented in the example below.


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
          "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.2"
     width="100%" height="100%"
     top="0" left="0"
     viewBox="0 0 1280 720"
     viewport-fill="#ffffff"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">

<use id="oss_notice"
     xlink:href="file:///usr/share/license/opensourcenotice#oss_g"></use>
</svg>

Note! The example above will only work if the open source notice is created in format image/svg+xml.

Note! The SVG Portal Application is good at displaying graphics, but text rendering can be slow for large text areas. We recommend the use of javascript to limit the amount of text rendered, as shown in the following example.

The javascript example below uses the getOpenSourceNotice() function to get the open source notice as a string, and then renders a predefined number of rows at a time.


var startLine;
var textArray;
var textArea;
var LINES_TO_SHOW=30;

function onLoad()
{
  textArea = document.createElement("textArea");
  textArea.setAttributeNS(null, "x", "200");
  textArea.setAttributeNS(null, "y", "100");
  textArea.setAttributeNS(null, "width", "auto");
  textArea.setAttributeNS(null, "height", "auto");
  textArea.setAttributeNS(null, "font-size", "12");
  document.documentElement.appendChild(textArea);

  // Read the open source notice into an array
  textArray = getOpenSourceNotice().split("\n");

  startLine=0;
  scrollText(0);
  document.addEventListener("keydown", onKey, false);
}

function scrollText(scrollDiff)
{
  // Check so we don't scroll too far
  startLine = Math.min(Math.max(startLine+scrollDiff,0),
                       Math.max(textArray.length-LINES_TO_SHOW,0));
  var endLine = Math.min(textArray.length, startLine+LINES_TO_SHOW);

  // Remove the old content
  while (textArea.hasChildNodes()) {
    textArea.removeChild(textArea.firstChild);
  }

  // Set new content
  for (var i=startLine; i<endLine; ++i) {
    textArea.appendChild(document.createTextNode(textArray[i]));
    textArea.appendChild(document.createElement("tbreak"));
  }
}

function onKey(ev)
{
  if (ev.keyIdentifier=="Down")
    scrollText(LINES_TO_SHOW);
  else if (ev.keyIdentifier=="Up")
    scrollText(-LINES_TO_SHOW);
}

Note! This example is intended for an open source notice in format text/plain.