aboutsummaryrefslogtreecommitdiff
path: root/app/view
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2019-08-09 15:58:37 +0200
committervincent-peugnet <v.peugnet@free.fr>2019-08-09 15:58:37 +0200
commit93c827446737252c36d6d9daee7e2e7a55eb911b (patch)
treec3c602a65e971b0953ff9c6d98cbb2b017964b12 /app/view
parent95ada5c09026882f384a4a386916b1b2decbfce9 (diff)
downloadwcms-93c827446737252c36d6d9daee7e2e7a55eb911b.tar.gz
wcms-93c827446737252c36d6d9daee7e2e7a55eb911b.zip
New Feature : Alert pages have more options
Diffstat (limited to 'app/view')
-rw-r--r--app/view/templates/admin.php367
-rw-r--r--app/view/templates/alert.php104
-rw-r--r--app/view/templates/read.php56
3 files changed, 333 insertions, 194 deletions
diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php
index c1d7ff4..98027dc 100644
--- a/app/view/templates/admin.php
+++ b/app/view/templates/admin.php
@@ -8,237 +8,310 @@
<?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'admin']) ?>
-<main class="admin">
+ <main class="admin">
- <section>
+ <section>
- <form action="<?= $this->url('adminupdate') ?>" method="post">
+ <form action="<?= $this->url('adminupdate') ?>" method="post">
- <article>
+ <article>
- <h1>Administration</h1>
+ <h1>Administration</h1>
- <input type="submit" value="Update configuration">
- </article>
+ <input type="submit" value="Update configuration">
+ </article>
- <article>
+ <article>
- <h2>Home page</h2>
+ <h2>Home page</h2>
- <p>Here you can set the home-page view for visitors.</p>
+ <p>Here you can set the home-page view for visitors.</p>
- <div class="radio">
- <input type="radio" name="homepage" value="default" id="default" <?= Config::homepage() === 'default' ? 'checked' : '' ?>>
- <label for="default">default</label>
- </div>
+ <div class="radio">
+ <input type="radio" name="homepage" value="default" id="default" <?= Config::homepage() === 'default' ? 'checked' : '' ?>>
+ <label for="default">default</label>
+ </div>
- <div class="radio">
- <input type="radio" name="homepage" value="search" id="searchbar" <?= Config::homepage() === 'search' ? 'checked' : '' ?>>
- <label for="searchbar">search bar</label>
- </div>
+ <div class="radio">
+ <input type="radio" name="homepage" value="search" id="searchbar" <?= Config::homepage() === 'search' ? 'checked' : '' ?>>
+ <label for="searchbar">search bar</label>
+ </div>
- <div class="radio">
- <input type="radio" name="homepage" value="redirect" id="redirect" <?= Config::homepage() === 'redirect' ? 'checked' : '' ?>>
- <label for="redirect">redirect to page</label>
- </div>
+ <div class="radio">
+ <input type="radio" name="homepage" value="redirect" id="redirect" <?= Config::homepage() === 'redirect' ? 'checked' : '' ?>>
+ <label for="redirect">redirect to page</label>
+ </div>
- <select name="homeredirect" id="homeredirect">
- <option value="" <?= Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option>
+ <select name="homeredirect" id="homeredirect">
+ <option value="" <?= Config::homeredirect() === null ? 'selected' : '' ?>>--select page to redirect--</option>
- <?php
- foreach ($artlist as $art) {
- ?>
- <option value="<?= $art ?>" <?= Config::homeredirect() === $art ? 'selected' : '' ?>><?= $art ?></option>
- <?php
- }
+ <?php
+ foreach ($artlist as $art) {
+ ?>
+ <option value="<?= $art ?>" <?= Config::homeredirect() === $art ? 'selected' : '' ?>><?= $art ?></option>
+ <?php
+ }
- ?>
- </select>
+ ?>
+ </select>
- </article>
+ </article>
- <article>
+ <article>
- <h2>Page creation</h2>
+ <h2>Page creation</h2>
- <label for="defaultprivacy">Default privacy</label>
- <select name="defaultprivacy" id="defaultprivacy">
- <option value="0" <?= Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option>
- <option value="1" <?= Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option>
- <option value="2" <?= Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option>
- </select>
+ <p>What really happend when you create a new page</p>
+ <label for="defaultprivacy">Default privacy</label>
+ <select name="defaultprivacy" id="defaultprivacy">
+ <option value="0" <?= Config::defaultprivacy() == 0 ? 'selected' : '' ?>>public</option>
+ <option value="1" <?= Config::defaultprivacy() == 1 ? 'selected' : '' ?>>private</option>
+ <option value="2" <?= Config::defaultprivacy() == 2 ? 'selected' : '' ?>>not published</option>
+ </select>
- <label for="defaultart">Create new page BODY based on an already existing one</label>
- <select name="defaultart" id="defaultart">
- <option value="" <?= Config::defaultart() === '' || !$defaultartexist ? 'selected' : '' ?>>--use default BODY element--</option>
- <?php
- foreach ($artlist as $art) {
- ?>
- <option value="<?= $art ?>" <?= Config::defaultart() === $art ? 'selected' : '' ?>><?= $art ?></option>
- <?php }
- ?>
- </select>
- <?php
- if(empty(!$defaultartexist || Config::defaultart())) {
- ?>
- <label for="defaultbody">Edit default BODY element</label>
- <textarea name="defaultbody" id="defaultbody" cols="30" rows="10"><?= Config::defaultbody() ?></textarea>
- <?php
- }
- ?>
+ <label for="defaultart">Or, create new page BODY based on an already existing one</label>
+ <select name="defaultart" id="defaultart">
+ <option value="" <?= Config::defaultart() === '' || !$defaultartexist ? 'selected' : '' ?>>--use default BODY element--</option>
+ <?php
+ foreach ($artlist as $art) {
+ ?>
+ <option value="<?= $art ?>" <?= Config::defaultart() === $art ? 'selected' : '' ?>><?= $art ?></option>
+ <?php }
+ ?>
+ </select>
- </article>
+ <?php
+ if (empty(!$defaultartexist || Config::defaultart())) {
+ ?>
+ <label for="defaultbody">Edit default BODY element</label>
+ <textarea name="defaultbody" id="defaultbody" cols="30" rows="10"><?= Config::defaultbody() ?></textarea>
+ <?php
+ }
+ ?>
- <article>
+ </article>
+ <article>
- <h2>Editing</h2>
- <label for="existnot">Text to show when a page does not exist yet</label>
- <input type="text" name="existnot" id="existnot" value="<?= Config::existnot() ?>">
+ <h2>Alert pages</h2>
+ <h4>Common options</h4>
- <h4>Render</h4>
+ <label for="alerttitle">H1 Title</label>
+ <input type="text" name="alerttitle" id="alerttitle" value="<?= Config::alerttitle() ?>">
- <div class="checkbox">
- <input type="hidden" name="reccursiverender" value="0">
- <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Config::reccursiverender() ? 'checked' : '' ?>>
- <label for="reccursiverender">Reccursive render</label>
- </div>
+ <label for="alertlink">Link to this page (for visitors)</label>
+ <select name="alertlink" id="alertlink">
+ <option value="" <?= empty(Config::alertlink()) ? 'selected' : '' ?>>--No link--</option>
+ <?php
+ foreach ($artlist as $art) {
+ ?>
+ <option value="<?= $art ?>" <?= Config::alertlink() === $art ? 'selected' : '' ?>><?= $art ?></option>
+ <?php }
+ ?>
+ </select>
- <h4>Links</h4>
-
- <div class="checkbox">
- <input type="hidden" name="externallinkblank" value="0">
- <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Config::externallinkblank() ? 'checked' : '' ?>>
- <label for="externallinkblank">Open external links in new tab</label>
- </div>
- <div class="checkbox">
- <input type="hidden" name="internallinkblank" value="0">
- <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Config::internallinkblank() ? 'checked' : '' ?>>
- <label for="internallinkblank">Open internal links in new tab</label>
- </div>
+ <label for="alertlinktext">Link text</label>
+ <input type="text" name="alertlinktext" id="alertlinktext" value="<?= Config::alertlinktext() ?>">
- <i>(This modifications need re-rendering)</i>
- <h4>Edit quick menu</h4>
- <div class="checkbox">
- <input type="hidden" name="showeditmenu" value="false">
- <input type="checkbox" name="showeditmenu" id="showeditmenu" value="true" <?= Config::showeditmenu() === true ? 'checked' : '' ?>>
- <label for="showeditmenu">Show editor menu in top right corner of pages</label>
- </div>
+ <h4>Un-existing</h4>
- <?php
- if(Config::showeditmenu() === true) {
- ?>
- <label for="editsymbol">Symbol</label>
- <select name="editsymbol" id="editsymbol">
- <?php
- foreach (Model::EDIT_SYMBOLS as $symbol) {
- ?>
- <option value="<?= $symbol ?>" <?= Config::editsymbol() === $symbol ? 'selected' : '' ?>><?= $symbol ?></option>
- <?php
- }
- ?>
- </select>
- <?php
- }
- ?>
+ <label for="existnot">Text to show when a page does not exist yet.</label>
+ <i>This will also be shown as a tooltip over links.</i>
+ <input type="text" name="existnot" id="existnot" value="<?= Config::existnot() ?>">
- </article>
+ <div class="checkbox">
+ <input type="hidden" name="existnotpass" value="0">
+ <input type="checkbox" name="existnotpass" id="existnotpass" value="1" <?= Config::existnotpass() ? 'checked' : '' ?>>
+ <label for="existnotpass">Ask for password</label>
+ </div>
+ <h4>Private</h4>
+ <label for="private">Text to show when a page is private.</label>
+ <input type="text" name="private" id="private" value="<?= Config::private() ?>">
+ <div class="checkbox">
+ <input type="hidden" name="privatepass" value="0">
+ <input type="checkbox" name="privatepass" id="privatepass" value="1" <?= Config::privatepass() ? 'checked' : '' ?>>
+ <label for="privatepass">Ask for password</label>
+ </div>
+ <h4>Not published</h4>
- <article>
+ <label for="notpublished">Text to show when a page is not published.</label>
+ <input type="text" name="notpublished" id="notpublished" value="<?= Config::notpublished() ?>">
- <h2>CSS</h2>
+ <div class="checkbox">
+ <input type="hidden" name="notpublishedpass" value="0">
+ <input type="checkbox" name="notpublishedpass" id="notpublishedpass" value="1" <?= Config::notpublishedpass() ? 'checked' : '' ?>>
+ <label for="notpublishedpass">Ask for password</label>
+ </div>
- <label for="globalcss">Edit global css that will apply to every pages</label>
- <textarea name="globalcss" id="globalcss" cols="30" rows="10"><?= $globalcss ?></textarea>
+ <h4>CSS</h4>
- <label for="defaultfavicon">Default favicon</label>
- <select name="defaultfavicon" id="defaultfavicon">
- <option value="">--no favicon--</option>
- <?php
- foreach ($faviconlist as $favicon) {
- ?>
- <option value="<?= $favicon ?>" <?= Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
- <?php
- }
- ?>
- </select>
+ <div class="checkbox">
+ <input type="hidden" name="alertcss" value="0">
+ <input type="checkbox" name="alertcss" id="alertcss" value="1" <?= Config::alertcss() ? 'checked' : '' ?>>
+ <label for="alertcss">Use global.css for those page as well</label>
+ </div>
- </article>
+ <p>
+ <i>You can use <code>body.alert</code> class to specify style.</i>
+ </p>
+ </article>
+
+
+ <article>
+
+ <h2>Render</h2>
+ <div class="checkbox">
+ <input type="hidden" name="reccursiverender" value="0">
+ <input type="checkbox" name="reccursiverender" id="reccursiverender" value="1" <?= Config::reccursiverender() ? 'checked' : '' ?>>
+ <label for="reccursiverender">Reccursive render</label>
+ </div>
+ <h4>Links</h4>
+ <div class="checkbox">
+ <input type="hidden" name="externallinkblank" value="0">
+ <input type="checkbox" name="externallinkblank" id="externallinkblank" value="1" <?= Config::externallinkblank() ? 'checked' : '' ?>>
+ <label for="externallinkblank">Open external links in new tab</label>
+ </div>
- <article>
+ <div class="checkbox">
+ <input type="hidden" name="internallinkblank" value="0">
+ <input type="checkbox" name="internallinkblank" id="internallinkblank" value="1" <?= Config::internallinkblank() ? 'checked' : '' ?>>
+ <label for="internallinkblank">Open internal links in new tab</label>
+ </div>
- <h2>Interface</h2>
+ <i>(This modifications need re-rendering)</i>
- <p>Set interface Style</p>
+ <h4>Edit quick menu</h4>
- <select name="interfacecss" id="interfacecss">
- <option value="null">--default interface style---</option>
- <?php
- foreach ($interfacecsslist as $interfacecss) {
- ?>
- <option value="<?= $interfacecss ?>" <?= $interfacecss === Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option>
+ <div class="checkbox">
+ <input type="hidden" name="showeditmenu" value="false">
+ <input type="checkbox" name="showeditmenu" id="showeditmenu" value="true" <?= Config::showeditmenu() === true ? 'checked' : '' ?>>
+ <label for="showeditmenu">Show editor menu in top right corner of pages</label>
+ </div>
+
+ <?php
+ if (Config::showeditmenu() === true) {
+ ?>
+ <label for="editsymbol">Symbol</label>
+ <select name="editsymbol" id="editsymbol">
+ <?php
+ foreach (Model::EDIT_SYMBOLS as $symbol) {
+ ?>
+ <option value="<?= $symbol ?>" <?= Config::editsymbol() === $symbol ? 'selected' : '' ?>><?= $symbol ?></option>
+ <?php
+ }
+ ?>
+ </select>
<?php
- }
- ?>
- </select>
+ }
+ ?>
+
+ </article>
+
+
+
+
+
+ <article>
+
+ <h2>CSS</h2>
+
+ <label for="globalcss">Edit global css that will apply to every pages</label>
+ <textarea name="globalcss" id="globalcss" cols="30" rows="10"><?= $globalcss ?></textarea>
+
+ <label for="defaultfavicon">Default favicon</label>
+ <select name="defaultfavicon" id="defaultfavicon">
+ <option value="">--no favicon--</option>
+ <?php
+ foreach ($faviconlist as $favicon) {
+ ?>
+ <option value="<?= $favicon ?>" <?= Config::defaultfavicon() === $favicon ? 'selected' : '' ?>><?= $favicon ?></option>
+ <?php
+ }
+ ?>
+ </select>
+
+ </article>
+
+
+
+
+
+
+
+ <article>
+
+ <h2>Interface</h2>
+
+ <p>Set interface Style</p>
+
+ <select name="interfacecss" id="interfacecss">
+ <option value="null">--default interface style---</option>
+ <?php
+ foreach ($interfacecsslist as $interfacecss) {
+ ?>
+ <option value="<?= $interfacecss ?>" <?= $interfacecss === Config::interfacecss() ? 'selected' : '' ?>><?= $interfacecss ?></option>
+ <?php
+ }
+ ?>
+ </select>
- </article>
+ </article>
- <article>
+ <article>
- <h2>Tracking</h2>
+ <h2>Tracking</h2>
- <label for="analytics">Google analytics Tracking ID</label>
- <input type="text" name="analytics" id="analytics" value="<?= Config::analytics() ?>">
+ <label for="analytics">Google analytics Tracking ID</label>
+ <input type="text" name="analytics" id="analytics" value="<?= Config::analytics() ?>">
- <i>(Need rendering to work)</i>
+ <i>(Need rendering to work)</i>
- </article>
+ </article>
- <article>
- <input type="submit" value="Update configuration">
- </article>
+ <article>
+ <input type="submit" value="Update configuration">
+ </article>
- </form>
+ </form>
- </section>
+ </section>
-</main>
+ </main>
</body>
<?php $this->stop('page') ?> \ No newline at end of file
diff --git a/app/view/templates/alert.php b/app/view/templates/alert.php
new file mode 100644
index 0000000..ff29e30
--- /dev/null
+++ b/app/view/templates/alert.php
@@ -0,0 +1,104 @@
+<?php
+
+$this->layout('readerlayout') ?>
+
+<?php
+$this->start('head');
+?>
+
+<head>
+ <?= Config::alertcss() ? '<link href="' . Model::globalpath() . 'global.css" rel="stylesheet" />' : '' ?>
+</head>
+
+
+<?php
+$this->stop();
+?>
+
+
+
+<?php $this->start('page') ?>
+
+<body class="alert">
+
+<main class="alert">
+
+ <?php
+ if ($readernav) {
+ $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist, 'canedit' => $canedit]);
+ }
+
+ ?>
+
+
+
+
+ <?= !empty(Config::alerttitle()) ? '<h1>' . Config::alerttitle() . '</h1>' : '' ?>
+
+ <?php
+
+ $form = '<p>
+ <form action="/!co" method="post">
+ <input type="password" name="pass" id="loginpass" placeholder="password">
+ <input type="hidden" name="route" value="artread/">
+ <input type="hidden" name="id" value="' . $art->id() . '">
+ <input type="submit" name="log" value="login" id="button">
+ </form>
+ </p>';
+
+
+ if(!$artexist) {
+ if(!empty(Config::existnot())) {
+ echo '<h2>' . Config::existnot() . '</h2>';
+ }
+ if(Config::existnotpass() && !$canedit) {
+ echo $form;
+ }
+ } else {
+
+
+
+ switch ($art->secure()) {
+ case 1:
+ if(!empty(Config::private())) {
+ echo '<h2>' . Config::private() . '</h2>';
+ }
+ if(Config::privatepass()) {
+ echo $form;
+ }
+ break;
+
+ case 2:
+ if(!empty(Config::notpublished())) {
+ echo '<h2>' . Config::notpublished() . '</h2>';
+ }
+ if(Config::notpublishedpass()) {
+ echo $form;
+ }
+ break;
+ }
+ }
+
+
+
+ if ($canedit) {
+ ?>
+ <p><a href="<?= $this->uart('artadd', $art->id()) ?>">⭐ Create</a></p>
+ <?php
+ } elseif(!empty(Config::alertlink())) {
+ ?>
+ <p><a href="<?= $this->uart('artread/', Config::alertlink()) ?>"><?= empty(Config::alertlinktext()) ? Config::alertlink() : Config::alertlinktext() ?></a></p>
+ <?php
+ }
+
+
+ ?>
+
+
+
+</main>
+
+
+</body>
+
+<?php $this->stop() ?> \ No newline at end of file
diff --git a/app/view/templates/read.php b/app/view/templates/read.php
index f8201cc..54b137e 100644
--- a/app/view/templates/read.php
+++ b/app/view/templates/read.php
@@ -3,69 +3,31 @@
<?php
$this->start('head');
-if ($artexist) {
- if ($canread) {
- echo $head;
- } else {
- $this->insert('arthead', ['title' => $art->title(), 'description' => $art->description()]);
- }
-} else {
- $this->insert('arthead', ['title' => $art->id(), 'description' => $alertnotexist]);
-}
-
-
+echo $head;
$this->stop();
?>
-
-
-
-
-
-
<?php $this->start('page') ?>
- <body>
-
-
+<body>
- <?php
- if ($readernav) {
- $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist, 'canedit' => $canedit]);
- }
- ?>
-
- <?php
-
- if ($artexist) {
+ <?php
+ if ($readernav) {
+ $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist, 'canedit' => $canedit]);
+ }
- if ($canread) {
- echo $body;
- } else {
- echo '<h1>'.$alertprivate.'</h1>';
- }
- } else {
- if(!empty(Config::existnot())) {
- echo '<h1>' . Config::existnot() . '</h1>';
- }
- if ($user->iseditor()) {
- ?>
- <a href="<?= $this->uart('artadd', $art->id()) ?>">⭐ Create</a>
- <?php
- }
- }
+ echo $body;
+ ?>
- ?>
-
- </body>
+</body>
<?php $this->stop() ?> \ No newline at end of file