diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-07-10 01:31:04 +0200 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-07-10 01:31:04 +0200 |
commit | 7a1e28b979fffefbf29d08e3b7c6430d8d60e0e3 (patch) | |
tree | a4f8a02841a82e63aff7759751bb2a01cfdf6b57 /public | |
parent | acc42674db6482ee6d432c4a9c174ed7dfcea063 (diff) | |
download | wcms-7a1e28b979fffefbf29d08e3b7c6430d8d60e0e3.tar.gz wcms-7a1e28b979fffefbf29d08e3b7c6430d8d60e0e3.zip |
W 2.3
Diffstat (limited to 'public')
-rw-r--r-- | public/css/stylebase.css | 3 | ||||
-rw-r--r-- | public/css/stylerecord.css | 66 | ||||
-rw-r--r-- | public/css/stylew.css | 15 | ||||
-rw-r--r-- | public/w/index.php | 166 |
4 files changed, 204 insertions, 46 deletions
diff --git a/public/css/stylebase.css b/public/css/stylebase.css index 92ea674..ff59114 100644 --- a/public/css/stylebase.css +++ b/public/css/stylebase.css @@ -46,10 +46,9 @@ form { section { padding: 3%; - line-height: 1.2em; } -.edit { +.edit body { overflow-y: scroll; } diff --git a/public/css/stylerecord.css b/public/css/stylerecord.css new file mode 100644 index 0000000..9e46c3f --- /dev/null +++ b/public/css/stylerecord.css @@ -0,0 +1,66 @@ +section { + padding: 0; +} + +.infobulle { + display: none; +} + +.little:hover .infobulle { + display: inline-block; + position: relative; + background-color: white; + z-index: 5; + top: 5px; + width: 300px; + font-family: monospace; + font-size: 0.9em; + line-height: 1.1em; +} + +span.infobulle img { + width: 100%; +} + +.grid { + display: flex; + flex-wrap: wrap; + padding: 4%; + margin-right: 120px; + list-style: none; + +} + +.little { + width: 100px; + height: 150px; + margin: 10px; + background-color: white; + +} + +.infobulle input[type="text"] { + font-family: monospace; + font-size: 0.9em; + margin: 3px; +} + +img.thumbnail { + max-width: 100%; + max-height: 100px; +} + +section.gest { + padding-bottom: 300px; +} + +input[type="file"] { + font-size: 1.3em; +} + +input[type="checkbox"] { + width: unset; + padding: unset; + margin: unset; + height: unset; +}
\ No newline at end of file diff --git a/public/css/stylew.css b/public/css/stylew.css index 3a414c7..f175036 100644 --- a/public/css/stylew.css +++ b/public/css/stylew.css @@ -2,6 +2,7 @@ body { background-color: #dcdcdceb; font-family: helvetica, arial, sans-serif; margin: 0px; + overflow: hidden; } @@ -52,11 +53,23 @@ form { section { text-align: justify; padding: 3%; - line-height: 1.2em; } .edit { overflow-y: scroll; + height: 100%; + +} + +.lecture { + overflow-wrap: break-word; + overflow-y: auto; + height: 100%; +} + +.home { + overflow-y: scroll; + height: 100%; } .edit section { diff --git a/public/w/index.php b/public/w/index.php index 9a40e9f..3f572b3 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -3,32 +3,120 @@ // _____________________________________________________ R E Q U I R E ________________________________________________________________ - - -$config = require('../../config.php'); 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'); + +// ________________________________________________________ I N S T A L _________________________________________________ + +$app = new App(); +$aff = new Aff(); + + +$config = $app->readconfig(); +if (!$config) { + $message = 'config_file_error'; + echo $message; + if (isset($_POST['config']) && $_POST['config'] == 'create') { + $config = $app->createconfig($_POST); + $app->savejson($config->tojson()); + header('Location: ./'); + + } else { + $aff->configform(); + } + exit; +} + + +// _________________________________________________________ S E S ___________________________________________________________ + session(); if (!isset($_SESSION['level'])) { - $level = 0; + $session = 0; } else { - $level = $_SESSION['level']; + $session = $_SESSION['level']; +} + +$app->setsession($session); + +//var_dump($config); +//var_dump($app); + + + +// _________________________________________________________ N A V _______________________________________________ + +if (isset($_GET['id'])) { + $app->setbdd($config); } -$app = new App($config); -$aff = new Aff($level); // _____________________________________________________ A C T I O N __________________________________________________________________ + +if (isset($_POST['action'])) { + switch ($_POST['action']) { + + case 'login': + $_SESSION['level'] = $app->login($_POST['pass'], $config); + if (isset($_GET['id'])) { + header('Location: ?id=' . $_GET['id']); + } else { + header('Location: ./'); + } + break; + + case 'logout': + $_SESSION['level'] = $app->logout(); + if (isset($_GET['id'])) { + header('Location: ?id=' . $_GET['id']); + } else { + header('Location: ./'); + } + break; + + case 'addmedia': + $message = $app->addmedia($_FILES, 2 ** 24, $_POST['id']); + header('Location: ./?aff=media&message=' . $message); + break; + + case 'addcss': + $message = $app->addcss($_FILES, 2 ** 24, $_POST['id']); + header('Location: ./?aff=admin&message=' . $message); + break; + + case 'changecss': + $config->setcssread($_POST['lecturecss']); + $app->savejson($config->tojson()); + header('Location: ./?aff=admin'); + break; + + case 'editconfig': + $config->hydrate($_POST); + $app->savejson($config->tojson()); + header('Location: ./?aff=admin'); + + break; + + + } +} + + +// _____________________________________________________ D A T A B A S E __________________________________________________________________ + if (isset($_POST['action'])) { + $app->setbdd($config); + switch ($_POST['action']) { case 'update': @@ -71,46 +159,22 @@ if (isset($_POST['action'])) { } break; - - case 'login': - $_SESSION['level'] = $app->login($_POST['pass']); - if (isset($_GET['id'])) { - header('Location: ?id=' . $_GET['id']); - } else { - header('Location: ./'); - } - break; - - case 'logout': - $_SESSION['level'] = $app->logout(); - if (isset($_GET['id'])) { - header('Location: ?id=' . $_GET['id']); - } else { - header('Location: ./'); - } - break; - - case 'addmedia': - $message = $app->addmedia($_FILES, 2 ** 10, $_POST['id']); - header('Location: ./?aff=media&message='.$message); - break; - } } - - // _______________________________________________________ H E A D _____________________________________________________________ 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, '✏'); + $aff->arthead($art, $config->cssread(), 1); + } else { + $aff->arthead($art, $config->cssread(), 0); } - $aff->arthead($art, ''); } else { $aff->head($_GET['id'], 'w'); @@ -146,15 +210,17 @@ echo '<body>'; $aff->nav($app); if (isset($_GET['id'])) { + $app->setbdd($config); + if ($app->exist($_GET['id'])) { $art = $app->get($_GET['id']); - if (isset($_GET['edit']) and $_GET['edit'] == 1 and $aff->session() == 2) { - $aff->edit($art, $app->getlister(['id', 'titre'], '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')); - $aff->aside($app->lister()); + $aff->aside($app); } else { $aff->lecture($art, $app); @@ -170,7 +236,7 @@ if (isset($_GET['id'])) { } else { echo '<span class="alert"><h4>Cet article n\'existe pas encore</h4></span>'; - if ($level >= 2) { + if ($aff->session() >= 2) { echo '<form action="?id=' . $_GET['id'] . '&edit=1" method="post"><input type="hidden" name="action" value="new"><input type="submit" value="créer"></form>'; } @@ -184,11 +250,17 @@ if (isset($_GET['id'])) { } elseif (isset($_GET['lien'])) { echo '<h4>' . $_GET['lien'] . '</h4>'; $aff->lien($app->getlister(['id', 'titre', 'intro', 'lien'], 'id'), $_GET['lien']); - -} elseif (isset($_GET['aff'])) { +} elseif (isset($_GET['aff']) && $app->session() == $app::ADMIN) { if ($_GET['aff'] == 'admin') { + echo '<section>'; echo '<h1>Admin</h1>'; + + $aff->admincss($config, $app->csslist()); + $aff->admindb($config); + + echo '</section>'; } elseif ($_GET['aff'] == 'media') { + echo '<h1>Media</h1>'; echo '<section>'; $aff->addmedia(); @@ -198,11 +270,19 @@ if (isset($_GET['id'])) { } elseif ($_GET['aff'] == 'record') { echo '<h1>Record</h1>'; + echo '<section>'; + + $aff->recordlist($app); + + echo '</section>'; + } else { header('Location: ./'); } } else { + $app->setbdd($config); + if (isset($_GET['tri'])) { $tri = strip_tags($_GET['tri']); } else { @@ -213,7 +293,7 @@ if (isset($_GET['id'])) { } else { $desc = 'ASC'; } - $aff->home2table($app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc)); + $aff->home2table($app, $app->getlister(['id', 'titre', 'intro', 'lien', 'datecreation', 'datemodif'], $tri, $desc)); } |