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