diff options
Diffstat (limited to 'views')
| -rw-r--r-- | views/archive/index.php | 34 | ||||
| -rw-r--r-- | views/archive/item.php | 20 | ||||
| -rw-r--r-- | views/archive/item_show.php | 8 | ||||
| -rw-r--r-- | views/profile/index.php | 36 |
4 files changed, 39 insertions, 59 deletions
diff --git a/views/archive/index.php b/views/archive/index.php index 846f910..f7c427f 100644 --- a/views/archive/index.php +++ b/views/archive/index.php @@ -24,36 +24,12 @@ <!-- Button to delete --> <h2>Archives by date:</h2> - <?php foreach ($page->allArchives() as $page): ?> - <section class="item"> - <section> - <div> - <img src="<?= '/archives/' . $page->FaviconPath ?>" class="favicon"> - <a href="<?= '/archives/' . $page->WID . '/index.php' ?>"><?= $page->URL ?></a> - <span class="float-right"><?= $page->Date ?></span> - </div> - <div class="details"> - <span>Visits: <?= $page->Visits ?></span> - <span class="float-right"><?= Database\User::fromDBuid($page->RequesterUID)->Username ?></span> - </div> - </section> - <section name="itemButton" hidden> - <form action="/list/update" method="GET"> - <input type="hidden" name="wid" value="<?= $page->WID ?>"> - <input type="submit" value="+"> - </form> - <span><!-- Delete (when admin) button --></span> - </section> - </section> - <?php endforeach; ?> - <script type="text/javascript"> - function showButtons() { - for (buttonset of document.getElementsByName('itemButton')) { - buttonset.hidden = false; - } + <?php + foreach ($page->allArchives() as $page) { + include __DIR__ . '/item.php'; } - authenticated(showButtons); - </script> + include_once __DIR__ . '/item_show.php'; + ?> <?php elseif(!$exists): ?> <h2>"<?= $url ?>" Does not exist!</h2> diff --git a/views/archive/item.php b/views/archive/item.php new file mode 100644 index 0000000..4d3db12 --- /dev/null +++ b/views/archive/item.php @@ -0,0 +1,20 @@ +<section class="item"> + <section> + <div> + <img src="<?= '/archives/' . $page->FaviconPath ?>" class="favicon"> + <a href="<?= '/archives/' . $page->WID . '/index.php' ?>"><?= $page->URL ?></a> + <span class="float-right"><?= $page->Date ?></span> + </div> + <div class="details"> + <span>Visits: <?= $page->Visits ?></span> + <span class="float-right"><?= Database\User::fromDBuid($page->RequesterUID)->Username ?></span> + </div> + </section> + <section name="itemButton" hidden> + <form action="/list/update" method="GET"> + <input type="hidden" name="wid" value="<?= $page->WID ?>"> + <input type="submit" value="+"> + </form> + <span><!-- Delete (when admin) button --></span> + </section> +</section> diff --git a/views/archive/item_show.php b/views/archive/item_show.php new file mode 100644 index 0000000..1a31f4b --- /dev/null +++ b/views/archive/item_show.php @@ -0,0 +1,8 @@ +<script type="text/javascript"> + function showButtons() { + for (buttonset of document.getElementsByName('itemButton')) { + buttonset.hidden = false; + } + } + authenticated(showButtons); +</script> diff --git a/views/profile/index.php b/views/profile/index.php index 0a10e4a..58a43e2 100644 --- a/views/profile/index.php +++ b/views/profile/index.php @@ -18,36 +18,12 @@ <h2 onclick="openArchives()">Archives</h2> <h2 onclick="openLists()">Lists</h2> <section id="user-archives"> - <?php foreach ($user->archives() as $page): ?> - <section class="item"> - <section> - <div> - <img src="<?= '/archives/' . $page->FaviconPath ?>" class="favicon"> - <a href="<?= '/archives/' . $page->WID ?>"><?= $page->URL ?></a> - <span class="float-right"><?= $page->Date ?></span> - </div> - <div class="details"> - <span>Visits: <?= $page->Visits ?></span> - <span class="float-right"><?= Database\User::fromDBuid($page->RequesterUID)->Username ?></span> - </div> - </section> - <section name="itemButton" hidden> - <form action="/list/update" method="GET"> - <input type="hidden" name="wid" value="<?= $page->WID ?>"> - <input type="submit" value="+"> - </form> - <span><!-- Delete (when admin) button --></span> - </section> - </section> - <?php endforeach; ?> - <script type="text/javascript"> - function showButtons() { - for (buttonset of document.getElementsByName('itemButton')) { - buttonset.hidden = false; - } - } - authenticated(showButtons); - </script> + <?php + foreach ($user->archives() as $page) { + include $VIEWS_DIR . '/archive/item.php'; + } + include_once $VIEWS_DIR . '/archive/item_show.php'; + ?> </section> <section id="user-lists" hidden> |
