mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-04-10 14:06:41 +00:00
Translated to french and bugfixes
This commit is contained in:
parent
3b2d2bdd8d
commit
f76c935c49
@ -25,6 +25,9 @@ bcrypt_rounds = 14
|
||||
# sqlite3 database path
|
||||
db_path = "./local_storage.db"
|
||||
|
||||
# Set to true to allow guests to search any directory
|
||||
allow_guests = False
|
||||
|
||||
try:
|
||||
import cairosvg
|
||||
cairosvg = True
|
||||
|
@ -23,7 +23,7 @@ class Indexer:
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
||||
time.sleep(15)
|
||||
time.sleep(25)
|
||||
|
||||
if self.es.indices.exists(self.index_name):
|
||||
print("Index is already setup")
|
||||
|
164
run.py
164
run.py
@ -38,19 +38,16 @@ def get_dir_size(path):
|
||||
def user_manage(user):
|
||||
|
||||
if "admin" in session and session["admin"]:
|
||||
pass
|
||||
return render_template("user_manage.html", directories=storage.dirs(), user=storage.users()[user])
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
return user
|
||||
|
||||
|
||||
@app.route("/logout")
|
||||
def logout():
|
||||
session.pop("username")
|
||||
session.pop("admin")
|
||||
flash("Successfully logged out", "success")
|
||||
flash("Déconnection réussie", "success")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -63,9 +60,9 @@ def login():
|
||||
session["username"] = username
|
||||
session["admin"] = storage.users()[username].admin
|
||||
|
||||
flash("Successfully logged in", "success")
|
||||
flash("Connexion réussie", "success")
|
||||
else:
|
||||
flash("Invalid username or password", "danger")
|
||||
flash("Nom d'utilisateur ou mot de passe invalide", "danger")
|
||||
|
||||
return redirect("/")
|
||||
|
||||
@ -83,10 +80,50 @@ def user_page():
|
||||
if not admin_account_present or ("admin" in session and session["admin"]):
|
||||
return render_template("user.html", users=storage.users(), admin_account_present=admin_account_present)
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.route("/user/<username>/set_access")
|
||||
def user_set_access(username):
|
||||
|
||||
if "admin" in session and session["admin"]:
|
||||
dir_id = request.args["dir_id"]
|
||||
user = storage.users()[username]
|
||||
|
||||
if request.args["access"] == "1":
|
||||
user.readable_directories.add(int(dir_id))
|
||||
else:
|
||||
if int(dir_id) in user.readable_directories:
|
||||
user.readable_directories.remove(int(dir_id))
|
||||
|
||||
storage.update_user(user)
|
||||
|
||||
flash("Permissions mises à jour", "success")
|
||||
return redirect("/user/" + username)
|
||||
else:
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.route("/user/<username>/set_admin")
|
||||
def user_set_admin(username):
|
||||
|
||||
if "admin" in session and session["admin"]:
|
||||
|
||||
user = storage.users()[username]
|
||||
|
||||
if user.username == session["username"]:
|
||||
flash("Vous n'êtes pas autorisé à changer votre propre type de compte", "warning")
|
||||
else:
|
||||
user.admin = request.args["admin"] == "1"
|
||||
storage.update_user(user)
|
||||
|
||||
flash("Permissions mises à jour", "success")
|
||||
|
||||
return redirect("/user/" + username)
|
||||
|
||||
|
||||
@app.route("/user/add", methods=['POST'])
|
||||
def user_add():
|
||||
|
||||
@ -104,21 +141,38 @@ def user_add():
|
||||
|
||||
try:
|
||||
storage.save_user(User(username, password, is_admin))
|
||||
flash("Created new user", "success")
|
||||
flash("Nouvel utilisateur créé", "success")
|
||||
except DuplicateUserException:
|
||||
flash("<strong>Couldn't create user</strong> Make sure that the username is unique", "danger")
|
||||
flash("<strong>L'utilisateur n'as pas pu être créé</strong> Assurez vous que le nom d'utilisateur est unique", "danger")
|
||||
|
||||
return redirect("/user")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.route("/user/<username>/del")
|
||||
def user_del(username):
|
||||
|
||||
if "admin" in session and session["admin"]:
|
||||
|
||||
if session["username"] == username:
|
||||
flash("Vous ne pouvez pas supprimer votre propre compte", "warning")
|
||||
return redirect("/user/" + username)
|
||||
else:
|
||||
storage.remove_user(username)
|
||||
flash("Utilisateur supprimé", "success")
|
||||
return redirect("/user")
|
||||
else:
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
@app.route("/suggest")
|
||||
def suggest():
|
||||
|
||||
return json.dumps(search.suggest(request.args.get("prefix")))
|
||||
|
||||
|
||||
@app.route("/document/<doc_id>")
|
||||
def document(doc_id):
|
||||
|
||||
@ -171,14 +225,12 @@ def thumb(doc_id):
|
||||
if os.path.isfile(tn_path):
|
||||
return send_file(tn_path)
|
||||
else:
|
||||
print("tn not found")
|
||||
default_thumbnail = BytesIO()
|
||||
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
||||
default_thumbnail.seek(0)
|
||||
return send_file(default_thumbnail, "image/jpeg")
|
||||
|
||||
else:
|
||||
print("doc is none")
|
||||
default_thumbnail = BytesIO()
|
||||
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
||||
default_thumbnail.seek(0)
|
||||
@ -189,9 +241,13 @@ def thumb(doc_id):
|
||||
def search_page():
|
||||
|
||||
mime_map = search.get_mime_map()
|
||||
mime_map.append({"id": "any", "text": "Any"})
|
||||
mime_map.append({"id": "any", "text": "Tous"})
|
||||
|
||||
return render_template("search.html", directories=storage.dirs(), mime_map=mime_map)
|
||||
directories = [storage.dirs()[x] for x in get_allowed_dirs(session["username"] if "username" in session else None)]
|
||||
|
||||
return render_template("search.html",
|
||||
directories=directories,
|
||||
mime_map=mime_map)
|
||||
|
||||
|
||||
@app.route("/list")
|
||||
@ -199,6 +255,18 @@ def search_liste_page():
|
||||
return render_template("searchList.html")
|
||||
|
||||
|
||||
def get_allowed_dirs(username):
|
||||
|
||||
if config.allow_guests:
|
||||
return [x for x in storage.dirs() if x.enabled]
|
||||
else:
|
||||
if username:
|
||||
user = storage.users()[username]
|
||||
return [x for x in storage.dirs() if storage.dirs()[x].enabled and x in user.readable_directories]
|
||||
else:
|
||||
return list()
|
||||
|
||||
|
||||
@app.route("/search", methods=['POST'])
|
||||
def search_route():
|
||||
|
||||
@ -212,19 +280,8 @@ def search_route():
|
||||
directories = request.json["directories"]
|
||||
|
||||
# Remove disabled & non-existing directories
|
||||
for search_directory in directories:
|
||||
directory_exists = False
|
||||
|
||||
for dir_id in storage.dirs():
|
||||
if search_directory == dir_id:
|
||||
directory_exists = True
|
||||
|
||||
if not storage.dirs()[dir_id].enabled:
|
||||
directories.remove(search_directory)
|
||||
break
|
||||
|
||||
if not directory_exists:
|
||||
directories.remove(search_directory)
|
||||
allowed_dirs = get_allowed_dirs(session["username"] if "username" in session else None)
|
||||
directories = [x for x in directories if x in allowed_dirs]
|
||||
|
||||
path = request.json["path"]
|
||||
|
||||
@ -249,7 +306,7 @@ def dir_list():
|
||||
if "admin" in session and session["admin"]:
|
||||
return render_template("directory.html", directories=storage.dirs())
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -266,13 +323,13 @@ def directory_add():
|
||||
try:
|
||||
d.set_default_options()
|
||||
storage.save_directory(d)
|
||||
flash("<strong>Created directory</strong>", "success")
|
||||
flash("<strong>Dossier créé</strong>", "success")
|
||||
except DuplicateDirectoryException:
|
||||
flash("<strong>Couldn't create directory</strong> Make sure that the path is unique", "danger")
|
||||
flash("<strong>Le dossier n'a pas pu être créé</strong> Assurer vous de choisir un nom unique", "danger")
|
||||
|
||||
return redirect("/directory")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -287,7 +344,7 @@ def directory_manage(dir_id):
|
||||
return render_template("directory_manage.html", directory=directory, tn_size=tn_size,
|
||||
tn_size_formatted=tn_size_formatted)
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -312,14 +369,14 @@ def directory_update(dir_id):
|
||||
|
||||
try:
|
||||
storage.update_directory(updated_dir)
|
||||
flash("<strong>Updated directory</strong>", "success")
|
||||
flash("<strong>Dossier mis à jour</strong>", "success")
|
||||
|
||||
except DuplicateDirectoryException:
|
||||
flash("<strong>Couldn't update directory</strong> Make sure that the path is unique", "danger")
|
||||
flash("<strong>Le dossier n'a pas pu être mis à jour</strong> Assurez vous que le chemin est unique", "danger")
|
||||
|
||||
return redirect("/directory/" + str(dir_id))
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -335,7 +392,7 @@ def directory_update_opt(dir_id):
|
||||
|
||||
return redirect("/directory/" + str(dir_id))
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -347,11 +404,11 @@ def directory_del(dir_id):
|
||||
shutil.rmtree("static/thumbnails/" + str(dir_id))
|
||||
|
||||
storage.remove_directory(dir_id)
|
||||
flash("<strong>Deleted directory</strong>", "success")
|
||||
flash("<strong>Dossier supprimé</strong>", "success")
|
||||
|
||||
return redirect("/directory")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -374,10 +431,10 @@ def directory_reset(dir_id):
|
||||
|
||||
search.delete_directory(dir_id)
|
||||
|
||||
flash("<strong>Reset directory options to default settings</strong>", "success")
|
||||
flash("<strong>Options du dossier réinitialisés</strong>", "success")
|
||||
return redirect("directory/" + str(dir_id))
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -387,7 +444,7 @@ def task():
|
||||
return render_template("task.html", tasks=storage.tasks(), directories=storage.dirs(),
|
||||
task_list=json.dumps(list(storage.tasks().keys())))
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -400,7 +457,7 @@ def get_current_task():
|
||||
else:
|
||||
return ""
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -410,11 +467,18 @@ def task_add():
|
||||
task_type = request.args.get("type")
|
||||
directory = request.args.get("directory")
|
||||
|
||||
storage.save_task(Task(task_type, directory))
|
||||
if task_type not in ("1", "2"):
|
||||
flash("Vous devez choisir un type de tâche", "danger")
|
||||
return redirect("/task")
|
||||
|
||||
if directory.isdigit() and int(directory) in storage.dirs():
|
||||
storage.save_task(Task(task_type, directory))
|
||||
else:
|
||||
flash("Vous devez choisir un dossier", "danger")
|
||||
|
||||
return redirect("/task")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -428,14 +492,14 @@ def task_del(task_id):
|
||||
|
||||
return redirect("/task")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@app.route("/reset_es")
|
||||
def reset_es():
|
||||
if "admin" in session and session["admin"]:
|
||||
flash("Elasticsearch index has been reset. Modifications made in <b>config.py</b> have been applied.", "success")
|
||||
flash("Elasticsearch a été réinitialisé, les changements dans <strong>config.py</strong> ont été appliqués", "success")
|
||||
|
||||
tm.indexer.init()
|
||||
if os.path.exists("static/thumbnails"):
|
||||
@ -443,7 +507,7 @@ def reset_es():
|
||||
|
||||
return redirect("/dashboard")
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
@ -470,7 +534,7 @@ def dashboard():
|
||||
index_size=humanfriendly.format_size(search.get_index_size()))
|
||||
|
||||
else:
|
||||
flash("You are not authorized to access this page", "warning")
|
||||
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||
return redirect("/")
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ function makeStatsCard(searchResult) {
|
||||
statsCardBody.setAttribute("class", "card-body");
|
||||
|
||||
let stat = document.createElement("p");
|
||||
stat.appendChild(document.createTextNode(searchResult["hits"]["total"] + " results in " + searchResult["took"] + "ms"));
|
||||
stat.appendChild(document.createTextNode(searchResult["hits"]["total"] + " résultats en " + searchResult["took"] + "ms"));
|
||||
|
||||
let sizeStat = document.createElement("span");
|
||||
sizeStat.appendChild(document.createTextNode(humanFileSize(searchResult["aggregations"]["total_size"]["value"])));
|
||||
@ -173,8 +173,8 @@ function gifOver(thumbnail, documentId) {
|
||||
|
||||
function downloadPopover(element, documentId) {
|
||||
element.setAttribute("data-content",
|
||||
'<a class="btn btn-sm btn-primary" href="/dl/'+ documentId +'"><i class="fas fa-download"></i> Download</a>' +
|
||||
'<a class="btn btn-sm btn-success" style="margin-left:3px;" href="/file/'+ documentId + '" target="_blank"><i class="fas fa-eye"></i> View</a>');
|
||||
'<a class="btn btn-sm btn-primary" href="/dl/'+ documentId +'"><i class="fas fa-download"></i> Télécharger</a>' +
|
||||
'<a class="btn btn-sm btn-success" style="margin-left:3px;" href="/file/'+ documentId + '" target="_blank"><i class="fas fa-eye"></i> Consulter</a>');
|
||||
element.setAttribute("data-toggle", "popover");
|
||||
element.addEventListener("mouseover", function() {
|
||||
element.focus();
|
||||
@ -267,7 +267,7 @@ function createDocCard(hit) {
|
||||
}
|
||||
thumbnailOverlay.appendChild(resolutionBadge);
|
||||
|
||||
var format = hit["_source"]["format"];
|
||||
var format = hit["_source"]["format_name"];
|
||||
|
||||
//Hover
|
||||
if(format === "GIF") {
|
||||
@ -592,4 +592,4 @@ document.getElementById("pathBar").addEventListener("keyup", function () {
|
||||
searchQueued = true;
|
||||
});
|
||||
|
||||
window.setInterval(search, 150);
|
||||
window.setInterval(search, 300);
|
17
storage.py
17
storage.py
@ -28,6 +28,7 @@ class User:
|
||||
self.username = username
|
||||
self.hashed_password = hashed_password
|
||||
self.admin = admin
|
||||
self.readable_directories = set()
|
||||
|
||||
|
||||
class Option:
|
||||
@ -224,7 +225,15 @@ class LocalStorage:
|
||||
db_users = c.fetchall()
|
||||
|
||||
for db_user in db_users:
|
||||
self.cached_users[db_user[0]] = User(db_user[0], b"", bool(db_user[1]))
|
||||
user = User(db_user[0], b"", bool(db_user[1]))
|
||||
|
||||
c.execute("SELECT username, directory_id FROM User_canRead_Directory WHERE username=?", (db_user[0],))
|
||||
db_accesses = c.fetchall()
|
||||
|
||||
for db_access in db_accesses:
|
||||
user.readable_directories.add(db_access[1])
|
||||
|
||||
self.cached_users[db_user[0]] = user
|
||||
|
||||
conn.close()
|
||||
|
||||
@ -256,6 +265,12 @@ class LocalStorage:
|
||||
c = conn.cursor()
|
||||
c.execute("UPDATE User SET is_admin=? WHERE username=?", (user.admin, user.username))
|
||||
|
||||
c.execute("DELETE FROM User_canRead_Directory WHERE username=?", (user.username, ))
|
||||
conn.commit()
|
||||
|
||||
for access in user.readable_directories:
|
||||
c.execute("INSERT INTO User_canRead_Directory VALUES (?,?)", (user.username, access))
|
||||
|
||||
c.close()
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">Global Information</div>
|
||||
<div class="card-header">Information globale</div>
|
||||
<div class="card-body">
|
||||
<table class="info-table table-hover table-striped">
|
||||
<tbody>
|
||||
@ -14,45 +14,45 @@
|
||||
<td><pre>{{ version }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total thumbnail cache size</th>
|
||||
<th>Taille totale des miniatures</th>
|
||||
<td><pre>{{ tn_size_total }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total document count</th>
|
||||
<th>Nombre de documents totals</th>
|
||||
<td><pre>{{ doc_count }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total size of indexed documents</th>
|
||||
<th>Taille totale des documents indexés</th>
|
||||
<td><pre>{{ doc_size }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total index size</th>
|
||||
<th>Taille totale de l'index</th>
|
||||
<td><pre>{{ index_size }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>User count</th>
|
||||
<th>Nombre d'utilisateurs</th>
|
||||
<td><pre>1</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SQLite database path</th>
|
||||
<th>Chemin de la base de donnée SQLite</th>
|
||||
<td><pre>{{ db_path }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Elasticsearch URL</th>
|
||||
<th>Adresse Elasticsearch</th>
|
||||
<td><pre>{{ elasticsearch_url }}</pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-muted">Change global settings in <b>config.py</b></div>
|
||||
<div class="card-footer text-muted">Changez les paramètres dans <b>config.py</b></div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Actions</div>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-danger" onclick="resetAll()">
|
||||
<i class="fas fa-exclamation-triangle"></i> Reset elasticsearch index
|
||||
<i class="fas fa-exclamation-triangle"></i> Réinitialiser l'index elasticsearch
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -60,8 +60,8 @@
|
||||
|
||||
<script>
|
||||
function resetAll() {
|
||||
if (confirm("This will entirely reset the index and documents will need to be re-indexed.\n\n" +
|
||||
"Do you want to proceed?")) {
|
||||
if (confirm("Cela va entièrement réinitialiser l'index et ses documents devrons être réindexés.\n\n" +
|
||||
"Voulez-vous procéder?")) {
|
||||
window.location = "/reset_es"
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set active_page = "directory" %}
|
||||
|
||||
{% block title %}An Excellent title{% endblock title %}
|
||||
{% block title %}Liste des dossiers{% endblock title %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
|
||||
{# Add directory form #}
|
||||
<div class="card">
|
||||
<div class="card-header">An excellent form</div>
|
||||
<div class="card-header">Ajouter un dossier</div>
|
||||
<div class="card-body">
|
||||
|
||||
<form method="GET" action="/directory/add">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" placeholder="Display name" name="name">
|
||||
<input type="text" class="form-control" placeholder="Nom du dossier" name="name">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" placeholder="Absolute path" name="path">
|
||||
<input type="text" class="form-control" placeholder="Chemin absolu" name="path">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Add Directory</button>
|
||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Ajouter</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@ -26,16 +26,15 @@
|
||||
|
||||
{# List of directories #}
|
||||
<div class="card">
|
||||
<div class="card-header">An excellent list</div>
|
||||
<div class="card-header">Liste des dossiers</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="info-table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Display Name</th>
|
||||
<th>Path</th>
|
||||
<th>Enabled</th>
|
||||
<th>Last indexed</th>
|
||||
<th>Nom</th>
|
||||
<th>Chemin</th>
|
||||
<th>Activé</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -45,8 +44,7 @@
|
||||
<td>{{ directories[dir].name }}</td>
|
||||
<td style="word-break: break-all"><pre>{{ directories[dir].path }}</pre></td>
|
||||
<td><i class="far {{ "fa-check-square" if directories[dir].enabled else "fa-square" }}"></i></td>
|
||||
<td>2018-02-21</td>
|
||||
<td><a href="directory/{{ dir }}" class="btn btn-primary"><i class="fas fa-cog"></i> Manage</a> </td>
|
||||
<td><a href="directory/{{ dir }}" class="btn btn-primary"><i class="fas fa-cog"></i> Gérer</a> </td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set active_page = "directory" %}
|
||||
|
||||
{% block title %}An excellent title{% endblock title %}
|
||||
{% block title %}{{ directory.name }}{% endblock title %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
@ -63,40 +63,40 @@
|
||||
|
||||
<div class="card">
|
||||
|
||||
<div class="card-header">Summary</div>
|
||||
<div class="card-header">Sommaire</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="info-table">
|
||||
<tr onclick="modifyDisplayName()">
|
||||
<th style="width: 20%">Display name</th>
|
||||
<th style="width: 20%">Nom</th>
|
||||
<td>
|
||||
<pre id="display-name" title="Click to update">{{ directory.name }}</pre>
|
||||
<pre id="display-name" title="Cliquer pour mettre à jour">{{ directory.name }}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr onclick="modifyPath()">
|
||||
<th style="width: 20%">Path</th>Task
|
||||
<th style="width: 20%">Chemin</th>
|
||||
<td>
|
||||
<pre id="path" title="Click to update">{{ directory.path }}</pre>
|
||||
<pre id="path" title="Cliquer pour mettre à jour">{{ directory.path }}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width: 20%">Enabled</th>
|
||||
<th style="width: 20%">Activé</th>
|
||||
<td>
|
||||
<form action="/directory/{{ directory.id }}/update" style="display: inline;margin-left: 6px;">
|
||||
<input type="hidden" name="enabled" value="{{ "0" if directory.enabled else "1" }}">
|
||||
<button class="btn btn-sm {{ "btn-danger" if directory.enabled else "btn-success" }}">
|
||||
<i class="far {{ "fa-check-square" if directory.enabled else "fa-square" }}"></i>
|
||||
{{ "Disable" if directory.enabled else "Enable" }}
|
||||
{{ "Désactiver" if directory.enabled else "Activer" }}
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>Thumbnail cache size</th>
|
||||
<td><pre>{{ tn_size_formatted }} ({{ tn_size }} bytes)</pre></td>
|
||||
<th>Taille des miniatures</th>
|
||||
<td><pre>{{ tn_size_formatted }} ({{ tn_size }} octets)</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@ -112,16 +112,16 @@
|
||||
<form action="/task/add" class="p-2">
|
||||
<input type="hidden" value="1" name="type">
|
||||
<input type="hidden" value="{{ directory.id }}" name="directory">
|
||||
<button class="btn btn-primary" href="/task/" value="Generate thumbnails">
|
||||
<i class="fas fa-book"></i> Generate index
|
||||
<button class="btn btn-primary" href="/task/">
|
||||
<i class="fas fa-book"></i> Générer l'index
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form action="/task/add" class="p-2">
|
||||
<input type="hidden" value="2" name="type">
|
||||
<input type="hidden" value="{{ directory.id }}" name="directory">
|
||||
<button class="btn btn-primary" href="/task/" value="Generate thumbnails">
|
||||
<i class="far fa-images"></i> Generate thumbnails
|
||||
<button class="btn btn-primary" href="/task/">
|
||||
<i class="far fa-images"></i> Générer les miniatures
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@ -129,8 +129,8 @@
|
||||
<button class="btn dropdown-toggle btn-danger" data-toggle="dropdown">Action</button>
|
||||
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/del">Delete directory</a>
|
||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/reset">Reset to default settings</a>
|
||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/del">Supprimer le dossier</a>
|
||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/reset">Réinitialiser aux paramètres par défaut</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -140,13 +140,13 @@
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Options <a href="#" style="float:right">Learn more <i class="fas fa-external-link-alt"></i></a></div>
|
||||
<div class="card-header">Options <a href="#" style="float:right">En savoir plus <i class="fas fa-external-link-alt"></i></a></div>
|
||||
<div class="card-body">
|
||||
<table class="info-table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Option</th>
|
||||
<th>Value</th>
|
||||
<th>Valeur</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -154,7 +154,7 @@
|
||||
|
||||
<tr>
|
||||
<td style="width: 30%"><span>{{ option.key }}</span></td>
|
||||
<td onclick="modifyVal({{ option.id }}, '{{ option.key }}')" title="Click to update"><pre id="val-{{ option.id }}">{{ option.value }}</pre></td>
|
||||
<td onclick="modifyVal({{ option.id }}, '{{ option.key }}')" title="Cliquer pour modifier"><pre id="val-{{ option.id }}">{{ option.value }}</pre></td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
<div class="card-header">{{ doc.name }}</div>
|
||||
<div class="card-body">
|
||||
<h3>Document properties</h3>
|
||||
<h3>Propriétés du document</h3>
|
||||
|
||||
<table class="info-table table-hover table-striped">
|
||||
<tbody>
|
||||
@ -26,21 +26,21 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<h3>Raw json</h3>
|
||||
<h3>JSON</h3>
|
||||
<textarea class="form-control" style="min-height: 100px" readonly>{{ doc | tojson }}</textarea>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><a href="/directory/{{ directory.id }}">Directory</a></h3>
|
||||
<h3><a href="/directory/{{ directory.id }}">Dossier</a></h3>
|
||||
<table class="info-table table-hover table-striped">
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>Path</th>
|
||||
<th>Chemin</th>
|
||||
<td><pre>{{ directory.path }}</pre></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Nom</th>
|
||||
<td><pre>{{ directory.name }}</pre></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -52,7 +52,7 @@
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-expand-lg navbar-light" style="background: #F7F7F7; border-bottom: solid 1px #dfdfdf;">
|
||||
<a class="navbar-brand" href="/"><i class="fa fa-search"></i> Search</a>
|
||||
<a class="navbar-brand" href="/"><i class="fa fa-search"></i> Recherche</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
@ -60,30 +60,30 @@
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if "directory" == active_page %}active{% endif %}" href="/directory">Directories</a>
|
||||
<a class="nav-link {% if "directory" == active_page %}active{% endif %}" href="/directory">Dossiers</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if "task" == active_page %}active{% endif %}" href="/task">Tasks</a>
|
||||
<a class="nav-link {% if "task" == active_page %}active{% endif %}" href="/task">Tâches</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if "user" == active_page %}active{% endif %}" href="/user">Users</a>
|
||||
<a class="nav-link {% if "user" == active_page %}active{% endif %}" href="/user">Utilisateurs</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if "dashboard" == active_page %}active{% endif %}" href="/dashboard">Dashboard</a>
|
||||
<a class="nav-link {% if "dashboard" == active_page %}active{% endif %}" href="/dashboard">Panneau de contrôle</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% if session["username"] %}
|
||||
<span>
|
||||
Logged in as <i>{{ session["username"] }}</i>
|
||||
{% if session["admin"] %}(Admin){% endif %}
|
||||
Connecté en tant que <i>{{ session["username"] }}</i>
|
||||
{% if session["admin"] %}(Administrateur){% endif %}
|
||||
</span>
|
||||
<a href="/logout" class="btn btn-outline-warning" style="margin-left: 8px">Logout</a>
|
||||
<a href="/logout" class="btn btn-outline-warning" style="margin-left: 8px">Déconnexion</a>
|
||||
{% else %}
|
||||
<form class="form-inline my-2 my-lg-0" method="POST" action="/login">
|
||||
<input class="form-control mr-sm-2" placeholder="Username" name="username">
|
||||
<input class="form-control mr-sm-2" type="password" placeholder="Password" name="password">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0">Login</button>
|
||||
<input class="form-control mr-sm-2" placeholder="Nom d'utilisateur" name="username">
|
||||
<input class="form-control mr-sm-2" type="password" placeholder="Mot de pass" name="password">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0">Connexion</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -97,7 +97,7 @@
|
||||
<div class="container" style="margin-top: 1em">
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="fermer">×</a>
|
||||
{{ message | safe }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<style>
|
||||
.fit:hover {
|
||||
-webkit-transform:scale(2.5);
|
||||
-moz-transform:scale(2.5);
|
||||
-ms-transform:scale(2.5);
|
||||
-o-transform:scale(2.5);
|
||||
transform:scale(2.5);
|
||||
|
||||
}
|
||||
|
||||
.fit {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-container{
|
||||
width: 305px;
|
||||
height: 300px;
|
||||
background-color: #ccc;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
.doc-container {
|
||||
height: 330px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.doc-caption {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="photos">
|
||||
|
||||
{% for doc in docs %}
|
||||
{% if doc.type == "audio" %}
|
||||
<div class="image-container">
|
||||
<audio controls class="fit">
|
||||
<!--<source src="files/{{doc.doc_id}}">-->
|
||||
</audio>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="/files/{{doc.doc_id}}">
|
||||
<div class="doc-container">
|
||||
<div class="image-container">
|
||||
<img class="fit" src="/thumbs/{{doc.doc_id}}">
|
||||
</div>
|
||||
<span class="doc-caption" style="font-size: 8pt">{{doc.name}}</span>
|
||||
|
||||
</div>
|
||||
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
{% set active_page = "search" %}
|
||||
|
||||
{% block title %}Search{% endblock title %}
|
||||
{% block title %}Recherche{% endblock title %}
|
||||
|
||||
{% block imports %}
|
||||
<link href="/static/css/search.css" rel="stylesheet" type="text/css">
|
||||
@ -14,36 +14,38 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group">
|
||||
<input id="pathBar" type="search" class="form-control" placeholder="Filter path">
|
||||
<input id="pathBar" type="search" class="form-control" placeholder="Filtrer le chemin">
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<span onclick="document.getElementById('barToggle').click()">Must match </span>
|
||||
<input title="Toggle between 'Should' and 'Must' match mode" type="checkbox" id="barToggle" onclick="toggleSearchBar()" checked>
|
||||
<span onclick="document.getElementById('barToggle').click()">Doit être égal </span>
|
||||
<input title="Basculer entre 'Devrait' and 'doit' être égal" type="checkbox" id="barToggle" onclick="toggleSearchBar()" checked>
|
||||
</div>
|
||||
</div>
|
||||
<input id="searchBar" type="search" class="form-control" placeholder="Search">
|
||||
<input id="searchBar" type="search" class="form-control" placeholder="Recherche">
|
||||
|
||||
</div>
|
||||
|
||||
<input title="File size" id="sizeSlider" name="size">
|
||||
<input title="Taille des fichiers" id="sizeSlider" name="size">
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<label for="directories" >Search in directories</label>
|
||||
<label for="directories" >Rechercher dans les dossiers</label>
|
||||
|
||||
<select class="custom-select" id="directories" multiple size="6">
|
||||
{% for dir_id in directories %}
|
||||
{% if directories[dir_id].enabled %}
|
||||
<option selected value="{{ directories[dir_id].id }}">{{ directories[dir_id].name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if directories | length > 0%}
|
||||
{% for dir in directories %}
|
||||
<option selected value="{{ dir.id }}">{{ dir.name }}</option>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<option disabled>Il n'existe aucun dossier actif auquel vous avez accès</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<label>Mime types</label>
|
||||
<label>Types de fichier</label>
|
||||
|
||||
<div class="tree"></div>
|
||||
</div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends "layout.html" %}
|
||||
{% set active_page = "task" %}
|
||||
|
||||
{% block title %}An excellent title{% endblock title %}
|
||||
{% block title %}Tâches{% endblock title %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
@ -43,23 +43,23 @@
|
||||
<div class="container">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Add task</div>
|
||||
<div class="card-header">Ajouter un tâche</div>
|
||||
<div class="card-body">
|
||||
<form class="form-inline" action="/task/add">
|
||||
<select title="Select task type" class="form-control" id="type" name="type">
|
||||
<option hidden>Create task...</option>
|
||||
<option value="1">Indexing</option>
|
||||
<option value="2">Thumbnail Generation</option>
|
||||
<select title="Sélectionner le type de tâche" class="form-control" id="type" name="type">
|
||||
<option hidden>Créer un tâche...</option>
|
||||
<option value="1">d'indexation</option>
|
||||
<option value="2">de génération des miniatures</option>
|
||||
</select>
|
||||
|
||||
<select title="Select directory" class="form-control" id="directory" name="directory" >
|
||||
<option hidden>For directory...</option>
|
||||
<select title="Sélectionner le dossier" class="form-control" id="directory" name="directory" >
|
||||
<option hidden>Pour le dossier...</option>
|
||||
{% for dir_id in directories %}
|
||||
<option value="{{ dir_id }}">{{ directories[dir_id].name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<button class="form-control btn btn-success"><i class="fas fa-plus"></i> Add</button>
|
||||
<button class="form-control btn btn-success"><i class="fas fa-plus"></i> Ajouter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -81,7 +81,7 @@
|
||||
|
||||
if (currentTask.total === 0) {
|
||||
|
||||
document.getElementById("task-label-" + currentTask.id).innerHTML = "Calculating file count...";
|
||||
document.getElementById("task-label-" + currentTask.id).innerHTML = "Calcul du nombre de fichier...";
|
||||
|
||||
} else {
|
||||
let bar = document.getElementById("task-bar-" + currentTask.id);
|
||||
@ -107,16 +107,16 @@
|
||||
</script>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Ongoing tasks</div>
|
||||
<div class="card-header">Tâches en cours</div>
|
||||
<div class="card-body">
|
||||
{% for task_id in tasks | sort() %}
|
||||
<div class="task-wrapper container-fluid">
|
||||
<a class="task-name" href="/directory/{{ tasks[task_id].dir_id }}">{{ directories[tasks[task_id].dir_id].name }}</a>
|
||||
<span class="task-info"> -
|
||||
{% if tasks[task_id].type == 1 %}
|
||||
Indexing
|
||||
Indexation
|
||||
{% else %}
|
||||
Thumbnail generation
|
||||
Génération des miniatures
|
||||
{% endif %}
|
||||
</span>
|
||||
|
||||
@ -124,12 +124,12 @@
|
||||
<div class="container-fluid p-2">
|
||||
<div class="progress">
|
||||
<div id="task-bar-{{ task_id }}" class="progress-bar" role="progressbar" style="width: 0;">
|
||||
<span id="task-label-{{ task_id }}">Queued</span>
|
||||
<span id="task-label-{{ task_id }}">En attente</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-2"><a class="btn btn-danger" href="/task/{{ task_id }}/del">Cancel</a></div>
|
||||
<div class="p-2"><a class="btn btn-danger" href="/task/{{ task_id }}/del">Annuler</a></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -1,16 +1,16 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% set active_page = "user" %}
|
||||
{% block title %}Liste des utilisateurs{% endblock title %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">Create user</div>
|
||||
<div class="container"> <div class="card">
|
||||
<div class="card-header">Créer un utilisateur</div>
|
||||
<div class="card-body">
|
||||
|
||||
{% if not admin_account_present %}
|
||||
<p>This page is unlocked because there are no admin accounts</p>
|
||||
<p>Cette page est débloquée parce qu'il n'y a aucun compte administrateur</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="POST" action="/user/add">
|
||||
@ -18,39 +18,37 @@
|
||||
<div class="input-group form-group">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
<label for="is_admin" style="margin: 0 8px 0 0">Set admin</label>
|
||||
<input title="Set user as admin" type="checkbox" id="is_admin" name="is_admin">
|
||||
<label for="is_admin" style="margin: 0 8px 0 0">Administrateur</label>
|
||||
<input title="administrateur" type="checkbox" id="is_admin" name="is_admin">
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control" placeholder="Username" name="username">
|
||||
<input type="text" class="form-control" placeholder="Nom d'utilisateur" name="username">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="password" class="form-control" placeholder="Password" name="password">
|
||||
<input type="password" class="form-control" placeholder="Mot de passe" name="password">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Add User</button>
|
||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Créer un utilissateur</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Users</div>
|
||||
<div class="card-header">Utilisateurs</div>
|
||||
<div class="card-body">
|
||||
|
||||
<table class="info-table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Admin</th>
|
||||
<th>Utilisateur</th>
|
||||
<th>Administrateur</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</tr> </thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
{% for user in users %} <tr>
|
||||
<td style="width: 80%;">{% if session["username"] == user %}<b>{{ user }}{% else %}{{ user }}{% endif %}</b></td>
|
||||
<td><i class="far {{ "fa-check-square" if users[user].admin else "fa-square" }}"></i></td>
|
||||
<td><a href="/user/{{ user }}" class="btn btn-primary">Manage</a></td>
|
||||
<td><a href="/user/{{ user }}" class="btn btn-primary">Gérer</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
@ -1,19 +1,72 @@
|
||||
{% extends "layout.html" %}
|
||||
|
||||
{% set active_page = "user" %}
|
||||
{% block title %}Gestion utilisateur{% endblock title %}
|
||||
|
||||
{% block body %}
|
||||
|
||||
<div class="container">
|
||||
<div class="card">
|
||||
<div class="card-header">Manage permission of <strong>{{ session["username"] }}</strong></div>
|
||||
<div class="card-header">Gérer les permission de <strong>{{ user.username }}</strong></div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5>Administrateur: </h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form action="/user/{{ user.username }}/set_admin" style="display: inline;margin-left: 6px;">
|
||||
<input type="hidden" name="admin" value="{{ "0" if user.admin else "1" }}">
|
||||
<button class="btn btn-sm {{ "btn-danger" if user.admin else "btn-success" }}">
|
||||
<i class="far {{ "fa-check-square" if user.admin else "fa-square" }}"></i>
|
||||
{{ "Rétrograder" if user.admin else "Faire administrateur" }}
|
||||
</button>
|
||||
<input type="hidden" name="dir_id" value="{{ dir_id }}">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<table class="info-table table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Dossier</th>
|
||||
<th>Accès</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for dir_id in directories %}
|
||||
<tr>
|
||||
<td>{{ directories[dir_id].name }}</td>
|
||||
<td><form action="/user/{{ user.username }}/set_access" style="display: inline;margin-left: 6px;">
|
||||
<input type="hidden" name="access" value="{{ "0" if dir_id in user.readable_directories else "1" }}">
|
||||
<button class="btn btn-sm {{ "btn-danger" if dir_id in user.readable_directories else "btn-success" }}">
|
||||
<i class="far {{ "fa-check-square" if dir_id in user.readable_directories else "fa-square" }}"></i>
|
||||
{{ "Désactiver" if dir_id in user.readable_directories else "Activer" }}
|
||||
</button>
|
||||
<input type="hidden" name="dir_id" value="{{ dir_id }}">
|
||||
</form></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<button class="btn btn-danger" onclick="userDelete()">Supprimer le compte</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function userDelete() {
|
||||
if (confirm("Êtes vous certain de vouloir supprimer ce compte?")) {
|
||||
window.location = "/user/{{ user.username }}/del"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock body %}
|
Loading…
x
Reference in New Issue
Block a user