- click on showApi-button calls docapplication/read_action to re-read the

application each time a user enters the doc-frameset.
- function docfiles aren't stored in their own directory each but moved up to the
prototype directory, further regex-parsing of the resuting html-code necessary
This commit is contained in:
stefanp 2002-11-22 14:32:46 +00:00
parent c709dd4c59
commit 4505fb1ffc
4 changed files with 21 additions and 13 deletions

View file

@ -2,7 +2,7 @@
<% this.description prefix="<br/>" %> <% this.description prefix="<br/>" %>
<br/> <br/>
-&gt; -&gt;
<a href="<% this.href action="api" %>/main">showAPI</a> | <a href="<% this.href action="api" %>/read">showAPI</a> |
<a href="<% this.href action="api" %>/render">renderAPI</a> | <a href="<% this.href action="api" %>/render">renderAPI</a> |
<a href="<% this.url %>">public</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=flush">flush</a> |

View file

@ -6,7 +6,7 @@
<table border="0" cellspacing="0" cellpadding="0"> <table border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td align="right" valign="top"><small style="font-size:9px;"> <td align="right" valign="top"><small style="font-size:9px;">
<a href="<% this.href action="api" %>/main">showAPI</a> | <a href="<% this.href action="api" %>/read">showAPI</a> |
<a href="<% this.href action="api" %>/render">renderAPI</a> | <a href="<% this.href action="api" %>/render">renderAPI</a> |
<a href="<% this.url %>">public</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=flush">flush</a> |

View file

@ -1,3 +1,8 @@
function read_action () {
this.readApplication ();
res.redirect (this.href("main"));
}
function main_action () { function main_action () {
if (checkAddress()==false) if (checkAddress()==false)
return; return;
@ -44,7 +49,7 @@ function render_action () {
return; return;
res.writeln("<html><head><title>render</title></head><body>rendering API ... "); res.writeln("<html><head><title>render</title></head><body>rendering API ... ");
var prefix = this.href (""); var prefix = this.href ("");
this.storePage (this, "main"); this.storePage (this, "main", "", "index.html");
this.storePage (this, "prototypes"); this.storePage (this, "prototypes");
this.storePage (this, "summary"); this.storePage (this, "summary");
this.storePage (this, "functionindex"); this.storePage (this, "functionindex");
@ -56,7 +61,7 @@ function render_action () {
ct += 2; ct += 2;
var subarr = arr[i].listChildren (); var subarr = arr[i].listChildren ();
for (var j=0; j<subarr.length; j++) { for (var j=0; j<subarr.length; j++) {
this.storePage (subarr[j], "main", "../../"); this.storePage (subarr[j], "main", "../", subarr[j].getElementName () + ".html");
ct += 1; ct += 1;
} }
} }

View file

@ -12,27 +12,23 @@ function getDir (dir, obj) {
dir.mkdir (); dir.mkdir ();
if (obj.getType () == this.APPLICATION) { if (obj.getType () == this.APPLICATION) {
return dir; return dir;
} else if (obj.getType () == this.PROTOTYPE) {
var protoObj = this.getDocPrototype (obj);
var dir = new File (dir, protoObj.getElementName ());
dir.mkdir ();
return dir;
} else { } else {
var protoObj = this.getDocPrototype (obj); var protoObj = this.getDocPrototype (obj);
var dir = this.getDir (dir, protoObj); var dir = new File (dir, protoObj.getElementName ());
dir = new File (dir, obj.getElementName ());
dir.mkdir (); dir.mkdir ();
return dir; return dir;
} }
} }
function storePage (obj, action, backPath) { function storePage (obj, action, backPath, filename) {
if (filename==null)
var filename = action + ".html";
var str = this.getPage (obj, action, backPath); var str = this.getPage (obj, action, backPath);
var appObj = this.getParentElement (); var appObj = this.getParentElement ();
var dir = new File (appObj.getAppDir ().getAbsolutePath (), ".docs"); var dir = new File (appObj.getAppDir ().getAbsolutePath (), ".docs");
dir = this.getDir (dir, obj); dir = this.getDir (dir, obj);
var f = new File (dir, action + ".html"); var f = new File (dir, filename);
f.remove (); f.remove ();
f.open (); f.open ();
f.write (str); f.write (str);
@ -46,12 +42,19 @@ function getPage (obj, action, backPath) {
res.pushStringBuffer (); res.pushStringBuffer ();
eval ("obj." + action + "_action ();"); eval ("obj." + action + "_action ();");
var str = res.popStringBuffer (); var str = res.popStringBuffer ();
// get the baseURI out of the url and replace
// it with the given relative prefix
var reg = new RegExp ("href=\"" + this.href ("") + "([^\"]+)\""); var reg = new RegExp ("href=\"" + this.href ("") + "([^\"]+)\"");
reg.global = true; reg.global = true;
str = str.replace (reg, "href=\"" + backPath + "$1.html\""); str = str.replace (reg, "href=\"" + backPath + "$1.html\"");
var reg = new RegExp ("src=\"" + this.href ("") + "([^\"]+)\""); var reg = new RegExp ("src=\"" + this.href ("") + "([^\"]+)\"");
reg.global = true; reg.global = true;
str = str.replace (reg, "src=\"" + backPath + "$1.html\""); str = str.replace (reg, "src=\"" + backPath + "$1.html\"");
// shorten links, so that function files can move up one directory
// in the hierarchy
var reg = new RegExp ("(prototype_[^/]+/[^/]+)/main.html");
reg.global = true;
str = str.replace (reg, "$1.html");
return str; return str;
} }