From cbecc0dfc819febf4c2b36791d5a2a7e69d842af Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sun, 2 Sep 2018 16:19:13 +0200 Subject: 2.5 mobile update + minor upgrades and fixes --- public/css/styleadmin.css | 12 +++ public/css/stylebase.css | 20 +++-- public/css/styleedit.css | 40 +++++++++- public/css/stylehome.css | 38 +++++++++ public/css/stylemedia.css | 14 ++++ public/css/stylerecord.css | 13 ++++ public/rsc/js/app.js | 2 +- public/w/article.php | 28 +++++++ public/w/home.php | 57 ++++++++++++++ public/w/index.php | 188 ++++++++++++--------------------------------- public/w/menu.php | 50 ++++++++++++ 11 files changed, 317 insertions(+), 145 deletions(-) create mode 100644 public/w/article.php create mode 100644 public/w/home.php create mode 100644 public/w/menu.php (limited to 'public') diff --git a/public/css/styleadmin.css b/public/css/styleadmin.css index e69de29..aacca33 100644 --- a/public/css/styleadmin.css +++ b/public/css/styleadmin.css @@ -0,0 +1,12 @@ + +@media (max-width: 600px) { + nav { + width: unset; + position: relative; + display: block; + } + + div#menu { + display: block; + } +} \ No newline at end of file diff --git a/public/css/stylebase.css b/public/css/stylebase.css index 5621363..581994d 100644 --- a/public/css/stylebase.css +++ b/public/css/stylebase.css @@ -11,10 +11,6 @@ body { } -section { -} - - @@ -30,8 +26,6 @@ nav { right: 0; z-index: 10; background-color: var(--color1); - /* width: calc(10% - 20px); */ - width: 10%; border: ridge 1px grey; } @@ -56,3 +50,17 @@ nav #loginpass { } +@media (max-width: 600px) { + body { + font-size: 1.3em; + } + + input, textarea, select, button { + font-size: 0.8em; + } + + nav { + display: none; + } + +} \ No newline at end of file diff --git a/public/css/styleedit.css b/public/css/styleedit.css index 0e5ed01..3a868c3 100644 --- a/public/css/styleedit.css +++ b/public/css/styleedit.css @@ -56,7 +56,8 @@ textarea#html { padding-bottom: 40px; font-family: serif; padding-left: 2%; - padding-right: calc(50% - 500px); + padding-right: calc(50% - 500px); + resize: none; } @@ -117,4 +118,41 @@ fieldset { summary, div#linklist, div#copy, div#submit { border: ridge 1px grey; +} + + +@media (max-width: 600px) { + details#editinfo, details#editcss, div#copy, div#linklist { + display: none; + } + + + nav { + position: absolute; + display: inline-flex; + } + + div#menu { + display: block; + } + + div#submit { + position: absolute; + display: block; + width: unset; + top: unset; + bottom: 0; + } + + nav form, nav a { + display: inline-flex; + margin: 1%; + } + + textarea#html { + padding-top: 60px; + } + + + } \ No newline at end of file diff --git a/public/css/stylehome.css b/public/css/stylehome.css index b2e8c73..beaae93 100644 --- a/public/css/stylehome.css +++ b/public/css/stylehome.css @@ -54,3 +54,41 @@ div#options { +@media (max-width: 600px) { + + section.home { + position: relative; + display: block; + margin: unset; + } + + div#options { + position: relative; + width: unset; + } + + header { + position: relative; + border: none; + } + + table#home2table { + display: block; + position: relative; + width: 100%; + overflow-x: scroll; + font-size: 1em; + } + + nav { + width: unset; + position: relative; + display: block; + } + + div#menu { + display: block; + } + + +} \ No newline at end of file diff --git a/public/css/stylemedia.css b/public/css/stylemedia.css index 9e46c3f..a2f9800 100644 --- a/public/css/stylemedia.css +++ b/public/css/stylemedia.css @@ -63,4 +63,18 @@ input[type="checkbox"] { padding: unset; margin: unset; height: unset; +} + + + +@media (max-width: 600px) { + nav { + width: unset; + position: relative; + display: block; + } + + div#menu { + display: block; + } } \ No newline at end of file diff --git a/public/css/stylerecord.css b/public/css/stylerecord.css index 9e46c3f..409bcd4 100644 --- a/public/css/stylerecord.css +++ b/public/css/stylerecord.css @@ -63,4 +63,17 @@ input[type="checkbox"] { padding: unset; margin: unset; height: unset; +} + + +@media (max-width: 600px) { + nav { + width: unset; + position: relative; + display: block; + } + + div#menu { + display: block; + } } \ No newline at end of file diff --git a/public/rsc/js/app.js b/public/rsc/js/app.js index b806baf..1f1df61 100644 --- a/public/rsc/js/app.js +++ b/public/rsc/js/app.js @@ -1,5 +1,5 @@ function confirmSubmit(event, element, idform) { - if (window.confirm('Confirmer ? ' + element) === false) { + if (window.confirm('Confirm ? ' + element) === false) { event.preventDefault(); } else { document.getElementById(idform).submit(); diff --git a/public/w/article.php b/public/w/article.php new file mode 100644 index 0000000..e5cfff7 --- /dev/null +++ b/public/w/article.php @@ -0,0 +1,28 @@ +exist($_GET['id'])) { + + $art = $app->get($_GET['id']); + + if (isset($_GET['edit']) and $_GET['edit'] == 1 and $app->session() >= $app::EDITOR) { + 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 { + echo 'This article does not exist yet'; + + if ($app->session() >= $app::EDITOR) { + echo '
'; + } + +} + +?> \ No newline at end of file diff --git a/public/w/home.php b/public/w/home.php new file mode 100644 index 0000000..4966c62 --- /dev/null +++ b/public/w/home.php @@ -0,0 +1,57 @@ +header(); + +echo '
'; + + +if ($app->session() >= $app::EDITOR) { + + $app->bddinit($config); + $opt = new Opt(Art::classvarlist()); + + if(!empty($_GET)) { + + $_SESSION['opt'] = $_GET; + $opt->hydrate($_GET); + + } + if(isset($_GET['submit']) && $_GET['submit'] == 'reset') { + $opt = new Opt(Art::classvarlist()); + } else { + $opt->hydrate($_SESSION['opt']); + + } + + $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); + + $filtertagfilter = $app->filtertagfilter($table, $opt->tagfilter(), $opt->tagcompare()); + $filtersecure = $app->filtersecure($table, $opt->secure()); + + $filter = array_intersect($filtertagfilter, $filtersecure); + $table2 = []; + foreach ($table as $art) { + if (in_array($art->id(), $filter)) { + $table2[] = $art; + } + } + + $app->artlistsort($table2, $opt->sortby(), $opt->order()); + + + + $aff->home2table($app, $table2); +} + + + +echo '
'; + +?> \ No newline at end of file diff --git a/public/w/index.php b/public/w/index.php index 8b5069f..d9b9d5c 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -1,18 +1,17 @@ setsession($session); -// __________________________________________________________ I D _______________________________________________ - -if (isset($_GET['id'])) { - $app->setbdd($config); -} // _______________________________________________________ A C T I O N __________________________________________________________________ @@ -100,13 +94,23 @@ if (isset($_POST['action'])) { } + // _____________________________________________________ D A T A B A S E __________________________________________________________________ if (isset($_POST['action'])) { - $app->setbdd($config); + $app->bddinit($config); switch ($_POST['action']) { + case 'new': + if (isset($_GET['id'])) { + $art = new Art($_GET); + $art->reset(); + $app->add($art); + header('Location: ?id=' . $_GET['id'] . '&edit=1'); + } + break; + case 'update': if ($app->exist($_GET['id'])) { $art = new Art($_POST); @@ -147,6 +151,24 @@ if (isset($_POST['action'])) { } break; + case 'massedit': + if (isset($_POST['id'])) { + foreach ($_POST['id'] as $id) { + $art = new Art(['id' => $id]); + if ($_POST['massedit'] == 'delete' && $app->exist($id)) { + $app->delete($art); + } + if ($_POST['massedit'] >= 0 && $app->exist($id)) { + $art = $app->get($id); + $art->setsecure($_POST['massedit']); + $app->update($art); + } + header('Location: ./'); + } + + } + break; + } } @@ -165,10 +187,14 @@ if (isset($_POST['actiondb'])) { } } + + + + // _______________________________________________________ H E A D _____________________________________________________________ if (isset($_GET['id'])) { - $app->setbdd($config); + $app->bddinit($config); if ($app->exist($_GET['id'])) { $art = $app->get($_GET['id']); if (!isset($_GET['edit'])) { @@ -206,140 +232,28 @@ if (isset($_GET['message'])) { // ______________________________________________________ B O D Y _______________________________________________________________ -echo ''; -$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 $app->session() >= $app::EDITOR) { - 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 { - if (isset($_POST['action'])) { - if ($_POST['action'] == 'new') { - $art = new Art($_GET); - $art->reset(); - $app->add($art); - header('Location: ?id=' . $_GET['id'] . '&edit=1'); - } - } else { - echo 'This article does not exist yet'; +$aff->nav($app); - if ($app->session() >= $app::EDITOR) { - echo '
'; - } - } - } -} elseif (isset($_GET['tag'])) { - $app->setbdd($config); +if (array_key_exists('id', $_GET)) { + $app->bddinit($config); + include('article.php'); +} elseif (array_key_exists('tag', $_GET)) { + $app->bddinit($config); echo '

' . $_GET['tag'] . '

'; $aff->tag($app->getlister(['id', 'titre', 'intro', 'tag'], 'id'), $_GET['tag'], $app); - -} elseif (isset($_GET['lien'])) { - $app->setbdd($config); +} elseif (array_key_exists('lien', $_GET)) { + $app->bddinit($config); echo '

' . $_GET['lien'] . '

'; $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) { - echo '
'; - echo '

Admin

'; - - - - // $app->tableexist($config->dbname(), 'guigui'); - - $aff->admincss($config, $app); - $aff->adminpassword($config); - $aff->admindb($config); - if ($app->setbdd($config)) { - //var_dump($app->tablelist($config->dbname())); - echo '

database status : OK

'; - } - $aff->admintable($config, $app->tablelist($config->dbname())); - - echo '
'; - } elseif ($_GET['aff'] == 'media') { - echo '

Media

'; - echo '
'; - - $aff->addmedia($app); - $aff->medialist($app); - - echo '
'; - - } elseif ($_GET['aff'] == 'record') { - echo '

Record

'; - echo '
'; - - $aff->recordlist($app); - - echo '
'; - - } elseif ($_GET['aff'] == 'map') { - $app->setbdd($config); - $aff->map($app, $config->domain()); - } else { - header('Location: ./'); - } - +} elseif (array_key_exists('aff', $_GET)) { + include('menu.php'); } else { - - $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; - } - } - - $app->artlistsort($table2, $opt->sortby(), $opt->order()); - - - - $aff->home2table($app, $table2); - - echo '
'; - + include('home.php'); } -echo ''; -?> +?> \ No newline at end of file diff --git a/public/w/menu.php b/public/w/menu.php new file mode 100644 index 0000000..b2495f2 --- /dev/null +++ b/public/w/menu.php @@ -0,0 +1,50 @@ +session() >= $app::EDITOR) { + + if ($_GET['aff'] == 'admin' && $app->session() >= $app::ADMIN) { + echo '
'; + echo '

Admin

'; + + $aff->admincss($config, $app); + $aff->adminpassword($config); + $aff->admindb($config); + if ($app->setbdd($config)) { + //var_dump($app->tablelist($config->dbname())); + echo '

database status : OK

'; + } + $aff->admintable($config, $app->tablelist($config->dbname())); + + echo '
'; + } elseif ($_GET['aff'] == 'media') { + echo '

Media

'; + echo '
'; + + $aff->addmedia($app); + $aff->medialist($app); + + echo '
'; + + } elseif ($_GET['aff'] == 'record') { + echo '

Record

'; + echo '
'; + + $aff->recordlist($app); + + echo '
'; + + } elseif ($_GET['aff'] == 'map') { + $app->bddinit($config); + $aff->map($app, $config->domain()); + } else { + echo '

Private

You dont have the permission to access this page.

'; + + } + + +} else { + echo '

Private

You should be connected to access this page.

'; +} + +?> \ No newline at end of file -- cgit v1.2.3