* Do not rely on Java classes to implement IPathElement.

Implement all necessary features such as href() and getChildElement()
  ourselves instead.
* Add missing classes to class.properties.
* Display actual line numbers in function source macro.
This commit is contained in:
hns 2006-11-20 11:05:24 +00:00
parent c9463fe57a
commit 694139d897
6 changed files with 47 additions and 26 deletions

View file

@ -7,14 +7,6 @@ function constructor(name) {
this.name = name;
}
/**
* of no use, just to avoid error message
*/
function onRequest() {
}
/**
* return true/false to determine if application is running
*/
@ -25,4 +17,19 @@ function isActive() {
return true;
}
/**
* Method used by Helma for URL composition.
*/
function href(action) {
var base = root.href() + this.name + "/";
return action ? base + action : base;
}
/**
* Method used by Helma request path resolution.
*/
function getChildElement(name) {
if (name == "api")
return this.getDoc();
return null;
}

View file

@ -1,6 +1,6 @@
/**
* get the prototype of any doc-object (either a prototype, a function or a tag)
*/
* Get the prototype of any doc-object (either a prototype, a function or a tag)
*/
function getDocPrototype(obj) {
var tmp = obj;
while (tmp != null && tmp.getType() != this.PROTOTYPE) {
@ -11,12 +11,19 @@ function getDocPrototype(obj) {
/**
* get a prototype of this docapplication, ie get on of the children of this object
* Get a prototype of this docapplication, ie get on of the children of this object
*/
function getPrototype(name) {
return this.getChildElement("prototype_" + name);
}
/**
* Method used by Helma for URL composition.
*/
function href(action) {
var base = this.getParentElement().href() + "api/";
return action ? base + action : base;
}
function getDir(dir, obj) {
dir.mkdir();

View file

@ -129,8 +129,9 @@ function source_macro(param) {
sourcecode = sourcecode.replace(r, "");
var arr = sourcecode.split("<br />");
var line = this.getStartLine ? this.getStartLine() : 1;
for (var i = 0; i < arr.length; i++) {
res.write('<font color="#aaaaaa">' + (i + 1) + ':</font> ');
res.write('<font color="#aaaaaa">' + (line++) + ':</font> ');
if (i < 99) {
res.write(' ');
}

View file

@ -1,14 +1,3 @@
///**
// * utility function for head_macro, rendering link to app and to prototype
// */
//function getPath() {
// var appObj = this.getParentElement ();
// var str = appObj.getPath();
// str += '/<a href="' + this.href("main") + '">' + this.name + '</a>';
// return( str );
//}
function translateType(filter) {
if (filter == "actions")
return Packages.helma.doc.DocElement.ACTION;
@ -24,9 +13,18 @@ function translateType(filter) {
return -1;
}
/**
* Get the application we're part of.
*/
function getApplication() {
return this.getParentElement();
}
/**
* Method used by Helma for URL composition.
*/
function href(action) {
var base = this.getParentElement().href()
+ this.getElementName() + "/";
return action ? base + action : base;
}

View file

@ -55,5 +55,11 @@ function getApp(name) {
return appObj;
}
/**
* Method used by Helma path resolution.
*/
function getChildElement(name) {
return this.getApp(name);
}

View file

@ -21,5 +21,7 @@ helma.framework.core.Application = Application
helma.doc.DocApplication = DocApplication
helma.doc.DocPrototype = DocPrototype
helma.doc.DocFunction = DocFunction
helma.doc.DocProperties = DocFunction
helma.doc.DocSkin = DocFunction
helma.doc.DocTag = DocTag