jeremy 02/03/17 13:26:56
Modified: src/scratchpad/webapp/mount/editor editor.xmap
src/scratchpad/webapp/mount/editor/editor/docs
alpha-config.xml bravo-config.xml
schematron-page.xml
src/scratchpad/webapp/mount/editor/editor/stylesheets
dir2editor.xsl editor-alpha-components.xsl
editor-bravo-components.xsl editor-components.xsl
editor-page2html.xsl editor-utils.xsl
editor2writer.xsl file2editor.xsl
request2editor.xsl stream2editor.xsl
Added: src/scratchpad/webapp/mount/editor/editor/stylesheets
generation-utils.xsl validationFilter.xsl
Log:
added new preview behaviour, you get to see what you are about to save,
before you save it
Revision Changes Path
1.6 +26 -40
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor.xmap
Index: editor.xmap
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor.xmap,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- editor.xmap 17 Mar 2002 16:10:25 -0000 1.5
+++ editor.xmap 17 Mar 2002 21:26:55 -0000 1.6
@@ -87,9 +87,10 @@
Enforces using 'docs' folder of the main
project as the root.
-->
- <map:match pattern="fetch-dir(*,**/*)">
+ <map:match pattern="content-dir(*,**/*)">
<map:generate type="xpathdirectory"
src="docs{2}/#/page/title"/>
<map:transform
src="editor/stylesheets/dir2editor.xsl">
+ <map:parameter name="behaviour"
value="dir"/>
<map:parameter name="sub" value="{1}"/>
<map:parameter name="target"
value="{2}/"/>
</map:transform>
@@ -104,7 +105,7 @@
To have different templates, you need new
sub-editors, and possibly, more specific pipelines to handle them
-->
- <map:match pattern="fetch-new(*,**)">
+ <map:match pattern="content-new(*,**)">
<map:generate src="editor/docs/template.xml"/>
<!-- get a template -->
<map:transform
src="editor/stylesheets/file2editor.xsl">
<map:parameter name="behaviour"
value="new"/>
@@ -114,19 +115,16 @@
<map:serialize type="xml"/>
</map:match>
- <!--
-
- Put using Alpha
-
- Parse form data for the "alpha" sub-editor
coming from the StreamGenerator
- Assemble the data into a new document and write
it.
- Enforces using 'docs' folder of the main
project as the root.
-
- NB. Do not put a slash at the end of the base
parameter,
- the target-path already has the correct ones
- -->
+ <map:match pattern="request-*(bravo)">
+ <map:generate type="request"/>
+ <map:transform
src="editor/stylesheets/request2editor.xsl">
+ <map:parameter name="sub"
value="bravo"/>
+ <map:parameter name="behaviour"
value="{1}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
- <map:match pattern="fetch-put(alpha,**)">
+ <map:match pattern="request-*(alpha)">
<map:act type="request">
<map:parameter name="parameters"
value="true"/>
<map:generate type="stream">
@@ -135,39 +133,28 @@
<map:transform
src="editor/stylesheets/stream2editor.xsl">
<map:parameter name="sub"
value="alpha"/>
<map:parameter name="target"
value="{target}"/>
+ <map:parameter name="behaviour"
value="{../1}"/>
</map:transform>
- <map:transform
src="cocoon:/make-validator(page)"/>
- <map:transform
src="editor/stylesheets/editor2writer.xsl">
- <map:parameter name="base"
value="docs"/>
- </map:transform>
- <map:transform type="sourcewriter"/>
<map:serialize type="xml"/>
</map:act>
</map:match>
- <!--
-
- Put using Bravo
-
- Copy form data for the "bravo" sub-editor from
multiple form fields, provided by the RequestGenerator
- Assemble the data into a new document and write
it.
- Enforces using 'docs' folder of the main
project as the root.
-
- NB. Do not put a slash at the end of the base
parameter,
- the target-path already has the correct ones
-
- -->
- <map:match pattern="fetch-put(bravo,**)">
- <map:generate type="request"/>
- <map:transform
src="editor/stylesheets/request2editor.xsl">
- <map:parameter name="sub"
value="bravo"/>
- </map:transform>
+ <map:match pattern="content-put(*,**)">
+ <map:generate src="cocoon:/request-put({1})"/>
<map:transform
src="cocoon:/make-validator(page)"/>
+ <map:transform
src="editor/stylesheets/validationFilter.xsl"/>
<map:transform
src="editor/stylesheets/editor2writer.xsl">
<map:parameter name="base"
value="docs"/>
</map:transform>
<map:transform type="sourcewriter"/>
- <map:serialize type="xml"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <map:match pattern="content-pre(*,**)">
+ <map:generate src="cocoon:/request-pre({1})"/>
+ <map:transform
src="cocoon:/make-validator(page)"/>
+ <map:transform
src="editor/stylesheets/validationFilter.xsl"/>
+ <map:serialize type="xml"/>
</map:match>
<!--
@@ -180,13 +167,12 @@
the target-path already has the correct ones
-->
- <map:match pattern="fetch-*(*,**)">
+ <map:match pattern="content-*(*,**)">
<map:generate src="docs{3}"/>
<map:transform
src="editor/stylesheets/file2editor.xsl">
<map:parameter name="behaviour"
value="{1}"/>
<map:parameter name="sub" value="{2}"/>
<map:parameter name="target"
value="{3}"/>
- <map:parameter name="form-name"
value="xml-field"/><!-- this is only needed by 'alpha' editor -->
</map:transform>
<map:serialize type="xml"/>
</map:match>
@@ -229,7 +215,7 @@
<map:match pattern="*(*)**">
<map:aggregate element="slash-edit" label="agg">
<map:part
src="editor/docs/{2}-config.xml"/>
- <map:part
src="cocoon:/fetch-{1}({2},{3})"/>
+ <map:part
src="cocoon:/content-{1}({2},{3})"/>
</map:aggregate>
<map:transform
src="editor/stylesheets/editor-page2html.xsl"/>
<map:serialize type="xhtml"/>
1.3 +12 -2
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/alpha-config.xml
Index: alpha-config.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/alpha-config.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- alpha-config.xml 14 Mar 2002 19:59:17 -0000 1.2
+++ alpha-config.xml 17 Mar 2002 21:26:55 -0000 1.3
@@ -11,18 +11,21 @@
<title behaviour="put">Save Results</title>
<title behaviour="see">View a Page</title>
<title behaviour="dir">Directory Listing</title>
+ <title behaviour="pre">Page Preview</title>
<notify behaviour="new">Making a new File at</notify>
<notify behaviour="get">Editing the File at</notify>
<notify behaviour="put">Results of saving a file at</notify>
<notify behaviour="see">Viewing the File at</notify>
<notify behaviour="dir">Directory Listing of</notify>
+ <notify behaviour="pre">Editor Preview of</notify>
<notes behaviour="new">Please edit the XML, then click the 'Make New
File' button above</notes>
<notes behaviour="get">Please edit the XML, then click the 'Save My
Changes' button above</notes>
<notes behaviour="put">Thanks for using <slash-edit/></notes>
<notes behaviour="see">This is the editor-view of your file, internal
links are not likely to work correctly.</notes>
<notes behaviour="dir">Please choose a file to view in the
editor</notes>
+ <notes behaviour="pre">Please confirm your changes, or fix your
mistakes</notes>
<!-- The commands -->
<command behaviour="new" tip="Make a new File"
icon="new.gif">new(alpha)</command>
@@ -30,10 +33,12 @@
<command behaviour="put">put(alpha)</command>
<command behaviour="see" tip="See this File"
icon="see.gif">see(alpha)</command>
<command behaviour="dir" tip="View Directory listing"
icon="dir.gif">dir(alpha)</command>
+ <command behaviour="pre">pre(alpha)</command>
<!-- text for form buttons -->
- <button behaviour="new">Make New File</button>
- <button behaviour="get">Save My Changes</button>
+ <button behaviour="new" tip="This will create a new file at the
location specified in the 'Save as' field">Make New File</button>
+ <button behaviour="get" tip="View the result of your changes, without
overwriting the original">Preview My Changes</button>
+ <button behaviour="pre" tip="Your changes will written">Save My
Changes</button>
<!-- the tools available to each behaviour -->
<tools behaviour="new">
@@ -58,6 +63,11 @@
</tools>
<tools behaviour="dir">
<tool command="new"/>
+ </tools>
+ <tools behaviour="pre">
+ <tool command="dir"/>
+ <tool command="new"/>
+ <tool command="see"/>
</tools>
<!-- what to call the parent directory link -->
1.4 +12 -2
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/bravo-config.xml
Index: bravo-config.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/bravo-config.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- bravo-config.xml 17 Mar 2002 16:10:25 -0000 1.3
+++ bravo-config.xml 17 Mar 2002 21:26:55 -0000 1.4
@@ -11,18 +11,21 @@
<title behaviour="put">Save Results</title>
<title behaviour="see">View a Document</title>
<title behaviour="dir">Directory Listing</title>
+ <title behaviour="pre">Document Preview</title>
<notify behaviour="new">Making a new Document at</notify>
<notify behaviour="get">Editing the Document at</notify>
<notify behaviour="put">Results of saving a Document at</notify>
<notify behaviour="see">Viewing the Document at</notify>
<notify behaviour="dir">Directory Listing of</notify>
+ <notify behaviour="pre">Editor Preview of</notify>
<notes behaviour="new">Please edit the fields, then click the 'Make New
Document' button above</notes>
<notes behaviour="get">Please edit the fields, then click the 'Save My
Changes' button above</notes>
<notes behaviour="put">Thanks for using <slash-edit/></notes>
<notes behaviour="see">This is the editor-view of your Document,
internal links are not likely to work correctly.</notes>
<notes behaviour="dir">Please choose a Document to view in the
editor</notes>
+ <notes behaviour="pre">Please confirm your changes, or fix your
mistakes</notes>
<!-- The commands -->
<command behaviour="new" tip="Make a new Document"
icon="new.gif">new(bravo)</command>
@@ -30,10 +33,12 @@
<command behaviour="put">put(bravo)</command>
<command behaviour="see" tip="See this Document"
icon="see.gif">see(bravo)</command>
<command behaviour="dir" tip="View Directory listing"
icon="dir.gif">dir(bravo)</command>
+ <command behaviour="pre">pre(bravo)</command>
<!-- text for form buttons -->
- <button behaviour="new">Make New Document</button>
- <button behaviour="get">Save My Changes</button>
+ <button behaviour="new" tip="This will create a new document at the
location specified in the 'Save as' field">Make New Document</button>
+ <button behaviour="get" tip="View the result of your changes, without
overwriting the original">Preview My Changes</button>
+ <button behaviour="pre" tip="Your changes will written">Save My
Changes</button>
<!-- the tools available to each behaviour -->
<tools behaviour="new">
@@ -58,6 +63,11 @@
</tools>
<tools behaviour="dir">
<tool command="new"/>
+ </tools>
+ <tools behaviour="pre">
+ <tool command="dir"/>
+ <tool command="new"/>
+ <tool command="see"/>
</tools>
<!-- what to call the parent directory link -->
1.2 +1 -1
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/schematron-page.xml
Index: schematron-page.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/schematron-page.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- schematron-page.xml 17 Mar 2002 16:10:25 -0000 1.1
+++ schematron-page.xml 17 Mar 2002 21:26:55 -0000 1.2
@@ -8,7 +8,7 @@
<schema ns="http://xml.apache.cocoon/page"
xmlns="http://www.ascc.net/xml/schematron">
<title>Schema for <slash-edit/></title>
- <pattern name="Page Validation Pattern">
+ <pattern name="Cocoon Simple Page">
<rule context="page">
<assert test="count(title) > 0">There should be a
title tag.</assert>
<assert test="count(title) < 2">There only should
be one title tag.</assert>
1.4 +3 -5
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/dir2editor.xsl
Index: dir2editor.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/dir2editor.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dir2editor.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ dir2editor.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -5,11 +5,12 @@
xmlns:dir="http://apache.org/cocoon/directory/2.0"
>
- <xsl:param name="sub"/>
+ <xsl:include href="generation-utils.xsl"/>
<!-- utility templates and variables -->
+
<xsl:param name="target"/>
<xsl:template match="/">
- <editor sub="{$sub}">
+ <editor sub="{$sub}" command-base="{$command-base}">
<instance behaviour="dir" target="{$target}">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
@@ -17,8 +18,5 @@
</instance>
</editor>
</xsl:template>
-<!-- copy anything -->
- <xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
- <xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
1.4 +40 -3
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-alpha-components.xsl
Index: editor-alpha-components.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-alpha-components.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- editor-alpha-components.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ editor-alpha-components.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -4,8 +4,6 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
-
-
<!-- your form for editing 'page' doctype content, handles the 'alpha'
sub-editor for 'get' and 'new' behaviours -->
<xsl:template match="[EMAIL PROTECTED]'alpha']/[EMAIL PROTECTED]'get'
or @behaviour='new']/page" mode="sub-editor">
@@ -17,7 +15,7 @@
<tr>
<td bgcolor="white">
<form method="post">
- <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'put']"/></xsl:attribute>
+ <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'pre']"/></xsl:attribute>
<table border="0"
cellspacing="0" cellpadding="5" width="100%">
<tr>
<td
colspan="2"><span class="block-title">File content: </span><br/><textarea
name="{$config/xml-field-name}" rows="20" cols="80" xml:space="preserve"
onchange="changed=true;"><xsl:apply-templates select="."/> </textarea></td>
@@ -39,5 +37,44 @@
<br/>
</xsl:template>
+<!-- your template for previewing 'page' doctype content, handles the
'alpha' sub-editor for 'pre' behaviour -->
+ <xsl:template match="[EMAIL PROTECTED]'alpha']/[EMAIL
PROTECTED]'pre']/page" mode="sub-editor">
+ <br/>
+ <table bgcolor="#0086B2" border="0" cellspacing="1"
cellpadding="5" width="95%">
+ <tr>
+ <td class="notes" colspan="2">Editor
Preview</td>
+ </tr>
+ <tr><td bgcolor="white"><xsl:apply-templates
mode="editor-view"/></td></tr>
+ </table>
+ <br/>
+ <table bgcolor="#0086B2" border="0" cellspacing="1"
cellpadding="5">
+ <tr>
+ <td class="block-title" colspan="2">Confirm</td>
+ </tr>
+ <tr>
+ <td bgcolor="white">
+ <form method="post">
+ <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'put']"/></xsl:attribute>
+ <table border="0"
cellspacing="0" cellpadding="5" width="100%">
+ <tr>
+ <td
colspan="2"><span class="block-title">XML content: </span><br/><textarea
name="{$config/xml-field-name}" rows="6" cols="80" xml:space="preserve"
onchange="changed=true;"><xsl:apply-templates select="."/> </textarea></td>
+ </tr>
+ <tr>
+ <td
valign="middle">
+ <span
class="block-title">Save as: </span><br/><input type="text" name="target"
value="{$newfile}" size="40" title="Note: to make a new directory, prepend the
filename with a directory path"/>
+ </td>
+ <td
align="right">
+ <input
type="hidden" name="xml-field-name" value="{$config/xml-field-name}"/>
+ <input
class="submit" type="submit" value="{$config/[EMAIL PROTECTED] = $behaviour]}"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+ </xsl:template>
</xsl:stylesheet>
1.4 +43 -1
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-bravo-components.xsl
Index: editor-bravo-components.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-bravo-components.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- editor-bravo-components.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ editor-bravo-components.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -15,13 +15,55 @@
<tr>
<td bgcolor="white">
<form method="post">
- <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'put']"/></xsl:attribute>
+ <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'pre']"/></xsl:attribute>
<table border="0"
cellspacing="0" cellpadding="5" width="100%">
<tr>
<td><span
class="block-title">Title: </span><br/><input name="title" size="40"
onchange="changed=true;" value="{normalize-space(title)}"/></td>
</tr>
<tr>
<td
colspan="2"><span class="block-title">Body: </span><br/><textarea
name="content" rows="20" cols="80" xml:space="preserve"
onchange="changed=true;"><xsl:apply-templates select="content/*" mode="bravo"/>
</textarea></td>
+ </tr>
+ <tr>
+ <td
valign="middle">
+ <span
class="block-title">Save as: </span><br/><input type="text" name="target"
value="{$newfile}" size="40" title="Note: to make a new directory, prepend the
filename with a directory path"/>
+ </td>
+ <td
align="right">
+ <input
class="submit" type="submit" value="{$config/[EMAIL PROTECTED] = $behaviour]}"/>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+ </table>
+ <br/>
+ </xsl:template>
+
+<!-- your template for previewing 'page' doctype content, handles the
'bravo' sub-editor for 'pre' behaviour -->
+ <xsl:template match="[EMAIL PROTECTED]'bravo']/[EMAIL
PROTECTED]'pre']/page" mode="sub-editor">
+ <br/>
+ <table bgcolor="#0086B2" border="0" cellspacing="1"
cellpadding="5" width="95%">
+ <tr>
+ <td class="notes" colspan="2">Editor
Preview</td>
+ </tr>
+ <tr><td bgcolor="white"><xsl:apply-templates
mode="editor-view"/></td></tr>
+ </table>
+ <br/>
+
+ <table bgcolor="#0086B2" border="0" cellspacing="1"
cellpadding="5">
+ <tr>
+ <td class="notes" colspan="2">Confirm</td>
+ </tr>
+ <tr>
+ <td bgcolor="white">
+ <form method="post">
+ <xsl:attribute
name="action"><xsl:value-of select="$command-base"/><xsl:value-of
select="$config/[EMAIL PROTECTED] = 'put']"/></xsl:attribute>
+ <table border="0"
cellspacing="0" cellpadding="5" width="100%">
+ <tr>
+ <td><span
class="block-title">Title: </span><br/><input name="title" size="40"
onchange="changed=true;" value="{normalize-space(title)}"/></td>
+ </tr>
+ <tr>
+ <td
colspan="2"><span class="block-title">Body: </span><br/><textarea
name="content" rows="6" cols="80" xml:space="preserve"
onchange="changed=true;"><xsl:apply-templates select="content/*" mode="bravo"/>
</textarea></td>
</tr>
<tr>
<td
valign="middle">
1.6 +11 -2
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-components.xsl
Index: editor-components.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-components.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- editor-components.xsl 17 Mar 2002 16:10:25 -0000 1.5
+++ editor-components.xsl 17 Mar 2002 21:26:55 -0000 1.6
@@ -14,8 +14,17 @@
<xsl:template match="[EMAIL PROTECTED]'see']/page" mode="sub-editor">
<br/>
- <table border="0" cellspacing="2" cellpadding="0" width="95%"
bgcolor="white">
- <tr><td><xsl:apply-templates mode="editor-view"/></td></tr>
+ <table bgcolor="#0086B2" border="0" cellspacing="1"
cellpadding="5" width="95%">
+ <tr>
+ <td class="notes" colspan="2">Editor View</td>
+ </tr>
+ <tr>
+ <td bgcolor="white">
+ <table border="0" cellspacing="2"
cellpadding="0" width="95%" bgcolor="white">
+ <tr><td><xsl:apply-templates
mode="editor-view"/></td></tr>
+ </table>
+ </td>
+ </tr>
</table>
<br/>
</xsl:template>
1.6 +3 -7
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-page2html.xsl
Index: editor-page2html.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-page2html.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- editor-page2html.xsl 17 Mar 2002 16:10:25 -0000 1.5
+++ editor-page2html.xsl 17 Mar 2002 21:26:55 -0000 1.6
@@ -8,13 +8,12 @@
>
-
<!--
This is the main Editor Stylesheet
It adapts itself to the particular command being sent in the
structure of the XML.
It uses information stored in
'editor/docs/[sub-editor]-config.xml' to work out the commands, static strings
etc.
-->
-
+
<xsl:include href="editor-utils.xsl"/>
<!-- utility templates and variables -->
<xsl:include href="editor-components.xsl"/>
<!-- generic editor display templates -->
<xsl:include href="editor-alpha-components.xsl"/>
<!-- "alpha" sub-editor display templates -->
@@ -101,7 +100,7 @@
</table>
</center>
- <!-- debug <table>
+<!-- debug <table>
<tr>
<td>target</td> <td><xsl:value-of
select="$target"/></td>
</tr>
@@ -111,10 +110,7 @@
<tr>
<td>behaviour</td> <td><xsl:value-of
select="$behaviour"/></td>
</tr>
- <tr>
- <td>old-behaviour</td>
<td><xsl:value-of select="$old-behaviour"/></td>
- </tr>
- </table> -->
+ </table> -->
<!-- / debug -->
<p align="center">
1.5 +2 -27
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-utils.xsl
Index: editor-utils.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor-utils.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- editor-utils.xsl 17 Mar 2002 16:10:25 -0000 1.4
+++ editor-utils.xsl 17 Mar 2002 21:26:55 -0000 1.5
@@ -5,27 +5,17 @@
>
<xsl:variable name="sub" select="/slash-edit/editor/@sub"/>
+ <xsl:variable name="command-base"
select="/slash-edit/editor/@command-base"/>
<xsl:variable name="target"
select="/slash-edit/editor/instance/@target"/>
<xsl:variable name="behaviour"
select="/slash-edit/editor/instance/@behaviour"/>
- <xsl:variable name="old-behaviour"><xsl:value-of
select="/slash-edit/editor/instance/@old-behaviour"/></xsl:variable><!-- darn!
this is a hack! -->
- <xsl:variable name="form-name"
select="/slash-edit/editor/instance/@form-name"/>
<!-- the aggregated editor-config document -->
<xsl:variable name="config" select="/slash-edit/config"/>
-<!-- the relative base for commands -->
- <xsl:variable name="command-base">
- <xsl:if test="$behaviour != 'put' and $old-behaviour != 'put'">
- <xsl:call-template name="find-base">
- <xsl:with-param name="path"><xsl:value-of
select="$target"/></xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
<!-- Do we have a form on this page? -->
<xsl:variable name="is-form">
<xsl:choose>
- <xsl:when test="$behaviour = 'get' or $behaviour =
'new'">true</xsl:when>
+ <xsl:when test="$behaviour = 'get' or $behaviour =
'new' or $behaviour = 'pre'">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@@ -39,21 +29,6 @@
<xsl:otherwise><xsl:value-of
select="$config/default-new-file"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
-<!-- find the command base, relative to the current folder -->
- <xsl:template name="find-base">
- <xsl:param name="path"/>
- <xsl:param name="prefix"></xsl:param>
- <xsl:choose>
- <xsl:when test="contains($path,'/')">
- <xsl:call-template name="find-base">
- <xsl:with-param
name="path"><xsl:value-of select="substring-after($path,'/')"/></xsl:with-param>
- <xsl:with-param
name="prefix"><xsl:value-of select="concat($prefix,'../')"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise><xsl:value-of
select="$prefix"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
<!-- copy anything -->
<xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
1.2 +7 -6
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor2writer.xsl
Index: editor2writer.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/editor2writer.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editor2writer.xsl 17 Mar 2002 16:10:25 -0000 1.1
+++ editor2writer.xsl 17 Mar 2002 21:26:55 -0000 1.2
@@ -24,17 +24,18 @@
<xsl:template match="editor">
- <editor sub="[EMAIL PROTECTED]">
+ <editor>
+ <xsl:copy-of select="@*"/>
<xsl:choose>
- <xsl:when test="validationResult/pattern/error">
- <instance behaviour="get" old-behaviour="put"
target="{instance/@target}" form-name="{instance/@form-name}">
+ <xsl:when test="instance/@behaviour='put'">
+ <instance behaviour="{instance/@behaviour}"
target="{instance/@target}"><source:write
src="{concat($base,instance/@target)}" xml:space="preserve"
xmlns:source="http://apache.org/cocoon/source/1.0">
<xsl:apply-templates select="instance/*"/>
- </instance>
+ </source:write></instance>
</xsl:when>
<xsl:otherwise>
- <instance behaviour="{instance/@behaviour}"
target="{instance/@target}"><source:write
src="{concat($base,instance/@target)}" xml:space="preserve"
xmlns:source="http://apache.org/cocoon/source/1.0">
+ <instance behaviour="{instance/@behaviour}"
target="{instance/@target}">
<xsl:apply-templates select="instance/*"/>
- </source:write></instance>
+ </instance>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="validationResult"/>
1.4 +4 -8
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/file2editor.xsl
Index: file2editor.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/file2editor.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- file2editor.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ file2editor.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -3,23 +3,19 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
+ <xsl:include href="generation-utils.xsl"/>
<!-- utility templates and variables -->
- <xsl:param name="sub"/>
<xsl:param name="target"/>
- <xsl:param name="behaviour"/>
- <xsl:param name="form-name"/>
<xsl:template match="/">
- <editor sub="{$sub}">
- <instance behaviour="{$behaviour}" target="{$target}"
form-name="{$form-name}">
+ <editor sub="{$sub}" command-base="{$command-base}">
+ <instance behaviour="{$behaviour}" target="{$target}">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
</xsl:copy>
</instance>
</editor>
</xsl:template>
-<!-- copy anything -->
- <xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
- <xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
+
</xsl:stylesheet>
1.4 +5 -44
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/request2editor.xsl
Index: request2editor.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/request2editor.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- request2editor.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ request2editor.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -5,7 +5,9 @@
xmlns:request="http://xml.apache.org/cocoon/requestgenerator/2.0"
>
- <xsl:param name="sub"/>
+ <xsl:include href="generation-utils.xsl"/>
<!-- utility templates and variables -->
+
+ <xsl:variable name="target"
select="request:request/request:requestParameters/request:[EMAIL PROTECTED] =
'target']/request:value"/>
<!--
@@ -21,10 +23,9 @@
-->
-
<xsl:template match="/">
-<editor sub="{$sub}">
-<instance behaviour="put"
target="{request:request/request:requestParameters/request:[EMAIL PROTECTED] =
'target']/request:value}">
+<editor sub="{$sub}" command-base="{$command-base}">
+<instance behaviour="{$behaviour}" target="{$target}">
<page><xsl:text>
</xsl:text><title><xsl:value-of
select="request:request/request:requestParameters/request:[EMAIL PROTECTED] =
'title']/request:value"/></title><xsl:text>
</xsl:text><content><xsl:text>
@@ -37,45 +38,5 @@
</editor>
</xsl:template>
-<!-- convert double CRs to 'para' tags -->
-<xsl:template name="cr2para">
- <xsl:param name="text"/>
- <xsl:choose>
- <xsl:when test="normalize-space(substring-before($text,'

')) !=
''">
- <para><xsl:call-template name="cr2br"><xsl:with-param
name="text"><xsl:value-of
select="substring-before($text,'

')"/></xsl:with-param></xsl:call-template></para>
- <xsl:text>
- </xsl:text>
- <xsl:call-template name="cr2para">
- <xsl:with-param name="text"><xsl:value-of
select="substring-after($text,'

')"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="normalize-space($text) != ''">
- <para><xsl:call-template name="cr2br"><xsl:with-param
name="text"><xsl:value-of
select="$text"/></xsl:with-param></xsl:call-template></para>
- </xsl:when>
- </xsl:choose>
-</xsl:template>
-
-<!-- convert single CRs to 'br' tags -->
-<xsl:template name="cr2br">
- <xsl:param name="text"/>
- <xsl:choose>
- <xsl:when test="normalize-space(substring-before($text,'
')) != ''">
-<xsl:value-of
select="normalize-space(substring-before($text,'
'))"/><br/>
-<xsl:text>
-</xsl:text>
- <xsl:call-template name="cr2br">
- <xsl:with-param name="text"><xsl:value-of
select="substring-after($text,'
')"/></xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="normalize-space($text) != ''"><xsl:value-of
select="$text"/></xsl:when>
- </xsl:choose>
-</xsl:template>
-
-
-
-
-<!-- copy anything -->
- <xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
- <xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
1.4 +3 -8
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/stream2editor.xsl
Index: stream2editor.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/stream2editor.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- stream2editor.xsl 17 Mar 2002 16:10:25 -0000 1.3
+++ stream2editor.xsl 17 Mar 2002 21:26:55 -0000 1.4
@@ -3,8 +3,8 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
+ <xsl:include href="generation-utils.xsl"/>
<!-- utility templates and variables -->
- <xsl:param name="sub"/>
<xsl:param name="target"/>
<!--
@@ -13,17 +13,12 @@
-->
-
<xsl:template match="/">
-<editor sub="{$sub}">
-<instance behaviour="put" target="{$target}">
+<editor sub="{$sub}" command-base="{$command-base}">
+<instance behaviour="{$behaviour}" target="{$target}">
<xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
</instance>
</editor>
</xsl:template>
-
-<!-- copy anything -->
- <xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
- <xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/generation-utils.xsl
Index: generation-utils.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="sub"/>
<xsl:param name="behaviour"/>
<!-- the relative base for commands -->
<xsl:variable name="command-base">
<xsl:choose>
<xsl:when test="$behaviour = 'put'"></xsl:when>
<xsl:when test="$behaviour = 'pre'"></xsl:when>
<xsl:otherwise>
<xsl:call-template name="find-base">
<xsl:with-param name="path"><xsl:value-of
select="$target"/></xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- find the command base, relative to the current folder -->
<xsl:template name="find-base">
<xsl:param name="path"/>
<xsl:param name="prefix"></xsl:param>
<xsl:choose>
<xsl:when test="contains($path,'/')">
<xsl:call-template name="find-base">
<xsl:with-param
name="path"><xsl:value-of select="substring-after($path,'/')"/></xsl:with-param>
<xsl:with-param
name="prefix"><xsl:value-of select="concat($prefix,'../')"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><xsl:value-of
select="$prefix"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- convert double CRs to 'para' tags -->
<xsl:template name="cr2para">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="normalize-space(substring-before($text,'

')) !=
''">
<para><xsl:call-template name="cr2br"><xsl:with-param
name="text"><xsl:value-of
select="substring-before($text,'

')"/></xsl:with-param></xsl:call-template></para>
<xsl:text>
</xsl:text>
<xsl:call-template name="cr2para">
<xsl:with-param name="text"><xsl:value-of
select="substring-after($text,'

')"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="normalize-space($text) != ''">
<para><xsl:call-template name="cr2br"><xsl:with-param
name="text"><xsl:value-of
select="$text"/></xsl:with-param></xsl:call-template></para>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- convert single CRs to 'br' tags -->
<xsl:template name="cr2br">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="normalize-space(substring-before($text,'
')) != ''">
<xsl:value-of select="normalize-space(substring-before($text,'
'))"/><br/>
<xsl:text>
</xsl:text>
<xsl:call-template name="cr2br">
<xsl:with-param name="text"><xsl:value-of
select="substring-after($text,'
')"/></xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="normalize-space($text) != ''"><xsl:value-of
select="$text"/></xsl:when>
</xsl:choose>
</xsl:template>
<!-- copy anything -->
<xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
<xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
1.1
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/stylesheets/validationFilter.xsl
Index: validationFilter.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sch="http://www.ascc.net/xml/schematron"
xmlns:zvon="http://zvon.org/schematron"
xmlns:request="http://xml.apache.org/cocoon/requestgenerator/2.0"
>
<!--
This StyleSheet changes the behaviour of the Editor if the output of
the Validator contains errors.
NB. the indentation of these templates effects the output document
NB. it can get tricky to decide which namespaces need to be in which
stylesheet,
to make sure the wrong ones don't end up being written to source
-->
<xsl:variable name="behaviour">
<xsl:choose>
<xsl:when
test="/editor/validationResult/pattern/error">get</xsl:when>
<xsl:otherwise><xsl:value-of
select="/editor/instance/@behaviour"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="editor">
<editor>
<xsl:copy-of select="@*"/>
<instance behaviour="{$behaviour}" target="{instance/@target}">
<xsl:apply-templates select="instance/*"/>
</instance>
<xsl:apply-templates select="validationResult"/>
</editor>
</xsl:template>
<!-- copy anything -->
<xsl:template match="@*|node()"
priority="-2"><xsl:copy><xsl:apply-templates
select="@*|node()"/></xsl:copy></xsl:template>
<xsl:template match="text()" priority="-1"><xsl:value-of
select="."/></xsl:template>
</xsl:stylesheet>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]