mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +01:00
Merge pull request #2 from partitioncloud/dev
This commit is contained in:
commit
85c2740f9c
@ -232,6 +232,7 @@ def add_partition(album_uuid):
|
||||
db = get_db()
|
||||
user = User(user_id=session.get("user_id"))
|
||||
album = Album(uuid=album_uuid)
|
||||
source = "upload" # source type: upload, unknown or url
|
||||
|
||||
if (not user.is_participant(album.uuid)) and (user.access_level != 1):
|
||||
flash("Vous ne participez pas à cet album.")
|
||||
@ -256,6 +257,8 @@ def add_partition(album_uuid):
|
||||
).fetchone()
|
||||
if data is None:
|
||||
error = "Les résultats de la recherche ont expiré."
|
||||
else:
|
||||
source = data["url"]
|
||||
else:
|
||||
partition_type = "file"
|
||||
|
||||
@ -278,10 +281,10 @@ def add_partition(album_uuid):
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
INSERT INTO partition (uuid, name, author, body, user_id)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
INSERT INTO partition (uuid, name, author, body, user_id, source)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""",
|
||||
(partition_uuid, request.form["name"], author, body, user.id),
|
||||
(partition_uuid, request.form["name"], author, body, user.id, source),
|
||||
)
|
||||
db.commit()
|
||||
|
||||
|
@ -314,6 +314,7 @@ class Partition():
|
||||
self.author = data["author"]
|
||||
self.body = data["body"]
|
||||
self.user_id = data["user_id"]
|
||||
self.source = data["source"]
|
||||
else:
|
||||
raise LookupError
|
||||
|
||||
|
@ -17,7 +17,8 @@ CREATE TABLE partition (
|
||||
name TEXT NOT NULL,
|
||||
author TEXT,
|
||||
body TEXT,
|
||||
user_id INTEGER
|
||||
user_id INTEGER,
|
||||
source TEXT DEFAULT 'unknown'
|
||||
);
|
||||
|
||||
CREATE TABLE album (
|
||||
|
@ -603,6 +603,7 @@ table {
|
||||
}
|
||||
|
||||
td {
|
||||
height: 35px; /* will grow automatically */
|
||||
min-width: 178px;
|
||||
border: thin solid var(--color-surface0);
|
||||
text-align: center;
|
||||
|
@ -24,6 +24,18 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Type d'ajout
|
||||
</td>
|
||||
<td>
|
||||
{% if partition.source == "unknown" or partition.source == "upload" %}
|
||||
{{ partition.source }}
|
||||
{% else %}
|
||||
<a href="{{ partition.source }}">search</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Albums
|
||||
|
@ -13,6 +13,16 @@
|
||||
<td>Fichier</td>
|
||||
<td><a href="/partition/{{ partition.uuid }}"><img class="partition-thumbnail" src="/static/thumbnails/{{ partition.uuid }}.jpg"></a></td>
|
||||
</tr>
|
||||
{% if partition.source != "unknown" and partition.source != "upload" %}
|
||||
<tr>
|
||||
<td>
|
||||
Source
|
||||
</td>
|
||||
<td class="partition-source">
|
||||
<a href="{{ partition.source }}">{{ partition.source.split("/")[2] }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<td>Titre</td>
|
||||
<td><input name="name" type="text" value="{{ partition.name }}" placeholder="Titre" required /><br/></td>
|
||||
|
Loading…
Reference in New Issue
Block a user