I think we should change the include() method to this code:
include : function(src,path) {
if(src.substring(src.length-3)!=".js") src+=".js"
if (!path) {
var path=DynAPI.librarypath
var pckg=src.substring(0,src.indexOf('.'))
var groupname=src.substring(src.indexOf('.')+1)
var realsrc=groupname.substring(groupname.indexOf('.')+1)
groupname=groupname.substring(0,groupname.indexOf('.'))
if (src.indexOf('.*')>0) {
src=src.substring(0,src.indexOf('.*'))
if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg].libs[groupname]
if (group) for (var i in group) document.write('<script
language="Javascript1.2"
src="'+path+pckg+'/'+groupname+'/'+group[i]+'"><\/script>')
else alert(DynAPI.toString()+'\n\nError occured\nThe following package
could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.')
} else {
document.write('<script language="Javascript1.2"
src="'+path+pckg+'/'+groupname+'/'+realsrc+'"><\/script>')
}
} else {
document.write('<script language="Javascript1.2"
src="'+path+'/'+src+'"><\/script>')
}
This way you can call the include in a more flexible way, if you specify a
path variable you can include seperate javascript files. This was the main
reason the path variable was added once, but I don't think it ever worked as
we wanted it to :-)
If you specify no path parameter it will use the package.group.file
syntax, if you do specify a path it will simply load the src file from the
specified path (without adding package/group to it)
Pascal Bestebroer
pa...@dy...
http://www.dynamic-core.net
|