﻿//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Classe JSMLText estensione della classe JSMultilanguage
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function JSMLText(tableRef, languagePriority, targetObj, selectAllLang){
	JSMultilanguage.call(this, tableRef, languagePriority, targetObj, selectAllLang)
	
	this.createContentTag=createTextTag
	this.modifyDescr=modifyDescr
}

JSMLText.prototype = new JSMultilanguage(tableRef, languagePriority, targetObj, selectAllLang)

	
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function createTextTag(langId){
	str="<input type=text cols=\"\" rows=\"\" name=\"descr\" size=\"80\" onchange='"  +  this.targetObj  + ".modifyDescr(value,\"" + langId + "\")' value=\"" 
	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 + "\">"
	return str

}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//	End Of Implementations
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


function modifyDescr(value, langid){
	this.dataSrc.getItemByKey(langid).setDescription(value)
}
