aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-05-02 00:54:41 +0200
committervincent-peugnet <v.peugnet@free.fr>2018-05-02 00:54:41 +0200
commit8ad36569c333324614a864225d507972247f22be (patch)
treeb42ddb543f9370d4e1ac5400047d7138bdbeab7d
parentdf7d23a090526aff78a60872f7ba5d1169cbc735 (diff)
downloadwcms-8ad36569c333324614a864225d507972247f22be.tar.gz
wcms-8ad36569c333324614a864225d507972247f22be.zip
bugs corriges css + top
-rw-r--r--class/class.aff.php120
-rw-r--r--class/class.app.php22
-rw-r--r--class/class.art.php34
-rw-r--r--public/css/stylew.css98
-rw-r--r--public/w/index.php15
5 files changed, 173 insertions, 116 deletions
diff --git a/class/class.aff.php b/class/class.aff.php
index 20742a8..61ee142 100644
--- a/class/class.aff.php
+++ b/class/class.aff.php
@@ -17,6 +17,7 @@ class Aff
public function lecture(Art $art, App $app)
{
+ echo '<body class="lecture">';
if ($art->secure() == 1) {
echo '<span class="alert"><h4>cet article est privé</h4></span>';
}
@@ -38,7 +39,7 @@ class Aff
color: <?= $art->couleurlien() ?>;
}
- a[target="_blank"] {
+ section a[target="_blank"] {
color: <?= $art->couleurlienblank() ?>;
}
<?= $art->css() ?>
@@ -46,11 +47,12 @@ class Aff
<section>
<h1><?= $art->titre() ?></h1>
<h6><?= $art->soustitre() ?></h6>
- <article><?= $app->introlien($art) ?></article>
+ <article><?= $art->html($app) ?></article>
</section>
<?php
}
+ echo '</body>';
}
public function edit(Art $art)
@@ -58,58 +60,78 @@ class Aff
if ($this->session() >= self::$edit) {
?>
- <section class="edit">
+ <body class="edit">
+ <section>
<form action="?id=<?= $art->id() ?>" method="post">
- <details close>
+ <details 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>
- </details>
+ <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>
+ </details>
<details close>
<summary>CSS</summary>
- <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">
+ <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">
</details>
<details open>
<summary>Contenu</summary>
- <label for="html">Contenu :</label>
- <textarea name="html" id="html" ><?= $art->html('md'); ?></textarea>
- </details>
+ <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>
</div>
- </form>
- </section>
+ </body>
- <?php
+ <?php
}
}
+public function template(Art $art, $list)
+{
+ echo '<div class="template">';
+ echo '<form action="?id=' . $art->id() . '" method="post">';
+ echo '<input type="hidden" name="action" value="template">';
+ echo '<input type="hidden" name="id" value="' . $art->id() . '">';
+ echo '<select name="template">';
+ foreach ($list as $item) {
+ echo '<option value="' . $item['id'] . '">' . $item['titre'] . '</option>';
+ }
+ echo '</select>';
+ ?>
+ <input type="submit" value="template" onclick="confirmSubmit(event, 'Ecraser le style CSS')">
+ <?php
+// echo '<input type="submit" value="template">';
+ echo '</form>';
+ echo '</div>';
+}
+
public function head($title, $tool)
{
?>
@@ -140,6 +162,7 @@ public function head($title, $tool)
public function tag($getlist, $tag)
{
+ echo '<body class="tag">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($tag, $item->tag('array'))) {
@@ -152,10 +175,12 @@ public function head($title, $tool)
}
}
echo ' </ul> ';
+ echo ' </body> ';
}
public function lien($getlist, $lien)
{
+ echo '<body class="lien">';
echo '<ul>';
foreach ($getlist as $item) {
if (in_array($lien, $item->lien('array'))) {
@@ -168,6 +193,7 @@ public function head($title, $tool)
}
}
echo ' </ul> ';
+ echo ' </body> ';
}
public function home($getlist)
@@ -198,6 +224,7 @@ public function head($title, $tool)
public function home2($getlist)
{
+ echo '<body class="home">';
if ($this->session() >= 2) {
echo '<ul>';
foreach ($getlist as $item) {
@@ -214,10 +241,15 @@ public function head($title, $tool)
}
echo ' </ul> ';
}
+ echo ' </body> ';
}
public function home2table($getlist)
{
+ echo '<body class="home">';
+ echo '<section>';
+ echo '<h1>W</h1>';
+ $this->search();
if ($this->session() >= 2) {
echo '<h1>Home</h1>';
echo '<table>';
@@ -237,8 +269,10 @@ public function head($title, $tool)
echo '<td><a href="?id=' . $item->id() . '&edit=1">modifier</a></td>';
echo '</tr>';
}
- echo ' <table> ';
+ echo ' </table> ';
}
+ echo '</section>';
+ echo ' </body> ';
}
public function aside($list)
@@ -260,7 +294,7 @@ public function head($title, $tool)
<nav>
<?= $this->session() ?>
</br>
- <a href="?">home</a>
+ <a class="button" href="?">home</a>
</br>
<?php
@@ -271,7 +305,7 @@ public function head($title, $tool)
<form action="?id=<?= $_GET['id'] ?>" method="post">
<input type="hidden" name="action" value="login">
<input type="password" name="pass" id="pass" placeholder="password">
- <input type="submit" value="connect">
+ <input type="submit" value="login">
</form>
<?php
@@ -280,15 +314,15 @@ public function head($title, $tool)
?>
<form action="?id=<?= $_GET['id'] ?>" method="post">
<input type="hidden" name="action" value="logout">
- <input type="submit" value="disconnect">
+ <input type="submit" value="logout">
</form>
<?php
if ($this->session() == 2) {
?>
- <a href="?id=<?= $_GET['id'] ?>" target="_blank">display</a>
+ <a class="button" href="?id=<?= $_GET['id'] ?>" target="_blank">display</a>
</br>
- <a href="?id=<?= $_GET['id'] ?>&edit=1" >edit</a>
+ <a class="button" href="?id=<?= $_GET['id'] ?>&edit=1" >edit</a>
<?php
}
@@ -300,7 +334,7 @@ public function head($title, $tool)
<form action="?" method="post">
<input type="hidden" name="action" value="login">
<input type="password" name="pass" id="pass" placeholder="password">
- <input type="submit" value="connect">
+ <input type="submit" value="login">
</form>
<?php
@@ -309,7 +343,7 @@ public function head($title, $tool)
?>
<form action="?" method="post">
<input type="hidden" name="action" value="logout">
- <input type="submit" value="disconnect">
+ <input type="submit" value="logout">
</form>
<?php
diff --git a/class/class.app.php b/class/class.app.php
index fbab4b4..2a863dd 100644
--- a/class/class.app.php
+++ b/class/class.app.php
@@ -36,7 +36,7 @@ class App
$q->bindValue(':datecreation', $now->format('Y-m-d H:i:s'));
$q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
$q->bindValue(':css', $art->css());
- $q->bindValue(':html', $art->html('md'));
+ $q->bindValue(':html', $art->md());
$q->bindValue(':secure', $art->secure());
$q->bindValue(':couleurtext', $art->couleurtext());
$q->bindValue(':couleurbkg', $art->couleurbkg());
@@ -108,24 +108,6 @@ class App
return (bool)$donnees['COUNT(*)'];
}
- public function introlien(Art $art)
- {
- $html = $art->html('html');
- foreach ($art->lien('array') as $id) {
- $title = '';
- foreach ($this->getlister(['id', 'intro'], 'id') as $item) {
- if ($item->id() == $id) {
- $title = $item->intro();
- }
- }
-
- $lien = 'href="?id=' . $id . '"';
- $titlelien = ' title="' . $title . '" ' . $lien;
- $html = str_replace($lien, $titlelien, $html);
- }
- return $html;
- }
-
public function update(Art $art)
{
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
@@ -143,7 +125,7 @@ class App
$q->bindValue(':datecreation', $art->datecreation('string'));
$q->bindValue(':datemodif', $now->format('Y-m-d H:i:s'));
$q->bindValue(':css', $art->css());
- $q->bindValue(':html', $art->html('md'));
+ $q->bindValue(':html', $art->md());
$q->bindValue(':secure', $art->secure());
$q->bindValue(':couleurtext', $art->couleurtext());
$q->bindValue(':couleurbkg', $art->couleurbkg());
diff --git a/class/class.art.php b/class/class.art.php
index cc383d0..58653ca 100644
--- a/class/class.art.php
+++ b/class/class.art.php
@@ -68,7 +68,7 @@ a:hover {}');
public function updatelien()
{
- $this->lien = search($this->html('md'), self::DEBUT, self::FIN);
+ $this->lien = search($this->md(), self::DEBUT, self::FIN);
}
@@ -128,16 +128,32 @@ a:hover {}');
return $this->css;
}
- public function html($option)
+ public function md()
{
- if ($option == 'md') {
- return $this->html;
- } elseif ($option == 'html') {
- $html = Markdown::defaultTransform($this->html);
- $htmla = str_replace('href="http', ' class="external" target="_blank" href="http', $html);
- $htmlmedia = str_replace('src="/', 'src="../media/', $htmla);
- return $htmlmedia;
+ return $this->html;
+ }
+
+ public function html(App $app)
+ {
+ $html = Markdown::defaultTransform($this->html);
+
+ foreach ($this->lien('array') as $id) {
+ $title = "Cet article n'existe pas encore";
+ foreach ($app->getlister(['id', 'intro'], 'id') as $item) {
+ if ($item->id() == $id) {
+ $title = $item->intro();
+ }
+ }
+ $lien = 'href="?id=' . $id . '"';
+ $titlelien = ' title="' . $title . '" ' . $lien;
+ $html = str_replace($lien, $titlelien, $html);
}
+
+ $html = str_replace('href="http', ' class="external" target="_blank" href="http', $html);
+ $html = str_replace('src="/', 'src="../media/', $html);
+ return $html;
+
+
}
public function secure()
diff --git a/public/css/stylew.css b/public/css/stylew.css
index 86ec715..ab206a3 100644
--- a/public/css/stylew.css
+++ b/public/css/stylew.css
@@ -48,23 +48,31 @@ img {
max-width: 1000px;
}
+form {
+ margin-bottom: 0px;
+}
+
section {
text-align: justify;
padding: 3%;
line-height: 1.2em;
}
-.edit {
+body.edit {
+ overflow-y: scroll;
+}
+
+body.edit section {
text-align: left;
- padding-top: 1%;
- padding-bottom: 1%;
+ padding-top: 0px;
+ padding-bottom: 0px;
padding-left: 8%;
padding-right: 8%;
line-height: 1.2em;
}
-
-section input, textarea, select {
+.button, input, textarea, select {
+ display: inline-block;
width: 90%;
padding-left: 15px;
padding-right: 15px;
@@ -75,17 +83,43 @@ section input, textarea, select {
border-style: unset;
}
+.button {
+ text-align: center;
+ color: black;
+ font-size: 13px;
+ padding-top: 7px;
+ background-color: #bfbfbf;
+ box-sizing: border-box;
+ align-items: flex-start;
+ text-align: center;
+ cursor: default;
+ white-space: pre;
+ -webkit-rtl-ordering: logical;
+ text-rendering: auto;
+ color: initial;
+ letter-spacing: normal;
+ word-spacing: normal;
+ text-transform: none;
+ text-indent: 0px;
+ text-shadow: none;
+}
+
+.button:hover {
+
+ text-decoration: none;
+}
+
article {
position: relative;
z-index: 7;
}
#html{
- height: 1000px;
+ height: calc(100% - 95px);
}
#css{
- height: 100px;
+ height: 250px;
}
input[type="submit"] {
@@ -113,19 +147,18 @@ aside:hover {
nav {
position: fixed;
top: 0px;
- right: -50px;
- padding: 7px;
+ right: -6%;
z-index: 10;
- background: #6c7d8a;
opacity: 0.3;
- width:100px;
- border-width: 4px;
- border-style: outset;
+ width: 8%;
+ text-align: right;
}
-nav:hover {
+
+
+nav:hover, body.edit nav {
opacity: 1;
- right: -5px;
+ right: 0px;
}
.alert h4 {
@@ -133,31 +166,9 @@ nav:hover {
margin: 0px;
}
-nav a {
- color: black;
- padding: 1px 4px;
- font-size: 13px;
- background-color: #bfbfbf;
- /* text-rendering: auto; */
- /* color: initial; */
- /* letter-spacing: normal; */
- /* word-spacing: normal; */
- /* text-transform: none; */
- text-indent: 0px;
- text-decoration: none;
- /* text-shadow: none; */
- /* display: inline-block; */
- /* -webkit-appearance: push-button; */
- align-items: flex-start;
- text-align: center;
- cursor: default;
- /* color: buttontext; */
- /* background-color: buttonface; */
- box-sizing: border-box;
- /* padding: 2px 6px 3px; */
- border-width: 2px;
- border-color: lightgrey;
- border-style: outset;
+table {
+ width: 100%;
+ margin-top: 20px;
}
.submit {
@@ -199,4 +210,11 @@ summary {
background-color: #bdbdbd;
margin-top: 3px;
margin-bottom: 3px;
+}
+
+.template {
+ position: fixed;
+ bottom: 0px;
+ left: 0px;
+ width: 8%;
} \ No newline at end of file
diff --git a/public/w/index.php b/public/w/index.php
index d961d56..695ce56 100644
--- a/public/w/index.php
+++ b/public/w/index.php
@@ -38,6 +38,16 @@ if (isset($_POST['action'])) {
}
break;
+ case 'template':
+ if ($app->exist($_GET['id'])) {
+ $template = $app->get($_POST['template']);
+ $art = $app->get($_POST['id']);
+ $art->setcss($template->css());
+ $app->update($art);
+ header('Location: ?id=' . $art->id() . '&edit=1');
+ }
+ break;
+
case 'delete':
if ($app->exist($_GET['id'])) {
$art = new Art($_POST);
@@ -89,7 +99,6 @@ $aff->head($titre, 'w');
// ______________________________________________________ B O D Y _______________________________________________________________
-echo '<body>';
$aff->nav($app);
if (isset($_GET['id'])) {
@@ -100,6 +109,7 @@ if (isset($_GET['id'])) {
if (isset($_GET['edit']) and $_GET['edit'] == 1) {
$aff->edit($art);
+ $aff->template($art, $app->lister());
$aff->aside($app->lister());
} else {
$aff->lecture($art, $app);
@@ -137,11 +147,8 @@ if (isset($_GET['id'])) {
} else {
$tri = 'id';
}
- $aff->search();
$aff->home2table($app->getlister(['id', 'titre', 'intro', 'lien'], $tri));
}
-echo '</body>';
-
?>