Add new purge contacts option to admin server blocklist

- Move adding a server domain pattern to the blocklist in a separate module to allow reviewing the list of known servers that would be affected
This commit is contained in:
Hypolite Petovan 2021-10-16 19:18:11 -04:00
commit 41062eb7e4
7 changed files with 311 additions and 131 deletions

View file

@ -0,0 +1,56 @@
<div id="adminpage">
<p><a href="{{$baseurl}}/admin/blocklist/server">{{$l10n.return_list}}</a></p>
<h1>{{$l10n.title}} - {{$l10n.page}}</h1>
{{$l10n.syntax nofilter}}
<form action="{{$baseurl}}/admin/blocklist/server/add" method="get">
{{include file="field_input.tpl" field=$newdomain}}
<div class="submit">
<button type="submit" class="btn btn-primary">{{$l10n.submit}}</button>
</div>
</form>
{{if $pattern}}
<h2>{{$l10n.matching_servers}}</h2>
<form action="{{$baseurl}}/admin/blocklist/server/add" method="post">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<input type="hidden" name="pattern" value="{{$pattern}}">
<table class="table table-condensed table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>{{$l10n.server_name}}</th>
<th>{{$l10n.server_domain}}</th>
<th>{{$l10n.known_contacts}}</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">{{$l10n.server_count}}</td>
</tr>
</tfoot>
<tbody>
{{foreach $gservers as $gserver}}
<tr>
<td class="text-center">
<span class="network-label icon" alt="{{$gserver.network_name}}" title="{{$gserver.network_name}}">
<i class="fa fa-{{$gserver.network_icon}}"></i>
</span>
</td>
<th>{{$gserver.site_name|default:$gserver.domain}}</th>
<td>
<a href="{{$gserver.url}}" target="_blank" rel="noreferrer noopener">{{$gserver.domain}} <i class="fa fa-external-link"></i></a>
</td>
<td class="text-right">{{$gserver.contacts}} <i class="fa fa-user"></i></td>
</tr>
{{/foreach}}
</tbody>
</table>
{{include file="field_checkbox.tpl" field=$newpurge}}
{{include file="field_input.tpl" field=$newreason}}
<div class="submit">
<button type="submit" class="btn btn-primary" name="page_blocklist_add" value="{{$l10n.add_pattern}}">{{$l10n.add_pattern}}</button>
</div>
</form>
{{/if}}
</div>

View file

@ -1,27 +1,24 @@
<script>
function confirm_delete(uname){
return confirm("{{$confirm_delete}}".format(uname));
return confirm("{{$l10n.confirm_delete}}".format(uname));
}
</script>
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<p>{{$intro}}</p>
<p>{{$public nofilter}}</p>
{{$syntax nofilter}}
<h1>{{$l10n.title}} - {{$l10n.page}}</h1>
<p>{{$l10n.intro}}</p>
<p>{{$l10n.public nofilter}}</p>
{{$l10n.syntax nofilter}}
<h2>{{$addtitle}}</h2>
<form action="{{$baseurl}}/admin/blocklist/server" method="post">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<h2>{{$l10n.addtitle}}</h2>
<form action="{{$baseurl}}/admin/blocklist/server/add" method="get">
{{include file="field_input.tpl" field=$newdomain}}
{{include file="field_input.tpl" field=$newreason}}
<div class="submit">
<button type="submit" class="btn btn-primary" name="page_blocklist_save" value="{{$submit}}">{{$submit}}</button>
<button type="submit" class="btn btn-primary">{{$l10n.submit}}</button>
</div>
</form>
{{if $entries}}
<h2>{{$currenttitle}}</h2>
<p>{{$currentintro}}</p>
<h2>{{$l10n.currenttitle}}</h2>
<form action="{{$baseurl}}/admin/blocklist/server" method="post">
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
{{foreach $entries as $e}}
@ -30,7 +27,7 @@
{{include file="field_checkbox.tpl" field=$e.delete}}
{{/foreach}}
<div class="submit">
<button type="submit" class="btn btn-primary" name="page_blocklist_edit" value="{{$savechanges}}">{{$savechanges}}</button>
<button type="submit" class="btn btn-primary" name="page_blocklist_edit" value="{{$l10n.savechanges}}">{{$l10n.savechanges}}</button>
</div>
{{/if}}
</form>