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/view | |
parent | 8e10d770c74acdbb5795e8fc73fd220b900d75aa (diff) | |
parent | 49273cba81ea86639a23dfd5a43bda2f6b01f075 (diff) | |
download | wcms-526dc66454a56ea4ccb0ed220e498bf6611cc666.tar.gz wcms-526dc66454a56ea4ccb0ed220e498bf6611cc666.zip |
Merge branch 'implement-better-ui'
Diffstat (limited to 'app/view')
-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 |
3 files changed, 146 insertions, 163 deletions
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 |