Author: fred
Date: 2007-08-28 16:09:04 +0000 (Tue, 28 Aug 2007)
New Revision: 14902
Modified:
trunk/plugins/Echo/images/echo-logo-small-0.1.png
trunk/plugins/Echo/src/plugins/echo/Echo.java
trunk/plugins/Echo/src/plugins/echo/Node.java
trunk/plugins/Echo/src/plugins/echo/Project.java
trunk/plugins/Echo/src/plugins/echo/ProjectManager.java
trunk/plugins/Echo/src/plugins/echo/SiteGenerator.java
trunk/plugins/Echo/src/plugins/echo/WikiMarkupRender.java
trunk/plugins/Echo/src/plugins/echo/block/BlockManager.java
trunk/plugins/Echo/src/plugins/echo/block/BlogrollBlock.java
trunk/plugins/Echo/src/plugins/echo/block/CategoriesBlock.java
trunk/plugins/Echo/src/plugins/echo/i18n/echo.i18n.en.properties
trunk/plugins/Echo/src/resources/edit.css
trunk/plugins/Echo/src/resources/style.css
trunk/plugins/Echo/src/xml/edit.xsl
trunk/plugins/Echo/src/xml/test.xsl
Log:
Preparing for release :
* New logo (Alpha release)
* Echo is now able to insert the site itself
* Improvement of the SiteGenerator
* Small changes in the default CSS
* I18n
Modified: trunk/plugins/Echo/images/echo-logo-small-0.1.png
===================================================================
(Binary files differ)
Modified: trunk/plugins/Echo/src/plugins/echo/Echo.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/Echo.java 2007-08-28 16:07:10 UTC
(rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/Echo.java 2007-08-28 16:09:04 UTC
(rev 14902)
@@ -10,13 +10,13 @@
import freenet.pluginmanager.FredPluginThreadless;
import freenet.pluginmanager.PluginRespirator;
import freenet.pluginmanager.PluginHTTPException;
-
import freenet.pluginmanager.DownloadPluginHTTPException;
import freenet.pluginmanager.RedirectPluginHTTPException;
import freenet.keys.FreenetURI;
import freenet.support.api.HTTPRequest;
import freenet.support.HTMLNode;
+import freenet.node.fcp.ClientPutDir;
import nu.xom.Builder;
import nu.xom.Document;
@@ -32,9 +32,9 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
-
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.net.MalformedURLException;
// TODO
// * Exceptions !
@@ -52,8 +52,9 @@
private static final int MAX_ID_LENGTH = Math.max(PROJECT_ID_LENGTH,
Math.max(NODE_ID_LENGTH, CATEGORY_ID_LENGTH));
private static final int MAX_OBJECT_LENGTH = 8;
private static final int MAX_CATEGORY_NAME_LENGTH = 100;
+ private static final int MAX_KEY_LENGTH = 1024*1024;
- private PluginRespirator respirator;
+ protected PluginRespirator respirator;
private Builder parser;
private XSLTransform transform;
private I18n i18n;
@@ -63,29 +64,35 @@
private NodesManager nodesManager;
private BlockManager blockManager;
private Node node;
+ private ClientPutDir clientPutDir;
- private InsertTest test;
+ public Echo()
+ {
+
+ }
- public Echo() throws PluginHTTPException
- {
+ public void runPlugin(PluginRespirator p) {
+
try {
+ this.respirator = p;
i18n = new I18n("en");
parser = new Builder();
-// Document styleSheet =
parser.build(getClass().getResourceAsStream("/xml/edit.xsl"));
- Document styleSheet =
parser.build("/home/fred/prog/soc/trunk/plugins/Echo/src/xml/edit.xsl");
+ Document styleSheet =
parser.build(getClass().getResourceAsStream("/xml/edit.xsl"));
+// Document styleSheet =
parser.build("/home/fred/prog/soc/trunk/plugins/Echo/src/xml/edit.xsl");
i18n.translateXML(styleSheet);
transform = new XSLTransform(styleSheet);
- projectManager = new ProjectManager(BASE_DIR);
+ projectManager = new ProjectManager(BASE_DIR,
respirator.getNode().random);
if(projectManager.countProjects() == 0)
- projectManager.newProject("bleh");
+ projectManager.newProject("My Flog");
+
setProject(projectManager.loadProject("001"));
} catch (Exception e) {
- e.printStackTrace(System.err);
+ e.printStackTrace();
}
// } catch (IOException ioe) {
//
// throw new PluginHTTPException("Cannot open the style
sheet", ""); //
@@ -94,15 +101,7 @@
// } catch (XSLException xe) {
//
// throw new PluginHTTPException("Cannot build the XSL
transformer", ""); //
// }
-
- }
-
- public void runPlugin(PluginRespirator p) {
- this.respirator = p;
-// test = new InsertTest(respirator.getNode(), new
File("/home/fred/test.jpg"));
-// System.err.println("Test.isNull ?? : " + (test == null));
-
}
public void terminate() {
@@ -122,12 +121,12 @@
private String transform(Page page) {
try {
-// return
transform.transform(page.getDoc()).get(0).toXML();
+ return
transform.transform(page.getDoc()).get(0).toXML();
/*
Nice but input white space are not respected
- */
+
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
Serializer serializer = new Serializer(baos);
serializer.setIndent(4);
@@ -135,8 +134,8 @@
serializer.write(new Document((Element)
transform.transform(page.getDoc()).get(0)));
return baos.toString();
+ */
-
} catch (Exception e) {
return e.getMessage();
}
@@ -300,23 +299,7 @@
}
} else if ("insert".equals(fileName)) {
- Element insert = new Element("insert");
- page= new Page(insert);
- page.setTitle("Insert");
-
- FreenetURI uri = project.getInsertURI();
- if(uri != null){
- Element insertURI = new Element("insertURI");
- insertURI.appendChild(uri.toString());
- insert.appendChild(insertURI);
- }
-
- uri = project.getRequestURI();
- if(uri != null){
- Element requestURI = new Element("requestURI");
- requestURI.appendChild(uri.toString());
- insert.appendChild(requestURI);
- }
+ setInsertPage();
} else if ("nodes".equals(fileName)) {
@@ -416,6 +399,48 @@
setBlocksPage();
+ } else if (request.isPartSet("insert-key")) {
+ setInsertPage();
+
+ if(clientPutDir == null ||
clientPutDir.hasFinished()) {
+ FreenetURI insertURI = null;
+ FreenetURI requestURI = null;
+
+ try {
+ insertURI = new
FreenetURI(request.getPartAsString("insert-key", MAX_KEY_LENGTH));
+ } catch(MalformedURLException mue) {
+ page.appendError("Invalid
insertion key : " + mue.getMessage());
+ }
+
+ try {
+ requestURI = new
FreenetURI(request.getPartAsString("request-key", MAX_KEY_LENGTH));
+ } catch(MalformedURLException mue) {
+ page.appendError("Invalid
request key : " + mue.getMessage());
+ }
+
+ if(insertURI != null && requestURI !=
null) {
+
+
+ if (!
project.getInsertURI().equals(insertURI)){
+
project.setInsertURI(insertURI);
+
+ }
+
+ if (!
project.getRequestURI().equals(requestURI)) {
+
project.setRequestURI(requestURI);
+
+ }
+
+ SiteGenerator generator = new
SiteGenerator(project);
+ generator.generate();
+
+ SimpleDirectoryInserter
inserter = new
SimpleDirectoryInserter(respirator.getNode().clientCore.getFCPServer());
+ clientPutDir =
inserter.insert(new File(project.getProjectDir(), "out"), "index.html",
insertURI);
+
+ setInsertPage();
+ }
+ }
+
} else {
String title = request.getPartAsString("title",
MAX_TITLE_LENGTH).trim();
@@ -505,6 +530,34 @@
page.appendData(getFormPassword());
}
+ private void setInsertPage() {
+
+ Element insert = new Element("insert");
+ page= new Page(insert);
+ page.setTitle("Insert");
+ page.appendData(getFormPassword());
+
+ if(clientPutDir == null || clientPutDir.hasFinished()) {
+
+ FreenetURI uri = project.getInsertURI();
+ if(uri != null){
+ Element insertURI = new
Element("insertURI");
+ insertURI.appendChild(uri.toString());
+ insert.appendChild(insertURI);
+ }
+
+ uri = project.getRequestURI();
+ if(uri != null){
+ Element requestURI = new
Element("requestURI");
+ requestURI.appendChild(uri.toString());
+ insert.appendChild(requestURI);
+ }
+ } else {
+ insert.addAttribute(new
Attribute("running","true"));
+ }
+
+ }
+
private Element getFormPassword() {
Element formPassword = new Element("formpassword");
Modified: trunk/plugins/Echo/src/plugins/echo/Node.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/Node.java 2007-08-28 16:07:10 UTC
(rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/Node.java 2007-08-28 16:09:04 UTC
(rev 14902)
@@ -227,10 +227,42 @@
}
+ public Node summary() {
+
+ WikiMarkupRender render = new TempWikiMarkupRender();
+ Node summary = this.copy();
+ Text content = (Text) summary.getContentElement().getChild(0);
+
+ String str = content.getValue();
+ int words = 0;
+ int index = 1;
+ boolean lastIsSpace = false;
+ while(words < 80 && index < str.length()) {
+
+ if(' ' == str.charAt(index++)) {
+ if(!lastIsSpace)
+ words++;
+ lastIsSpace = true;
+ } else
+ lastIsSpace = false;
+ }
+
+ if(index != str.length()) {
+ str = str.substring(0, index);
+ str += "...";
+ }
+
+ content.setValue(str);
+ render.render(summary.getContentElement());
+
+ return summary;
+
+ }
+
public Node render() {
- Node renderedNode = (Node) this.copy();
- WikiMarkupRender render = new WikiMarkupRender();
+ Node renderedNode = this.copy();
+ WikiMarkupRender render = new TempWikiMarkupRender();
render.render(renderedNode.getContentElement());
Modified: trunk/plugins/Echo/src/plugins/echo/Project.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/Project.java 2007-08-28 16:07:10 UTC
(rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/Project.java 2007-08-28 16:09:04 UTC
(rev 14902)
@@ -7,6 +7,7 @@
import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -16,6 +17,7 @@
public class Project {
private File projectDir;
+ private File projectConfigFile;
private Properties projectConfig;
private NodesManager nodesManager;
private BlockManager blockManager;
@@ -24,8 +26,9 @@
public Project(File projectDir) throws FileNotFoundException,
ParsingException, IOException {
this.projectDir = projectDir;
- projectConfig = new Properties();
- projectConfig.loadFromXML(new
FileInputStream(projectDir.getPath() + File.separator + "conf.xml"));
+ this.projectConfigFile = new File(projectDir, "conf.xml");
+ this.projectConfig = new Properties();
+ projectConfig.loadFromXML(new
FileInputStream(projectConfigFile));
nodesManager = new NodesManager(new File(projectDir.getPath() +
File.separator + "nodes"));
blockManager = new BlockManager(new File(projectDir.getPath() +
File.separator + "blocks"));
@@ -46,25 +49,25 @@
public FreenetURI getInsertURI() {
- return getURI("inserturi");
+ return getURI("insertURI");
}
public FreenetURI getRequestURI() {
- return getURI("requesturi");
+ return getURI("requestURI");
}
public void setInsertURI(FreenetURI uri) {
- projectConfig.setProperty("inserturi", uri.toString());
+ projectConfig.setProperty("insertURI", uri.toString());
}
public void setRequestURI(FreenetURI uri) {
- projectConfig.setProperty("requesturi", uri.toString());
+ projectConfig.setProperty("requestURI", uri.toString());
}
@@ -93,6 +96,14 @@
return blockManager;
}
+
+ public void writeConfig() throws FileNotFoundException, IOException {
+
+ FileOutputStream out = new FileOutputStream(projectConfigFile);
+ projectConfig.storeToXML(out, null);
+ out.close();
+
+ }
}
\ No newline at end of file
Modified: trunk/plugins/Echo/src/plugins/echo/ProjectManager.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/ProjectManager.java 2007-08-28
16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/ProjectManager.java 2007-08-28
16:09:04 UTC (rev 14902)
@@ -1,5 +1,9 @@
package plugins.echo;
+import freenet.crypt.RandomSource;
+import freenet.keys.InsertableClientSSK;
+import freenet.keys.FreenetURI;
+
import java.util.HashMap;
import java.util.Properties;
import java.io.File;
@@ -13,10 +17,12 @@
private File baseDir;
private HashMap<String,File> projects;
+ private RandomSource randomSource;
- public ProjectManager(File baseDir) {
+ public ProjectManager(File baseDir, RandomSource randomSource) {
this.baseDir= baseDir;
+ this.randomSource = randomSource;
projects = new HashMap<String,File>();
File[] files = baseDir.listFiles();
@@ -50,7 +56,7 @@
break;
}
- File projectDir = new File(baseDir.getPath() + File.separator +
id);
+ File projectDir = new File(baseDir, id);
if(projectDir.mkdirs()) {
(new File(projectDir.getPath() + File.separator +
"nodes")).mkdirs();
@@ -59,6 +65,11 @@
FileOutputStream configFile = new
FileOutputStream(projectDir.getPath() + File.separator + "conf.xml");
Properties conf = new Properties();
conf.setProperty("title", projectTitle);
+
+ InsertableClientSSK key =
InsertableClientSSK.createRandom(randomSource, projectTitle);
+ conf.setProperty("insertURI",
key.getInsertURI().toString());
+ conf.setProperty("requestURI", key.getURI().toString());
+
conf.storeToXML(configFile, null);
configFile.close();
Modified: trunk/plugins/Echo/src/plugins/echo/SiteGenerator.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/SiteGenerator.java 2007-08-28
16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/SiteGenerator.java 2007-08-28
16:09:04 UTC (rev 14902)
@@ -1,5 +1,8 @@
package plugins.echo;
+import plugins.echo.block.Block;
+import plugins.echo.block.BlockManager;
+
import nu.xom.*;
import nu.xom.xslt.*;
@@ -11,6 +14,7 @@
public static final int POSTS_PER_PAGE = 5;
private NodesManager nodesManager;
+ private BlockManager blockManager;
private Builder parser;
private XSLTransform transform;
private XSLTransform rssTransform;
@@ -18,14 +22,15 @@
private Document template;
private Project project;
private File outDir;
+ private Element blocksElement;
public SiteGenerator(Project project) throws IOException,
ParsingException, XSLException {
this.project = project;
this.outDir = new File(project.getProjectDir(), "out/");
nodesManager = project.getNodesManager();
+ blockManager = project.getBlockManager();
parser = new Builder();
-
template =
parser.build(getClass().getResourceAsStream("/xml/test.xsl"));
// template =
parser.build("/home/fred/prog/soc/trunk/plugins/Echo/src/xml/test.xsl");
@@ -39,14 +44,27 @@
serializer.setIndent(4);
serializer.setMaxLength(128);
+ blocksElement = new Element("blocks");
+ Block[] blocks = blockManager.getBlocks();
+
+ for(Block b : blocks) {
+ if(! b.getPosition().equals("disabled"))
+ blocksElement.appendChild(b.toXMLElement());
+ }
}
- public void writeToFile(nu.xom.Nodes result, String fileName) throws
XSLException, IOException {
+ private void makePage(Element e, String fileName) throws XSLException,
IOException{
- serializer.setOutputStream(new
FileOutputStream(outDir.getPath() + File.separator + fileName));
+ Element page = new Element("page");
+ blocksElement.detach();
+ page.appendChild(blocksElement);
+ page.appendChild(e);
+
+ nu.xom.Nodes result = transform.transform(new Document(page));
+ serializer.setOutputStream(new FileOutputStream(new
File(outDir.getPath(), fileName)));
serializer.write(new Document((Element) result.get(0)));
- }
+ }
public void generate() throws Exception{ // TODO : Pfouille !!
@@ -54,8 +72,7 @@
Nodes nodes = nodesManager.getNodes();
for(Node node : nodes) {
- System.out.println(node.getId());
-
writeToFile(transform.transform(node.render().getDoc()), node.getId() +
".html");
+ makePage(node.render().getRoot(), node.getId() +
".html");
}
Nodes posts = nodes.getPosts();
@@ -63,25 +80,21 @@
Element index = new Element("index");
for(Node post : posts) {
- System.out.println(post.getId() + " (" +
post.getCreationDate().toString() + ")");
- index.appendChild(post.render().getRoot());
+ index.appendChild(post.summary().getRoot());
}
- writeToFile(transform.transform(new Document(index)),
"index.html");
+ makePage(index, "index.html");
// writeToFile(rssTransform.transform(new Document(index)),
"feed.rss");
-
- System.out.println("\n * Categories *");
-
+
String[] categories = nodesManager.getCategoriesIds();
for(String category : categories) {
- System.out.println(category);
index = new Element("index");
index.addAttribute(new Attribute("category", category));
for(Node post : posts) {
if(post.isInCategory(category))
-
index.appendChild(post.render().getRoot());
+
index.appendChild(post.summary().getRoot());
}
- writeToFile(transform.transform(new Document(index)),
"category-" + category + ".html");
+ makePage(index, "category-" + category + ".html");
}
Modified: trunk/plugins/Echo/src/plugins/echo/WikiMarkupRender.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/WikiMarkupRender.java 2007-08-28
16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/WikiMarkupRender.java 2007-08-28
16:09:04 UTC (rev 14902)
@@ -11,7 +11,7 @@
/**
This class provides a simple wiki markup render.
- Performances are acceptable but many optimizations are still possible
+ Atm the code is very crapy !!
Formatting tricks :
Heading
Modified: trunk/plugins/Echo/src/plugins/echo/block/BlockManager.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/block/BlockManager.java 2007-08-28
16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/block/BlockManager.java 2007-08-28
16:09:04 UTC (rev 14902)
@@ -1,5 +1,7 @@
package plugins.echo.block;
+import plugins.echo.Project;
+
import java.io.File;
import java.io.FileOutputStream;
import java.util.HashMap;
@@ -35,6 +37,9 @@
case BLOG_ROLL:
block = new BlogrollBlock(doc);
break;
+ case CATEGORIES:
+ block = new
CategoriesBlock(doc);
+ break;
}
if(block != null)
@@ -89,6 +94,9 @@
Block blogroll = new BlogrollBlock("001");
write(blogroll);
+
+ Block categories = new CategoriesBlock("002");
+ write(categories);
}
Modified: trunk/plugins/Echo/src/plugins/echo/block/BlogrollBlock.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/block/BlogrollBlock.java
2007-08-28 16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/block/BlogrollBlock.java
2007-08-28 16:09:04 UTC (rev 14902)
@@ -10,7 +10,7 @@
public class BlogrollBlock extends Block {
- public BlogrollBlock (String id) {
+ protected BlogrollBlock(String id) {
super(id, Block.BlockType.BLOG_ROLL);
Modified: trunk/plugins/Echo/src/plugins/echo/block/CategoriesBlock.java
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/block/CategoriesBlock.java
2007-08-28 16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/block/CategoriesBlock.java
2007-08-28 16:09:04 UTC (rev 14902)
@@ -1,11 +1,32 @@
package plugins.echo.block;
-public class CategoriesBlock /*extends Block*/ {
+import nu.xom.Document;
-// public CategoriesBlock(String id) {
-//
-// super(id, Block.BlockType.CATEGORIES);
-//
-// }
+public class CategoriesBlock extends Block {
+
+ protected CategoriesBlock(String id) {
+
+ super(id, Block.BlockType.CATEGORIES);
+
+ }
+
+ public CategoriesBlock(Document document) {
+
+ super(document);
+
+ }
+
+ public final boolean isConfigurable() {
+
+ return false;
+
+ }
+
+ public final BlockType getType() {
+
+ return Block.BlockType.CATEGORIES;
+
+ }
+
}
\ No newline at end of file
Modified: trunk/plugins/Echo/src/plugins/echo/i18n/echo.i18n.en.properties
===================================================================
--- trunk/plugins/Echo/src/plugins/echo/i18n/echo.i18n.en.properties
2007-08-28 16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/plugins/echo/i18n/echo.i18n.en.properties
2007-08-28 16:09:04 UTC (rev 14902)
@@ -27,5 +27,13 @@
echo.manage.myNodes.desc=A list of your nodes
echo.manage.newCategory=New category
echo.manage.categories.desc=Categorize your posts
+echo.manage.blocks.desc=Configure the sidebare and other regions
-echo.block.blog-roll=Blog Roll
\ No newline at end of file
+echo.block.blog-roll=Blog Roll
+echo.block.categories=Categories
+
+echo.generate=Generate the site
+echo.generate.desc=Generate the pages in order to preview the result
+
+echo.insert=Insert
+echo.insert.desc=Generate the site and insert it on Freenet
\ No newline at end of file
Modified: trunk/plugins/Echo/src/resources/edit.css
===================================================================
--- trunk/plugins/Echo/src/resources/edit.css 2007-08-28 16:07:10 UTC (rev
14901)
+++ trunk/plugins/Echo/src/resources/edit.css 2007-08-28 16:09:04 UTC (rev
14902)
@@ -42,8 +42,10 @@
hr {clear : both; visibility : hidden; margin : 0; padding : 0;}
p {margin: 0 0 10px 30px;}
+textarea {
+ width:80%;
+}
-
#container {
width: 90%;
margin-top:20px;
Modified: trunk/plugins/Echo/src/resources/style.css
===================================================================
--- trunk/plugins/Echo/src/resources/style.css 2007-08-28 16:07:10 UTC (rev
14901)
+++ trunk/plugins/Echo/src/resources/style.css 2007-08-28 16:09:04 UTC (rev
14902)
@@ -16,7 +16,10 @@
text-decoration: none;
color:#6da0de;
}
-
+blockquote {
+ border-left:5px solid #bbb;
+ padding-left:5px;
+}
a:hover {
text-decoration: underline;
}
@@ -25,6 +28,14 @@
color:black;
}
+h2.post-title {
+ margin-bottom:0;
+}
+
+.date{
+ color:gray;
+}
+
#container {
width: 760px;
margin: 0 auto;
@@ -67,14 +78,31 @@
color:white;
}
+h2#page-title {
+ margin-top:0.5em;
+ font-size:2em;
+}
+
ul.block {
list-style-type: none;
margin: 0;
padding: 0;
}
+div.post {
+
+ margin-bottom:2em;
+
+}
+
+div.entry {
+ padding-left:10px;
+}
+
div.meta {
+ background-color:#cfcfcf;
+ padding:3px;
}
Modified: trunk/plugins/Echo/src/xml/edit.xsl
===================================================================
--- trunk/plugins/Echo/src/xml/edit.xsl 2007-08-28 16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/xml/edit.xsl 2007-08-28 16:09:04 UTC (rev 14902)
@@ -39,7 +39,7 @@
<li><a
href="write"><i18n key="echo.action.write" /></a></li>
<li><a
href="manage"><i18n key="echo.action.manage" /></a></li>
<li><a
href="publish"><i18n key="echo.action.publish" /></a></li>
- <li><a
href="configure"><i18n key="echo.action.configure" /></a></li>
+<!-- <li><a
href="configure"><i18n key="echo.action.configure" /></a></li> -->
</ul>
</div>
@@ -47,7 +47,7 @@
<h1><xsl:value-of
select="title/text()" /></h1>
<xsl:apply-templates
select="errors" />
<xsl:apply-templates
select="data" />
- <div><xsl:copy-of
select="/node()" /></div>
+<!-- <div><xsl:copy-of
select="/node()" /></div> -->
</div>
</div>
@@ -85,11 +85,11 @@
<xsl:when test="publish">
<dl>
- <dt><a href="generate">Generate the
site</a></dt>
- <dd>Bleh bleh</dd>
+ <dt><a href="generate"><i18n
key="echo.generate" /></a></dt>
+ <dd><i18n key="echo.generate.desc"
/></dd>
- <dt><a href="insert">Insert</a></dt>
- <dd>Generate the site and insert it on
Freenet</dd>
+ <dt><a href="insert"><i18n
key="echo.insert" /></a></dt>
+ <dd><i18n key="echo.insert.desc" /></dd>
</dl>
</xsl:when>
@@ -100,27 +100,34 @@
</xsl:when>
<xsl:when test="insert">
- <form name="insert">
- <label for="insert-key">Insert
key</label>
- <input type="text" name="insert-key"
id="insert-key" size="70">
- <xsl:if test="insert/insertKey" >
- <xsl:attribute name="value">
- <xsl:value-of
select="insert/insertKey" />
- </xsl:attribute>
- </xsl:if>
- </input>
-
- <label for="request-key">Request
key</label>
- <input type="text" name="request-key"
id="request-key" size="70">
- <xsl:if test="insert/requestKey">
- <xsl:attribute name="value">
- <xsl:value-of
select="insert/requestKey" />
- </xsl:attribute>
- </xsl:if>
- </input>
- <input type="hidden"
name="formPassword" value="{formpassword/@value}" />
- <input type="submit" />
- </form>
+ <xsl:choose>
+ <xsl:when test="insert/@running='true'">
+ An insertion is already
running, you can see its advancement on the <a href="/queue/">queue page</a>.
+ </xsl:when>
+ <xsl:otherwise>
+ <form name="insert"
method="POST" action="">
+ <label
for="insert-key">Insert key</label>
+ <input type="text"
name="insert-key" id="insert-key" size="70">
+ <xsl:if
test="insert/insertURI" >
+ <xsl:attribute
name="value">
+
<xsl:value-of select="insert/insertURI" />
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+
+ <label
for="request-key">Request key</label>
+ <input type="text"
name="request-key" id="request-key" size="70">
+ <xsl:if
test="insert/requestURI">
+ <xsl:attribute
name="value">
+
<xsl:value-of select="insert/requestURI" />
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ <input type="hidden"
name="formPassword" value="{formpassword/@value}" />
+ <input type="submit" />
+ </form>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
<xsl:when test="configure">
@@ -160,7 +167,7 @@
<form name="newCategory" method="POST"
action="">
<label for="category-name"
class="inline"><i18n key="echo.manage.newCategory" /></label>
- <input type="text" id="category-name"
name="category-sname" class="inline" />
+ <input type="text" id="category-name"
name="category-name" class="inline" />
<input type="hidden"
name="formPassword" value="{formpassword/@value}" class="inline" />
<input type="submit" value="Create"
class="inline" />
</form>
@@ -272,9 +279,9 @@
<xsl:when test="./node">
<form name="edit" method="POST" action="">
<label for="edit-title"><i18n
key="echo.common.title" /></label>
- <input type="text" id="edit-title" name="title"
value="{node/title/text()}"/>
+ <input type="text" id="edit-title" name="title"
size="100" value="{node/title/text()}"/>
<label for="edit-body"><i18n
key="echo.write.nodeBody" /></label>
- <textarea id="edit-body" name="body" cols="60"
rows="20">
+ <textarea id="edit-body" name="body" cols="100"
rows="50">
<xsl:choose>
<xsl:when
test="node/content/text()">
<xsl:text><xsl:value-of
select="node/content" /></xsl:text>
Modified: trunk/plugins/Echo/src/xml/test.xsl
===================================================================
--- trunk/plugins/Echo/src/xml/test.xsl 2007-08-28 16:07:10 UTC (rev 14901)
+++ trunk/plugins/Echo/src/xml/test.xsl 2007-08-28 16:09:04 UTC (rev 14902)
@@ -14,15 +14,15 @@
<xsl:param name="basedir" />
<xsl:param name="project-title" />
-
+ <xsl:variable name="nodesdir"><xsl:value-of select="$basedir"
/>/nodes/</xsl:variable>
<xsl:variable name="blocksdir"><xsl:value-of select="$basedir"
/>/blocks/</xsl:variable>
- <xsl:variable name="categoriesFile"><xsl:value-of select="$basedir"
/>/categories.xml</xsl:variable>
+ <xsl:variable name="categoriesFile"><xsl:value-of select="$nodesdir"
/>/categories.xml</xsl:variable>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css"
media="screen" />
- <title>Blog - <xsl:call-template
name="page-title" /></title>
+ <title><xsl:value-of select="$project-title" />
- <xsl:call-template name="page-title" /></title>
</head>
<body>
<div id="container">
@@ -37,15 +37,15 @@
</div>-->
<div id="main">
- <h2><xsl:call-template
name="page-title" /></h2>
+ <h2
id="page-title"><xsl:call-template name="page-title" /></h2>
<xsl:call-template
name="content" />
</div>
- <!--<div id="right">
+ <div id="right">
<xsl:call-template name="blocks">
- <xsl:with-param
name="align">right</xsl:with-param>
+ <xsl:with-param
name="position">right</xsl:with-param>
</xsl:call-template>
- </div>-->
+ </div>
<div id="footer">
Powered by Echo
@@ -56,12 +56,12 @@
</xsl:template>
<xsl:template name="blocks">
- <xsl:param name="align" />
+ <xsl:param name="position" />
- <!--<xsl:for-each
select="document(concat($blocksdir,'blocks.xml'))//block[@align=$align]">
- <xsl:sort order="ascending" select ="@order" />
+ <xsl:for-each select="/page/blocks/block[@position=$position]">
+ <xsl:sort order="ascending" select ="@weight" />
<xsl:apply-templates
select="document(concat($blocksdir, @id, '.xml'))/block" />
- </xsl:for-each>-->
+ </xsl:for-each>
</xsl:template>
<xsl:template match="block">
@@ -78,7 +78,7 @@
<xsl:when test="@type='categories'">
<h3 class="block">Categories</h3>
<ul class="block categories">
- <xsl:for-each select="document(concat($basedir,
'categories.xml'))//category">
+ <xsl:for-each
select="document($categoriesFile)//category">
<li>
<a
href="category-{@id}.html"><xsl:value-of select="text()"/></a>
</li>
@@ -86,7 +86,7 @@
</ul>
</xsl:when>
- <xsl:when test="@type='blogroll'">
+ <xsl:when test="@type='blog-roll'">
<h3 class="block">Blogroll</h3>
<ul class="block blogroll">
<xsl:for-each select="blog">
@@ -115,20 +115,20 @@
<xsl:template name="content">
<xsl:choose>
- <xsl:when test="/node">
- <xsl:copy-of select="/node/content/node()" />
+ <xsl:when test="/page/node">
+ <xsl:copy-of select="/page/node/content/node()"
/>
</xsl:when>
- <xsl:when test="/index">
- <xsl:for-each select="/index/node">
+ <xsl:when test="/page/index">
+ <xsl:for-each select="/page/index/node">
<div class="post" id="post-{@id}">
- <h2><a
href="{@id}.html"><xsl:value-of select="title/text()"/></a></h2>
+ <h2 class="post-title"><a
href="{@id}.html"><xsl:value-of select="title/text()"/></a></h2>
+ <span
class="date"><xsl:value-of select="created/text()" /></span>
<div class="entry">
<xsl:copy-of
select="content/node()" />
</div>
<div class="meta">
- <xsl:value-of
select="created/text()" />
<xsl:if
test="count(categories/category) > 0">
- |<ul class="categories">
+ Posted in <ul
class="categories">
<xsl:for-each
select="categories/category">
<li>
<a
href="category-{@id}.html">
@@ -143,25 +143,25 @@
</div>
</div>
</xsl:for-each>
-<!-- <xsl:copy-of select="." /> -->
</xsl:when>
</xsl:choose>
+<!-- <xsl:copy-of select="/" /> -->
</xsl:template>
<xsl:template name="page-title">
<xsl:choose>
- <xsl:when test="/node">
- <xsl:value-of select="/node/title/text()" />
+ <xsl:when test="/page/node">
+ <xsl:value-of select="/page/node/title/text()"
/>
</xsl:when>
- <xsl:when test="/index">
+ <xsl:when test="/page/index">
<xsl:choose>
- <xsl:when test="/index/@category">
+ <xsl:when test="/page/index/@category">
<xsl:call-template
name="categoryName">
- <xsl:with-param
name="id" select="/index/@category" />
+ <xsl:with-param
name="id" select="/page/index/@category" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
- My Flog
+ Last posts
</xsl:otherwise>
</xsl:choose>
</xsl:when>