Merge remote-tracking branch 'manage/master' into subtree

this merges master branch of https://github.com/helma-org/apps-manage-mirror into helma
This commit is contained in:
Simon Oberhammer 2012-03-27 11:47:36 +02:00
commit ca2b08a5df
58 changed files with 2678 additions and 0 deletions

View file

@ -0,0 +1,18 @@
function list_action() {
if (checkAddress() == false)
return;
if (checkAuth() == false)
return;
res.data.body = this.renderSkinAsString("list");
renderSkin("api");
}
function main_action() {
if (checkAddress() == false)
return;
if (checkAuth() == false)
return;
res.data.body = this.renderSkinAsString("main");
renderSkin("api");
}

View file

@ -0,0 +1 @@
extends Prototype <a href="<% this.href action="list" %>"><% this.name %></a>

View file

@ -0,0 +1,16 @@
<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/>" %>
</td></tr>

View 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 />

View file

@ -0,0 +1,4 @@
<tr><td>
<a href="<% this.href action="main" %>"><% this.name %></a><br/>
<% this.comment length="200" %>
</td></tr>

View file

@ -0,0 +1,30 @@
function translateType(filter) {
if (filter == "actions")
return Packages.helma.doc.DocElement.ACTION;
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 if (filter == "properties")
return Packages.helma.doc.DocElement.PROPERTIES;
else
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

@ -0,0 +1,10 @@
<big>Prototype <a href="<% this.href action="main" %>" target="main"><% this.name %></a></big><br/>
<% 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>" %>

View file

@ -0,0 +1,165 @@
/**
* macro rendering a skin
* @param name name of skin
*/
function skin_macro(par) {
if (par && par.name) {
this.renderSkin(par.name);
}
}
/**
* macro-wrapper for href-function
* @param action name of action to call on this prototype, default 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 formatting list of methods of this prototype
* @param filter actions | functions | macros | skins
* @param skin skin to apply to the docfunction object
* @param separator
* @param desc Description that is passed on to the called skin
*/
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);
}
}
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
* if it has got any functions.
* @param skin
*/
function parentPrototype_macro(param) {
var skinname = (param.skin) ? param.skin : "asParentList";
var obj = this.getParentPrototype();
while (obj != null) {
if (obj.listChildren().length > 0) {
obj.renderSkin(skinname);
}
obj = obj.getParentPrototype();
}
}
/**
* macro rendering a skin depending on wheter this prototype has got
* type-properties or not.
* @param skin
*/
function typeProperties_macro(param) {
var props = this.getTypeProperties();
var iter = props.getResources();
while (iter.hasNext()) {
var tmp = this.renderTypePropertiesResource(iter.next(), props);
var skinname = (param.skinname) ? param.skinname : "typeproperties";
this.renderSkin(skinname, tmp);
}
}
function renderTypePropertiesResource(res, props) {
if (res.getContent() != "") {
var sb = new java.lang.StringBuffer ();
// map of all mappings....
var mappings = props.getMappings();
// parse type.properties linewise:
var arr = res.getContent().split("\n");
for (var i = 0; i < arr.length; i++) {
arr [i] = arr[i].trim();
// look up in mappings table if line matches:
for (var e = mappings.keys(); e.hasMoreElements();) {
var key = e.nextElement();
var reg = new RegExp ('^' + key + '\\s');
if (arr[i].match(reg)) {
// it matched, wrap line in a link to that prototype:
var docProtoObj = this.getApplication().getPrototype(mappings.getProperty(key));
if (docProtoObj != null) {
arr[i] = '<a href="' + docProtoObj.href("main") + '#typeproperties">' + arr[i] + '</a>';
}
}
}
sb.append(arr[i] + "\n");
}
var tmp = new Object ();
tmp.content = sb.toString();
tmp.source = res.getName();
return tmp;
}
}

View file

@ -0,0 +1,81 @@
<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="#typeproperties">TYPE.PROPERTIES</a>
<br/><br/>
<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>"
suffix="<tr><td height='8'>&nbsp;</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>"
suffix="<tr><td height='8'>&nbsp;</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>"
suffix="<tr><td height='8'>&nbsp;</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>"
suffix="<tr><td height='8'>&nbsp;</td></tr>"
%>
<% this.methods separator="<tr><td class='mainbox'><img src='' width=0 height=0></td></tr>"
filter="properties"
skin="asLargeListItemSkin"
prefix="<tr><td class='headline'>type.properties<a name='typeproperties'><!-- --></a></td></tr>"
suffix="<tr><td height='8'>&nbsp;</td></tr>"
%>
<% this.parentPrototype skin="asParentList" %>
</table>
<br/><br/>
<!-- % this.typeProperties % -->

View file

@ -0,0 +1,9 @@
<a name='typeproperties'><!-- --></a>
<table width='90%' border='0' cellspacing='1' cellpadding='5'><tr>
<td class="headline">type.properties in <% param.source %></td>
</tr>
<tr>
<td class="mainbox"><pre><% param.content %></pre></td>
</tr>
</table>