diff --git a/db_ddl.sql b/db_versions/0_initial.sql
similarity index 100%
rename from db_ddl.sql
rename to db_versions/0_initial.sql
diff --git a/db_versions/1_add_uploaded.sql b/db_versions/1_add_uploaded.sql
new file mode 100644
index 0000000..e44b679
--- /dev/null
+++ b/db_versions/1_add_uploaded.sql
@@ -0,0 +1 @@
+ALTER TABLE Documents ADD UploadedTime INTEGER;
\ No newline at end of file
diff --git a/www/_templates/front_intro.php b/www/_templates/front_intro.php
index b1f92e9..b979b6d 100644
--- a/www/_templates/front_intro.php
+++ b/www/_templates/front_intro.php
@@ -5,4 +5,24 @@
Tohle je hromádka zajímavýho materiálu co něco znamená v kontextu sdbs - budeme sem postupně
dávat ty nejdůležitější nebo nejzajímavější věci, zatim se o tom ale nikde moc nešiřte.
/-\
+
+
+
\ No newline at end of file
diff --git a/www/_util/PileDB.php b/www/_util/PileDB.php
index f91a570..bd1d032 100644
--- a/www/_util/PileDB.php
+++ b/www/_util/PileDB.php
@@ -113,13 +113,27 @@ class PileDB
return $docs;
}
+ public function getRecentDocs($count = 15)
+ {
+ $query = $this->db->prepare("SELECT * FROM Documents ORDER BY ID DESC LIMIT :count");
+ $query->bindValue("count", $count);
+
+ $query_ret = $query->execute();
+ $result = [];
+ while ($row = $query_ret->fetchArray(SQLITE3_ASSOC)) {
+ array_push($result, $row);
+ }
+ return $result;
+ }
+
public function updateDoc($id, $title, $author, $description, $published, $url, $tag_ids)
{
if (empty($id)) {
$stmt = $this->db->prepare("INSERT INTO Documents
- (ID, Title, Author, Description, Published, URL)
+ (ID, Title, Author, Description, Published, URL, UploadedTime)
VALUES
- (NULL, :title, :author, :description, :published, :url)");
+ (NULL, :title, :author, :description, :published, :url, :uploadedtime)");
+ $stmt->bindValue(":uploadedtime", time(), SQLITE3_INTEGER);
} else {
$stmt = $this->db->prepare("UPDATE Documents SET
Title=:title,
diff --git a/www/assets/main.css b/www/assets/main.css
index 638ecd4..f7f89c3 100755
--- a/www/assets/main.css
+++ b/www/assets/main.css
@@ -23,6 +23,19 @@ a {
text-decoration: none;
}
+ul {
+ padding-left: 20px;
+}
+
+ul > li {
+ list-style: none;
+}
+
+ul > li:before {
+ content: "—";
+ padding-right: .5rem;
+}
+
#sidebar {
font-family: Prociono, serif;
}
@@ -64,6 +77,7 @@ a {
#sidebar-taglist > ul > li:before {
content: "/ ";
+ padding-right: 0;
}
#sidebar-taglist-top:before {
@@ -175,6 +189,22 @@ a {
}
}
+
+.recent-additions li {
+ margin-bottom: .5em;
+}
+
+.recent-additions-desc {
+ font-size: 12pt;
+ color: #bfbfbf;
+ padding-left: calc(20px + .5rem);
+
+ line-height: 13pt;
+ max-height: 26pt;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
@media screen and (max-width: 64em ) {
#sidebar-head {
display: flex;
diff --git a/www/feed.php b/www/feed.php
new file mode 100644
index 0000000..f0184f3
--- /dev/null
+++ b/www/feed.php
@@ -0,0 +1,26 @@
+getRecentDocs();
+
+header('Content-Type: application/rss+xml');
+?>
+
+
+
+
+ /-\ pile
+ https://pile.sdbs.cz
+
+ A pile of interesting documents.
+
+
+ -
+
= $doc['Title'] ?>
+ = $doc['URL'] ?>
+ https://pile.sdbs.cz/?item== $doc['ID'] ?>
+ = $doc['Description'] ?>
+
+
+
+
diff --git a/www/index.php b/www/index.php
index d1eb95a..e5c175a 100644
--- a/www/index.php
+++ b/www/index.php
@@ -33,6 +33,7 @@ if (isset($_GET["item"])) {
$content = $doc_list_template->render('front_doc_listing.php');
} else {
$intro_template = new Template();
+ $intro_template->recent_docs = $db->getRecentDocs();
$content = $intro_template->render('front_intro.php');
}