Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

if.jst 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. {{## def.validateIfClause:_clause:
  6. {{
  7. $it.schema = it.schema['_clause'];
  8. $it.schemaPath = it.schemaPath + '._clause';
  9. $it.errSchemaPath = it.errSchemaPath + '/_clause';
  10. }}
  11. {{# def.insertSubschemaCode }}
  12. {{=$valid}} = {{=$nextValid}};
  13. {{? $thenPresent && $elsePresent }}
  14. {{ $ifClause = 'ifClause' + $lvl; }}
  15. var {{=$ifClause}} = '_clause';
  16. {{??}}
  17. {{ $ifClause = '\'_clause\''; }}
  18. {{?}}
  19. #}}
  20. {{
  21. var $thenSch = it.schema['then']
  22. , $elseSch = it.schema['else']
  23. , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
  24. , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
  25. , $currentBaseId = $it.baseId;
  26. }}
  27. {{? $thenPresent || $elsePresent }}
  28. {{
  29. var $ifClause;
  30. $it.createErrors = false;
  31. $it.schema = $schema;
  32. $it.schemaPath = $schemaPath;
  33. $it.errSchemaPath = $errSchemaPath;
  34. }}
  35. var {{=$errs}} = errors;
  36. var {{=$valid}} = true;
  37. {{# def.setCompositeRule }}
  38. {{# def.insertSubschemaCode }}
  39. {{ $it.createErrors = true; }}
  40. {{# def.resetErrors }}
  41. {{# def.resetCompositeRule }}
  42. {{? $thenPresent }}
  43. if ({{=$nextValid}}) {
  44. {{# def.validateIfClause:then }}
  45. }
  46. {{? $elsePresent }}
  47. else {
  48. {{?}}
  49. {{??}}
  50. if (!{{=$nextValid}}) {
  51. {{?}}
  52. {{? $elsePresent }}
  53. {{# def.validateIfClause:else }}
  54. }
  55. {{?}}
  56. if (!{{=$valid}}) {
  57. {{# def.extraError:'if' }}
  58. }
  59. {{? $breakOnError }} else { {{?}}
  60. {{# def.cleanUp }}
  61. {{??}}
  62. {{? $breakOnError }}
  63. if (true) {
  64. {{?}}
  65. {{?}}