aboutsummaryrefslogtreecommitdiff
path: root/class/class.w.aff.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-07-31 18:29:53 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-07-31 18:29:53 +0200
commite9b2ca7c06875069fa03379258625490872cc33d (patch)
tree3af763a303f07c75d63ca9801c98e58fa9052628 /class/class.w.aff.php
parentc36f25e76f40c6fdd6e02f92713d9c1241ed0a79 (diff)
downloadwcms-e9b2ca7c06875069fa03379258625490872cc33d.tar.gz
wcms-e9b2ca7c06875069fa03379258625490872cc33d.zip
W 2.4 graphic update table sort engine update
Diffstat (limited to 'class/class.w.aff.php')
-rw-r--r--class/class.w.aff.php417
1 files changed, 248 insertions, 169 deletions
diff --git a/class/class.w.aff.php b/class/class.w.aff.php
index cacec99..9f1177a 100644
--- a/class/class.w.aff.php
+++ b/class/class.w.aff.php
@@ -58,12 +58,11 @@ class Aff
public function lecture(Art $art, App $app)
{
- echo '<div class="lecture">';
if ($art->secure() == 1) {
- echo '<span class="alert"><h4>cet article est privé</h4></span>';
+ echo '<span class="alert">This article is private</span>';
}
if ($art->secure() == 2) {
- echo "<span class=\"alert\"><h4>cet article n'est pas publié</h4></span>";
+ echo "<span class=\"alert\">This article is not published yet</span>";
}
if ($app->session() >= $art->secure()) {
@@ -85,17 +84,14 @@ class Aff
}
<?= $art->csstemplate($app) ?>
</style>
- <section>
<header>
<h1><?= $art->titre() ?></h1>
<h6><?= $art->soustitre() ?></h6>
</header>
<article><?= $art->html($app) ?></article>
- </section>
<?php
}
- echo '</div>';
}
public function edit(Art $art, App $app, $list)
@@ -103,45 +99,50 @@ class Aff
if ($app->session() >= self::$edit) {
?>
- <div class="edit">
- <section>
- <form action="?id=<?= $art->id() ?>" method="post">
- <details close>
+
+ <form action="?id=<?= $art->id() ?>" method="post" id="artedit">
+ <textarea style="background-color: <?= $art->couleurbkg() ?>; color: <?= $art->couleurtext() ?>;" name="html" id="html" spellcheck="true" autofocus><?= $art->md(); ?></textarea>
+
+
+ <details id="editinfo" close>
<summary>Infos</summary>
- <label for="titre">Titre :</label>
- <input type="text" name="titre" id="titre" value="<?= $art->titre(); ?>">
- <label for="soustitre">Sous-titre :</label>
- <input type="text" name="soustitre" id="soustitre" value="<?= $art->soustitre(); ?>">
- <label for="intro">Introduction :</label>
- <input type="text" name="intro" id="intro" value="<?= $art->intro(); ?>">
- <label for="tag">Tag(s) :</label>
- <input type="text" name="tag" id="tag" value="<?= $art->tag('string'); ?>">
- <label for="secure">Niveau de sécurité :</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>
- </select>
+ <fieldset>
+ <label for="titre">Titre :</label>
+ <input type="text" name="titre" id="titre" value="<?= $art->titre(); ?>">
+ <label for="soustitre">Sous-titre :</label>
+ <input type="text" name="soustitre" id="soustitre" value="<?= $art->soustitre(); ?>">
+ <label for="intro">Introduction :</label>
+ <input type="text" name="intro" id="intro" value="<?= $art->intro(); ?>">
+ <label for="tag">Tag(s) :</label>
+ <input type="text" name="tag" id="tag" value="<?= $art->tag('string'); ?>">
+ <label for="secure">Niveau de sécurité :</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>
+ </select>
+ </fieldset>
</details>
- <details close>
+ <details id="editcss" close>
<summary>CSS</summary>
+ <fieldset>
<label for="template">Template :</label>
- <select name="template" id="template">
- <?php
- if ($art->template() == 'NULL') {
- echo '<option value="" selected >Sans template</option>';
- } else {
- echo '<option value="" >sans template</option>';
- }
- foreach ($list as $item) {
-
- if ($item->id() == $art->template()) {
- echo '<option value="' . $item->id() . '" selected >' . $item->titre() . '</option>';
- } else {
- echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
- }
- }
- ?>
+ <select name="template" id="template">
+ <?php
+ if ($art->template() == 'NULL') {
+ echo '<option value="" selected >Sans template</option>';
+ } else {
+ echo '<option value="" >sans template</option>';
+ }
+ foreach ($list as $item) {
+
+ if ($item->id() == $art->template()) {
+ echo '<option value="' . $item->id() . '" selected >' . $item->titre() . '</option>';
+ } else {
+ echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
+ }
+ }
+ ?>
</select>
<label for="css">Styles CSS :</label>
<textarea name="css" id="css"><?= $art->css(); ?></textarea>
@@ -153,20 +154,17 @@ class Aff
<input type="color" name="couleurlien" value="<?= $art->couleurlien() ?>" id="couleurlien">
<label for="couleurlienblank">Couleur des liens externes :</label>
<input type="color" name="couleurlienblank" value="<?= $art->couleurlienblank() ?>" id="couleurlienblank">
+ </fieldset>
</details>
- <details open>
- <summary>Contenu</summary>
- <textarea name="html" id="html" ><?= $art->md(); ?></textarea>
- </details>
+
<input type="hidden" name="datecreation" value="<?= $art->datecreation('string'); ?>">
<input type="hidden" name="id" value="<?= $art->id() ?>">
- </section>
- <div class="submit">
- <input type="submit" name="action" value="update">
- <input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Suppression de cet article')">
- </form>
+ </form>
+ <div id="submit">
+ <input type="submit" name="action" value="update" accesskey="s" onclick="document.getElementById('artedit').submit();" form="artedit">
+ <input type="submit" name="action" value="delete" onclick="confirmSubmit(event, 'Suppression de cet article', 'artedit')" form="artedit">
</div>
- </div>
+
<?php
@@ -174,30 +172,34 @@ class Aff
}
+
+
public function copy(Art $art, $list)
{
?>
- <div class="copy">
- <form action="?id=<?= $art->id() ?>&edit=1" method="post">
- <input type="hidden" name="action" value="copy">
- <input type="hidden" name="id" value="<?= $art->id() ?>">
- <select name="copy">
- <?php
- foreach ($list as $item) {
- echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
- }
- echo '</select>';
- ?>
- <label for="checkcss">CSS</label>
- <input type="checkbox" id="checkcss" name="css" value="true">
- <label for="checkcolor">Color</label>
- <input type="checkbox" id="checkcolor" name="color" value="true">
- <label for="checkhtml">HTML</label>
- <input type="checkbox" id="checkhtml" name="html" value="true">
- <label for="checktemplate">template</label>
- <input type="checkbox" id="checktemplate" name="template" value="true">
- <input type="submit" value="copy" onclick="confirmSubmit(event, 'Ecraser ces valeurs')">
- </form>
+ <div id="copy">
+ <form action="?id=<?= $art->id() ?>&edit=1" method="post">
+ <fieldset>
+ <input type="hidden" name="action" value="copy">
+ <input type="hidden" name="id" value="<?= $art->id() ?>">
+ <select name="copy" required>
+ <?php
+ foreach ($list as $item) {
+ echo '<option value="' . $item->id() . '">' . $item->id() . '</option>';
+ }
+ echo '</select>';
+ ?>
+ <label for="checkcss">CSS</label>
+ <input type="checkbox" id="checkcss" name="css" value="true">
+ <label for="checkcolor">Color</label>
+ <input type="checkbox" id="checkcolor" name="color" value="true">
+ <label for="checkhtml">HTML</label>
+ <input type="checkbox" id="checkhtml" name="html" value="true">
+ <label for="checktemplate">template</label>
+ <input type="checkbox" id="checktemplate" name="template" value="true">
+ <input type="submit" value="copy" onclick="confirmSubmit(event, 'Ecraser ces valeurs')">
+ </fieldset>
+ </form>
</div>
<?php
@@ -228,8 +230,7 @@ public function arthead(Art $art, $cssread = '', $edit = 0)
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" href="../media/logo.png" type="image/x-icon">
<link href="/css/stylebase.css" rel="stylesheet" />
- <link href="/css/stylew.css" rel="stylesheet" />
- <?= $edit == 0 ? '<link href="/css/lecture/' . $cssread . '" rel="stylesheet" />' : '' ?>
+ <?= $edit == 0 ? '<link href="/css/lecture/' . $cssread . '" rel="stylesheet" />' : '<link href="/css/styleedit.css" rel="stylesheet" />' ?>
<title><?= $edit == 1 ? '✏' : '' ?> <?= $art->titre() ?></title>
<script src="../rsc/js/app.js"></script>
</head>
@@ -243,132 +244,206 @@ public function arthead(Art $art, $cssread = '', $edit = 0)
public function search()
{
?>
+ <div id="search">
<form action="./" method="get">
<input type="text" name="id" id="id" placeholder="identifiant article" required>
<input type="submit" value="accéder">
- </form>
- <?php
+ </form>
+ </div>
+ <?php
- }
+}
- public function tag($getlist, $tag, $app)
- {
- echo '<div class="tag">';
- echo '<ul>';
- foreach ($getlist as $item) {
- if (in_array($tag, $item->tag('array'))) {
- echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- if ($app->session() >= $app::EDITOR) {
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
- } else {
- echo '</li>';
- }
+public function tag($getlist, $tag, $app)
+{
+ echo '<div class="tag">';
+ echo '<ul>';
+ foreach ($getlist as $item) {
+ if (in_array($tag, $item->tag('array'))) {
+ echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
+ if ($app->session() >= $app::EDITOR) {
+ echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a></li>';
+ } else {
+ echo '</li>';
}
}
- echo ' </ul> ';
- echo ' </div> ';
}
+ echo ' </ul> ';
+ echo ' </div> ';
+}
- public function lien($getlist, $lien, App $app)
- {
- echo '<div class="lien">';
- echo '<ul>';
- foreach ($getlist as $item) {
- if (in_array($lien, $item->lien('array'))) {
- echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
- if ($app->session() >= $app::EDITOR) {
- echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a> - <a href="?lien=' . $item->id() . '">liens</a></li>';
- } else {
- echo '</li>';
- }
+public function lien($getlist, $lien, App $app)
+{
+ echo '<div class="lien">';
+ echo '<ul>';
+ foreach ($getlist as $item) {
+ if (in_array($lien, $item->lien('array'))) {
+ echo '<li><a href="?id=' . $item->id() . '">' . $item->titre() . '</a> - ' . $item->intro();
+ if ($app->session() >= $app::EDITOR) {
+ echo ' - <a href="?id=' . $item->id() . '&edit=1">modifier</a> - <a href="?lien=' . $item->id() . '">liens</a></li>';
+ } else {
+ echo '</li>';
}
}
- echo ' </ul> ';
- echo ' </div> ';
}
+ echo ' </ul> ';
+ echo ' </div> ';
+}
- public function dump($getlist)
- {
- echo '<ul>';
+public function dump($getlist)
+{
+ echo '<ul>';
+ foreach ($getlist as $item) {
+ echo '<li>';
+ var_dump($item);
+ echo '</li>';
+ }
+ echo ' </ul> ';
+}
+
+public function header()
+{
+ echo '<header>';
+ $this->search();
+ echo '</header>';
+}
+
+
+public function home2table(App $app, $getlist)
+{
+
+
+ if ($app->session() >= $app::EDITOR) {
+ echo '<table id="home2table">';
+ echo '<tr><th>title</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><th>⚙ edit</th></tr>';
foreach ($getlist as $item) {
- echo '<li>';
- var_dump($item);
- echo '</li>';
+ echo '<tr>';
+ echo '<td><a href="?id=' . $item->id() . '">' . $item->titre() . '</a></td>';
+ echo '<td>' . $item->tag('sort') . '</td>';
+ echo '<td>' . $item->intro() . '</td>';
+ echo '<td><a href="?lien=' . $item->id() . '">' . $item->liento('sort') . '</a></td>';
+ echo '<td>' . $item->lien('sort') . '</td>';
+ echo '<td>' . $item->datemodif('hrdi') . '</td>';
+ echo '<td>' . $item->datecreation('hrdi') . '</td>';
+ echo '<td>' . $item->secure('string') . '</td>';
+ echo '<td><a href="?id=' . $item->id() . '&edit=1">edit</a></td>';
+ echo '</tr>';
}
- echo ' </ul> ';
+ echo ' </table> ';
}
+}
+public function option(App $app, Opt $opt)
+{
+ if ($app->session() >= $app::EDITOR) {
+ echo '<div id="options"><form action="./" method="get" >';
- public function home2table(App $app, $getlist)
- {
- echo '<div class="home">';
- echo '<section>';
- echo '<h1>W</h1>';
- $this->search();
- if ($app->session() >= $app::EDITOR) {
- echo '<h1>Home</h1>';
- echo '<table>';
- echo '<tr><th><a href="./?tri=titre">titre</a></th><th>résumé</th><th>lien from</th><th>lien to</th><th><a href="./?tri=datemodif&desc=DESC">dernière modif</a></th><th><a href="./?tri=datecreation&desc=DESC">date de création</a></th><th>edit</th></tr>';
- foreach ($getlist as $item) {
- $liento = 0;
- $lienfrom = 0;
-
- foreach ($getlist as $lien) {
- if (in_array($item->id(), $lien->lien('array'))) {
- $liento++;
- }
- }
- foreach ($item->lien('array') as $count) {
- $lienfrom++;
- }
- echo '<tr>';
- echo '<td><a href="?id=' . $item->id() . '">' . $item->titre() . '</a></td>';
- echo '<td>' . $item->intro() . '</td>';
- echo '<td>' . $lienfrom . '</td>';
- echo '<td><a href="?lien=' . $item->id() . '">' . $liento . '</a></td>';
- echo '<td>' . $item->datemodif('hrdi') . '</td>';
- echo '<td>' . $item->datecreation('hrdi') . '</td>';
- echo '<td><a href="?id=' . $item->id() . '&edit=1">modifier</a></td>';
- echo '</tr>';
- }
- echo ' </table> ';
+
+ $this->optiontag($opt);
+ $this->optionprivacy($opt);
+ $this->optionsort($opt);
+
+
+
+
+ echo '<input type=submit value="show">';
+
+ echo '</form></div>';
+
+ }
+
+}
+
+public function optiontag(Opt $opt)
+{
+
+ echo '<fieldset><legend>Tag</legend><ul>';
+ foreach ($opt->taglist() as $tagor => $count) {
+ if (in_array($tagor, $opt->tagor())) {
+ echo '<li><input type="checkbox" name="tagor[]" id="' . $tagor . '" value="' . $tagor . '" checked /><label for="' . $tagor . '">' . $tagor . ' (' . $count . ')</label></li>';
+ } else {
+ echo '<li><input type="checkbox" name="tagor[]" id="' . $tagor . '" value="' . $tagor . '" /><label for="' . $tagor . '">' . $tagor . ' (' . $count . ')</label></li>';
}
- echo '</section>';
- echo ' </div> ';
}
+ echo '</ul></fieldset>';
- public function aside(App $app)
- {
- if ($app->session() >= $app::EDITOR) {
- echo '<aside><ul>';
- foreach ($app->lister() as $item) {
- echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <code>[' . $item['titre'] . '](?id=' . $item['id'] . ')</code>';
+}
+public function optionprivacy(Opt $opt)
+{
+ echo '<fieldset><legend>Privacity</legend><ul>';
+ echo '<li><input type="radio" id="4" name="secure" value="4" ' . ($opt->secure() == 4 ? "checked" : "") . ' /><label for="4">all</label></li>';
+ echo '<li><input type="radio" id="2" name="secure" value="2" ' . ($opt->secure() == 2 ? "checked" : "") . ' /><label for="2">not published</label></li>';
+ echo '<li><input type="radio" id="1" name="secure" value="1" ' . ($opt->secure() == 1 ? "checked" : "") . ' /><label for="1">private</label></li>';
+ echo '<li><input type="radio" id="0" name="secure" value="0" ' . ($opt->secure() == 0 ? "checked" : "") . ' /><label for="0">public</label></li>';
+ echo '</ul></fieldset>';
+}
- }
- echo ' </ul></aside> ';
+public function optionsort(Opt $opt)
+{
+ echo '<fieldset><legend>Sort</legend>';
+ echo '<select name="sortby" id="sortby">';
+ foreach ($opt->col('array') as $key => $col) {
+ echo '<option value="' . $col . '" ' . ($opt->sortby() == $col ? "selected" : "") . '>' . $col . '</option>';
+ }
+ echo '</select>';
+ echo '<input type="radio" id="asc" name="order" value="1" ' . ($opt->order() == '1' ? "checked" : "") . ' /><label for="asc">ascending</label>';
+ echo '<input type="radio" id="desc" name="order" value="-1" ' . ($opt->order() == '-1' ? "checked" : "") . ' /><label for="desc">descending</label>';
+
+ echo '</fieldset>';
+
+}
+
+public function map(App $app, $url)
+{
+ echo '<div class="home"><section>';
+
+ $map = "";
+ $link = "";
+ foreach ($app->getlister(['id', 'lien']) as $item) {
+ foreach ($item->lien('array') as $lien) {
+ $map = $map . ' </br> ' . $item->id() . ' --> ' . $lien;
}
+ $link = $link . '</br>click ' . $item->id() . ' "' . $url . '/w/?id=' . $item->id() . '"';
}
+ echo $map;
+ echo $link;
- public function nav($app)
- {
- echo '<nav>';
- echo $app->session();
- echo '</br>';
+ echo '</div></section>';
+}
- echo '<a class="button" href="?">home</a>';
+public function aside(App $app)
+{
+ if ($app->session() >= $app::EDITOR) {
+ echo '<div id="linklist">Links<div id="roll"><ul>';
+ foreach ($app->lister() as $item) {
+ echo '<li><a href="?id=' . $item['id'] . '&edit=1">' . $item['titre'] . '</a> - <input type="text" value="[' . $item['titre'] . '](?id=' . $item['id'] . ')">';
- if ($app->session() == $app::FREE) {
- if (isset($_GET['id'])) {
- echo '<form action="./?id=' . $_GET['id'] . '" method="post">';
- } else {
- echo '<form action="." method="post">';
- }
- ?>
+
+ }
+ echo ' </ul></div></div> ';
+ }
+}
+
+public function nav($app)
+{
+ echo '<nav>';
+ echo $app->session();
+ echo '<div id="menu">';
+
+ echo '<a class="button" href="?">home</a>';
+
+ if ($app->session() == $app::FREE) {
+ if (isset($_GET['id'])) {
+ echo '<form action="./?id=' . $_GET['id'] . '" method="post">';
+ } else {
+ echo '<form action="." method="post">';
+ }
+ ?>
<input type="hidden" name="action" value="login">
- <input type="password" name="pass" id="pass" placeholder="password">
+ <input type="password" name="pass" id="loginpass" placeholder="password">
<input type="submit" value="login">
</form>
<?php
@@ -402,7 +477,11 @@ public function search()
}
}
+
+
+
?>
+ </div>
</nav>
<?php