/**
* Represents a collection of evaluations that belong to a single event.
* @param evaluations {Array of Evaluation} The list of Evaluation to be grouped together.
*/
function Evaluations(evaluations)
{
//========== private static members ==========//
Evaluations.id = (typeof Evaluations.id == 'undefined') ? 0 : ++Evaluations.id;
//========== public constants ==========//
this.evaluations = evaluations;
this.id = Evaluations.id;
this.expandOptionID = "evalutionsExpandOption" + this.id;
this.evaluationsID = "evaluations" + this.id;
//========== public read-only members ==========//
this.expanded = true;
//========== public methods ==========//
this.html = html;
this.expandAction = expandAction;
//========== private methods ==========//
this.expandOption = expandOption;
this.expandOptionSymbol = expandOptionSymbol;
this.refresh = refresh;
this.evaluationsHTML = evaluationsHTML;
//========== function definitions ==========//
/**
* @return The html for the "+" or "-" button that expands or collapses these
* evaluations when clicked.
*/
function expandOption()
{
return "";
}
/**
* @return The "-" or "-" symbol for the expand/collapse button.
*/
function expandOptionSymbol()
{
return this.expanded == true ? "–" : "+";
}
/**
* Updates the expand/collapse symbol and whether the evaluations are visible.
*/
function refresh()
{
// IF the expandOption element exists THEN
if (events.doc.getElementById(this.expandOptionID))
{
events.doc.getElementById(this.expandOptionID).innerHTML =
this.expandOptionSymbol();
}
// IF the evaluations element exists THEN
if (events.doc.getElementById(this.evaluationsID))
{
events.doc.getElementById(this.evaluationsID).innerHTML =
this.expanded ? this.evaluationsHTML() : "";
}
}
/**
* @return The html for the evaluations.
*/
function evaluationsHTML()
{
var html = "
";
// FOR each evaluation
for (var i = 0; i < this.evaluations.length; i++)
{
// add evaluation html
html += "
" +
"
" + this.evaluations[i].html() + "
" +
"
";
}
html += "
";
return html;
}
/**
* Expands the evaluations if they are collapsed.
* Collapses the evaluations if they are expanded.
*/
function expandAction()
{
this.expanded = !this.expanded; this.refresh();
}
/**
* @return The html representation of these evaluations.
*/
function html()
{
var text = "";
// IF there are any evaluations THEN
if (this.evaluations.length > 0)
{
text = "
";
/* In 2019 we no longer care to expand "Properties" or "Evaluations" */
/*
text += "