This commit was generated by cvs2svn to compensate for changes in r2155,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
parent
72d15e11ab
commit
4a7616d5a0
51 changed files with 1885 additions and 0 deletions
35
Application/functions.js
Normal file
35
Application/functions.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* construct an application object so that we can use
|
||||
* skins for non-active applications too
|
||||
* @arg name
|
||||
*/
|
||||
function constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* overrides the internal href-function, as
|
||||
* helma.framework.core.Application.getNodeHref(Object,String)
|
||||
* isn't able to compute correct urls for non-node objects.
|
||||
* @arg action of application
|
||||
*/
|
||||
function href(action) {
|
||||
var url = getProperty("baseURI");
|
||||
url = (url==null || url=="null") ? "" : url;
|
||||
url += this.name + "/" + ( (action!=null && action!="") ? action : "main" );
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return true/false to determine if application is running
|
||||
*/
|
||||
function isActive() {
|
||||
if ( root.getApplication(this.name)==null )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
10
Application/head.skin
Normal file
10
Application/head.skin
Normal file
|
@ -0,0 +1,10 @@
|
|||
<p><big>AppManager <% this.title %></big>
|
||||
<% this.description prefix="<br/>" %>
|
||||
<br/>
|
||||
->
|
||||
<a href="<% this.href action="api" %>/main">AppDoc</a> |
|
||||
<a href="<% this.url %>">public</a> |
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=flush">flush</a> |
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=restart">restart</a> |
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=stop">stop</a>
|
||||
</p>
|
172
Application/macros.js
Normal file
172
Application/macros.js
Normal file
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
* 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(par) {
|
||||
return this.href( (par&&par.action)?par.action:"main" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the URL of an application.
|
||||
* using absoluteURI if set in app.properties, otherwise we go for the href calculated by
|
||||
* the application (which is using baseURI if set)
|
||||
*/
|
||||
function url_macro() {
|
||||
var str = this.getProperty("absoluteuri");
|
||||
if ( str!=null && str!="" ) {
|
||||
return str;
|
||||
} else {
|
||||
return this.getRootHref();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the title of an application
|
||||
*/
|
||||
function title_macro() {
|
||||
var title = this.name;
|
||||
return(title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro rendering a description of an application from a
|
||||
* file called description.txt or doc.html located in the
|
||||
* app's root. Limits description to 200 chars.
|
||||
* @param Object Macro parameter object
|
||||
*/
|
||||
function description_macro(param) {
|
||||
var str = "";
|
||||
var appHome = this.getAppDir();
|
||||
var f = new File(this.getAppDir().toString(), "description.txt");
|
||||
if (!f.exists())
|
||||
f = new File(this.getAppDir().toString(), "doc.html");
|
||||
if (f.exists()) {
|
||||
str = f.readAll();
|
||||
if (str.length > 200)
|
||||
str = str.substring(0, 200) + "...";
|
||||
}
|
||||
return(str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the server's uptime nicely formatted
|
||||
*/
|
||||
function uptime_macro() {
|
||||
return formatAge( (java.lang.System.currentTimeMillis()-this.starttime) / 1000 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the number of active sessions.
|
||||
* parameter used by global.formatCount
|
||||
* @see global.formatCount
|
||||
*/
|
||||
function countSessions_macro(par) {
|
||||
if ( this.isActive()==true )
|
||||
return this.sessions.size() + formatCount(this.sessions.size(),par);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the number of logged-in users or the list
|
||||
* of logged-in users if http-parameter showusers is set to true.
|
||||
* Makes use of this.countUsers_macro and this.listUsers_macro
|
||||
* @see application.countUsers_macro
|
||||
* @see application.listUsers_macro
|
||||
*/
|
||||
function users_macro(par) {
|
||||
if ( req.data.showusers=="true" ) {
|
||||
this.listUsers_macro(par);
|
||||
} else {
|
||||
this.countUsers_macro(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the number of logged-in users if application
|
||||
* is active
|
||||
* parameter used by global.formatCount
|
||||
* @see global.formatCount
|
||||
*/
|
||||
function countUsers_macro(par) {
|
||||
if ( this.isActive()==true )
|
||||
return this.activeUsers.size() + formatCount(this.activeUsers.size(),par);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro rendering the list of logged-in users if application is active
|
||||
* @param separator html-code written between elements
|
||||
*/
|
||||
function listUsers_macro(par) {
|
||||
var separator = (par && par.separator) ? par.separator : ", ";
|
||||
if ( this.activeUsers.size()==0 )
|
||||
return "";
|
||||
var e = this.activeUsers.keys();
|
||||
while ( e.hasMoreElements() ) {
|
||||
res.write ( e.nextElement() );
|
||||
if ( e.hasMoreElements() ) {
|
||||
res.write ( separator );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the number of active evaluators (=threads)
|
||||
*/
|
||||
function countActiveEvaluators_macro() {
|
||||
return this.countActiveEvaluators();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro returning the number of free evaluators (=threads)
|
||||
*/
|
||||
function countFreeEvaluators_macro() {
|
||||
return this.countFreeEvaluators();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro formatting the 5min average of requests.
|
||||
*/
|
||||
function getRequestAvg_macro(par) {
|
||||
if ( app.requestStat==null || app.requestStat.get(this.name)==null )
|
||||
return 0;
|
||||
if ( this.isActive() ) {
|
||||
var obj = app.requestStat.get(this.name);
|
||||
return obj.last5Min + formatCount(obj.last5Min,par);
|
||||
} else {
|
||||
return 0 + formatCount(0,par);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Macro formatting app.properties
|
||||
*/
|
||||
function properties_macro(par) {
|
||||
formatProperties( this.getProperties(), par );
|
||||
}
|
||||
|
10
Application/main.hac
Normal file
10
Application/main.hac
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* renders AppManager
|
||||
*/
|
||||
|
||||
if ( checkAddress()==false ) return;
|
||||
if ( checkAuth(this)==false ) return;
|
||||
|
||||
res.skin="global";
|
||||
res.body = this.renderSkinAsString("main");
|
||||
|
42
Application/main.skin
Normal file
42
Application/main.skin
Normal file
|
@ -0,0 +1,42 @@
|
|||
<% this.skin name="head" %>
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="3">
|
||||
<tr>
|
||||
<td class="list_separator" colspan="3">application</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200">active sessions:</td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.countSessions %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200"><a href="<% this.href action="main" %>?showusers=true">logged-in users:</a></td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.users %> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200">active evaluators:</td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.countActiveEvaluators %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200">free evaluators:</td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.countFreeEvaluators %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200">5min-request-avg:</td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.getRequestAvg %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_property" align="right" width="200">uptime:</td>
|
||||
<td class="list_property" width="5"> </td>
|
||||
<td class="list_property" align="left"><% this.uptime %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="list_separator" colspan="3">app.properties</td>
|
||||
</tr>
|
||||
<% this.properties prefix="<tr><td class=\"list_property\" align=\"right\" width=\"200\">" separator="</td><td class=\"list_property\" width=\"5\"> </td><td class=\"list_property\" align=\"left\">" suffix="</td></tr>" %>
|
||||
</table>
|
||||
|
23
Application/mrtg.hac
Normal file
23
Application/mrtg.hac
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* prints session- and thread-stats for mrtg-tool
|
||||
* doesn't check username or password, so that we don't have
|
||||
* to write them cleartext in a mrtg-configfile
|
||||
*/
|
||||
|
||||
if ( checkAddress()==false ) return;
|
||||
|
||||
if ( this.isActive()==false ) {
|
||||
res.write ( "0\n0\n0\n0\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( req.data.action=="sessions" ) {
|
||||
res.write ( this.sessions.size() + "\n0\n0\n0\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( req.data.action=="threads" ) {
|
||||
res.write ( this.countActiveEvaluators() + "\n" + this.countFreeEvaluators() + "\n0\n0\n");
|
||||
return;
|
||||
}
|
||||
|
15
Application/navig_active.skin
Normal file
15
Application/navig_active.skin
Normal file
|
@ -0,0 +1,15 @@
|
|||
<div class="list_apps">
|
||||
<b><a href="<% this.href action="main" %>"><% this.title %></a></b><br />
|
||||
<small><% this.countSessions singular=" Session" plural=" Sessions" %>, <% this.getRequestAvg singular=" Request" plural=" Requests" %>/5min</small>
|
||||
<div align="right">
|
||||
<!--<table border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td align="right" valign="top"><small>
|
||||
<a href="<% this.href action="api" %>/main">AppDoc</a>
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=flush">flush</a>
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=restart">restart</a>
|
||||
</small></td>
|
||||
</tr>
|
||||
</table>-->
|
||||
</div>
|
||||
</div>
|
10
Application/navig_disabled.skin
Normal file
10
Application/navig_disabled.skin
Normal file
|
@ -0,0 +1,10 @@
|
|||
<div class="list_apps">
|
||||
<table border="0" cellspacing="0" cellpadding="0" align="right">
|
||||
<tr>
|
||||
<td align="right" valign="top"><small>
|
||||
<a href="<% root.href action="main" %>?app=<% this.title %>&action=start">start</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<b><% this.title %></b>
|
||||
</div>
|
10
Application/redirectpublic.hac
Normal file
10
Application/redirectpublic.hac
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* performs a redirect to the public site
|
||||
* (workaround, we can't access application object from docapplication for some reason)
|
||||
* @see application.url_macro
|
||||
*/
|
||||
|
||||
if ( checkAddress()==false ) return;
|
||||
if ( checkAuth(this)==false ) return;
|
||||
|
||||
res.redirect ( this.url_macro() );
|
Loading…
Add table
Add a link
Reference in a new issue