Skip to content

Commit ac2802b

Browse files
authored
Refactor nameserver fields (hestiacp#4153)
1 parent 6c31fd9 commit ac2802b

File tree

6 files changed

+25
-152
lines changed

6 files changed

+25
-152
lines changed

web/css/src/utilities.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
user-select: none !important;
2424
}
2525

26+
.u-button-reset {
27+
border: 0 !important;
28+
padding: 0 !important;
29+
background-color: transparent !important;
30+
}
31+
2632
.u-text-right {
2733
text-align: right !important;
2834
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$nsValues = ['v_ns3', 'v_ns4', 'v_ns5', 'v_ns6', 'v_ns7', 'v_ns8'];
3+
foreach ($nsValues as $nsValue) {
4+
if ($$nsValue) {
5+
?>
6+
<div class="u-side-by-side u-mb5">
7+
<input type="text" class="form-control" name="<?php echo $nsValue; ?>" value="<?php echo htmlentities(trim($$nsValue, "'")); ?>">
8+
<button type="button" class="u-button-reset u-ml10 js-remove-ns" title="<?= _("Remove") ?>">
9+
<i class="fas fa-trash icon-dim icon-red"></i>
10+
</button>
11+
</div>
12+
<?php
13+
}
14+
}
15+
?>

web/templates/pages/add_dns.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -115,44 +115,7 @@
115115
<div class="u-mb5">
116116
<input type="text" class="form-control" name="v_ns2" value="<?= htmlentities(trim($v_ns2, "'")) ?>">
117117
</div>
118-
<?php
119-
if ($v_ns3) {
120-
echo '<div class="u-side-by-side u-mb5">
121-
<input type="text" class="form-control" name="v_ns3" value="' . htmlentities(trim($v_ns3, "'")) . '">
122-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
123-
</div>';
124-
}
125-
if ($v_ns4) {
126-
echo '<div class="u-side-by-side u-mb5">
127-
<input type="text" class="form-control" name="v_ns4" value="' . htmlentities(trim($v_ns4, "'")) . '">
128-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
129-
</div>';
130-
}
131-
if ($v_ns5) {
132-
echo '<div class="u-side-by-side u-mb5">
133-
<input type="text" class="form-control" name="v_ns5" value="' . htmlentities(trim($v_ns5, "'")) . '">
134-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
135-
</div>';
136-
}
137-
if ($v_ns6) {
138-
echo '<div class="u-side-by-side u-mb5">
139-
<input type="text" class="form-control" name="v_ns6" value="' . htmlentities(trim($v_ns6, "'")) . '">
140-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
141-
</div>';
142-
}
143-
if ($v_ns7) {
144-
echo '<div class="u-side-by-side u-mb5">
145-
<input type="text" class="form-control" name="v_ns7" value="' . htmlentities(trim($v_ns7, "'")) . '">
146-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
147-
</div>';
148-
}
149-
if ($v_ns8) {
150-
echo '<div class="u-side-by-side u-mb5">
151-
<input type="text" class="form-control" name="v_ns8" value="' . htmlentities(trim($v_ns8, "'")) . '">
152-
<span class="form-link form-link-danger u-ml10 js-remove-ns">' . _('Delete') . '</span>
153-
</div>';
154-
}
155-
?>
118+
<?php require $_SERVER["HESTIA"] . "/web/templates/includes/extra-ns-fields.php"; ?>
156119
<button type="button" class="form-link u-mt20 js-add-ns" <?php if ($v_ns8) echo 'style="display:none;"'; ?>>
157120
<?= _("Add Name Server") ?>
158121
</button>

web/templates/pages/add_package.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -186,44 +186,7 @@
186186
<div class="u-mb5">
187187
<input type="text" class="form-control" name="v_ns2" value="<?= htmlentities(trim($v_ns2, "'")) ?>">
188188
</div>
189-
<?php
190-
if ($v_ns3) {
191-
echo '<div class="u-side-by-side u-mb5">
192-
<input type="text" class="form-control" name="v_ns3" value="'.htmlentities(trim($v_ns3, "'")).'">
193-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
194-
</div>';
195-
}
196-
if ($v_ns4) {
197-
echo '<div class="u-side-by-side u-mb5">
198-
<input type="text" class="form-control" name="v_ns4" value="'.htmlentities(trim($v_ns4, "'")).'">
199-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
200-
</div>';
201-
}
202-
if ($v_ns5) {
203-
echo '<div class="u-side-by-side u-mb5">
204-
<input type="text" class="form-control" name="v_ns5" value="'.htmlentities(trim($v_ns5, "'")).'">
205-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
206-
</div>';
207-
}
208-
if ($v_ns6) {
209-
echo '<div class="u-side-by-side u-mb5">
210-
<input type="text" class="form-control" name="v_ns6" value="'.htmlentities(trim($v_ns6, "'")).'">
211-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
212-
</div>';
213-
}
214-
if ($v_ns7) {
215-
echo '<div class="u-side-by-side u-mb5">
216-
<input type="text" class="form-control" name="v_ns7" value="'.htmlentities(trim($v_ns7, "'")).'">
217-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
218-
</div>';
219-
}
220-
if ($v_ns8) {
221-
echo '<div class="u-side-by-side u-mb5">
222-
<input type="text" class="form-control" name="v_ns8" value="'.htmlentities(trim($v_ns8, "'")).'">
223-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
224-
</div>';
225-
}
226-
?>
189+
<?php require $_SERVER["HESTIA"] . "/web/templates/includes/extra-ns-fields.php"; ?>
227190
<button type="button" class="form-link u-mt20 js-add-ns" <?php if ($v_ns8) echo 'style="display:none;"'; ?>>
228191
<?= _("Add Name Server") ?>
229192
</button>

web/templates/pages/edit_package.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -191,44 +191,7 @@ class="<?= $v_status ?>"
191191
<div class="u-mb5">
192192
<input type="text" class="form-control" name="v_ns2" value="<?= htmlentities(trim($v_ns2, "'")) ?>">
193193
</div>
194-
<?php
195-
if ($v_ns3) {
196-
echo '<div class="u-side-by-side u-mb5">
197-
<input type="text" class="form-control" name="v_ns3" value="'.htmlentities(trim($v_ns3, "'")).'">
198-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
199-
</div>';
200-
}
201-
if ($v_ns4) {
202-
echo '<div class="u-side-by-side u-mb5">
203-
<input type="text" class="form-control" name="v_ns4" value="'.htmlentities(trim($v_ns4, "'")).'">
204-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
205-
</div>';
206-
}
207-
if ($v_ns5) {
208-
echo '<div class="u-side-by-side u-mb5">
209-
<input type="text" class="form-control" name="v_ns5" value="'.htmlentities(trim($v_ns5, "'")).'">
210-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
211-
</div>';
212-
}
213-
if ($v_ns6) {
214-
echo '<div class="u-side-by-side u-mb5">
215-
<input type="text" class="form-control" name="v_ns6" value="'.htmlentities(trim($v_ns6, "'")).'">
216-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
217-
</div>';
218-
}
219-
if ($v_ns7) {
220-
echo '<div class="u-side-by-side u-mb5">
221-
<input type="text" class="form-control" name="v_ns7" value="'.htmlentities(trim($v_ns7, "'")).'">
222-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
223-
</div>';
224-
}
225-
if ($v_ns8) {
226-
echo '<div class="u-side-by-side u-mb5">
227-
<input type="text" class="form-control" name="v_ns8" value="'.htmlentities(trim($v_ns8, "'")).'">
228-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
229-
</div>';
230-
}
231-
?>
194+
<?php require $_SERVER["HESTIA"] . "/web/templates/includes/extra-ns-fields.php"; ?>
232195
<button type="button" class="form-link u-mt20 js-add-ns" <?php if ($v_ns8) echo 'style="display:none;"'; ?>>
233196
<?= _("Add Name Server") ?>
234197
</button>

web/templates/pages/edit_user.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -248,44 +248,7 @@ class="<?= $v_status ?>"
248248
<div class="u-mb5">
249249
<input type="text" class="form-control" name="v_ns2" value="<?= htmlentities(trim($v_ns2, "'")) ?>">
250250
</div>
251-
<?php
252-
if ($v_ns3) {
253-
echo '<div class="u-side-by-side u-mb5">
254-
<input type="text" class="form-control" name="v_ns3" value="'.htmlentities(trim($v_ns3, "'")).'">
255-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
256-
</div>';
257-
}
258-
if ($v_ns4) {
259-
echo '<div class="u-side-by-side u-mb5">
260-
<input type="text" class="form-control" name="v_ns4" value="'.htmlentities(trim($v_ns4, "'")).'">
261-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
262-
</div>';
263-
}
264-
if ($v_ns5) {
265-
echo '<div class="u-side-by-side u-mb5">
266-
<input type="text" class="form-control" name="v_ns5" value="'.htmlentities(trim($v_ns5, "'")).'">
267-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
268-
</div>';
269-
}
270-
if ($v_ns6) {
271-
echo '<div class="u-side-by-side u-mb5">
272-
<input type="text" class="form-control" name="v_ns6" value="'.htmlentities(trim($v_ns6, "'")).'">
273-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
274-
</div>';
275-
}
276-
if ($v_ns7) {
277-
echo '<div class="u-side-by-side u-mb5">
278-
<input type="text" class="form-control" name="v_ns7" value="'.htmlentities(trim($v_ns7, "'")).'">
279-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
280-
</div>';
281-
}
282-
if ($v_ns8) {
283-
echo '<div class="u-side-by-side u-mb5">
284-
<input type="text" class="form-control" name="v_ns8" value="'.htmlentities(trim($v_ns8, "'")).'">
285-
<span class="u-ml10 js-remove-ns"><i class="fas fa-trash icon-dim icon-red"></i></span>
286-
</div>';
287-
}
288-
?>
251+
<?php require $_SERVER["HESTIA"] . "/web/templates/includes/extra-ns-fields.php"; ?>
289252
<button type="button" class="form-link u-mt20 js-add-ns" <?php if ($v_ns8) echo 'style="display:none;"'; ?>>
290253
<?= _("Add Name Server") ?>
291254
</button>

0 commit comments

Comments
 (0)