Stop using deprecated HasAdmin() function
Cette révision appartient à :
Parent
14c6f7ca80
révision
28655df244
1 fichiers modifiés avec 44 ajouts et 15 suppressions
|
@ -52,7 +52,7 @@
|
|||
</tr>
|
||||
<tr class="torrent-info-row">
|
||||
<td class="torrent-info-td torrent-info-label">{{ T("size")}}:</td>
|
||||
<td class="torrent-view-td torrent-info-data">{{ fileSize(Torrent.Filesize, T, true) }}</td>
|
||||
<td class="torrent-view-td torrent-info-data torrent-info-size">{{ fileSize(Torrent.Filesize, T, true) }}</td>
|
||||
</tr>
|
||||
{{ if len(Torrent.Languages) > 0 && Torrent.Languages[0] != "" }}
|
||||
<tr class="torrent-info-row">
|
||||
|
@ -163,7 +163,7 @@
|
|||
</a>
|
||||
<a id="reportPopup" href="/report/{{Torrent.ID}}" class="form-input">{{ T("report_btn") }}</a>
|
||||
{{ if User.ID > 0}}
|
||||
{{ if User.HasAdmin()}}
|
||||
{{ if User.IsModerator()}}
|
||||
<form method="POST" action="/mod/torrent/delete" class="delete-form">
|
||||
{{ yield csrf_field()}}
|
||||
<input type="hidden" name="id" value="{{ Torrent.ID }}">
|
||||
|
@ -188,10 +188,14 @@
|
|||
<p>{{ T("no_description") }}</p>
|
||||
{{end}}
|
||||
<input type="checkbox" id="show-filelist" {{if len(Torrent.FileList) < 4 && len(Torrent.FileList) > 0}}checked{{end}}/>
|
||||
<label class="torrent-hr filelist-control{{if len(Torrent.FileList) == 0}} hidden{{end}}" for="show-filelist">{{ T("files")}}</label>
|
||||
<label class="torrent-hr filelist-control{{if len(Torrent.FileList) == 0}} hidden{{end}}" for="show-filelist">
|
||||
{{ if len(Torrent.FileList) == 0 }}
|
||||
<a href="/files/{{Torrent.ID}}">{{ T("files")}}</a>
|
||||
{{else}}
|
||||
{{ T("files")}}
|
||||
{{end}}
|
||||
</label>
|
||||
<div class="torrent-info-box{{if len(Torrent.FileList) == 0}} hidden{{end}}" id="filelist">
|
||||
{{ if len(Torrent.FileList) > 0 }}
|
||||
{* how do i concat lol *}
|
||||
<table class="table-filelist">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -200,12 +204,13 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ yield make_treeview(treeviewData=makeTreeViewData(RootFolder, 0, "root")) }}
|
||||
{{ if len(Torrent.FileList) > 0 }}
|
||||
{{ yield make_treeview(treeviewData=makeTreeViewData(RootFolder, 0, "root")) }}
|
||||
{{else}}
|
||||
<tr class="tr-filelist"><td colspan="2">{{ T("no_files") }}</td></tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{ else }}
|
||||
<p>{{ T("no_files") }}</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<p class="torrent-hr" id="comments">{{ T("comments")}}</p>
|
||||
|
@ -336,9 +341,36 @@ Modal.Init({
|
|||
// order of apparition of the modals
|
||||
button: ["#reportPopup", "#tagPopup"]
|
||||
});
|
||||
</script>
|
||||
|
||||
{{ if len(Torrent.FileList) == 0 }}
|
||||
var FileListContainer = document.querySelector("#filelist tbody"),
|
||||
FileListLabel = document.getElementsByClassName("filelist-control")[0],
|
||||
FileListOldHtml = FileListContainer.innerHTML
|
||||
|
||||
FileListLabel.innerHTML = FileListLabel.innerText
|
||||
|
||||
FileListLabel.addEventListener("click", function (e) {
|
||||
FileListContainer.innerHTML = "<tr class='tr-filelist'><td>{{T("loading_file_list")}}</td></tr>"
|
||||
Query.Get('/stats/{{Torrent.ID}}?files', function (data) {
|
||||
if(data.filelist != null) {
|
||||
FileListContainer.innerHTML = ""
|
||||
FileListLabel.style.opacity = 1
|
||||
document.getElementById("filelist").style.opacity = 1
|
||||
if(data.totalsize != "0.0 B") document.getElementsByClassName("torrent-info-size")[0].innerHTML = data.totalsize
|
||||
|
||||
for(var i = 0; i < data.filelist.length; i++) {
|
||||
var file = data.filelist[i]
|
||||
if(file.filesize == "0.0 B") file.filesize = "{{T("unknown")}}"
|
||||
FileListContainer.innerHTML = FileListContainer.innerHTML + '<tr class="tr-filelist '+ file.class +'"><td>'+ file.path +'</td><td>'+ file.filesize +'</td></tr>'
|
||||
}
|
||||
} else {
|
||||
FileListContainer.innerHTML = FileListOldHtml
|
||||
}
|
||||
})
|
||||
})
|
||||
{{end}}
|
||||
|
||||
{{ if !torrentFileExists(Torrent.Hash, Torrent.TorrentLink)}}
|
||||
<script type="text/javascript">
|
||||
var torrentLink = document.getElementById("torrent-download-link"),
|
||||
oldDownloadHtml = torrentLink.innerHTML,
|
||||
downloadIconHtml = torrentLink.innerHTML.substring(0, torrentLink.innerHTML.indexOf("</div>") + 6),
|
||||
|
@ -378,10 +410,8 @@ Modal.Init({
|
|||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{{end}}
|
||||
{{if Torrent.StatsObsolete[1] }}
|
||||
<script type="text/javascript">
|
||||
var seeders = document.querySelector(".tr-se"),
|
||||
leechers = document.querySelector(".tr-le"),
|
||||
downloads = document.querySelector(".tr-dl"),
|
||||
|
@ -408,9 +438,8 @@ Modal.Init({
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
{{end}}
|
||||
</script>
|
||||
{{ if User.ID > 0 }}
|
||||
<script type="text/javascript" src="{{ URL.Parse("/js/template.js") }}"></script>
|
||||
<script type="text/javascript" src="{{ URL.Parse("/js/modal.js") }}"></script>
|
||||
|
|
Référencer dans un nouveau ticket