major overhaul of the manage app's api-documentation functions.
things can now be rendered to static html, new helma features are supported (prototype extension), everyhting is done in a nice and clean way with skins.
This commit is contained in:
parent
76bbe4053b
commit
7633e98eea
59 changed files with 1052 additions and 578 deletions
|
@ -1,3 +1,4 @@
|
|||
|
||||
/**
|
||||
* macro rendering a skin
|
||||
* @param name name of skin
|
||||
|
@ -8,105 +9,105 @@ function skin_macro(par) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro-wrapper for href-function
|
||||
* @param action name of action to call on this prototype, default main
|
||||
*/
|
||||
function href_macro(par) {
|
||||
return this.href( (par&&par.action)?par.action:"main" );
|
||||
function href_macro(param) { return this.href ((param && param.action) ? param.action : "main"); }
|
||||
|
||||
function comment_macro (param) { return renderComment (this, param); }
|
||||
function content_macro (param) { return this.getContent (); }
|
||||
function tags_macro (param) { return renderTags (this, param); }
|
||||
function location_macro (param) { return renderLocation (this, param); }
|
||||
function link_macro (param) { return renderLink (this, param); }
|
||||
|
||||
//// END OF COPIED FUNCTIONS
|
||||
|
||||
|
||||
|
||||
function headline_macro (param) {
|
||||
res.write (this.getName ());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro rendering page head
|
||||
* macro formatting list of methods of this prototype
|
||||
* @param filter actions | functions | macros | templates | skins
|
||||
* @param skin skin to apply to the docfunction object
|
||||
* @param separator
|
||||
* @param desc Description that is passed on to the called skin
|
||||
*/
|
||||
function head_macro(par) {
|
||||
var obj = new Object();
|
||||
obj.path = this.getPath();
|
||||
var appObj = this.getApplication();
|
||||
appObj.renderSkin("head",obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* utility function for head_macro, rendering link to app and to prototype
|
||||
*/
|
||||
function getPath() {
|
||||
var appObj = this.getApplication();
|
||||
var str = appObj.getPath();
|
||||
str += '/<a href="' + this.href("main") + '">' + this.name + '</a>';
|
||||
return( str );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro returning the comment for this prototype
|
||||
*/
|
||||
function comment_macro(par) {
|
||||
return this.getComment();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro formatting list of actions of this prototype
|
||||
*/
|
||||
function actions_macro(par) {
|
||||
this.printMethods( Packages.helma.doc.DocElement.ACTION, "listElementAction","Actions" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro formatting list of templates of this prototype
|
||||
*/
|
||||
function templates_macro(par) {
|
||||
this.printMethods( Packages.helma.doc.DocElement.TEMPLATE, "listElementTemplate","Templates" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro formatting list of functions of this prototype
|
||||
*/
|
||||
function functions_macro(par) {
|
||||
this.printMethods( Packages.helma.doc.DocElement.FUNCTION, "listElementFunction","Functions" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro formatting list of skins of this prototype
|
||||
*/
|
||||
function skins_macro(par) {
|
||||
this.printMethods( Packages.helma.doc.DocElement.SKIN, "listElementSkin","Skins" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro formatting list of macros of this prototype
|
||||
*/
|
||||
function macros_macro(par) {
|
||||
this.printMethods( Packages.helma.doc.DocElement.MACRO, "listElementMacro","Macros" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* macro-utility: renders a list of methods of this prototype
|
||||
* usage of docprototype.listHeader/listFooter skin is hardcoded
|
||||
* @arg type integer - which type of methods are listed
|
||||
* @arg skin skin to be called on method
|
||||
* @arg desc string describing the type of method (ie "Skins", "Actions")
|
||||
*/
|
||||
function printMethods(type,skin,desc) {
|
||||
var arr = this.listFunctions(type);
|
||||
if ( arr.length > 0 ) {
|
||||
var obj = new Object();
|
||||
obj.desc = desc;
|
||||
this.renderSkin("listHeader",obj);
|
||||
for ( var i in arr ) {
|
||||
arr[i].renderSkin(skin,obj);
|
||||
function methods_macro (param) {
|
||||
var skinname = (param.skin) ? param.skin : "list";
|
||||
var separator = (param.separator) ? param.separator : "";
|
||||
var arr = this.listChildren ();
|
||||
var type = this.translateType (param.filter);
|
||||
var sb = new java.lang.StringBuffer ();
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
if (arr[i].getType () == type) {
|
||||
sb.append (arr[i].renderSkinAsString (skinname, param));
|
||||
sb.append (separator);
|
||||
}
|
||||
this.renderSkin("listFooter",obj);
|
||||
}
|
||||
var str = sb.toString ();
|
||||
if (str.length>0)
|
||||
return str.substring (0, str.length - separator.length);
|
||||
else
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function inheritance_macro (param) {
|
||||
var action = param.action ? param.action : "main";
|
||||
var target = param.target ? ('target="' + param.target + '" ') : '';
|
||||
var obj = this.getParentPrototype ();
|
||||
if (obj!=null) {
|
||||
obj = this.inheritanceUtil (obj, param);
|
||||
}
|
||||
if (param.deep=="true") {
|
||||
while (obj!=null) {
|
||||
obj = this.inheritanceUtil (obj, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function inheritanceUtil (obj, param) {
|
||||
if (obj.getName ()=="hopobject" && param.hopobject!="true")
|
||||
return null;
|
||||
var tmp = new Object ();
|
||||
for (var i in param)
|
||||
tmp[i] = param[i];
|
||||
tmp.href = obj.href ((param.action) ? param.action : "main");
|
||||
delete tmp.hopobject;
|
||||
delete tmp.action;
|
||||
delete tmp.deep;
|
||||
delete tmp.separator;
|
||||
res.write (renderLinkTag (tmp));
|
||||
res.write (obj.getName () + "</a>");
|
||||
if (obj.getParentPrototype ())
|
||||
res.write (param.separator);
|
||||
return obj.getParentPrototype ();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* loops through the parent prototypes and renders a skin on each
|
||||
* @param skin
|
||||
*/
|
||||
function parentPrototype_macro (param) {
|
||||
var skinname = (param.skin) ? param.skin : "asParentList";
|
||||
var obj = this.getParentPrototype ();
|
||||
while (obj!=null) {
|
||||
obj.renderSkin (skinname);
|
||||
obj = obj.getParentPrototype ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function typeProperties_macro (param) {
|
||||
var props = this.getTypeProperties ();
|
||||
if (props!=null) {
|
||||
res.encode(props.getContent ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue