diff --git a/mydnshost-php-api b/mydnshost-php-api
index b4fb058..92d5d03 160000
--- a/mydnshost-php-api
+++ b/mydnshost-php-api
@@ -1 +1 @@
-Subproject commit b4fb05808bf2148572c0b3a077a3adfc6a2b89f2
+Subproject commit 92d5d03f8d9330fe05bd0aaa7a44000b4ec53999
diff --git a/src/DisplayEngine.php b/src/DisplayEngine.php
index bd9c92a..2d4e5fd 100644
--- a/src/DisplayEngine.php
+++ b/src/DisplayEngine.php
@@ -299,6 +299,9 @@ public function showHeaderMenu() {
if ($this->hasPermission(['manage_domains'])) {
$menu[] = ['link' => $this->getURL('/admin/domains'), 'title' => 'Manage Domains', 'active' => ($this->pageID == '/admin/domains')];
}
+ if ($this->hasPermission(['manage_articles'])) {
+ $menu[] = ['link' => $this->getURL('/admin/articles'), 'title' => 'Manage Articles', 'active' => ($this->pageID == '/admin/aticles')];
+ }
if ($this->hasPermission(['system_stats'])) {
$menu[] = ['link' => $this->getURL('/admin/stats'), 'title' => 'System Statistics', 'active' => ($this->pageID == '/admin/stats')];
}
diff --git a/src/routes/AdminRoutes.php b/src/routes/AdminRoutes.php
index f10710c..3f4825e 100644
--- a/src/routes/AdminRoutes.php
+++ b/src/routes/AdminRoutes.php
@@ -195,5 +195,49 @@ public function addRoutes($router, $displayEngine, $api) {
return;
});
}
+
+
+ if ($displayEngine->hasPermission(['manage_articles'])) {
+ $router->get('/admin/articles', function() use ($displayEngine, $api) {
+ $displayEngine->setPageID('/admin/articles')->setTitle('Admin :: Articles');
+
+ $articles = $api->getAllArticles();
+ $displayEngine->setVar('articles', $articles);
+ $displayEngine->setVar('time', time());
+
+ $displayEngine->display('admin/articles.tpl');
+ });
+
+ $router->get('/admin/articles/(.*)', function($articleid) use ($displayEngine, $api) {
+ $displayEngine->setPageID('/admin/articles')->setTitle('Admin :: Articles :: ' . $articleid);
+
+ $article = $api->getArticle($articleid);
+ $displayEngine->setVar('article', $article);
+ $displayEngine->setVar('time', time());
+
+ $displayEngine->display('admin/article.tpl');
+ });
+
+ $router->post('/admin/articles/(.*)', function($articleid) use ($displayEngine, $api) {
+
+ });
+
+ $router->post('/admin/articles/(.*)/delete', function($articleid) use ($displayEngine, $api) {
+
+ });
+
+ $router->get('/admin/articles/create', function() use ($displayEngine, $api) {
+ $displayEngine->setPageID('/admin/articles')->setTitle('Admin :: Articles :: Create');
+ $displayEngine->setVar('create', true);
+ $displayEngine->setVar('time', time());
+ $displayEngine->display('admin/article.tpl');
+ });
+
+ $router->post('/admin/articles/create', function() use ($displayEngine, $api) {
+
+ });
+ }
+
+
}
}
diff --git a/templates/default/admin/article.tpl b/templates/default/admin/article.tpl
new file mode 100644
index 0000000..396cf5a
--- /dev/null
+++ b/templates/default/admin/article.tpl
@@ -0,0 +1,58 @@
+
Article :: {{ article.id }}
+
+
+
+
+
+
diff --git a/templates/default/admin/articles.tpl b/templates/default/admin/articles.tpl
new file mode 100644
index 0000000..458991c
--- /dev/null
+++ b/templates/default/admin/articles.tpl
@@ -0,0 +1,61 @@
+Article List
+
+
+
+
+
+
+
+
+
+
+ ID |
+ Title |
+ Content |
+ Visible |
+ Actions |
+
+
+
+ {% for article in articles %}
+
+
+ {{ article.id }}
+ |
+
+ {{ article.title }}
+ |
+
+ {{ article.content }}
+ |
+
+ {% set visible = article.visiblefrom < time and (article.visibleuntil == -1 or article.visibleuntil > time) %}
+
+
+ {{ visible | yesno }}
+
+ |
+
+ {% if userinfo.email != user.email %}
+ View/Edit
+ |
+
+ {% endfor %}
+
+
+
+{% embed 'blocks/modal_confirm.tpl' with {'id': 'confirmDelete'} only %}
+ {% block title %}
+ Delete Article
+ {% endblock %}
+
+ {% block body %}
+ Are you sure you want to delete this Article?
+ {% endblock %}
+{% endembed %}
+
+