Skip to content

Commit ed625a1

Browse files
author
Till Brehm
committed
Merge branch '6645-more-delete-buttons' into 'develop'
Resolve "Delete button on Web Domain and SOA edit form" Closes #6645 See merge request ispconfig/ispconfig3!1851
2 parents 329b30d + 0b92768 commit ed625a1

File tree

7 files changed

+37
-2
lines changed

7 files changed

+37
-2
lines changed

install/tpl/system.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ session_timeout=0
7575
session_allow_endless=0
7676
min_password_length=8
7777
min_password_strength=3
78+
show_delete_on_forms=n

interface/web/client/domain_edit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ function onShowEnd() {
130130

131131
$app->tpl->setVar($wb);
132132

133+
$csrf_token = $app->auth->csrf_token_get('_domain_del');
134+
$app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']);
135+
$app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']);
136+
137+
$global_config = $app->getconf->get_global_config();
138+
$app->tpl->setVar('show_delete_on_forms', $global_config['misc']['show_delete_on_forms']);
139+
133140
parent::onShowEnd();
134141
}
135142

interface/web/client/templates/domain_edit.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
<input type="hidden" name="id" value="{tmpl_var name='id'}">
2020
<input type="hidden" name="type" value="local">
2121

22-
<div class="clear"><div class="right">
22+
<div class="clear">
23+
<tmpl_if name='id'><tmpl_if name='show_delete_on_forms' op="==" value="y">
24+
<a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('client/domain_del.php?id={tmpl_var name='id'}&_csrf_id={tmpl_var name='_csrf_id'}&_csrf_key={tmpl_var name='_csrf_key'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
25+
</tmpl_if></tmpl_if>
26+
<div class="right">
2327
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="client/domain_edit.php">{tmpl_var name='btn_save_txt'}</button>
2428
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="client/domain_list.php">{tmpl_var name='btn_cancel_txt'}</button>
2529
</div></div>

interface/web/dns/dns_soa_edit.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ function onShowEnd() {
227227
}
228228
}
229229

230+
$csrf_token = $app->auth->csrf_token_get('dns_soa_del');
231+
$app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']);
232+
$app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']);
233+
234+
$global_config = $app->getconf->get_global_config();
235+
$app->tpl->setVar('show_delete_on_forms', $global_config['misc']['show_delete_on_forms']);
236+
237+
230238
} else {
231239
$app->tpl->setVar("edit_disabled", 0);
232240
}

interface/web/dns/templates/dns_soa_edit.htm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@
173173
<input type="hidden" name="id" value="{tmpl_var name='id'}">
174174
<input name="serial" type="hidden" value="{tmpl_var name='serial'}">
175175
<div class="clear">
176+
<tmpl_if name='id'><tmpl_if name='show_delete_on_forms' op="==" value="y">
177+
<a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('dns/dns_soa_del.php?id={tmpl_var name='id'}&_csrf_id={tmpl_var name='_csrf_id'}&_csrf_key={tmpl_var name='_csrf_key'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name
178+
='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
179+
</tmpl_if></tmpl_if>
176180
<div class="right">
177181
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="dns/dns_soa_edit.php">{tmpl_var name='btn_save_txt'}</button>
178182
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="dns/dns_soa_list.php">{tmpl_var name='btn_cancel_txt'}</button>

interface/web/sites/templates/web_vhost_domain_edit.htm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@
278278

279279
<input type="hidden" name="id" value="{tmpl_var name='id'}">
280280

281-
<div class="clear"><div class="right">
281+
<div class="clear">
282+
<tmpl_if name='id'><tmpl_if name='show_delete_on_forms' op="==" value="y">
283+
<a class="btn btn-default formbutton-danger formbutton-narrow" href="javascript: ISPConfig.confirm_action('sites/web_vhost_domain_del.php?id={tmpl_var name='id'}&_csrf_id={tmpl_var name='_csrf_id'}&_csrf_key={tmpl_var name='_csrf_key'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span class="icon icon-delete"></span></a>
284+
</tmpl_if></tmpl_if>
285+
<div class="right">
282286
<button id="dom-edit-submit" class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}">{tmpl_var name='btn_save_txt'}</button>
283287
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="sites/web_vhost_domain_list.php">{tmpl_var name='btn_cancel_txt'}</button>
284288
</div></div>

interface/web/sites/web_vhost_domain_edit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,13 @@ function onShowEnd() {
843843
$app->tpl->setVar('is_pagespeed_enabled', ($web_config['nginx_enable_pagespeed']));
844844
}
845845

846+
$csrf_token = $app->auth->csrf_token_get('web_vhost_domain_del');
847+
$app->tpl->setVar('_csrf_id', $csrf_token['csrf_id']);
848+
$app->tpl->setVar('_csrf_key', $csrf_token['csrf_key']);
849+
850+
$global_config = $app->getconf->get_global_config();
851+
$app->tpl->setVar('show_delete_on_forms', $global_config['misc']['show_delete_on_forms']);
852+
846853
$app->tpl->setVar('app_module', 'sites');
847854

848855
parent::onShowEnd();

0 commit comments

Comments
 (0)