aboutsummaryrefslogtreecommitdiff
path: root/views/list
diff options
context:
space:
mode:
Diffstat (limited to 'views/list')
-rw-r--r--views/list/new/index.php8
-rw-r--r--views/list/update/index.php56
2 files changed, 36 insertions, 28 deletions
diff --git a/views/list/new/index.php b/views/list/new/index.php
index 7f1aaf5..cc680b5 100644
--- a/views/list/new/index.php
+++ b/views/list/new/index.php
@@ -1,12 +1,6 @@
<?php
- if (isset($list_status) && $list_status === "") {
- }
+ require_login();
?>
-<script type="text/javascript">
- if (!cookieStorage.getItem('token')) {
- window.location.href = '/login';
- }
-</script>
<h1>Create a new list</h1>
diff --git a/views/list/update/index.php b/views/list/update/index.php
index b3737f0..5366110 100644
--- a/views/list/update/index.php
+++ b/views/list/update/index.php
@@ -1,30 +1,44 @@
-
-<!-- TODO: Redirect when no user -->
-
<?php
- $user = null;
+ require_login();
+
$webpage = null;
+ $list = null;
try {
- $user = Database\Cookie::fromDB($TOKEN);
+ $list = Database\Cookie::fromDB($TOKEN)->archiveLists();
$webpage = Database\Webpage::fromDBwid($_GET['wid']);
}
catch (Exception $e) {}
?>
-<!-- TODO: Redirect when no webpage -->
-<!-- TODO: Redirect when lists is empty -->
-
-<h2>To which list do you want to add "<?= $webpage->URL ?>"?</h2>
-
-<form action="/list" method="GET">
- <input type="hidden" name="method" value="PATCH">
- <select name="lid">
- <?php foreach ($user->archiveLists() as $list): ?>
- <option value="<?= $list->LID ?>"><?= $list->Name ?></option>
- <?php endforeach; ?>
- </select>
- <input type="hidden" name="type" value="add">
- <input type="hidden" name="wid" value="<?= $_GET['wid'] ?>">
- <input type="submit" value="Select">
-</form>
+<?php if ($webpage !== null && $list !== null): ?>
+ <h2>
+ To which list do you want to add</br>
+ <?= $webpage->URL ?></br>
+ from</br>
+ <?= $webpage->Date ?>?
+ </h2>
+
+ <form action="/list" method="GET" class="font-125 flex-row width-100 center-margin">
+ <input type="hidden" name="method" value="PATCH">
+ <select name="lid" class="flex-expand">
+ <?php foreach ($list as $list): ?>
+ <option value="<?= $list->LID ?>"><?= $list->Name ?></option>
+ <?php endforeach; ?>
+ </select>
+ <input type="hidden" name="type" value="add">
+ <input type="hidden" name="wid" value="<?= $_GET['wid'] ?>">
+ <input type="submit" value="Select">
+ </form>
+
+<?php elseif ($webpage === null): ?>
+ <h2>No page with identifier <?= $_GET['wid'] ?> exists!</h2>
+
+<?php else: ?>
+ <h2>You have no lists!</h2>
+
+ <form action="/list/new" method="GET">
+ <input type="submit" value="Create a new list">
+ </form>
+
+<?php endif; ?>