Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b364553b

Von Sven Schöling vor etwa 14 Jahren hinzugefügt

  • ID b364553bd1c69d15999e3269649fa9a8b55eb8c3
  • Vorgänger adecbacd
  • Nachfolger 997c9f23

multibox part 2.

Jetzt komplett PROCESS fähig, die einzelnen Variablen werden
zwischengespeichert unter einem Pseudonamespace, und garantiert überschrieben
beim Folgeaufruf.

Unterschiede anzeigen:

templates/webpages/generic/multibox.html
6 6
  decides wether it should be a text field or a drop down box,
7 7
  generates the HTML code, and fixes everything just right.
8 8

  
9
  call:  INCLUDE generic/multibox.html var = var, var2 = ....
9
  call:  PROCESS generic/multibox.html var = var, var2 = ....
10 10

  
11 11
  options and variables:
12 12
    name          : name of the select/textfield
......
26 26
    select_name   : if a select is displayed, use a different name. ex.: department for textinput, but department_id for selects
27 27
    readonly      : softly prevents modification
28 28
-%]
29
[%- DEFAULT
30
  limit      = limit   != '' ? limit   : vclimit != '' ? vclimit : 200
31
  show_text  = allow_textbox and DATA.size and limit < DATA.size ? 1 : 0
32
  id         = id      != '' ? id      : name
33
  default    = default != '' ? default : $name
34
-%]
35 29
[%-
36
  name       = (select_name != '' and ! show_text) ? select_name : name
30
  Multibox__limit      = limit   != '' ? limit   : vclimit != '' ? vclimit : 200
31
  Multibox__show_text  = allow_textbox and DATA.size and Multibox__limit < DATA.size ? 1 : 0
32
  Multibox__id         = id      != '' ? id      : name
33
  Multibox__default    = default != '' ? default : $name
34
  Multibox__name       = (select_name != '' and ! Multibox__show_text) ? select_name : name
37 35
-%]
38
[%- IF show_text %]
36
[%- IF Multibox__show_text %]
39 37
<input type="text"
40
 [%- IF name     %] name="[%     HTML.escape(name)     %]"[% END -%]
41
 [%- IF id       %] id="[%       HTML.escape(id)       %]"[% END -%]
42
 [%- IF default  %] value="[%    HTML.escape(default)  %]"[% END -%]
43
 [%- IF style    %] style="[%    HTML.escape(style)    %]"[% END -%]
44
 [%- IF readonly %] readonly[% END -%]
38
 [%- IF Multibox__name     %] name="[%  Multibox__name    | html %]"[% END -%]
39
 [%- IF Multibox__id       %] id="[%    Multibox__id      | html %]"[% END -%]
40
 [%- IF Multibox__default  %] value="[% Multibox__default | html %]"[% END -%]
41
 [%- IF style              %] style="[% style             | html %]"[% END -%]
42
 [%- IF readonly           %] readonly[% END -%]
45 43
[%- -%]>
46 44
[%- IF select -%]
47 45
  <input type="button" onclick="[% select %]" value="?">
48 46
[%- END -%]
49 47
[%- ELSE %]
50 48
<select
51
 [%- IF name     %] name="[%     HTML.escape(name)     %]"[% END -%]
52
 [%- IF id       %] id="[%       HTML.escape(id)       %]"[% END -%]
53
 [%- IF style    %] style="[%    HTML.escape(style)    %]"[% END -%]
54
 [%- IF onChange %] onChange="[% HTML.escape(onChange) %]"[% END -%]
55
 [%- IF readonly %] disabled[% END -%]
49
 [%- IF Multibox__name     %] name="[%     Multibox__name     | html %]"[% END -%]
50
 [%- IF Multibox__id       %] id="[%       Multibox__id       | html %]"[% END -%]
51
 [%- IF style              %] style="[%    style              | html %]"[% END -%]
52
 [%- IF onChange           %] onChange="[% onChange           | html %]"[% END -%]
53
 [%- IF readonly           %] disabled[% END -%]
56 54
[%- -%]>
57 55
  [%- IF show_empty %]
58 56
  <option value=""></option>
59 57
  [%- END %]
60 58
  [%- FOREACH row = DATA %]
61
  <option value="[% row.$id_key != '' ? row.$id_key : $id_sub(row) | html %]"[% IF default == (row.$id_key != '' ? row.$id_key : $id_sub(row)) %] selected[% END %]>[%
62
                      row.$label_key  != ''  ? row.$label_key
63
                    : $label_sub(row) != ''  ? $label_sub(row)
64
                    : row.$id_key     != ''  ? row.$id_key
65
                    :                          $id_sub(row) | html %]</option>
59
  [%-
60
      Multibox__row_id       = row.$id_key     != ''  ? row.$id_key    : $id_sub(row)
61
      Multibox__row_label    = row.$label_key  != ''  ? row.$label_key
62
                             : $label_sub(row) != ''  ? $label_sub(row)
63
                             :                          Multibox__row_id
64
      Multibox__row_selected = Multibox__default == Multibox__row_id
65
  %]
66
  <option value="[% Multibox__row_id | html %]"[% IF Multibox__row_selected %] selected[% END %]>[% Multibox__row_label | html %]</option>
66 67
  [%- END %]
67 68
</select>
68 69
[%- END %]

Auch abrufbar als: Unified diff