function renderComponent(oPlaceholder)
{
var strHtml = null;if (!oPlaceholder)
return;strHtml = oPlaceholder.innerHTML;oPlaceholder.outerHTML = strHtml;}
function getComponentStatus(bCheck)
{
var oComponentStatus = new ComponentStatus(m_aComponentInformation);if (null == bCheck)
bCheck = true;if (bCheck)
oComponentStatus.check();return oComponentStatus;}
function ComponentStatus(astrInfo)
{
this.parse(astrInfo);}
ComponentStatus.prototype = 
{
init:function(oComponents, nComponentCount)
{
this.components = oComponents;this.componentCount = nComponentCount;this.checked = false;},
empty:function()
{
this.components = null;this.componentCount = 0;this.checked = false;delete this.status;},
parse:function(astrInfo)
{
var nIndex = 0;var oComponent = null;var oComponents = null;var nComponentCount = 0;var bStatus = false;this.empty();if (!astrInfo || (0 == astrInfo.length))
return;for (nIndex in astrInfo)
{
oComponent = new ComponentInfo(astrInfo[nIndex]);if (oComponent.isEmpty())
continue;if (null == oComponents)
oComponents = new Object();oComponents[oComponent.name] = oComponent;nComponentCount++;}
this.init(oComponents, nComponentCount);},
isEmpty:function()
{
return (!this.components || (0 == this.componentCount)) ? true : false;},
check:function()
{
var strName = null;var oComponent = null;var bStatus = true;for (strName in this.components)
{
if ((null == (oComponent = this.components[strName])) || !ComponentInfo.prototype.isPrototypeOf(oComponent) || oComponent.isEmpty())
continue;if (!oComponent.checkStatus())
bStatus = false;}
this.status = bStatus;this.checked = true;return bStatus;}
}
function ComponentInfo(strInfo)
{
this.parse(strInfo);}
ComponentInfo.prototype =
{
init: function(strID, strName, strDescription, strClassID, strCodeBase, strRequiredVersion, strCurrentVersion)
{
this.id = strID;this.name = strName;this.description = strDescription;this.codeBase = strCodeBase;this.requiredVersion = new VersionInfo();this.requiredVersionSpecified = false;this.currentVersion = new VersionInfo();this.currentVersionSpecified = false;this.checked = false;if ((null != strRequiredVersion) && (0 < strRequiredVersion.length))
{
this.requiredVersion.parse(strRequiredVersion, ",");this.requiredVersionSpecified = true;}
if ((null != strCurrentVersion) && (0 < strCurrentVersion.length))
{
this.currentVersion.parse(strCurrentVersion, ",");this.currentVersionSpecified = true;}
},
empty: function()
{
this.id = null;this.name = null;this.description = null;this.requiredVersion = new VersionInfo();this.currentVersion = new VersionInfo();this.checked = false;delete this.installed;delete this.status;delete this.statusMessage;},
isEmpty: function()
{
return (!this.name || (0 == this.name.length)) ? true : false;},
parse: function(strInfo, strDelimiter)
{
var aInfo = null;this.empty();if (!strInfo || (0 == strInfo.length))
return;if ((null == strDelimiter) || (0 == strDelimiter.length))
strDelimiter = ";";aInfo = strInfo.split(strDelimiter);this.init(aInfo[6], aInfo[0], aInfo[1], aInfo[2], aInfo[3], aInfo[4], aInfo[5]);},
checkStatus: function()
{
var oCheck = document.getElementById(this.id);var bInstalled = false;var strVersion = null;var strStatus = "OK";var bStatus = false;if (!oCheck)
strStatus = "[unknown]";else if (!oCheck.object && !this.currentVersionSpecified)
strStatus = "not installed";else if (!this.checkVersion())
{
bInstalled = true;strStatus = "update";strVersion = this.currentVersion.format(".");if ((null != strVersion) && (0 < strVersion.length))
strStatus += " from version " + strVersion;strVersion = this.requiredVersion.format(".");if ((null != strVersion) && (0 < strVersion.length))
strStatus += " to version " + strVersion;strStatus += " required";}
else
{
bInstalled = true;strStatus = "OK";bStatus = true;}
this.installed = bInstalled;this.statusMessage = strStatus;this.status = bStatus;this.checked = true;return bStatus;},
checkVersion: function()
{
var oComponent = document.getElementById(this.id);var oRequiredVersion = this.requiredVersion;var oCurrentVersion = this.currentVersion;if (oCurrentVersion.isEmpty())
{
try { parseComponentVersion(oComponent, oCurrentVersion);} catch (e) { };}
if (oRequiredVersion.isEmpty() && (0 == parseCodebaseVersion(oComponent, oRequiredVersion)))
return true;if (oCurrentVersion.isEmpty())
return false;if (0 > oRequiredVersion.major)
return true;else if (oCurrentVersion.major != oRequiredVersion.major)
return false;if (0 > oRequiredVersion.minor)
return true;else if (oCurrentVersion.minor < oRequiredVersion.minor)
return false;if (0 > oRequiredVersion.build)
return true;else if (oCurrentVersion.build < oRequiredVersion.build)
return false;if (0 > oRequiredVersion.revision)
return true;else if (oCurrentVersion.revision < oRequiredVersion.revision)
return false;return true;}
}
function VersionInfo(nMajor, nMinor, nBuild, nRevision)
{
if (null == nMajor)
nMajor = -1;if (null == nMinor)
nMinor = -1;if (null == nBuild)
nBuild = -1;if (null == nRevision)
nRevision = -1;this.major = nMajor;if (-1 == this.major)
return;this.minor = nMinor;if (-1 == this.minor)
return;this.build = nBuild;if (-1 == this.build)
return;this.revision = nRevision;if (-1 == this.revision)
return;}
VersionInfo.prototype = 
{
parse:function(strVersion, strDelimiter)
{
var astrVersionParts = null;var nVersionPartCount = 0;var nMajor = -1;var nMinor = -1;var nBuild = -1;var nRevision = -1;if ((null != strVersion) && (0 < strVersion.length))
astrVersionParts = strVersion.split(strDelimiter);if (null != astrVersionParts)
nVersionPartCount = astrVersionParts.length;if (0 < nVersionPartCount)
nMajor = astrVersionParts[0] - 0;if (1 < nVersionPartCount)
nMinor = astrVersionParts[1] - 0;if (2 < nVersionPartCount)
nBuild = astrVersionParts[2] - 0;if (3 < nVersionPartCount)
nRevision = astrVersionParts[3] - 0;this.major = nMajor;this.minor = nMinor;this.build = nBuild;this.revision = nRevision;return nVersionPartCount;},
format:function(strDelimiter)
{
var nMajor = this.major;var nMinor = this.minor;var nBuild = this.build;var nRevision = this.revision;var strVersion = "";if (0 <= nMajor)
strVersion += nMajor;else
return strVersion;if (0 <= nMinor)
strVersion += strDelimiter + nMinor;else
return strVersion;if (0 <= nBuild)
strVersion += strDelimiter + nBuild;else
return strVersion;if (0 <= nRevision)
strVersion += strDelimiter + nRevision;else
return strVersion;return strVersion;},
empty:function()
{
this.major = -1;this.minor = -1;this.build = -1;this.revision = -1;},
isEmpty:function()
{
var nMajor = this.major;return ((NaN == nMajor) || (-1 == nMajor)) ? true : false;}
}
function parseCodebaseVersion(oObject, oVersion)
{
var strMatch = "#version=";var strCodebase = null;var nPos = 0;var strVersion = null;if (null == oVersion)
oVersion = new VersionInfo();try { strCodebase = oObject.codeBase;} catch(e) {};if ((null != strCodebase) && (0 < strCodebase.length) && (0 <= (nPos = strCodebase.lastIndexOf(strMatch))))
strVersion = strCodebase.slice(nPos + strMatch.length);return oVersion.parse(strVersion, ",");}
function parseComponentVersion(oObject, oVersion)
{
var strVersion = null;if (null == oVersion)
oVersion = new VersionInfo();try { strVersion = oObject.object.ComponentVersion;} catch(e) {};return oVersion.parse(strVersion, ".");}
