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
@ -31,7 +27,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;
@ -48,7 +44,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");
};
@ -343,8 +339,16 @@ function dhtmlDragAndDropObject(){
}
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
@ -387,7 +392,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}
}
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
@ -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");
};
@ -290,6 +294,14 @@ function dhtmlDragAndDropObject(){
}
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;
@ -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
@ -334,7 +347,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}
}
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
@ -32,7 +27,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;
@ -49,7 +44,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");
};
@ -344,8 +339,16 @@ function dhtmlDragAndDropObject(){
}
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
@ -388,7 +392,7 @@ dtmlXMLLoaderObject.prototype.doXPath = function(xpathExp,docObj){
}
}
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;