|
36 | 36 | </div> |
37 | 37 | </div> |
38 | 38 | <?php } ?> |
39 | | - <div class="u-mt20"> |
40 | | - <?php |
41 | | - foreach ($WebappInstaller->getOptions() as $form_name => $form_control) { |
42 | | - $field_name = $WebappInstaller->formNs() . "_" . $form_name; |
43 | | - $field_type = $form_control; |
44 | | - $field_value = ""; |
45 | | - $field_label = |
46 | | - isset($form_control["label"]) |
47 | | - ? htmlentities($form_control["label"]) |
48 | | - : ucwords(str_replace([".","_"], " ", $form_name)); |
49 | | - $field_placeholder = ""; |
50 | | - if (is_array($form_control)) { |
51 | | - $field_type = !empty($form_control["type"]) ? $form_control["type"] : "text"; |
52 | | - $field_value = !empty($form_control["value"]) ? $form_control["value"] : ""; |
53 | | - $field_placeholder = !empty($form_control["placeholder"]) ? $form_control["placeholder"] : ""; |
54 | | - } |
55 | | - $field_value = htmlentities($field_value); |
56 | | - $field_label = htmlentities($field_label); |
57 | | - $field_name = htmlentities($field_name); |
58 | | - $field_placeholder = htmlentities($field_placeholder); |
59 | | - ?> |
60 | | - <div |
61 | | - x-data="{ |
62 | | - value: '<?= !empty($field_value) ? $field_value : "" ?>' |
63 | | - }" |
64 | | - class="u-mb10" |
65 | | - > |
66 | | - <?php if ($field_type != "boolean"): ?> |
67 | | - <label for="<?= $field_name ?>" class="form-label"> |
68 | | - <?= $field_label ?> |
69 | | - <?php if ($field_type == "password") { ?> |
70 | | - / |
71 | | - <button |
72 | | - x-on:click="value = Hestia.helpers.randomPassword()" |
73 | | - class="form-link" |
74 | | - type="button" |
75 | | - > |
76 | | - <?= _("Generate") ?> |
| 39 | + <?php |
| 40 | + foreach ($WebappInstaller->getOptions() as $form_name => $form_control) { |
| 41 | + $field_name = $WebappInstaller->formNs() . "_" . $form_name; |
| 42 | + $field_type = $form_control; |
| 43 | + $field_value = ""; |
| 44 | + $field_label = |
| 45 | + isset($form_control["label"]) |
| 46 | + ? htmlentities($form_control["label"]) |
| 47 | + : ucwords(str_replace([".","_"], " ", $form_name)); |
| 48 | + $field_placeholder = ""; |
| 49 | + if (is_array($form_control)) { |
| 50 | + $field_type = !empty($form_control["type"]) ? $form_control["type"] : "text"; |
| 51 | + $field_value = !empty($form_control["value"]) ? $form_control["value"] : ""; |
| 52 | + $field_placeholder = !empty($form_control["placeholder"]) ? $form_control["placeholder"] : ""; |
| 53 | + } |
| 54 | + $field_value = htmlentities($field_value); |
| 55 | + $field_label = htmlentities($field_label); |
| 56 | + $field_name = htmlentities($field_name); |
| 57 | + $field_placeholder = htmlentities($field_placeholder); |
| 58 | + ?> |
| 59 | + <div class="u-mb10"> |
| 60 | + <?php if ($field_type != "boolean"): ?> |
| 61 | + <label for="<?= $field_name ?>" class="form-label"> |
| 62 | + <?= $field_label ?> |
| 63 | + <?php if ($field_type == "password"): ?> |
| 64 | + <button type="button" title="<?= _("Generate") ?>" class="u-unstyled-button u-ml5 js-generate-password"> |
| 65 | + <i class="fas fa-arrows-rotate icon-green"></i> |
77 | 66 | </button> |
78 | | - <?php } ?> |
79 | | - </label> |
80 | | - <?php endif; ?> |
| 67 | + <?php endif; ?> |
| 68 | + </label> |
| 69 | + <?php endif; ?> |
81 | 70 |
|
82 | | - <?php if ($field_type == 'select' && count($form_control['options'])) { ?> |
83 | | - <select class="form-select" name="<?= $field_name ?>" id="<?= $field_name ?>"> |
84 | | - <?php |
85 | | - foreach ($form_control['options'] as $key => $option) { |
86 | | - $key = !is_numeric($key) ? $key : $option; |
87 | | - $selected = !empty($form_control['value'] && $key == $form_control['value']) ? 'selected' : ''; |
88 | | - ?> |
89 | | - <option |
90 | | - value="<?= $key ?>" |
91 | | - <?= $selected ?> |
92 | | - > |
93 | | - <?= htmlentities($option) ?> |
94 | | - </option> |
95 | | - <?php } ?> |
96 | | - </select> |
97 | | - <?php |
98 | | - } elseif ($field_type == "boolean") { |
99 | | - $checked = !empty($field_value) ? "checked" : ""; |
100 | | - ?> |
101 | | - <div class="form-check"> |
| 71 | + <?php if ($field_type == 'select' && count($form_control['options'])): ?> |
| 72 | + <select class="form-select" name="<?= $field_name ?>" id="<?= $field_name ?>"> |
| 73 | + <?php foreach ($form_control['options'] as $key => $option): |
| 74 | + $key = !is_numeric($key) ? $key : $option; |
| 75 | + $selected = !empty($form_control['value'] && $key == $form_control['value']) ? 'selected' : ''; ?> |
| 76 | + <option value="<?= $key ?>" <?= $selected ?>> |
| 77 | + <?= htmlentities($option) ?> |
| 78 | + </option> |
| 79 | + <?php endforeach; ?> |
| 80 | + </select> |
| 81 | + <?php elseif ($field_type == "boolean"): |
| 82 | + $checked = !empty($field_value) ? "checked" : ""; ?> |
| 83 | + <div class="form-check"> |
| 84 | + <input |
| 85 | + class="form-check-input" |
| 86 | + type="checkbox" |
| 87 | + name="<?= $field_name ?>" |
| 88 | + id="<?= $field_name ?>" |
| 89 | + value="true" |
| 90 | + <?= $checked ?> |
| 91 | + > |
| 92 | + <label for="<?= $field_name ?>"> |
| 93 | + <?= $field_label ?> |
| 94 | + </label> |
| 95 | + </div> |
| 96 | + <?php else: ?> |
| 97 | + <?php if ($field_type == "password"): ?> |
| 98 | + <div class="u-pos-relative"> |
102 | 99 | <input |
103 | | - class="form-check-input" |
104 | | - type="checkbox" |
| 100 | + type="text" |
| 101 | + class="form-control js-password-input" |
105 | 102 | name="<?= $field_name ?>" |
106 | 103 | id="<?= $field_name ?>" |
107 | | - value="true" |
108 | | - <?= $checked ?> |
| 104 | + placeholder="<?= $field_placeholder ?>" |
109 | 105 | > |
110 | | - <label for="<?= $field_name ?>"> |
111 | | - <?= $field_label ?> |
112 | | - </label> |
| 106 | + <div class="password-meter"> |
| 107 | + <meter max="4" class="password-meter-input js-password-meter"></meter> |
| 108 | + </div> |
113 | 109 | </div> |
114 | | - <?php } else { ?> |
| 110 | + <?php else: ?> |
115 | 111 | <input |
116 | | - x-model="value" |
117 | 112 | type="text" |
118 | 113 | class="form-control" |
119 | 114 | name="<?= $field_name ?>" |
120 | 115 | id="<?= $field_name ?>" |
121 | 116 | placeholder="<?= $field_placeholder ?>" |
122 | 117 | > |
123 | | - <?php } ?> |
124 | | - </div> |
125 | | - <?php } ?> |
126 | | - </div> |
| 118 | + <?php endif; ?> |
| 119 | + <?php endif; ?> |
| 120 | + </div> |
| 121 | + <?php } ?> |
127 | 122 | </div> |
128 | 123 | </form> |
129 | 124 | <?php } ?> |
|
0 commit comments