summaryrefslogtreecommitdiffstats
path: root/modules-available/imgmanagement
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-03 19:03:09 +0200
committerSimon Rettberg2016-05-03 19:03:09 +0200
commit50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66 (patch)
tree05e99fdffa696434960d7c77966c0bc36d6339e8 /modules-available/imgmanagement
parentSecond half of merge.... (diff)
downloadslx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.gz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.tar.xz
slx-admin-50404f3b23b7fd6aeae4c9d2f6df0ea25e984e66.zip
WIP
Diffstat (limited to 'modules-available/imgmanagement')
-rw-r--r--modules-available/imgmanagement/config.json4
-rw-r--r--modules-available/imgmanagement/lang/pt/module.json3
-rw-r--r--modules-available/imgmanagement/page.inc.php63
-rw-r--r--modules-available/imgmanagement/templates/page-imgmanagement.html62
4 files changed, 132 insertions, 0 deletions
diff --git a/modules-available/imgmanagement/config.json b/modules-available/imgmanagement/config.json
new file mode 100644
index 00000000..5c5c05ca
--- /dev/null
+++ b/modules-available/imgmanagement/config.json
@@ -0,0 +1,4 @@
+{
+ "enabled":"false",
+ "permission":"1"
+}
diff --git a/modules-available/imgmanagement/lang/pt/module.json b/modules-available/imgmanagement/lang/pt/module.json
new file mode 100644
index 00000000..83b9751a
--- /dev/null
+++ b/modules-available/imgmanagement/lang/pt/module.json
@@ -0,0 +1,3 @@
+{
+ "module_name": "Gerenciamento de Imagens"
+} \ No newline at end of file
diff --git a/modules-available/imgmanagement/page.inc.php b/modules-available/imgmanagement/page.inc.php
new file mode 100644
index 00000000..dc19cb2a
--- /dev/null
+++ b/modules-available/imgmanagement/page.inc.php
@@ -0,0 +1,63 @@
+<?php
+
+class Page_Imgmanagement extends Page
+{
+
+ private $page;
+ private $baselocation;
+ private $images;
+
+ protected function doPreprocess()
+ {
+
+ User::load();
+ if (!User::hasPermission('baseconfig_local')) {
+ Message::addError('no-permission');
+ Util::redirect('?do=Main');
+ }
+
+ error_reporting(E_ALL);
+ ini_set('display_errors','on');
+
+ Session::get('token');
+
+ }
+
+ protected function doRender()
+ {
+ error_reporting(E_ALL);
+ ini_set('display_errors','on');
+
+ $actives = array();
+ $deactives = array();
+
+ $res = Database::simpleQuery("SELECT id, name, path, userid, is_template, is_active, description FROM images ORDER BY id DESC");
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if($row['is_active'])
+ $actives[] = array(
+ 'id' => $row['id'],
+ 'name' => $row['name'],
+ 'path' => $row['path'],
+ 'userid' => $row['userid'],
+ 'is_template' => $row['is_template'],
+ 'is_active' => $row['is_active'],
+ 'description' => $row['description']
+ );
+ else
+ $deactives[] = array(
+ 'id' => $row['id'],
+ 'name' => $row['name'],
+ 'path' => $row['path'],
+ 'userid' => $row['userid'],
+ 'is_template' => $row['is_template'],
+ 'is_active' => $row['is_active'],
+ 'description' => $row['description']
+ );
+
+ }
+
+ Render::addTemplate('page-imgmanagement', array(
+ 'deactives' => $deactives,
+ 'actives' => $actives));
+ }
+}
diff --git a/modules-available/imgmanagement/templates/page-imgmanagement.html b/modules-available/imgmanagement/templates/page-imgmanagement.html
new file mode 100644
index 00000000..cdae627b
--- /dev/null
+++ b/modules-available/imgmanagement/templates/page-imgmanagement.html
@@ -0,0 +1,62 @@
+<div class="panel panel-default">
+ <div class="panel-heading">
+ Gerenciamento de Imagens
+ </div>
+
+ <div class="panel-body">
+ <div class="alert alert-info">
+ Imagens em azul indicam imagens criadas pelo usuário
+ </div>
+
+ <div class="panel-body col-xs-6">
+ <div class="left">
+ <ul class="source connected">
+ {{#deactives}}
+ <li>{{name}}</li>
+ {{/deactives}}
+ </ul>
+ </div>
+ </div>
+
+ <div class="panel-body col-xs-6">
+ <div class="right">
+ <ul class="target connected" id="ativa1">
+
+ {{#actives}}
+ <li>{{name}}</li>
+ {{/actives}}
+ </ul>
+ </div>
+ </div>
+
+ <div class="panel-body text-center">
+ <input type='button' value='<<' id='move_left' />
+ <input type='button' value='>>' id='move_right' />
+ <a class="btn btn-default" href="#" role="button">Upload de Nova Imagem<a>
+ <a class="btn btn-info" href="#" role="button">Gerar IPXE<a>
+ <a class="btn btn-info" href="#" role="button">Salvar<a>
+ </div>
+
+ </div>
+</div>
+
+<script src="script/jquery.sortable.min.js"></script>
+<script type="text/javascript">
+ $(document).ready(function() {
+ $(".source, .target").sortable({
+ connectWith: ".connected"
+ });
+
+ });
+ $('body').on('click', 'li', function() {
+ $(this).toggleClass('selected');
+ });
+
+ $('#move_left').click(function() {
+ $('.source').append($('.target .selected').removeClass('selected'));
+ });
+
+ $('#move_right').click(function() {
+ $('.target').append($('.source .selected').removeClass('selected'));
+ });
+</script>