diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-10-28 19:56:27 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-10-28 19:56:27 +0100 |
commit | e17392e46259e6f2e012017987cf7c31c171488f (patch) | |
tree | 72b61b63e32819e81433e8df6f14dc92b0e3a604 /w/view | |
parent | a91c916248f967da2d4218b575e665242b7c975b (diff) | |
download | wcms-e17392e46259e6f2e012017987cf7c31c171488f.tar.gz wcms-e17392e46259e6f2e012017987cf7c31c171488f.zip |
abstract config NWY
Diffstat (limited to 'w/view')
-rw-r--r-- | w/view/templates/base.php | 10 | ||||
-rw-r--r-- | w/view/templates/body.php | 0 | ||||
-rw-r--r-- | w/view/templates/edit.php | 47 | ||||
-rw-r--r-- | w/view/templates/edithelp.php | 27 | ||||
-rw-r--r-- | w/view/templates/editsidebar.php | 40 | ||||
-rw-r--r-- | w/view/templates/edittabs.php | 19 | ||||
-rw-r--r-- | w/view/templates/edittopbar.php | 12 | ||||
-rw-r--r-- | w/view/templates/home.php | 85 | ||||
-rw-r--r-- | w/view/templates/homeopt.php | 84 | ||||
-rw-r--r-- | w/view/templates/layout.php | 20 | ||||
-rw-r--r-- | w/view/templates/nav.php | 42 | ||||
-rw-r--r-- | w/view/templates/navart.php | 64 | ||||
-rw-r--r-- | w/view/templates/navback.php | 54 | ||||
-rw-r--r-- | w/view/templates/read.php | 55 | ||||
-rw-r--r-- | w/view/templates/readart.php | 25 | ||||
-rw-r--r-- | w/view/templates/readcreate.php | 3 | ||||
-rw-r--r-- | w/view/templates/reader.php | 38 |
17 files changed, 521 insertions, 104 deletions
diff --git a/w/view/templates/base.php b/w/view/templates/base.php deleted file mode 100644 index aaca8e1..0000000 --- a/w/view/templates/base.php +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> - <title><?=$this->e($title)?></title> -</head> -<body> - -<?=$this->section('content')?> - -</body> -</html>
\ No newline at end of file diff --git a/w/view/templates/body.php b/w/view/templates/body.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/w/view/templates/body.php diff --git a/w/view/templates/edit.php b/w/view/templates/edit.php new file mode 100644 index 0000000..39c2104 --- /dev/null +++ b/w/view/templates/edit.php @@ -0,0 +1,47 @@ +<?php $this->layout('layout', ['title' => 'β '.$art->title()]) ?> + + + + + +<?php $this->start('customhead') ?> + <script src="./rsc/js/app.js"></script> +<?php $this->stop() ?> + + + + + + +<?php $this->start('page') ?> + +<body> + + <?php $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist]) ?> + + +<form action="?id=<?= $art->id() ?>&action=update" method="post" id="artedit"> + + + + <?php $this->insert('edittopbar', ['config' => $config, 'art' => $art]) ?> + <?php $this->insert('editsidebar', ['config' => $config, 'art' => $art]) ?> + + +<style>textarea{font-size: <?= Config::fontsize() ?>px}</style> + + <?php + $tablist = ['section' => $art->md(), 'css' => $art->css(), 'header' => $art->header(), 'nav' => $art->nav(), 'aside' => $art->aside(), 'footer' => $art->footer(), 'html' => $art->html(), 'javascript' => $art->javascript()]; + $this->insert('edittabs', ['tablist' => $tablist, 'opentab' => $art->interface()]) + ?> + + + + +<input type="hidden" name="id" value="<?= $art->id() ?>"> + +</form> + +</body> + +<?php $this->stop() ?>
\ No newline at end of file diff --git a/w/view/templates/edithelp.php b/w/view/templates/edithelp.php new file mode 100644 index 0000000..fee94c7 --- /dev/null +++ b/w/view/templates/edithelp.php @@ -0,0 +1,27 @@ + + <h2>Help !</h2> + <p>To save your article, press the HOME, UPDATE, or DISPLAY buttons. You can use the keyboard shortcuts as well.</p> + <pre><span class="i">ALT + W</span> : home</pre> + <pre><span class="i">ALT + X</span> : update</pre> + <pre><span class="i">ALT + C</span> : display</pre> + <h3>Markdown</h3> + <p>The html section use <a href="https://daringfireball.net/projects/markdown/syntax" target="_blank">Markdown encoding</a>. Actualy, W is using Michel Fortin's <a href="https://michelf.ca/projects/php-markdown/extra/" target="_blank">Markdown Extra</a>.</p> + <h3>Links</h3> + <pre>[text](=<span class="i">article_id</span>)</pre> + <p>where article_id is the article's id you want to point to.</p> + <h3>Images</h3> + <pre>[altimage](/<span class="i">img_id.extension</span>)</pre> + <p>Where img_id is the id of your image and its extension.</p> + <h3>Shortcuts</h3> + <pre>%TITLE%</pre> + <p>Show the title of your article.</p> + <pre>%DESCRIPTION%</pre> + <p>Show the description of your article.</p> + <pre>%SUMMARY%</pre> + <p>Generate a <strong>summary</strong>, the list of all your head titles using #, ##, ###...</p> + <pre>%%<span class="i">tag_name</span>%%</pre> + <p>Generate a <strong>menu</strong>, a list of links to all articles under this tag.</p> + <p>vv</p> + <p>vv</p> + <p>vv</p> + <p></p>
\ No newline at end of file diff --git a/w/view/templates/editsidebar.php b/w/view/templates/editsidebar.php new file mode 100644 index 0000000..99612dd --- /dev/null +++ b/w/view/templates/editsidebar.php @@ -0,0 +1,40 @@ +<div class="sidebar"> + <details id="editinfo" open> + <summary>Infos</summary> + <fieldset> + <label for="title">title :</label> + <input type="text" name="title" id="title" value="<?= $art->title(); ?>"> + <label for="description">Description :</label> + <input type="text" name="description" id="description" value="<?= $art->description(); ?>"> + <label for="tag">Tag(s) :</label> + <input type="text" name="tag" id="tag" value="<?= $art->tag('string'); ?>"> + <label for="secure">Privacy level :</label> + <select name="secure" id="secure"> + <option value="0" <?= $art->secure() == 0 ? 'selected' : '' ?>>0</option> + <option value="1" <?= $art->secure() == 1 ? 'selected' : '' ?>>1</option> + <option value="2" <?= $art->secure() == 2 ? 'selected' : '' ?>>2</option> + <option value="3" <?= $art->secure() == 3 ? 'selected' : '' ?>>3</option> + </select> + </fieldset> + </details> + <details> + <summary>Advanced</summary> + <fieldset> + <h3>Template options</h3> + <p>NOT WORKING</p> + </fieldset> + </details> + <details id="editcss" open> + <summary>Quick CSS</summary> + + </details> + <details> + <summary>Help</summary> + <div id="help"> + <?php $this->insert('edithelp') ?> + + </div> + </details> + + +</div>
\ No newline at end of file diff --git a/w/view/templates/edittabs.php b/w/view/templates/edittabs.php new file mode 100644 index 0000000..c65a7c7 --- /dev/null +++ b/w/view/templates/edittabs.php @@ -0,0 +1,19 @@ +<div class="tabs"> + +<?php +foreach ($tablist as $key => $value) { + echo '<div class="tab">'; + if ($key == $opentab) { + echo '<input name="interface" type="radio" value="'.$key.'" id="tab' . $key . '" class="checkboxtab" checked>'; + } else { + echo '<input name="interface" type="radio" value="'.$key.'" id="tab' . $key . '" class="checkboxtab">'; + } + echo '<label for="tab' . $key . '">' . $key . '</label>'; + echo '<div class="content">'; + echo '<textarea name="' . $key . '" id="' . $key . '" >' . $value . '</textarea>'; + echo '</div>'; + echo '</div>'; +} +?> + +</div>
\ No newline at end of file diff --git a/w/view/templates/edittopbar.php b/w/view/templates/edittopbar.php new file mode 100644 index 0000000..7e7f9e8 --- /dev/null +++ b/w/view/templates/edittopbar.php @@ -0,0 +1,12 @@ +<div id="submit"> + <!-- <input type="submit" name="action" value="home" accesskey="w" onclick="document.getElementById('artedit').submit();" form="artedit"> --> + <input type="submit" name="action" value="update" accesskey="x" onclick="document.getElementById('artedit').submit();" form="artedit"> + <!-- <input type="submit" name="action" value="display" accesskey="c" onclick="document.getElementById('artedit').submit();" form="artedit"> --> + <!-- <input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Delete this article', 'artedit')" form="artedit"> --> + <a href="?id=<?= $art->id() ?>" target="_blank">π</a> + + <span id="headid"><?= $art->id() ?></span> + + <label for="fontsize">Font-size</label> + <input type="number" name="fontsize" value="<?= Config::fontsize() ?>" id="fontsize"> +</div>
\ No newline at end of file diff --git a/w/view/templates/home.php b/w/view/templates/home.php new file mode 100644 index 0000000..34bac1a --- /dev/null +++ b/w/view/templates/home.php @@ -0,0 +1,85 @@ +<?php $this->layout('layout', ['title' => 'home']) ?> + + + + +<?php $this->start('page') ?> + + +<body> + + <?php $this->insert('navback', ['user' => $user]) ?> + + +<section> +<div id="flex"> + + + <?php $this->insert('homeopt', ['opt' => $opt]) ?> + + + +<div id="main"> +<h2>Articles</h2> +<form action="./" method="post"> + + + <div id="massedit"> + <h3>Mass Edit</h3> + <select name="massedit" required> + <option value="public">set as public</option> + <option value="private">set as private</option> + <option value="not published">set as not published</option> + <option value="erasetag">erase all tags</option> + <option value="erasetemplate">erase template</option> + <option value="delete">delete</option> + </select> + + <input type="submit" name="massaction" value="do" onclick="confirmSubmit(event, 'Are you sure')" > + + <input type="text" name="targettag" placeholder="add tag"> + <input type="submit" name="massaction" value="add tag" onclick="confirmSubmit(event, 'Are you sure')" > + + <select name="masstemplate"> + <?php + foreach ($table2 as $art) { + echo '<option value="' . $art->id() . '">' . $art->id() . '</option>'; + } + ?> + </select> + + <input type="submit" name="massaction" value="set template" onclick="confirmSubmit(event, 'Are you sure')" > + + <input type="hidden" name="action" value="massedit"> + </div> + + + <table id="home2table"> + <tr><th>x</th><th>id</th><th>edit</th><th>see</th><th>log</th><th>tag</th><th>summary</th><th>β to</th><th>β from</th><th>last modification</th><th>date of creation</th><th>privacy</th></tr> + <?php foreach ($table2 as $item) { ?> + <tr> + <td><input type="checkbox" name="id[]" value="<?= $item->id() ?>" id="<?= $item->id() ?>"></td> + <td><label title="<?= $item->title() ?>" for="<?= $item->id() ?>"><?= $item->id() ?></label></td> + <td><a href="?id=<?= $item->id() ?>&aff=edit">β</a></td> + <td><a href="?id=<?= $item->id() ?>" target="_blank">π</a></td> + <td><a href="?id=<?= $item->id() ?>&aff=log" target="_blank">ΒΆ</a></td> + <td><?= $item->tag('sort') ?></td> + <td><?= $item->description() ?></td> + <td><?= $item->linkto('sort') ?></td> + <td><?= $item->linkfrom('sort') ?></td> + <td><?= $item->datemodif('hrdi') ?></td> + <td><?= $item->datecreation('hrdi') ?></td> + <td><?= $item->secure('string') ?></td> + </tr> + + <?php }?> + </table> +</form> +</div> +</div> +</section> +</body> + + + +<?php $this->stop() ?>
\ No newline at end of file diff --git a/w/view/templates/homeopt.php b/w/view/templates/homeopt.php new file mode 100644 index 0000000..cecb79b --- /dev/null +++ b/w/view/templates/homeopt.php @@ -0,0 +1,84 @@ +<div id="options"> +<h2>Options</h2> +<form action="./" method="get" > +<input type="submit" name="submit" value="filter"> +β¬
<input type="submit" name="submit" value="reset"> + + + <!-- $this->optionsort($opt); + $this->optionprivacy($opt); + $this->optiontag($opt); --> + +<fieldset><legend>Sort</legend> +<select name="sortby" id="sortby"> +<?php +foreach ($opt->col('array') as $key => $col) { + echo '<option value="' . $col . '" ' . ($opt->sortby() == $col ? "selected" : "") . '>' . $col . '</option>'; +} +?> +</select> +</br> +<input type="radio" id="asc" name="order" value="1" <?= $opt->order() == '1' ? "checked" : "" ?>/><label for="asc">ascending</label> +</br> +<input type="radio" id="desc" name="order" value="-1" <?= $opt->order() == '-1' ? "checked" : "" ?>/><label for="desc">descending</label> + +</fieldset> + +<fieldset><legend>Privacy</legend><ul> +<li><input type="radio" id="4" name="secure" value="4"<?= $opt->secure() == 4 ? "checked" : "" ?>/><label for="4">all</label></li> +<li><input type="radio" id="3" name="secure" value="3"<?= $opt->secure() == 3 ? "checked" : "" ?>/><label for="3">editor</label></li> +<li><input type="radio" id="2" name="secure" value="2"<?= $opt->secure() == 2 ? "checked" : "" ?>/><label for="2">invite only</label></li> +<li><input type="radio" id="1" name="secure" value="1"<?= $opt->secure() == 1 ? "checked" : "" ?>/><label for="1">private</label></li> +<li><input type="radio" id="0" name="secure" value="0"<?= $opt->secure() == 0 ? "checked" : "" ?>/><label for="0">public</label></li> +</ul></fieldset> + + <fieldset><legend>Tag</legend><ul> + + +<input type="radio" id="OR" name="tagcompare" value="OR" ' . <?= $opt->tagcompare() == "OR" ? "checked" : "" ?> ><label for="OR">OR</label> +<input type="radio" id="AND" name="tagcompare" value="AND" <?= $opt->tagcompare() == "AND" ? "checked" : "" ?>><label for="AND">AND</label> + +<?php +$in = false; +$out = false; +$limit = 1; +foreach ($opt->taglist() as $tagfilter => $count) { + + if ($count > $limit && $in == false) { + echo '<details open><summary>>' . $limit . '</summary>'; + $in = true; + } + if ($count == $limit && $in == true && $out == false) { + echo '</details><details><summary>' . $limit . '</summary>'; + $out = true; + } + + if (in_array($tagfilter, $opt->tagfilter())) { + + echo '<li><input type="checkbox" name="tagfilter[]" id="' . $tagfilter . '" value="' . $tagfilter . '" checked /><label for="' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>'; + } else { + echo '<li><input type="checkbox" name="tagfilter[]" id="' . $tagfilter . '" value="' . $tagfilter . '" /><label for="' . $tagfilter . '">' . $tagfilter . ' (' . $count . ')</label></li>'; + } +} +if ($in = true || $out = true) { + echo '</details>'; +} +?> + +</ul></fieldset> + + <?php + if ($opt->invert() == 1) { + echo '<input type="checkbox" name="invert" value="1" id="invert" checked>'; + } else { + echo '<input type="checkbox" name="invert" value="1" id="invert">'; + } + echo '<label for="invert">invert</></br>'; + ?> + + +<input type="submit" name="submit" value="filter"> +β¬
<input type="submit" name="submit" value="reset"> + +</form> +</div> diff --git a/w/view/templates/layout.php b/w/view/templates/layout.php new file mode 100644 index 0000000..263cca3 --- /dev/null +++ b/w/view/templates/layout.php @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf8" /> + + <meta name="viewport" content="width=device-width" /> + <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> + <title><?= $title ?></title> + <link rel="stylesheet" href="./css/soft.css"> + <?=$this->section('customhead')?> + <?=$this->section('arthead')?> + +</head> + + + +<?=$this->section('page')?> + + +</html>
\ No newline at end of file diff --git a/w/view/templates/nav.php b/w/view/templates/nav.php deleted file mode 100644 index e731673..0000000 --- a/w/view/templates/nav.php +++ /dev/null @@ -1,42 +0,0 @@ -<div class="menu"> - <?= $this->e($level) ?> - <div id="dropmenu"> - - <a class="button" href="?">home</a> - - <!-- id if level == 0 --> - <form action="./?action=login<?= isset($this->e($id)) ? '&id=' . $this->e($id) : '' ?>" method="post"> - <input type="password" name="pass" id="loginpass" placeholder="password"> - <input type="submit" value="login"> - </form> - - - <!-- id if level > 0 --> - <form action="./?action=logout<?= isset($this->e($id)) ? '&id=' . $this->e($id) : '' ?>" method="post"> - <input type="submit" value="logout"> - </form> - - - <!-- display / edit --> - - - if ($app->session() >= $app::EDITOR && isset($_GET['id']) && $app->exist($_GET['id'])) { - if (isset($_GET['edit']) && $_GET['edit'] == 1) { - echo '<a class="button" href="?id=' . $_GET['id'] . '" target="_blank">display</a>'; - } else { - echo '<a class="button" href="?id=' . $_GET['id'] . '&edit=1" >edit</a>'; - } - } - if ($app->session() >= $app::EDITOR) { - echo '<a class="button" href="?aff=media" >Media</a>'; - echo '<a class="button" href="?aff=record" >Record</a>'; - if ($app->session() >= $app::ADMIN) { - echo '<a class="button" href="?aff=admin" >Admin</a>'; - } - } - - - - -</div> -</dav>
\ No newline at end of file diff --git a/w/view/templates/navart.php b/w/view/templates/navart.php new file mode 100644 index 0000000..0ddba17 --- /dev/null +++ b/w/view/templates/navart.php @@ -0,0 +1,64 @@ +<div class="menu"> + <?= $user->level() ?> + <div id="dropmenu"> + + <ul> + + <li> + <a class="button" href="./">home</a> + </li> + + +<?php if($user->isvisitor()) { ?> + + <li> + <form action="./?action=login<?= $art->id() !== null ? '&id=' . $art->id() : '' ?>" method="post"> + <input type="password" name="pass" id="loginpass" placeholder="password"> + <input type="submit" value="login"> + </form> + </li> + +<?php } else { ?> + + <li> + <form action="./?action=logout<?= $art->id() !== null ? '&id=' . $art->id() : '' ?>" method="post"> + <input type="submit" value="logout"> + </form> + </li> + +<?php } ?> + + +<?php if($user->canedit() && $artexist) { ?> + + <li> + <a class="button" href="?id=<?=$art->id() ?>" target="_blank">display</a> + </li> + <li> + <a class="button" href="?id=<?=$art->id() ?>&aff=edit" >edit</a> + </li> + +<?php } ?> + + +<?php if ($user->canedit()) { ?> + + <li> + <a class="button" href="?aff=media" >Media</a> + </li> + +<?php } ?> + +<?php if($user->isadmin()) { ?> + + <li> + <a class="button" href="?aff=admin" >Admin</a> + </li> + +<?php } ?> + + + + + </div> +</div>
\ No newline at end of file diff --git a/w/view/templates/navback.php b/w/view/templates/navback.php new file mode 100644 index 0000000..ab8a4d4 --- /dev/null +++ b/w/view/templates/navback.php @@ -0,0 +1,54 @@ +<div class="menu"> + <?= $user->level() ?> + <div id="dropmenu"> + + <ul> + + <li> + <a class="button" href="./">home</a> + </li> + + +<?php if($user->isvisitor()) { ?> + + <li> + <form action="./?action=login" method="post"> + <input type="password" name="pass" id="loginpass" placeholder="password"> + <input type="submit" value="login"> + </form> + </li> + +<?php } else { ?> + + <li> + <form action="./?action=logout" method="post"> + <input type="submit" value="logout"> + </form> + </li> + +<?php } ?> + + + + +<?php if ($user->canedit()) { ?> + + <li> + <a class="button" href="?aff=media" >Media</a> + </li> + +<?php } ?> + +<?php if($user->isadmin()) { ?> + + <li> + <a class="button" href="?aff=admin" >Admin</a> + </li> + +<?php } ?> + + + </ul> + + </div> +</div>
\ No newline at end of file diff --git a/w/view/templates/read.php b/w/view/templates/read.php index 4d9a58f..5c544b3 100644 --- a/w/view/templates/read.php +++ b/w/view/templates/read.php @@ -1,20 +1,47 @@ -<html> +<?php $this->layout('layout', ['title' => $art->title()]) ?> -<head> - <meta charset="utf8" /> - <meta name="description" content="<?= $art->description() ?>" /> - <meta name="viewport" content="width=device-width" /> - <link rel="shortcut icon" href="./media/logo.png" type="image/x-icon"> - <link href="<?= $globalcss ?>" rel="stylesheet" /> - <?= $edit == 0 ? '<link href="' . $globalcss . '" rel="stylesheet" />' : '<link href="./rsc/css/styleedit.css" rel="stylesheet" />' ?> - <title><?= $edit == 1 ? 'β' : '' ?> <?= $art->title() ?></title> - <script src="./rsc/js/app.js"></script> -</head> - -<?= $html ?> -</html>
\ No newline at end of file + + + + + +<?php $this->start('page') ?> + + <body> + + + + <?php $this->insert('navart', ['user' => $user, 'art' => $art, 'artexist' => $artexist]) ?> + + + + <?php + + if($artexist) { + + if($display) { + $this->insert('readart', ['art' => $art]); + } else { + echo '<h1>You dont have enought rights to see this article</h1>'; + } + + } else { + echo '<h1>This article does not exist yet</h1>'; + if ($cancreate) { + $this->insert('readcreate', ['id' => $art->id()]); + } + } + + + + ?> + + + </body> + +<?php $this->stop() ?>
\ No newline at end of file diff --git a/w/view/templates/readart.php b/w/view/templates/readart.php new file mode 100644 index 0000000..e44877d --- /dev/null +++ b/w/view/templates/readart.php @@ -0,0 +1,25 @@ +<script> +<?=$art->javascript() ?> +</script> + +<body> + +<header> +<?=$art->header()?> +</header> + +<nav> +<?=$art->nav()?> +</nav> + +<aside> +<?=$art->aside()?> +</aside> + +<section> +<?=$art->section()?> +</section> + +<footer> +<?=$art->footer()?> +</footer> diff --git a/w/view/templates/readcreate.php b/w/view/templates/readcreate.php new file mode 100644 index 0000000..fd5df18 --- /dev/null +++ b/w/view/templates/readcreate.php @@ -0,0 +1,3 @@ +<form action="/?id=<?= $id ?>&action=add"> +<input type="submit" value="create"> +</form>
\ No newline at end of file diff --git a/w/view/templates/reader.php b/w/view/templates/reader.php deleted file mode 100644 index 7561ae3..0000000 --- a/w/view/templates/reader.php +++ /dev/null @@ -1,38 +0,0 @@ -<html> -<head> - <meta charset="utf8" /> - <meta name="description" content="<?=$this->e($description)?>" /> - <link href="<?=$this->e($id)?>quickcss" rel="stylesheet" /> - <link href="<?=$this->e($id)?>" rel="stylesheet" /> - <title><?=$this->e($title)?></title> - -</head> - -<script> -<?=$this->e($javascript)?> -</script> - -<body> - -<header> -<?=$this->e($header)?> -</header> - -<nav> -<?=$this->e($nav)?> -</nav> - -<aside> -<?=$this->e($aside)?> -</aside> - -<section> -<?=$this->e($section)?> -</section> - -<footer> -<?=$this->e($footer)?> -</footer> - -</body> -</html>
\ No newline at end of file |