PDA

View Full Version : Domino Outline



galdaka
22 May 2007, 12:52 PM
Thanks in advance for open this forum.

I developing with client 5.0.18 and Domino 6.5.3. I use this library for view Domino Outlines in Web with good results.


String.prototype.trim = function(){
return this.replace(/^\s*|\s*$/g, "");
};

DominoUIOutline = function(config) {
Ext.apply(this,config);
this.init();
};

DominoUIOutline.prototype.init = function() {
YAHOO.util.Connect.asyncRequest('POST', this.outlineUrl + '?ReadEntries', {
success : this.init2.createDelegate(this),
failure : this.init2.createDelegate(this)
}, null);
};

DominoUIOutline.prototype.init2 = function(o) {
var response = o.responseXML;
var arEntries = response.getElementsByTagName('outlineentry');

var Tree = Ext.tree;

var target;
if (this.outlinePanel){
target = this.outlinePanel.getEl();
}else if (this.htmlTarget){
target = this.htmlTarget;
}else {
alert("Error. No hay contenedor para el tree.");
}

tree = new Tree.TreePanel(target, {
animate : true,
containerScroll : true,
rootVisible : false
});

var root = new Tree.TreeNode({
text : 'domino-folders',
draggable : false,
id : 'domino-folders'
});
tree.setRootNode(root);

this.tree = tree;

var curNode = null;
var arNodes = [];
for (var i=0; i<arEntries.length; i++) {
var entry = arEntries.item(i);
var dwtType = entry.attributes.getNamedItem('type').value;
var dwtTitle = entry.attributes.getNamedItem('title').value;
var tmpdwtHref = entry.attributes.getNamedItem('url');
var dwtHref = (tmpdwtHref) ? tmpdwtHref.value : "";

var tmpframeName = entry.attributes.getNamedItem('framesetname');
var frameName = (tmpframeName) ? tmpframeName.value : "";

var expandable = entry.attributes.getNamedItem('expandable');
var isExpandable = (expandable) ? true : false;

var tmpdwtIcon = entry.attributes.getNamedItem('icon');
var dwtIcon = (tmpdwtIcon) ? tmpdwtIcon.value : "";
var curPosition = entry.attributes.getNamedItem('position').value;

var cls;
switch (dwtType) {
// section
case "0" :
cls = (isExpandable) ? "folder" : "file";
break;
// view
case "2" :
cls = "file";
break;
// folder
case "20" :
cls = "folder";
break;
default :
cls = "file";
};

var curNode = new Tree.TreeNode({
text : dwtTitle,
cls : cls,
allowDrag : true,
isTarget : true,
leaf : false,
dwtHref : dwtHref,
frameName : frameName,
dwtType : dwtType,
dwtExpandable: isExpandable,
dwtPosition : curPosition,
icon : dwtIcon
});

curNode.on('click', this.openEntry.createDelegate(this), this, true);

arNodes[curPosition] = curNode;

if (curPosition.indexOf('.') > 0) {
var parentPosition = curPosition.substring(0,curPosition.lastIndexOf('.'));
arNodes[parentPosition].appendChild(curNode);
} else {
root.appendChild(curNode);
}

};

tree.on('nodedragover', function(node) {
alert(' dragging...');
});
tree.on('dragdrop', function(node) {
alert(' dd');
});

tree.render();

root.expand();
};

DominoUIOutline.prototype.openEntry = function(node, e){
var attributes, dwtType, dwtHref, dwtPosition, entryId, title, frameName;
attributes = node.attributes;
dwtHref = attributes.dwtHref;
frameName = attributes.frameName;
dwtType = attributes.dwtType;
dwtPosition = attributes.dwtPosition;
entryId = "id-" + dwtPosition;
title = node.text.trim();

if ((dwtType == "2" || dwtType == "20") & dwtHref != "") {
var idPestana = "";
for(var i = 0; i<this.targetLayout.getRegion(this.targetRegion).panels.items.length; i++){
if(this.targetLayout.getRegion(this.targetRegion).panels.items[i].title == title){
idPestana = this.targetLayout.getRegion(this.targetRegion).panels.items[i].getId();
break;
}
}
if (idPestana != ""){
this.targetLayout.getRegion(this.targetRegion).showPanel(idPestana);
}else{
var viewUrl = (dwtHref.indexOf('?') > 0) ? dwtHref.split('?')[0] : dwtHref.split('!')[0];
var iframe = Ext.DomHelper.append(document.body, {tag: 'iframe', frameBorder: 0, src: viewUrl});
var panel = new Ext.ContentPanel(iframe, {title: title, fitToFrame:true, closable:true});
this.targetLayout.add(this.targetRegion, panel);
//this.layout.showPanel(this.viewPanel);
}
} else if (dwtHref != "") {
switch (frameName.toLowerCase()){
case "new":
window.open(dwtHref);
break;
case "void":
//Ejecutamos javaScript sin abrir nada
eval(dwtHref);
break;
default:
var idPestana = "";
for(var i = 0; i<this.targetLayout.getRegion(this.targetRegion).panels.items.length; i++){
if(this.targetLayout.getRegion(this.targetRegion).panels.items[i].title == title){
idPestana = this.targetLayout.getRegion(this.targetRegion).panels.items[i].getId();
break;
}
}
if (idPestana != ""){
this.targetLayout.getRegion(this.targetRegion).showPanel(idPestana);
}else{
var viewUrl = (dwtHref.indexOf('?') > 0) ? dwtHref.split('?')[0] : dwtHref.split('!')[0];
var iframe = Ext.DomHelper.append(document.body, {tag: 'iframe', frameBorder: 0, src: viewUrl});
var panel = new Ext.ContentPanel(iframe, {title: title, fitToFrame:true, closable:true});
this.targetLayout.add(this.targetRegion, panel);
break;
}
}
}
};

Ext.data.Node.prototype.hasChildNodes = function() {
if (this.attributes.dwtType == "20" || (this.attributes.dwtType == "0" && this.attributes.dwtExpandable == true)) {
return true;
} else {
return false;
}
};

And this is the code to create a Outline:


outlineP = new DominoUIOutline({
targetLayout : layout,
targetRegion : 'center',
outlinePanel : layoutWestP,
outlineUrl : 'menuIzdoP'
});

The rest od the configuration in Domino Designer (Icons, Elements to open, ...)

The results: http://extjs.com/forum/attachment.php?attachmentid=94&d=1176397306

jratcliff
22 May 2007, 1:25 PM
@galdaka - very very nice.


Here's a Domino Directory using the Ext.nd.UIOutline
http://openntf.org/extnd/names.nsf/main.html

Now compare that to what Domino gives you by default
http://openntf.org/extnd/names.nsf

fredrik.stockel
23 May 2007, 1:11 AM
Nice implementations! :)

perka
23 May 2007, 1:38 AM
I like it a lot. :D

pravink nair
11 Aug 2008, 3:23 AM
Dear ,

can you pls. help me in implementing this code

galdaka
12 Aug 2008, 12:37 PM
Dear ,

can you pls. help me in implementing this code

www.jadacosta.es