|
107 | 107 | $domains = $db->getArray(); |
108 | 108 |
|
109 | 109 | if ($clang_id === rex_clang::getStartId() || !$form->isEditMode()) { |
| 110 | + $form->addFieldset(rex_i18n::msg('consent_manager_general')); |
| 111 | + |
110 | 112 | $field = $form->addTextField('uid'); |
111 | 113 | $field->setLabel(rex_i18n::msg('consent_manager_uid')); |
112 | 114 | $field->getValidator()->add('notEmpty', rex_i18n::msg('consent_manager_uid_empty_msg')); |
|
115 | 117 | $field = $form->addCheckboxField('required'); |
116 | 118 | $field->addOption(rex_i18n::msg('consent_manager_cookiegroup_required'), 1); |
117 | 119 |
|
| 120 | + $field = $form->addPrioField('prio'); |
| 121 | + $field->setWhereCondition('clang_id = ' . $clang_id); |
| 122 | + $field->setLabel(rex_i18n::msg('consent_manager_prio')); |
| 123 | + $field->setLabelField('uid'); |
| 124 | + |
118 | 125 | if (count($domains) > 0) { |
| 126 | + $form->addFieldset(rex_i18n::msg('consent_manager_domain')); |
119 | 127 | $field = $form->addCheckboxField('domain'); |
120 | 128 | $field->setLabel(rex_i18n::msg('consent_manager_domain')); |
121 | 129 | foreach ($domains as $v) { |
122 | 130 | $field->addOption((string) $v['uid'], (int) $v['id']); |
123 | 131 | } |
124 | 132 | } |
125 | | - |
126 | | - $field = $form->addPrioField('prio'); |
127 | | - $field->setWhereCondition('clang_id = ' . $clang_id); |
128 | | - $field->setLabel(rex_i18n::msg('consent_manager_prio')); |
129 | | - $field->setLabelField('uid'); |
130 | 133 | } else { |
| 134 | + $form->addFieldset(rex_i18n::msg('consent_manager_general')); |
| 135 | + |
131 | 136 | $form->addRawField(RexFormSupport::getFakeText(rex_i18n::msg('consent_manager_uid'), (string) $form->getSql()->getValue('uid'))); |
132 | 137 | $form->addRawField(RexFormSupport::getFakeCheckbox('', [[$form->getSql()->getValue('required'), rex_i18n::msg('consent_manager_cookiegroup_required')]])); /** @phpstan-ignore-line */ |
133 | 138 |
|
|
140 | 145 | $checkboxes[] = [$checked, $v['uid']]; |
141 | 146 | } |
142 | 147 | if (count($checkboxes) > 0) { |
| 148 | + $form->addFieldset(rex_i18n::msg('consent_manager_domain')); |
143 | 149 | $form->addRawField(RexFormSupport::getFakeCheckbox(rex_i18n::msg('consent_manager_domain'), $checkboxes)); /** @phpstan-ignore-line */ |
144 | 150 | } |
145 | 151 | } |
| 152 | + |
| 153 | + if ($form->isEditMode() && $clang_id !== rex_clang::getStartId()) { |
| 154 | + $form->addFieldset(rex_i18n::msg('consent_manager_general')); |
| 155 | + } |
| 156 | + |
146 | 157 | $field = $form->addTextField('name'); |
147 | 158 | $field->setLabel(rex_i18n::msg('consent_manager_name')); |
148 | 159 | $field->getValidator()->add('notEmpty', rex_i18n::msg('consent_manager_uid_empty_msg')); |
|
157 | 168 | $db->select('DISTINCT pid, uid, service_name, variant'); |
158 | 169 | $cookies = $db->getArray(); |
159 | 170 |
|
160 | | - $cookieLinks = []; |
161 | | - foreach ($cookies as $c) { |
162 | | - $cookieLinks[$c['uid']] = rex_url::backendPage('consent_manager/cookie', ['func' => 'edit', 'pid' => $c['pid']]); |
163 | | - } |
164 | | - |
165 | 171 | if ($clang_id === rex_clang::getStartId() || true !== $form->isEditMode()) { |
166 | 172 | if ([] !== $cookies) { |
| 173 | + $form->addFieldset(rex_i18n::msg('consent_manager_cookies')); |
| 174 | + |
167 | 175 | // Styling und Buttons |
168 | | - $html = '<div id="cm-cookie-toolbar" class="input-group input-group-xs" style="margin-bottom: 5px;">'; |
| 176 | + $html = '<div style="display: flex; justify-content: center; margin-bottom: 5px;">'; |
| 177 | + $html .= '<div id="cm-cookie-toolbar" class="input-group input-group-xs" style="width: auto;">'; |
169 | 178 | $html .= '<span class="input-group-btn">'; |
170 | 179 | $html .= '<button type="button" class="btn btn-info cm-select-all"><i class="fa fa-check-square-o"></i> Alle auswählen</button>'; |
171 | 180 | $html .= '<button type="button" class="btn btn-default cm-deselect-all"><i class="fa fa-square-o"></i> Alle abwählen</button>'; |
172 | 181 | $html .= '</span>'; |
173 | | - $html .= '<input type="text" id="cm-cookie-search" class="form-control" placeholder="Suche...">'; |
| 182 | + $html .= '<input type="text" id="cm-cookie-search" class="form-control" placeholder="Suche..." style="width: 200px;">'; |
174 | 183 | $html .= '<span class="input-group-addon"><i class="rex-icon rex-icon-search"></i></span>'; |
175 | 184 | $html .= '</div>'; |
| 185 | + $html .= '</div>'; |
176 | 186 |
|
177 | 187 | $html .= '<script nonce="' . rex_response::getNonce() . '"> |
178 | 188 | jQuery(function($) { |
|
184 | 194 | $checkboxes.first().closest(".rex-form-group").addClass("consent-manager-cookie-list"); |
185 | 195 | } |
186 | 196 | |
187 | | - // Toolbar Wrapper |
| 197 | + // Toolbar Wrapper finden |
188 | 198 | var $toolbar = $("#cm-cookie-toolbar"); |
189 | 199 | |
190 | | - // Optional: Label des Button-Containers leeren, falls vorhanden |
191 | | - $toolbar.closest(".rex-form-group").find("dt").html(" "); |
| 200 | + // Den zugehörigen Form-Group Container des Toolbars finden |
| 201 | + var $toolbarGroup = $toolbar.closest(".rex-form-group"); |
192 | 202 | |
| 203 | + // Label (dt) des Toolbars entfernen/verstecken für Full-Width Look |
| 204 | + $toolbarGroup.addClass("cm-toolbar-group"); |
| 205 | + $toolbarGroup.find("dt").html(" "); |
| 206 | +
|
193 | 207 | // Select All Handler |
194 | 208 | $toolbar.on("click", ".cm-select-all", function() { |
195 | 209 | $checkboxes.filter(":visible").prop("checked", true); |
|
219 | 233 | </script>'; |
220 | 234 |
|
221 | 235 | $html .= '<style nonce="' . rex_response::getNonce() . '"> |
| 236 | + /* Toolbar Row Styling */ |
| 237 | + .cm-toolbar-group { |
| 238 | + margin-bottom: 0 !important; |
| 239 | + border-bottom: 0 !important; |
| 240 | + } |
| 241 | + .cm-toolbar-group dd { |
| 242 | + padding-bottom: 5px; |
| 243 | + } |
| 244 | +
|
| 245 | + /* Cookie List Styling */ |
222 | 246 | .consent-manager-cookie-list .checkbox { |
223 | 247 | display: inline-block; |
224 | 248 | width: 49%; |
|
252 | 276 | } |
253 | 277 | } else { |
254 | 278 | if ([] !== $cookies) { |
| 279 | + $form->addFieldset(rex_i18n::msg('consent_manager_cookies')); |
| 280 | + |
255 | 281 | $checkboxes = []; |
256 | 282 | if (null !== $form->getSql()->getValue('cookie')) { |
257 | 283 | $checkedBoxes = array_filter(explode('|', (string) $form->getSql()->getValue('cookie')), static function ($value) { |
|
0 commit comments