Esempio n. 1
0
 public override void finishTreeBeforeLocalize(lm_scorm root) {
   base.finishTree(root);
   LMLiteral lit = (LMLiteral)Item;
   if (lit == null || string.IsNullOrEmpty(lit.text)) return;
   //matice tvorici krizovku
   string txt = lit.text.Replace('\r', ' ').Trim();
   string[] lines = txt.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
   table = new table();
   table.Items = new object[lines.Length];
   for (int i = 0; i < lines.Length; i++) table.Items[i] = new row();
   int max = 0; int count = 0;
   for (int i = 0; i < lines.Length; i++) {
     string str = lines[i].Trim();
     if (string.IsNullOrEmpty(str)) throw new Exception(string.Format("Empty row not allowed {0}", ErrorId));
     string[] cells = str.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
     if (max == 0) max = cells.Length;
     else if (max != cells.Length) throw new Exception(string.Format("All rows have to have the same number of cells {0}", ErrorId));
     row rw = (row)table.Items[i];
     rw.Items = new object[max];
     for (int j = 0; j < max; j++)
       rw.Items[j] = createCheckItem(cells[j], count++);
   }
   table.border = true;
   table.grid = tableGrid.thin;
   table.flow = flow_type.left;
   table.finishTreeBeforeLocalize(root);
   //table.padding = colPadding.right;
 }
Esempio n. 2
0
 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);
 }