aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-10-04 05:10:51 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-10-04 05:10:51 +0200
commit67b20c49ec4e5efb4526fc64ef679dfb6dd41e30 (patch)
tree289a6da21e036b62c881bc505a079d5d64dc1c20
parentc3c4be4a4efd1404aad19797c15d2a9a6ffe29a6 (diff)
downloadwcms-67b20c49ec4e5efb4526fc64ef679dfb6dd41e30.tar.gz
wcms-67b20c49ec4e5efb4526fc64ef679dfb6dd41e30.zip
2.8 auto-tag-update + help + tabs
-rw-r--r--class/class.w.aff.php232
-rw-r--r--class/class.w.app.php54
-rw-r--r--class/class.w.art.php48
-rw-r--r--class/class.w.config.php14
-rw-r--r--public/css/stylebase.css22
-rw-r--r--public/css/styleedit.css150
-rw-r--r--public/test/index.php24
-rw-r--r--public/w/article.php9
-rw-r--r--public/w/index.php36
9 files changed, 466 insertions, 123 deletions
diff --git a/class/class.w.aff.php b/class/class.w.aff.php
index 0c7aa24..d14e682 100644
--- a/class/class.w.aff.php
+++ b/class/class.w.aff.php
@@ -94,80 +94,171 @@ class Aff
}
}
- public function edit(Art $art, App $app, $list)
+ public function edit(Art $art, App $app, $list, $fontsize, $imagelist)
{
+
if ($app->session() >= self::$edit) {
?>
<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>
- <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 id="editcss" close>
- <summary>CSS</summary>
- <fieldset>
- <label for="template">Template :</label>
- <select name="template" id="template">
+
+ <?php
+ echo '<style>textarea{font-size: ' . $fontsize . '}</style>';
+ $tablist = ['html' => $art->md(), 'css' => $art->css(), 'aside' => 'NOT WORKING', 'footer' => 'NOT WORKING'];
+
+ $this->tabs($tablist, 'html');
+
+ ?>
+
+ <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="<?= $fontsize ?>" id="fontsize">
+ </div>
+ <div class="sidebar">
+ <details id="editinfo" open>
+ <summary>Infos</summary>
+ <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>
+ <label for="template">Template :</label>
+ <select name="template" id="template">
+ <?php
+ if ($art->template() == 'NULL') {
+ echo '<option value="" selected >No template</option>';
+ } else {
+ echo '<option value="" >No 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>
+ </fieldset>
+ </details>
+ <details>
+ <summary>Advanced</summary>
+ <fieldset>
+ <h3>Template options</h3>
+ <p>NOT WORKING</p>
+ <ul>
<?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>';
+ $templatelist = ['header' => 0, 'section' => 0, 'nav' => 0, 'aside' => 0, 'footer' => 0, 'quickcss' => 1, 'css' => 1];
+
+ foreach ($templatelist as $template => $check) {
+ if($check == 1) {
+ echo '<li><input type="checkbox" name="template'.$template.'" id="template'.$template.'" checked><label for="template'.$template.'">'.$template.'</label></li>';
} else {
- echo '<option value="' . $item->id() . '">' . $item->titre() . '</option>';
+ echo '<li><input type="checkbox" name="template'.$template.'" id="template'.$template.'"><label for="template'.$template.'">'.$template.'</label></li>';
}
}
- ?>
- </select>
- <label for="css">Styles CSS :</label>
- <textarea name="css" id="css"><?= $art->css(); ?></textarea>
- <label for="couleurtext">Couleur du texte :</label>
- <input type="color" name="couleurtext" value="<?= $art->couleurtext() ?>" id="couleurtext">
- <label for="couleurbkg">Couleur de l'arrière plan :</label>
- <input type="color" name="couleurbkg" value="<?= $art->couleurbkg() ?>" id="couleurbkg">
- <label for="couleurlien">Couleur des liens :</label>
- <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>
-
- <input type="hidden" name="datecreation" value="<?= $art->datecreation('string'); ?>">
- <input type="hidden" name="id" value="<?= $art->id() ?>">
- </form>
- <div id="submit">
- <a href="./">↖</a>
- <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, 'Delete this article', 'artedit')" form="artedit">
- <a href="?id=<?= $art->id() ?>" target="_blank">👁</a>
+ ?>
+ </ul>
+ </fieldset>
+ </details>
+ <details id="editcss" open>
+ <summary>Quick CSS</summary>
+ <fieldset>
+
+ <?php
+ $colorlist = ['text' => $art->couleurtext(), 'lien' => $art->couleurlien(), 'lienblank' => $art->couleurlienblank(), 'bkg' => $art->couleurbkg()];
+ foreach ($colorlist as $element => $color) {
+ echo '<label for="couleur'.$element.'">Couleur du '.$element.' :</label><input type="color" name="couleur'.$element.'" value="'.$color.'" id="couleur'.$element.'">';
+ }
+
+
+
+ ?>
+
+ <label for="bkgimage">NOT WORKING</label>
+ <select name="bkgimage" id="bkgimage">
+ <?php
+
+ $artbkgimage = "NULL";
+
+ if ($artbkgimage == 'NULL') {
+ echo '<option value="" selected >No background image</option>';
+ } else {
+ echo '<option value="" >No background image</option>';
+ }
+ foreach ($imagelist as $image) {
+ if ($image->id() == $artbkgimage) {
+ echo '<option value="' . $image->id() . '.'.$image->extension().'" selected >' . $image->id() . '.'.$image->extension().'</option>';
+ } else {
+ echo '<option value="' . $image->id() . '.'.$image->extension().'">' . $image->id() . '.'.$image->extension().'</option>';
+ }
+ }
+ ?>
+ </select>
+
+ </fieldset>
+ </details>
+ <details>
+ <summary>Help</summary>
+ <div id="help">
+ <h2>Help !</h2>
+ <p>To save your article, clic on 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 Markdown encoding : <a href="https://daringfireball.net/projects/markdown/syntax" target="_blank">synthax</a>. But the following strategies are specific to W.</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>Tricks</h3>
+ <pre>%TITLE%</pre>
+ <p>Show the title of your article.</p>
+ <pre>%DESCRIPTION%</pre>
+ <p>Show the description (intro) of your article.</p>
+ <pre>%%<span class="i">tag_name</span>%%</pre>
+ <p>Generate a list of links to all articles under this tag.</p>
+ <p>vv</p>
+ <p>vv</p>
+ <p>vv</p>
+ <p></p>
+ </div>
+ </details>
+
+
</div>
+ <input type="hidden" name="datecreation" value="<?= $art->datecreation('string'); ?>">
+ <input type="hidden" name="id" value="<?= $art->id() ?>">
+
+ </form>
+
+
<?php
}
@@ -175,6 +266,27 @@ class Aff
}
+public function tabs($tablist, $opentab)
+{
+ echo '<div class="tabs">';
+ foreach ($tablist as $key => $value) {
+ echo '<div class="tab">';
+ if ($key == $opentab) {
+ echo '<input name="checkbox-tabs-group" type="radio" id="tab' . $key . '" class="checkboxtab" checked>';
+ } else {
+ echo '<input name="checkbox-tabs-group" type="radio" 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>';
+ }
+
+ echo '</div>';
+}
+
+
public function copy(Art $art, $list)
{
diff --git a/class/class.w.app.php b/class/class.w.app.php
index 82e2bef..d8751ab 100644
--- a/class/class.w.app.php
+++ b/class/class.w.app.php
@@ -11,6 +11,7 @@ class App
const SQL_READ_DIR = '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR;
const MEDIA_DIR = '..' . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR;
const MEDIA_EXTENSIONS = array('jpeg', 'jpg', 'JPG', 'png', 'gif', 'mp3', 'mp4', 'mov', 'wav', 'flac', 'pdf');
+ const MEDIA_TYPES = ['image', 'video', 'sound', 'other'];
const ADMIN = 10;
@@ -176,7 +177,6 @@ class App
public function update(Art $art)
{
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
- $art->updatelien();
$q = $this->bdd->prepare('UPDATE ' . $this->arttable . ' SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank, lien = :lien, template = :template WHERE id = :id');
@@ -326,7 +326,26 @@ class App
$req->closeCursor();
return $donnees;
+ }
+ public function tag(array $artlist, $tagchecked)
+ {
+ $artcheckedlist = [];
+ foreach($artlist as $art) {
+ if (in_array($tagchecked, $art->tag('array'))) {
+ $artcheckedlist[] = $art;
+ }
+ }
+ return $artcheckedlist;
+ }
+
+ public function taglist(array $artlist, array $tagcheckedlist)
+ {
+ $taglist = [];
+ foreach ($tagcheckedlist as $tag) {
+ $taglist[$tag] = $this->tag($artlist, $tag);
+ }
+ return $taglist;
}
public function count()
@@ -497,39 +516,26 @@ class App
}
- public function getlistermedia($dir)
+ public function getlistermedia($dir, $type="all")
{
if ($handle = opendir($dir)) {
$list = [];
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
-
- // var_dump($entry);
-
- // $fileinfo = pathinfo($entry);
-
- // var_dump($fileinfo);
-
-
- // $filepath = $dir . $fileinfo['filename'] . '.' . $fileinfo['extension'];
-
- // list($width, $height, $type, $attr) = getimagesize($filepath);
- // $filesize = filesize($filepath);
-
- // $donnees = array(
- // 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']),
- // 'path' => dirname($entry),
- // 'extension' => $fileinfo['extension']
- // );
-
- // $media = new Media($donnees);
-
$media = $this->getmedia($entry, $dir);
$media->analyse();
- $list[] = $media;
+
+ if(in_array($type, self::MEDIA_TYPES)) {
+ if($media->type() == $type) {
+ $list[] = $media;
+ }
+ } else {
+ $list[] = $media;
+ }
+
}
}
diff --git a/class/class.w.art.php b/class/class.w.art.php
index 2238f71..12ff1e3 100644
--- a/class/class.w.art.php
+++ b/class/class.w.art.php
@@ -73,7 +73,9 @@ class Art
public function updatelien()
{
- $this->lien = search($this->md(true), self::DEBUT, self::FIN);
+ $this->lien = [];
+ $this->lien = array_unique(search($this->md(true), self::DEBUT, self::FIN));
+
}
public static function classvarlist()
@@ -100,6 +102,38 @@ class Art
}
+ public function autotaglist()
+ {
+ $pattern = "/%%(\w*)%%/";
+ preg_match_all($pattern, $this->md(), $out);
+ return $out[1];
+
+ }
+
+ public function autotaglistupdate($taglist)
+ {
+ foreach ($taglist as $tag => $artlist) {
+ $replace = '<ul>';
+ foreach ($artlist as $art) {
+ $replace .= '<li><a href="?id=' . $art->id() . '" title="' . $art->intro() . '">' . $art->titre() . '</a></li>';
+ }
+ $replace .= '</ul>';
+ $this->html = str_replace('%%' . $tag . '%%', $replace, $this->html);
+ }
+ }
+
+ public function autotaglistcalc($taglist)
+ {
+ foreach ($taglist as $tag => $artlist) {
+ foreach ($artlist as $art) {
+ if(!in_array($art->id(), $this->lien('array')) && $art->id() != $this->id()) {
+ $this->lien[] = $art->id();
+ }
+ }
+ }
+ }
+
+
// _____________________________________________________ G E T ____________________________________________________
public function id($type = 'string')
@@ -181,7 +215,7 @@ class Art
public function md($expand = false)
{
- if($expand == true) {
+ if ($expand == true) {
$md = str_replace('](=', '](?id=', $this->html);
} else {
$md = $this->html;
@@ -192,6 +226,7 @@ class Art
public function html(App $app)
{
$html = Markdown::defaultTransform($this->html);
+ $html = str_replace('href="=', 'href="?id=', $html);
foreach ($this->lien('array') as $id) {
$title = "Cet article n'existe pas encore";
@@ -205,7 +240,10 @@ class Art
$html = str_replace($lien, $titlelien, $html);
}
- $html = str_replace('href="=', 'href="?id=', $html);
+
+
+ $html = str_replace('%TITLE%', $this->titre(), $html);
+ $html = str_replace('%DESCRIPTION%', $this->intro(), $html);
$html = str_replace('href="../media/', ' class="file" target="_blank" href="../media/', $html);
$html = str_replace('href="http', ' class="external" target="_blank" href="http', $html);
$html = str_replace('<img src="/', '<img src="../media/', $html);
@@ -315,13 +353,13 @@ class Art
public function settag($tag)
{
- if(is_string($tag)) {
+ if (is_string($tag)) {
if (strlen($tag) < self::LEN and is_string($tag)) {
$tag = strip_tags(trim(strtolower($tag)));
$tag = str_replace('*', '', $tag);
$tag = str_replace(' ', '', $tag);
-
+
$taglist = explode(",", $tag);
$taglist = array_filter($taglist);
$this->tag = $taglist;
diff --git a/class/class.w.config.php b/class/class.w.config.php
index 1d5f7b5..68b0987 100644
--- a/class/class.w.config.php
+++ b/class/class.w.config.php
@@ -16,6 +16,7 @@ class Config
private $read;
private $cssread;
private $color4;
+ private $fontsize = 6;
// _______________________________________ F U N _______________________________________
@@ -105,6 +106,11 @@ class Config
return $this->color4;
}
+ public function fontsize()
+ {
+ return $this->fontsize;
+ }
+
// __________________________________________ S E T ______________________________________
@@ -171,6 +177,14 @@ class Config
}
}
+ public function setfontsize($fontsize)
+ {
+ $fontsize = intval($fontsize);
+ if($fontsize > 1) {
+ $this->fontsize = $fontsize;
+ }
+ }
+
}
diff --git a/public/css/stylebase.css b/public/css/stylebase.css
index c733e79..017b075 100644
--- a/public/css/stylebase.css
+++ b/public/css/stylebase.css
@@ -5,14 +5,32 @@
--color4: grey;
}
+
+@keyframes alert {
+ from {top: 30px;}
+ to {top: -50px;}
+}
+
body {
margin: 0;
- font-family: monospace;
+ font-family: sans-serif;
background-color: var(--color4);
}
-
+span.alert {
+ position: fixed;
+ background-color: var(--color1);
+ z-index: 100;
+ border: ridge red;
+ width: 200px;
+ text-align: center;
+ padding: 5px;
+ top: 30px;
+ font-weight: bold;
+ left: calc(50% - 100px);
+ animation: alert 1s linear 2s forwards;
+}
form{
diff --git a/public/css/styleedit.css b/public/css/styleedit.css
index 3a868c3..fe6745f 100644
--- a/public/css/styleedit.css
+++ b/public/css/styleedit.css
@@ -25,37 +25,25 @@ details {
-
-
-
-details#editinfo {
- position: fixed;
- top: 0;
- left: 10%;
- width: 40%;
-}
-
-details#editcss {
- position: fixed;
- top: 0;
- left: 50%;
- width: 40%;
+.sidebar {
+ position: fixed;
+ width: 250px;
+ height: 100%;
+ overflow: scroll;
+ overflow-x: hidden;
}
div#submit {
- position: fixed;
- top: 0;
- width: 10%;
+ position: relative;
}
-textarea#html {
- width: 100%;
+textarea {
+ position: fixed;
+ width: calc(100% - 250px);
+ right: 0px;
height: 100%;
font-size: 1em;
- padding-top: 40px;
- padding-bottom: 40px;
- font-family: serif;
- padding-left: 2%;
+ padding: 2%;
padding-right: calc(50% - 500px);
resize: none;
@@ -96,19 +84,25 @@ div#roll ul {
details label {
- display: block;
margin-top: 4px;
}
-textarea#css {
- width: 100%;
- height: 200px;
-}
details select, details input, details label, details textarea#css {
width: 100%;
}
+details input[type="checkbox"]
+{
+ width: auto;
+}
+
+ul {
+ list-style: none;
+ padding: 0;
+ margin: 2px;
+}
+
fieldset {
margin: 0;
padding: 0;
@@ -120,6 +114,104 @@ summary, div#linklist, div#copy, div#submit {
}
+span#headid {
+ font-weight: bold;
+ padding-left: 1%;
+ padding-right: 1%;
+ border: ridge;
+ background-color: var(--color3);
+
+}
+
+input#fontsize {
+ width: 40px;
+}
+
+summary {
+ background-color: var(--color1);
+ border: outset;
+ font-weight: bold;
+}
+
+summary:focus {
+ outline: none;
+}
+
+div#help {
+ padding: 2px;
+}
+
+div#help pre {
+ background-color: white;
+ margin-bottom: 2px;
+}
+
+div#help p {
+ background-color: var(--color3);
+ margin-top: 4px;
+}
+
+div#help h3 {margin-bottom: 8px;}
+
+span.i {
+ background-color: var(--color2);
+ color: white;
+}
+
+
+
+/* ------------------------------ TABS ----------------------------- */
+
+
+
+.tabs
+{
+ position: absolute;
+ left: 250px;
+ top: 28px;
+}
+
+.tabs .tab
+{
+ float: left;
+}
+
+.tabs .tab .content
+{
+ position: absolute;
+ background-color: white;
+ left: 0px;
+ width: 100%;
+ border: 1px #000 solid;
+}
+
+.checkboxtab
+{
+ display: none;
+}
+
+.tab label
+{
+ margin-right: 10px;
+ border: outset;
+ background-color: var(--color1);
+}
+
+.checkboxtab:checked ~ label
+{
+ border: inset;
+}
+
+.checkboxtab:checked ~ .content
+{
+ z-index: 1;
+}
+
+
+
+
+
+
@media (max-width: 600px) {
details#editinfo, details#editcss, div#copy, div#linklist {
diff --git a/public/test/index.php b/public/test/index.php
new file mode 100644
index 0000000..5b778ee
--- /dev/null
+++ b/public/test/index.php
@@ -0,0 +1,24 @@
+
+
+<?php
+
+$pattern = "/%%(\w*)%%/";
+
+$string = "bla bla bld dd d , dfddddddsdsdf fzpapap %q dsq%%c%%dd % dsqqsd %% dsqq dsq sd %%c%%dsssssssssss dsqd %%coucouhibou%% fdsf fdsf fdsfsdfsdf ";
+
+
+
+preg_match_all($pattern, $string, $out);
+
+foreach ($out[0] as $key => $value) {
+ $replace = '^^ÔHYEAH BB££___'.$out[1][$key]. '_____§§§§§§';
+ $string = str_replace($value, $replace, $string);
+
+}
+
+
+var_dump($out);
+
+var_dump($string);
+
+?> \ No newline at end of file
diff --git a/public/w/article.php b/public/w/article.php
index e5cfff7..307caa4 100644
--- a/public/w/article.php
+++ b/public/w/article.php
@@ -6,12 +6,17 @@ if ($app->exist($_GET['id'])) {
if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) {
echo '<section class=edit>';
- $aff->edit($art, $app, $app->getlister(['id', 'titre']));
- $aff->copy($art, $app->getlister(['id', 'titre']));
+ $aff->edit($art, $app, $app->getlister(['id', 'titre']), $config->fontsize(), $app->getlistermedia($app::MEDIA_DIR, 'image'));
+ //$aff->copy($art, $app->getlister(['id', 'titre']));
$aff->aside($app);
echo '</section>';
} else {
echo '<section class="lecture">';
+
+
+ $art->autotaglistupdate($app->taglist($app->getlister(['id', 'titre', 'intro', 'tag']), $art->autotaglist()));
+
+
$aff->lecture($art, $app);
echo '</section>';
diff --git a/public/w/index.php b/public/w/index.php
index 1f3e967..887cc9a 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -118,8 +118,42 @@ if (isset($_POST['action'])) {
case 'update':
if ($app->exist($_GET['id'])) {
$art = new Art($_POST);
+ $art->updatelien();
+ $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
$app->update($art);
- header('Location: ?id=' . $art->id() . '&edit=1');
+ if($config->fontsize() != $_POST['fontsize']) {
+ $config->setfontsize($_POST['fontsize']);
+ $app->savejson($config->tojson());
+ }
+ header('Location: ?id=' . $art->id() . '&edit=1&message='.$art->id().'_saved');
+ }
+ break;
+
+ case 'display':
+ if ($app->exist($_GET['id'])) {
+ $art = new Art($_POST);
+ $art->updatelien();
+ $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
+ $app->update($art);
+ if($config->fontsize() != $_POST['fontsize']) {
+ $config->setfontsize($_POST['fontsize']);
+ $app->savejson($config->tojson());
+ }
+ header('Location: ?id=' . $art->id().'&message='.$art->id().'_saved');
+ }
+ break;
+
+ case 'home':
+ if ($app->exist($_GET['id'])) {
+ $art = new Art($_POST);
+ $art->updatelien();
+ $art->autotaglistcalc($app->taglist($app->getlister(['id', 'titre', 'tag']), $art->autotaglist()));
+ $app->update($art);
+ if($config->fontsize() != $_POST['fontsize']) {
+ $config->setfontsize($_POST['fontsize']);
+ $app->savejson($config->tojson());
+ }
+ header('Location: ./?message='.$art->id().'_saved');
}
break;