Exemple #1
0
    void changeUrlIdx(int urlIdx) {
      this.urlIdx = urlIdx;
      if (urlIdx < 0) {
        Splitter.Visible = PrevBtn.Visible = NextBtn.Visible = IENewBtn.Visible = IEOldBtn.Visible = checkBtn.Visible = createHand.Visible =
          comboNew.Visible = comboOld.Visible = comboEdit.Visible = EditBtn.Visible = statusLab.Visible = false;
        if (nonFilterUrls == null)
          Text = exFile.actWorker().ToString() + ": Drag and Drop file(s) to one of blue panels";
        else
          this.Text = "Empty filter result # " + actFile;
        fileEx = null;
        return;
      }

      var actUrl = urls[urlIdx];
      this.Text = string.Format("{1}/{2} # {3} # {0}", actFile, urlIdx + 1, urls == null ? 0 : urls.Length, actUrl);

      Splitter.Visible = PrevBtn.Visible = NextBtn.Visible = IENewBtn.Visible = IEOldBtn.Visible = checkBtn.Visible = comboNew.Visible =
        comboOld.Visible = comboEdit.Visible = EditBtn.Visible = statusLab.Visible = true;


      this.Text = string.Format("{1}/{2} # {3} # {0}", actFile, urlIdx + 1, urls.Length, actUrl);

      fileEx = OldToNew.fileGroup.getAllFiles()[actUrl];

      refresh();

      PrevBtn.Enabled = urlIdx > 0; NextBtn.Enabled = urlIdx < urls.Length - 1;
      //checkBtn.Visible = true; 
    }
Exemple #2
0
 static bool soundOnly(exFile root) {
   return
     !root.statNames.Except(tg_sound).Any() &&
     sound_(root);
 }
Exemple #3
0
 //XXX1
 public static void oldToNewTransform(XElement root, exFile fileEx) {
   controlProp.adjust_child_attrs_all(root, null);
   var trs = fileEx.getTransforms();
   if (trs != null) foreach (var tr in trs) trans.form(tr, root);
   LMScormLibDOM.oldToNewSound.transformedXml = root.ToString();
 }
Exemple #4
0
 //**************** selection-radioButton
 static bool selection_(exFile root, bool testWithTitle, bool? isRadio) {
   Func<string, bool> test = type => {
     if (isRadio == null) return true; //radioButton nebo checkBox
     if (isRadio == true) return type == "radioButton"; //radioButton
     return type != "radioButton"; //checkBox
   };
   var gfSrc = root.statControls.Where(e => e.Name.LocalName == "selection" && test(e.AttributeValue("type"))).ToArray();
   if (gfSrc.Length == 0) return false;
   if (testWithTitle && gfSrc.Any(s => string.IsNullOrEmpty(s.AttributeValue("title")))) return false;
   var chits = root.statControls.Where(e => e.Name.LocalName == "check_item").ToArray();
   if (chits.Length == 0 || chits.Any(c => c.Parent.Name.LocalName != "selection")) return false;
   return true;
 }
Exemple #5
0
 //*********************** pairing
 static bool simple_pairing_(exFile root, string[] itemTags) {
   if (!root.statNames.Contains("pairing")) return false;
   var pairItems = root.statControls.Where(e => e.Name.LocalName == "pairing").ToArray();
   pairItems = pairItems.Elements().ToArray();
   if (pairItems.Any(p => p.Name.LocalName != "item")) throw new Exception();
   if (pairItems.Any(p => p.Nodes().Count() != 2 || p.Elements().Count() != 2)) throw new Exception();
   if (pairItems.Any(p => p.Elements().Select(e => e.Name.LocalName).Except(new string[] { "html", "sound_mark" }).Any())) throw new Exception();
   //pokud tag, tak jako jediny element
   foreach (var pi in pairItems.SelectMany(pi => pi.Elements())) {
     bool isFirst = pi == pi.Parent.Elements().First();
     if (isFirst && pi.Name.LocalName == "sound_mark") continue;
     if (pi.Name.LocalName != "html") throw new Exception();
     if (!pi.Elements().Any()) continue;
     var htmlTags = pi.Elements().Select(e => e.Name.LocalName).ToArray();
     if (!isFirst && htmlTags.Length > 1) return false; // throw new Exception();
     if (itemTags != null && htmlTags.Except(itemTags).Any()) return false;
   }
   return true;
   //if (pairItems.SelectMany(p => p.Descendants()).Any(d => d.Name.LocalName != "html" && d.Name.LocalName != "trans")) return true;
   //return false;
 }
Exemple #6
0
    //*********************** soundOnly

    static bool sound_(exFile root) {
      var soundAll = root.statControls.Where(e => tg_sound.Contains(e.Name.LocalName));
      if (!soundAll.Any()) return false;
      //not normal sound.layout
      var soundAttrs = root.statControls.Where(e => e.Name.LocalName == "sound").SelectMany(sound => sound.Attributes("layout"));
      if (soundAttrs.Any(a => a.Value != "normal")) return false;
      //not ignore sound: 
      //BT_2207
      //var ignoreSoundAttrs = root.statControls.SelectMany(sound => sound.Attributes("ignore_sound"));
      //if (ignoreSoundAttrs.Any(a => a.Value != "no")) return false;
      //sentences, sentence.layout
      var sentAttrs = root.statControls.Where(e => e.Name.LocalName == "sound_sentences" || e.Name.LocalName == "sound_sentence").SelectMany(sent => sent.Attributes("layout"));
      if (sentAttrs.Any(a => a.Value != "text" && a.Value != "hidden")) return false;
      return true;
    }
Exemple #7
0
 //*********************** simpleGapFill
 static bool simpleGapFill_(exFile root, gapFillSets set) {
   var gapFills = root.statControls.Where(e => e.Name.LocalName == "gap_fill").ToArray();
   if (gapFills.Length == 0) return false;
   var atts = gapFills.SelectMany(gapFill => gapFill.Attributes()).Select(a => a.Name.LocalName).Distinct().ToArray();
   return (atts.All(at => {
     //if (at == "group_eval" /*|| at == "width"*/) return false;
     if ((set & gapFillSets.dragSource) == 0 && at == "drag_source") return false;
     if ((set & gapFillSets.initExample) == 0 && (at == "init_value" || at == "example" || at == "width" || at == "group_eval")) return false;
     return true;
   }));
 }
Exemple #8
0
 static bool problem_BT_2207(exFile root) {
   var soundAll = root.statControls.Where(e => tg_sound.Contains(e.Name.LocalName));
   if (!soundAll.Any()) return false;
   var ignoreSoundAttrs = root.statControls.SelectMany(sound => sound.Attributes("ignore_sound"));
   return ignoreSoundAttrs.Any(a => a.Value == "map");
 }
Exemple #9
0
 static bool selection(exFile root, bool testWithTitle, bool? isRadio) {
   return
     !root.statNames.Except(tg_selection.Concat(tg_gapFillSource).Concat(tg_gapFill_evalMark).Concat(tg_sound).Concat(tg_pairing).Concat(tg_table)).Any() &&
     (selection_(root, testWithTitle, isRadio)) &&
     gapFillCondition(root, gapFillSets.noInit) &&
     soundCondition(root) &&
     pairingCondition(root);
 }
Exemple #10
0
 static bool other_gap_fill_source(exFile root) {
   return
     !root.statNames.Except(tg_gapFillSource.Concat(tg_sound).Concat(tg_pairing).Concat(tg_table)).Any() &&
     gapFillCondition(root, gapFillSets.noInit) &&
     soundCondition(root) &&
     pairingCondition(root);
 }
Exemple #11
0
 static bool simple_gap_fill_source(exFile root) {
   return
     !root.statNames.Except(tg_gapFillSource).Any() &&
     simpleGapFill_(root, gapFillSets.dragSource);
 }
Exemple #12
0
 static bool other_pairing(exFile root) {
   return
     !root.statNames.Except(tg_gapFill_evalMark.Concat(tg_sound).Concat(tg_pairing).Concat(tg_table)).Any() &&
     gapFillCondition(root, gapFillSets.simple) &&
     soundCondition(root) &&
     pairingCondition(root);
 }
Exemple #13
0
 static bool simple_pairing(exFile root) {
   return
     !root.statNames.Except(tg_pairing).Any() &&
     simple_pairing_(root, tg_simplePairItem);
 }
Exemple #14
0
 static bool sound_gap_fill(exFile root) {
   return
     !root.statNames.Except(tg_gapFill_evalMark.Concat(tg_sound).Concat(tg_table)).Any() &&
     gapFillCondition(root, gapFillSets.simple) &&
     soundCondition(root);
 }
Exemple #15
0
 static bool problem_BT_2176(exFile root) {
   var tables = root.statContent.Descendants(exFile.lm + "table").Where(t => t.AttributeValue("start_with") == "evalControl");
   //var tables = root.statContent.Descendants(exFile.lm + "table").Where(t => t.AttributeValue("start_with") == "evalControl");
   //tables = tables.Where(t => t.AttributeValue("start_with") == "evalControl" && !t.Elements().All(e => e.Name.LocalName == "row") && !t.Elements().All(e => e.Name.LocalName == "control"));
   //tables = tables.Where(t => t.AttributeValue("start_with") == "evalControl" && t.Elements().All(e => e.Name.LocalName == "control"));
   //var tables = tables.Where(t => t.AttributeValue("start_with") == "evalControl" && t.Descendants().Select(d => d.Name.LocalName).Any(n => StatLib._evalControlsName.Contains(n) && n != "gap_fill" && n != "eval_mark"));
   return tables.Any();
 }
Exemple #16
0
 static bool problem_BT_2159(exFile root) {
   var gapFills = root.statControls.Where(e => e.Name.LocalName == "gap_fill").Where(g => g.AttributeValue("correct") == ""/*&& g.AttributeValue("width") != null*/);
   return gapFills.Any();
 }
Exemple #17
0
 static bool classification(exFile root) {
   return
     !root.statNames.Except(tg_selection.Concat(tg_gapFillSource).Concat(tg_gapFill_evalMark).Concat(tg_sound).Concat(tg_pairing).Concat(tg_table).Concat(tg_classification)).Any() &&
     gapFillCondition(root, gapFillSets.all) &&
     soundCondition(root) &&
     pairingCondition(root) &&
     selectionCondition(root);
   //classificationCondition(root);
 }
Exemple #18
0
 static bool todoFilter(exFile root) {
   var sound = root.statControls.Where(e => (e.Name.LocalName == "sound" || e.Name.LocalName == "sound_dialog") && e.AttributeValue("ignore_sound") != "no");
   var checkBox = root.statControls.Where(e => e.Name.LocalName == "selection" && e.AttributeValue("type") != "radioButton");
   return sound.Any() || checkBox.Any();
 }
Exemple #19
0
 static bool checkItem(exFile root) {
   return
     !root.statNames.Except(tg_selection.Concat(tg_gapFillSource).Concat(tg_gapFill_evalMark).Concat(tg_sound).Concat(tg_pairing).Concat(tg_table).Concat(tg_classification).Concat(tg_wordOrdering).Concat(tg_sentenceOrdering)).Any() &&
     gapFillCondition(root, gapFillSets.all) &&
     soundCondition(root) &&
     pairingCondition(root);
   //selectionCondition(root) &&
   //classificationCondition(root) &&
   //wordOrderingCondition(root) &&
   //checkItemCondition(root);
 }
Exemple #20
0
 static bool gapFillCondition(exFile root, gapFillSets set) {
   if (!root.statNames.Contains("gap_fill")) return true; //neobsahuje zadny gapfill, pak je OK
   //obsahuje gapfill:
   return simpleGapFill_(root, set); //kontrola gafill atributu
 }
Exemple #21
0
 static bool passive(exFile root) { return root.statNames.Length == 0; }
Exemple #22
0
 static bool soundCondition(exFile root) {
   if (root.statNames.All(t => !tg_soundSet.Contains(t))) return true; //neobsahuje zadny sound, pak je OK
   return sound_(root);
 }
Exemple #23
0
 static bool other(exFile root) { return true; }
Exemple #24
0
    static string[] tg_simplePairItem = new string[] { "trans", "html" }; //tagy, povolene v item

    static bool pairingCondition(exFile root) {
      if (!root.statNames.Contains("pairing")) return true; //neobsahuje zadny pairing, pak je OK
      return simple_pairing_(root, null);
    }
Exemple #25
0
 static bool problem_BT_2166(exFile root) {
   var drags = root.statControls.Where(e => e.Name.LocalName == "gap_fill_source");
   if (!drags.Any()) return false;
   var gapFills = root.statControls.Where(e => e.Name.LocalName == "gap_fill").Where(g => !string.IsNullOrEmpty(g.AttributeValue("group_set")));
   if (!gapFills.Any()) return false;
   return true;
 }
Exemple #26
0
 static bool selectionCondition(exFile root) {
   if (!root.statNames.Intersect(tg_selection).Any()) return true; //neni selection, pak OK
   return selection_(root, false, true);
 }
Exemple #27
0
 static bool problem_BT_2167(exFile root) {
   var drags = root.statControls.Where(e => e.Name.LocalName == "gap_fill_source").Where(g => g.AttributeValue("type") == "Drag" || g.AttributeValue("type") == "DragAll");
   if (!drags.Any()) return false;
   var gapFills = root.statControls.Where(e => e.Name.LocalName == "gap_fill").Where(g => g.AttributeValue("correct").Any(ch => char.IsUpper(ch)) && g.AttributeValue("eval_mode") != "caseSensitive");
   if (!gapFills.Any()) return false;
   return true;
 }
Exemple #28
0
 static bool problem_BT_2158(exFile root) {
   var drags = root.statControls.Where(e => e.Name.LocalName == "gap_fill_source").ToArray(); if (drags.Length != 1) return false;
   if (drags[0].AttributeValue("type") != "DragAll") return false;
   var gapFills = root.statControls.Where(e => e.Name.LocalName == "gap_fill").SelectMany(g => g.Attributes("correct")).Select(a => a.Value).GroupBy(v => v);
   return gapFills.Any(g => g.Count() > 1);
 }
Exemple #29
0
 static bool simpleGapFill(exFile root) {
   return
     !root.statNames.Except(tg_gapFill_evalMark).Any() &&
     simpleGapFill_(root, gapFillSets.simple);
 }