{{define "title"}}Acceuil{{end}}
{{define "content"}}
	<h1>Espace utilisateur</h1>
	<h2>Documents</h2>
	{{if .Data.Error}}
	<p class="error">{{.Data.Error}}</p>
	{{end}}
	{{if ne .Data.UserImpersonation ""}}
	<form action="/upload?user={{.Data.UserImpersonation}}" method="POST" enctype="multipart/form-data">
	{{else}}
	<form action="/upload" method="POST" enctype="multipart/form-data">
	{{end}}
		<input type="file" name="files" multiple />
		<input type="submit" value="Upload" />
	</form>
	{{if ne .Data.UserImpersonation ""}}
	<form action="/download?user={{.Data.UserImpersonation}}" method="POST" class="inline">
	{{else}}
	<form action="/download" method="POST" class="inline">
	{{end}}
		<div class="docs">
		<table>
			<tr>
				<th></th>
				<th>Nom du fichier</th>
				<th>Date de modification</th>
				<th>Taille</th>
			</tr>
			{{range .Data.Docs}}
			<tr>
				<td>
					<input type="checkbox" name="selection" value="{{.Link}}">
				</td>
				<td class="filename">
					<a href="{{.Link}}">{{.Name}}</a>
				</td>
				<td>
					{{formatmodtime .ModTime}}
				</td>
				<td>
					{{.Size}}
				</td>
			</tr>
			{{end}}
		</table>
		</div>
		<br/>
		<input type="submit" value="Télécharger les fichiers sélectionnés">
	</form>
	<form action="/download" method="GET" class="inlineblk">
		<input type="hidden" name="user" id="userAll" value="{{.Data.UserImpersonation}}">
		<input type="submit" value="Télécharger tous les fichiers">
	</form>
{{end}}
