﻿//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Classe JSMLLabel estensione della classe JSMultilanguage
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function JSMLLabel(tableRef, languagePriority, targetObj, selectAllLang){
	JSMultilanguage.call(this, tableRef, languagePriority, targetObj, selectAllLang)
	
	this.createContentTag=createLabelTag	
	this.modifyDescr=modifyDescr
}

JSMLLabel.prototype = new JSMultilanguage(tableRef, languagePriority, targetObj, selectAllLang)

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function createLabelTag(langId){

	str="<label cols=\"\" rows=\"\" name=\"descr\" onchange='"  +  this.targetObj  + ".modifyDescr(value,\"" + langId + "\")'>" 
	if (this.dataSrc.getItemByKey(langId) != null) {
		str = str + this.dataSrc.getItemByKey(langId).Text
	}
	else{
		newDescr=new JSTranslation(langId, "" )
		this.dataSrc.addItem(newDescr.LNG_Id, newDescr)
		str = str + this.dataSrc.getItemByKey(langId).Text
	}
	str = str + "</label>"
	return str
}


//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	End Of Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


function modifyDescr(value, langid){
	this.dataSrc.getItemByKey(langid).setDescription(value)
}
