aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2018-12-05 18:37:30 +0100
committervincent-peugnet <v.peugnet@free.fr>2018-12-05 18:37:30 +0100
commit7fb607b48c181512b31f52a7ef7e302f331ec18d (patch)
treec4d89cba3c0d01679ed1455e0d7c39fa2fdb824c
parentad3aed389f2e0d69802641f5a5b7c6add73f1ce5 (diff)
downloadwcms-7fb607b48c181512b31f52a7ef7e302f331ec18d.tar.gz
wcms-7fb607b48c181512b31f52a7ef7e302f331ec18d.zip
mediastyle
-rw-r--r--app/class/controllerfont.php2
-rw-r--r--app/class/controllerhome.php9
-rw-r--r--app/class/controllerinfo.php25
-rw-r--r--app/class/controllermedia.php6
-rw-r--r--app/class/modelmedia.php40
-rw-r--r--app/class/routes.php4
-rw-r--r--app/view/templates/admin.php2
-rw-r--r--app/view/templates/backtopbar.php21
-rw-r--r--app/view/templates/font.php2
-rw-r--r--app/view/templates/home.php2
-rw-r--r--app/view/templates/info.php25
-rw-r--r--app/view/templates/media.php67
-rw-r--r--assets/css/home.css43
13 files changed, 215 insertions, 33 deletions
diff --git a/app/class/controllerfont.php b/app/class/controllerfont.php
index b1cd0d9..7a59cd6 100644
--- a/app/class/controllerfont.php
+++ b/app/class/controllerfont.php
@@ -14,7 +14,7 @@ class Controllerfont extends Controller
public function desktop()
{
- if($this->user->isadmin()) {
+ if($this->user->iseditor()) {
$fontlist = $this->fontmanager->getfontlist();
diff --git a/app/class/controllerhome.php b/app/class/controllerhome.php
index 4d5feb8..1309adb 100644
--- a/app/class/controllerhome.php
+++ b/app/class/controllerhome.php
@@ -48,6 +48,15 @@ class Controllerhome extends Controller
}
+ public function search()
+ {
+ if(isset($_POST['id']) && !empty($_POST['id'])) {
+ $this->routedirect('artread/', ['art' => $_POST['id']]);
+ } else {
+ $this->routedirect('home');
+ }
+ }
+
diff --git a/app/class/controllerinfo.php b/app/class/controllerinfo.php
new file mode 100644
index 0000000..8f8b494
--- /dev/null
+++ b/app/class/controllerinfo.php
@@ -0,0 +1,25 @@
+<?php
+
+class Controllerinfo extends Controller
+{
+
+ public function __construct($render) {
+ parent::__construct($render);
+
+
+ }
+
+ public function desktop()
+ {
+ if($this->user->iseditor()) {
+ $this->showtemplate('info', []);
+ }
+ }
+
+
+
+
+}
+
+
+?> \ No newline at end of file
diff --git a/app/class/controllermedia.php b/app/class/controllermedia.php
index 48f803b..1fa564b 100644
--- a/app/class/controllermedia.php
+++ b/app/class/controllermedia.php
@@ -14,7 +14,11 @@ class Controllermedia extends Controller
public function desktop()
{
-
+ if($this->user->iseditor()) {
+ $medialist = $this->mediamanager->getlistermedia(Model::MEDIA_DIR);
+ $faviconlist = $this->mediamanager->getlistermedia(Model::FAVICON_DIR);
+ $this->showtemplate('media', ['medialist' => $medialist, 'faviconlist' => $faviconlist]);
+ }
}
public function addmedia()
diff --git a/app/class/modelmedia.php b/app/class/modelmedia.php
index a5c48fe..3402a04 100644
--- a/app/class/modelmedia.php
+++ b/app/class/modelmedia.php
@@ -40,17 +40,20 @@ class Modelmedia extends Model
{
$fileinfo = pathinfo($entry);
- $filepath = $fileinfo['dirname'] . '.' . $fileinfo['extension'];
-
- $donnees = array(
- 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']),
- 'path' => $dir,
- 'extension' => $fileinfo['extension']
- );
-
+ if(isset($fileinfo['extension'])) {
+ $filepath = $fileinfo['dirname'] . '.' . $fileinfo['extension'];
+
+ $datas = array(
+ 'id' => str_replace('.' . $fileinfo['extension'], '', $fileinfo['filename']),
+ 'path' => $dir,
+ 'extension' => $fileinfo['extension']
+ );
+ return new Media($datas);
+ } else {
+ return false;
+ }
- return new Media($donnees);
}
@@ -63,21 +66,24 @@ class Modelmedia extends Model
$media = $this->getmedia($entry, $dir);
-
- $media->analyse();
-
- if (in_array($type, self::MEDIA_TYPES)) {
- if ($media->type() == $type) {
+ if($media != false) {
+
+ $media->analyse();
+
+ if (in_array($type, self::MEDIA_TYPES)) {
+ if ($media->type() == $type) {
+ $list[] = $media;
+ }
+ } else {
$list[] = $media;
}
- } else {
- $list[] = $media;
+
}
+
}
}
- return $list;
}
return $list;
diff --git a/app/class/routes.php b/app/class/routes.php
index 6eb992b..b324e64 100644
--- a/app/class/routes.php
+++ b/app/class/routes.php
@@ -17,10 +17,12 @@ class Routes
['GET|POST', '/', 'Controllerhome#desktop', 'home'],
['POST', '/!co', 'Controllerconnect#log', 'log'],
['GET', '/!co', 'Controllerconnect#connect', 'connect'],
- ['GET', '/!m', 'Controllermedia#desktop', 'media'],
+ ['POST', '/!search', 'Controllerhome#search', 'search'],
+ ['GET', '/!media', 'Controllermedia#desktop', 'media'],
['GET', '/!font', 'Controllerfont#desktop', 'font'],
['POST', '/!admin', 'Controlleradmin#update', 'adminupdate'],
['GET', '/!admin', 'Controlleradmin#desktop', 'admin'],
+ ['GET', '/!info', 'Controllerinfo#desktop', 'info'],
['GET', '/!font/render', 'Controllerfont#render', 'fontrender'],
['POST', '/!font/add', 'Controllerfont#add', 'fontadd'],
['GET', '/[cid:art]/', 'Controllerart#read', 'artread/'],
diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php
index 5edf262..6e8e0ab 100644
--- a/app/view/templates/admin.php
+++ b/app/view/templates/admin.php
@@ -5,7 +5,7 @@
<body>
- <?php $this->insert('backtopbar', ['user' => $user]) ?>
+ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'admin']) ?>
<section class="admin">
diff --git a/app/view/templates/backtopbar.php b/app/view/templates/backtopbar.php
index a06c304..d769993 100644
--- a/app/view/templates/backtopbar.php
+++ b/app/view/templates/backtopbar.php
@@ -1,5 +1,13 @@
<div id="topbar">
+<span id="search">
+<form action="<?= $this->url('search') ?>" method="post">
+<input type="text" name="id" id="id" placeholder="page id" required>
+<input type="submit" value="go">
+</form>
+</span>
+
+
<span id="user">
<?php if($user->isvisitor()) { ?>
@@ -14,7 +22,7 @@
<?php } else { ?>
<span>
-User level : <?= $user->level() ?>
+<?= $user->level() ?>
</span>
@@ -33,17 +41,18 @@ User level : <?= $user->level() ?>
<?php if($user->iseditor()) { ?>
-<span>
-<a href="<?= $this->url('home') ?>">home</a>
+<span id="menu">
+<a href="<?= $this->url('home') ?>" <?= $tab == 'home' ? 'class="actualpage"' : '' ?>>home</a>
+<a href="<?= $this->url('media') ?>" <?= $tab == 'media' ? 'class="actualpage"' : '' ?>>media</a>
+<a href="<?= $this->url('font') ?>" <?= $tab == 'font' ? 'class="actualpage"' : '' ?>>font</a>
<?php
if($user->isadmin()) {
?>
-<a href="<?= $this->url('font') ?>">font</a>
-<a href="<?= $this->url('admin') ?>">admin</a>
+<a href="<?= $this->url('admin') ?>" <?= $tab == 'admin' ? 'class="actualpage"' : '' ?>>admin</a>
<?php
}
?>
-| <i><a href="https://github.com/vincent-peugnet/wcms" target="_blank">github↝</a></i>
+<a href="<?= $this->url('info') ?>" <?= $tab == 'info' ? 'class="actualpage"' : '' ?>>info</a>
</span>
diff --git a/app/view/templates/font.php b/app/view/templates/font.php
index 6e55686..90614a9 100644
--- a/app/view/templates/font.php
+++ b/app/view/templates/font.php
@@ -5,7 +5,7 @@
<body>
- <?php $this->insert('backtopbar', ['user' => $user]) ?>
+ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'font']) ?>
<section class="font">
diff --git a/app/view/templates/home.php b/app/view/templates/home.php
index a83361d..87cdb8d 100644
--- a/app/view/templates/home.php
+++ b/app/view/templates/home.php
@@ -8,7 +8,7 @@
<body>
- <?php $this->insert('backtopbar', ['user' => $user]) ?>
+ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'home']) ?>
<?php if($user->iseditor()) { ?>
diff --git a/app/view/templates/info.php b/app/view/templates/info.php
new file mode 100644
index 0000000..231a114
--- /dev/null
+++ b/app/view/templates/info.php
@@ -0,0 +1,25 @@
+<?php $this->layout('layout', ['title' => 'info', 'css' => $css . 'home.css']) ?>
+
+
+<?php $this->start('page') ?>
+
+<body>
+
+ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'info']) ?>
+
+
+<section class="info">
+
+<h1>Info</h1>
+
+<a href="https://github.com/vincent-peugnet/wcms" target="_blank">πŸ±β€πŸ‘€ Github</a>
+
+<a href="#">πŸ“• Manual</a>
+<a href="#">🌡 Website</a>
+
+<h2>About</h2>
+
+</section>
+</body>
+
+<?php $this->stop('page') ?> \ No newline at end of file
diff --git a/app/view/templates/media.php b/app/view/templates/media.php
index 31e3ad0..043000d 100644
--- a/app/view/templates/media.php
+++ b/app/view/templates/media.php
@@ -1 +1,66 @@
-<?php $this->layout('layout', ['title' => 'Media']) ?>
+<?php $this->layout('layout', ['title' => 'media', 'css' => $css . 'home.css']) ?>
+
+
+<?php $this->start('page') ?>
+
+<body>
+
+ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'media']) ?>
+
+
+<section class="media">
+
+<h1>Media</h1>
+
+<table id="medialist">
+<tr><th>id</th><th>extension</th><th>path</th><th>type</th><th>size</th><th>width</th><th>height</th><th>lengh</th></tr>
+
+<?php
+foreach ($medialist as $media) {
+ ?>
+ <tr>
+ <td><?= $media->id() ?></td>
+ <td><?= $media->extension() ?></td>
+ <td><?= $media->path() ?></td>
+ <td><?= $media->type() ?></td>
+ <td><?= readablesize($media->size()) ?></td>
+ <td><?= $media->width() ?></td>
+ <td><?= $media->height() ?></td>
+ <td><?= $media->length() ?></td>
+ </tr>
+ <?php
+}
+
+
+?>
+
+</table>
+
+<h1>Favicon</h1>
+
+<table id="faviconlist">
+<tr><th>id</th><th>extension</th><th>path</th><th>size</th><th>width</th><th>height</th></tr>
+
+<?php
+foreach ($faviconlist as $favicon) {
+ ?>
+ <tr>
+ <td><?= $favicon->id() ?></td>
+ <td><?= $favicon->extension() ?></td>
+ <td><?= $favicon->path() ?></td>
+ <td><?= readablesize($favicon->size()) ?></td>
+ <td><?= $favicon->width() ?></td>
+ <td><?= $favicon->height() ?></td>
+ </tr>
+ <?php
+}
+
+
+?>
+
+</table>
+
+</section>
+</body>
+
+<?php $this->stop('page') ?> \ No newline at end of file
diff --git a/assets/css/home.css b/assets/css/home.css
index 1032c71..da820dd 100644
--- a/assets/css/home.css
+++ b/assets/css/home.css
@@ -33,11 +33,10 @@ tr:hover {
}
#topbar {
- height: 30px;
background-color: #7b97b9;
- line-height: 30px;
position: fixed;
width: 100%;
+ padding: 3px 0.5%;
}
#topbar form {
@@ -69,11 +68,13 @@ th {
section {
padding-top: 30px;
- margin-left: 4px;
+ margin: 0 0.5%;
}
section.admin input, select, textarea {
display: block;
+ width: 100%;
+ max-width: 400px;
}
section.font input, select, textarea {
@@ -82,4 +83,40 @@ section.font input, select, textarea {
span#user {
float: right;
+}
+
+span#search {
+ float: left;
+}
+
+#topbar span#menu {
+ display: inline-block;
+ margin: 0 1%;
+}
+
+input#id {width: 100px;}
+
+
+section.info a {
+ display: block;
+ width: fit-content;
+}
+
+section.font table#fontlist {
+ width: 100%;
+ max-width: 500px;
+}
+
+section.media table#medialist {
+ width: 100%;
+ max-width: 960px;
+}
+
+#topbar a.actualpage {
+ text-decoration: underline;
+}
+
+section.media table#faviconlist {
+ width: 100%;
+ max-width: 640px;
} \ No newline at end of file