Debut travail avec jstree
This commit is contained in:
@@ -1,146 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>jstree basic demos</title>
|
||||
<style>
|
||||
html { margin:0; padding:0; font-size:62.5%; }
|
||||
body { max-width:800px; min-width:300px; margin:0 auto; padding:20px 10px; font-size:14px; font-size:1.4em; }
|
||||
h1 { font-size:1.8em; }
|
||||
.demo { overflow:auto; border:1px solid silver; min-height:100px; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="./../../dist/themes/default/style.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>HTML demo</h1>
|
||||
<div id="html" class="demo">
|
||||
<ul>
|
||||
<li data-jstree='{ "opened" : true }'>Root node
|
||||
<ul>
|
||||
<li data-jstree='{ "selected" : true }'>Child node 1</li>
|
||||
<li>Child node 2</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h1>Inline data demo</h1>
|
||||
<div id="data" class="demo"></div>
|
||||
|
||||
<h1>Data format demo</h1>
|
||||
<div id="frmt" class="demo"></div>
|
||||
|
||||
<h1>AJAX demo</h1>
|
||||
<div id="ajax" class="demo"></div>
|
||||
|
||||
<h1>Lazy loading demo</h1>
|
||||
<div id="lazy" class="demo"></div>
|
||||
|
||||
<h1>Callback function data demo</h1>
|
||||
<div id="clbk" class="demo"></div>
|
||||
|
||||
<h1>Interaction and events demo</h1>
|
||||
<button id="evts_button">select node with id 1</button> <em>either click the button or a node in the tree</em>
|
||||
<div id="evts" class="demo"></div>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script src="./../../dist/jstree.min.js"></script>
|
||||
|
||||
<script>
|
||||
// html demo
|
||||
$('#html').jstree();
|
||||
|
||||
// inline data demo
|
||||
$('#data').jstree({
|
||||
'core' : {
|
||||
'data' : [
|
||||
{ "text" : "Root node", "children" : [
|
||||
{ "text" : "Child node 1" },
|
||||
{ "text" : "Child node 2" }
|
||||
]}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// data format demo
|
||||
$('#frmt').jstree({
|
||||
'core' : {
|
||||
'data' : [
|
||||
{
|
||||
"text" : "Root node",
|
||||
"state" : { "opened" : true },
|
||||
"children" : [
|
||||
{
|
||||
"text" : "Child node 1",
|
||||
"state" : { "selected" : true },
|
||||
"icon" : "jstree-file"
|
||||
},
|
||||
{ "text" : "Child node 2", "state" : { "disabled" : true } }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
// ajax demo
|
||||
$('#ajax').jstree({
|
||||
'core' : {
|
||||
'data' : {
|
||||
"url" : "./root.json",
|
||||
"dataType" : "json" // needed only if you do not supply JSON headers
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// lazy demo
|
||||
$('#lazy').jstree({
|
||||
'core' : {
|
||||
'data' : {
|
||||
"url" : "//www.jstree.com/fiddle/?lazy",
|
||||
"data" : function (node) {
|
||||
return { "id" : node.id };
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// data from callback
|
||||
$('#clbk').jstree({
|
||||
'core' : {
|
||||
'data' : function (node, cb) {
|
||||
if(node.id === "#") {
|
||||
cb([{"text" : "Root", "id" : "1", "children" : true}]);
|
||||
}
|
||||
else {
|
||||
cb(["Child"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// interaction and events
|
||||
$('#evts_button').on("click", function () {
|
||||
var instance = $('#evts').jstree(true);
|
||||
instance.deselect_all();
|
||||
instance.select_node('1');
|
||||
});
|
||||
$('#evts')
|
||||
.on("changed.jstree", function (e, data) {
|
||||
if(data.selected.length) {
|
||||
alert('The selected node is: ' + data.instance.get_node(data.selected[0]).text);
|
||||
}
|
||||
})
|
||||
.jstree({
|
||||
'core' : {
|
||||
'multiple' : false,
|
||||
'data' : [
|
||||
{ "text" : "Root node", "children" : [
|
||||
{ "text" : "Child node 1", "id" : 1 },
|
||||
{ "text" : "Child node 2" }
|
||||
]}
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
[{"id":1,"text":"Root node","children":[{"id":2,"text":"Child node 1"},{"id":3,"text":"Child node 2"}]}]
|
||||
@@ -1 +0,0 @@
|
||||
deny from all
|
||||
@@ -1 +0,0 @@
|
||||
Conteneur
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB |
@@ -1,450 +0,0 @@
|
||||
<?php
|
||||
ini_set('open_basedir', dirname(__FILE__) . DIRECTORY_SEPARATOR);
|
||||
|
||||
class fs
|
||||
{
|
||||
protected $base = null;
|
||||
|
||||
protected function real($path) {
|
||||
$temp = realpath($path);
|
||||
if(!$temp) { throw new Exception('Path does not exist: ' . $path); }
|
||||
if($this->base && strlen($this->base)) {
|
||||
if(strpos($temp, $this->base) !== 0) { throw new Exception('Path is not inside base ('.$this->base.'): ' . $temp); }
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
protected function path($id) {
|
||||
$id = str_replace('/', DIRECTORY_SEPARATOR, $id);
|
||||
$id = trim($id, DIRECTORY_SEPARATOR);
|
||||
$id = $this->real($this->base . DIRECTORY_SEPARATOR . $id);
|
||||
return $id;
|
||||
}
|
||||
protected function id($path) {
|
||||
$path = $this->real($path);
|
||||
$path = substr($path, strlen($this->base));
|
||||
$path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
|
||||
$path = trim($path, '/');
|
||||
return strlen($path) ? $path : '/';
|
||||
}
|
||||
|
||||
public function __construct($base) {
|
||||
$this->base = $this->real($base);
|
||||
if(!$this->base) { throw new Exception('Base directory does not exist'); }
|
||||
}
|
||||
public function lst($id, $with_root = false) {
|
||||
$dir = $this->path($id);
|
||||
$lst = @scandir($dir);
|
||||
if(!$lst) { throw new Exception('Could not list path: ' . $dir); }
|
||||
$res = array();
|
||||
foreach($lst as $item) {
|
||||
if($item == '.' || $item == '..' || $item === null) { continue; }
|
||||
$tmp = preg_match('([^ a-zа-я-_0-9.]+)ui', $item);
|
||||
if($tmp === false || $tmp === 1) { continue; }
|
||||
if(is_dir($dir . DIRECTORY_SEPARATOR . $item)) {
|
||||
$res[] = array('text' => $item, 'children' => true, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'icon' => 'folder');
|
||||
}
|
||||
else {
|
||||
$res[] = array('text' => $item, 'children' => false, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'type' => 'file', 'icon' => 'file file-'.substr($item, strrpos($item,'.') + 1));
|
||||
}
|
||||
}
|
||||
if($with_root && $this->id($dir) === '/') {
|
||||
$res = array(array('text' => basename($this->base), 'children' => $res, 'id' => '/', 'icon'=>'folder', 'state' => array('opened' => true, 'disabled' => true)));
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
public function data($id) {
|
||||
if(strpos($id, ":")) {
|
||||
$id = array_map(array($this, 'id'), explode(':', $id));
|
||||
return array('type'=>'multiple', 'content'=> 'Multiple selected: ' . implode(' ', $id));
|
||||
}
|
||||
$dir = $this->path($id);
|
||||
if(is_dir($dir)) {
|
||||
return array('type'=>'folder', 'content'=> $id);
|
||||
}
|
||||
if(is_file($dir)) {
|
||||
$ext = strpos($dir, '.') !== FALSE ? substr($dir, strrpos($dir, '.') + 1) : '';
|
||||
$dat = array('type' => $ext, 'content' => '');
|
||||
switch($ext) {
|
||||
case 'txt':
|
||||
case 'text':
|
||||
case 'md':
|
||||
case 'js':
|
||||
case 'json':
|
||||
case 'css':
|
||||
case 'html':
|
||||
case 'htm':
|
||||
case 'xml':
|
||||
case 'c':
|
||||
case 'cpp':
|
||||
case 'h':
|
||||
case 'sql':
|
||||
case 'log':
|
||||
case 'py':
|
||||
case 'rb':
|
||||
case 'htaccess':
|
||||
case 'php':
|
||||
$dat['content'] = file_get_contents($dir);
|
||||
break;
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
case 'gif':
|
||||
case 'png':
|
||||
case 'bmp':
|
||||
$dat['content'] = 'data:'.finfo_file(finfo_open(FILEINFO_MIME_TYPE), $dir).';base64,'.base64_encode(file_get_contents($dir));
|
||||
break;
|
||||
default:
|
||||
$dat['content'] = 'File not recognized: '.$this->id($dir);
|
||||
break;
|
||||
}
|
||||
return $dat;
|
||||
}
|
||||
throw new Exception('Not a valid selection: ' . $dir);
|
||||
}
|
||||
public function create($id, $name, $mkdir = false) {
|
||||
$dir = $this->path($id);
|
||||
if(preg_match('([^ a-zа-я-_0-9.]+)ui', $name) || !strlen($name)) {
|
||||
throw new Exception('Invalid name: ' . $name);
|
||||
}
|
||||
if($mkdir) {
|
||||
mkdir($dir . DIRECTORY_SEPARATOR . $name);
|
||||
}
|
||||
else {
|
||||
file_put_contents($dir . DIRECTORY_SEPARATOR . $name, '');
|
||||
}
|
||||
return array('id' => $this->id($dir . DIRECTORY_SEPARATOR . $name));
|
||||
}
|
||||
public function rename($id, $name) {
|
||||
$dir = $this->path($id);
|
||||
if($dir === $this->base) {
|
||||
throw new Exception('Cannot rename root');
|
||||
}
|
||||
if(preg_match('([^ a-zа-я-_0-9.]+)ui', $name) || !strlen($name)) {
|
||||
throw new Exception('Invalid name: ' . $name);
|
||||
}
|
||||
$new = explode(DIRECTORY_SEPARATOR, $dir);
|
||||
array_pop($new);
|
||||
array_push($new, $name);
|
||||
$new = implode(DIRECTORY_SEPARATOR, $new);
|
||||
if($dir !== $new) {
|
||||
if(is_file($new) || is_dir($new)) { throw new Exception('Path already exists: ' . $new); }
|
||||
rename($dir, $new);
|
||||
}
|
||||
return array('id' => $this->id($new));
|
||||
}
|
||||
public function remove($id) {
|
||||
$dir = $this->path($id);
|
||||
if($dir === $this->base) {
|
||||
throw new Exception('Cannot remove root');
|
||||
}
|
||||
if(is_dir($dir)) {
|
||||
foreach(array_diff(scandir($dir), array(".", "..")) as $f) {
|
||||
$this->remove($this->id($dir . DIRECTORY_SEPARATOR . $f));
|
||||
}
|
||||
rmdir($dir);
|
||||
}
|
||||
if(is_file($dir)) {
|
||||
unlink($dir);
|
||||
}
|
||||
return array('status' => 'OK');
|
||||
}
|
||||
public function move($id, $par) {
|
||||
$dir = $this->path($id);
|
||||
$par = $this->path($par);
|
||||
$new = explode(DIRECTORY_SEPARATOR, $dir);
|
||||
$new = array_pop($new);
|
||||
$new = $par . DIRECTORY_SEPARATOR . $new;
|
||||
rename($dir, $new);
|
||||
return array('id' => $this->id($new));
|
||||
}
|
||||
public function copy($id, $par) {
|
||||
$dir = $this->path($id);
|
||||
$par = $this->path($par);
|
||||
$new = explode(DIRECTORY_SEPARATOR, $dir);
|
||||
$new = array_pop($new);
|
||||
$new = $par . DIRECTORY_SEPARATOR . $new;
|
||||
if(is_file($new) || is_dir($new)) { throw new Exception('Path already exists: ' . $new); }
|
||||
|
||||
if(is_dir($dir)) {
|
||||
mkdir($new);
|
||||
foreach(array_diff(scandir($dir), array(".", "..")) as $f) {
|
||||
$this->copy($this->id($dir . DIRECTORY_SEPARATOR . $f), $this->id($new));
|
||||
}
|
||||
}
|
||||
if(is_file($dir)) {
|
||||
copy($dir, $new);
|
||||
}
|
||||
return array('id' => $this->id($new));
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['operation'])) {
|
||||
$fs = new fs(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'root' . DIRECTORY_SEPARATOR);
|
||||
try {
|
||||
$rslt = null;
|
||||
switch($_GET['operation']) {
|
||||
case 'get_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$rslt = $fs->lst($node, (isset($_GET['id']) && $_GET['id'] === '#'));
|
||||
break;
|
||||
case "get_content":
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$rslt = $fs->data($node);
|
||||
break;
|
||||
case 'create_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$rslt = $fs->create($node, isset($_GET['text']) ? $_GET['text'] : '', (!isset($_GET['type']) || $_GET['type'] !== 'file'));
|
||||
break;
|
||||
case 'rename_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$rslt = $fs->rename($node, isset($_GET['text']) ? $_GET['text'] : '');
|
||||
break;
|
||||
case 'delete_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$rslt = $fs->remove($node);
|
||||
break;
|
||||
case 'move_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/';
|
||||
$rslt = $fs->move($node, $parn);
|
||||
break;
|
||||
case 'copy_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : '/';
|
||||
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? $_GET['parent'] : '/';
|
||||
$rslt = $fs->copy($node, $parn);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unsupported operation: ' . $_GET['operation']);
|
||||
break;
|
||||
}
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($rslt);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error');
|
||||
header('Status: 500 Server Error');
|
||||
echo $e->getMessage();
|
||||
}
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Title</title>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="stylesheet" href="../vendor/vakata/jstree/dist/themes/default/style.min.css" />
|
||||
<style>
|
||||
html, body { background:#ebebeb; font-size:10px; font-family:Verdana; margin:0; padding:0; }
|
||||
#container { min-width:320px; margin:0px auto 0 auto; background:white; border-radius:0px; padding:0px; overflow:hidden; }
|
||||
#tree { float:left; min-width:319px; border-right:1px solid silver; overflow:auto; padding:0px 0; }
|
||||
#data { margin-left:320px; }
|
||||
#data textarea { margin:0; padding:0; height:100%; width:100%; border:0; background:white; display:block; line-height:18px; resize:none; }
|
||||
#data, #code { font: normal normal normal 12px/18px 'Consolas', monospace !important; }
|
||||
|
||||
#tree .folder { background:url('./file_sprite.png') right bottom no-repeat; }
|
||||
#tree .file { background:url('./file_sprite.png') 0 0 no-repeat; }
|
||||
#tree .file-pdf { background-position: -32px 0 }
|
||||
#tree .file-as { background-position: -36px 0 }
|
||||
#tree .file-c { background-position: -72px -0px }
|
||||
#tree .file-iso { background-position: -108px -0px }
|
||||
#tree .file-htm, #tree .file-html, #tree .file-xml, #tree .file-xsl { background-position: -126px -0px }
|
||||
#tree .file-cf { background-position: -162px -0px }
|
||||
#tree .file-cpp { background-position: -216px -0px }
|
||||
#tree .file-cs { background-position: -236px -0px }
|
||||
#tree .file-sql { background-position: -272px -0px }
|
||||
#tree .file-xls, #tree .file-xlsx { background-position: -362px -0px }
|
||||
#tree .file-h { background-position: -488px -0px }
|
||||
#tree .file-crt, #tree .file-pem, #tree .file-cer { background-position: -452px -18px }
|
||||
#tree .file-php { background-position: -108px -18px }
|
||||
#tree .file-jpg, #tree .file-jpeg, #tree .file-png, #tree .file-gif, #tree .file-bmp { background-position: -126px -18px }
|
||||
#tree .file-ppt, #tree .file-pptx { background-position: -144px -18px }
|
||||
#tree .file-rb { background-position: -180px -18px }
|
||||
#tree .file-text, #tree .file-txt, #tree .file-md, #tree .file-log, #tree .file-htaccess { background-position: -254px -18px }
|
||||
#tree .file-doc, #tree .file-docx { background-position: -362px -18px }
|
||||
#tree .file-zip, #tree .file-gz, #tree .file-tar, #tree .file-rar { background-position: -416px -18px }
|
||||
#tree .file-js { background-position: -434px -18px }
|
||||
#tree .file-css { background-position: -144px -0px }
|
||||
#tree .file-fla { background-position: -398px -0px }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" role="main">
|
||||
<div id="tree"></div>
|
||||
<div id="data">
|
||||
<div class="content code" style="display:none;"><textarea id="code" readonly="readonly"></textarea></div>
|
||||
<div class="content folder" style="display:none;"></div>
|
||||
<div class="content image" style="display:none; position:relative;"><img src="" alt="" style="display:block; position:absolute; left:50%; top:50%; padding:0; max-height:90%; max-width:90%;" /></div>
|
||||
<div class="content default" style="text-align:center;">Select a file from the tree.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script src="../vendor/vakata/jstree/dist/jstree.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$(window).resize(function () {
|
||||
var h = Math.max($(window).height() - 0, 420);
|
||||
$('#container, #data, #tree, #data .content').height(h).filter('.default').css('lineHeight', h + 'px');
|
||||
}).resize();
|
||||
|
||||
$('#tree')
|
||||
.jstree({
|
||||
'core' : {
|
||||
'data' : {
|
||||
'url' : '?operation=get_node',
|
||||
'data' : function (node) {
|
||||
return { 'id' : node.id };
|
||||
}
|
||||
},
|
||||
'check_callback' : function(o, n, p, i, m) {
|
||||
if(m && m.dnd && m.pos !== 'i') { return false; }
|
||||
if(o === "move_node" || o === "copy_node") {
|
||||
if(this.get_node(n).parent === this.get_node(p).id) { return false; }
|
||||
}
|
||||
return true;
|
||||
},
|
||||
'force_text' : true,
|
||||
'themes' : {
|
||||
'responsive' : false,
|
||||
'variant' : 'small',
|
||||
'stripes' : true
|
||||
}
|
||||
},
|
||||
'sort' : function(a, b) {
|
||||
return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : (this.get_type(a) >= this.get_type(b) ? 1 : -1);
|
||||
},
|
||||
'contextmenu' : {
|
||||
'items' : function(node) {
|
||||
var tmp = $.jstree.defaults.contextmenu.items();
|
||||
delete tmp.create.action;
|
||||
tmp.create.label = "New";
|
||||
tmp.create.submenu = {
|
||||
"create_folder" : {
|
||||
"separator_after" : true,
|
||||
"label" : "Folder",
|
||||
"action" : function (data) {
|
||||
var inst = $.jstree.reference(data.reference),
|
||||
obj = inst.get_node(data.reference);
|
||||
inst.create_node(obj, { type : "default" }, "last", function (new_node) {
|
||||
setTimeout(function () { inst.edit(new_node); },0);
|
||||
});
|
||||
}
|
||||
},
|
||||
"create_file" : {
|
||||
"label" : "File",
|
||||
"action" : function (data) {
|
||||
var inst = $.jstree.reference(data.reference),
|
||||
obj = inst.get_node(data.reference);
|
||||
inst.create_node(obj, { type : "file" }, "last", function (new_node) {
|
||||
setTimeout(function () { inst.edit(new_node); },0);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if(this.get_type(node) === "file") {
|
||||
delete tmp.create;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
},
|
||||
'types' : {
|
||||
'default' : { 'icon' : 'folder' },
|
||||
'file' : { 'valid_children' : [], 'icon' : 'file' }
|
||||
},
|
||||
'unique' : {
|
||||
'duplicate' : function (name, counter) {
|
||||
return name + ' ' + counter;
|
||||
}
|
||||
},
|
||||
'plugins' : ['state','dnd','sort','types','contextmenu','unique']
|
||||
})
|
||||
.on('delete_node.jstree', function (e, data) {
|
||||
$.get('?operation=delete_node', { 'id' : data.node.id })
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('create_node.jstree', function (e, data) {
|
||||
$.get('?operation=create_node', { 'type' : data.node.type, 'id' : data.node.parent, 'text' : data.node.text })
|
||||
.done(function (d) {
|
||||
data.instance.set_id(data.node, d.id);
|
||||
})
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('rename_node.jstree', function (e, data) {
|
||||
$.get('?operation=rename_node', { 'id' : data.node.id, 'text' : data.text })
|
||||
.done(function (d) {
|
||||
data.instance.set_id(data.node, d.id);
|
||||
})
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('move_node.jstree', function (e, data) {
|
||||
$.get('?operation=move_node', { 'id' : data.node.id, 'parent' : data.parent })
|
||||
.done(function (d) {
|
||||
//data.instance.load_node(data.parent);
|
||||
data.instance.refresh();
|
||||
})
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('copy_node.jstree', function (e, data) {
|
||||
$.get('?operation=copy_node', { 'id' : data.original.id, 'parent' : data.parent })
|
||||
.done(function (d) {
|
||||
//data.instance.load_node(data.parent);
|
||||
data.instance.refresh();
|
||||
})
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('changed.jstree', function (e, data) {
|
||||
if(data && data.selected && data.selected.length) {
|
||||
$.get('?operation=get_content&id=' + data.selected.join(':'), function (d) {
|
||||
if(d && typeof d.type !== 'undefined') {
|
||||
$('#data .content').hide();
|
||||
switch(d.type) {
|
||||
case 'text':
|
||||
case 'txt':
|
||||
case 'md':
|
||||
case 'htaccess':
|
||||
case 'log':
|
||||
case 'sql':
|
||||
case 'php':
|
||||
case 'js':
|
||||
case 'json':
|
||||
case 'css':
|
||||
case 'html':
|
||||
$('#data .code').show();
|
||||
$('#code').val(d.content);
|
||||
break;
|
||||
case 'png':
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
case 'bmp':
|
||||
case 'gif':
|
||||
$('#data .image img').one('load', function () { $(this).css({'marginTop':'-' + $(this).height()/2 + 'px','marginLeft':'-' + $(this).width()/2 + 'px'}); }).attr('src',d.content);
|
||||
$('#data .image').show();
|
||||
break;
|
||||
default:
|
||||
$('#data .default').html(d.content).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#data .content').hide();
|
||||
$('#data .default').html('Select a file from the tree.').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,47 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('input[type=password]').keyup(function() {
|
||||
var pswd = $(this).val();
|
||||
|
||||
//validate the length
|
||||
if ( pswd.length < 8 ) {
|
||||
$('#length').removeClass('valid').addClass('invalid');
|
||||
} else {
|
||||
$('#length').removeClass('invalid').addClass('valid');
|
||||
}
|
||||
|
||||
//validate letter
|
||||
if ( pswd.match(/[A-z]/) ) {
|
||||
$('#letter').removeClass('invalid').addClass('valid');
|
||||
} else {
|
||||
$('#letter').removeClass('valid').addClass('invalid');
|
||||
}
|
||||
|
||||
//validate capital letter
|
||||
if ( pswd.match(/[A-Z]/) ) {
|
||||
$('#capital').removeClass('invalid').addClass('valid');
|
||||
} else {
|
||||
$('#capital').removeClass('valid').addClass('invalid');
|
||||
}
|
||||
|
||||
//validate number
|
||||
if ( pswd.match(/\d/) ) {
|
||||
$('#number').removeClass('invalid').addClass('valid');
|
||||
} else {
|
||||
$('#number').removeClass('valid').addClass('invalid');
|
||||
}
|
||||
|
||||
//validate space
|
||||
if ( pswd.match(/[^a-zA-Z0-9\-\/]/) ) {
|
||||
$('#space').removeClass('invalid').addClass('valid');
|
||||
} else {
|
||||
$('#space').removeClass('valid').addClass('invalid');
|
||||
}
|
||||
|
||||
}).focus(function() {
|
||||
$('#pswd_info').show();
|
||||
}).blur(function() {
|
||||
$('#pswd_info').hide();
|
||||
});
|
||||
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,986 +0,0 @@
|
||||
<?php
|
||||
// TO DO: better exceptions, use params
|
||||
class tree
|
||||
{
|
||||
protected $db = null;
|
||||
protected $options = null;
|
||||
protected $default = array(
|
||||
'structure_table' => 'structure', // the structure table (containing the id, left, right, level, parent_id and position fields)
|
||||
'data_table' => 'structure', // table for additional fields (apart from structure ones, can be the same as structure_table)
|
||||
'data2structure' => 'id', // which field from the data table maps to the structure table
|
||||
'structure' => array( // which field (value) maps to what in the structure (key)
|
||||
'id' => 'id',
|
||||
'left' => 'lft',
|
||||
'right' => 'rgt',
|
||||
'level' => 'lvl',
|
||||
'parent_id' => 'pid',
|
||||
'position' => 'pos'
|
||||
),
|
||||
'data' => array() // array of additional fields from the data table
|
||||
);
|
||||
|
||||
public function __construct(\vakata\database\IDB $db, array $options = array()) {
|
||||
$this->db = $db;
|
||||
$this->options = array_merge($this->default, $options);
|
||||
}
|
||||
|
||||
public function get_node($id, $options = array()) {
|
||||
$node = $this->db->one("
|
||||
SELECT
|
||||
s.".implode(", s.", $this->options['structure']).",
|
||||
d.".implode(", d.", $this->options['data'])."
|
||||
FROM
|
||||
".$this->options['structure_table']." s,
|
||||
".$this->options['data_table']." d
|
||||
WHERE
|
||||
s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND
|
||||
s.".$this->options['structure']['id']." = ".(int)$id
|
||||
);
|
||||
if(!$node) {
|
||||
throw new Exception('Node does not exist');
|
||||
}
|
||||
if(isset($options['with_children'])) {
|
||||
$node['children'] = $this->get_children($id, isset($options['deep_children']));
|
||||
}
|
||||
if(isset($options['with_path'])) {
|
||||
$node['path'] = $this->get_path($id);
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
public function get_children($id, $recursive = false) {
|
||||
$sql = false;
|
||||
if($recursive) {
|
||||
$node = $this->get_node($id);
|
||||
$sql = "
|
||||
SELECT
|
||||
s.".implode(", s.", $this->options['structure']).",
|
||||
d.".implode(", d.", $this->options['data'])."
|
||||
FROM
|
||||
".$this->options['structure_table']." s,
|
||||
".$this->options['data_table']." d
|
||||
WHERE
|
||||
s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND
|
||||
s.".$this->options['structure']['left']." > ".(int)$node[$this->options['structure']['left']]." AND
|
||||
s.".$this->options['structure']['right']." < ".(int)$node[$this->options['structure']['right']]."
|
||||
ORDER BY
|
||||
s.".$this->options['structure']['left']."
|
||||
";
|
||||
}
|
||||
else {
|
||||
$sql = "
|
||||
SELECT
|
||||
s.".implode(", s.", $this->options['structure']).",
|
||||
d.".implode(", d.", $this->options['data'])."
|
||||
FROM
|
||||
".$this->options['structure_table']." s,
|
||||
".$this->options['data_table']." d
|
||||
WHERE
|
||||
s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND
|
||||
s.".$this->options['structure']['parent_id']." = ".(int)$id."
|
||||
ORDER BY
|
||||
s.".$this->options['structure']['position']."
|
||||
";
|
||||
}
|
||||
return $this->db->all($sql);
|
||||
}
|
||||
|
||||
public function get_path($id) {
|
||||
$node = $this->get_node($id);
|
||||
$sql = false;
|
||||
if($node) {
|
||||
$sql = "
|
||||
SELECT
|
||||
s.".implode(", s.", $this->options['structure']).",
|
||||
d.".implode(", d.", $this->options['data'])."
|
||||
FROM
|
||||
".$this->options['structure_table']." s,
|
||||
".$this->options['data_table']." d
|
||||
WHERE
|
||||
s.".$this->options['structure']['id']." = d.".$this->options['data2structure']." AND
|
||||
s.".$this->options['structure']['left']." < ".(int)$node[$this->options['structure']['left']]." AND
|
||||
s.".$this->options['structure']['right']." > ".(int)$node[$this->options['structure']['right']]."
|
||||
ORDER BY
|
||||
s.".$this->options['structure']['left']."
|
||||
";
|
||||
}
|
||||
return $sql ? $this->db->all($sql) : false;
|
||||
}
|
||||
|
||||
public function mk($parent, $position = 0, $data = array()) {
|
||||
$parent = (int)$parent;
|
||||
if($parent == 0) { throw new Exception('Parent is 0'); }
|
||||
$parent = $this->get_node($parent, array('with_children'=> true));
|
||||
if(!$parent['children']) { $position = 0; }
|
||||
if($parent['children'] && $position >= count($parent['children'])) { $position = count($parent['children']); }
|
||||
|
||||
$sql = array();
|
||||
$par = array();
|
||||
|
||||
// PREPARE NEW PARENT
|
||||
// update positions of all next elements
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1
|
||||
WHERE
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND
|
||||
".$this->options['structure']["position"]." >= ".$position."
|
||||
";
|
||||
$par[] = false;
|
||||
|
||||
// update left indexes
|
||||
$ref_lft = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]];
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + 2
|
||||
WHERE
|
||||
".$this->options['structure']["left"]." >= ".(int)$ref_lft."
|
||||
";
|
||||
$par[] = false;
|
||||
|
||||
// update right indexes
|
||||
$ref_rgt = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1;
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + 2
|
||||
WHERE
|
||||
".$this->options['structure']["right"]." >= ".(int)$ref_rgt."
|
||||
";
|
||||
$par[] = false;
|
||||
|
||||
// INSERT NEW NODE IN STRUCTURE
|
||||
$sql[] = "INSERT INTO ".$this->options['structure_table']." (".implode(",", $this->options['structure']).") VALUES (?".str_repeat(',?', count($this->options['structure']) - 1).")";
|
||||
$tmp = array();
|
||||
foreach($this->options['structure'] as $k => $v) {
|
||||
switch($k) {
|
||||
case 'id':
|
||||
$tmp[] = null;
|
||||
break;
|
||||
case 'left':
|
||||
$tmp[] = (int)$ref_lft;
|
||||
break;
|
||||
case 'right':
|
||||
$tmp[] = (int)$ref_lft + 1;
|
||||
break;
|
||||
case 'level':
|
||||
$tmp[] = (int)$parent[$v] + 1;
|
||||
break;
|
||||
case 'parent_id':
|
||||
$tmp[] = $parent[$this->options['structure']['id']];
|
||||
break;
|
||||
case 'position':
|
||||
$tmp[] = $position;
|
||||
break;
|
||||
default:
|
||||
$tmp[] = null;
|
||||
}
|
||||
}
|
||||
$par[] = $tmp;
|
||||
|
||||
foreach($sql as $k => $v) {
|
||||
try {
|
||||
$this->db->query($v, $par[$k]);
|
||||
} catch(Exception $e) {
|
||||
$this->reconstruct();
|
||||
throw new Exception('Could not create');
|
||||
}
|
||||
}
|
||||
if($data && count($data)) {
|
||||
$node = $this->db->insert_id();
|
||||
if(!$this->rn($node,$data)) {
|
||||
$this->rm($node);
|
||||
throw new Exception('Could not rename after create');
|
||||
}
|
||||
}
|
||||
return $node;
|
||||
}
|
||||
|
||||
public function mv($id, $parent, $position = 0) {
|
||||
$id = (int)$id;
|
||||
$parent = (int)$parent;
|
||||
if($parent == 0 || $id == 0 || $id == 1) {
|
||||
throw new Exception('Cannot move inside 0, or move root node');
|
||||
}
|
||||
|
||||
$parent = $this->get_node($parent, array('with_children'=> true, 'with_path' => true));
|
||||
$id = $this->get_node($id, array('with_children'=> true, 'deep_children' => true, 'with_path' => true));
|
||||
if(!$parent['children']) {
|
||||
$position = 0;
|
||||
}
|
||||
if($id[$this->options['structure']['parent_id']] == $parent[$this->options['structure']['id']] && $position > $id[$this->options['structure']['position']]) {
|
||||
$position ++;
|
||||
}
|
||||
if($parent['children'] && $position >= count($parent['children'])) {
|
||||
$position = count($parent['children']);
|
||||
}
|
||||
if($id[$this->options['structure']['left']] < $parent[$this->options['structure']['left']] && $id[$this->options['structure']['right']] > $parent[$this->options['structure']['right']]) {
|
||||
throw new Exception('Could not move parent inside child');
|
||||
}
|
||||
|
||||
$tmp = array();
|
||||
$tmp[] = (int)$id[$this->options['structure']["id"]];
|
||||
if($id['children'] && is_array($id['children'])) {
|
||||
foreach($id['children'] as $c) {
|
||||
$tmp[] = (int)$c[$this->options['structure']["id"]];
|
||||
}
|
||||
}
|
||||
$width = (int)$id[$this->options['structure']["right"]] - (int)$id[$this->options['structure']["left"]] + 1;
|
||||
|
||||
$sql = array();
|
||||
|
||||
// PREPARE NEW PARENT
|
||||
// update positions of all next elements
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1
|
||||
WHERE
|
||||
".$this->options['structure']["id"]." != ".(int)$id[$this->options['structure']['id']]." AND
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND
|
||||
".$this->options['structure']["position"]." >= ".$position."
|
||||
";
|
||||
|
||||
// update left indexes
|
||||
$ref_lft = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]];
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["left"]." >= ".(int)$ref_lft." AND
|
||||
".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).")
|
||||
";
|
||||
// update right indexes
|
||||
$ref_rgt = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1;
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["right"]." >= ".(int)$ref_rgt." AND
|
||||
".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).")
|
||||
";
|
||||
|
||||
// MOVE THE ELEMENT AND CHILDREN
|
||||
// left, right and level
|
||||
$diff = $ref_lft - (int)$id[$this->options['structure']["left"]];
|
||||
|
||||
if($diff > 0) { $diff = $diff - $width; }
|
||||
$ldiff = ((int)$parent[$this->options['structure']['level']] + 1) - (int)$id[$this->options['structure']['level']];
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$diff.",
|
||||
".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$diff.",
|
||||
".$this->options['structure']["level"]." = ".$this->options['structure']["level"]." + ".$ldiff."
|
||||
WHERE ".$this->options['structure']["id"]." IN(".implode(',',$tmp).")
|
||||
";
|
||||
// position and parent_id
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$position.",
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']["id"]]."
|
||||
WHERE ".$this->options['structure']["id"]." = ".(int)$id[$this->options['structure']['id']]."
|
||||
";
|
||||
|
||||
// CLEAN OLD PARENT
|
||||
// position of all next elements
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." - 1
|
||||
WHERE
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$id[$this->options['structure']["parent_id"]]." AND
|
||||
".$this->options['structure']["position"]." > ".(int)$id[$this->options['structure']["position"]];
|
||||
// left indexes
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." - ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["left"]." > ".(int)$id[$this->options['structure']["right"]]." AND
|
||||
".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).")
|
||||
";
|
||||
// right indexes
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." - ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["right"]." > ".(int)$id[$this->options['structure']["right"]]." AND
|
||||
".$this->options['structure']["id"]." NOT IN(".implode(',',$tmp).")
|
||||
";
|
||||
|
||||
foreach($sql as $k => $v) {
|
||||
//echo preg_replace('@[\s\t]+@',' ',$v) ."\n";
|
||||
try {
|
||||
$this->db->query($v);
|
||||
} catch(Exception $e) {
|
||||
$this->reconstruct();
|
||||
throw new Exception('Error moving');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function cp($id, $parent, $position = 0) {
|
||||
$id = (int)$id;
|
||||
$parent = (int)$parent;
|
||||
if($parent == 0 || $id == 0 || $id == 1) {
|
||||
throw new Exception('Could not copy inside parent 0, or copy root nodes');
|
||||
}
|
||||
|
||||
$parent = $this->get_node($parent, array('with_children'=> true, 'with_path' => true));
|
||||
$id = $this->get_node($id, array('with_children'=> true, 'deep_children' => true, 'with_path' => true));
|
||||
$old_nodes = $this->db->get("
|
||||
SELECT * FROM ".$this->options['structure_table']."
|
||||
WHERE ".$this->options['structure']["left"]." > ".$id[$this->options['structure']["left"]]." AND ".$this->options['structure']["right"]." < ".$id[$this->options['structure']["right"]]."
|
||||
ORDER BY ".$this->options['structure']["left"]."
|
||||
");
|
||||
if(!$parent['children']) {
|
||||
$position = 0;
|
||||
}
|
||||
if($id[$this->options['structure']['parent_id']] == $parent[$this->options['structure']['id']] && $position > $id[$this->options['structure']['position']]) {
|
||||
//$position ++;
|
||||
}
|
||||
if($parent['children'] && $position >= count($parent['children'])) {
|
||||
$position = count($parent['children']);
|
||||
}
|
||||
|
||||
$tmp = array();
|
||||
$tmp[] = (int)$id[$this->options['structure']["id"]];
|
||||
if($id['children'] && is_array($id['children'])) {
|
||||
foreach($id['children'] as $c) {
|
||||
$tmp[] = (int)$c[$this->options['structure']["id"]];
|
||||
}
|
||||
}
|
||||
$width = (int)$id[$this->options['structure']["right"]] - (int)$id[$this->options['structure']["left"]] + 1;
|
||||
|
||||
$sql = array();
|
||||
|
||||
// PREPARE NEW PARENT
|
||||
// update positions of all next elements
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." + 1
|
||||
WHERE
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']['id']]." AND
|
||||
".$this->options['structure']["position"]." >= ".$position."
|
||||
";
|
||||
|
||||
// update left indexes
|
||||
$ref_lft = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_lft = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_lft = $parent['children'][(int)$position][$this->options['structure']["left"]];
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." + ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["left"]." >= ".(int)$ref_lft."
|
||||
";
|
||||
// update right indexes
|
||||
$ref_rgt = false;
|
||||
if(!$parent['children']) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else if(!isset($parent['children'][$position])) {
|
||||
$ref_rgt = $parent[$this->options['structure']["right"]];
|
||||
}
|
||||
else {
|
||||
$ref_rgt = $parent['children'][(int)$position][$this->options['structure']["left"]] + 1;
|
||||
}
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." + ".$width."
|
||||
WHERE
|
||||
".$this->options['structure']["right"]." >= ".(int)$ref_rgt."
|
||||
";
|
||||
|
||||
// MOVE THE ELEMENT AND CHILDREN
|
||||
// left, right and level
|
||||
$diff = $ref_lft - (int)$id[$this->options['structure']["left"]];
|
||||
|
||||
if($diff <= 0) { $diff = $diff - $width; }
|
||||
$ldiff = ((int)$parent[$this->options['structure']['level']] + 1) - (int)$id[$this->options['structure']['level']];
|
||||
|
||||
// build all fields + data table
|
||||
$fields = array_combine($this->options['structure'], $this->options['structure']);
|
||||
unset($fields['id']);
|
||||
$fields[$this->options['structure']["left"]] = $this->options['structure']["left"]." + ".$diff;
|
||||
$fields[$this->options['structure']["right"]] = $this->options['structure']["right"]." + ".$diff;
|
||||
$fields[$this->options['structure']["level"]] = $this->options['structure']["level"]." + ".$ldiff;
|
||||
$sql[] = "
|
||||
INSERT INTO ".$this->options['structure_table']." ( ".implode(',',array_keys($fields))." )
|
||||
SELECT ".implode(',',array_values($fields))." FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." IN (".implode(",", $tmp).")
|
||||
ORDER BY ".$this->options['structure']["level"]." ASC";
|
||||
|
||||
foreach($sql as $k => $v) {
|
||||
try {
|
||||
$this->db->query($v);
|
||||
} catch(Exception $e) {
|
||||
$this->reconstruct();
|
||||
throw new Exception('Error copying');
|
||||
}
|
||||
}
|
||||
$iid = (int)$this->db->insert_id();
|
||||
|
||||
try {
|
||||
$this->db->query("
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$position.",
|
||||
".$this->options['structure']["parent_id"]." = ".(int)$parent[$this->options['structure']["id"]]."
|
||||
WHERE ".$this->options['structure']["id"]." = ".$iid."
|
||||
");
|
||||
} catch(Exception $e) {
|
||||
$this->rm($iid);
|
||||
$this->reconstruct();
|
||||
throw new Exception('Could not update adjacency after copy');
|
||||
}
|
||||
$fields = $this->options['data'];
|
||||
unset($fields['id']);
|
||||
$update_fields = array();
|
||||
foreach($fields as $f) {
|
||||
$update_fields[] = $f.'=VALUES('.$f.')';
|
||||
}
|
||||
$update_fields = implode(',', $update_fields);
|
||||
if(count($fields)) {
|
||||
try {
|
||||
$this->db->query("
|
||||
INSERT INTO ".$this->options['data_table']." (".$this->options['data2structure'].",".implode(",",$fields).")
|
||||
SELECT ".$iid.",".implode(",",$fields)." FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = ".$id[$this->options['data2structure']]."
|
||||
ON DUPLICATE KEY UPDATE ".$update_fields."
|
||||
");
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$this->rm($iid);
|
||||
$this->reconstruct();
|
||||
throw new Exception('Could not update data after copy');
|
||||
}
|
||||
}
|
||||
|
||||
// manually fix all parent_ids and copy all data
|
||||
$new_nodes = $this->db->get("
|
||||
SELECT * FROM ".$this->options['structure_table']."
|
||||
WHERE ".$this->options['structure']["left"]." > ".$ref_lft." AND ".$this->options['structure']["right"]." < ".($ref_lft + $width - 1)." AND ".$this->options['structure']["id"]." != ".$iid."
|
||||
ORDER BY ".$this->options['structure']["left"]."
|
||||
");
|
||||
$parents = array();
|
||||
foreach($new_nodes as $node) {
|
||||
if(!isset($parents[$node[$this->options['structure']["left"]]])) { $parents[$node[$this->options['structure']["left"]]] = $iid; }
|
||||
for($i = $node[$this->options['structure']["left"]] + 1; $i < $node[$this->options['structure']["right"]]; $i++) {
|
||||
$parents[$i] = $node[$this->options['structure']["id"]];
|
||||
}
|
||||
}
|
||||
$sql = array();
|
||||
foreach($new_nodes as $k => $node) {
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["parent_id"]." = ".$parents[$node[$this->options['structure']["left"]]]."
|
||||
WHERE ".$this->options['structure']["id"]." = ".(int)$node[$this->options['structure']["id"]]."
|
||||
";
|
||||
if(count($fields)) {
|
||||
$up = "";
|
||||
foreach($fields as $f)
|
||||
$sql[] = "
|
||||
INSERT INTO ".$this->options['data_table']." (".$this->options['data2structure'].",".implode(",",$fields).")
|
||||
SELECT ".(int)$node[$this->options['structure']["id"]].",".implode(",",$fields)." FROM ".$this->options['data_table']."
|
||||
WHERE ".$this->options['data2structure']." = ".$old_nodes[$k][$this->options['structure']['id']]."
|
||||
ON DUPLICATE KEY UPDATE ".$update_fields."
|
||||
";
|
||||
}
|
||||
}
|
||||
//var_dump($sql);
|
||||
foreach($sql as $k => $v) {
|
||||
try {
|
||||
$this->db->query($v);
|
||||
} catch(Exception $e) {
|
||||
$this->rm($iid);
|
||||
$this->reconstruct();
|
||||
throw new Exception('Error copying');
|
||||
}
|
||||
}
|
||||
return $iid;
|
||||
}
|
||||
|
||||
public function rm($id) {
|
||||
$id = (int)$id;
|
||||
if(!$id || $id === 1) { throw new Exception('Could not create inside roots'); }
|
||||
$data = $this->get_node($id, array('with_children' => true, 'deep_children' => true));
|
||||
$lft = (int)$data[$this->options['structure']["left"]];
|
||||
$rgt = (int)$data[$this->options['structure']["right"]];
|
||||
$pid = (int)$data[$this->options['structure']["parent_id"]];
|
||||
$pos = (int)$data[$this->options['structure']["position"]];
|
||||
$dif = $rgt - $lft + 1;
|
||||
|
||||
$sql = array();
|
||||
// deleting node and its children from structure
|
||||
$sql[] = "
|
||||
DELETE FROM ".$this->options['structure_table']."
|
||||
WHERE ".$this->options['structure']["left"]." >= ".(int)$lft." AND ".$this->options['structure']["right"]." <= ".(int)$rgt."
|
||||
";
|
||||
// shift left indexes of nodes right of the node
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["left"]." = ".$this->options['structure']["left"]." - ".(int)$dif."
|
||||
WHERE ".$this->options['structure']["left"]." > ".(int)$rgt."
|
||||
";
|
||||
// shift right indexes of nodes right of the node and the node's parents
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["right"]." = ".$this->options['structure']["right"]." - ".(int)$dif."
|
||||
WHERE ".$this->options['structure']["right"]." > ".(int)$lft."
|
||||
";
|
||||
// Update position of siblings below the deleted node
|
||||
$sql[] = "
|
||||
UPDATE ".$this->options['structure_table']."
|
||||
SET ".$this->options['structure']["position"]." = ".$this->options['structure']["position"]." - 1
|
||||
WHERE ".$this->options['structure']["parent_id"]." = ".$pid." AND ".$this->options['structure']["position"]." > ".(int)$pos."
|
||||
";
|
||||
// delete from data table
|
||||
if($this->options['data_table']) {
|
||||
$tmp = array();
|
||||
$tmp[] = (int)$data['id'];
|
||||
if($data['children'] && is_array($data['children'])) {
|
||||
foreach($data['children'] as $v) {
|
||||
$tmp[] = (int)$v['id'];
|
||||
}
|
||||
}
|
||||
$sql[] = "DELETE FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." IN (".implode(',',$tmp).")";
|
||||
}
|
||||
|
||||
foreach($sql as $v) {
|
||||
try {
|
||||
$this->db->query($v);
|
||||
} catch(Exception $e) {
|
||||
$this->reconstruct();
|
||||
throw new Exception('Could not remove');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rn($id, $data) {
|
||||
if(!(int)$this->db->one('SELECT 1 AS res FROM '.$this->options['structure_table'].' WHERE '.$this->options['structure']['id'].' = '.(int)$id)) {
|
||||
throw new Exception('Could not rename non-existing node');
|
||||
}
|
||||
$tmp = array();
|
||||
foreach($this->options['data'] as $v) {
|
||||
if(isset($data[$v])) {
|
||||
$tmp[$v] = $data[$v];
|
||||
}
|
||||
}
|
||||
if(count($tmp)) {
|
||||
$tmp[$this->options['data2structure']] = $id;
|
||||
$sql = "
|
||||
INSERT INTO
|
||||
".$this->options['data_table']." (".implode(',', array_keys($tmp)).")
|
||||
VALUES(?".str_repeat(',?', count($tmp) - 1).")
|
||||
ON DUPLICATE KEY UPDATE
|
||||
".implode(' = ?, ', array_keys($tmp))." = ?";
|
||||
$par = array_merge(array_values($tmp), array_values($tmp));
|
||||
try {
|
||||
$this->db->query($sql, $par);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
throw new Exception('Could not rename');
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function analyze($get_errors = false) {
|
||||
$report = array();
|
||||
if((int)$this->db->one("SELECT COUNT(".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["parent_id"]." = 0") !== 1) {
|
||||
$report[] = "No or more than one root node.";
|
||||
}
|
||||
if((int)$this->db->one("SELECT ".$this->options['structure']["left"]." AS res FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["parent_id"]." = 0") !== 1) {
|
||||
$report[] = "Root node's left index is not 1.";
|
||||
}
|
||||
if((int)$this->db->one("
|
||||
SELECT
|
||||
COUNT(".$this->options['structure']['id'].") AS res
|
||||
FROM ".$this->options['structure_table']." s
|
||||
WHERE
|
||||
".$this->options['structure']["parent_id"]." != 0 AND
|
||||
(SELECT COUNT(".$this->options['structure']['id'].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." = s.".$this->options['structure']["parent_id"].") = 0") > 0
|
||||
) {
|
||||
$report[] = "Missing parents.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("SELECT MAX(".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table']) / 2 !=
|
||||
(int)$this->db->one("SELECT COUNT(".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table'])
|
||||
) {
|
||||
$report[] = "Right index does not match node count.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table']) !=
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["left"].") AS res FROM ".$this->options['structure_table'])
|
||||
) {
|
||||
$report[] = "Duplicates in nested set.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']) !=
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["left"].") AS res FROM ".$this->options['structure_table'])
|
||||
) {
|
||||
$report[] = "Left indexes not unique.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["id"].") AS res FROM ".$this->options['structure_table']) !=
|
||||
(int)$this->db->one("SELECT COUNT(DISTINCT ".$this->options['structure']["right"].") AS res FROM ".$this->options['structure_table'])
|
||||
) {
|
||||
$report[] = "Right indexes not unique.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("
|
||||
SELECT
|
||||
s1.".$this->options['structure']["id"]." AS res
|
||||
FROM ".$this->options['structure_table']." s1, ".$this->options['structure_table']." s2
|
||||
WHERE
|
||||
s1.".$this->options['structure']['id']." != s2.".$this->options['structure']['id']." AND
|
||||
s1.".$this->options['structure']['left']." = s2.".$this->options['structure']['right']."
|
||||
LIMIT 1")
|
||||
) {
|
||||
$report[] = "Nested set - matching left and right indexes.";
|
||||
}
|
||||
if(
|
||||
(int)$this->db->one("
|
||||
SELECT
|
||||
".$this->options['structure']["id"]." AS res
|
||||
FROM ".$this->options['structure_table']." s
|
||||
WHERE
|
||||
".$this->options['structure']['position']." >= (
|
||||
SELECT
|
||||
COUNT(".$this->options['structure']["id"].")
|
||||
FROM ".$this->options['structure_table']."
|
||||
WHERE ".$this->options['structure']['parent_id']." = s.".$this->options['structure']['parent_id']."
|
||||
)
|
||||
LIMIT 1") ||
|
||||
(int)$this->db->one("
|
||||
SELECT
|
||||
s1.".$this->options['structure']["id"]." AS res
|
||||
FROM ".$this->options['structure_table']." s1, ".$this->options['structure_table']." s2
|
||||
WHERE
|
||||
s1.".$this->options['structure']['id']." != s2.".$this->options['structure']['id']." AND
|
||||
s1.".$this->options['structure']['parent_id']." = s2.".$this->options['structure']['parent_id']." AND
|
||||
s1.".$this->options['structure']['position']." = s2.".$this->options['structure']['position']."
|
||||
LIMIT 1")
|
||||
) {
|
||||
$report[] = "Positions not correct.";
|
||||
}
|
||||
if((int)$this->db->one("
|
||||
SELECT
|
||||
COUNT(".$this->options['structure']["id"].") FROM ".$this->options['structure_table']." s
|
||||
WHERE
|
||||
(
|
||||
SELECT
|
||||
COUNT(".$this->options['structure']["id"].")
|
||||
FROM ".$this->options['structure_table']."
|
||||
WHERE
|
||||
".$this->options['structure']["right"]." < s.".$this->options['structure']["right"]." AND
|
||||
".$this->options['structure']["left"]." > s.".$this->options['structure']["left"]." AND
|
||||
".$this->options['structure']["level"]." = s.".$this->options['structure']["level"]." + 1
|
||||
) !=
|
||||
(
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM ".$this->options['structure_table']."
|
||||
WHERE
|
||||
".$this->options['structure']["parent_id"]." = s.".$this->options['structure']["id"]."
|
||||
)")
|
||||
) {
|
||||
$report[] = "Adjacency and nested set do not match.";
|
||||
}
|
||||
if(
|
||||
$this->options['data_table'] &&
|
||||
(int)$this->db->one("
|
||||
SELECT
|
||||
COUNT(".$this->options['structure']["id"].") AS res
|
||||
FROM ".$this->options['structure_table']." s
|
||||
WHERE
|
||||
(SELECT COUNT(".$this->options['data2structure'].") FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = s.".$this->options['structure']["id"].") = 0
|
||||
")
|
||||
) {
|
||||
$report[] = "Missing records in data table.";
|
||||
}
|
||||
if(
|
||||
$this->options['data_table'] &&
|
||||
(int)$this->db->one("
|
||||
SELECT
|
||||
COUNT(".$this->options['data2structure'].") AS res
|
||||
FROM ".$this->options['data_table']." s
|
||||
WHERE
|
||||
(SELECT COUNT(".$this->options['structure']["id"].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']["id"]." = s.".$this->options['data2structure'].") = 0
|
||||
")
|
||||
) {
|
||||
$report[] = "Dangling records in data table.";
|
||||
}
|
||||
return $get_errors ? $report : count($report) == 0;
|
||||
}
|
||||
|
||||
public function reconstruct($analyze = true) {
|
||||
if($analyze && $this->analyze()) { return true; }
|
||||
|
||||
if(!$this->db->query("" .
|
||||
"CREATE TEMPORARY TABLE temp_tree (" .
|
||||
"".$this->options['structure']["id"]." INTEGER NOT NULL, " .
|
||||
"".$this->options['structure']["parent_id"]." INTEGER NOT NULL, " .
|
||||
"". $this->options['structure']["position"]." INTEGER NOT NULL" .
|
||||
") "
|
||||
)) { return false; }
|
||||
if(!$this->db->query("" .
|
||||
"INSERT INTO temp_tree " .
|
||||
"SELECT " .
|
||||
"".$this->options['structure']["id"].", " .
|
||||
"".$this->options['structure']["parent_id"].", " .
|
||||
"".$this->options['structure']["position"]." " .
|
||||
"FROM ".$this->options['structure_table'].""
|
||||
)) { return false; }
|
||||
|
||||
if(!$this->db->query("" .
|
||||
"CREATE TEMPORARY TABLE temp_stack (" .
|
||||
"".$this->options['structure']["id"]." INTEGER NOT NULL, " .
|
||||
"".$this->options['structure']["left"]." INTEGER, " .
|
||||
"".$this->options['structure']["right"]." INTEGER, " .
|
||||
"".$this->options['structure']["level"]." INTEGER, " .
|
||||
"stack_top INTEGER NOT NULL, " .
|
||||
"".$this->options['structure']["parent_id"]." INTEGER, " .
|
||||
"".$this->options['structure']["position"]." INTEGER " .
|
||||
") "
|
||||
)) { return false; }
|
||||
|
||||
$counter = 2;
|
||||
if(!$this->db->query("SELECT COUNT(*) FROM temp_tree")) {
|
||||
return false;
|
||||
}
|
||||
$this->db->nextr();
|
||||
$maxcounter = (int) $this->db->f(0) * 2;
|
||||
$currenttop = 1;
|
||||
if(!$this->db->query("" .
|
||||
"INSERT INTO temp_stack " .
|
||||
"SELECT " .
|
||||
"".$this->options['structure']["id"].", " .
|
||||
"1, " .
|
||||
"NULL, " .
|
||||
"0, " .
|
||||
"1, " .
|
||||
"".$this->options['structure']["parent_id"].", " .
|
||||
"".$this->options['structure']["position"]." " .
|
||||
"FROM temp_tree " .
|
||||
"WHERE ".$this->options['structure']["parent_id"]." = 0"
|
||||
)) { return false; }
|
||||
if(!$this->db->query("DELETE FROM temp_tree WHERE ".$this->options['structure']["parent_id"]." = 0")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while ($counter <= $maxcounter) {
|
||||
if(!$this->db->query("" .
|
||||
"SELECT " .
|
||||
"temp_tree.".$this->options['structure']["id"]." AS tempmin, " .
|
||||
"temp_tree.".$this->options['structure']["parent_id"]." AS pid, " .
|
||||
"temp_tree.".$this->options['structure']["position"]." AS lid " .
|
||||
"FROM temp_stack, temp_tree " .
|
||||
"WHERE " .
|
||||
"temp_stack.".$this->options['structure']["id"]." = temp_tree.".$this->options['structure']["parent_id"]." AND " .
|
||||
"temp_stack.stack_top = ".$currenttop." " .
|
||||
"ORDER BY temp_tree.".$this->options['structure']["position"]." ASC LIMIT 1"
|
||||
)) { return false; }
|
||||
|
||||
if($this->db->nextr()) {
|
||||
$tmp = $this->db->f("tempmin");
|
||||
|
||||
$q = "INSERT INTO temp_stack (stack_top, ".$this->options['structure']["id"].", ".$this->options['structure']["left"].", ".$this->options['structure']["right"].", ".$this->options['structure']["level"].", ".$this->options['structure']["parent_id"].", ".$this->options['structure']["position"].") VALUES(".($currenttop + 1).", ".$tmp.", ".$counter.", NULL, ".$currenttop.", ".$this->db->f("pid").", ".$this->db->f("lid").")";
|
||||
if(!$this->db->query($q)) {
|
||||
return false;
|
||||
}
|
||||
if(!$this->db->query("DELETE FROM temp_tree WHERE ".$this->options['structure']["id"]." = ".$tmp)) {
|
||||
return false;
|
||||
}
|
||||
$counter++;
|
||||
$currenttop++;
|
||||
}
|
||||
else {
|
||||
if(!$this->db->query("" .
|
||||
"UPDATE temp_stack SET " .
|
||||
"".$this->options['structure']["right"]." = ".$counter.", " .
|
||||
"stack_top = -stack_top " .
|
||||
"WHERE stack_top = ".$currenttop
|
||||
)) { return false; }
|
||||
$counter++;
|
||||
$currenttop--;
|
||||
}
|
||||
}
|
||||
|
||||
$temp_fields = $this->options['structure'];
|
||||
unset($temp_fields["parent_id"]);
|
||||
unset($temp_fields["position"]);
|
||||
unset($temp_fields["left"]);
|
||||
unset($temp_fields["right"]);
|
||||
unset($temp_fields["level"]);
|
||||
if(count($temp_fields) > 1) {
|
||||
if(!$this->db->query("" .
|
||||
"CREATE TEMPORARY TABLE temp_tree2 " .
|
||||
"SELECT ".implode(", ", $temp_fields)." FROM ".$this->options['structure_table']." "
|
||||
)) { return false; }
|
||||
}
|
||||
if(!$this->db->query("TRUNCATE TABLE ".$this->options['structure_table']."")) {
|
||||
return false;
|
||||
}
|
||||
if(!$this->db->query("" .
|
||||
"INSERT INTO ".$this->options['structure_table']." (" .
|
||||
"".$this->options['structure']["id"].", " .
|
||||
"".$this->options['structure']["parent_id"].", " .
|
||||
"".$this->options['structure']["position"].", " .
|
||||
"".$this->options['structure']["left"].", " .
|
||||
"".$this->options['structure']["right"].", " .
|
||||
"".$this->options['structure']["level"]." " .
|
||||
") " .
|
||||
"SELECT " .
|
||||
"".$this->options['structure']["id"].", " .
|
||||
"".$this->options['structure']["parent_id"].", " .
|
||||
"".$this->options['structure']["position"].", " .
|
||||
"".$this->options['structure']["left"].", " .
|
||||
"".$this->options['structure']["right"].", " .
|
||||
"".$this->options['structure']["level"]." " .
|
||||
"FROM temp_stack " .
|
||||
"ORDER BY ".$this->options['structure']["id"].""
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
if(count($temp_fields) > 1) {
|
||||
$sql = "" .
|
||||
"UPDATE ".$this->options['structure_table']." v, temp_tree2 SET v.".$this->options['structure']["id"]." = v.".$this->options['structure']["id"]." ";
|
||||
foreach($temp_fields as $k => $v) {
|
||||
if($k == "id") continue;
|
||||
$sql .= ", v.".$v." = temp_tree2.".$v." ";
|
||||
}
|
||||
$sql .= " WHERE v.".$this->options['structure']["id"]." = temp_tree2.".$this->options['structure']["id"]." ";
|
||||
if(!$this->db->query($sql)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// fix positions
|
||||
$nodes = $this->db->get("SELECT ".$this->options['structure']['id'].", ".$this->options['structure']['parent_id']." FROM ".$this->options['structure_table']." ORDER BY ".$this->options['structure']['parent_id'].", ".$this->options['structure']['position']);
|
||||
$last_parent = false;
|
||||
$last_position = false;
|
||||
foreach($nodes as $node) {
|
||||
if((int)$node[$this->options['structure']['parent_id']] !== $last_parent) {
|
||||
$last_position = 0;
|
||||
$last_parent = (int)$node[$this->options['structure']['parent_id']];
|
||||
}
|
||||
$this->db->query("UPDATE ".$this->options['structure_table']." SET ".$this->options['structure']['position']." = ".$last_position." WHERE ".$this->options['structure']['id']." = ".(int)$node[$this->options['structure']['id']]);
|
||||
$last_position++;
|
||||
}
|
||||
if($this->options['data_table'] != $this->options['structure_table']) {
|
||||
// fix missing data records
|
||||
$this->db->query("
|
||||
INSERT INTO
|
||||
".$this->options['data_table']." (".implode(',',$this->options['data']).")
|
||||
SELECT ".$this->options['structure']['id']." ".str_repeat(", ".$this->options['structure']['id'], count($this->options['data']) - 1)."
|
||||
FROM ".$this->options['structure_table']." s
|
||||
WHERE (SELECT COUNT(".$this->options['data2structure'].") FROM ".$this->options['data_table']." WHERE ".$this->options['data2structure']." = s.".$this->options['structure']['id'].") = 0 "
|
||||
);
|
||||
// remove dangling data records
|
||||
$this->db->query("
|
||||
DELETE FROM
|
||||
".$this->options['data_table']."
|
||||
WHERE
|
||||
(SELECT COUNT(".$this->options['structure']['id'].") FROM ".$this->options['structure_table']." WHERE ".$this->options['structure']['id']." = ".$this->options['data_table'].".".$this->options['data2structure'].") = 0
|
||||
");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function res($data = array()) {
|
||||
if(!$this->db->query("TRUNCATE TABLE ".$this->options['structure_table'])) { return false; }
|
||||
if(!$this->db->query("TRUNCATE TABLE ".$this->options['data_table'])) { return false; }
|
||||
$sql = "INSERT INTO ".$this->options['structure_table']." (".implode(",", $this->options['structure']).") VALUES (?".str_repeat(',?', count($this->options['structure']) - 1).")";
|
||||
$par = array();
|
||||
foreach($this->options['structure'] as $k => $v) {
|
||||
switch($k) {
|
||||
case 'id':
|
||||
$par[] = null;
|
||||
break;
|
||||
case 'left':
|
||||
$par[] = 1;
|
||||
break;
|
||||
case 'right':
|
||||
$par[] = 2;
|
||||
break;
|
||||
case 'level':
|
||||
$par[] = 0;
|
||||
break;
|
||||
case 'parent_id':
|
||||
$par[] = 0;
|
||||
break;
|
||||
case 'position':
|
||||
$par[] = 0;
|
||||
break;
|
||||
default:
|
||||
$par[] = null;
|
||||
}
|
||||
}
|
||||
if(!$this->db->query($sql, $par)) { return false; }
|
||||
$id = $this->db->insert_id();
|
||||
foreach($this->options['structure'] as $k => $v) {
|
||||
if(!isset($data[$k])) { $data[$k] = null; }
|
||||
}
|
||||
return $this->rn($id, $data);
|
||||
}
|
||||
|
||||
public function dump() {
|
||||
$nodes = $this->db->get("
|
||||
SELECT
|
||||
s.".implode(", s.", $this->options['structure']).",
|
||||
d.".implode(", d.", $this->options['data'])."
|
||||
FROM
|
||||
".$this->options['structure_table']." s,
|
||||
".$this->options['data_table']." d
|
||||
WHERE
|
||||
s.".$this->options['structure']['id']." = d.".$this->options['data2structure']."
|
||||
ORDER BY ".$this->options['structure']["left"]
|
||||
);
|
||||
echo "\n\n";
|
||||
foreach($nodes as $node) {
|
||||
echo str_repeat(" ",(int)$node[$this->options['structure']["level"]] * 2);
|
||||
echo $node[$this->options['structure']["id"]]." ".$node["nm"]." (".$node[$this->options['structure']["left"]].",".$node[$this->options['structure']["right"]].",".$node[$this->options['structure']["level"]].",".$node[$this->options['structure']["parent_id"]].",".$node[$this->options['structure']["position"]].")" . "\n";
|
||||
}
|
||||
echo str_repeat("-",40);
|
||||
echo "\n\n";
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
-- phpMyAdmin SQL Dump
|
||||
-- version 4.0.1
|
||||
-- http://www.phpmyadmin.net
|
||||
--
|
||||
-- Host: 127.0.0.1
|
||||
-- Generation Time: Apr 15, 2014 at 05:14 PM
|
||||
-- Server version: 5.5.27
|
||||
-- PHP Version: 5.4.7
|
||||
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
--
|
||||
-- Database: `test`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `tree_data`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tree_data` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`nm` varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tree_data`
|
||||
--
|
||||
|
||||
INSERT INTO `tree_data` (`id`, `nm`) VALUES
|
||||
(1, 'root'),
|
||||
(1063, 'Node 12'),
|
||||
(1064, 'Node 2'),
|
||||
(1065, 'Node 3'),
|
||||
(1066, 'Node 4'),
|
||||
(1067, 'Node 5'),
|
||||
(1068, 'Node 6'),
|
||||
(1069, 'Node 7'),
|
||||
(1070, 'Node 8'),
|
||||
(1071, 'Node 9'),
|
||||
(1072, 'Node 9'),
|
||||
(1073, 'Node 9'),
|
||||
(1074, 'Node 9'),
|
||||
(1075, 'Node 7'),
|
||||
(1076, 'Node 8'),
|
||||
(1077, 'Node 9'),
|
||||
(1078, 'Node 9'),
|
||||
(1079, 'Node 9');
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Table structure for table `tree_struct`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tree_struct` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`lft` int(10) unsigned NOT NULL,
|
||||
`rgt` int(10) unsigned NOT NULL,
|
||||
`lvl` int(10) unsigned NOT NULL,
|
||||
`pid` int(10) unsigned NOT NULL,
|
||||
`pos` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1083 ;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tree_struct`
|
||||
--
|
||||
|
||||
INSERT INTO `tree_struct` (`id`, `lft`, `rgt`, `lvl`, `pid`, `pos`) VALUES
|
||||
(1, 1, 36, 0, 0, 0),
|
||||
(1063, 2, 31, 1, 1, 0),
|
||||
(1064, 3, 30, 2, 1063, 0),
|
||||
(1065, 4, 29, 3, 1064, 0),
|
||||
(1066, 5, 28, 4, 1065, 0),
|
||||
(1067, 6, 19, 5, 1066, 0),
|
||||
(1068, 7, 18, 6, 1067, 0),
|
||||
(1069, 8, 17, 7, 1068, 0),
|
||||
(1070, 9, 16, 8, 1069, 0),
|
||||
(1071, 12, 13, 9, 1070, 1),
|
||||
(1072, 14, 15, 9, 1070, 2),
|
||||
(1073, 10, 11, 9, 1070, 0),
|
||||
(1074, 32, 35, 1, 1, 1),
|
||||
(1075, 20, 27, 5, 1066, 1),
|
||||
(1076, 21, 26, 6, 1075, 0),
|
||||
(1077, 24, 25, 7, 1076, 1),
|
||||
(1078, 33, 34, 2, 1074, 0),
|
||||
(1079, 22, 23, 7, 1076, 0);
|
||||
@@ -1,172 +0,0 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . '/class.db.php');
|
||||
require_once(dirname(__FILE__) . '/class.tree.php');
|
||||
|
||||
if(isset($_GET['operation'])) {
|
||||
$fs = new tree(db::get('mysqli://root@127.0.0.1/test'), array('structure_table' => 'tree_struct', 'data_table' => 'tree_data', 'data' => array('nm')));
|
||||
try {
|
||||
$rslt = null;
|
||||
switch($_GET['operation']) {
|
||||
case 'analyze':
|
||||
var_dump($fs->analyze(true));
|
||||
die();
|
||||
break;
|
||||
case 'get_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$temp = $fs->get_children($node);
|
||||
$rslt = array();
|
||||
foreach($temp as $v) {
|
||||
$rslt[] = array('id' => $v['id'], 'text' => $v['nm'], 'children' => ($v['rgt'] - $v['lft'] > 1));
|
||||
}
|
||||
break;
|
||||
case "get_content":
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : 0;
|
||||
$node = explode(':', $node);
|
||||
if(count($node) > 1) {
|
||||
$rslt = array('content' => 'Multiple selected');
|
||||
}
|
||||
else {
|
||||
$temp = $fs->get_node((int)$node[0], array('with_path' => true));
|
||||
$rslt = array('content' => 'Selected: /' . implode('/',array_map(function ($v) { return $v['nm']; }, $temp['path'])). '/'.$temp['nm']);
|
||||
}
|
||||
break;
|
||||
case 'create_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$temp = $fs->mk($node, isset($_GET['position']) ? (int)$_GET['position'] : 0, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'New node'));
|
||||
$rslt = array('id' => $temp);
|
||||
break;
|
||||
case 'rename_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$rslt = $fs->rn($node, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'Renamed node'));
|
||||
break;
|
||||
case 'delete_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$rslt = $fs->rm($node);
|
||||
break;
|
||||
case 'move_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int)$_GET['parent'] : 0;
|
||||
$rslt = $fs->mv($node, $parn, isset($_GET['position']) ? (int)$_GET['position'] : 0);
|
||||
break;
|
||||
case 'copy_node':
|
||||
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
|
||||
$parn = isset($_GET['parent']) && $_GET['parent'] !== '#' ? (int)$_GET['parent'] : 0;
|
||||
$rslt = $fs->cp($node, $parn, isset($_GET['position']) ? (int)$_GET['position'] : 0);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unsupported operation: ' . $_GET['operation']);
|
||||
break;
|
||||
}
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($rslt);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
header($_SERVER["SERVER_PROTOCOL"] . ' 500 Server Error');
|
||||
header('Status: 500 Server Error');
|
||||
echo $e->getMessage();
|
||||
}
|
||||
die();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Title</title>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="stylesheet" href="./../../dist/themes/default/style.min.css" />
|
||||
<style>
|
||||
html, body { background:#ebebeb; font-size:10px; font-family:Verdana; margin:0; padding:0; }
|
||||
#container { min-width:320px; margin:0px auto 0 auto; background:white; border-radius:0px; padding:0px; overflow:hidden; }
|
||||
#tree { float:left; min-width:319px; border-right:1px solid silver; overflow:auto; padding:0px 0; }
|
||||
#data { margin-left:320px; }
|
||||
#data textarea { margin:0; padding:0; height:100%; width:100%; border:0; background:white; display:block; line-height:18px; }
|
||||
#data, #code { font: normal normal normal 12px/18px 'Consolas', monospace !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container" role="main">
|
||||
<div id="tree"></div>
|
||||
<div id="data">
|
||||
<div class="content code" style="display:none;"><textarea id="code" readonly="readonly"></textarea></div>
|
||||
<div class="content folder" style="display:none;"></div>
|
||||
<div class="content image" style="display:none; position:relative;"><img src="" alt="" style="display:block; position:absolute; left:50%; top:50%; padding:0; max-height:90%; max-width:90%;" /></div>
|
||||
<div class="content default" style="text-align:center;">Select a node from the tree.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
|
||||
<script src="./../../dist/jstree.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$(window).resize(function () {
|
||||
var h = Math.max($(window).height() - 0, 420);
|
||||
$('#container, #data, #tree, #data .content').height(h).filter('.default').css('lineHeight', h + 'px');
|
||||
}).resize();
|
||||
|
||||
$('#tree')
|
||||
.jstree({
|
||||
'core' : {
|
||||
'data' : {
|
||||
'url' : '?operation=get_node',
|
||||
'data' : function (node) {
|
||||
return { 'id' : node.id };
|
||||
}
|
||||
},
|
||||
'check_callback' : true,
|
||||
'themes' : {
|
||||
'responsive' : false
|
||||
}
|
||||
},
|
||||
'force_text' : true,
|
||||
'plugins' : ['state','dnd','contextmenu','wholerow']
|
||||
})
|
||||
.on('delete_node.jstree', function (e, data) {
|
||||
$.get('?operation=delete_node', { 'id' : data.node.id })
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('create_node.jstree', function (e, data) {
|
||||
$.get('?operation=create_node', { 'id' : data.node.parent, 'position' : data.position, 'text' : data.node.text })
|
||||
.done(function (d) {
|
||||
data.instance.set_id(data.node, d.id);
|
||||
})
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('rename_node.jstree', function (e, data) {
|
||||
$.get('?operation=rename_node', { 'id' : data.node.id, 'text' : data.text })
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('move_node.jstree', function (e, data) {
|
||||
$.get('?operation=move_node', { 'id' : data.node.id, 'parent' : data.parent, 'position' : data.position })
|
||||
.fail(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('copy_node.jstree', function (e, data) {
|
||||
$.get('?operation=copy_node', { 'id' : data.original.id, 'parent' : data.parent, 'position' : data.position })
|
||||
.always(function () {
|
||||
data.instance.refresh();
|
||||
});
|
||||
})
|
||||
.on('changed.jstree', function (e, data) {
|
||||
if(data && data.selected && data.selected.length) {
|
||||
$.get('?operation=get_content&id=' + data.selected.join(':'), function (d) {
|
||||
$('#data .default').text(d.content).show();
|
||||
});
|
||||
}
|
||||
else {
|
||||
$('#data .content').hide();
|
||||
$('#data .default').text('Select a file from the tree.').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,10 +1,6 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
if( $_GET['id'] == '#')
|
||||
echo '[{"id":1,"text":"RootDN","children":[{"id":2,"text":"Serveurs","children":true},{"id":3,"text":"Child node 2"}]}]';
|
||||
echo '[{"id":1,"text":"RootDN","children":[{"id":2,"text":"Serveurs","children":true},{"id":3,"text":"Kubernetes"}]}]';
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 47 KiB |
@@ -0,0 +1,230 @@
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WRL2l2eY.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WRP2l2eY.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WR32lw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp2I7WRL2l2eY.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp2I7WRP2l2eY.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Inconsolata';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-stretch: normal;
|
||||
src: url(https://fonts.gstatic.com/s/inconsolata/v20/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp2I7WR32lw.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u8w4BMUTPHjxsAUi-qJCY.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u8w4BMUTPHjxsAXC-q.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u_w4BMUTPHjxsI5wq_FQft1dw.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: italic;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u_w4BMUTPHjxsI5wq_Gwft.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6uyw4BMUTPHjxAwXjeu.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6uyw4BMUTPHjx4wXg.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh6UVSwaPGR_p.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Lato';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/lato/v17/S6u9w4BMUTPHh6UVSwiPGQ.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmYmRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISma2RjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmY2RjRdE.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmbGRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmYGRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmYWRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjojISmb2Rj.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* cyrillic-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4OmYmRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
/* cyrillic */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4Oma2RjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
/* greek-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4OmY2RjRdE.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
/* greek */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4OmbGRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
/* vietnamese */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4OmYGRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
/* latin-ext */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4OmYWRjRdE.woff2) format('woff2');
|
||||
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Roboto Slab';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
src: url(https://fonts.gstatic.com/s/robotoslab/v12/BngbUXZYTXPIvIBgJJSb6s3BzlRRfKOFbvjoa4Omb2Rj.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
@charset "UTF-8";
|
||||
/*!
|
||||
* jQuery contextMenu - Plugin for simple contextMenu handling
|
||||
*
|
||||
* Version: v2.7.1
|
||||
*
|
||||
* Authors: Björn Brala (SWIS.nl), Rodney Rehm, Addy Osmani (patches for FF)
|
||||
* Web: http://swisnl.github.io/jQuery-contextMenu/
|
||||
*
|
||||
* Copyright (c) 2011-2018 SWIS BV and contributors
|
||||
*
|
||||
* Licensed under
|
||||
* MIT License http://www.opensource.org/licenses/mit-license
|
||||
*
|
||||
* Date: 2018-11-29T10:56:47.812Z
|
||||
*/
|
||||
@-webkit-keyframes cm-spin {
|
||||
0% {
|
||||
-webkit-transform: translateY(-50%) rotate(0deg);
|
||||
transform: translateY(-50%) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translateY(-50%) rotate(359deg);
|
||||
transform: translateY(-50%) rotate(359deg);
|
||||
}
|
||||
}
|
||||
@-o-keyframes cm-spin {
|
||||
0% {
|
||||
-webkit-transform: translateY(-50%) rotate(0deg);
|
||||
-o-transform: translateY(-50%) rotate(0deg);
|
||||
transform: translateY(-50%) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translateY(-50%) rotate(359deg);
|
||||
-o-transform: translateY(-50%) rotate(359deg);
|
||||
transform: translateY(-50%) rotate(359deg);
|
||||
}
|
||||
}
|
||||
@keyframes cm-spin {
|
||||
0% {
|
||||
-webkit-transform: translateY(-50%) rotate(0deg);
|
||||
-o-transform: translateY(-50%) rotate(0deg);
|
||||
transform: translateY(-50%) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translateY(-50%) rotate(359deg);
|
||||
-o-transform: translateY(-50%) rotate(359deg);
|
||||
transform: translateY(-50%) rotate(359deg);
|
||||
}
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "context-menu-icons";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
|
||||
src: url("../fonts/context-menu-icons.eot?2gb3e");
|
||||
src: url("../fonts/context-menu-icons.eot?2gb3e#iefix") format("embedded-opentype"), url("../fonts/context-menu-icons.woff2?2gb3e") format("woff2"), url("../fonts/context-menu-icons.woff?2gb3e") format("woff"), url("../fonts/context-menu-icons.ttf?2gb3e") format("truetype");
|
||||
}
|
||||
|
||||
.context-menu-icon-add:before {
|
||||
content: "\EA01";
|
||||
}
|
||||
|
||||
.context-menu-icon-copy:before {
|
||||
content: "\EA02";
|
||||
}
|
||||
|
||||
.context-menu-icon-cut:before {
|
||||
content: "\EA03";
|
||||
}
|
||||
|
||||
.context-menu-icon-delete:before {
|
||||
content: "\EA04";
|
||||
}
|
||||
|
||||
.context-menu-icon-edit:before {
|
||||
content: "\EA05";
|
||||
}
|
||||
|
||||
.context-menu-icon-loading:before {
|
||||
content: "\EA06";
|
||||
}
|
||||
|
||||
.context-menu-icon-paste:before {
|
||||
content: "\EA07";
|
||||
}
|
||||
|
||||
.context-menu-icon-quit:before {
|
||||
content: "\EA08";
|
||||
}
|
||||
|
||||
.context-menu-icon::before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
width: 2em;
|
||||
font-family: "context-menu-icons";
|
||||
font-size: 1em;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
color: #2980b9;
|
||||
text-align: center;
|
||||
-webkit-transform: translateY(-50%);
|
||||
-ms-transform: translateY(-50%);
|
||||
-o-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.context-menu-icon.context-menu-hover:before {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.context-menu-icon.context-menu-disabled::before {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.context-menu-icon.context-menu-icon-loading:before {
|
||||
-webkit-animation: cm-spin 2s infinite;
|
||||
-o-animation: cm-spin 2s infinite;
|
||||
animation: cm-spin 2s infinite;
|
||||
}
|
||||
|
||||
.context-menu-icon.context-menu-icon--fa {
|
||||
display: list-item;
|
||||
font-family: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa::before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
width: 2em;
|
||||
font-family: FontAwesome;
|
||||
font-size: 1em;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
color: #2980b9;
|
||||
text-align: center;
|
||||
-webkit-transform: translateY(-50%);
|
||||
-ms-transform: translateY(-50%);
|
||||
-o-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa.context-menu-hover:before {
|
||||
color: #fff;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa.context-menu-disabled::before {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.context-menu-icon.context-menu-icon--fa5 {
|
||||
display: list-item;
|
||||
font-family: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa5 i, .context-menu-icon.context-menu-icon--fa5 svg {
|
||||
position: absolute;
|
||||
top: .3em;
|
||||
left: .5em;
|
||||
color: #2980b9;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa5.context-menu-hover > i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover > svg {
|
||||
color: #fff;
|
||||
}
|
||||
.context-menu-icon.context-menu-icon--fa5.context-menu-disabled i, .context-menu-icon.context-menu-icon--fa5.context-menu-disabled svg {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.context-menu-list {
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
min-width: 13em;
|
||||
max-width: 26em;
|
||||
padding: .25em 0;
|
||||
margin: .3em;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
list-style-type: none;
|
||||
background: #fff;
|
||||
border: 1px solid #bebebe;
|
||||
border-radius: .2em;
|
||||
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
|
||||
}
|
||||
|
||||
.context-menu-item {
|
||||
position: relative;
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
padding: .2em 2em;
|
||||
color: #2f2f2f;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.context-menu-separator {
|
||||
padding: 0;
|
||||
margin: .35em 0;
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
}
|
||||
|
||||
.context-menu-item > label > input,
|
||||
.context-menu-item > label > textarea {
|
||||
-webkit-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.context-menu-item.context-menu-hover {
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
.context-menu-item.context-menu-disabled {
|
||||
color: #bbb;
|
||||
cursor: default;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.context-menu-input.context-menu-hover {
|
||||
color: #2f2f2f;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.context-menu-submenu:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: .5em;
|
||||
z-index: 1;
|
||||
width: 0;
|
||||
height: 0;
|
||||
content: '';
|
||||
border-color: transparent transparent transparent #2f2f2f;
|
||||
border-style: solid;
|
||||
border-width: .25em 0 .25em .25em;
|
||||
-webkit-transform: translateY(-50%);
|
||||
-ms-transform: translateY(-50%);
|
||||
-o-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inputs
|
||||
*/
|
||||
.context-menu-item.context-menu-input {
|
||||
padding: .3em .6em;
|
||||
}
|
||||
|
||||
/* vertically align inside labels */
|
||||
.context-menu-input > label > * {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* position checkboxes and radios as icons */
|
||||
.context-menu-input > label > input[type="checkbox"],
|
||||
.context-menu-input > label > input[type="radio"] {
|
||||
position: relative;
|
||||
top: .12em;
|
||||
margin-right: .4em;
|
||||
}
|
||||
|
||||
.context-menu-input > label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.context-menu-input > label,
|
||||
.context-menu-input > label > input[type="text"],
|
||||
.context-menu-input > label > textarea,
|
||||
.context-menu-input > label > select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.context-menu-input > label > textarea {
|
||||
height: 7em;
|
||||
}
|
||||
|
||||
.context-menu-item > .context-menu-list {
|
||||
top: .3em;
|
||||
/* re-positioned by js */
|
||||
right: -.3em;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.context-menu-item.context-menu-visible > .context-menu-list {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.context-menu-accesskey {
|
||||
text-decoration: underline;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,8 +1,3 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
/**
|
||||
* Exit program (logout)
|
||||
*
|
||||
@@ -13,15 +8,68 @@ function Quit()
|
||||
document.getElementById('formAction').submit();
|
||||
}
|
||||
|
||||
// Main Page
|
||||
$(function() {
|
||||
$('#jsTree').jstree({
|
||||
|
||||
// $(function() {
|
||||
// $.contextMenu({
|
||||
// selector: '#RootDN',
|
||||
// callback: function(key, options) {
|
||||
// var m = "clicked: " + key;
|
||||
// window.console && console.log(m) || alert(m);
|
||||
// },
|
||||
// items: {
|
||||
// "edit": {name: "Edit", icon: "edit"},
|
||||
// "cut": {name: "Cut", icon: "cut"},
|
||||
// copy: {name: "Copy", icon: "copy"},
|
||||
// "paste": {name: "Paste", icon: "paste"},
|
||||
// "delete": {name: "Delete", icon: "delete"},
|
||||
// "sep1": "---------",
|
||||
// "quit": {name: "Quit", icon: function(){
|
||||
// return 'context-menu-icon context-menu-icon-quit';
|
||||
// }}
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('.context-menu-one').on('click', function(e){
|
||||
// console.log('clicked', this);
|
||||
// })
|
||||
// });
|
||||
|
||||
|
||||
$('#jsTree')
|
||||
.jstree({
|
||||
'core' : {
|
||||
'data' : {
|
||||
"url" : "src/ajax.php?jstree=1",
|
||||
"data" : function (node) {
|
||||
return { "id" : node.id };
|
||||
'url' : 'src/ajax.php?operation=get_node',
|
||||
'data' : function (node) {
|
||||
return { 'id' : node.id };
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'contextmenu' : {
|
||||
'items' : function(node) {
|
||||
var tmp = $.jstree.defaults.contextmenu.items();
|
||||
delete tmp.create.action;
|
||||
tmp.create.label = "Ajouter";
|
||||
tmp.create.submenu = {
|
||||
"create_folder" : {
|
||||
"separator_after" : true,
|
||||
"label" : "Utilisateur",
|
||||
"action" : function (data) {
|
||||
alert('user');
|
||||
}
|
||||
},
|
||||
"create_file" : {
|
||||
"label" : "Machine",
|
||||
"action" : function (data) {
|
||||
alert('Machine');
|
||||
}
|
||||
}
|
||||
};
|
||||
return tmp;
|
||||
}
|
||||
},
|
||||
'plugins' : ['contextmenu']
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
Quit()
|
||||
------
|
||||
Exit program (logout)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<link href="vendor/twbs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="vendor/components/jquery/jquery.js" type="text/javascript"></script>
|
||||
<link href="src/css/login.css" rel="stylesheet">
|
||||
<script src="src/javascript/login.js" type="text/javascript"></script>
|
||||
</head>
|
||||
{if isset($error) }
|
||||
<body onload="onLoad();">
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{include file='header.smarty'}
|
||||
<script src="src/javascript/main.js"></script>
|
||||
<script src="src/javascript/main.js"></script>
|
||||
<script src="src/javascript/contextMenu.js"></script>
|
||||
<link href="src/css/contextMenu.css" rel="stylesheet" type="text/css" />
|
||||
<link href="src/css/contextFonts.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -44,7 +47,8 @@
|
||||
<!-- /Menu de l'application -->
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
||||
|
||||
<!-- <div class="col-md-12" id='RootDN'><span class="fa fa-globe"></span>RootDN</div> -->
|
||||
<div class="col-md-12" id='jsTree'> </div>
|
||||
|
||||
<input type='hidden' name='Action' id='Action' value='' />
|
||||
|
||||
+1
Submodule Sources/webAduc/www/src/tmp/jstree-php-demos added at 35dcdd7a4f
Reference in New Issue
Block a user