diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-01-20 01:58:42 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-01-20 01:58:42 +0100 |
commit | 526dc66454a56ea4ccb0ed220e498bf6611cc666 (patch) | |
tree | 49acf50c0c007e37224b73f8db01b0761f0c7aee /app | |
parent | 8e10d770c74acdbb5795e8fc73fd220b900d75aa (diff) | |
parent | 49273cba81ea86639a23dfd5a43bda2f6b01f075 (diff) | |
download | wcms-526dc66454a56ea4ccb0ed220e498bf6611cc666.tar.gz wcms-526dc66454a56ea4ccb0ed220e498bf6611cc666.zip |
Merge branch 'implement-better-ui'
Diffstat (limited to 'app')
-rw-r--r-- | app/class/Controller.php | 2 | ||||
-rw-r--r-- | app/class/Controllermedia.php | 21 | ||||
-rw-r--r-- | app/class/Medialist.php | 119 | ||||
-rw-r--r-- | app/class/Model.php | 4 | ||||
-rw-r--r-- | app/class/Modelmedia.php | 50 | ||||
-rw-r--r-- | app/class/Modelrender.php | 7 | ||||
-rw-r--r-- | app/fn/fn.php | 24 | ||||
-rw-r--r-- | app/view/templates/media.php | 175 | ||||
-rw-r--r-- | app/view/templates/mediamenu.php | 80 | ||||
-rw-r--r-- | app/view/templates/navback.php | 54 |
10 files changed, 308 insertions, 228 deletions
diff --git a/app/class/Controller.php b/app/class/Controller.php index 32ffc13..c3787b2 100644 --- a/app/class/Controller.php +++ b/app/class/Controller.php @@ -10,7 +10,7 @@ class Controller /** @var User */ protected $user; - /** @var Routes */ + /** @var \AltoRouter */ protected $router; /** @var Modeluser */ diff --git a/app/class/Controllermedia.php b/app/class/Controllermedia.php index 5958289..3e323f5 100644 --- a/app/class/Controllermedia.php +++ b/app/class/Controllermedia.php @@ -33,25 +33,18 @@ class Controllermedia extends Controller throw new Exception("Media error : Cant create /media/thumbnail folder"); } + $mediaopt = new Medialist($_GET); - $dir = rtrim($_GET['path'] ?? Model::MEDIA_DIR, DIRECTORY_SEPARATOR); - $sortby = isset($_GET['sortby']) ? $_GET['sortby'] : 'id'; - $order = isset($_GET['order']) ? $_GET['order'] : '1'; - $opt = ['dir' => $dir, 'sortby' => $sortby, 'order' => $order]; - - if(is_dir($dir)) { - $medialist = $this->mediamanager->getlistermedia($dir . DIRECTORY_SEPARATOR); - $faviconlist = $this->mediamanager->getlistermedia(Model::FAVICON_DIR); + if(is_dir($mediaopt->dir())) { + $medialist = $this->mediamanager->medialistopt($mediaopt); $dirlist = $this->mediamanager->listdir(Model::MEDIA_DIR); $pathlist = []; - $this->mediamanager->listpath($dirlist, '', $pathlist); - $this->mediamanager->medialistsort($medialist, $sortby, $order); - $this->showtemplate('media', ['medialist' => $medialist, 'faviconlist' => $faviconlist, 'dirlist' => $dirlist, 'pathlist' =>$pathlist, 'dir' => $dir, 'opt' => $opt]); + $this->showtemplate('media', ['medialist' => $medialist, 'dirlist' => $dirlist, 'pathlist' =>$pathlist, 'mediaopt' => $mediaopt]); } else { $this->routedirect('media'); } @@ -68,7 +61,7 @@ class Controllermedia extends Controller if (!empty($_FILES['file']['name'][0])) { $this->mediamanager->multiupload('file', $target); } - $this->redirect($this->router->generate('media') . '?path=' . $target); + $this->redirect($this->router->generate('media') . '?path=/' . $target); } else { $this->routedirect('home'); } @@ -81,7 +74,7 @@ class Controllermedia extends Controller $name = idclean($_POST['foldername']) ?? 'new-folder'; $this->mediamanager->adddir($dir, $name); } - $this->redirect($this->router->generate('media') . '?path=' . $dir . DIRECTORY_SEPARATOR . $name); + $this->redirect($this->router->generate('media') . '?path=/' . $dir . DIRECTORY_SEPARATOR . $name); } @@ -91,7 +84,7 @@ class Controllermedia extends Controller if(isset($_POST['deletefolder']) && intval($_POST['deletefolder']) && $this->user->issupereditor()) { $this->mediamanager->deletedir($_POST['dir']); } else { - $this->redirect($this->router->generate('media') . '?path=' . $_POST['dir']); + $this->redirect($this->router->generate('media') . '?path=/' . $_POST['dir']); exit; } } diff --git a/app/class/Medialist.php b/app/class/Medialist.php index da5ba4f..b208fef 100644 --- a/app/class/Medialist.php +++ b/app/class/Medialist.php @@ -7,8 +7,8 @@ class Medialist /** @var string full regex match */ protected $fullmatch; - /** @var string options */ - protected $options = ''; + /** @var string full filter code line */ + protected $filter = ''; /** @var string directory of media */ protected $path = ''; @@ -19,16 +19,20 @@ class Medialist /** @var int */ protected $order = 1; + /** @var array list of media type to display */ + protected $type = ['image', 'sound', 'video', 'other']; + /** @var int display media contents*/ protected $display = 1; /** @var int display download links*/ protected $links = 0; - /** @var string ouput html code generated*/ - protected $content = ''; + /** @var string display the file name of the file */ + protected $filename = 0; - const SORT_BY_OPTIONS = ['id', 'size', 'type']; + const SORT_BY_FILTER = ['id', 'size', 'type']; + const TYPES = ['image', 'sound', 'video', 'other']; @@ -39,8 +43,6 @@ class Medialist public function __construct(array $datas = []) { $this->hydrate($datas); - $this->readoptions(); - $this->generatecontent(); } public function hydrate($datas) @@ -54,16 +56,16 @@ class Medialist } } - public function readoptions() + public function readfilter() { - parse_str($this->options, $datas); + parse_str($this->filter, $datas); $this->hydrate($datas); } public function generatecontent() { $mediamanager = new Modelmedia(); - $medialist = $mediamanager->getlistermedia(Model::MEDIA_DIR . $this->path . '/'); + $medialist = $mediamanager->getlistermedia($this->dir(), $this->type); if (!$medialist) { $this->content = '<strong>RENDERING ERROR :</strong> path : <code>' . Model::MEDIA_DIR . $this->path . '/</code> does not exist'; return false; @@ -91,10 +93,50 @@ class Medialist $div .= '</div>' . PHP_EOL; - $this->content = $div; + return $div; + } + } - return true; + /** + * Generate link adress for table header + * + * @param string $sortby + * @return string link adress + */ + public function getsortbyadress(string $sortby) : string + { + if(!in_array($sortby, self::SORT_BY_FILTER)) { + $sortby = 'id'; } + if ($this->sortby === $sortby) { + $order = $this->order * -1; + } else { + $order = $this->order; + } + $query = ['path' => $this->path, 'sortby' => $sortby, 'order' => $order]; + if(array_diff( self::TYPES, $this->type) != []) { + $query['type'] = $this->type; + } + return '?' . urldecode(http_build_query($query)); + + } + + public function getpathadress(string $path) : string + { + $query = ['path' => '/' . $path, 'sortby' => $this->sortby, 'order' => $this->order]; + if(array_diff( self::TYPES, $this->type) != []) { + $query['type'] = $this->type; + } + return '?' . urldecode(http_build_query($query)); + } + + public function getquery() + { + $query = ['path' => $this->path, 'sortby' => $this->sortby, 'order' => $this->order]; + if(array_diff( self::TYPES, $this->type) != []) { + $query['type'] = $this->type; + } + return '%MEDIA?' . urldecode(http_build_query($query)). '%'; } @@ -106,17 +148,41 @@ class Medialist return $this->fullmatch; } - public function options() + public function filter() { - return $this->options; + return $this->filter; } - public function content() + /** + * @return string formated like `/media/<folder>` + */ + public function path() { - return $this->content; + return $this->path; } + /** + * @return string formated like `media/<folder>/` + */ + public function dir() + { + return ltrim($this->path, '/') . '/'; + } + + public function sortby() + { + return $this->sortby; + } + + public function order() + { + return $this->order; + } + public function type() + { + return $this->type; + } // __________________________________________________ S E T ____________________________________________________________ @@ -127,21 +193,25 @@ class Medialist } - public function setoptions(string $options) + public function setfilter(string $filter) { - if (!empty($options)) { - $this->options = $options; + if (!empty($filter)) { + $this->filter = $filter; } } public function setpath(string $path) { - $this->path = $path; + if(preg_match('%^\/' . rtrim(Model::MEDIA_DIR, DIRECTORY_SEPARATOR) . '%', $path)) { + $this->path = rtrim($path, DIRECTORY_SEPARATOR); + } elseif (!preg_match('%^\/%', $path)) { + $this->path = '/' . Model::MEDIA_DIR . rtrim($path, DIRECTORY_SEPARATOR); + } } public function setsortby(string $sortby) { - if (in_array($sortby, self::SORT_BY_OPTIONS)) { + if (in_array($sortby, self::SORT_BY_FILTER)) { $this->sortby = $sortby; } } @@ -152,4 +222,11 @@ class Medialist $this->order = $order; } } + + public function settype($type) + { + if(is_array($type)) { + $this->type = array_intersect(self::TYPES, array_unique($type)); + } + } } diff --git a/app/class/Model.php b/app/class/Model.php index 81ad626..bb07fea 100644 --- a/app/class/Model.php +++ b/app/class/Model.php @@ -11,8 +11,8 @@ abstract class Model const ICONS_DIR = 'assets' . DIRECTORY_SEPARATOR .'icons' . DIRECTORY_SEPARATOR; const FONT_DIR = 'fonts' . DIRECTORY_SEPARATOR; const MEDIA_DIR = 'media' . DIRECTORY_SEPARATOR; - const FAVICON_DIR = 'media' . DIRECTORY_SEPARATOR . 'favicon' . DIRECTORY_SEPARATOR; - const THUMBNAIL_DIR = 'media' . DIRECTORY_SEPARATOR . 'thumbnail' . DIRECTORY_SEPARATOR; + const FAVICON_DIR = self::MEDIA_DIR . 'favicon' . DIRECTORY_SEPARATOR; + const THUMBNAIL_DIR = self::MEDIA_DIR . 'thumbnail' . DIRECTORY_SEPARATOR; const TEMPLATES_DIR = '.'. DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; const RENDER_DIR = 'assets'. DIRECTORY_SEPARATOR . 'render' . DIRECTORY_SEPARATOR; const HTML_RENDER_DIR = 'render' . DIRECTORY_SEPARATOR; diff --git a/app/class/Modelmedia.php b/app/class/Modelmedia.php index 6ac647f..d1da829 100644 --- a/app/class/Modelmedia.php +++ b/app/class/Modelmedia.php @@ -33,16 +33,23 @@ class Modelmedia extends Model } } + public function medialistopt(Medialist $mediaopt) + { + $medialist = $this->getlistermedia($mediaopt->dir(), $mediaopt->type()); + $this->medialistsort($medialist, $mediaopt->sortby(), $mediaopt->order()); + + return $medialist; + } + /** * Display a list of media * * @param string $path - * @param string $sortby - * @param string $order + * @param array $type * * @return array of Media objects */ - public function getlistermedia($dir, $type = "all") + public function getlistermedia($dir, $type = Model::MEDIA_TYPES) { if (is_dir($dir)) { if ($handle = opendir($dir)) { @@ -56,11 +63,7 @@ class Modelmedia extends Model $media->analyse(); - if (in_array($type, self::MEDIA_TYPES)) { - if ($media->type() == $type) { - $list[] = $media; - } - } else { + if (in_array($media->type(), $type)) { $list[] = $media; } } @@ -74,22 +77,6 @@ class Modelmedia extends Model } - - public function mediacompare($media1, $media2, $method = 'id', $order = 1) - { - $result = ($media1->$method() <=> $media2->$method()); - return $result * $order; - } - - public function buildsorter($sortby, $order) - { - return function ($media1, $media2) use ($sortby, $order) { - $result = $this->mediacompare($media1, $media2, $sortby, $order); - return $result; - }; - } - - /** * Sort an array of media * @@ -103,6 +90,21 @@ class Modelmedia extends Model $order = ($order === 1 || $order === -1) ? $order : 1; return usort($medialist, $this->buildsorter($sortby, $order)); } + + public function buildsorter($sortby, $order) + { + return function ($media1, $media2) use ($sortby, $order) { + $result = $this->mediacompare($media1, $media2, $sortby, $order); + return $result; + }; + } + + public function mediacompare($media1, $media2, $method = 'id', $order = 1) + { + $result = ($media1->$method() <=> $media2->$method()); + return $result * $order; + } + diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index 778b327..593a420 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -437,16 +437,17 @@ class Modelrender extends Modelpage */ public function automedialist(string $text) { - preg_match_all('~\%MEDIA\?([a-zA-Z0-9\&=\-\/\%]*)\%~', $text, $out); + preg_match_all('~\%MEDIA\?([a-zA-Z0-9\[\]\&=\-\/\%]*)\%~', $text, $out); foreach ($out[0] as $key => $match) { - $matches[$key] = ['fullmatch' => $match, 'options' => $out[1][$key]]; + $matches[$key] = ['fullmatch' => $match, 'filter' => $out[1][$key]]; } if(isset($matches)) { foreach ($matches as $match) { $medialist = new Medialist($match); - $text = str_replace($medialist->fullmatch(), $medialist->content(), $text); + $medialist->readfilter(); + $text = str_replace($medialist->fullmatch(), $medialist->generatecontent(), $text); } } return $text; diff --git a/app/fn/fn.php b/app/fn/fn.php index ccccfb9..583227a 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -1,5 +1,7 @@ <?php +use Wcms\Medialist; + function readablesize($bytes) { $format = ' %d %s'; @@ -207,6 +209,28 @@ function array_diff_assoc_recursive($array1, $array2) { } +/** + * Generate a folder tree based on reccurive array + */ +function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir, Medialist $mediaopt) +{ + if ($path . '/' === $currentdir) { + $folder = '├─📂<span id="currentdir">' . $dirname . '<span>'; + } else { + $folder = '├─📁' . $dirname; + } + echo '<tr>'; + echo '<td><a href="' . $mediaopt->getpathadress($path) . '">' . str_repeat(' ', $deepness) . $folder . '</a></td>'; + echo '<td>' . $dir['dirfilecount'] . '</td>'; + echo '</tr>'; + foreach ($dir as $key => $value) { + if (is_array($value)) { + treecount($value, $key, $deepness + 1, $path . DIRECTORY_SEPARATOR . $key, $currentdir, $mediaopt); + } + } +} + + diff --git a/app/view/templates/media.php b/app/view/templates/media.php index be1ac7f..12d4a2f 100644 --- a/app/view/templates/media.php +++ b/app/view/templates/media.php @@ -7,122 +7,81 @@ <?php $this->insert('backtopbar', ['user' => $user, 'tab' => 'media', 'pagelist' => $pagelist]) ?> + <?php $this->insert('mediamenu', ['user' => $user, 'pathlist' => $pathlist, 'mediaopt' => $mediaopt]) ?> <main class="media"> -<div id="tree"> -<h2>Explorer</h2> - - -<table id="dirlsit"> -<tr><th>folder</th><th>files</th></tr> - -<?php - -function treecount(array $dir, string $dirname, int $deepness, string $path, string $currentdir, array $opt) -{ - if ($path === $currentdir) { - $folder = '├─📂<strong>' . $dirname . '<strong>'; - } else { - $folder = '├─📁' . $dirname; - } - echo '<tr>'; - echo '<td><a href="?path=' . $path . '&sortby=' . $opt['sortby'] . '&order=' . $opt['order'] . '">' . str_repeat(' ', $deepness) . $folder . '</a></td>'; - echo '<td>' . $dir['dirfilecount'] . '</td>'; - echo '</tr>'; - foreach ($dir as $key => $value) { - if (is_array($value)) { - treecount($value, $key, $deepness + 1, $path . DIRECTORY_SEPARATOR . $key, $currentdir, $opt); - } - } -} - -treecount($dirlist, 'media', 0, 'media', $dir, $opt); - -?> - - - -</table> -</div> - - -<div id="explorer"> - - -<h2><?= $dir ?></h2> - - -<details> - <summary>Print this content on your page</summary> - - <p> - <code>%MEDIA?path=<?= substr($dir, 6) ?>&sortby=<?= $opt['sortby'] ?>&order=<?= $opt['order'] ?>%</code> - </p> - -</details> - - - -<form id="folderadd" action="<?= $this->url('mediafolderadd') ?>" method="post"> - <label for="foldername">📂 New folder</label> - <input type="text" name="foldername" id="foldername" placeholder="folder name" required> - <input type="hidden" name="dir" value="<?= $dir ?>"> - <input type="submit" value="create folder"> -</form> - -<?php if($user->issupereditor()) { ?> - -<form action="<?= $this->url('mediafolderdelete') ?>" id="deletefolder" method="post" class="hidephone"> - <input type="hidden" name="dir" value="<?= $dir ?>/"> - <input type="checkbox" name="deletefolder" id="confirmdeletefolder" value="1"> - <label for="confirmdeletefolder">Delete folder and all it's content</label> - <input type="submit" value="delete folder" > -</form> - - -<?php } ?> - -<form id=addmedia action="<?= $this->url('mediaupload') ?>" method="post" enctype="multipart/form-data"> - <label for="file">🚀 Upload file(s)</label> - <input type='file' id="file" name='file[]' multiple required> - <input type="hidden" name="dir" value="<?= $dir ?>"> - <input type="submit" value="upload"> -</form> - - - -<?php if($user->issupereditor()) { ?> - -<form action="<?= $this->url('mediaedit') ?>" method="post" id="mediaedit"> - <input type="hidden" name="path" value="<?= $dir ?>"> - <label for="moveto">Selected medias :</label> - <select name="dir" id="moveto" > - <option selected>---select destination---</option> - <option value="<?= Wcms\Model::MEDIA_DIR ?>">/</option> - <?php - foreach ($pathlist as $path) { - echo '<option value="' . Wcms\Model::MEDIA_DIR . $path . '">' . $path . '</option>'; - } - ?> - </select> - <input type="submit" name="action" value="move" > - <input type="submit" name="action" value="delete" > -</form> - -<?php } ?> - +<nav class="media"> + <div class="block"> + <h2>Explorer</h2> + <div class="scroll"> + <table id="dirlsit"> + <tr><th>folder</th><th>files</th></tr> + + <?php + + + treecount($dirlist, 'media', 0, 'media', $mediaopt->dir(), $mediaopt); + + ?> + + </table> + </div> + + </div> +</nav> + +<div id="fildter"> + <div class="block"> + <h2>filter</h2> + <div class="scroll"> + <form action="" method="get"> + <fieldset> + <legend>Type</legend> + <ul> + <li><input type="checkbox" name="type[]" id="image" value="image" <?= in_array('image', $mediaopt->type()) ? 'checked' : '' ?>><label for="image">image</label></li> + <li><input type="checkbox" name="type[]" id="sound" value="sound" <?= in_array('sound', $mediaopt->type()) ? 'checked' : '' ?>><label for="sound">sound</label></li> + <li><input type="checkbox" name="type[]" id="video" value="video" <?= in_array('video', $mediaopt->type()) ? 'checked' : '' ?>><label for="video">video</label></li> + <li><input type="checkbox" name="type[]" id="other" value="other" <?= in_array('other', $mediaopt->type()) ? 'checked' : '' ?>><label for="other">other</label></li> + </ul> + </fieldset> + <fieldset> + <legend>Sort</legend> + <select name="sortby" id="sortby"> + <option value="id" <?= $mediaopt->sortby() === 'id' ? 'selected' : '' ?>>id</option> + <option value="type" <?= $mediaopt->sortby() === 'type' ? 'selected' : '' ?>>type</option> + <option value="size" <?= $mediaopt->sortby() === 'size' ? 'selected' : '' ?>>size</option> + </select> + </br> + <input type="radio" name="order" id="asc" value="1" <?= $mediaopt->order() == 1 ? 'checked' : '' ?>><label for="asc">ascending</label> + </br> + <input type="radio" name="order" id="desc" value="-1" <?= $mediaopt->order() == -1 ? 'checked' : '' ?>><label for="desc">descending</label> + </br> + </fieldset> + <input type="hidden" name="path" value="<?= $mediaopt->path() ?>"> + <input type="submit" value="filter"> + </form> + </div> + </div> + </div> + + + +<section> + <div class="block"> + +<h2>/<?= $mediaopt->dir() ?></h2> <table id="medialist"> <tr> <th>x</th> - <th><a href="?path=<?= $dir ?>&sortby=id&order=<?php echo ($opt['order'] * -1); ?>">id</a></th> + <th><a href="<?= $mediaopt->getsortbyadress('id') ?>">id</a></th> <th>ext</th> - <th><a href="?path=<?= $dir ?>&sortby=type&order=<?php echo ($opt['order'] * -1); ?>">type</a></th> - <th><a href="?path=<?= $dir ?>&sortby=size&order=<?php echo ($opt['order'] * -1); ?>">size</a></th> + <th><a href="<?= $mediaopt->getsortbyadress('type') ?>">type</a></th> + <th><a href="<?= $mediaopt->getsortbyadress('size') ?>">size</a></th> <th>width</th> <th>height</th> <th>lengh</th> @@ -136,7 +95,7 @@ foreach ($medialist as $media) { <td><input type="checkbox" name="id[]" value="<?= $media->getfulldir() ?>" form="mediaedit" id="media_<?= $media->id() ?>"></td> <td><label for="media_<?= $media->id() ?>"><?= $media->id() ?></label></td> <td><?= $media->extension() ?></td> - <td><a href="<?= $media->getfullpath() ?>" target="_blank"><?= $media->type() == 'image' ? '<span class="thumbnail">image 👁<img src="' . $media->getfullpath() . '"></span>' : $media->type() ?></a></td> + <td><a href="<?= $media->getfullpath() ?>" target="_blank"><?= $media->type() == 'image' ? '<span class="thumbnail">image 👁<img src="' . $media->getfullpath() . '"></span>' : $media->type() . '⧉' ?></a></td> <td><?= $media->size('hr') ?></td> <td><?= $media->width() ?></td> <td><?= $media->height() ?></td> @@ -144,15 +103,13 @@ foreach ($medialist as $media) { <td class="code"><code><?= $media->getcode() ?></code></td> </tr> <?php - } - - ?> </table> </div> +</section> </main> </body> diff --git a/app/view/templates/mediamenu.php b/app/view/templates/mediamenu.php new file mode 100644 index 0000000..560025a --- /dev/null +++ b/app/view/templates/mediamenu.php @@ -0,0 +1,80 @@ +<aside class="media hidephone"> + + <details> + <summary>File</summary> + <div class="submenu"> + <h2>Upload File(s)</h2> + <form id=addmedia action="<?= $this->url('mediaupload') ?>" method="post" enctype="multipart/form-data"> + <label for="file">🚀 Upload file(s)</label> + <input type='file' id="file" name='file[]' multiple required> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>"> + <input type="submit" value="upload"> + </form> + <h2>Folder</h2> + <form id="folderadd" action="<?= $this->url('mediafolderadd') ?>" method="post"> + <label for="foldername">📂 New folder</label> + <input type="text" name="foldername" id="foldername" placeholder="folder name" required> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>"> + <input type="submit" value="create folder"> + </form> + </div> + </details> + + + <details> + <summary>Edit</summary> + <div class="submenu"> + + <?php if($user->issupereditor()) { ?> + + <h2>Folder</h2> + <form action="<?= $this->url('mediafolderdelete') ?>" id="deletefolder" method="post" class="hidephone"> + <input type="hidden" name="dir" value="<?= $mediaopt->dir() ?>/"> + <input type="checkbox" name="deletefolder" id="confirmdeletefolder" value="1"> + <label for="confirmdeletefolder">Delete actual folder and all it's content</label> + </br> + <input type="submit" value="delete folder" > + </form> + + + <h2>Move</h2> + <form action="<?= $this->url('mediaedit') ?>" method="post" id="mediaedit"> + <input type="hidden" name="path" value="<?= $mediaopt->dir() ?>"> + <label for="moveto">Move selected medias to a new directory</label> + </br> + <select name="dir" id="moveto" > + <option selected>---select destination---</option> + <option value="<?= Wcms\Model::MEDIA_DIR ?>">/</option> + <?php + foreach ($pathlist as $path) { + echo '<option value="' . Wcms\Model::MEDIA_DIR . $path . '">' . $path . '</option>'; + } + ?> + </select> + <input type="submit" name="action" value="move" > + <h2>Delete</h2> + Delete selected medias + </br> + <input type="submit" name="action" value="delete" > + </form> + + + + <?php } ?> + </div> + </details> + + + <details> + <summary>Filter</summary> + <div class="submenu"> + <h2>Print folder content</h2> + + + + <p>Use this code to print the content of the actual folder in a page</p> + <code><?= $mediaopt->getquery() ?></code> + </div> + </details> + +</aside>
\ No newline at end of file diff --git a/app/view/templates/navback.php b/app/view/templates/navback.php deleted file mode 100644 index 8218897..0000000 --- a/app/view/templates/navback.php +++ /dev/null @@ -1,54 +0,0 @@ -<div class="menu"> - <?= $user->level() ?> - <div id="dropmenu"> - - <ul> - - <li> - <a class="button" href="./">home</a> - </li> - - -<?php if($user->isvisitor()) { ?> - - <li> - <form action="?action=login" method="post"> - <input type="password" name="pass" id="loginpass" placeholder="password"> - <input type="submit" value="login"> - </form> - </li> - -<?php } else { ?> - - <li> - <form action="?action=logout" method="post"> - <input type="submit" value="logout"> - </form> - </li> - -<?php } ?> - - - - -<?php if ($user->iseditor()) { ?> - - <li> - <a class="button" href="?aff=media" >Media</a> - </li> - -<?php } ?> - -<?php if($user->isadmin()) { ?> - - <li> - <a class="button" href="?aff=admin" >Admin</a> - </li> - -<?php } ?> - - - </ul> - - </div> -</div>
\ No newline at end of file |