Commit f5e8d794 authored by Rene AJM Veerman's avatar Rene AJM Veerman

#siteManager drag and drop stability improved (eliminated above and beneath drop…

#siteManager drag and drop stability improved (eliminated above and beneath drop types for the jstree) - and start of ticket https://github.com/ibm-watson-data-lab/php-couchdb/issues/13 implementation
parent 699f2d18
......@@ -35,6 +35,12 @@ you'll need that to install couchdb on ubuntu 18.x
You'll also need to forward port 5984 from your internet modem to your web server,
much like you might need to forward port 80 or the HTTPS port.
* you'll need to add CORS to couchdb, which on ubuntu is done like so:
sudo su -
apt install npm
npm install -g add-cors-to-couchdb
add-cors-to-couchdb
* couchdb config files are in the root of the htdocs for seductiveapps,
https://gitlab.com/seductiveapps/seductiveapps/blob/master/config.localhost.couchdb.json and
https://gitlab.com/seductiveapps/seductiveapps/blob/master/config.seductiveapps.com.couchdb.json,
......
......@@ -42,7 +42,7 @@
'id' => 'bba',
'parent' => 'bab',
'text' => 'Blog',
'state' => [ 'opened' => true ],
'state' => [ 'opened' => true, 'selected' => true ],
'type' => 'saFolder'
]);
$db->create([
......
saTree = sa.tree = sa.t = {
about : {
copyright : 'Copyrighted (c) and All Rights Reserved (r) 2018 by Rene AJM Veerman from Amsterdam, Netherlands',
license : 'http://seductiveapps.com/LICENSE.txt'
},
globals : {
},
......@@ -10,7 +12,7 @@ saTree = sa.tree = sa.t = {
db : [],
pouchdb : {
pouchdb : { // javascript interface component towards couchdb no-sql/json-document database engine
address : function (databaseName, username, password) {
var r =
'http://'+(typeof username=='string' && username!=='' ? username : sa.a.settings.current.username)
......@@ -63,18 +65,41 @@ saTree = sa.tree = sa.t = {
jQuery('#siteManager__treeview__content').jstree({
'core' : {
"check_callback" : function (op, node, par, pos, more) {
if (op === 'move_node' && more.ref) {
return more.ref.type==='saFolder';
jQuery('#vakata-dnd').css ({ background : 'rgba(255,255,255,0.5)', fontWeight:'bold', zIndex : 99999999999 });
//console.log (more.pos, op, node, par, pos, more);
if (par.id==='#' || (more && more.ref && more.ref.id==='#')) {
return false;
}
if (op === 'move_node' && more && more.pos=='i') {
if (more.ref.type==='saFolder' || more.ref.type==='saUserRootFolder') {
sa.tree.settings.current.draggedOnto = more.ref;
}
return true;
}
if (op === 'move_node' && more && (more.pos=='b' || more.pos=='a')) {
if (more.ref.type==='saFolder' || more.ref.type==='saUserRootFolder') {
sa.tree.settings.current.draggedOnto = more.ref;
}
return true;
}
if (op === 'move_node' && more && more.ref) {
var r = more.ref.type==='saFolder' || more.ref.type==='saUserRootFolder';
return r;
}
debugger;
if (op === 'move_node' && !more.ref) {
if (op === 'move_node' && more && !more.ref) {
var
fromPath = sa.tree.currentPath(node),
toPath = sa.tree.currentPath(par);
toPath = sa.tree.currentPath(sa.tree.settings.current.draggedOnto);
console.log (toPath);
//debugger;
return false;
//if (node.type==='saFolder') {
debugger;
var
ajaxCommand = {
type : 'POST',
......@@ -138,7 +163,6 @@ saTree = sa.tree = sa.t = {
},
'multiple' : false,
"types" : {
'valid_children' : ['saFolder'],
"saSystemFolder" : {
"icon" : "/seductiveapps/siteMedia/sa.view.tree.saSystemFolder.png",
"valid_children" : []
......
{"http":"http:\/\/","adminUsername":"admin","adminPassword":"postm4n","domain":"localhost","port":"5984"}
\ No newline at end of file
......@@ -174,4 +174,16 @@ class Server
{
return $this->client;
}
// begin of contribution by seductiveapps@gmail.com
public function getAdmins() {
$endpoint = "/_node/nonode@nohost/_config/admins";
$verb = "GET";
$response = $this->client->request($verb, $endpoint);
return $response;
}
// end of contribution by seductiveapps@gmail.com
}
......@@ -174,4 +174,17 @@ class Server
{
return $this->client;
}
// begin of contribution by seductiveapps@gmail.com
public function getAdmins() {
$endpoint = "/_node/couchdb@127.0.0.1/_config/admins";
$verb = "GET";
$response = $this->client->request($verb, $endpoint);
return $response->getBody();
}
// end of contribution by seductiveapps@gmail.com
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment