Artikel: AN0001902Aktualisiert:
Die vorgegebene Sprachenversion vom Artikeltext wird angezeigt, weil es kein Text von der ausgewählten Sprache und Version gibt.
Two html texts can be campared and differences highlighted.
Following example compares values from two columns of the current record.
Where to use this script: Button of type Script
var cl = OGModel.ClassDefs.GetById( OGActualDataRowParentId);
var c1 = cl.Columns['text'];
var c2 = cl.Columns['new_text'];
var h1 = OGForm.GetControl( c1.Id).GetData();
var h2 = OGForm.GetControl( c2.Id).GetData();
var s = OG.TextUtils.CompareTwoHtml(h1, h2);
OGForm.JavaScript.ShowHtmlDialog( 'Comparison of article versions', s);
Below example compares value from the current record from column new_text with value in column text, that belongs to the record reffered in column article.
Where to use this script: Button of type Script
//new_text - v aktuálním záznamu
var dr = OG.DataRow.GetDataById(OGActualDataRowParentId, OGActualDataRowId);
//text - v záznamu odkazovaném ve sloupci article
var drArt = dr.GetDR('article');
var h1 = drArt['text'];
var h2 = dr['new_text'];
var s = OG.TextUtils.CompareTwoHtml(h1, h2);
OGForm.JavaScript.ShowHtmlDialog( 'Comparison of article versions', s);
Example of displaying compared text.