public override void finishTree(lm_scorm root) { base.finishTree(root); //maximalni delka classifications se stejnou group int max = 0; foreach (classification cl in LMScormObj.GetAll(root, delegate(object obj) { return (obj is classification) && ((classification)obj).group == group; })) max = Math.Max(cl.Items.Length, max); //prenes GapFills LMScormObj[] newGf = new LMScormObj[max + 1]; for (int i = 0; i < Items.Length; i++) newGf[i + 1] = Items[i]; for (int i = Items.Length; i < max; i++) { gap_fill gf = new gap_fill(); gf.isFake = true; gf.id = id + i.ToString(); newGf[i + 1] = gf; } //prvni radek tabulky: if (htmlTitleObj != null) newGf[0] = htmlTitleObj; else { html ht = new html(); newGf[0] = ht; ht.localItems = localtitle; } table = new table(); table.Items = newGf; table.border = true; table.col_header = true; table.grid = tableGrid.thin; table.finishTreeBeforeLocalize(root); }
public OrderItem(int correct, LMScormObj owner, string orderText) { this.correct = correct; this.orderText = orderText; this.Owner = owner; }
public void Fill(LocalizeType typ, LMScormObj obj, FieldInfo field, object value) { Value = value; Typ = typ; Obj = obj; Field = field; }
/// <summary> /// lokalizace objektu (LMData souboru) /// </summary> public static void Localize(lm_scorm root) { if (HttpContext.Current == null) return; adjustThreadCulture(); StringBuilder buf = new StringBuilder(); ResxFilesManager resx = new ResxFilesManager(root.PageInfo.FileName); if (resx == null) return; object[] objs; foreach (TranslateInfo info in toTranslate(root, new TranslateInfo())) switch (info.Typ) { case LocalizeType.string2string: //Lokalizovatelna String property, vysledkem lokalizace je lokalizovatelny LMLiteral string valStr = (string)info.Value; if (string.IsNullOrEmpty(valStr)) break; if (!valStr.StartsWith(localizeStringPrefix)) info.setValue(createLiteral(valStr)); else info.setValue(resx.propertyTolocalizedLiteral(info, valStr.Substring(localizeStringPrefix.Length))); break; case LocalizeType.items2string: //HTML: vysledkem lokalizace je jeden lokalizovatelny LMLiteral objs = (object[])info.Value; if (objs.Length == 0) break; if (objs.Length == 1 && objs[0] is LMLiteral) info.setValue(objs[0]); else { bool first = true; foreach (object res in localizeObjectList(objs, buf, resx)) { if (!first || !(res is LMLiteral)) throw new Exception(); first = true; info.setValue(res); } } break; case LocalizeType.items2items: //HTML a LMScormObj: vysledkem lokalizace je seznam lokalizovatelnych LMLiteral a LMScormObj objs = (object[])info.Value; if (objs.Length == 0) break; bool noLocalize = true; foreach (LMScormObj item in objs) if (item is trans || item is img) { noLocalize = false; break; } if (noLocalize) info.setValue(objs); else { List<LMScormObj> items = new List<LMScormObj>(); foreach (LMScormObj res in localizeObjectList(objs, buf, resx)) items.Add(res); LMScormObj[] resObjs = new LMScormObj[items.Count]; items.CopyTo(resObjs); info.setValue(resObjs); } break; } }
public static string getText(LMScormObj obj) { return getText(obj, string.Empty); }
public static string getText(LMScormObj obj, string defaultValue) { string res = obj == null ? null : ((LMLiteral)obj).getText(); return string.IsNullOrEmpty(res) ? defaultValue : res; }