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
10
DocPrototype/actions.js
Normal file
10
DocPrototype/actions.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
function list_action () {
|
||||
res.data.body = this.renderSkinAsString ("list");
|
||||
renderSkin ("api");
|
||||
}
|
||||
|
||||
function main_action () {
|
||||
res.data.body = this.renderSkinAsString ("main");
|
||||
renderSkin ("api");
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<tr>
|
||||
|
||||
<td class="list_property" align="right" valign="top" width="1%"><font size="-1"><a name="<% this.name %>"><!-- --></a><code> Prototype</code></font>
|
||||
<br></td>
|
||||
<td class="list_property" valign="top"><code><b><a href="<% this.href action="main" %>"><% this.name %></a></b></code><br />
|
||||
<% this.comment %>
|
||||
<br />
|
||||
</td>
|
||||
|
||||
</tr>
|
1
DocPrototype/asInheritanceLink.skin
Normal file
1
DocPrototype/asInheritanceLink.skin
Normal file
|
@ -0,0 +1 @@
|
|||
extends Prototype <a href="<% this.href action="list" %>"><% this.name %></a>
|
17
DocPrototype/asParentList.skin
Normal file
17
DocPrototype/asParentList.skin
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
<tr><td class='headline'><b>Inherited from prototype <% this.link %>:</b><br></td></tr>
|
||||
|
||||
<tr><td>
|
||||
|
||||
<% this.methods separator=", " filter="actions" skin="asParentListItem" prefix="<b>Actions: </b>" suffix="<br/>" %>
|
||||
<% this.methods separator=", " filter="functions" skin="asParentListItem" prefix="<b>Functions: </b>" suffix="<br/>" %>
|
||||
<% this.methods separator=", " filter="macros" skin="asParentListItem" prefix="<b>Macros: </b>" suffix="<br/>" %>
|
||||
<% this.methods separator=", " filter="skins" skin="asParentListItem" prefix="<b>Skins: </b>" suffix="<br/>" %>
|
||||
<% this.methods separator=", " filter="templates" skin="asParentListItem" prefix="<b>Templates: </b>" suffix="<br/>" %>
|
||||
|
||||
</td></tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
10
DocPrototype/asPrototypeList.skin
Normal file
10
DocPrototype/asPrototypeList.skin
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
<a href="<% this.href action="main" %>" onClick="parent.changePrototypeList(this);" target="main"><% this.name %></a>
|
||||
|
||||
<%
|
||||
this.inheritance action="main" target="main"
|
||||
onClick="parent.changePrototypeList(this);" hopobject="false"
|
||||
prefix=" (extends " suffix=")"
|
||||
%>
|
||||
|
||||
<br />
|
29
DocPrototype/functions.js
Normal file
29
DocPrototype/functions.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
///**
|
||||
// * 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;
|
||||
else if (filter=="templates")
|
||||
return Packages.helma.doc.DocElement.TEMPLATE;
|
||||
else if (filter=="functions")
|
||||
return Packages.helma.doc.DocElement.FUNCTION;
|
||||
else if (filter=="macros")
|
||||
return Packages.helma.doc.DocElement.MACRO;
|
||||
else if (filter=="skins")
|
||||
return Packages.helma.doc.DocElement.SKIN;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
11
DocPrototype/list.skin
Normal file
11
DocPrototype/list.skin
Normal file
|
@ -0,0 +1,11 @@
|
|||
<h3>Prototype <a href="<% this.href action="main" %>" target="main"><% this.name %></a></h3>
|
||||
<% this.inheritance action="list" %>
|
||||
<% this.inheritance deep="true" hopobject="true" action="main" target="main" onClick="parent.changePrototypeList(this);" separator=", " prefix="extends: " suffix="<br>" %><br>
|
||||
|
||||
|
||||
<% this.methods filter="actions" skin="asListItem" prefix="<p><b>Actions:</b><br/>" suffix="</p> %>
|
||||
<% this.methods filter="functions" skin="asListItem" prefix="<p><b>Functions:</b><br/>" suffix="</p> %>
|
||||
<% this.methods filter="macros" skin="asListItem" prefix="<p><b>Macros:</b><br/>" suffix="</p> %>
|
||||
<% this.methods filter="skins" skin="asListItem" prefix="<p><b>Skins:</b><br/>" suffix="</p> %>
|
||||
<% this.methods filter="templates" skin="asListItem" prefix="<p><b>Templates:</b><br/>" suffix="</p> %>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
</table>
|
||||
<br />
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<a name="<% param.desc %>"><!-- --></a>
|
||||
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="3">
|
||||
<tr>
|
||||
<td class="list_separator" colspan="3"><% param.desc %></td>
|
||||
</tr>
|
|
@ -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 ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
if ( checkAddress()==false ) return;
|
||||
if ( checkAuth(this)==false ) return;
|
||||
|
||||
res.data.body = this.renderSkinAsString("main");
|
||||
res.data.title = "Application " + this.name;
|
||||
renderSkin ("api");
|
||||
|
||||
|
|
@ -1,8 +1,82 @@
|
|||
<% this.head %>
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td class="headline">
|
||||
<big><tt>Prototype <% this.headline %></tt></big><br>
|
||||
<% this.inheritance deep="true" hopobject="true" action="main" target="main" onClick="parent.changePrototypeList(this);" separator=", " prefix="extends: " suffix="<br>" %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a class="navig" href="#actions">ACTIONS</a> |
|
||||
<a class="navig" href="#functions">FUNCTIONS</a> |
|
||||
<a class="navig" href="#macros">MACROS</a> |
|
||||
<a class="navig" href="#skins">SKINS</a> |
|
||||
<a class="navig" href="#templates">TEMPLATES</a> |
|
||||
<a class="navig" href="#typeproperties">TYPE.PROPERTIES</a>
|
||||
|
||||
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="5">
|
||||
<tr>
|
||||
<td class="mainbox">
|
||||
<% this.comment suffix="<br><br>" %>
|
||||
<ul>
|
||||
<% this.tags type="author" skin="author" %>
|
||||
<% this.tags type="see" skin="see" %>
|
||||
<% this.tags type="deprecated" skin="deprecated" %>
|
||||
<% this.tags type="overrides" skin="overrides" %>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table width="90%" border="0" cellspacing="1" cellpadding="3">
|
||||
|
||||
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
filter="actions"
|
||||
skin="asLargeListItem"
|
||||
prefix="<tr><td class='headline'>Actions<a name='actions'><!-- --></a></td></tr>"
|
||||
%>
|
||||
|
||||
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
filter="functions"
|
||||
skin="asLargeListItem"
|
||||
prefix="<tr><td class='headline'>Functions<a name='functions'><!-- --></a></td></tr>"
|
||||
%>
|
||||
|
||||
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
filter="macros"
|
||||
skin="asLargeListItem"
|
||||
prefix="<tr><td class='headline'>Macros<a name='macros'><!-- --></a></td></tr>"
|
||||
%>
|
||||
|
||||
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
filter="skins"
|
||||
skin="asLargeListItemSkin"
|
||||
prefix="<tr><td class='headline'>Skins<a name='skins'><!-- --></a></td></tr>"
|
||||
%>
|
||||
|
||||
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
|
||||
filter="templates"
|
||||
skin="asLargeListItem"
|
||||
prefix="<tr><td class='headline'>Templates<a name='templates'><!-- --></a></td></tr>"
|
||||
%>
|
||||
|
||||
<% this.parentPrototype skin="asParentList" %>
|
||||
</table>
|
||||
|
||||
<br/><br/><a name='typeproperties'><!-- --></a><table width='90%' border='0' cellspacing='1' cellpadding='5'><tr>
|
||||
<td class="headline">type.properties</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mainbox"><% this.typeProperties prefix="<pre>" suffix="</pre>" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<% this.actions %>
|
||||
<% this.skins %>
|
||||
<% this.macros %>
|
||||
<% this.functions %>
|
||||
<% this.templates %>
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
<a href="<% this.href action="main" %>"><% this.name %></a><br>
|
Loading…
Add table
Add a link
Reference in a new issue