Exemplo n.º 1
0
 public static string HomePage(Config cfg) {
   cfg.callInit = cfg.target != Targets.sl;
   string bodyClass = "";
   if (cfg.noCpv) bodyClass += " hide-cpv";
   return MainPage.run(
     cfg,
     () => MainPage.Head("schools", MainPage.headStyle.css, cssNewEA(cfg)) +
       MainPage.cssTmplIE7Start + MainPage.Head("schools", MainPage.headStyle.cssie7, cssIE7(cfg)) + MainPage.cssTmplIE7End +
       MainPage.Head("schools", MainPage.headStyle.js, jsNewEA(cfg)) +
       langInclude(cfg),
     () => null,
     () => MainPage.htmls(htmlNewEA(cfg)),
     () => jsInit(cfg),
     bodyClass
   );
 }
Exemplo n.º 2
0
 //soubory z q:\LMCom\rew\Web4\Schools\EACourses\ a q:\LMCom\rew\Web4\Schools\EAData\
 static IEnumerable<Consts.file> eaCoursesFiles(Config cfg) {
   string lngTxt = cfg.lang == null ? "{#lang}" : cfg.lang.ToString().Replace('_', '-');
   yield return new Consts.file("Schools/EACourses/courses.rjson");
   yield return new Consts.file("Schools/EACourses/dicts.rjson");
   yield return new Consts.file(string.Format("Schools/EACourses/{0}.rjson", cfg.prod.productId()));
   yield return new Consts.file(string.Format("Schools/EACourses/{1}/{0}.json", cfg.prod.productId(), lngTxt));
   foreach (var s in cfg.prod.grammarLevels()) {
     yield return new Consts.file(string.Format("Schools/EAGrammar/{0}_{1}.json", cfg.prod.course, s));
     yield return new Consts.file(string.Format("Schools/EAGrammar/{2}/{0}_{1}.json", cfg.prod.course, s, lngTxt));
   }
   yield return new Consts.file("Schools/EAData/instructions.json");
   yield return new Consts.file(string.Format("Schools/EAData/{0}/instructions.json", lngTxt));
   foreach (var s in ProductsDefine.Lib.allModules(cfg.prod)) {
     yield return new Consts.file(string.Format("Schools/EAData/{0}.json", s));
     yield return new Consts.file(string.Format("Schools/EAData/{1}/{0}.json", s, lngTxt));
     if (cfg.dictType == schools.dictTypes.lingOffline)
       yield return new Consts.file(string.Format("Schools/EAData/{1}/lingDict_{0}.rjson", s, lngTxt));
   }
 }
Exemplo n.º 3
0
    public static string run(Config cfg, Func<string> inHead, Func<string> bodyStart, Func<string> jsRender, Func<string> jsInit, string bodyClass) {
      return
@"
<!DOCTYPE html>
<!--[if lt IE 8]>  
<html class='no-media ie7'> 
<![endif]-->
<!--[if IE 8]>
<html class='no-ie7 no-media ie8'>
<![endif]-->
<!--[if IE 9]>
<html class='ie ie9'> 
<![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class='no-ie7 no-ie8'>
<!--<![endif]-->

<head runat='server'>
  <meta http-equiv='X-UA-Compatible' content='IE=Edge' />
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
  <meta name='viewport' content='width=device-width'/>
  <title>LANGMaster</title>
" +
  inHead()
  +
@"
<!-- head.htm -->
</head>
<body
"
  + (string.IsNullOrEmpty(bodyClass) ? null : " class='" + bodyClass + "'")
  + ">"
  +
  bodyStart()
  +
@"
  <div id='root' data-bind='template:rootTemplate'></div>
  <script id='dummy' type='text/x-jsrender' data-for='Dummy'>
    {{for ~ActPage()}}{{/for}}
  </script>
"
  +
  jsRender()
  +
@"
  <script type='text/javascript'>
"
 +
 jsInit()
 +
@"    
  </script>
</body>
</html>
"
;
    }
Exemplo n.º 4
0
 //test soubory z d:\LMCom\rew\Web4\RwTests\
 static IEnumerable<Consts.file> eaTestFiles(Config cfg) {
   return cfg.prod.productParts().
     Where(p => !string.IsNullOrEmpty(p.testFileName())).
     SelectMany(p => Directory.CreateDirectory(basicPath + @"RwTests\" + p.testFileName()).EnumerateFiles("*.*", SearchOption.AllDirectories)).
     Select(f => f.DirectoryName.Substring(basicPath.Length) + "\\" + f.Name).
     Select(f => new Consts.file(f));
 }
Exemplo n.º 5
0
 static IEnumerable<Consts.file> mediaFiles(Config cfg) {
   ProductsDefine.productDescrNew prod = cfg.prod as ProductsDefine.productDescrNew;
   if (prod == null) yield break;
   ScanDir sd = new ScanDir();
   sd.BasicPath = basicPath + @"RwCourses\" + prod.dataPath.Replace('/', '\\');
   sd.DirsToResult = false;
   sd.FileMask = @"(?i:\.(wmv|png|mp3|jpg|json))$";
   foreach (var f in sd.FileName(FileNameMode.FullPath)) yield return new Consts.file(f.Substring(basicPath.Length));
 }
Exemplo n.º 6
0
    //Javascript pro inicializaci
    static string jsInit(Config ccfg) {
      schools.config cfg = new schools.config();
      ccfg.copyTo(cfg);
      cfg.rootCourse = ccfg.target != Targets.web ? int.MaxValue - 1 : (ccfg.prod == null ? -1 : ccfg.prod.courseId);
      cfg.EADataPath = ccfg.EADataPath != null ? ccfg.EADataPath : "eaimgmp3/";

      string cfgStr = JsonConvert.SerializeObject(cfg);
      //if (ccfg.prod == null && ccfg.target != Targets.web) {
      if (ccfg.target != Targets.web) {
        string t = int.MaxValue.ToString(); string c = (int.MaxValue - 1).ToString();
        cfgStr = cfgStr.Replace(t, "{#target}").Replace(c, "{#courseId}");
      }
      return "    function jsInit() { schoolInit.init_school_master(" + cfgStr + "); }" + (ccfg.callInit ? "\r\n    jsInit();" : null);
    }
Exemplo n.º 7
0
 //files from q:\LMNet2\WebApps\EduAuthorNew\, ziskane parsovanim modulu z q:\LMCom\rew\Web4\Schools\EAData\
 static IEnumerable<Consts.file> eaFiles(Config cfg) {
   return ProductsDefine.Lib.allModules(cfg.prod).
     SelectMany(m => imagesMp3(File.ReadAllText(basicPath + @"Schools\EAData\" + m + ".json"))).
     Select(f => f.ToLower()).
     Distinct().
     Select(file => new Consts.file("Schools/EAImgMp3/" + file));
 }
Exemplo n.º 8
0
 static void ScormManifestInclude(Config cfg) {
   Consts.scormManifestFiles(commonFiles(cfg), issDestPath + "scormGlobalFiles.iss");
   Consts.scormZipFiles(commonFiles(cfg), issDestPath + "scormZipGlobalFiles.iss");
   //produkt specific files (vcetne home)
   foreach (var prod in ProductsDefine.Lib.products) {
     cfg.prod = prod;
     ScormProduct(cfg);
   }
 }
Exemplo n.º 9
0
 static void ISSInclude(Config cfg) {
   //spolecne SW files
   Consts.saveISSFile(commonFiles(cfg), issDestPath + "globalFiles.iss");
   //produkt specific files (vcetne home)
   foreach (var prod in ProductsDefine.Lib.products) {
     cfg.prod = prod;
     DownloadProduct(cfg);
   }
 }
Exemplo n.º 10
0
 public static void ScormISSIncludes(Config cfg) {
   langProductInfos();
   ISSInclude(cfg);
   ScormManifestInclude(cfg);
 }
Exemplo n.º 11
0
 static void DownloadProduct(Config cfg) {
   File.WriteAllText(Machines.basicPath + @"rew\Downloads\Common\IIS\indexTemplate-download.htm", HomePage(cfg));
   var prodPathPrefix = issDestPath + "products\\" + cfg.prod.productId();
   Consts.saveISSFile(productFiles(cfg), prodPathPrefix + "_files.iss");
 }
Exemplo n.º 12
0
 static void ScormProduct(Config cfg) {
   File.WriteAllText(Machines.basicPath + @"rew\Downloads\Common\IIS\indexTemplate-scorm.htm", HomePage(cfg));
   var prodPathPrefix = issDestPath + "products\\" + cfg.prod.productId();
   Consts.scormManifestFiles(productFiles(cfg), prodPathPrefix + "_scorm_files.iss");
   Consts.scormZipFiles(productFiles(cfg), prodPathPrefix + "_scormZip_files.iss");
 }
Exemplo n.º 13
0
 //Product dependent files
 public static IEnumerable<Consts.file> productFiles(Config cfg) {
   //q:\LMCom\rew\Web4\Schools\EA* files, lokalizace je zakodovana v {{#lang}}
   foreach (var fn in eaCoursesFiles(cfg)) yield return fn;
   //multimedia z d:\LMCom\rew\Web4\RwCourses\* files
   foreach (var fn in mediaFiles(cfg)) yield return fn;
   //q:\LMCom\rew\Web4\Schools\EAImgMp3\ files
   foreach (var fn in eaFiles(cfg)) yield return fn;
   //lokalizovane JS soubory
   foreach (var fn in langFiles(cfg)) yield return fn;
   //prehravace, naleznou se diky var xapPath = 'eaimgmp3/'; v Q:\LMCom\rew\web4\JsLib\EA\EAExtension.ts
   yield return new Consts.file("Schools/SLExtension.xap");
   if (cfg.prod != null && cfg.prod.isTest) {
     yield return new Consts.file("Schools/client.xap");
     foreach (var fn in eaTestFiles(cfg)) yield return fn;
   }
   yield return new Consts.file("Schools/player.swf");
 }
Exemplo n.º 14
0
 static IEnumerable<Consts.file> langFiles(Config cfg) { //Include JS souboru do manifestu, scorm zipu apod.
   yield return new Consts.file("schools/loc/tradosdata.{#lang}.js");
   yield return new Consts.file("jslib/scripts/cultures/globalize.culture.{#lang}.js");
 }