fix from DHTMLx Team <dhtmlx-AT-scand.com> modified by me to fix the wrong alignment of open folders in Konqueror

This commit is contained in:
Ralf Becker 2006-03-20 19:13:15 +00:00
parent 5e2d1d2367
commit 11ce7b455d
6 changed files with 251 additions and 50 deletions

View File

@ -1,7 +1,3 @@
/*
Copyright Scand LLC http://www.scbr.com
This version of Software is free for using in non-commercial applications. For commercial use please contact info@scbr.com to obtain license
*/
/**
* @desc: xmlLoader object
* @type: private
@ -26,12 +22,12 @@ function dtmlXMLLoaderObject(funcObject, dhtmlObject,async){
* @topic: 0
*/
dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){
this.check=function (){
this.check=function (){
if(dhtmlObject.onloadAction!=null){
if (!dhtmlObject.xmlDoc.readyState) dhtmlObject.onloadAction(dhtmlObject.mainObject);
else {
else {
if (dhtmlObject.xmlDoc.readyState != 4) return false;
else dhtmlObject.onloadAction(dhtmlObject.mainObject); }
else dhtmlObject.onloadAction(dhtmlObject.mainObject,null,null,null,dhtmlObject); }
}
};
return this.check;
@ -48,16 +44,16 @@ function dtmlXMLLoaderObject(funcObject, dhtmlObject,async){
if (this.xmlDoc.responseXML) { var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName); var z=temp[0]; }
else var z=this.xmlDoc.documentElement;
if (z) return z;
alert("Incorrect XML");
dhtmlxError.throwError("LoadXML","Incorrect XML",[this.xmlDoc])
return document.createElement("DIV");
};
/**
/**
* @desc: load XML
* @type: private
* @param: filePath - xml file path
* @topic: 0
*/
*/
dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){
try
{
@ -342,9 +338,17 @@ function dhtmlDragAndDropObject(){
window.frames[i].dhtmlDragAndDrop.initFrameRoute(window,((!win||mode)?1:0));
}
var _isFF=false; var _isIE=false; var _isOpera=false; var _isSafari=false;
if (navigator.userAgent.indexOf('Safari') != -1 || navigator.userAgent.indexOf('Konqueror') != -1)
_isSafari=true;
else if (navigator.userAgent.indexOf('Opera') != -1)
_isOpera=true;
else if(navigator.appName.indexOf("Microsoft")!=-1)
_isIE=true;
else _isFF=true;
//deprecated, use global constant instead
//determines if current browser is IE
function isIE(){
if(navigator.appName.indexOf("Microsoft")!=-1)
@ -355,6 +359,7 @@ function isIE(){
//multibrowser Xpath processor
dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
if ((_isOpera)||(_isSafari)) return this.doXPathOpera(xpathExp,docObj);
if(isIE()){//IE
if(arguments.length==1){
docObj = this.xmlDoc
@ -374,7 +379,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}else{
nodeObj = docObj;
docObj = docObj.ownerDocument;
}
var rowsCol = new Array();
var col = docObj.evaluate(xpathExp, nodeObj, null, XPathResult.ANY_TYPE,null);
@ -386,8 +391,8 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
return rowsCol;
}
}
if ( window.Node )
if (( window.Node )&&(!_isSafari))
Node.prototype.removeNode = function( removeChildren )
{
var self = this;
@ -403,3 +408,56 @@ Node.prototype.removeNode = function( removeChildren )
}
}
function _dhtmlxError(type,name,params){
if (!this.catches)
this.catches=new Array();
return this;
}
_dhtmlxError.prototype.catchError=function(type,func_name){
this.catches[type]=func_name;
}
_dhtmlxError.prototype.throwError=function(type,name,params){
if (this.catches[type]) return this.catches[type](type,name,params);
if (this.catches["ALL"]) return this.catches["ALL"](type,name,params);
alert("Error type: " + arguments[0]+"\nDescription: " + arguments[1] );
return null;
}
window.dhtmlxError=new _dhtmlxError();
//opera fake, while 9.0 not released
//multibrowser Xpath processor
dtmlXMLLoaderObject.prototype.doXPathOpera = function(xpathExp,docObj){
//this is fake for Opera
var z=xpathExp.replace(/[\/]+/gi,"/").split('/');
var obj=null;
var i=1;
if (!z.length) return [];
if (z[0]==".")
obj=[docObj];
else if (z[0]=="")
{
obj=this.xmlDoc.responseXML.getElementsByTagName(z[i]);
i++;
}
else return [];
for (i; i<z.length; i++)
obj=this._getAllNamedChilds(obj,z[i]);
return obj;
}
dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(a,b){
var c=new Array();
for (var i=0; i<a.length; i++)
for (var j=0; j<a[i].childNodes.length; j++)
if (a[i].childNodes[j].tagName==b) c[c.length]=a[i].childNodes[j];
return c;
}

View File

@ -1,6 +1,7 @@
/*
Copyright Scand LLC http://www.scbr.com
This version of Software is free for using in non-commercial applications. For commercial use please contact info@scbr.com to obtain license
This version of Software is free for using in non-commercial applications.
For commercial use please contact info@scbr.com to obtain license
*/
/*_TOPICS_
@0:Initialization
@ -19,7 +20,7 @@ This version of Software is free for using in non-commercial applications. For c
* @param: height - tree height
* @param: rootId - id of virtual root node
* @type: public
* @topic: 0
* @topic: 0
*/
function dhtmlXTreeObject(htmlObject, width, height, rootId){
this._isOpera=(navigator.userAgent.indexOf('Opera')!= -1);
@ -66,7 +67,7 @@ function dhtmlXTreeObject(htmlObject, width, height, rootId){
this.timgen=true;
this.dpcpy=false;
this.imPath="treeGfx/";
this.checkArray=new Array("iconUnCheckAll.gif","iconCheckAll.gif","iconCheckGray.gif","iconUncheckDis.gif");
this.lineArray=new Array("line2.gif","line3.gif","line4.gif","blank.gif","blank.gif");
@ -440,7 +441,7 @@ function dhtmlXTreeItemObject(itemId,itemText,parentObject,treeObject,actionHand
{
var nodx=node.childNodes[i];
var name=nodx.getAttribute("text");
var cId=nodx.getAttribute("id");
var cId=nodx.getAttribute("id");
if ((!dhtmlObject.waitUpdateXML)||(dhtmlObject.waitUpdateXML.toString().search(","+cId+",")!=-1))
{
var im0=nodx.getAttribute("im0");
@ -982,7 +983,9 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
// var inp=document.createElement("input"); inp.type="checkbox"; inp.style.width="12px"; inp.style.height="12px";
var inp=document.createElement((itemObject.id==this.rootId)?"div":"img");
inp.checked=0; inp.src=this.imPath+this.checkArray[0]; inp.style.width="16px"; inp.style.height="16px";
if (!acheck) ((this._isOpera)?td11:inp).style.display="none";
//can cause problems with hide/show check
if (!acheck) (((_isOpera)||(_isSafari))?td11:inp).style.display="none";
// td11.className="standartTreeImage";
//if (acheck)
td11.appendChild(inp);
@ -1015,8 +1018,10 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
itemObject.span.className="standartTreeRow";
if (this.mlitems) itemObject.span.style.width=this.mlitems;
else td2.noWrap=true;
td2.style.width="100%";
itemObject.span.appendChild(document.createTextNode(itemObject.label));
if (!_isSafari) td2.style.width="100%";
// itemObject.span.appendChild(document.createTextNode(itemObject.label));
itemObject.span.innerHTML=itemObject.label;
td2.appendChild(itemObject.span);
td2.parentObject=itemObject; td1.parentObject=itemObject;
td2.onclick=this.onRowSelect; td1.onclick=this.onRowClick; td2.ondblclick=this.onRowClick2;

View File

@ -1,4 +1,8 @@
/*
Copyright Scand LLC http://www.scbr.com
This version of Software is free for using in non-commercial applications.
For commercial use please contact info@scbr.com to obtain license
*/
function dtmlXMLLoaderObject(funcObject,dhtmlObject,async){
this.xmlDoc="";
if(arguments.length==2)
@ -16,7 +20,7 @@ function dtmlXMLLoaderObject(funcObject,dhtmlObject,async){
if(!dhtmlObject.xmlDoc.readyState)dhtmlObject.onloadAction(dhtmlObject.mainObject);
else{
if(dhtmlObject.xmlDoc.readyState != 4)return false;
else dhtmlObject.onloadAction(dhtmlObject.mainObject);}
else dhtmlObject.onloadAction(dhtmlObject.mainObject,null,null,null,dhtmlObject);}
}
};
return this.check;
@ -27,7 +31,7 @@ function dtmlXMLLoaderObject(funcObject,dhtmlObject,async){
if(this.xmlDoc.responseXML){var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName);var z=temp[0];}
else var z=this.xmlDoc.documentElement;
if(z)return z;
alert("Incorrect XML");
dhtmlxError.throwError("LoadXML","Incorrect XML",[this.xmlDoc])
return document.createElement("DIV");
};
@ -289,9 +293,17 @@ function dhtmlDragAndDropObject(){
window.frames[i].dhtmlDragAndDrop.initFrameRoute(window,((!win||mode)?1:0));
}
var _isFF=false;var _isIE=false;var _isOpera=false;var _isSafari=false;
if(navigator.userAgent.indexOf('Safari')!= -1 || navigator.userAgent.indexOf('Konqueror')!= -1)
_isSafari=true;
else if(navigator.userAgent.indexOf('Opera')!= -1)
_isOpera=true;
else if(navigator.appName.indexOf("Microsoft")!=-1)
_isIE=true;
else _isFF=true;
function isIE(){
if(navigator.appName.indexOf("Microsoft")!=-1)
@ -302,6 +314,7 @@ function isIE(){
dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
if((_isOpera)||(_isSafari))return this.doXPathOpera(xpathExp,docObj);
if(isIE()){
if(arguments.length==1){
docObj = this.xmlDoc
@ -321,7 +334,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}else{
nodeObj = docObj;
docObj = docObj.ownerDocument;
}
var rowsCol = new Array();
var col = docObj.evaluate(xpathExp,nodeObj,null,XPathResult.ANY_TYPE,null);
@ -333,8 +346,8 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
return rowsCol;
}
}
if(window.Node)
if((window.Node)&&(!_isSafari))
Node.prototype.removeNode = function(removeChildren)
{
var self = this;
@ -350,4 +363,57 @@ Node.prototype.removeNode = function(removeChildren)
}
}
function _dhtmlxError(type,name,params){
if(!this.catches)
this.catches=new Array();
return this;
}
_dhtmlxError.prototype.catchError=function(type,func_name){
this.catches[type]=func_name;
}
_dhtmlxError.prototype.throwError=function(type,name,params){
if(this.catches[type])return this.catches[type](type,name,params);
if(this.catches["ALL"])return this.catches["ALL"](type,name,params);
alert("Error type: "+arguments[0]+"\nDescription: "+arguments[1]);
return null;
}
window.dhtmlxError=new _dhtmlxError();
dtmlXMLLoaderObject.prototype.doXPathOpera = function(xpathExp,docObj){
var z=xpathExp.replace(/[\/]+/gi,"/").split('/');
var obj=null;
var i=1;
if(!z.length)return [];
if(z[0]==".")
obj=[docObj];
else if(z[0]=="")
{
obj=this.xmlDoc.responseXML.getElementsByTagName(z[i]);
i++;
}
else return [];
for(i;i<z.length;i++)
obj=this._getAllNamedChilds(obj,z[i]);
return obj;
}
dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(a,b){
var c=new Array();
for(var i=0;i<a.length;i++)
for(var j=0;j<a[i].childNodes.length;j++)
if(a[i].childNodes[j].tagName==b)c[c.length]=a[i].childNodes[j];
return c;
}

View File

@ -1,7 +1,14 @@
/*
Copyright Scand LLC http://www.scbr.com
This version of Software is free for using in non-commercial applications.
For commercial use please contact info@scbr.com to obtain license
*/
function dhtmlXTreeObject(htmlObject,width,height,rootId){
this._isOpera=(navigator.userAgent.indexOf('Opera')!= -1);
if(typeof(htmlObject)!="object")
this.parentObject=document.getElementById(htmlObject);
else
@ -776,7 +783,9 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
var inp=document.createElement((itemObject.id==this.rootId)?"div":"img");
inp.checked=0;inp.src=this.imPath+this.checkArray[0];inp.style.width="16px";inp.style.height="16px";
if(!acheck)inp.style.display="none";
if(!acheck)(((_isOpera)||(_isSafari))?td11:inp).style.display="none";
td11.appendChild(inp);
@ -809,8 +818,10 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
itemObject.span.className="standartTreeRow";
if(this.mlitems)itemObject.span.style.width=this.mlitems;
else td2.noWrap=true;
td2.style.width="100%";
itemObject.span.appendChild(document.createTextNode(itemObject.label));
if(!_isSafari)td2.style.width="100%";
itemObject.span.innerHTML=itemObject.label;
td2.appendChild(itemObject.span);
td2.parentObject=itemObject;td1.parentObject=itemObject;
td2.onclick=this.onRowSelect;td1.onclick=this.onRowClick;td2.ondblclick=this.onRowClick2;

View File

@ -1,8 +1,3 @@
/*
Copyright Scand LLC http://www.scbr.com
This version of Software is free for using in non-commercial applications.
For commercial use please contact info@scbr.com to obtain license
*/
/**
* @desc: xmlLoader object
* @type: private
@ -27,12 +22,12 @@ function dtmlXMLLoaderObject(funcObject, dhtmlObject,async){
* @topic: 0
*/
dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){
this.check=function (){
this.check=function (){
if(dhtmlObject.onloadAction!=null){
if (!dhtmlObject.xmlDoc.readyState) dhtmlObject.onloadAction(dhtmlObject.mainObject);
else {
else {
if (dhtmlObject.xmlDoc.readyState != 4) return false;
else dhtmlObject.onloadAction(dhtmlObject.mainObject); }
else dhtmlObject.onloadAction(dhtmlObject.mainObject,null,null,null,dhtmlObject); }
}
};
return this.check;
@ -49,16 +44,16 @@ function dtmlXMLLoaderObject(funcObject, dhtmlObject,async){
if (this.xmlDoc.responseXML) { var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName); var z=temp[0]; }
else var z=this.xmlDoc.documentElement;
if (z) return z;
alert("Incorrect XML");
dhtmlxError.throwError("LoadXML","Incorrect XML",[this.xmlDoc])
return document.createElement("DIV");
};
/**
/**
* @desc: load XML
* @type: private
* @param: filePath - xml file path
* @topic: 0
*/
*/
dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){
try
{
@ -343,9 +338,17 @@ function dhtmlDragAndDropObject(){
window.frames[i].dhtmlDragAndDrop.initFrameRoute(window,((!win||mode)?1:0));
}
var _isFF=false; var _isIE=false; var _isOpera=false; var _isSafari=false;
if (navigator.userAgent.indexOf('Safari') != -1 || navigator.userAgent.indexOf('Konqueror') != -1)
_isSafari=true;
else if (navigator.userAgent.indexOf('Opera') != -1)
_isOpera=true;
else if(navigator.appName.indexOf("Microsoft")!=-1)
_isIE=true;
else _isFF=true;
//deprecated, use global constant instead
//determines if current browser is IE
function isIE(){
if(navigator.appName.indexOf("Microsoft")!=-1)
@ -356,6 +359,7 @@ function isIE(){
//multibrowser Xpath processor
dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
if ((_isOpera)||(_isSafari)) return this.doXPathOpera(xpathExp,docObj);
if(isIE()){//IE
if(arguments.length==1){
docObj = this.xmlDoc
@ -375,7 +379,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}else{
nodeObj = docObj;
docObj = docObj.ownerDocument;
}
var rowsCol = new Array();
var col = docObj.evaluate(xpathExp, nodeObj, null, XPathResult.ANY_TYPE,null);
@ -387,8 +391,8 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
return rowsCol;
}
}
if ( window.Node )
if (( window.Node )&&(!_isSafari))
Node.prototype.removeNode = function( removeChildren )
{
var self = this;
@ -404,3 +408,56 @@ Node.prototype.removeNode = function( removeChildren )
}
}
function _dhtmlxError(type,name,params){
if (!this.catches)
this.catches=new Array();
return this;
}
_dhtmlxError.prototype.catchError=function(type,func_name){
this.catches[type]=func_name;
}
_dhtmlxError.prototype.throwError=function(type,name,params){
if (this.catches[type]) return this.catches[type](type,name,params);
if (this.catches["ALL"]) return this.catches["ALL"](type,name,params);
alert("Error type: " + arguments[0]+"\nDescription: " + arguments[1] );
return null;
}
window.dhtmlxError=new _dhtmlxError();
//opera fake, while 9.0 not released
//multibrowser Xpath processor
dtmlXMLLoaderObject.prototype.doXPathOpera = function(xpathExp,docObj){
//this is fake for Opera
var z=xpathExp.replace(/[\/]+/gi,"/").split('/');
var obj=null;
var i=1;
if (!z.length) return [];
if (z[0]==".")
obj=[docObj];
else if (z[0]=="")
{
obj=this.xmlDoc.responseXML.getElementsByTagName(z[i]);
i++;
}
else return [];
for (i; i<z.length; i++)
obj=this._getAllNamedChilds(obj,z[i]);
return obj;
}
dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(a,b){
var c=new Array();
for (var i=0; i<a.length; i++)
for (var j=0; j<a[i].childNodes.length; j++)
if (a[i].childNodes[j].tagName==b) c[c.length]=a[i].childNodes[j];
return c;
}

View File

@ -983,7 +983,9 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
// var inp=document.createElement("input"); inp.type="checkbox"; inp.style.width="12px"; inp.style.height="12px";
var inp=document.createElement((itemObject.id==this.rootId)?"div":"img");
inp.checked=0; inp.src=this.imPath+this.checkArray[0]; inp.style.width="16px"; inp.style.height="16px";
if (!acheck) ((this._isOpera)?td11:inp).style.display="none";
//can cause problems with hide/show check
if (!acheck) (((_isOpera)||(_isSafari))?td11:inp).style.display="none";
// td11.className="standartTreeImage";
//if (acheck)
td11.appendChild(inp);
@ -1016,8 +1018,10 @@ dhtmlXTreeObject.prototype._correctCheckStates=function(dhtmlObject){
itemObject.span.className="standartTreeRow";
if (this.mlitems) itemObject.span.style.width=this.mlitems;
else td2.noWrap=true;
td2.style.width="100%";
itemObject.span.appendChild(document.createTextNode(itemObject.label));
if (!_isSafari) td2.style.width="100%";
// itemObject.span.appendChild(document.createTextNode(itemObject.label));
itemObject.span.innerHTML=itemObject.label;
td2.appendChild(itemObject.span);
td2.parentObject=itemObject; td1.parentObject=itemObject;
td2.onclick=this.onRowSelect; td1.onclick=this.onRowClick; td2.ondblclick=this.onRowClick2;