<?xml version="1.0" encoding="UTF-8"?>
<rmml>
<!--
$RCSfile: rnmc_labwork_summary.xml,v $
$Revision: 957 $

last change: $Date: 2009-02-17 14:00:06 +0300 (Вт, 17 фев 2009) $
             $Author: toha $

	Lacerta Project
	version 1.0.0.1
	Copyright (C) 2007-2009 RNMC
-->
<!--

	Результаты лабораторной работы

-->
<composition name="rnmc_labwork_summary" class="rnmc_labwork_base" visible="false">
<script><![CDATA[
	this.type = "RNMC_LABWORK_SUMMARY";
//	совместимость со старым форматом
	this.useOldFormat = false;

// элемент список
	this.resultListX = 0;
	this.resultListY = 0;
	this.resultListWidth = 0;
	this.resultListHeight = 0;
	this.resultList = null;
	this.resultListVisible = false;

	this.columnsId = null;
	this.columnsStyle = null;

	this.resultId = null;
	this.resultWidth = null;
	this.resultStyle = null;

	this.markerColor = null;
	this.totalBkgColor = null;
	this.columnsBkgColor = null;

//	===============================================
	this.columnsWidth = null;

	this.oddStep  = null;
	this.evenStep  = null;
	this.totalStep  = null;
	this.defaultStep  = null;

	//	действия - если результат ниже порогового значения 
	this.resultBelowValueActions = null;
	//	действия - если результат выше порогового значения 
	this.resultAboveValueActions = null;
	//	действия - если результат находицца между двумя значенимя в формате "нижн;верхн"
	this.resultBetweenValuesActions = null;

// межстрочный интервал
	this.lineInterval  = 0;
// межстолбцовый интервал
	this.columnInterval  = 0;
  
  // настройки растояние внутри ячейки
  this.padding = {left: 0, right: 0, top: 0, bottom: 0};
  
	function loadStep(srcNode){
//trace("rnmc_labwork_summary.loadStep()");
		var xmlNode = null;
		var xmlAttributeMap = null;
		var xmlAttribute = null;

	//	настройки колонок
		this.columnsId = new Array();
		this.columnsWidth = new Array();
		this.columnsStyle = new Array();

	//	настройки колонок результирующей
		this.resultId = new Array();
		this.resultWidth = new Array();
		this.resultStyle = new Array();

	// прочий экранный хлам : ))
		this.childObjects = new Array();
		rnmc_labwork_base_loadStep(srcNode);
		this.loadChildsObject(srcNode);

		xmlNode = srcNode.firstChild;
		while(xmlNode){
			if(xmlNode.nodeName == "settings"){
				var settingNode = xmlNode.firstChild;
				while(settingNode){
					if(settingNode.nodeName == "list"){
						//	разбор старого формата, оставлено для совместимости
						/*	
							<column id="name" width="300" style="HistoryResultTable"/>
							<column id="starttime" width="80" style="HistoryResultTable"/>
							<column id="duration" width="150" style="HistoryResultTable"/>
							<column id="errorshelps" width="80" style="HistoryResultTable"/>
							<column id="result" width="150" style="HistoryResultTable"/>						
						*/
						this.useOldFormat = true;
						xmlAttributeMap = settingNode.attributes;
						if (xmlAttributeMap){
							xmlAttribute =  xmlAttributeMap.getNamedItem("visible");
							if (xmlAttribute != null && xmlAttribute.specified){
								if((xmlAttribute.value).toLowerCase() == "false"){
									this.resultListVisible = false;
								} else {
									this.resultListVisible = true;
								}
							}
							xmlAttribute =  xmlAttributeMap.getNamedItem("x");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.resultListX = parseInt(xmlAttribute.value);
							xmlAttribute =  xmlAttributeMap.getNamedItem("y");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.resultListY = parseInt(xmlAttribute.value);
							xmlAttribute =  xmlAttributeMap.getNamedItem("width");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.resultListWidth = parseInt(xmlAttribute.value);
							xmlAttribute =  xmlAttributeMap.getNamedItem("height");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.resultListHeight = parseInt(xmlAttribute.value);
							xmlAttribute =  xmlAttributeMap.getNamedItem("markerColor");
							if (xmlAttribute != null && xmlAttribute.specified)
								markerColor = xmlAttribute.value;
							xmlAttribute =  xmlAttributeMap.getNamedItem("bkgColor");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.columnsBkgColor = (xmlAttribute.value).split(";");
						}
						var listNode = settingNode.firstChild;
						while(listNode){
							if(listNode.nodeName == "column"){
								var columnId = null;
								var columnWidth = 0;
								var columnStyle = null;
								xmlAttributeMap = listNode.attributes;
								if (xmlAttributeMap){
									xmlAttribute =  xmlAttributeMap.getNamedItem("id");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnId = xmlAttribute.value;
									xmlAttribute =  xmlAttributeMap.getNamedItem("width");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnWidth = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("style");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnStyle = xmlAttribute.value;
								}
								if(columnId && columnWidth > 0){
									this.columnsId.push(columnId);
									this.columnsWidth.push(columnWidth);
									if(columnStyle && scene.StyleManager.styleExists(columnStyle)){
										this.columnsStyle.push(columnStyle);
									} else {
										this.columnsStyle.push(null);
									}
								}
							}
							listNode = listNode.nextSibling;
						}
					} else if(settingNode.nodeName == "total"){
						xmlAttributeMap = settingNode.attributes;
						if (xmlAttributeMap){
							xmlAttribute =  xmlAttributeMap.getNamedItem("bkgColor");
							if (xmlAttribute != null && xmlAttribute.specified)
								this.totalBkgColor = xmlAttribute.value;
						}
						var listNode = settingNode.firstChild;
						while(listNode){
							if(listNode.nodeName == "column"){
								var columnId = null;
								var columnWidth = 0;
								var columnStyle = null;
								xmlAttributeMap = listNode.attributes;
								if (xmlAttributeMap){
									xmlAttribute =  xmlAttributeMap.getNamedItem("id");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnId = xmlAttribute.value;
									xmlAttribute =  xmlAttributeMap.getNamedItem("width");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnWidth = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("style");
									if (xmlAttribute != null && xmlAttribute.specified)
										columnStyle = xmlAttribute.value;
								}
								if(columnId){
									this.resultId.push(columnId);
									this.resultWidth.push(columnWidth);
									if(columnStyle && scene.StyleManager.styleExists(columnStyle)){
										this.resultStyle.push(columnStyle);
									} else {
										this.resultStyle.push(null);
									}
								}
							}
							listNode = listNode.nextSibling;
						}
					} else if(settingNode.nodeName == "table"){
						this.useOldFormat = false;
						var tableNode = settingNode.firstChild;
						while(tableNode){
							if(tableNode.nodeName == "param"){
								xmlAttributeMap = tableNode.attributes;
								if (xmlAttributeMap){
									xmlAttribute =  xmlAttributeMap.getNamedItem("visible");
									if (xmlAttribute != null && xmlAttribute.specified){
										if((xmlAttribute.value).toLowerCase() == "false"){
											this.resultListVisible = false;
										} else {
											this.resultListVisible = true;
										}
									}
									xmlAttribute =  xmlAttributeMap.getNamedItem("x");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.resultListX = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("y");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.resultListY = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("width");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.resultListWidth = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("height");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.resultListHeight = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("totalBgColor");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.totalBkgColor = xmlAttribute.value;
									xmlAttribute =  xmlAttributeMap.getNamedItem("lineInterval");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.lineInterval = parseInt(xmlAttribute.value);
									xmlAttribute =  xmlAttributeMap.getNamedItem("columnInterval");
									if (xmlAttribute != null && xmlAttribute.specified)
										this.columnInterval = parseInt(xmlAttribute.value);
								}
                
                var paramNode = tableNode.firstChild;
                while (paramNode){
                  if(paramNode.nodeName == "padding"){
                    xmlAttributeMap = paramNode.attributes;
                    if (xmlAttributeMap){
                      xmlAttribute =  xmlAttributeMap.getNamedItem("left");
                      if (xmlAttribute != null && xmlAttribute.specified)
                        this.padding.left = parseInt(xmlAttribute.value);
                      xmlAttribute =  xmlAttributeMap.getNamedItem("right");
                      if (xmlAttribute != null && xmlAttribute.specified)
                        this.padding.right = parseInt(xmlAttribute.value);
                      xmlAttribute =  xmlAttributeMap.getNamedItem("top");
                      if (xmlAttribute != null && xmlAttribute.specified)
                        this.padding.top = parseInt(xmlAttribute.value);
                      xmlAttribute =  xmlAttributeMap.getNamedItem("bottom");
                      if (xmlAttribute != null && xmlAttribute.specified)
                        this.padding.bottom = parseInt(xmlAttribute.value);
                    }
                  }
                  
                  paramNode = paramNode.nextSibling;
                }
							} else if(tableNode.nodeName == "step"){
								var itemNode = tableNode.firstChild;
								var newStep = new Array();
								var newColWidth = new Array();
								xmlAttributeMap = tableNode.attributes;
								if (xmlAttributeMap){
									xmlAttribute =  xmlAttributeMap.getNamedItem("id");
									if (xmlAttribute != null && xmlAttribute.specified){
										if((xmlAttribute.value).toLowerCase() == "even"){
											newStep.id = "even";
										} else if((xmlAttribute.value).toLowerCase() == "odd"){
											newStep.id = "odd";
										} else if((xmlAttribute.value).toLowerCase() == "total"){
											newStep.id = "total";
										}
									} else {
										newStep.id = "default";
									}
									xmlAttribute =  xmlAttributeMap.getNamedItem("bgColor");
									if (xmlAttribute != null && xmlAttribute.specified){
                    newStep.bgColorLine = xmlAttribute.value.toLowerCase();
									}
								}
								while(itemNode){
									if(itemNode.nodeName == "item" && itemNode.textContent){
										var newItem = new Array();
										xmlAttributeMap = itemNode.attributes;
										if (xmlAttributeMap){
											xmlAttribute =  xmlAttributeMap.getNamedItem("width");
											if (xmlAttribute != null && xmlAttribute.specified){
												newItem.width = parseInt(xmlAttribute.value);
												newColWidth.push(newItem.width);
											}
											xmlAttribute =  xmlAttributeMap.getNamedItem("style");
											if (xmlAttribute != null && xmlAttribute.specified)
												newItem.style = xmlAttribute.value;
											xmlAttribute =  xmlAttributeMap.getNamedItem("bgColor");
											if (xmlAttribute != null && xmlAttribute.specified)
												newItem.bgColor = xmlAttribute.value;
											newItem.content = itemNode.textContent;
										}
										newStep.push(newItem);
									}
									itemNode = itemNode.nextSibling;
								}
								//	записываем актуальные значения ширины каждого столбца
								//	(надо для списка, но его надо переделать)
								for(var i = 0; i < newColWidth.length; i++){
									if(this.columnsWidth[i]){
										if(newColWidth[i] > this.columnsWidth[i]){
											this.columnsWidth[i] = newColWidth[i];
										}
									} else {
										this.columnsWidth[i] = newColWidth[i];
									}
								}
								switch(newStep.id){
								case "even":
									this.evenStep  = newStep;
									break;
								case "odd":
									this.oddStep  = newStep;
									break;
								case "default":
									this.defaultStep  = newStep;
									break;
								case "total":
									this.totalStep  = newStep;
									break;
								}
							} 
							tableNode = tableNode.nextSibling;
						}
					} 
					settingNode = settingNode.nextSibling;
				}
			} else if(xmlNode.nodeName == "actions"){
				//	разбираем стандартные действия для шага
				this.parseActionsNode(xmlNode);
				//	действия - если результат ниже порогового значения 
				this.resultBelowValueActions =
					scene.Utils.parseActionsNode(xmlNode, "onLabworkResultBelowValue");
				//	действия - если результат выше порогового значения 
				this.resultAboveValueActions =
					scene.Utils.parseActionsNode(xmlNode, "onLabworkResultAboveValue");
				//	действия - если результат находицца между двумя значенимя в формате "нижн;верхн"
				this.resultBetweenValuesActions =
					scene.Utils.parseActionsNode(xmlNode, "onLabworkResultBetweenValues");
			} else if(xmlNode.nodeName == "conditions"){
				var conditionNode = xmlNode.firstChild;
				while(conditionNode){
					if(conditionNode.nodeName == "condition"){
						this.parseConditionNode(conditionNode);
					}
					conditionNode = conditionNode.nextSibling;
				}
				this.parseConditionNode(xmlNode);
			}
			xmlNode = xmlNode.nextSibling;
		}
		return true;
	}

	function startStep(){
//	распечатка резульатов (DEBUG)
//  parent.resultManager.traceStepStatistics();
		var totalResult = parent.resultManager.getTotalResult();
		rnmc_labwork_base_startStep();
		if(this.resultListVisible){
			if(this.useOldFormat){
				this.resultList = new Composition();
				this.resultList._class = "common_list";
				this.resultList.parent  = this;
				this.resultList.x = this.resultListX;
				this.resultList.y = this.resultListY;
				this.resultList.depth = -10;
				var listWidth = 0;

				if (this.markerColor){
					this.resultList.markCurrent = true;
					this.resultList.currentItemBgColor = this.markerColor;
				}

				for(var i = 0; i < this.columnsWidth.length; i++){
					listWidth += this.columnsWidth[i];
				}
				this.resultList.initList(listWidth, this.resultListHeight, this.columnsId.length, this.columnsWidth);
				//this.resultList.setReleaseCallback(this, this.onSelectItem);

				var totalSteps = parent.resultManager.getStepsTotal();

				// создание новых строк
				for(var i = 0; i  < totalSteps; i++)
					this.resultList.addListItem();

				//	Создание списка в соответствии со старым форматом
				for(var i = 0; i  < totalSteps; i++){
					if(parent.resultManager.getStepType(i) != "summary"){
						for(var j = 0; j < this.columnsId.length; j++){
							switch(this.columnsId[j]){
							case "name":
								var newTxtObject = new Text();
								newTxtObject.value = (i + 1) + ".  " + parent.resultManager.getStepName(i);
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							case "starttime":
								var newTxtObject = new Text();
								newTxtObject.value =
									scene.Utils.translateSecondsToString(
										parent.resultManager.getStepStartTime(i), true);
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							case "duration":
								var newTxtObject = new Text();
								newTxtObject.value =
									scene.Utils.translateSecondsToString(
										parent.resultManager.getStepDuration(i), false);
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							case "errorshelps":
								var newTxtObject = new Text();
								newTxtObject.value =
									parent.resultManager.getStepErrors(i) + " / "
										+ parent.resultManager.getStepHelps(i);
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							case "visited":
								var newTxtObject = new Text();
								if(parent.resultManager.getStepVisited(i)){
									newTxtObject.value = "Выполнялся";
								} else {
									newTxtObject.value = "Не выполнялся";
								}
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							case "result":
								var newTxtObject = new Text();
								var curStepResult = parent.resultManager.getStepResult(i);
								if(curStepResult >= 0){
									newTxtObject.value = curStepResult + " %";
								} else {
									newTxtObject.value = "";
								}
								newTxtObject.adjustHeight = true;
								if(this.columnsStyle[j])
									newTxtObject.style = this.columnsStyle[j];
								newTxtObject.width = this.resultList.getColumnWidth(j);
								this.resultList.setRowObject(i, j, newTxtObject);
								break;
							default:
								trace("ОШИБКА: summary - неизвестное id колонки: " + this.columnsId[j]);
								break;
							}
						}

						if (this.columnsBkgColor)
							this.resultList.setItemBgColor(i, this.columnsBkgColor[i % this.columnsBkgColor.length]);
					}
				}

				//	суммарные параметры
				for(var j = 0; j < this.resultId.length; j++){
					switch(this.resultId[j]){
					case "name":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						newTxtObject.value = "Общий результат";
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					case "starttime":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						newTxtObject.value = "";
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					case "duration":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						newTxtObject.value =
							scene.Utils.translateSecondsToString(
								parent.resultManager.getTotalDuration(), false);
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					case "errorshelps":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						newTxtObject.value = parent.resultManager.getTotalErrors() + " / "
							+ parent.resultManager.getTotalHelps();
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					case "visited":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						newTxtObject.value = "";
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					case "result":
						var newTxtObject = new Text();
						if(this.resultStyle[j])
							newTxtObject.style = this.resultStyle[j];
						if (parent.resultManager.getTotalResult() > 0)
							newTxtObject.value = parent.resultManager.getTotalResult() + " %";
						newTxtObject.adjustHeight = true;
						newTxtObject.width = this.resultList.getColumnWidth(j);
						this.resultList.setRowObject(totalSteps - 1, j, newTxtObject);
						break;
					default:
						trace("ОШИБКА: summary - неизвестное id колонки: " + this.columnsId[j]);
						break;
					}
				}
				if (this.totalBkgColor)
					this.resultList.setItemBgColor(totalSteps - 1, this.totalBkgColor);

				this.resultList.listArea.hitArea =
					"[0,0," + this.resultList.listWidth + "," + this.resultList.listHeight + "]";
				this.resultList.topIndex = 0;
				this.resultList.calculateTotalItemsHeight();
				this.resultList.calculateMaxIndex();
				this.resultList.showObject();
			}
			//	END совместимость со старым форматом

		//	НОВЫЙ ФОРМАТ	====================================================================
			if(!this.useOldFormat){
				this.resultList                = new Composition();
				this.resultList._class         = "common_list";
				this.resultList.parent         = this;
				this.resultList.x              = this.resultListX;
				this.resultList.y              = this.resultListY;
				this.resultList.depth          = -10;
        this.resultList.lineInterval   = this.lineInterval;
        this.resultList.columnInterval = this.columnInterval;
        this.resultList.padding        = this.padding;

				var listWidth = 0;
				for(var i = 0; i < this.columnsWidth.length; i++){
					listWidth += this.columnsWidth[i];
				}
				this.resultList.initList(listWidth, this.resultListHeight,
					this.columnsWidth.length, this.columnsWidth);

				var totalSteps = parent.resultManager.getStepsTotal();

				// создание новых строк
				for(var i = 0; i  < totalSteps; i++)
					this.resultList.addListItem();

				for(var i = 0; i  < totalSteps; i++){
					if(parent.resultManager.getStepType(i) == "summary"){
						continue;
					}
					var currentStepSettings = null;
					if(this.evenStep && this.oddStep){
						if(((i + 1) % 2) == 0){
							currentStepSettings =  this.evenStep;
						} else {
							currentStepSettings = this.oddStep;
						}
					} else {
						currentStepSettings = this.defaultStep;
					}

					for(var j = 0; currentStepSettings && j < currentStepSettings.length; j++){
						var srcItemStr = currentStepSettings[j].content;
            var tmp = null;

						var re = new RegExp("(%StepIndex%)", "g");
						srcItemStr = srcItemStr.replace(re, (i+1));
						re = null;
						re = new RegExp("(%StepName%)", "g");
						srcItemStr = srcItemStr.replace(re, parent.resultManager.getStepName(i));
						re = null;
						var re = new RegExp("(%StartTime%)", "g");
						srcItemStr = srcItemStr.replace(re,
							scene.Utils.translateSecondsToString(parent.resultManager.getStepStartTime(i), true));
						re = null;
						var re = new RegExp("(%Duration%)", "g");
						srcItemStr = srcItemStr.replace(re,
							scene.Utils.translateSecondsToString(parent.resultManager.getStepDuration(i), false));
						re = null;
						var re = new RegExp("(%Errors%)", "g");
            tmp = parent.resultManager.getStepErrors(i);
						srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
						re = null;
						var re = new RegExp("(%Helps%)", "g");
            tmp = parent.resultManager.getStepHelps(i);
						srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
						re = null;
						var re = new RegExp("(%Attempts%)", "g");
            tmp = parent.resultManager.getStepAttempts(i);
						srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
						re = null;
						var re = new RegExp("(%Result%)", "g");
						tmp = parent.resultManager.getStepResult(i);
            srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : (tmp + " %"));
						re = null;
						var re = new RegExp("(%State%)", "g");
						tmp = parent.resultManager.getStepVisitedEx(i);
            srcItemStr = srcItemStr.replace(re, tmp);
						re = null;
						var re = new RegExp("(%Coefficient%)", "g");
						tmp = parent.resultManager.getStepCoefficient(i);
            srcItemStr = srcItemStr.replace(re, tmp);
						re = null;
						var re = new RegExp("(%SelectRule%)", "g");
						tmp = parent.resultManager.getSelectRule(i);
            srcItemStr = srcItemStr.replace(re, tmp);
						re = null;

						var newTxtObject = new Text();
						newTxtObject.width = this.resultList.getColumnWidth(j);
						newTxtObject.value = srcItemStr;
						newTxtObject.adjustHeight = true;
						if(currentStepSettings[j].style
							&& scene.StyleManager.styleExists(currentStepSettings[j].style))
							newTxtObject.style = currentStepSettings[j].style;
						if(currentStepSettings[j].bgColor)
							newTxtObject.bkgColor = currentStepSettings[j].bgColor;
						this.resultList.setRowObject(i, j, newTxtObject);		
            
            if (currentStepSettings.bgColorLine && 
                currentStepSettings.bgColorLine != "")
              this.resultList.setItemBgColor(i, currentStepSettings.bgColorLine);
					}
				}
			//	суммарная строчка
				var currentStepSettings = null;
				if(this.totalStep){
					currentStepSettings = this.totalStep;
				} else {
					currentStepSettings = this.defaultStep;
				}
				for(var j = 0; currentStepSettings && j < currentStepSettings.length; j++){
					var srcItemStr = currentStepSettings[j].content;
          var tmp = null;

					var re = new RegExp("(%StepIndex%)", "g");
					srcItemStr = srcItemStr.replace(re, "");
					re = null;
					re = new RegExp("(%StepName%)", "g");
					srcItemStr = srcItemStr.replace(re, "Общий результат");
					re = null;
					var re = new RegExp("(%StartTime%)", "g");
					srcItemStr = srcItemStr.replace(re, scene.Utils.translateSecondsToString(parent.resultManager.getStepStartTime(0), true));
					re = null;
					var re = new RegExp("(%Duration%)", "g");
					srcItemStr = srcItemStr.replace(re, scene.Utils.translateSecondsToString(parent.resultManager.getTotalDuration(), false));
					re = null;
					var re = new RegExp("(%Errors%)", "g");
          tmp = parent.resultManager.getTotalErrors();
					srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
					re = null;
					var re = new RegExp("(%Helps%)", "g");
          tmp = parent.resultManager.getTotalHelps();
					srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
					re = null;
					var re = new RegExp("(%Attempts%)", "g");
          tmp = parent.resultManager.getTotalAttempts();
					srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : tmp);
					re = null;
					var re = new RegExp("(%Result%)", "g");
					tmp = totalResult;
          srcItemStr = srcItemStr.replace(re, tmp < 0 ? "" : (tmp + " %"));
					re = null;
          var re = new RegExp("(%State%)", "g");
          srcItemStr = srcItemStr.replace(re, "");
          re = null;
          var re = new RegExp("(%Coefficient%)", "g");
          srcItemStr = srcItemStr.replace(re, "");
          re = null;
          var re = new RegExp("(%SelectRule%)", "g");
          srcItemStr = srcItemStr.replace(re, "");
          re = null;

					var newTxtObject = new Text();
					newTxtObject.width = this.resultList.getColumnWidth(j);
					newTxtObject.value = srcItemStr;
					newTxtObject.adjustHeight = true;
					if(currentStepSettings[j].style && scene.StyleManager.styleExists(currentStepSettings[j].style))
						newTxtObject.style = currentStepSettings[j].style;
					if(currentStepSettings[j].bgColor)
						newTxtObject.bkgColor = currentStepSettings[j].bgColor;
					this.resultList.setRowObject(totalSteps-1, j, newTxtObject);		
            
          if (currentStepSettings.bgColorLine && 
              currentStepSettings.bgColorLine != "")
            this.resultList.setItemBgColor(totalSteps-1, currentStepSettings.bgColorLine);
				}
				if (this.totalBkgColor)
					this.resultList.setItemBgColor(totalSteps - 1, this.totalBkgColor);

				this.resultList.listArea.hitArea =
					"[0,0," + this.resultList.listWidth + "," + this.resultList.listHeight + "]";
				this.resultList.topIndex = 0;
				this.resultList.calculateTotalItemsHeight();
				this.resultList.calculateMaxIndex();
//trace(this.resultList.listArea.hitArea);
				this.resultList.showObject();
			}
		}
		if(this.resultBelowValueActions){
			for(var i = 0; i < this.resultBelowValueActions.length; i++){
				if(totalResult < parseInt(this.resultBelowValueActions[i].eventParam)){
					this.dispatchAction(this.resultBelowValueActions[i]);
				}
			}
		}
		if(this.resultAboveValueActions){
			for(var i = 0; i < this.resultAboveValueActions.length; i++){
				if(totalResult > parseInt(this.resultAboveValueActions[i].eventParam)){
					this.dispatchAction(this.resultAboveValueActions[i]);
				}
			}
		}
		if(this.resultBetweenValuesActions){
			for(var i = 0; i < this.resultBetweenValuesActions.length; i++){
				var actionParams = (this.resultBetweenValuesActions[i].eventParam).split(";");
				if(actionParams.length == 2){
					var minBound = parseInt(actionParams[0]);
					var maxBound = parseInt(actionParams[1]);
					if(minBound <= totalResult && totalResult <= maxBound){
						this.dispatchAction(this.resultBetweenValuesActions[i]);
					}
				}
			}
		}
	}

	function exitStep(){
		rnmc_labwork_base_exitStep();
	}
]]> </script>
</composition>
</rmml>