linklist bugfix update
This commit is contained in:
parent
82cf98b3ba
commit
8be5a8a643
|
@ -1 +1,11 @@
|
||||||
|
2.00
|
||||||
|
- silence cache lite non static PEAR errors on $obj->remove()
|
||||||
|
- minor preparations for the Serendipity 2.0 backend
|
||||||
|
- fix multiple dtree includements using a unique name
|
||||||
|
- add css seperators
|
||||||
|
|
||||||
|
1.99.1 - use serendipity_specialchars
|
||||||
|
|
||||||
|
1.99 - compat fixes
|
||||||
|
|
||||||
1.98 - remove short tag occurences
|
1.98 - remove short tag occurences
|
||||||
|
|
|
@ -11,341 +11,341 @@
|
||||||
|
|
||||||
// Node object
|
// Node object
|
||||||
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
|
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.pid = pid;
|
this.pid = pid;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
this.iconOpen = iconOpen;
|
this.iconOpen = iconOpen;
|
||||||
this._io = open || false;
|
this._io = open || false;
|
||||||
this._is = false;
|
this._is = false;
|
||||||
this._ls = false;
|
this._ls = false;
|
||||||
this._hc = false;
|
this._hc = false;
|
||||||
this._ai = 0;
|
this._ai = 0;
|
||||||
this._p;
|
this._p;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Tree object
|
// Tree object
|
||||||
function dTree(objName, img_directory) {
|
function dTree(objName, img_directory) {
|
||||||
this.config = {
|
this.config = {
|
||||||
target : null,
|
target : null,
|
||||||
folderLinks : true,
|
folderLinks : true,
|
||||||
useSelection : true,
|
useSelection : true,
|
||||||
useCookies : true,
|
useCookies : true,
|
||||||
useLines : true,
|
useLines : true,
|
||||||
useIcons : true,
|
useIcons : true,
|
||||||
useStatusText : false,
|
useStatusText : false,
|
||||||
closeSameLevel : false,
|
closeSameLevel : false,
|
||||||
inOrder : false
|
inOrder : false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.icon = {
|
this.icon = {
|
||||||
root : img_directory + '/img/base.gif',
|
root : img_directory + '/img/base.gif',
|
||||||
folder : img_directory + '/img/folder.gif',
|
folder : img_directory + '/img/folder.gif',
|
||||||
folderOpen : img_directory + '/img/folderopen.gif',
|
folderOpen : img_directory + '/img/folderopen.gif',
|
||||||
node : img_directory + '/img/page.gif',
|
node : img_directory + '/img/page.gif',
|
||||||
empty : img_directory + '/img/empty.gif',
|
empty : img_directory + '/img/empty.gif',
|
||||||
line : img_directory + '/img/line.gif',
|
line : img_directory + '/img/line.gif',
|
||||||
join : img_directory + '/img/join.gif',
|
join : img_directory + '/img/join.gif',
|
||||||
joinBottom : img_directory + '/img/joinbottom.gif',
|
joinBottom : img_directory + '/img/joinbottom.gif',
|
||||||
plus : img_directory + '/img/plus.gif',
|
plus : img_directory + '/img/plus.gif',
|
||||||
plusBottom : img_directory + '/img/plusbottom.gif',
|
plusBottom : img_directory + '/img/plusbottom.gif',
|
||||||
minus : img_directory + '/img/minus.gif',
|
minus : img_directory + '/img/minus.gif',
|
||||||
minusBottom : img_directory + '/img/minusbottom.gif',
|
minusBottom : img_directory + '/img/minusbottom.gif',
|
||||||
nlPlus : img_directory + '/img/nolines_plus.gif',
|
nlPlus : img_directory + '/img/nolines_plus.gif',
|
||||||
nlMinus : img_directory + '/img/nolines_minus.gif'
|
nlMinus : img_directory + '/img/nolines_minus.gif'
|
||||||
};
|
};
|
||||||
this.obj = objName;
|
this.obj = objName;
|
||||||
this.aNodes = [];
|
this.aNodes = [];
|
||||||
this.aIndent = [];
|
this.aIndent = [];
|
||||||
this.root = new Node(-1);
|
this.root = new Node(-1);
|
||||||
this.selectedNode = null;
|
this.selectedNode = null;
|
||||||
this.selectedFound = false;
|
this.selectedFound = false;
|
||||||
this.completed = false;
|
this.completed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adds a new node to the node array
|
// Adds a new node to the node array
|
||||||
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
|
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
|
||||||
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
|
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open/close all nodes
|
// Open/close all nodes
|
||||||
dTree.prototype.openAll = function() {
|
dTree.prototype.openAll = function() {
|
||||||
this.oAll(true);
|
this.oAll(true);
|
||||||
};
|
};
|
||||||
dTree.prototype.closeAll = function() {
|
dTree.prototype.closeAll = function() {
|
||||||
this.oAll(false);
|
this.oAll(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Outputs the tree to the page
|
// Outputs the tree to the page
|
||||||
dTree.prototype.toString = function() {
|
dTree.prototype.toString = function() {
|
||||||
var str = '<div class="dtree">\n';
|
var str = '<div class="dtree">\n';
|
||||||
if (document.getElementById) {
|
if (document.getElementById) {
|
||||||
if (this.config.useCookies) this.selectedNode = this.getSelected();
|
if (this.config.useCookies) this.selectedNode = this.getSelected();
|
||||||
str += this.addNode(this.root);
|
str += this.addNode(this.root);
|
||||||
} else str += 'Browser not supported.';
|
} else str += 'Browser not supported.';
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
if (!this.selectedFound) this.selectedNode = null;
|
if (!this.selectedFound) this.selectedNode = null;
|
||||||
this.completed = true;
|
this.completed = true;
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates the tree structure
|
// Creates the tree structure
|
||||||
dTree.prototype.addNode = function(pNode) {
|
dTree.prototype.addNode = function(pNode) {
|
||||||
var str = '';
|
var str = '';
|
||||||
var n=0;
|
var n=0;
|
||||||
if (this.config.inOrder) n = pNode._ai;
|
if (this.config.inOrder) n = pNode._ai;
|
||||||
for (n; n<this.aNodes.length; n++) {
|
for (n; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n].pid == pNode.id) {
|
if (this.aNodes[n].pid == pNode.id) {
|
||||||
var cn = this.aNodes[n];
|
var cn = this.aNodes[n];
|
||||||
cn._p = pNode;
|
cn._p = pNode;
|
||||||
cn._ai = n;
|
cn._ai = n;
|
||||||
this.setCS(cn);
|
this.setCS(cn);
|
||||||
if (!cn.target && this.config.target) cn.target = this.config.target;
|
if (!cn.target && this.config.target) cn.target = this.config.target;
|
||||||
if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
|
if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
|
||||||
if (!this.config.folderLinks && cn._hc) cn.url = null;
|
if (!this.config.folderLinks && cn._hc) cn.url = null;
|
||||||
if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
|
if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
|
||||||
cn._is = true;
|
cn._is = true;
|
||||||
this.selectedNode = n;
|
this.selectedNode = n;
|
||||||
this.selectedFound = true;
|
this.selectedFound = true;
|
||||||
}
|
}
|
||||||
str += this.node(cn, n);
|
str += this.node(cn, n);
|
||||||
if (cn._ls) break;
|
if (cn._ls) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Creates the node icon, url and text
|
// Creates the node icon, url and text
|
||||||
dTree.prototype.node = function(node, nodeId) {
|
dTree.prototype.node = function(node, nodeId) {
|
||||||
var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
|
var str = '<div class="dTreeNode">' + this.indent(node, nodeId);
|
||||||
if (this.config.useIcons) {
|
if (this.config.useIcons) {
|
||||||
if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
|
if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
|
||||||
if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
|
if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
|
||||||
if (this.root.id == node.pid) {
|
if (this.root.id == node.pid) {
|
||||||
node.icon = this.icon.root;
|
node.icon = this.icon.root;
|
||||||
node.iconOpen = this.icon.root;
|
node.iconOpen = this.icon.root;
|
||||||
}
|
}
|
||||||
str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
|
str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
|
||||||
}
|
}
|
||||||
if (node.url) {
|
if (node.url) {
|
||||||
str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
|
str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
|
||||||
if (node.title) str += ' title="' + node.title + '"';
|
if (node.title) str += ' title="' + node.title + '"';
|
||||||
if (node.target) str += ' target="' + node.target + '"';
|
if (node.target) str += ' target="' + node.target + '"';
|
||||||
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
|
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
|
||||||
if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
|
if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
|
||||||
str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
|
str += ' onclick="javascript: ' + this.obj + '.s(' + nodeId + ');"';
|
||||||
str += '>';
|
str += '>';
|
||||||
}
|
}
|
||||||
else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
|
else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
|
||||||
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
|
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
|
||||||
str += node.name;
|
str += node.name;
|
||||||
if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
|
if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
if (node._hc) {
|
if (node._hc) {
|
||||||
str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
|
str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
|
||||||
str += this.addNode(node);
|
str += this.addNode(node);
|
||||||
str += '</div>';
|
str += '</div>';
|
||||||
}
|
}
|
||||||
this.aIndent.pop();
|
this.aIndent.pop();
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Adds the empty and line icons
|
// Adds the empty and line icons
|
||||||
dTree.prototype.indent = function(node, nodeId) {
|
dTree.prototype.indent = function(node, nodeId) {
|
||||||
var str = '';
|
var str = '';
|
||||||
if (this.root.id != node.pid) {
|
if (this.root.id != node.pid) {
|
||||||
for (var n=0; n<this.aIndent.length; n++)
|
for (var n=0; n<this.aIndent.length; n++)
|
||||||
str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
|
str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
|
||||||
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
|
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
|
||||||
if (node._hc) {
|
if (node._hc) {
|
||||||
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
|
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
|
||||||
if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
|
if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
|
||||||
else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
|
else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
|
||||||
str += '" alt="" /></a>';
|
str += '" alt="" /></a>';
|
||||||
} else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
|
} else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Checks if a node has any children and if it is the last sibling
|
// Checks if a node has any children and if it is the last sibling
|
||||||
dTree.prototype.setCS = function(node) {
|
dTree.prototype.setCS = function(node) {
|
||||||
var lastId;
|
var lastId;
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n].pid == node.id) node._hc = true;
|
if (this.aNodes[n].pid == node.id) node._hc = true;
|
||||||
if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
|
if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
|
||||||
}
|
}
|
||||||
if (lastId==node.id) node._ls = true;
|
if (lastId==node.id) node._ls = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns the selected node
|
// Returns the selected node
|
||||||
dTree.prototype.getSelected = function() {
|
dTree.prototype.getSelected = function() {
|
||||||
var sn = this.getCookie('cs' + this.obj);
|
var sn = this.getCookie('cs' + this.obj);
|
||||||
return (sn) ? sn : null;
|
return (sn) ? sn : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Highlights the selected node
|
// Highlights the selected node
|
||||||
dTree.prototype.s = function(id) {
|
dTree.prototype.s = function(id) {
|
||||||
if (!this.config.useSelection) return;
|
if (!this.config.useSelection) return;
|
||||||
var cn = this.aNodes[id];
|
var cn = this.aNodes[id];
|
||||||
if (cn._hc && !this.config.folderLinks) return;
|
if (cn._hc && !this.config.folderLinks) return;
|
||||||
if (this.selectedNode != id) {
|
if (this.selectedNode != id) {
|
||||||
if (this.selectedNode || this.selectedNode==0) {
|
if (this.selectedNode || this.selectedNode==0) {
|
||||||
eOld = document.getElementById("s" + this.obj + this.selectedNode);
|
eOld = document.getElementById("s" + this.obj + this.selectedNode);
|
||||||
eOld.className = "node";
|
eOld.className = "node";
|
||||||
}
|
}
|
||||||
eNew = document.getElementById("s" + this.obj + id);
|
eNew = document.getElementById("s" + this.obj + id);
|
||||||
eNew.className = "nodeSel";
|
eNew.className = "nodeSel";
|
||||||
this.selectedNode = id;
|
this.selectedNode = id;
|
||||||
if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
|
if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Toggle Open or close
|
// Toggle Open or close
|
||||||
dTree.prototype.o = function(id) {
|
dTree.prototype.o = function(id) {
|
||||||
var cn = this.aNodes[id];
|
var cn = this.aNodes[id];
|
||||||
this.nodeStatus(!cn._io, id, cn._ls);
|
this.nodeStatus(!cn._io, id, cn._ls);
|
||||||
cn._io = !cn._io;
|
cn._io = !cn._io;
|
||||||
if (this.config.closeSameLevel) this.closeLevel(cn);
|
if (this.config.closeSameLevel) this.closeLevel(cn);
|
||||||
if (this.config.useCookies) this.updateCookie();
|
if (this.config.useCookies) this.updateCookie();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open or close all nodes
|
// Open or close all nodes
|
||||||
|
|
||||||
dTree.prototype.oAll = function(status) {
|
dTree.prototype.oAll = function(status) {
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
|
if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
|
||||||
this.nodeStatus(status, n, this.aNodes[n]._ls)
|
this.nodeStatus(status, n, this.aNodes[n]._ls)
|
||||||
this.aNodes[n]._io = status;
|
this.aNodes[n]._io = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.config.useCookies) this.updateCookie();
|
if (this.config.useCookies) this.updateCookie();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Opens the tree to a specific node
|
// Opens the tree to a specific node
|
||||||
dTree.prototype.openTo = function(nId, bSelect, bFirst) {
|
dTree.prototype.openTo = function(nId, bSelect, bFirst) {
|
||||||
if (!bFirst) {
|
if (!bFirst) {
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n].id == nId) {
|
if (this.aNodes[n].id == nId) {
|
||||||
nId=n;
|
nId=n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var cn=this.aNodes[nId];
|
var cn=this.aNodes[nId];
|
||||||
if (cn.pid==this.root.id || !cn._p) return;
|
if (cn.pid==this.root.id || !cn._p) return;
|
||||||
cn._io = true;
|
cn._io = true;
|
||||||
cn._is = bSelect;
|
cn._is = bSelect;
|
||||||
if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
|
if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
|
||||||
if (this.completed && bSelect) this.s(cn._ai);
|
if (this.completed && bSelect) this.s(cn._ai);
|
||||||
else if (bSelect) this._sn=cn._ai;
|
else if (bSelect) this._sn=cn._ai;
|
||||||
this.openTo(cn._p._ai, false, true);
|
this.openTo(cn._p._ai, false, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Closes all nodes on the same level as certain node
|
// Closes all nodes on the same level as certain node
|
||||||
dTree.prototype.closeLevel = function(node) {
|
dTree.prototype.closeLevel = function(node) {
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
|
if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
|
||||||
this.nodeStatus(false, n, this.aNodes[n]._ls);
|
this.nodeStatus(false, n, this.aNodes[n]._ls);
|
||||||
this.aNodes[n]._io = false;
|
this.aNodes[n]._io = false;
|
||||||
this.closeAllChildren(this.aNodes[n]);
|
this.closeAllChildren(this.aNodes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Closes all children of a node
|
// Closes all children of a node
|
||||||
dTree.prototype.closeAllChildren = function(node) {
|
dTree.prototype.closeAllChildren = function(node) {
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
|
if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
|
||||||
if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
|
if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
|
||||||
this.aNodes[n]._io = false;
|
this.aNodes[n]._io = false;
|
||||||
this.closeAllChildren(this.aNodes[n]);
|
this.closeAllChildren(this.aNodes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the status of a node(open or closed)
|
// Change the status of a node(open or closed)
|
||||||
dTree.prototype.nodeStatus = function(status, id, bottom) {
|
dTree.prototype.nodeStatus = function(status, id, bottom) {
|
||||||
eDiv = document.getElementById('d' + this.obj + id);
|
eDiv = document.getElementById('d' + this.obj + id);
|
||||||
eJoin = document.getElementById('j' + this.obj + id);
|
eJoin = document.getElementById('j' + this.obj + id);
|
||||||
if (this.config.useIcons) {
|
if (this.config.useIcons) {
|
||||||
eIcon = document.getElementById('i' + this.obj + id);
|
eIcon = document.getElementById('i' + this.obj + id);
|
||||||
eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
|
eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
|
||||||
}
|
}
|
||||||
eJoin.src = (this.config.useLines)?
|
eJoin.src = (this.config.useLines)?
|
||||||
((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
|
((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
|
||||||
((status)?this.icon.nlMinus:this.icon.nlPlus);
|
((status)?this.icon.nlMinus:this.icon.nlPlus);
|
||||||
eDiv.style.display = (status) ? 'block': 'none';
|
eDiv.style.display = (status) ? 'block': 'none';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// [Cookie] Clears a cookie
|
// [Cookie] Clears a cookie
|
||||||
dTree.prototype.clearCookie = function() {
|
dTree.prototype.clearCookie = function() {
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
|
var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
|
||||||
this.setCookie('co'+this.obj, 'cookieValue', yesterday);
|
this.setCookie('co'+this.obj, 'cookieValue', yesterday);
|
||||||
this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
|
this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Cookie] Sets value in a cookie
|
// [Cookie] Sets value in a cookie
|
||||||
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
|
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
|
||||||
document.cookie =
|
document.cookie =
|
||||||
escape(cookieName) + '=' + escape(cookieValue)
|
escape(cookieName) + '=' + escape(cookieValue)
|
||||||
+ (expires ? '; expires=' + expires.toGMTString() : '')
|
+ (expires ? '; expires=' + expires.toGMTString() : '')
|
||||||
+ (path ? '; path=' + path : '')
|
+ (path ? '; path=' + path : '')
|
||||||
+ (domain ? '; domain=' + domain : '')
|
+ (domain ? '; domain=' + domain : '')
|
||||||
+ (secure ? '; secure' : '');
|
+ (secure ? '; secure' : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Cookie] Gets a value from a cookie
|
// [Cookie] Gets a value from a cookie
|
||||||
dTree.prototype.getCookie = function(cookieName) {
|
dTree.prototype.getCookie = function(cookieName) {
|
||||||
var cookieValue = '';
|
var cookieValue = '';
|
||||||
var posName = document.cookie.indexOf(escape(cookieName) + '=');
|
var posName = document.cookie.indexOf(escape(cookieName) + '=');
|
||||||
if (posName != -1) {
|
if (posName != -1) {
|
||||||
var posValue = posName + (escape(cookieName) + '=').length;
|
var posValue = posName + (escape(cookieName) + '=').length;
|
||||||
var endPos = document.cookie.indexOf(';', posValue);
|
var endPos = document.cookie.indexOf(';', posValue);
|
||||||
if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
|
if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
|
||||||
else cookieValue = unescape(document.cookie.substring(posValue));
|
else cookieValue = unescape(document.cookie.substring(posValue));
|
||||||
}
|
}
|
||||||
return (cookieValue);
|
return (cookieValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Cookie] Returns ids of open nodes as a string
|
// [Cookie] Returns ids of open nodes as a string
|
||||||
dTree.prototype.updateCookie = function() {
|
dTree.prototype.updateCookie = function() {
|
||||||
var str = '';
|
var str = '';
|
||||||
for (var n=0; n<this.aNodes.length; n++) {
|
for (var n=0; n<this.aNodes.length; n++) {
|
||||||
if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
|
if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
|
||||||
if (str) str += '.';
|
if (str) str += '.';
|
||||||
str += this.aNodes[n].id;
|
str += this.aNodes[n].id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.setCookie('co' + this.obj, str);
|
this.setCookie('co' + this.obj, str);
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Cookie] Checks if a node id is in a cookie
|
// [Cookie] Checks if a node id is in a cookie
|
||||||
dTree.prototype.isOpen = function(id) {
|
dTree.prototype.isOpen = function(id) {
|
||||||
var aOpen = this.getCookie('co' + this.obj).split('.');
|
var aOpen = this.getCookie('co' + this.obj).split('.');
|
||||||
for (var n=0; n<aOpen.length; n++)
|
for (var n=0; n<aOpen.length; n++)
|
||||||
if (aOpen[n] == id) return true;
|
if (aOpen[n] == id) return true;
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// If Push and pop is not implemented by the browser
|
// If Push and pop is not implemented by the browser
|
||||||
if (!Array.prototype.push) {
|
if (!Array.prototype.push) {
|
||||||
Array.prototype.push = function array_push() {
|
Array.prototype.push = function array_push() {
|
||||||
for(var i=0;i<arguments.length;i++)
|
for(var i=0;i<arguments.length;i++)
|
||||||
this[this.length]=arguments[i];
|
this[this.length]=arguments[i];
|
||||||
return this.length;
|
return this.length;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!Array.prototype.pop) {
|
if (!Array.prototype.pop) {
|
||||||
Array.prototype.pop = function array_pop() {
|
Array.prototype.pop = function array_pop() {
|
||||||
lastElement = this[this.length-1];
|
lastElement = this[this.length-1];
|
||||||
this.length = Math.max(this.length-1,0);
|
this.length = Math.max(this.length-1,0);
|
||||||
return lastElement;
|
return lastElement;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function hide_unhide(thing, path, lines, icons, bottom){
|
function hide_unhide(thing, path, lines, icons, bottom){
|
||||||
nav=document.getElementById(thing).style
|
nav=document.getElementById(thing).style;
|
||||||
if (lines) {
|
if (lines) {
|
||||||
if (bottom) {
|
if (bottom) {
|
||||||
plus = path + '/img/plus.gif';
|
plus = path + '/img/plus.gif';
|
||||||
|
|
|
@ -32,4 +32,7 @@
|
||||||
}
|
}
|
||||||
.dtree .clip {
|
.dtree .clip {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* linklist dtree end */
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,46 @@
|
||||||
|
/* serendipity_event_linklist.css start */
|
||||||
|
|
||||||
div.linklist span.menu_title {
|
div.linklist span.menu_title {
|
||||||
}
|
}
|
||||||
|
|
||||||
div.linklist {
|
div.linklist {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #666;
|
color: #666;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
div.linklist ul {
|
div.linklist ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.linklist li {
|
div.linklist li {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-family: Arial, Helvetica, sans-serif;
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.linklist img {
|
div.linklist img {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
div.linklist a.folder {
|
div.linklist a.folder {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
div.linklist a.link {
|
div.linklist a.link {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
div.linklist a:hover {
|
div.linklist a:hover {
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* serendipity_event_linklist.css end */
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php #
|
<?php
|
||||||
|
|
||||||
|
|
||||||
if (IN_serendipity !== true) {
|
if (IN_serendipity !== true) {
|
||||||
die ("Don't hack!");
|
die ("Don't hack!");
|
||||||
|
@ -24,13 +23,14 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
$propbag->add('description', PLUGIN_LINKLIST_DESC);
|
$propbag->add('description', PLUGIN_LINKLIST_DESC);
|
||||||
$propbag->add('event_hooks', array('backend_sidebar_entries_event_display_linklist' => true,
|
$propbag->add('event_hooks', array('backend_sidebar_entries_event_display_linklist' => true,
|
||||||
'backend_sidebar_entries' => true,
|
'backend_sidebar_entries' => true,
|
||||||
|
'backend_sidebar_admin_appearance' => true,
|
||||||
'plugins_linklist_input' => true,
|
'plugins_linklist_input' => true,
|
||||||
'css' => true,
|
'css' => true,
|
||||||
'plugins_linklist_conf' => true,
|
'plugins_linklist_conf' => true,
|
||||||
'external_plugin' => true
|
'external_plugin' => true
|
||||||
));
|
));
|
||||||
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
|
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
|
||||||
$propbag->add('version', '1.99.1');
|
$propbag->add('version', '2.00');
|
||||||
$propbag->add('requirements', array(
|
$propbag->add('requirements', array(
|
||||||
'serendipity' => '0.8',
|
'serendipity' => '0.8',
|
||||||
'smarty' => '2.6.7',
|
'smarty' => '2.6.7',
|
||||||
|
@ -128,34 +128,41 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'backend_sidebar_entries':
|
case 'backend_sidebar_entries':
|
||||||
if ($this->get_config('active')=='true') {
|
if ($this->get_config('active')=='true' && $serendipity['version'][0] < 2) {
|
||||||
echo '<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist">'.PLUGIN_LINKLIST_ADMINLINK.'</a></li>';
|
echo "\n".'<li class="serendipitySideBarMenuLink serendipitySideBarMenuEntryLinks"><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist">' . PLUGIN_LINKLIST_ADMINLINK . '</a></li>';
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'backend_sidebar_admin_appearance':
|
||||||
|
if ($this->get_config('active')=='true' && $serendipity['version'][0] > 1) {
|
||||||
|
echo "\n".'<li><a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist">' . PLUGIN_LINKLIST_ADMINLINK . '</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'css':
|
case 'css':
|
||||||
if ($this->get_config('style') == "dtree") {
|
if ($this->get_config('style') == 'dtree') {
|
||||||
$searchstr = '.dtree';
|
$searchstr = '.dtree';
|
||||||
$filename = "serendipity_event_dtree.css";
|
$filename = 'serendipity_event_dtree.css';
|
||||||
} else {
|
} else {
|
||||||
$searchstr = '.linklist';
|
$searchstr = '.linklist';
|
||||||
$filename = "serendipity_event_linklist.css";
|
$filename = 'serendipity_event_linklist.css';
|
||||||
}
|
}
|
||||||
if (stristr($eventData, $searchstr)) {
|
if (strpos($eventData, $searchstr)) {
|
||||||
// class exists in CSS, so a user has customized it and we don't need default
|
// class exists in CSS by another Plugin, or a user has customized it and we don't need default
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
$out = serendipity_getTemplateFile($filename, 'serendipityPath');
|
|
||||||
if ($out && $out != $filename) {
|
|
||||||
$eventData .= file_get_contents($out);
|
|
||||||
} else {
|
|
||||||
$eventData .= file_get_contents(dirname(__FILE__) . '/'.$filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
$tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
|
||||||
|
if (!$tfile || $tfile == $filename) {
|
||||||
|
$tfile = dirname(__FILE__) . '/' . $filename;
|
||||||
|
}
|
||||||
|
echo file_get_contents($tfile);
|
||||||
|
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,7 +171,7 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
$parts = explode('&', $uri_parts[0]);
|
$parts = explode('&', $uri_parts[0]);
|
||||||
$uri_part = $parts[0];
|
$uri_part = $parts[0];
|
||||||
switch($uri_part) {
|
switch($uri_part) {
|
||||||
case 'dtree.js':
|
case 'lldtree.js': // name unique!
|
||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
echo file_get_contents(dirname(__FILE__).'/dtree.js');
|
echo file_get_contents(dirname(__FILE__).'/dtree.js');
|
||||||
break;
|
break;
|
||||||
|
@ -177,76 +184,78 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'plugins_linklist_input':
|
case 'plugins_linklist_input':
|
||||||
$eventData['links'] = $this->generate_output(false);
|
$eventData['links'] = $this->generate_output(false);
|
||||||
return true;
|
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'plugins_linklist_conf':
|
case 'plugins_linklist_conf':
|
||||||
$this->set_config('style', $eventData['style']);
|
$this->set_config('style', $eventData['style']);
|
||||||
$this->set_config('display', $eventData['display']);
|
$this->set_config('display', $eventData['display']);
|
||||||
$this->set_config('category', $eventData['category']);
|
$this->set_config('category', $eventData['category']);
|
||||||
$this->set_config('cache', $eventData['cache']);
|
$this->set_config('cache', $eventData['cache']);
|
||||||
|
|
||||||
$eventData['changed'] = 'false';
|
$eventData['changed'] = 'false';
|
||||||
if ($eventData['enabled']=='true') {
|
if ($eventData['enabled']=='true') {
|
||||||
if ($this->get_config('active')!='true') {
|
if ($this->get_config('active')!='true') {
|
||||||
$eventData['changed'] = 'true';
|
$eventData['changed'] = 'true';
|
||||||
$this->set_config('active','true');
|
$this->set_config('active','true');
|
||||||
$this->set_config('active','true');
|
$this->set_config('active','true');
|
||||||
$this->set_config('category','custom');
|
$this->set_config('category','custom');
|
||||||
$q = 'SELECT count(id) FROM '.$serendipity['dbPrefix'].'links';
|
$q = 'SELECT count(id) FROM '.$serendipity['dbPrefix'].'links';
|
||||||
$sql = serendipity_db_query($q);
|
$sql = serendipity_db_query($q);
|
||||||
if ($sql[0][0] == 0) {
|
if ($sql[0][0] == 0) {
|
||||||
$xml = xml_parser_create('UTF-8');
|
$xml = xml_parser_create('UTF-8');
|
||||||
xml_parse_into_struct($xml, '<list>'.serendipity_utf8_encode($eventData['links']).'</list>', $struct, $index);
|
xml_parse_into_struct($xml, '<list>'.serendipity_utf8_encode($eventData['links']).'</list>', $struct, $index);
|
||||||
xml_parser_free($xml);
|
xml_parser_free($xml);
|
||||||
$depth = -1;
|
$depth = -1;
|
||||||
for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
||||||
if(isset($struct[$i]['type'])){
|
if (isset($struct[$i]['type'])){
|
||||||
if($struct[$i]['type']=='open' && strtolower($struct[$i]['tag'])=='dir'){
|
if ($struct[$i]['type']=='open' && strtolower($struct[$i]['tag'])=='dir'){
|
||||||
$this->add_cat($this->decode($struct[$i]['attributes']['NAME']),$in_cat[0]);
|
$this->add_cat($this->decode($struct[$i]['attributes']['NAME']),$in_cat[0]);
|
||||||
$q = 'SELECT categoryid FROM '.$serendipity['dbPrefix'].'link_category where category_name = "'.serendipity_db_escape_string($this->decode($struct[$i]['attributes']['NAME'])).'"';
|
$q = 'SELECT categoryid FROM '.$serendipity['dbPrefix'].'link_category where category_name = "'.serendipity_db_escape_string($this->decode($struct[$i]['attributes']['NAME'])).'"';
|
||||||
$sql = serendipity_db_query($q);
|
$sql = serendipity_db_query($q);
|
||||||
$in_cat[] = $sql[0][0];
|
$in_cat[] = $sql[0][0];
|
||||||
$depth++;
|
$depth++;
|
||||||
} else if($struct[$i]['type']=='close' && strtolower($struct[$i]['tag'])=='dir'){
|
} else if($struct[$i]['type']=='close' && strtolower($struct[$i]['tag'])=='dir'){
|
||||||
$blah = array_pop($in_cat);
|
$blah = array_pop($in_cat);
|
||||||
$depth--;
|
$depth--;
|
||||||
} else if($struct[$i]['type']=='complete' && strtolower($struct[$i]['tag'])=='link'){
|
} else if($struct[$i]['type']=='complete' && strtolower($struct[$i]['tag'])=='link'){
|
||||||
$this->add_link($this->decode($struct[$i]['attributes']['LINK']),$this->decode($struct[$i]['attributes']['NAME']),$this->decode($struct[$i]['attributes']['DESCRIP']),$in_cat[$depth]);
|
$this->add_link($this->decode($struct[$i]['attributes']['LINK']),$this->decode($struct[$i]['attributes']['NAME']),$this->decode($struct[$i]['attributes']['DESCRIP']),$in_cat[$depth]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($eventData['cache'] == 'yes') {
|
}
|
||||||
if (@include_once("Cache/Lite.php")) {
|
if ($eventData['cache'] == 'yes') {
|
||||||
$cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
if (@include_once("Cache/Lite.php")) {
|
||||||
$output = $this->generate_output(true);
|
$cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
||||||
$eventData['links'] = $output;
|
$output = $this->generate_output(true);
|
||||||
$cache_obj->save($output,'linklist_cache');
|
$eventData['links'] = $output;
|
||||||
} else {
|
$cache_obj->save($output,'linklist_cache');
|
||||||
$output = $this->generate_output(true);
|
} else {
|
||||||
$eventData['links'] = $output;
|
$output = $this->generate_output(true);
|
||||||
$this->set_config('cached_output',$output);
|
$eventData['links'] = $output;
|
||||||
}
|
$this->set_config('cached_output',$output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ($this->get_config('active') =='true') {
|
|
||||||
$this->set_config('active','false');
|
|
||||||
$this->set_config('cache', 'no');
|
|
||||||
$this->set_config('display', 'category');
|
|
||||||
$eventData['links'] = $this->generate_output(true);
|
|
||||||
if (@include_once("Cache/Lite.php")) {
|
|
||||||
$cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
|
||||||
$cache_obj->remove('linklist_cache');
|
|
||||||
} else {
|
|
||||||
$this->set_config('cached_output','');
|
|
||||||
}
|
|
||||||
$eventData['changed'] = 'true';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
} else {
|
||||||
|
if ($this->get_config('active') =='true') {
|
||||||
|
$this->set_config('active','false');
|
||||||
|
$this->set_config('cache', 'no');
|
||||||
|
$this->set_config('display', 'category');
|
||||||
|
$eventData['links'] = $this->generate_output(true);
|
||||||
|
if (@include_once("Cache/Lite.php")) {
|
||||||
|
$cache_obj = new Cache_Lite(array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
||||||
|
@$cache_obj->remove('linklist_cache');
|
||||||
|
} else {
|
||||||
|
$this->set_config('cached_output','');
|
||||||
|
}
|
||||||
|
$eventData['changed'] = 'true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -279,17 +288,17 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
if ($this->get_config('category') == 'custom') {
|
if ($this->get_config('category') == 'custom') {
|
||||||
$table = $serendipity['dbPrefix'].'link_category';
|
$table = $serendipity['dbPrefix'].'link_category';
|
||||||
} else {
|
} else {
|
||||||
$table = $serendipity['dbPrefix'].'category';
|
$table = $serendipity['dbPrefix'].'category';
|
||||||
}
|
}
|
||||||
$output = $this->category_output($table,0,0);
|
$output = $this->category_output($table,0,0);
|
||||||
} else {
|
} else {
|
||||||
$q = $this->set_query($display);
|
$q = $this->set_query($display);
|
||||||
$sql = serendipity_db_query($q);
|
$sql = serendipity_db_query($q);
|
||||||
if ($sql && is_array($sql)) {
|
if ($sql && is_array($sql)) {
|
||||||
foreach($sql AS $key => $row) {
|
foreach($sql AS $key => $row) {
|
||||||
$name = $row['name'];
|
$name = $row['name'];
|
||||||
$link = $row['link'];
|
$link = $row['link'];
|
||||||
$id = $row['id'];
|
$id = $row['id'];
|
||||||
$descrip = $row['descrip'];
|
$descrip = $row['descrip'];
|
||||||
$output .= '<link name="'.(function_exists('serendipity_specialchars') ? serendipity_specialchars($name) : htmlspecialchars($name, ENT_COMPAT, LANG_CHARSET)).'" link="http://'.$link.'" descrip="'.(function_exists('serendipity_specialchars') ? serendipity_specialchars($descrip) : htmlspecialchars($descrip, ENT_COMPAT, LANG_CHARSET)).'" />'."\n";
|
$output .= '<link name="'.(function_exists('serendipity_specialchars') ? serendipity_specialchars($name) : htmlspecialchars($name, ENT_COMPAT, LANG_CHARSET)).'" link="http://'.$link.'" descrip="'.(function_exists('serendipity_specialchars') ? serendipity_specialchars($descrip) : htmlspecialchars($descrip, ENT_COMPAT, LANG_CHARSET)).'" />'."\n";
|
||||||
}
|
}
|
||||||
|
@ -577,7 +586,7 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
$q = $this->set_query($display);
|
$q = $this->set_query($display);
|
||||||
$categories = $this->build_categories();
|
$categories = $this->build_categories();
|
||||||
|
|
||||||
echo '<h3>'.PLUGIN_LINKLIST_ADMINLINK.'</h3>';
|
echo '<h3>'.PLUGIN_LINKLIST_ADMINLINK.'</h3>'."\n\n";
|
||||||
?>
|
?>
|
||||||
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist" method="post">
|
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist" method="post">
|
||||||
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||||
|
@ -632,14 +641,14 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
<?php
|
<?php
|
||||||
$sort_idx++;
|
$sort_idx++;
|
||||||
}
|
}
|
||||||
echo '<br />';
|
echo '
|
||||||
echo '</table>';
|
</table>
|
||||||
echo '<div>';
|
<div>
|
||||||
echo '<input type="submit" name="REMOVE" title="'.REMOVE.'" value="'.DELETE.'" class="serendipityPrettyButton input_button" />';
|
<input type="submit" name="REMOVE" title="'.REMOVE.'" value="'.DELETE.'" class="serendipityPrettyButton input_button state_cancel" />
|
||||||
echo ' ';
|
<span> </span>
|
||||||
echo '<input type="submit" name="SAVE" title="'.SAVE.'" value="'.SAVE.'" class="serendipityPrettyButton input_button" />';
|
<input type="submit" name="SAVE" title="'.SAVE.'" value="'.SAVE.'" class="serendipityPrettyButton input_button" />
|
||||||
echo '</div>';
|
</div>
|
||||||
echo '</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,19 +688,20 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
echo '<h3>'.$maintitle.'</h3>';
|
echo '<h3>'.$maintitle.'</h3>';
|
||||||
?>
|
?>
|
||||||
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist" method="post">
|
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist" method="post">
|
||||||
<input type="hidden" name="serendipity[add_link][id]" value="<?php echo $id; ?>">
|
<input type="hidden" name="serendipity[add_link][id]" value="<?php echo $id; ?>">
|
||||||
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||||
<tr><td><?php echo PLUGIN_LINKLIST_LINK.'<div style="font-size: smaller;">'.PLUGIN_LINKLIST_LINK_EXAMPLE.'</div>'; ?></td><td><input class="input_textbox" type="text" name="serendipity[add_link][link]" value="<?php echo $link; ?>" size="30" /></td></tr>
|
<tr><td><?php echo PLUGIN_LINKLIST_LINK.'<div style="font-size: smaller;">'.PLUGIN_LINKLIST_LINK_EXAMPLE.'</div>'; ?></td><td><input class="input_textbox" type="text" name="serendipity[add_link][link]" value="<?php echo $link; ?>" size="30" /></td></tr>
|
||||||
<tr><td><?php echo PLUGIN_LINKLIST_LINK_NAME; ?></td><td><input class="input_textbox" type="text" name="serendipity[add_link][title]" value="<?php echo $title; ?>" size="30" /></td></tr>
|
<tr><td><?php echo PLUGIN_LINKLIST_LINK_NAME; ?></td><td><input class="input_textbox" type="text" name="serendipity[add_link][title]" value="<?php echo $title; ?>" size="30" /></td></tr>
|
||||||
<tr><td><?php echo CATEGORY; ?> <?php echo $catlink;?></td><td><?php echo $this->category_box('cat',$categories,$cat); ?></td></tr>
|
<tr><td><?php echo CATEGORY; ?> <?php echo $catlink;?></td><td><?php echo $this->category_box('cat',$categories,$cat); ?></td></tr>
|
||||||
<tr><td valign="top"><?php echo PLUGIN_LINKLIST_LINKDESC; ?></td><td><textarea style="width: 100%" name="serendipity[add_link][desc]" id="serendipity[add_link][desc]" cols="80" rows="3"><?php echo $desc; ?></textarea></td></tr>
|
<tr><td valign="top"><?php echo PLUGIN_LINKLIST_LINKDESC; ?></td><td><textarea style="width: 100%" name="serendipity[add_link][desc]" id="serendipity[add_link][desc]" cols="80" rows="3"><?php echo $desc; ?></textarea></td></tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo '</table>';
|
echo '
|
||||||
echo '<div>';
|
</table>
|
||||||
echo $button;
|
<div>
|
||||||
echo '</div>';
|
' . $button . '
|
||||||
echo '</form>';
|
</div>
|
||||||
|
</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function output_categoryadmin() {
|
function output_categoryadmin() {
|
||||||
|
@ -699,25 +709,31 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
$display = $this->get_config('display');
|
$display = $this->get_config('display');
|
||||||
$categories = $this->build_categories();
|
$categories = $this->build_categories();
|
||||||
$maintitle = PLUGIN_LINKLIST_ADD_CAT;
|
$maintitle = PLUGIN_LINKLIST_ADD_CAT;
|
||||||
$button = '<input type="submit" name="ADD" title="'.ADD.'" value="'.ADD.'" class="serendipityPrettyButton input_button" />';
|
$button = '<input type="submit" name="ADD" title="' . ADD . '" value="' . ADD . '" class="serendipityPrettyButton input_button" />';
|
||||||
|
|
||||||
echo '<h3>'.$maintitle.'</h3>';
|
echo '<h3>'.$maintitle.'</h3>';
|
||||||
?>
|
?>
|
||||||
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist&serendipity[manage_category]=1" method="post">
|
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist&serendipity[manage_category]=1" method="post">
|
||||||
<input type="hidden" name="serendipity[add_link][id]" value="<?php echo $id; ?>">
|
<input type="hidden" name="serendipity[add_link][id]" value="<?php echo $id; ?>">
|
||||||
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
||||||
<tr><td><?php echo PLUGIN_LINKLIST_CAT_NAME; ?></td><td><input class="input_textbox" type="text" name="serendipity[add_category][title]" size="30" /></td></tr>
|
<tr>
|
||||||
<tr><td><?php echo PLUGIN_LINKLIST_PARENT_CATEGORY; ?></td><td><?php echo $this->category_box('cat',$categories,$cat); ?></td></tr>
|
<td><?php echo PLUGIN_LINKLIST_CAT_NAME; ?></td>
|
||||||
|
<td><input class="input_textbox" type="text" name="serendipity[add_category][title]" size="30" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo PLUGIN_LINKLIST_PARENT_CATEGORY; ?></td>
|
||||||
|
<td><?php echo $this->category_box('cat',$categories,$cat); ?></td>
|
||||||
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
echo '</table>';
|
echo '
|
||||||
echo '<div>';
|
</table>
|
||||||
echo $button;
|
<div>
|
||||||
echo '</div>';
|
' . $button . '
|
||||||
echo '</form>';
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
echo '<h3>'.PLUGIN_LINKLIST_ADMINCAT.'</h3>';
|
<h3>' . PLUGIN_LINKLIST_ADMINCAT . '</h3>
|
||||||
echo '<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist">'.PLUGIN_LINKLIST_ADMINLINK.'</a>';
|
<a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist">' . PLUGIN_LINKLIST_ADMINLINK . '</a>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist&serendipity[manage_category]=1" method="post">
|
<form action="?serendipity[adminModule]=event_display&serendipity[adminAction]=linklist&serendipity[manage_category]=1" method="post">
|
||||||
|
@ -727,8 +743,8 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
<td><strong><?php echo CATEGORY; ?></strong></td>
|
<td><strong><?php echo CATEGORY; ?></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$q = 'SELECT s.* FROM '.$serendipity['dbPrefix'].'link_category AS s
|
$q = 'SELECT s.* FROM '.$serendipity['dbPrefix'].'link_category AS s
|
||||||
ORDER BY s.category_name DESC';
|
ORDER BY s.category_name DESC';
|
||||||
|
|
||||||
$categories = serendipity_db_query($q);
|
$categories = serendipity_db_query($q);
|
||||||
$categories = @serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
|
$categories = @serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
|
||||||
|
@ -737,37 +753,39 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="16">
|
<td width="16">
|
||||||
<input class="input_checkbox" type="checkbox" name="serendipity[category_to_remove][]" value="<?php echo $category['categoryid']; ?>" />
|
<input class="input_checkbox" type="checkbox" name="serendipity[category_to_remove][]" value="<?php echo $category['categoryid']; ?>" />
|
||||||
|
</td>
|
||||||
|
<td width="300" style="padding-left: <?php echo ($category['depth']*15)+20 ?>px">
|
||||||
|
<img src="<?php echo serendipity_getTemplateFile('admin/img/folder.png') ?>" style="vertical-align: bottom;"> <?php echo (function_exists('serendipity_specialchars') ? serendipity_specialchars($category['category_name']) : htmlspecialchars($category['category_name'], ENT_COMPAT, LANG_CHARSET)) ?>
|
||||||
</td>
|
</td>
|
||||||
<td width="300" style="padding-left: <?php echo ($category['depth']*15)+20 ?>px"><img src="<?php echo serendipity_getTemplateFile('admin/img/folder.png') ?>" style="vertical-align: bottom;"> <?php echo (function_exists('serendipity_specialchars') ? serendipity_specialchars($category['category_name']) : htmlspecialchars($category['category_name'], ENT_COMPAT, LANG_CHARSET)) ?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
echo '<br />';
|
echo '
|
||||||
echo '</table>';
|
</table>
|
||||||
echo '<div>';
|
<div>
|
||||||
echo '<input type="submit" name="REMOVE" title="'.REMOVE.'" value="'.DELETE.'" class="serendipityPrettyButton input_button" />';
|
<input type="submit" name="REMOVE" title="' . REMOVE . '" value="' . DELETE . '" class="serendipityPrettyButton input_button state_cancel" />
|
||||||
echo '</div>';
|
</div>
|
||||||
echo '<div style="font-size: smaller;">'.PLUGIN_LINKLIST_DELETE_WARN.'</div>';
|
<div style="font-size: smaller;">' . PLUGIN_LINKLIST_DELETE_WARN . '</div>
|
||||||
echo '</form>';
|
</form>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function set_query($display) {
|
function set_query($display) {
|
||||||
global $serendipity;
|
global $serendipity;
|
||||||
$q = 'SELECT s.link AS link,
|
$q = 'SELECT s.link AS link,
|
||||||
s.title AS name,
|
s.title AS name,
|
||||||
s.descrip AS descrip,
|
s.descrip AS descrip,
|
||||||
s.category AS cat_id,
|
s.category AS cat_id,
|
||||||
s.id AS id
|
s.id AS id
|
||||||
FROM '.$serendipity['dbPrefix'].'links AS s ';
|
FROM '.$serendipity['dbPrefix'].'links AS s ';
|
||||||
switch($display) {
|
switch($display) {
|
||||||
case 'category':
|
case 'category':
|
||||||
$q .= 'ORDER BY s.category';
|
$q .= 'ORDER BY s.category';
|
||||||
break;
|
break;
|
||||||
case 'order_num':
|
case 'order_num':
|
||||||
$q .= 'ORDER BY s.order_num ASC';
|
$q .= 'ORDER BY s.order_num ASC';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dateacs':
|
case 'dateacs':
|
||||||
|
@ -778,7 +796,7 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
$q .= 'ORDER BY date_added DESC';
|
$q .= 'ORDER BY date_added DESC';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$q .= 'ORDER BY s.title ASC';
|
$q .= 'ORDER BY s.title ASC';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $q;
|
return $q;
|
||||||
|
@ -791,10 +809,10 @@ class serendipity_event_linklist extends serendipity_event {
|
||||||
} else {
|
} else {
|
||||||
$table = $serendipity['dbPrefix'].'category';
|
$table = $serendipity['dbPrefix'].'category';
|
||||||
}
|
}
|
||||||
$q = 'SELECT s.categoryid AS id,
|
$q = 'SELECT s.categoryid AS id,
|
||||||
s.category_name AS name
|
s.category_name AS name
|
||||||
FROM '.$table.' AS s
|
FROM '.$table.' AS s
|
||||||
ORDER BY s.category_name DESC';
|
ORDER BY s.category_name DESC';
|
||||||
$sql = serendipity_db_query($q);
|
$sql = serendipity_db_query($q);
|
||||||
$categories['0'] = '';
|
$categories['0'] = '';
|
||||||
if ($sql && is_array($sql)) {
|
if ($sql && is_array($sql)) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php #
|
<?php
|
||||||
|
|
||||||
|
|
||||||
if (IN_serendipity !== true) {
|
if (IN_serendipity !== true) {
|
||||||
die ("Don't hack!");
|
die ("Don't hack!");
|
||||||
|
@ -25,7 +24,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$propbag->add('description', PLUGIN_LINKS_BLAHBLAH);
|
$propbag->add('description', PLUGIN_LINKS_BLAHBLAH);
|
||||||
$propbag->add('stackable', true);
|
$propbag->add('stackable', true);
|
||||||
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
|
$propbag->add('author', 'Matthew Groeninger, Omid Mottaghi Rad');
|
||||||
$propbag->add('version', '1.20');
|
$propbag->add('version', '1.21');
|
||||||
$propbag->add('stackable', false);
|
$propbag->add('stackable', false);
|
||||||
$propbag->add('configuration', array(
|
$propbag->add('configuration', array(
|
||||||
'title',
|
'title',
|
||||||
|
@ -134,7 +133,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_NAME_DESC);
|
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_NAME_DESC);
|
||||||
$propbag->add('radio',
|
$propbag->add('radio',
|
||||||
array( 'value' => array('custom','default'),
|
array( 'value' => array('custom','default'),
|
||||||
'desc' => array(PLUGIN_LINKLIST_CATEGORY_NAME_CUSTOM,PLUGIN_LINKLIST_CATEGORY_NAME_DEFAULT)
|
'desc' => array(PLUGIN_LINKLIST_CATEGORY_NAME_CUSTOM,PLUGIN_LINKLIST_CATEGORY_NAME_DEFAULT)
|
||||||
));
|
));
|
||||||
$propbag->add('radio_per_row', '2');
|
$propbag->add('radio_per_row', '2');
|
||||||
$propbag->add('default', 'custom');
|
$propbag->add('default', 'custom');
|
||||||
|
@ -290,7 +289,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_DESC);
|
$propbag->add('description', PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_DESC);
|
||||||
$propbag->add('radio',
|
$propbag->add('radio',
|
||||||
array( 'value' => array('closed','open'),
|
array( 'value' => array('closed','open'),
|
||||||
'desc' => array(PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_CLOSED,PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_OPEN)
|
'desc' => array(PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_CLOSED,PLUGIN_LINKLIST_CATEGORY_DEFAULT_OPEN_NAME_OPEN)
|
||||||
));
|
));
|
||||||
$propbag->add('radio_per_row', '2');
|
$propbag->add('radio_per_row', '2');
|
||||||
$propbag->add('default', 'closed');
|
$propbag->add('default', 'closed');
|
||||||
|
@ -372,34 +371,33 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$imgdir = $serendipity['baseURL'] . 'plugins/' . $plugin_dir;
|
$imgdir = $serendipity['baseURL'] . 'plugins/' . $plugin_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = $this->get_config('prepend_text');
|
$str = $this->get_config('prepend_text');
|
||||||
$str.="\n\n";
|
$str .= "\n\n";
|
||||||
if ($style == "dtree") {
|
if ($style == "dtree") {
|
||||||
$str.='<script src="'.$serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '').'plugin/dtree.js" type="text/javascript"></script>';
|
$str .= "\n".'<script src="' . $serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '') . 'plugin/lldtree.js" type="text/javascript"></script>'."\n";
|
||||||
|
|
||||||
|
if ($this->get_config('showOpenAndCloseLinks')=='true' && $this->get_config('locationOfOpenAndClose')=='top'){
|
||||||
if($this->get_config('showOpenAndCloseLinks')=='true' && $this->get_config('locationOfOpenAndClose')=='top'){
|
$str .= '<p><a href="javascript: d.openAll();">'.$this->get_config('openAllText').'</a> | <a href="javascript: d.closeAll();">'.$this->get_config('closeAllText').'</a></p>';
|
||||||
$str.='<p><a href="javascript: d.openAll();">'.$this->get_config('openAllText').'</a> | <a href="javascript: d.closeAll();">'.$this->get_config('closeAllText').'</a></p>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$str.='<script type="text/javascript">
|
$str .= '<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
d = new dTree("d","'.$imgdir.'");'."\n";
|
d = new dTree("d","'.$imgdir.'");'."\n";
|
||||||
|
|
||||||
/* configuration section*/
|
/* configuration section*/
|
||||||
if($this->get_config('useSelection')!=true) $str.='d.config.useSelection=false;'."\n";
|
if ($this->get_config('useSelection')!=true) $str.='d.config.useSelection=false;'."\n";
|
||||||
if($this->get_config('useCookies')!=true) $str.='d.config.useCookies=false;'."\n";
|
if ($this->get_config('useCookies')!=true) $str.='d.config.useCookies=false;'."\n";
|
||||||
if($this->get_config('useLines')!=true) $str.='d.config.useLines=false;'."\n";
|
if ($this->get_config('useLines')!=true) $str.='d.config.useLines=false;'."\n";
|
||||||
if($this->get_config('useIcons')!=true) $str.='d.config.useIcons=false;'."\n";
|
if ($this->get_config('useIcons')!=true) $str.='d.config.useIcons=false;'."\n";
|
||||||
if($this->get_config('useStatusText')==true) $str.='d.config.useStatusText=true;'."\n";
|
if ($this->get_config('useStatusText')==true) $str.='d.config.useStatusText=true;'."\n";
|
||||||
if($this->get_config('closeSameLevel')==true) $str.='d.config.closeSameLevel=true;'."\n";
|
if ($this->get_config('closeSameLevel')==true) $str.='d.config.closeSameLevel=true;'."\n";
|
||||||
$my_target = $this->get_config('target');
|
$my_target = $this->get_config('target');
|
||||||
if (!empty($my_target)) {
|
if (!empty($my_target)) {
|
||||||
$str.='d.config.target="'.$my_target.'";'."\n";
|
$str .= 'd.config.target="'.$my_target.'";'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add Directory and Links */
|
/* Add Directory and Links */
|
||||||
$str.='d.add(0,-1,"'.$this->get_config('top_level').'");'."\n";
|
$str .= 'd.add(0,-1,"'.$this->get_config('top_level').'");'."\n";
|
||||||
|
|
||||||
for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
||||||
if(isset($struct[$i]['type'])){
|
if(isset($struct[$i]['type'])){
|
||||||
|
@ -430,7 +428,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if($this->get_config('call_markup')!='true') {
|
if($this->get_config('call_markup') != 'true') {
|
||||||
$delimiter = "\n";
|
$delimiter = "\n";
|
||||||
} else {
|
} else {
|
||||||
$delimiter = "";
|
$delimiter = "";
|
||||||
|
@ -444,26 +442,26 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$link_array = array();
|
$link_array = array();
|
||||||
$dirname = array();
|
$dirname = array();
|
||||||
$level = array();
|
$level = array();
|
||||||
$dir_array['']=array('dirname'=>'','level'=>1,linkcount=>0,'links'=>$link_array,'dircount'=>0,'directories'=>$link_array);
|
$dir_array[''] = array('dirname' => '','level' => 1,linkcount => 0,'links' => $link_array,'dircount' => 0,'directories' => $link_array);
|
||||||
for($level[]=0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
for($level[] = 0, $i=1, $j=1; isset($struct[$i]); $i++, $j++){
|
||||||
if(isset($struct[$i]['type'])){
|
if (isset($struct[$i]['type'])){
|
||||||
if($struct[$i]['type']=='open' && strtolower($struct[$i]['tag'])=='dir'){
|
if($struct[$i]['type'] == 'open' && strtolower($struct[$i]['tag']) == 'dir'){
|
||||||
$dir_array[$dirname[0]]['directories'][] = $this->decode($struct[$i]['attributes']['NAME']);
|
$dir_array[$dirname[0]]['directories'][] = $this->decode($struct[$i]['attributes']['NAME']);
|
||||||
$dir_array[$dirname[0]]['dircount']++;
|
$dir_array[$dirname[0]]['dircount']++;
|
||||||
array_unshift($dirname, $this->decode($struct[$i]['attributes']['NAME']));
|
array_unshift($dirname, $this->decode($struct[$i]['attributes']['NAME']));
|
||||||
array_unshift($level,$j);
|
array_unshift($level,$j);
|
||||||
$dir_array[$dirname[0]] = array('dirname'=>$dirname[0],'level'=>count($level),'linkcount'=>0,'links'=>$link_array,'dircount'=>0,'directories'=>$link_array);
|
$dir_array[$dirname[0]] = array('dirname' => $dirname[0],'level' => count($level),'linkcount' => 0,'links' => $link_array,'dircount' => 0,'directories' => $link_array);
|
||||||
} else if($struct[$i]['type']=='close' && strtolower($struct[$i]['tag'])=='dir'){
|
} else if($struct[$i]['type'] == 'close' && strtolower($struct[$i]['tag']) == 'dir'){
|
||||||
$dump=array_shift($dirname);
|
$dump=array_shift($dirname);
|
||||||
$dump=array_shift($level);
|
$dump=array_shift($level);
|
||||||
} else if($struct[$i]['type']=='complete' && strtolower($struct[$i]['tag'])=='link'){
|
} else if($struct[$i]['type'] == 'complete' && strtolower($struct[$i]['tag']) == 'link'){
|
||||||
$dir_array[$dirname[0]]['linkcount']++;
|
$dir_array[$dirname[0]]['linkcount']++;
|
||||||
if (count($level) == 0) {
|
if (count($level) == 0) {
|
||||||
$level_pass = 1;
|
$level_pass = 1;
|
||||||
} else {
|
} else {
|
||||||
$level_pass = count($level)+1;
|
$level_pass = count($level)+1;
|
||||||
}
|
}
|
||||||
$basic_array = array('linkloc'=>$this->decode($struct[$i]['attributes']['LINK']),'name'=>$this->decode($struct[$i]['attributes']['NAME']),'descr'=>$this->decode($struct[$i]['attributes']['DESCRIP']),'level'=>$level_pass,'dirname'=>$dirname,'hcard'=>$this->decode($struct[$i]['attributes']['HCARD']),'rel'=>$this->decode($struct[$i]['attributes']['REL']));
|
$basic_array = array('linkloc' => $this->decode($struct[$i]['attributes']['LINK']),'name' => $this->decode($struct[$i]['attributes']['NAME']),'descr' => $this->decode($struct[$i]['attributes']['DESCRIP']),'level' => $level_pass,'dirname' => $dirname,'hcard' => $this->decode($struct[$i]['attributes']['HCARD']),'rel' => $this->decode($struct[$i]['attributes']['REL']));
|
||||||
$dir_array[$dirname[0]]['links'][] = $basic_array;
|
$dir_array[$dirname[0]]['links'][] = $basic_array;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,32 +474,32 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$imagear['uselines'] = $this->get_config('useLines');
|
$imagear['uselines'] = $this->get_config('useLines');
|
||||||
$imagear['useicons'] = $this->get_config('useIcons');
|
$imagear['useicons'] = $this->get_config('useIcons');
|
||||||
if ($imagear['useicons']) {
|
if ($imagear['useicons']) {
|
||||||
$imagear['folder'] = '/img/folder.gif';
|
$imagear['folder'] = '/img/folder.gif';
|
||||||
$imagear['folderopen'] = '/img/folderopen.gif';
|
$imagear['folderopen'] = '/img/folderopen.gif';
|
||||||
$imagear['page'] = '/img/page.gif';
|
$imagear['page'] = '/img/page.gif';
|
||||||
}
|
}
|
||||||
if ($this->get_config('useLines')) {
|
if ($this->get_config('useLines')) {
|
||||||
$imagear['line'] = '/img/line.gif';
|
$imagear['line'] = '/img/line.gif';
|
||||||
$imagear['join'] = '/img/join.gif';
|
$imagear['join'] = '/img/join.gif';
|
||||||
$imagear['joinBottom'] = '/img/joinbottom.gif';
|
$imagear['joinBottom'] = '/img/joinbottom.gif';
|
||||||
$imagear['plus'] = '/img/plus.gif';
|
$imagear['plus'] = '/img/plus.gif';
|
||||||
$imagear['plusBottom'] = '/img/plusbottom.gif';
|
$imagear['plusBottom'] = '/img/plusbottom.gif';
|
||||||
$imagear['minus'] = '/img/minus.gif';
|
$imagear['minus'] = '/img/minus.gif';
|
||||||
$imagear['minusBottom']= '/img/minusbottom.gif';
|
$imagear['minusBottom'] = '/img/minusbottom.gif';
|
||||||
$imagear['empty_image']= '/img/empty.gif';
|
$imagear['empty_image'] = '/img/empty.gif';
|
||||||
} else {
|
} else {
|
||||||
$imagear['line'] = '/img/empty.gif';
|
$imagear['line'] = '/img/empty.gif';
|
||||||
$imagear['join'] = '/img/empty.gif';
|
$imagear['join'] = '/img/empty.gif';
|
||||||
$imagear['joinBottom'] = '/img/empty.gif';
|
$imagear['joinBottom'] = '/img/empty.gif';
|
||||||
$imagear['plus'] = '/img/nolines_plus.gif';
|
$imagear['plus'] = '/img/nolines_plus.gif';
|
||||||
$imagear['plusBottom'] = '/img/nolines_plus.gif';
|
$imagear['plusBottom'] = '/img/nolines_plus.gif';
|
||||||
$imagear['minus'] = '/img/nolines_minus.gif';
|
$imagear['minus'] = '/img/nolines_minus.gif';
|
||||||
$imagear['minusBottom']= '/img/nolines_minus.gif';
|
$imagear['minusBottom'] = '/img/nolines_minus.gif';
|
||||||
$imagear['empty_image']= '/img/empty.gif';
|
$imagear['empty_image'] = '/img/empty.gif';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$lessformatting) {
|
if (!$lessformatting) {
|
||||||
$str.='<script src="'.$serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '').'plugin/linklist.js" type="text/javascript"></script>';
|
$str .= '<script src="'.$serendipity['baseURL'] . ($serendipity['rewrite'] == 'none' ? $serendipity['indexFile'] . '?/' : '').'plugin/linklist.js" type="text/javascript"></script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= '<div class="linklist"><ul>'.$delimiter;
|
$str .= '<div class="linklist"><ul>'.$delimiter;
|
||||||
|
@ -510,14 +508,14 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$str .= '</ul></div>';
|
$str .= '</ul></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$str.=$this->get_config('append_text');
|
$str .= $this->get_config('append_text');
|
||||||
|
|
||||||
if($this->get_config('call_markup')=='true') {
|
if ($this->get_config('call_markup') == 'true') {
|
||||||
$entry = array('html_nugget' => $str);
|
$entry = array('html_nugget' => $str);
|
||||||
serendipity_plugin_api::hook_event('frontend_display', $entry);
|
serendipity_plugin_api::hook_event('frontend_display', $entry);
|
||||||
return $entry['html_nugget'];
|
return $entry['html_nugget'];
|
||||||
} else {
|
} else {
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,16 +526,16 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
if ($this->get_config('cache') == 'no') {
|
if ($this->get_config('cache') == 'no') {
|
||||||
if (@include_once("Cache/Lite.php")) {
|
if (@include_once("Cache/Lite.php")) {
|
||||||
$cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
$cache_obj = new Cache_Lite( array('cacheDir' => $serendipity['serendipityPath'].'templates_c/','automaticSerialization' => true));
|
||||||
$cache_obj->remove('linklist_html');
|
@$cache_obj->remove('linklist_html');
|
||||||
$cache_obj->remove('linklist_xmlhash');
|
@$cache_obj->remove('linklist_xmlhash');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$setdata = array('display' => $this->get_config('display'),
|
$setdata = array('display' => $this->get_config('display'),
|
||||||
'category' => $this->get_config('category'),
|
'category' => $this->get_config('category'),
|
||||||
'style' => $this->get_config('style'),
|
'style' => $this->get_config('style'),
|
||||||
'cache' => $cache);
|
'cache' => $cache);
|
||||||
|
|
||||||
if($this->get_config('directxml')!='true') {
|
if($this->get_config('directxml') != 'true') {
|
||||||
$blah = $this->get_config('display');
|
$blah = $this->get_config('display');
|
||||||
if (!isset($blah)) {
|
if (!isset($blah)) {
|
||||||
$this->set_config('display','category');
|
$this->set_config('display','category');
|
||||||
|
@ -548,7 +546,7 @@ class serendipity_plugin_linklist extends serendipity_plugin
|
||||||
$setdata['enabled'] = 'false';
|
$setdata['enabled'] = 'false';
|
||||||
}
|
}
|
||||||
serendipity_plugin_api::hook_event('plugins_linklist_conf',$setdata);
|
serendipity_plugin_api::hook_event('plugins_linklist_conf',$setdata);
|
||||||
if ($setdata['changed']=='true') {
|
if ($setdata['changed'] == 'true') {
|
||||||
$this->set_config('links',$setdata['links']);
|
$this->set_config('links',$setdata['links']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue