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. HTML format is recommended for Webkit portals.
The open source notice is placed in /usr/share/license/opensourcenotice on the rootdisk of the box and can be accessed directly by e.g. an <iframe>. However, to avoid cross site scripting restrictions, the file is preferably read with the Javascript function getOpenSourceNotice() which returns the file contents as a string.
One way to display the notice in the HTML Portal Application is presented in the example below.
function onLoad()
{
var ossNotice = document.createElement("div");
ossNotice.setAttributeNS(null, "id", "ossNotice");
ossNotice.style.position = "absolute";
ossNotice.style.top = "200";
ossNotice.style.left = "200";
ossNotice.style.width = "800";
document.getElementsByTagName("body")[0].appendChild(ossNotice);
var oss = getOpenSourceNotice();
ossNotice.innerHTML = oss;
// Add a keyhandler to let the user scroll the page.
document.addEventListener("keydown", onKeyPress, false);
}
function onUnload()
{
document.removeEventListener("keydown", onKeyPress, false);
}
function onKeyPress(ev)
{
if (ev.keyIdentifier=="Down")
window.scrollBy(0,100);
else if (ev.keyIdentifier=="Up")
window.scrollBy(0,-100);
}