From e9b2ca7c06875069fa03379258625490872cc33d Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Tue, 31 Jul 2018 18:29:53 +0200 Subject: W 2.4 graphic update table sort engine update --- class/class.w.aff.php | 417 +++++++++++++++++++++++++------------------ class/class.w.app.php | 158 ++++++++++++---- class/class.w.art.php | 94 ++++++++-- class/class.w.opt.php | 207 +++++++++++++++++++++ fn/fn.php | 35 ++++ public/css/old/styleedit.css | 27 +++ public/css/style.css | 0 public/css/styleadmin.css | 0 public/css/stylebase.css | 189 +++----------------- public/css/styleedit.css | 120 +++++++++++++ public/css/stylehome.css | 56 ++++++ public/css/stylew.css | 249 -------------------------- public/rsc/js/app.js | 4 +- public/w/index.php | 87 +++++---- 14 files changed, 983 insertions(+), 660 deletions(-) create mode 100644 class/class.w.opt.php create mode 100644 public/css/old/styleedit.css create mode 100644 public/css/style.css create mode 100644 public/css/styleadmin.css create mode 100644 public/css/styleedit.css create mode 100644 public/css/stylehome.css delete mode 100644 public/css/stylew.css 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 '
'; if ($art->secure() == 1) { - echo '

cet article est privé

'; + echo 'This article is private'; } if ($art->secure() == 2) { - echo "

cet article n'est pas publié

"; + echo "This article is not published yet"; } if ($app->session() >= $art->secure()) { @@ -85,17 +84,14 @@ class Aff } csstemplate($app) ?> -

titre() ?>

soustitre() ?>
html($app) ?>
-
'; } public function edit(Art $art, App $app, $list) @@ -103,45 +99,50 @@ class Aff if ($app->session() >= self::$edit) { ?> -
-
-
-
+ + + + + +
Infos - - - - - - - - - - +
+ + + + + + + + + + +
-
+
CSS +
- + template() == 'NULL') { + echo ''; + } else { + echo ''; + } + foreach ($list as $item) { + + if ($item->id() == $art->template()) { + echo ''; + } else { + echo ''; + } + } + ?> @@ -153,20 +154,17 @@ class Aff +
-
- Contenu - -
+ -
-
- - - + +
+ +
-
+ -
-
- - - '; - ?> - - - - - - - - - -
+
+
+
+ + + '; + ?> + + + + + + + + + +
+
- - ' : '' ?> + ' : '' ?> <?= $edit == 1 ? '✏' : '' ?> <?= $art->titre() ?> @@ -243,132 +244,206 @@ public function arthead(Art $art, $cssread = '', $edit = 0) public function search() { ?> + + '; - echo '
    '; - foreach ($getlist as $item) { - if (in_array($tag, $item->tag('array'))) { - echo '
  • ' . $item->titre() . ' - ' . $item->intro(); - if ($app->session() >= $app::EDITOR) { - echo ' - modifier
  • '; - } else { - echo ''; - } +public function tag($getlist, $tag, $app) +{ + echo '
    '; + echo '
      '; + foreach ($getlist as $item) { + if (in_array($tag, $item->tag('array'))) { + echo '
    • ' . $item->titre() . ' - ' . $item->intro(); + if ($app->session() >= $app::EDITOR) { + echo ' - modifier
    • '; + } else { + echo ''; } } - echo '
    '; - echo '
    '; } + echo '
'; + echo '
'; +} - public function lien($getlist, $lien, App $app) - { - echo '
'; - echo '
    '; - foreach ($getlist as $item) { - if (in_array($lien, $item->lien('array'))) { - echo '
  • ' . $item->titre() . ' - ' . $item->intro(); - if ($app->session() >= $app::EDITOR) { - echo ' - modifier - liens
  • '; - } else { - echo ''; - } +public function lien($getlist, $lien, App $app) +{ + echo '
    '; + echo '
      '; + foreach ($getlist as $item) { + if (in_array($lien, $item->lien('array'))) { + echo '
    • ' . $item->titre() . ' - ' . $item->intro(); + if ($app->session() >= $app::EDITOR) { + echo ' - modifier - liens
    • '; + } else { + echo ''; } } - echo '
    '; - echo '
    '; } + echo '
'; + echo '
'; +} - public function dump($getlist) - { - echo '
    '; +public function dump($getlist) +{ + echo '
      '; + foreach ($getlist as $item) { + echo '
    • '; + var_dump($item); + echo '
    • '; + } + echo '
    '; +} + +public function header() +{ + echo '
    '; + $this->search(); + echo '
    '; +} + + +public function home2table(App $app, $getlist) +{ + + + if ($app->session() >= $app::EDITOR) { + echo ''; + echo ''; foreach ($getlist as $item) { - echo '
  • '; - var_dump($item); - echo '
  • '; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; } - echo ' '; + echo '
    titletagsummary↘ to↗ fromlast modificationdate of creationprivacy⚙ edit
    ' . $item->titre() . '' . $item->tag('sort') . '' . $item->intro() . '' . $item->liento('sort') . '' . $item->lien('sort') . '' . $item->datemodif('hrdi') . '' . $item->datecreation('hrdi') . '' . $item->secure('string') . 'edit
    '; } +} +public function option(App $app, Opt $opt) +{ + if ($app->session() >= $app::EDITOR) { + echo '
    '; - public function home2table(App $app, $getlist) - { - echo '
    '; - echo '
    '; - echo '

    W

    '; - $this->search(); - if ($app->session() >= $app::EDITOR) { - echo '

    Home

    '; - echo ''; - echo ''; - 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 ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - } - echo '
    titrerésumélien fromlien todernière modifdate de créationedit
    ' . $item->titre() . '' . $item->intro() . '' . $lienfrom . '' . $liento . '' . $item->datemodif('hrdi') . '' . $item->datecreation('hrdi') . 'modifier
    '; + + $this->optiontag($opt); + $this->optionprivacy($opt); + $this->optionsort($opt); + + + + + echo ''; + + echo '
    '; + + } + +} + +public function optiontag(Opt $opt) +{ + + echo '
    Tag
      '; + foreach ($opt->taglist() as $tagor => $count) { + if (in_array($tagor, $opt->tagor())) { + echo '
    • '; + } else { + echo '
    • '; } - echo ''; - echo '
    '; } + echo '
'; - public function aside(App $app) - { - if ($app->session() >= $app::EDITOR) { - echo ' '; +public function optionsort(Opt $opt) +{ + echo '
Sort'; + echo ''; + echo 'order() == '1' ? "checked" : "") . ' />'; + echo 'order() == '-1' ? "checked" : "") . ' />'; + + echo '
'; + +} + +public function map(App $app, $url) +{ + echo '
'; + + $map = ""; + $link = ""; + foreach ($app->getlister(['id', 'lien']) as $item) { + foreach ($item->lien('array') as $lien) { + $map = $map . '
' . $item->id() . ' --> ' . $lien; } + $link = $link . '
click ' . $item->id() . ' "' . $url . '/w/?id=' . $item->id() . '"'; } + echo $map; + echo $link; - public function nav($app) - { - echo '
'; +} - echo 'home'; +public function aside(App $app) +{ + if ($app->session() >= $app::EDITOR) { + echo ' '; + } +} + +public function nav($app) +{ + echo ' 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'); + + $q->bindValue(':id', $art->id()); + $q->bindValue(':titre', $art->titre()); + $q->bindValue(':soustitre', $art->soustitre()); + $q->bindValue(':intro', $art->intro()); + $q->bindValue(':tag', $art->tag('string')); + $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->md()); + $q->bindValue(':secure', $art->secure()); + $q->bindValue(':couleurtext', $art->couleurtext()); + $q->bindValue(':couleurbkg', $art->couleurbkg()); + $q->bindValue(':couleurlien', $art->couleurlien()); + $q->bindValue(':couleurlienblank', $art->couleurlienblank()); + $q->bindValue(':lien', $art->lien('string')); + $q->bindValue(':template', $art->template()); + + $q->execute(); + } + + + + + //____________________________________________ L S T ______________________________ + + + + public function getlister(array $selection = ['id'], array $opt = []) + { + $default = ['tri' => 'id', 'desc' => 'DESC']; + $opt = array_update($default, $opt); + $list = []; - $option = ['datecreation', 'titre', 'id', 'intro', 'datemodif']; - if (is_array($selection) && is_string($tri) && strlen($tri) < 16 && is_string($desc) && strlen($desc) < 5 && in_array($tri, $option)) { + $option = ['datecreation', 'titre', 'id', 'intro', 'datemodif', 'tag', 'secure']; + if (is_array($selection) && is_string($opt['tri']) && strlen($opt['tri']) < 16 && is_string($opt['desc']) && strlen($opt['desc']) < 5 && in_array($opt['tri'], $option)) { $selection = implode(", ", $selection); - $select = 'SELECT ' . $selection . ' FROM ' . $this->arttable . ' ORDER BY ' . $tri . ' ' . $desc; + $select = 'SELECT ' . $selection . ' FROM ' . $this->arttable . ' ORDER BY ' . $opt['tri'] . ' ' . $opt['desc']; $req = $this->bdd->query($select); while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) { $list[] = new Art($donnees); @@ -159,13 +198,95 @@ class App } } + + + + + + public function getlisteropt(Opt $opt) + { + + + $artlist = []; + + $select = 'SELECT ' . $opt->col('string') . ' FROM ' . $this->arttable; + $req = $this->bdd->query($select); + while ($donnees = $req->fetch(PDO::FETCH_ASSOC)) { + $artlist[] = new Art($donnees); + } + return $artlist; + + } + + public function listcalclien(&$artlist) + { + foreach ($artlist as $art) { + $art->calcliento($artlist); + } + } + + public function artcompare($art1, $art2, $method = 'id', $order = 1) + { + $result = ($art1->$method('sort') <=> $art2->$method('sort')); + return $result * $order; + + } + + public function buildsorter($sortby, $order) + { + return function ($art1, $art2) use ($sortby, $order) { + $result = $this->artcompare($art1, $art2, $sortby, $order); + return $result; + }; + } + + + + public function artlistsort(&$artlist, $sortby, $order = 1) + { + return usort($artlist, $this->buildsorter($sortby, $order)); + } + + + + + + + public function filtertagor(array $artlist, array $tagchecked) + { + + $filteredlist = []; + foreach ($artlist as $art) { + if (!empty(array_intersect($art->tag('array'), $tagchecked))) { + $filteredlist[] = $art->id(); + } elseif (empty($tagchecked)) { + $filteredlist[] = $art->id(); + } + } + return $filteredlist; + } + + public function filtersecure(array $artlist, $secure) + { + $filteredlist = []; + foreach ($artlist as $art) { + if ($art->secure() == intval($secure)) { + $filteredlist[] = $art->id(); + } elseif (intval($secure) >= 4) { + $filteredlist[] = $art->id(); + } + } + return $filteredlist; + } + + public function lister() { $req = $this->bdd->query(' SELECT * FROM ' . $this->arttable . ' ORDER BY id '); $donnees = $req->fetchAll(PDO::FETCH_ASSOC); + $req->closeCursor(); return $donnees; - $req->closeCursor(); } @@ -183,32 +304,9 @@ class App return (bool)$donnees['COUNT(*)']; } - 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'); - - $q->bindValue(':id', $art->id()); - $q->bindValue(':titre', $art->titre()); - $q->bindValue(':soustitre', $art->soustitre()); - $q->bindValue(':intro', $art->intro()); - $q->bindValue(':tag', $art->tag('string')); - $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->md()); - $q->bindValue(':secure', $art->secure()); - $q->bindValue(':couleurtext', $art->couleurtext()); - $q->bindValue(':couleurbkg', $art->couleurbkg()); - $q->bindValue(':couleurlien', $art->couleurlien()); - $q->bindValue(':couleurlienblank', $art->couleurlienblank()); - $q->bindValue(':lien', $art->lien('string')); - $q->bindValue(':template', $art->template()); + + // __________________________________________ T A B L E ________________________________________________________ - $q->execute(); - } public function tableexist($dbname, $tablename) { diff --git a/class/class.w.art.php b/class/class.w.art.php index 9640470..d757e0d 100644 --- a/class/class.w.art.php +++ b/class/class.w.art.php @@ -20,6 +20,7 @@ class Art private $couleurlien; private $couleurlienblank; private $lien; + private $liento; private $template; const LEN = 255; @@ -59,8 +60,7 @@ class Art $this->setintro('resumé'); $this->settag('sans tag,'); $this->setdatecreation($now); - $this->setcss('section {} -a:hover {}'); + $this->setcss(''); $this->sethtml('contenu'); $this->setsecure(2); $this->setcouleurtext('#000000'); @@ -74,27 +74,50 @@ a:hover {}'); public function updatelien() { $this->lien = search($this->md(), self::DEBUT, self::FIN); + } + public static function classvarlist() + { + $classvarlist = []; + foreach (get_class_vars(__class__) as $var => $default) { + $classvarlist[] = $var; + } + return ['artvarlist' => $classvarlist]; } + + + + public function calcliento($getlist) + { + $liento = []; + foreach ($getlist as $lien) { + if (in_array($this->id(), $lien->lien('array'))) { + $liento[] = $lien->id(); + } + } + $this->setliento($liento); + } + + // _____________________________________________________ G E T ____________________________________________________ - public function id() + public function id($type = 'string') { return $this->id; } - public function titre() + public function titre($type = 'string') { return $this->titre; } - public function soustitre() + public function soustitre($type = 'string') { return $this->soustitre; } - public function intro() + public function intro($type = 'string') { return $this->intro; } @@ -102,18 +125,19 @@ a:hover {}'); public function tag($option) { if ($option == 'string') { - $tag = implode(", ", $this->tag); + return implode(", ", $this->tag); } elseif ($option == 'array') { - $tag = $this->tag; + return $this->tag; + } elseif ($option == 'sort') { + return count($this->tag); } - return $tag; } public function datecreation($option) { if ($option == 'string') { return $this->datecreation->format('Y-m-d H:i:s'); - } elseif ($option == 'date') { + } elseif ($option == 'date' || $option == 'sort') { return $this->datecreation; } elseif ($option == 'hrdi') { $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); @@ -126,7 +150,7 @@ a:hover {}'); { if ($option == 'string') { return $this->datemodif->format('Y-m-d H:i:s'); - } elseif ($option == 'date') { + } elseif ($option == 'date' || $option == 'sort') { return $this->datemodif; } elseif ($option == 'hrdi') { $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); @@ -134,7 +158,7 @@ a:hover {}'); } } - public function css() + public function css($type = 'string') { return $this->css; } @@ -166,7 +190,7 @@ a:hover {}'); foreach ($this->lien('array') as $id) { $title = "Cet article n'existe pas encore"; - foreach ($app->getlister(['id', 'intro'], 'id') as $item) { + foreach ($app->getlister(['id', 'intro']) as $item) { if ($item->id() == $id) { $title = $item->intro(); } @@ -185,9 +209,16 @@ a:hover {}'); } - public function secure() + public function secure($type = 'int') { - return $this->secure; + if ($type == 'string') { + if ($this->secure == 0) $secure = 'public'; + if ($this->secure == 1) $secure = 'private'; + if ($this->secure == 2) $secure = 'not published'; + return $secure; + } else { + return $this->secure; + } } public function couleurtext() @@ -216,12 +247,27 @@ a:hover {}'); $lien = implode(", ", $this->lien); } elseif ($option == 'array') { $lien = $this->lien; + } elseif ($option == 'sort') { + return count($this->lien); } return $lien; } - public function template() + public function liento($option) + { + if ($option == 'string') { + $liento = implode(", ", $this->liento); + } elseif ($option == 'array') { + $liento = $this->liento; + } elseif ($option == 'sort') { + return count($this->liento); + } + return $liento; + + } + + public function template($type = 'string') { return $this->template; } @@ -229,6 +275,7 @@ a:hover {}'); + // _____________________________________________________ S E T ____________________________________________________ public function setid($id) @@ -263,7 +310,11 @@ a:hover {}'); { if (strlen($tag) < self::LEN and is_string($tag)) { $tag = strip_tags(trim(strtolower($tag))); - $taglist = explode(", ", $tag); + $tag = str_replace('*', '', $tag); + $tag = str_replace(' ', '', $tag); + + $taglist = explode(",", $tag); + $taglist = array_filter($taglist); $this->tag = $taglist; } } @@ -350,6 +401,15 @@ a:hover {}'); } } + public function setliento($liento) + { + if (is_array($liento)) { + $this->liento = $liento; + } + + + } + public function settemplate($template) { $template = strip_tags($template); diff --git a/class/class.w.opt.php b/class/class.w.opt.php new file mode 100644 index 0000000..76b3905 --- /dev/null +++ b/class/class.w.opt.php @@ -0,0 +1,207 @@ + '0', 'max' => '0']; + private $lienfrom = ['min' => '0', 'max' => '0']; + private $col = ['id']; + private $taglist = []; + + private $artvarlist; + + public function __construct(array $donnees = []) + { + $this->hydrate($donnees); + } + + public function hydrate(array $donnees) + { + foreach ($donnees as $key => $value) { + $method = 'set' . $key; + + if (method_exists($this, $method)) { + $this->$method($value); + } + } + } + + + public function reset() + { + $varlist = get_class_vars(__class__); + + foreach ($varlist as $var => $default) { + $method = 'set' . $var; + $this->$method($default); + } + } + + public function dump() + { + var_dump($this); + } + + + + + + // _______________________________________________ G E T _______________________________________________ + + public function sortby() + { + return $this->sortby; + } + + public function order() + { + return $this->order; + } + + public function secure() + { + return $this->secure; + } + + public function tagor($type = 'array') + { + return $this->tagor; + } + + public function liento($type = 'array') + { + return $this->liento; + } + + public function lienfrom($type = 'array') + { + return $this->lienfrom; + } + + public function col($type = 'array') + { + if ($type == 'string') { + return implode(', ', $this->col); + } else { + return ($this->col); + } + } + + public function artvarlist() + { + return $this->artvarlist; + } + + public function taglist() + { + return $this->taglist; + } + + + // __________________________________________________ S E T _____________________________________________ + + public function setsortby($sortby) + { + if (is_string($sortby) && in_array($sortby, $this->artvarlist())) { + $this->sortby = strtolower(strip_tags($sortby)); + } + } + + public function setorder($order) + { + $order = intval($order); + if (in_array($order, [-1, 0, 1])) { + $this->order = $order; + } + } + + public function settagor($tagor) + { + if (is_array($tagor)) { + // $tagorlist = []; + // foreach ($tagor as $tag) { + // if (array_key_exists($tag, $this->taglist())) { + // $tagorlist[] = $tag; + // } + // } + $this->tagor = $tagor; + } + } + + public function setsecure($secure) + { + if ($secure >= 0 && $secure <= 5) { + $this->secure = intval($secure); + } + } + + public function setliento($n0, $n1) + { + $stock = [intval($n1), intval($n2)]; + $sorted = asort($stock); + $this->liento = ['min' => $stock[0], 'max' => $stock[1]]; + } + + public function setlienfrom($n0, $n1) + { + $stock = [intval($n1), intval($n2)]; + $sorted = asort($stock); + $this->lienfrom = ['min' => $stock[0], 'max' => $stock[1]]; + } + + public function setlientomin($min) + { + $this->liento['min'] = intval($min); + } + + public function setlientomax($max) + { + $this->liento['max'] = intval($max); + } + + public function setlienfrommin($min) + { + $this->lienfrom['min'] = intval($min); + } + + public function setlienfrommax($max) + { + $this->lienfrom['max'] = intval($max); + } + + public function setcol($col) + { + if (is_array($col)) { + $this->col = array_intersect($this->artvarlist(), $col); + } + } + + public function setartvarlist(array $artvarlist) + { + $this->artvarlist = $artvarlist; + } + + public function settaglist(array $artlist) + { + $taglist = []; + foreach ($artlist as $art) { + foreach ($art->tag('array') as $tag) { + if (!array_key_exists($tag, $taglist)) { + $taglist[$tag] = 1; + } else { + $taglist[$tag]++; + } + } + } + $taglistsorted = arsort($taglist); + $this->taglist = $taglist; + } + +} + + + + +?> \ No newline at end of file diff --git a/fn/fn.php b/fn/fn.php index ce299c8..f3b87aa 100644 --- a/fn/fn.php +++ b/fn/fn.php @@ -99,5 +99,40 @@ function hrdi(DateInterval $diff) } + +function arrayclean($input) +{ + $output = []; + foreach ($input as $key => $value) { + if (is_array($value)) { + $output[$key] = array_filter($value); + } else { + $output[$key] = $value; + } + } + return $output; +} + + + + +function array_update($base, $new) +{ + foreach ($base as $key => $value) { + if (array_key_exists($key, $new)) { + if (gettype($base[$key]) == gettype($new[$key])) { + $base[$key] = $new[$key]; + } + } + } + return $base; +} + + + + + + + ?> diff --git a/public/css/old/styleedit.css b/public/css/old/styleedit.css new file mode 100644 index 0000000..21435fb --- /dev/null +++ b/public/css/old/styleedit.css @@ -0,0 +1,27 @@ +.edit { + background-color: greenyellow; +} + +#linklist { + background-color: blanchedalmond; +} + +#submit { + background-color: coral; +} + +#copy { + background-color: darkkhaki; +} + +#html { + background-color: deepskyblue; +} + +#artedit { + background-color: darksalmon; +} + +#editoption { + background-color: blueviolet; +} \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/public/css/styleadmin.css b/public/css/styleadmin.css new file mode 100644 index 0000000..e69de29 diff --git a/public/css/stylebase.css b/public/css/stylebase.css index ff59114..5621363 100644 --- a/public/css/stylebase.css +++ b/public/css/stylebase.css @@ -1,193 +1,58 @@ -body { - background-color: #dcdcdceb; - font-family: helvetica, arial, sans-serif; - margin: 0px; - -} - -h1 { - font-size: 3em; - font-variant: all-small-caps; - margin-top: 0px; - margin-bottom: 0px; -} - -h2 { - font-style: italic; +:root { + --color1: lightgrey; + --color2: lightslategrey; + --color3: white; + --color4: grey; } -h3 { - opacity: 0.7; -} - -h6 { - font-size: 1em; -} - -p{ - font-size: 1em; -} - -em { - opacity: 0.8; -} - -a{ - text-decoration: none; -} - -a:hover{ - text-decoration: underline; +body { + margin: 0; + font-family: monospace; } -form { - margin-bottom: 0px; -} section { - padding: 3%; -} - -.edit body { - overflow-y: scroll; -} - -.edit section { - text-align: left; - padding-top: 0px; - padding-bottom: 0px; - padding-left: 8%; - padding-right: 8%; - line-height: 1.2em; } -.button, input, textarea, select { - display: inline-block; - width: 90%; - padding-left: 15px; - padding-right: 15px; - margin: 5px; - margin-left: 5%; - margin-right: 5%; - height: 30px; - 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: calc(100% - 95px); +form{ + margin: 0; } -#css{ - height: 250px; -} -input[type="submit"] { - background-color: #bfbfbf; -} - -aside { - position: fixed; - bottom: 0px; - right: -300px; - padding: 7px; - z-index: 5; - background: #bfbfbf; - opacity: 0.3; - width: 350px; - overflow-y: scroll; - max-height: calc(100% - 200px); -} - -aside:hover { - opacity: 1; - right: 0px; -} nav { position: fixed; - top: 0px; - right: -6%; - z-index: 10; - opacity: 0.3; - width: 8%; - text-align: right; -} - - - -nav:hover, .edit nav { - opacity: 1; - right: 0px; + top: 0; + right: 0; + z-index: 10; + background-color: var(--color1); + /* width: calc(10% - 20px); */ + width: 10%; + border: ridge 1px grey; } -.alert h4 { - background-color: red; - margin: 0px; +div#menu { + display: none; } -table { - width: 100%; - margin-top: 20px; -} - -.home tr:hover { - background-color: #bfbfbf; +nav:hover div#menu { + display: block; } -.home td:hover { - background-color: #a7a6a6; +nav a { + display: block; } -td { - border: 1px solid #ffffff00; - padding-top: 3px; - padding-bottom: 3px; +nav a:hover { + background-color: var(--color2); } -.submit { - position: fixed; - top: 0px; - left: 0px; - width: 8%; +nav #loginpass { + width: 100%; } -summary { - height: 24px; - outline: none; - font-size: 1.4em; - background-color: #a0a0a0; - margin-top: 3px; - margin-bottom: 3px; -} \ No newline at end of file diff --git a/public/css/styleedit.css b/public/css/styleedit.css new file mode 100644 index 0000000..0e5ed01 --- /dev/null +++ b/public/css/styleedit.css @@ -0,0 +1,120 @@ +.edit { + background-color: var(--color1); +} + +#linklist { + background-color: var(--color1); +} + +#submit { + background-color: var(--color1); +} + +#copy { + background-color: var(--color1); +} + + +#artedit { + background-color: var(--color1); +} + +details { + background-color: var(--color1); +} + + + + + + +details#editinfo { + position: fixed; + top: 0; + left: 10%; + width: 40%; +} + +details#editcss { + position: fixed; + top: 0; + left: 50%; + width: 40%; +} + +div#submit { + position: fixed; + top: 0; + width: 10%; +} + +textarea#html { + width: 100%; + height: 100%; + font-size: 1em; + padding-top: 40px; + padding-bottom: 40px; + font-family: serif; + padding-left: 2%; + padding-right: calc(50% - 500px); + +} + + +div#copy { + position: fixed; + bottom: 0; +} + +div#linklist { + position: fixed; + bottom: 0; + right: 0; + min-width: 10%; + max-width: 50%; + max-height: 50%; + overflow-y: auto; + +} + +div#linklist div#roll { + display: none; +} + +div#linklist:hover div#roll { + display: block; + width: auto; +} + +div#roll ul { + list-style: none; + margin: 0; + padding: 0; +} + + + +details label { + display: block; + margin-top: 4px; +} + +textarea#css { + width: 100%; + height: 200px; +} + +details select, details input, details label, details textarea#css { + width: 100%; +} + +fieldset { + margin: 0; + padding: 0; + border: none; +} + +summary, div#linklist, div#copy, div#submit { + border: ridge 1px grey; + +} \ No newline at end of file diff --git a/public/css/stylehome.css b/public/css/stylehome.css new file mode 100644 index 0000000..b2e8c73 --- /dev/null +++ b/public/css/stylehome.css @@ -0,0 +1,56 @@ +div#options { + background-color: var(--color1); +} + +#home2table { + background-color: var(--color3); +} + +header { + background-color: var(--color1); +} + + + + +section.home { + margin-top: 20px; + display: inline-flex; + width: 100%; +} + +header { + position: fixed; + width: 100%; + border: ridge 1px grey; +} + + +div#options { + width: 15%; + list-style: none; +} + + +#home2table { + width: 85%; +} + +#options ul { + list-style: none; + margin: 0; + padding: 0; +} + + +#home2table tr:hover { + background-color: var(--color1); +} + +#home2table th { + background-color: var(--color1); + border: ridge 1px grey; +} + + + diff --git a/public/css/stylew.css b/public/css/stylew.css deleted file mode 100644 index f175036..0000000 --- a/public/css/stylew.css +++ /dev/null @@ -1,249 +0,0 @@ -body { - background-color: #dcdcdceb; - font-family: helvetica, arial, sans-serif; - margin: 0px; - overflow: hidden; - -} - -h1 { - font-size: 3em; - font-variant: all-small-caps; - margin-top: 0px; - margin-bottom: 0px; -} - -h2 { - font-style: italic; -} - -h3 { - opacity: 0.7; -} - -h6 { - font-size: 1em; -} - -p{ - font-size: 1em; -} - -em { - opacity: 0.8; -} - -a{ - text-decoration: none; -} - -a:hover{ - text-decoration: underline; -} - -img { - width: 90%; - max-width: 1000px; -} - -form { - margin-bottom: 0px; -} - -section { - text-align: justify; - padding: 3%; -} - -.edit { - overflow-y: scroll; - height: 100%; - -} - -.lecture { - overflow-wrap: break-word; - overflow-y: auto; - height: 100%; -} - -.home { - overflow-y: scroll; - height: 100%; -} - -.edit section { - text-align: left; - padding-top: 0px; - padding-bottom: 0px; - padding-left: 8%; - padding-right: 8%; - line-height: 1.2em; -} - -.button, input, textarea, select { - display: inline-block; - width: 90%; - padding-left: 15px; - padding-right: 15px; - margin: 5px; - margin-left: 5%; - margin-right: 5%; - height: 30px; - 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: calc(100% - 95px); -} - -#css{ - height: 250px; -} - -input[type="submit"] { - background-color: #bfbfbf; -} - -aside { - position: fixed; - bottom: 0px; - right: -300px; - padding: 7px; - z-index: 5; - background: #bfbfbf; - opacity: 0.3; - width: 350px; - overflow-y: scroll; - max-height: calc(100% - 200px); -} - -aside:hover { - opacity: 1; - right: 0px; -} - -nav { - position: fixed; - top: 0px; - right: -6%; - z-index: 10; - opacity: 0.3; - width: 8%; - text-align: right; -} - - - -nav:hover, .edit nav { - opacity: 1; - right: 0px; -} - -.alert h4 { - background-color: red; - margin: 0px; -} - -table { - width: 100%; - margin-top: 20px; -} - -.home tr:hover { - background-color: #bfbfbf; -} - -.home td:hover { - background-color: #a7a6a6; -} - -td { - border: 1px solid #ffffff00; - padding-top: 3px; - padding-bottom: 3px; -} - -.submit { - position: fixed; - top: 0px; - left: 0px; - width: 8%; -} - -.thumbnail { - max-width: 30px; -} - -.infobulle { - width: 20%; - display: none; -} - -.little:hover .infobulle { - display: inline; - position: absolute; - background-color: white; - border: 1px solid black; -} - -span.infobulle img { - width: 100% -} - -.grid { - display: flex; - flex-wrap: wrap; -} - -.copy { - position: fixed; - bottom: 0px; - left: 0px; - width: 8%; -} - -.container { - position: relative; - width: 100%; - height: 0; - padding-bottom: 56.25%; - } - .video { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - } \ No newline at end of file diff --git a/public/rsc/js/app.js b/public/rsc/js/app.js index d1b9f55..b806baf 100644 --- a/public/rsc/js/app.js +++ b/public/rsc/js/app.js @@ -1,5 +1,7 @@ -function confirmSubmit(event, element) { +function confirmSubmit(event, element, idform) { if (window.confirm('Confirmer ? ' + element) === false) { event.preventDefault(); + } else { + document.getElementById(idform).submit(); } } \ No newline at end of file diff --git a/public/w/index.php b/public/w/index.php index 9229bb9..8b5069f 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -4,16 +4,14 @@ // _____________________________________________________ R E Q U I R E ________________________________________________________________ require('../../vendor/autoload.php'); -use Michelf\Markdown; -use Michelf\MarkdownExtra; - require('../../fn/fn.php'); -require('../../class/class.w.config.php'); -require('../../class/class.w.art.php'); -require('../../class/class.w.app.php'); -require('../../class/class.w.aff.php'); -require('../../class/class.w.media.php'); -require('../../class/class.w.record.php'); + +function my_autoloader($class) +{ + require('../../class/class.w.' . strtolower($class) . '.php'); +} +spl_autoload_register('my_autoloader'); + // ________________________________________________________ I N S T A L _________________________________________________ @@ -173,19 +171,18 @@ if (isset($_GET['id'])) { $app->setbdd($config); if ($app->exist($_GET['id'])) { $art = $app->get($_GET['id']); - if (isset($_GET['edit']) && $_GET['edit'] == 1) { - $aff->arthead($art, $config->cssread(), 1); - } else { - $aff->arthead($art, $config->cssread(), 0); + if (!isset($_GET['edit'])) { + $_GET['edit'] = 0; } + $aff->arthead($art, $config->cssread(), $_GET['edit']); } else { - $aff->head($_GET['id'], 'w'); + $aff->head($_GET['id'], ''); } } elseif (isset($_GET['aff'])) { $aff->head($_GET['aff'], $_GET['aff']); } else { - $aff->head('home', 'w'); + $aff->head('home', 'home'); } @@ -197,7 +194,7 @@ if (isset($_GET['id'])) { // _____________________________________________________ A L E R T _______________________________________________________________ if (isset($_GET['message'])) { - echo '

' . $_GET['message'] . '

'; + echo '' . $_GET['message'] . ''; } @@ -221,11 +218,15 @@ if (isset($_GET['id'])) { $art = $app->get($_GET['id']); if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) { - $aff->edit($art, $app, $app->getlister(['id', 'titre'], 'id')); - $aff->copy($art, $app->getlister(['id', 'titre'], 'id')); + echo '
'; + $aff->edit($art, $app, $app->getlister(['id', 'titre'])); + $aff->copy($art, $app->getlister(['id', 'titre'])); $aff->aside($app); + echo '
'; } else { + echo '
'; $aff->lecture($art, $app); + echo '
'; } } else { @@ -237,7 +238,7 @@ if (isset($_GET['id'])) { header('Location: ?id=' . $_GET['id'] . '&edit=1'); } } else { - echo '

This article does not exist yet

'; + echo 'This article does not exist yet'; if ($app->session() >= $app::EDITOR) { echo '
'; @@ -254,7 +255,7 @@ if (isset($_GET['id'])) { } elseif (isset($_GET['lien'])) { $app->setbdd($config); echo '

' . $_GET['lien'] . '

'; - $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien'], 'id'), $_GET['lien'], $app); + $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien']), $_GET['lien'], $app); } elseif (isset($_GET['aff']) && $app->session() >= $app::EDITOR) { if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) { @@ -292,27 +293,49 @@ if (isset($_GET['id'])) { echo ''; + } elseif ($_GET['aff'] == 'map') { + $app->setbdd($config); + $aff->map($app, $config->domain()); } else { header('Location: ./'); } } else { - $app->setbdd($config); - if (isset($_GET['tri'])) { - $tri = strip_tags($_GET['tri']); - } else { - $tri = 'id'; - } - if (isset($_GET['desc'])) { - $desc = strip_tags($_GET['desc']); - } else { - $desc = 'ASC'; + $aff->header(); + + echo '
'; + + + $app->setbdd($config); + $opt = new Opt(Art::classvarlist()); + $opt->hydrate($_GET); + $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure']); + $table = $app->getlisteropt($opt); + $app->listcalclien($table); + $opt->settaglist($table); + $opt->setcol(['id', 'tag', 'lien', 'contenu', 'intro', 'titre', 'datemodif', 'datecreation', 'secure', 'liento']); + + $aff->option($app, $opt); + + $filtertagor = $app->filtertagor($table, $opt->tagor()); + $filtersecure = $app->filtersecure($table, $opt->secure()); + + $filter = array_intersect($filtertagor, $filtersecure); + $table2 = []; + foreach ($table as $art) { + if (in_array($art->id(), $filter)) { + $table2[] = $art; + } } - $aff->home2table($app, $app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc)); + $app->artlistsort($table2, $opt->sortby(), $opt->order()); + + + + $aff->home2table($app, $table2); - //var_dump($app->getlister(['id', 'lien'])); + echo '
'; } -- cgit v1.2.3