Exemplo n.º 1
0
 void noHtmlFinishTree(lm_scorm root) {
   if (Items == null || Items.Length == 0) return;
   //kontrola: kdyz jedna rowStart, tak vsechny rowStart:
   int rowCount = 0;
   foreach (LMScormObj obj in Items)
     if (obj is row) rowCount++;
   if (rowCount > 0 && rowCount != Items.Length)
     throw new Exception(string.Format("All rows or none rows expected in table {0}", ErrorId));
   //kontrola: kdyz rowStart, tak stejny pocet prvku
   if (rowCount > 0) {
     int cnt = -1;
     foreach (row rw in Items)
       if (cnt == -1) cnt = rw.Items == null ? 0 : rw.Items.Length;
       else if (cnt != (rw.Items == null ? 0 : rw.Items.Length))
         throw new Exception(string.Format("Number of row child element must be equal in table {0}", ErrorId));
   }
   bool addCol = start_with != tableStart_with.no; //pridani extra sloupce
   //pridani prvniho colStart:
   if (addCol && col != null) {
     col[] oldCol = col;
     col = new col[oldCol.Length + 1];
     Array.Copy(oldCol, 0, col, 1, oldCol.Length);
     col[0] = new col();
   }
   //pridani rows a dummy cell
   if (rowCount == 0) {
     object[] oldItems = Items;
     Items = new object[oldItems.Length];
     for (int i = 0; i < oldItems.Length; i++) {
       tr rw = new tr(); Items[i] = rw;
       td cl = new td();
       cl.Items = new object[] { oldItems[i] };
       if (addCol) {
         td addCl = new td();
         addCl.setCellContent(i, start_with, rw, this);
         rw.items = new object[] { addCl, cl };
       } else
         rw.items = new object[] { cl };
     }
   } else
     //pridani cells
     for (int rwi = 0; rwi < Items.Length; rwi++) {
       //zamena ROW by TR
       row oldRw = (row)Items[rwi]; tr rw = rowToTr(oldRw); Items[rwi] = rw;
       object[] oldItems = oldRw.Items;
       rw.items = new object[addCol ? oldItems.Length + 1 : oldItems.Length];
       for (int i = 0; i < rw.Items.Length; i++) {
         td cl = new td();
         rw.Items[i] = cl;
         if (addCol && i == 0)
           cl.setCellContent(rwi, start_with, rw, this);
         else {
           cl.Items = new object[] { oldItems[addCol ? i - 1 : i] };
         }
       }
     }
   //dosazeni myCol do celu:
   if (col != null)
     foreach (tr rw in Items) {
       for (int i = 0; i < col.Length; i++) {
         if (rw.Items.Length <= i) continue;
         ((td)rw.Items[i]).myCol = col[i];
       }
     }
 }
Exemplo n.º 2
0
 tr rowToTr(row row) {
   tr res = new tr();
   res.id = row.id;
   res.child_attrs = row.child_attrs;
   res.valign = row.valign;
   res.align = row.align;
   res.example = row.example;
   res.small = row.small;
   res.hlite = row.hlite;
   res.padding = row.padding;
   return res;
 }
Exemplo n.º 3
0
 public int cellContent = 0; //0..normalni cell, -1..eval control, -2..levy horni roh prazdneho pridaneho sloupce, else..poradi
 public void setCellContent(int idx, tableStart_with startWith, tr rw, table tb) {
   if (startWith == tableStart_with.evalControl) {
     LMScormLibDOM.eval_mark mark = new LMScormLibDOM.eval_mark();
     mark.group = rw.varName;
     if (tb.is_eval_group != eval_Type.no)
       mark.group_owner = tb.varName;
     Items = new object[] { mark };
   } else if (startWith == tableStart_with.number)
     cellContent = idx + 1;
   else if (startWith == tableStart_with.number_ignoreFirst)
     cellContent = idx == 0 ? -2 : idx;
 }