1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-27 15:26:25 -07:00
gochan/templates/manage_filebans.html

95 lines
No EOL
4.3 KiB
HTML

<div id="fileban-tabs">
<ul>
<li><a href="#filename-bans">Filename bans</a></li>
<li><a href="#checksum-bans">File checksum bans</a></li>
</ul>
<div id="filename-bans">
<h2>Create new filename ban</h2>
<form id="filenamebanform" action="{{webPath "manage/filebans"}}" method="POST">
<input type="hidden" name="bantype" value="filename">
<table>
<tr><td>Filename:</td><td><input type="text" name="filename" id="filename"></td></tr>
<tr><td>Regular expression</td><td><input type="checkbox" name="isregex" id="isregex"/></td></tr>
<tr><td>Board:</td><td><select name="boardid" id="boardid">
<option value="0">All boards</option>
{{- range $b, $board := $.allBoards -}}
<option value="{{$board.ID}}" {{if eq (dereference $.ban.BoardID) $board.ID}}selected{{end}}>/{{$board.Dir}}/ - {{$board.Title}}</option>
{{- end -}}
</select></td></tr>
<tr><td>Staff:</td><td>{{.currentStaff}}</td></tr>
<tr><td>Staff note:</td><td>
<textarea name="staffnote" id="staffnote" cols="30" rows="4"></textarea>
</td></tr>
</table>
<input type="submit" name="dofilenameban" value="Create"/>
<input type="button" onclick="document.getElementById('filenamebanform').reset()" value="Cancel"/>
</form><hr/>
<h2>Current filename bans</h2>
{{- if eq 0 (len .filenameBans)}}<i>No filename bans</i>{{else -}}
<table class="mgmt-table">
<tr><th>Filename</th><th>Regular expression</th><th>Board</th><th>Staff</th><th>Staff note</th><th>Action</th></tr>
{{range $b,$ban := .filenameBans}}
<tr>
<td>{{$ban.Filename}}</td>
<td>{{$ban.IsRegex}}</td>
<td>{{$uri := (intPtrToBoardDir $ban.BoardID "" "?")}}{{if eq $uri ""}}<i>All boards</i>{{else}}/{{$uri}}/{{end}}</td>
<td>{{$staff := (getStaffNameFromID $ban.StaffID)}}{{if eq $staff ""}}<i>?</i>{{else}}{{$staff}}{{end}}</td>
<td>{{$ban.StaffNote}}</td>
<td><a href="{{webPath "manage/filebans"}}?delfnb={{$ban.ID}}">Delete</a></td>
</tr>
{{end -}}
</table>
{{- end -}}
</div>
<div id="checksum-bans">
<h2>Create new file checksum ban</h2>
<form id="checksumbanform" action="{{webPath `manage/filebans`}}#checksum-bans" method="POST">
<input type="hidden" name="bantype" value="checksum">
<table>
<tr><td>Checksum</td><td><input type="text" name="checksum"></td></tr>
<tr><td>Board</td><td><select name="boardid" id="boardid">
<option value="0">All boards</option>
{{- range $b, $board := $.allBoards -}}
<option value="{{$board.ID}}" {{if eq (dereference $.ban.BoardID) $board.ID}}selected{{end}}>/{{$board.Dir}}/ - {{$board.Title}}</option>
{{- end -}}
</select></td></tr>
<tr><td>Staff:</td><td>{{.currentStaff}}</td></tr>
<tr><td>Mode:</td><td><select name="fingerprinter">
<option value="checksum">Checksum</option>
<option value="ahash">ahash (image fingerprint)</option>
</select></td></tr>
<tr>
<td>Ban on attempt: <sup title="If checked, anyone who attempts to post an image matching this checksum will be auto-banned">?</sup></td>
<td><input type="checkbox" name="ban" id="ban"></td>
</tr>
<tr>
<td>Ban message</td>
<td><textarea name="banmsg" id="banmsg" cols="30" rows="4" placeholder="Required if 'Ban on attempt' is checked"></textarea></td>
</tr>
<tr><td>Staff note:</td><td>
<textarea name="staffnote" id="staffnote" cols="30" rows="4"></textarea>
</td></tr>
</table>
<input type="submit" name="dochecksumban" value="Create"/>
<input type="button" onclick="document.getElementById('checksumbanform').reset()" value="Cancel"/>
</form><hr/>
<h2>Current file checksum bans</h2>
{{- if eq 0 (len .checksumBans)}}<i>No file checksum bans</i>{{else -}}
<table class="mgmt-table">
<tr><th>Checksum</th><th>Board</th><th>Staff</th><th>Staff note</th><th>Fingerprinter</th><th>Ban IP</th><th>Ban IP message</th><th>Action</th></tr>
{{range $b,$ban := .checksumBans}}
<tr>
<td>{{$ban.Checksum}}</td>
<td>{{$uri := (intPtrToBoardDir $ban.BoardID "" "?")}}{{if eq $uri ""}}<i>All boards</i>{{else}}/{{$uri}}/{{end}}</td>
<td>{{$staff := (getStaffNameFromID $ban.StaffID)}}{{if eq $staff ""}}<i>?</i>{{else}}{{$staff}}{{end}}</td>
<td>{{$ban.StaffNote}}</td>
<td>{{if eq $ban.Fingerprinter nil}}No{{else}}Yes{{end}}</td>
<td>{{if $ban.BanIP}}Yes{{else}}No{{end}}</td>
<td>{{if eq $ban.BanIPMessage nil}}<i>N/A</i>{{else}}{{$ban.BanIPMessage}}{{end}} </td>
<td><a href="{{webPath "manage/filebans"}}?delcsb={{$ban.ID}}#checksum-bans">Delete</a></td>
</tr>
{{- end -}}
</table>
{{end}}
</div>
</div>