aboutsummaryrefslogtreecommitdiffstats
path: root/root/base/component
blob: 4f455ce73b71553cb976f73e80373c56d4c11c47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
[%-

GLOBAL_DEBUG = ctx.debug;

MACRO loc(text, args) BLOCK;

  ctx.localize(text, args);

END;

MACRO include(name, args) BLOCK;

  filename = ${name};

  IF filename;
    IF GLOBAL_DEBUG;
      '<!-- Start block '; name | html; ' calling '; filename | html; " -->\n";
    END;
    INCLUDE $filename args;
    IF GLOBAL_DEBUG;
      '<!-- End block '; name | html; " -->\n";
    END;
  ELSE;
    error = 'Chosen INCLUDE ' _ name _ ' is empty';
    THROW file error;
  END;

END;

MACRO connect_form(vp, event) BLOCK;

  '';

END;

MACRO connect_control(vp, event, value) BLOCK;

  'name="'; vp.event_id_for(event); '"';

END;

MACRO connect_href(vp, events) BLOCK;

  FOREACH event = events.keys;
    evt_args.${vp.event_id_for(event)} = events.$event;
  END;
  'href="'; ctx.req.uri_with(evt_args); '"';

END;

UNLESS type;
  errmsg = "type is empty rendering " _ self;
  THROW file errmsg;
END;

PROCESS $type;

IF GLOBAL_DEBUG; '<!-- Rendering component '; type | html; " -->\n"; END;

include( 'main_block' );

IF GLOBAL_DEBUG; '<!-- End component '; type | html; " -->\n"; END;

-%]