var EventEmitter = require("events").EventEmitter;
var opath = require("opath");
var async = require("async");
var tool = require("tools2")();
var getthezip = require("libs/getthezip");
var unpackzip = require("libs/unpackzip");
var generatezip = require("libs/generatezip");
var random = require("sharedkey-thing").randoma(0xbadebabe)("#CHANGE BEFORE CHRISTMAS#");
var _ = require("lodash");
var templates = require("./templates");
var ignores =
"_created _data _events _extends _hasa _inherits _isa _maxListeners _metas _references _relations _rootname addListener children data data2 domain emit emita emitas eventNames export export2 exportFlatSync exportSerialised exportSync exporta extends getMaxListeners getStuff getStuff2 getStuff3 inherits innerExport isa listenerCount listeners metas metas2 metas3 name on once parents path pickdeep pingup prependListener prependOnceListener rawListeners relatesAsToWith removeAllListeners removeListener setMaxListeners test unextends uninherits unisa withAll withAllSync"
.split(" ");
function template_helpers(self) {
return {
"toTextArea": function(str) {
return ''
},
"toWrap": function(str, tag, attr) {
return '<' + tag + ' ' + attr + '>' + str + '' + tag + '>';
},
toLowerCase: function(str) {
return str.toLowerCase();
},
toUpperCase: function(str) {
return str.toUpperCase();
},
"pagecontent": function(obj) {
console.log("pagecontent", obj, arguments);
return self.template(obj._data.content, obj);
},
"siblings": function(obj) {
return [_.keys(obj.parents).shift()].map(function(parentpath) {
var ares = _.map(obj.parents[parentpath] ? obj.parents[parentpath].children : [], function(a) {
return a();
})
ares.sort(sorter(function(a) {
return a._metas.menu_order || 100
}, -1));
var ss = _.map(ares, function(child, name) {
return child.path
});
if (ss.length > 12) {
var cindex = ss.indexOf(obj.path);
cindex = cindex < 6 ? 6 : cindex;
var spp = _.map(ares, renderlin(obj))
var sasa = [].concat(spp.slice(cindex - 6, cindex + 7))
} else {
var sasa = _.map(ares, renderlin(obj))
}
return sasa.join("\n")
}).join("\n")
},
"parents": function(obj, ss_, sss_) {
if (typeof(ss_) !== "undefined" && typeof(sss_) !== "undefined") {
return gpath(obj, []).slice(parseInt(ss_), parseInt(sss_)).map(function(p, i) {
return '' +
self.oget(p +
"/._data.title", p) + ' ';
}).join("\n");
} else {
return gpath(obj, []).slice(1).map(function(p, i) {
return '' +
self.oget(p +
"/._data.title", p) + ' ';
}).join("\n");
}
},
"parent": function(obj) {
return _.map(obj.parents, function(par, nam) {
self.rendertemplate(par)
}).join("\n");
},
"children2": function(obj) {
var ret = [];
_.map(obj.children, function(child) {
var cho = typeof(child) === "function" ? child() : child;
ret.push(self.rendertemplate(cho))
})
return ret.join("\n")
},
"children": function(obj) {
var ret = [];
_.map(obj.children, function(child) {
var cho = typeof(child) === "function" ? child() : child;
ret.push(renderlin(cho)(cho, cho.name))
})
return ret.join("\n");
},
"relations": function(obj) {
var stash = [];
_.map(obj._relations, function(rels, relname) {
var relators = _.keys(rels);
var sss = relators.slice(0, 25).map(function(relator) {
return '
{{body}}', {body: con(), name: name, });
}).join("\n");
*/
var str = "";
if (self.current_tab) {} else {
self.current_tab = self.editorContexts[0].name;
}
str = self.editorContexts.filter((con) => con.name === self.current_tab).pop().func(obj, types);
return tabs_links + '
' + str + '
';
}
Asystem.prototype.editorTypes = function() {
var self = this;
var types = {
jsfuncs: function(obj, fiels) {
var qq = [];
_.map(_.omit(obj, ignores), function(val, prop) {
if (typeof(val) === "function") {
qq.push(["JS " + prop + '
Delete ',
"
'
]);
}
})
qq.push(["JS ", "
"]);
var ss = ('
' + qq.map(function(a) {
return '
' + (a[0] === false ? "" : a[0] + "") + '
' + a[1] +
'
'
}).join("\n") + '
');
return ss
},
relations: function(obj, field) {
var s = "";
var ss = []
_.map(obj._relations, function(rels, relname) {
var relators = _.keys(rels);
var sss = relators.slice(0, 25).map(function(relator) {
return '
' + relator + ' X '
}).join("\n");;
ss.push([relname + "(" + relators.length + ")", sss]);
});
s += ss.map(function(a) {
return '
'
}).join("\n")
return s;
},
relationsadd: function(obj, field) {
var s = "";
s += '
' +
' to: as: with: Relate ';
return s;
},
templatepaths: function(obj, field) {
return "
" + _.map(self.getRenderTemplate(obj), function(a) {
return '
' +
a.name +
' '
}).join("\n");
},
visa: function(obj, field) {
function mkaa(obja) {
}
setTimeout(function() {
var cols = {
parent: "#000000",
child: "#ff00ff",
extends: "#00ff00",
inherits: "#ff0000",
isa: "#ff9900",
hasa: "#00ff99"
}
function lokup(tp) {
return cols[tp];
}
var graph = Viva.Graph.graph();
var graphics = Viva.Graph.View.svgGraphics(),
nodeSize = 10;
self.allchildren().filter(function(c) {
return c.path.indexOf("trash/") === -1 && c.path.indexOf("folders/") === -1 && c.path.indexOf("blobs/") === -1
}).slice(0, 100).map(function(c) {
graph.addNode(c.path);
_.map(c.children, function(child, name) {
graph.addLink(c.path, child().path, 'child')
});
_.map(c._isa, function(child, name) {
graph.addLink(c.path, child.path, 'isa')
});
_.map(c._hasa, function(child, name) {
graph.addLink(c.path, child.path, 'hasa')
});
_.map(c._extends, function(child, name) {
graph.addLink(c.path, child.path, 'extends')
});
_.map(c._inherits, function(child, name) {
graph.addLink( c.path,child.path, 'inherits')
});
_.map(c._relations, function(rels, relname) {
_.map(rels, function(child, name) {
graph.addLink(c.path, name, relname)
})
});
})
var a = obj.path
//graph.addNode(a, '91bad8ceeec43ae303790f8fe238164b');
/* _.map(obj.parents, function(parent, name) {
graph.addNode(name, '');
graph.addLink(name, a, 'parent')
});
*/
/*
var ogs = gpath(obj, []);
console.log("OOOOOOOOOOOO", ogs);
var roo = obj.path,
nexta;
graph.addNode(roo, '');
while (ogs.length) {
nexta = ogs.shift();
graph.addLink(roo, nexta, 'parent')
roo = nexta;
}
roo = obj.path
_.map(obj.children, function(child, name) {
graph.addNode(name, '');
graph.addLink(roo, name, 'child')
});
_.map(obj._isa, function(child, name) {
graph.addNode(name, '');
graph.addLink(roo, name, 'isa')
});
_.map(obj._hasa, function(child, name) {
graph.addNode(name, '');
graph.addLink(roo, name, 'hasa')
});
_.map(obj._extends, function(child, name) {
graph.addNode(name, '');
graph.addLink(roo, name, 'extends')
});
_.map(obj._inherits, function(child, name) {
graph.addNode(name, '');
graph.addLink(name, roo, 'inherits')
});
*/
var idas = 1;
var ida = function(){
return "ida"+(idas++)
}
graphics.node(function(node) {
var ui = Viva.Graph.svg('g');
var circle = Viva.Graph.svg('circle')
.attr('cx', 2)
.attr('cy', 2)
.attr('r', 2)
.attr('fill', obj.path === node.id ? "#ff0000" : "#dadada");
ui.append(circle);
var svgText = Viva.Graph.svg('text').attr('font-size', '12px').attr('y', '4px').text(node.id.split("/").pop());
ui.append(svgText);
return ui;
}).placeNode(function(nodeUI, pos) {
nodeUI.attr('transform',
'translate(' +
(pos.x - nodeSize / 2) + ',' + (pos.y - nodeSize / 2) +
')');
});
var createMarker = function(id) {
return Viva.Graph.svg('marker')
.attr('id', id)
.attr('viewBox', "0 0 10 10")
.attr('refX', "10")
.attr('refY', "5")
.attr('markerUnits', "strokeWidth")
.attr('markerWidth', "10")
.attr('markerHeight', "5")
.attr('orient', "auto");
},
marker = createMarker('Triangle');
marker.append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z');
// Marker should be defined only once in
child element of root element:
var defs = graphics.getSvgRoot().append('defs');
defs.append(marker);
var geom = Viva.Graph.geom();
graphics.link(function(link) {
// Notice the Triangle marker-end attribe:
var isParent = (link.data === 'parent');
var ui = Viva.Graph.svg('g');
var p = Viva.Graph.svg('path')
.attr('stroke', lokup(link.data) || "#000000")
.attr('fill', 'none')
.attr('marker-end', 'url(#Triangle)')
.attr('id', ida() )
ui.isParent = isParent; // remember for future.
ui.linka = link.data;
ui.ry = 50 //- (Math.random() * 100);
ui.pp = p;
var svgText = Viva.Graph.svg('text').attr("dy",-4).attr("class","slabel");
var textPath = Viva.Graph.svg("textPath");
textPath.attr("href","#"+p.id).attr("startOffset","25%").text( link.data+ " >");
svgText.append(textPath)
ui.tt = svgText;
////
// svgText.attr('xlink', link.id);
ui.append(svgText)
ui.append(p);
return ui;
}).placeLink(function(linkUI, fromPos, toPos) {
// using arc command: http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
//var data = 'M' + fromPos.x + ',' + fromPos.y +
// ' A 4,' + linkUI.ry + ',-' + linkUI.ry + ',0,1,' + toPos.x + ',' + toPos.y;
var data = 'M' + fromPos.x + ',' + fromPos.y +
' C ' + (fromPos.x+50)+' '+(fromPos.y+10)+','+ (toPos.x-50) + ' ' +(toPos.y-10) + ',' +toPos.x + ' ' + toPos.y ;
linkUI.pp.attr("d", data);
return;
// linkUI.tt.attr("y", ((fromPos.y + toPos.y) / 2) - linkUI.ry);
// linkUI.tt.attr("x", ((fromPos.x + toPos.x) / 2) );
if (linkUI.isParent) {
/* var ry = linkUI.isParent ? 4 : 0,
// using arc command: http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
data = 'M' + fromPos.x + ',' + fromPos.y +
' A 4,' + ry + ',-4,0,1,' + toPos.x + ',' + toPos.y;
linkUI.attr("d", data);
*/
var data = 'M' + fromPos.x + ',' + fromPos.y +
'L' + toPos.x + ',' + toPos.y;
linkUI.pp.attr("d", data);
}
if (linkUI.linka === 'isa') {
var data = 'M' + fromPos.x + ',' + fromPos.y +
'L' + toPos.x + ',' + toPos.y;
linkUI.pp.attr("d", data);
}
if (linkUI.linka === 'hasa') {
// var data = 'M' + fromPos.x + ',' + fromPos.y +
// 'L' + toPos.x + ',' + toPos.y;
var ry = 4;
// using arc command: http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
var data = 'M' + fromPos.x + ',' + fromPos.y +
' A 4,' + ry + ',-4,0,1,' + toPos.x + ',' + toPos.y;
linkUI.pp.attr("d", data);
}
if (linkUI.linka === 'inherits') {
var data = 'M' + fromPos.x + ',' + fromPos.y +
'L' + toPos.x + ',' + toPos.y;
linkUI.pp.attr("d", data);
}
if (linkUI.linka === 'extends') {
var data = 'M' + fromPos.x + ',' + fromPos.y +
'L' + toPos.x + ',' + toPos.y;
linkUI.pp.attr("d", data);
}
if (linkUI.linka === 'child') {
var toNodeSize = nodeSize,
fromNodeSize = nodeSize;
var from = geom.intersectRect(
// rectangle:
fromPos.x - fromNodeSize / 2, // left
fromPos.y - fromNodeSize / 2, // top
fromPos.x + fromNodeSize / 2, // right
fromPos.y + fromNodeSize / 2, // bottom
// segment:
fromPos.x, fromPos.y, toPos.x, toPos.y) || fromPos; // if no intersection found - return center of the node
var to = geom.intersectRect(
// rectangle:
toPos.x - toNodeSize / 2, // left
toPos.y - toNodeSize / 2, // top
toPos.x + toNodeSize / 2, // right
toPos.y + toNodeSize / 2, // bottom
// segment:
toPos.x, toPos.y, fromPos.x, fromPos.y) || toPos; // if no intersection found - return center of the node
var data = 'M' + from.x + ',' + from.y +
'L' + to.x + ',' + to.y;
linkUI.pp.attr("d", data);
}
});
// graph.addNode( b, 'd43e8ea63b61e7669ded5b9d3c2e980f');
// graph.addLink(a, b);
/*
graphics.link(function(link) {
var isParent = (link.data === 'parent'),
ui = Viva.Graph.svg('path')
.attr('stroke', isParent ? 'red' : 'blue')
.attr('fill', 'none');
ui.isParent = isParent; // remember for future.
return ui;
}).placeLink(function(linkUI, fromPos, toPos) {
// linkUI - is the object returend from link() callback above.
var ry = linkUI.isParent ? 10 : 0,
// using arc command: http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
data = 'M' + fromPos.x + ',' + fromPos.y +
' A 10,' + ry + ',-30,0,1,' + toPos.x + ',' + toPos.y;
// 'Path data' (http://www.w3.org/TR/SVG/paths.html#DAttribute )
// is a common way of rendering paths in SVG:
linkUI.attr("d", data);
});
*/
var layout = Viva.Graph.Layout.forceDirected(graph, {
springLength: 80,
springCoeff: 0.00001,
dragCoeff: 0.001,
gravity: -1.2
});
var renderer = Viva.Graph.View.renderer(graph, {
graphics: graphics,
container: document.getElementById('visagraf'),
layout: layout
});
renderer.run();
}, 200)
return 'v
'
},
meta: function(obj, field) {
return "
'
},
data: function(obj, field) {
return "
'
},
hasas: function(obj, field) {
return '' + _.map(obj._hasa, function(tob, name) {
return self.template(
'
{{name}} X ', {
tob: tob,
obj: obj,
name: name
});
}).join("\n") + '
'
},
isas: function(obj, field) {
return '' + _.map(obj._isa, function(tob, name) {
return self.template(
'
{{name}} X ', {
tob: tob,
obj: obj,
name: name
});
}).join("\n") + '
' + self.template(' ', {
obj: obj
});
},
extends: function(obj, field) {
return '' + _.map(obj._extends, function(tob, name) {
return self.template(
'
{{name}} X ', {
tob: tob,
obj: obj,
name: name
});
}).join("\n") + '
' + self.template(' ', {
obj: obj
});
},
inherits: function(obj, field) {
return '' + _.map(obj._inherits, function(tob, name) {
return self.template(
'
{{name}} X ', {
tob: tob,
obj: obj,
name: name
});
}).join("\n") + '
' + self.template(' ', {
obj: obj
});
},
children: function(obj, field) {
var s = '';
s += mmb("Add child", " ');
s += '' + _.map(obj.children, function(a) {
return a().path
}).map(function(k) {
return '
' + k +
' '
}).join("\n") + ' '
return s;
},
info: function(obj, field) {
return "Path: " + obj.path
},
upload: function(obj, field) {
return (
'Upload files
');
},
content: function(obj, field) {
var content_type = " ' + "
";
var s = '';
s += mmb("Title", types.propeditor(obj, {
"path": "_data.title"
}))
if (obj._metas.type && obj._metas.type == "html") {
s += mmb("Content", "')
} else {
s += mmb("Body", "')
}
s += mmb("Type", content_type);
return s;
},
template: function(obj, field) {
return "'
},
texteditor: function(obj, field) {
var s = "";
s += ''
return s
},
propeditor: function(obj, field) {
var s = "";
s += ' '
return s
},
lookup: function(obj, field) {
var temps = obj.getStuff3(field.path, function(a) {
return a
}, field.path)
var current_name = "",
current_data = "";
if (temps.length > 0) {
current_name = temps[0].name
current_data = temps[0].data;
}
var s = ''; //' '
var path = opath.get(obj, field.path);
if (current_name !== "" && !path) {
path = opath.get(self.oget(current_name), field.path);
s += ' inherit ' + path + ' ';
s += ' from ' + ' ' + current_name + ' '
} else {
if (!path) {
s += 'no object selected'
} else {
s += 'Current: ' + path + ' X ';
}
}
s += " ";
return s;
},
lookup2: function(obj, field) {
var temps = obj.getStuff3(field.path, function(a) {
return a
}, field.path)
var current_name = "",
current_data = "";
if (temps.length > 0) {
current_name = temps[0].name
current_data = temps[0].data;
}
var s = ''; //' '
s += " ";
var path = opath.get(obj, field.path);
if (current_name !== "" && !path) {
path = opath.get(self.oget(current_name), field.path);
s += ' inherit ' + path + ' ';
s += ' from ' + ' ' + current_name + ' '
} else {
s += ' ' + path + ' ';
}
return s;
}
}
return types;
}
Asystem.prototype.renderEditor2a = function(obj) {
var self = this;
var stash = [];
// stash.push(["Parent", '' + self.template("{{parents::}}", obj) + '
']);
// stash.push(["Path", " ']);
/* stash.push(["Title", "
'
]);
*/
/* if (obj.name !== "root") {
(self.oget("root")._metas.fields || []).map(function(field) {
stash.push([field.title, types[field.type](obj, field)]);
})
}*/
/*
if (obj._metas && obj.name !== "root") {
(obj._metas.fields || []).map(function(field) {
stash.push([field.title, types[field.type](obj, field)]);
})
}*/
function mkmod(obj, field) {
var data = "";
if (types[field.type]) {
data = types[field.type](obj, field)
} else {
data = field.data;
}
var s = '' + field.title + '
' + data + '
'
return s
}
function mkmodg(name, title, data) {
var s = '' + title + '
' + data + '
'
return s
}
function mktab() {
}
var xx = []
if (obj._metas.notself) {} else {
var fff = obj.getStuff("_metas.fields", function(a) {
return a
}, "fi");
fff.map(function(ff) {
ff.data.map(function(field) {
xx.push(mkmod(obj, field));
})
})
}
stash.push([" ", mkmodg("info", " ", [mkmod(obj, {
"type": "info",
"title": "Info",
"data": "Path: " + obj.path
}), '
'].join("\n"))]);
/* var qq = []
qq.push(mkmod(obj, {
"title": "Path",
"data": " '
}));
qq.push(mkmod(obj, {
"title": "Parents",
"data": self.template("{{parents::}}", obj)
}));
stash.push([" ", mkmodg("content", " ", qq.join("\n"))]);
*/
stash.push([" ", mkmodg("content", " ", xx.join("\n"))]);
var left = [];
var right = [];
right.push(mkmod(obj, {
"type": "children",
"title": "Children"
}));
left.push(mkmod(obj, {
"type": "inherits",
"title": "Inherits"
}));
left.push(mkmod(obj, {
"type": "extends",
"title": "Extends"
}));
stash.push([" ", '' + mkmodg("x", " ", left.join("\n")) + '
' + mkmodg("y", " ", right.join("\n")) + '
']);
stash.push([" ", '']);
var left = [];
var right = [];
left.push(mkmod(obj, {
"type": "isas",
"title": "Is a thing"
}))
right.push(mkmod(obj, {
"type": "hasas",
"title": "Is thing to something"
}))
stash.push([" ", '' + mkmodg("xx", " ", left.join("\n")) + '
' + mkmodg(",yy", " ", right.join("\n")) + '
']);
var xx = [];
xx.push(mkmod(obj, {
"type": "template",
"title": "Template"
}))
xx.push(mkmod(obj, {
"type": "templatepaths",
"title": "Paths"
}))
stash.push([" ", mkmodg("x", "Template", xx.join("\n"))]);
stash.push([" ", " "]);
/* stash.push(["Icon", "
'
]);
*/
if (obj._data.data && obj._data.data.length > 8192) {
stash.push(["Data too big", obj._data.data.length + " :" + obj._data.data.substring(0, 200)])
} else {
stash.push(["Data", "
'
]);
}
stash.push(["Meta", "
'
]);
_.map(_.omit(obj, ignores), function(val, prop) {
if (typeof(val) === "function") {
stash.push(["JS " + prop + 'Delete ',
"
'
]);
}
})
stash.push(["JS ", " "]);
var ss = ('' + stash.map(function(a) {
return '
' + (a[0] === false ? "" : a[0] + "") + '
' + a[1] +
'
'
}).join("\n") + '
');
return ss
}
Asystem.prototype.renderEditor3 = function(obj) {
var self = this;
var stash = [];
var prot = {}
var meta = {}
allchildren(obj).map(function(c) {
var arr = opath.flatten(c._data, "");
arr.map(function(a) {
prot[a[0]] = prot[a[0]] || {}
prot[a[0]][a[1]] = prot[a[0]][a[1]] || 0
prot[a[0]][a[1]] += 1;
})
var arr = opath.flatten(c._metas, "");
arr.map(function(a) {
if (a[0].indexOf('_wp_attachment_backup_sizes') > -1) {
return;
}
meta[a[0]] = meta[a[0]] || {}
meta[a[0]][a[1]] = meta[a[0]][a[1]] || 0
meta[a[0]][a[1]] += 1;
})
});
var prota = _.map(prot, function(vala, nama) {
return nama + " : " + _.size(vala)
});
var metas = _.map(meta, function(vala, nama) {
return nama + " : " + _.size(vala)
});
stash.push(["Data Properties", '' + JSON.stringify(prota, true, 2) + ' '])
stash.push(["Meta Properties", '' + JSON.stringify(metas, true, 2) + ' '])
var ss = ('' + stash.map(function(a) {
return '
' + (a[0] === false ? "" : a[0] + "") + '
' + a[1] + '
'
}).join("\n") + '
');
return ss
}
Asystem.prototype.getRenderTemplate = function(obj) {
var self = this;
var stash = [];
var templates = []
var temps = obj.getStuff3("_data.template", function(a) {
return a
}, "_data.template")
var myself;
var x = {};
temps.map(function(a) {
x[a.name] = a
});
temps = _.map(x, function(a) {
return a
});
return temps
}
Asystem.prototype.rendertemplate2 = function(obj) {
var self = this;
var stash = [];
var templates = []
var temps = obj.getStuff3("_data.template", function(a) {
return a
}, "_data.template")
var myself;
var x = {};
temps.map(function(a) {
x[a.name] = a
});
temps = _.map(x, function(a) {
return a
});
var ss = ' ' + self.template(obj._data.template, obj) + '
'
return ss;
}
Asystem.prototype.rendertemplate = function(obj) {
var self = this;
var stash = [];
var templates = []
var temps = obj.getStuff3("_data.template", function(a) {
return a
}, "_data.template")
var myself;
var x = {};
temps.map(function(a) {
x[a.name] = a
});
temps = _.map(x, function(a) {
return a
});
if (obj._data.template && obj._data.template.indexOf("{{output}}") > -1) {
myself = temps.shift();
}
var outer = temps.filter(function(a) {
return a.data.indexOf("{{output}}") > -1
})
var otemp = "{{output}}"
var outera = "";
if (outer.length) {
outera = outer[0];
otemp = outer[0].data;
}
var output = temps.filter(function(a) {
return a.data.indexOf("{{output}}") === -1 && a.name.indexOf("menu") === -1 && a.name.indexOf("header") === -1 && a.from.indexOf("isa_") === -1
}).map(function(tmp) {
return ' ' + self.template(tmp.data, obj) + '
';
}).join("\n")
var menus = temps.filter(function(a) {
return a.name.indexOf("menu") > -1
}).slice(0, 1).map(function(tmp) {
return ' ' + self.template(tmp.data, obj) + '
';
}).join("\n")
var headers = temps.filter(function(a) {
return a.name.indexOf("header") > -1
}).slice(0, 1).map(function(tmp) {
return ' ' + self.template(tmp.data, obj) + '
';
}).join("\n")
/*
var isas = temps.filter(function(a) {
return a.from.indexOf("isa_") > -1
}).map(function(tmp) {
console.log("ISA,",tmp);
if(tmp.inas.length>2){
var tma=tmp.inas.pop();
tma=tmp.inas.pop();
return 'IIS ' + self.template(tmp.data, self.oget(tma)) + '
';
}else{
return 'IIS ' + self.template(tmp.data, self.oget(tmp.name)) + '
';
}
}).join("\n")
*/
if (myself) {
var ai = Object.assign({
"output": output,
"menu": menus,
"header": headers,
"selfie": JSON.stringify(temps, true, 2)
}, obj);
var ss = ' ' + self.template(myself.data, ai) + '
'
} else {
var ai = Object.assign({
"output": output,
"menu": menus,
"header": headers,
"selfie": JSON.stringify(temps, true, 2)
}, obj);
var ss = ' ' + self.template(otemp, ai) + '
'
}
return ss
}
Asystem.prototype.allchildren = function(ronly) {
var self = this;
var arr = [];
if (ronly) {
return [].concat.apply(arr, allchildren(self.oo[ronly]))
}
_.keys(self.oo).filter((k) => typeof(self.oo[k]) === "function").map(function(key) {
arr = [].concat.apply(arr, allchildren(self.oo[key]))
})
return arr;
}
Asystem.prototype.allchildpaths = function(ronly) {
var self = this;
var arr = [];
_.keys(self.oo).filter((k) => typeof(self.oo[k]) === "function").map(function(key) {
ronly ? (ronly === key ? arr = [].concat.apply(arr, allchildpaths(self.oo[key])) : null) : arr = [].concat.apply(arr, allchildpaths(self.oo[key]))
})
return arr;
}
module.exports = Asystem;