Skip to content

Commit a79703d

Browse files
committed
refactoring WebsiteComponents and updated global.css
1 parent a950b41 commit a79703d

4 files changed

Lines changed: 238 additions & 114 deletions

File tree

src/Website/CreateRole.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ protected static function buildCreateOrEditRoleTable(
9898
?Role $role = null,
9999
): \DOMElement {
100100
$table = $dom->createElement('table');
101+
$table->setAttribute('class', 'form-table');
101102
$tBody = $dom->createElement('tbody');
102103

103104
$rolename = !is_null($role)
@@ -115,10 +116,9 @@ protected static function buildCreateOrEditRoleTable(
115116
'content' => $rolename,
116117
'max-length' => 63,
117118
'readonly' => !is_null($role),
118-
'type' => 'text',
119119
],
120120
];
121-
$trName = WebsiteComponents::buildTableRowForFormular($dom, $nameSpecs);
121+
$trName = WebsiteComponents::buildTableRowForInputFormular($dom, $nameSpecs);
122122

123123
$passwordSpecs = [
124124
'id' => Role::FORM_ID_PASSWORD,
@@ -128,7 +128,7 @@ protected static function buildCreateOrEditRoleTable(
128128
'type' => 'password',
129129
],
130130
];
131-
$trPassword = WebsiteComponents::buildTableRowForFormular($dom, $passwordSpecs);
131+
$trPassword = WebsiteComponents::buildTableRowForInputFormular($dom, $passwordSpecs);
132132

133133
$confirmPasswordSpecs = [
134134
'id' => Role::FORM_ID_PASSWORD_CONFIRMATION,
@@ -138,7 +138,7 @@ protected static function buildCreateOrEditRoleTable(
138138
'type' => 'password',
139139
],
140140
];
141-
$trConfirm = WebsiteComponents::buildTableRowForFormular($dom, $confirmPasswordSpecs);
141+
$trConfirm = WebsiteComponents::buildTableRowForInputFormular($dom, $confirmPasswordSpecs);
142142

143143
$isSuperuserSpecs = [
144144
'id' => 'formSuper',
@@ -148,7 +148,7 @@ protected static function buildCreateOrEditRoleTable(
148148
'type' => 'bool',
149149
],
150150
];
151-
$trSuperuser = WebsiteComponents::buildTableRowForFormular($dom, $isSuperuserSpecs);
151+
$trSuperuser = WebsiteComponents::buildTableRowForCheckboxFormular($dom, $isSuperuserSpecs);
152152

153153
$canCreateDbSpecs = [
154154
'id' => 'formCreateDB',
@@ -158,7 +158,7 @@ protected static function buildCreateOrEditRoleTable(
158158
'type' => 'bool',
159159
],
160160
];
161-
$trCreateDb = WebsiteComponents::buildTableRowForFormular($dom, $canCreateDbSpecs);
161+
$trCreateDb = WebsiteComponents::buildTableRowForCheckboxFormular($dom, $canCreateDbSpecs);
162162

163163
$canCeateRoleSpecs = [
164164
'id' => 'formCreateRole',
@@ -168,7 +168,7 @@ protected static function buildCreateOrEditRoleTable(
168168
'type' => 'bool',
169169
],
170170
];
171-
$trCreateRole = WebsiteComponents::buildTableRowForFormular($dom, $canCeateRoleSpecs);
171+
$trCreateRole = WebsiteComponents::buildTableRowForCheckboxFormular($dom, $canCeateRoleSpecs);
172172

173173
$inheritsSpecs = [
174174
'id' => 'formInherits',
@@ -178,7 +178,7 @@ protected static function buildCreateOrEditRoleTable(
178178
'type' => 'bool',
179179
],
180180
];
181-
$trInherits = WebsiteComponents::buildTableRowForFormular($dom, $inheritsSpecs);
181+
$trInherits = WebsiteComponents::buildTableRowForCheckboxFormular($dom, $inheritsSpecs);
182182

183183
$canLoginSpecs = [
184184
'id' => 'formCanLogin',
@@ -188,7 +188,7 @@ protected static function buildCreateOrEditRoleTable(
188188
'type' => 'bool',
189189
],
190190
];
191-
$trCanLogin = WebsiteComponents::buildTableRowForFormular($dom, $canLoginSpecs);
191+
$trCanLogin = WebsiteComponents::buildTableRowForCheckboxFormular($dom, $canLoginSpecs);
192192

193193
$maxConnectionsSpecs = [
194194
'id' => 'formConnLimit',
@@ -198,7 +198,7 @@ protected static function buildCreateOrEditRoleTable(
198198
'type' => 'number',
199199
],
200200
];
201-
$trMaxConnections = WebsiteComponents::buildTableRowForFormular($dom, $maxConnectionsSpecs);
201+
$trMaxConnections = WebsiteComponents::buildTableRowForInputFormular($dom, $maxConnectionsSpecs);
202202

203203
$expiresSpecs = [
204204
'id' => 'formExpires',
@@ -208,7 +208,7 @@ protected static function buildCreateOrEditRoleTable(
208208
'type' => 'datetime-local',
209209
],
210210
];
211-
$trExpires = WebsiteComponents::buildTableRowForFormular($dom, $expiresSpecs);
211+
$trExpires = WebsiteComponents::buildTableRowForInputFormular($dom, $expiresSpecs);
212212

213213
$serverSession = ServerSession::fromServerId($serverId, Config::getServers());
214214
$db = PhpPgAdminConnection::createFromServerSession($serverSession);
@@ -234,33 +234,30 @@ protected static function buildCreateOrEditRoleTable(
234234
'label-text' => _('Member of'),
235235
'value' => [
236236
'selected-values' => $currentMembersOf,
237-
'selection-values' => $membersSelectionValues,
238-
'type' => 'selection',
237+
'values' => $membersSelectionValues,
239238
],
240239
];
241-
$trMemberOf = WebsiteComponents::buildTableRowForFormular($dom, $memberOfSpecs);
240+
$trMemberOf = WebsiteComponents::buildTableRowForSelectionFormular($dom, $memberOfSpecs);
242241

243242
$membersSpecs = [
244243
'id' => 'members[]',
245244
'label-text' => _('Members'),
246245
'value' => [
247246
'selected-values' => $currentMembers,
248-
'selection-values' => $membersSelectionValues,
249-
'type' => 'selection',
247+
'values' => $membersSelectionValues,
250248
],
251249
];
252-
$trMembers = WebsiteComponents::buildTableRowForFormular($dom, $membersSpecs);
250+
$trMembers = WebsiteComponents::buildTableRowForSelectionFormular($dom, $membersSpecs);
253251

254252
$adminMembersSpecs = [
255253
'id' => 'adminmembers[]',
256254
'label-text' => _('Admin members'),
257255
'value' => [
258256
'selected-values' => $currentAdminMembers,
259-
'selection-values' => $membersSelectionValues,
260-
'type' => 'selection',
257+
'values' => $membersSelectionValues,
261258
],
262259
];
263-
$trAdminMembers = WebsiteComponents::buildTableRowForFormular($dom, $adminMembersSpecs);
260+
$trAdminMembers = WebsiteComponents::buildTableRowForSelectionFormular($dom, $adminMembersSpecs);
264261

265262
$tBody->appendChild($trName);
266263
$tBody->appendChild($trPassword);

src/Website/CreateTablespace.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ protected static function buildCreateOrEditTablespaceTable(
115115
?Tablespace $tablespace = null,
116116
): \DOMElement {
117117
$table = $dom->createElement('table');
118+
$table->setAttribute('class', 'form-table');
118119
$tBody = $dom->createElement('tbody');
119120

120121
$tablespaceName = '';
@@ -136,11 +137,9 @@ protected static function buildCreateOrEditTablespaceTable(
136137
'content' => $tablespaceName,
137138
'max-length' => 63,
138139
'required' => true,
139-
'size' => 32,
140-
'type' => 'text',
141140
],
142141
];
143-
$trName = WebsiteComponents::buildTableRowForFormular($dom, $nameSpecs);
142+
$trName = WebsiteComponents::buildTableRowForInputFormular($dom, $nameSpecs);
144143

145144
$serverSession = ServerSession::fromServerId($serverId, Config::getServers());
146145
$db = PhpPgAdminConnection::createFromServerSession($serverSession);
@@ -164,14 +163,13 @@ protected static function buildCreateOrEditTablespaceTable(
164163
'id' => Tablespace::FORM_ID_OWNER,
165164
'label-text' => _('Owner'),
166165
'value' => [
166+
'is-multiple' => false,
167167
'required' => true,
168168
'selected-values' => $ownerSelectedValues,
169-
'selection-is-multiple' => false,
170-
'selection-values' => $ownerSelectionValues,
171-
'type' => 'selection',
169+
'values' => $ownerSelectionValues,
172170
],
173171
];
174-
$trOwner = WebsiteComponents::buildTableRowForFormular($dom, $ownerSpecs);
172+
$trOwner = WebsiteComponents::buildTableRowForSelectionFormular($dom, $ownerSpecs);
175173

176174
$locationSpecs = [
177175
'id' => Tablespace::FORM_ID_LOCATION,
@@ -180,23 +178,20 @@ protected static function buildCreateOrEditTablespaceTable(
180178
'content' => $tablespaceLocation,
181179
'readonly' => !is_null($tablespace),
182180
'required' => true,
183-
'size' => 32,
184-
'type' => 'text',
185181
],
186182
];
187-
$trLocation = WebsiteComponents::buildTableRowForFormular($dom, $locationSpecs);
183+
$trLocation = WebsiteComponents::buildTableRowForInputFormular($dom, $locationSpecs);
188184

189185
$commentSpecs = [
190186
'id' => Tablespace::FORM_ID_COMMENT,
191187
'label-text' => _('Comment'),
192188
'value' => [
189+
'cols' => 32,
193190
'content' => $tablespaceComment,
194191
'rows' => 3,
195-
'size' => 32,
196-
'type' => 'textarea',
197192
],
198193
];
199-
$trComment = WebsiteComponents::buildTableRowForFormular($dom, $commentSpecs);
194+
$trComment = WebsiteComponents::buildTableRowForTextareaFormular($dom, $commentSpecs);
200195

201196
$tBody->appendChild($trName);
202197
$tBody->appendChild($trOwner);

0 commit comments

Comments
 (0)