jeremy 02/03/14 11:59:18
Modified: src/scratchpad/webapp/mount/editor README editor.xmap
src/scratchpad/webapp/mount/editor/editor/docs
alpha-config.xml bravo-config.xml welcome.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
file2editor.xsl request2editor.xsl
stream2editor.xsl
Added: src/scratchpad/webapp/mount/editor/editor/images see.gif
Removed: src/scratchpad/webapp/mount/editor/editor/images view.gif
Log:
simplified SiteMap and XSLT further, by no longer separating path and file.
Now get Document 'title' in dir list using XPathDirectoryGenerator, plus some
style and documentation changes
Revision Changes Path
1.5 +25 -10 xml-cocoon2/src/scratchpad/webapp/mount/editor/README
Index: README
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/README,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- README 13 Mar 2002 19:19:42 -0000 1.4
+++ README 14 Mar 2002 19:59:17 -0000 1.5
@@ -27,9 +27,11 @@
Please report any problems.
-There is a sample 'file' editor in here now, called <slash-edit/>. It allows
you to edit XML files in the outer 'editor/docs/' directory. Currently the
sample can only edit the entire file in one form field, this is because I am
using the StreamGenerator to Parse the Request data and it can only handle a
single field. An additional problem here is that if there is an error in your
XML, your will only get part of it written to disk.
+There is a sample editor, called <slash-edit/>. It allows you to edit XML
files in the outer 'editor/docs/' directory. Currently there are two samples,
one (Alpha) can edit the entire file in one form field, the other (Bravo)
breaks down the xml into seperate form fields, converting <para/> and <br/>
tags to double and single linebreaks in the form, and back agian on submit.
-I'm working on samples that break your XML into separate fields so the user
is not editing raw XML. I can use the RequestGenerator but this does not parse
fields, so it can only be used to edit simple XML.
+Alpha uses the StreamGenerator to Parse the Request data so it can only
handle a single field. The main problem with it is that if there is an error in
your XML, your will only get part of it written to disk.
+
+Bravo, does not suffer from this problem because the form fields are not
Parsed, the problem now is that you cannot write any XML tags, without them
turning into Entities. Maybe this is useful for some purposes.
I think we will need a RequestParsingGenerator, that can selectively parse
fields, and signal via the generated XML that there has been a Parsing error,
not by throwing SaxExceptions, that way mal-formed XML in form fields can be
handled more gracefully.
@@ -41,22 +43,35 @@
Here is a breakdown of the StyleSheets used by the editor, and what they do:
-editor-page2html.xsl
- builds the page for all 'behaviours' calling different templates as
appropriate.
- It xsl:include's 'editor-components.xsl' and 'editor-utils.xsl'.
+dir2editor.xsl
+ converts a directory listing from the XPathDirectoryGenerator into an
Editor
+editor-alpha-components.xsl
+ Handles Alpha form creation
+editor-bravo-components.xsl
+ Handles Bravo Form creation
editor-components.xsl
- controls the style of the form(s), the tools, the 'editor view',
- the directory listing and the report from SourceWritingTransformer.
+ contains generic editor components for things like:
+ directory listing formatting, source:write reporting, editor-view etc.
+editor-page2html.xsl
+ controls the style of the page for all 'behaviours' calling different
templates as appropriate.
+ It xsl:include's 'editor-components.xsl', 'editor-utils.xsl',
+ 'editor-alpha-components.xsl' and 'editor-bravo-components.xsl'.
+ It reacts to the behaviour name embedded in the structure of the xml,
by the aggregation and fetching process
editor-utils.xsl
a few generic utilities used by editor-page2html.xsl
simple-page2html.xsl
renders <slash-edit/> welcome page
-stream2xfwt.xsl
+file2editor.xsl
+ copies the output of the FileGenerator
+request2editor.xsl
+ constructs a new document from the output of the RequestGenerator
+ into a tag telling the WriteableSourceTransformer to do it's job.
+stream2editor.xsl
copies the output of the StreamGenerator into a tag telling the
WriteableSourceTransformer to do it's job.
- It xsl:include's 'editor-utils.xsl'.
-The file 'mount/editor/editor/docs/editor.xml' contains information used by
'editor-page2html.xsl' such as the names of buttons, the tools for each
behaviour, the available commands etc.
+
+The file 'mount/editor/editor/docs/[sub-editor]-config.xml' contains
information used by 'editor-page2html.xsl' such as the names of buttons, the
tools for each behaviour, the available commands etc. for each sub-editor.
1.4 +130 -110
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- editor.xmap 13 Mar 2002 19:19:42 -0000 1.3
+++ editor.xmap 14 Mar 2002 19:59:17 -0000 1.4
@@ -1,24 +1,27 @@
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
- <map:generators default="file"/>
- <map:serializers default="html">
-
- <!-- You can define your own Serializer for SourceWritingTransformer to
use -->
-
- <map:serializer
- name="my-xml-serializer"
- mime-type="text/xml"
logger="sitemap.serializer.myxml"
-
src="org.apache.cocoon.serialization.XMLSerializer"
- >
-
<!--<doctype-system>urn:hrc:doc</doctype-system>-->
- <encoding>utf-8</encoding>
- <omit-xml-declaration>no</omit-xml-declaration>
- <indent>2</indent>
- </map:serializer>
+ <map:generators default="file">
- <!-- Define an xhtml Serializer, in case you need
people to edit HTML and have it remain xml well-formed -->
+ <!--
+
+ Define an XPathDirectoryGenerator
+
+ -->
+ <map:generator
+ name="xpathdirectory"
+ logger="sitemap.generator.xpathdirectory"
+
src="org.apache.cocoon.generation.XPathDirectoryGenerator"
+ />
+ </map:generators>
+ <map:serializers default="html">
+ <!--
+
+ Define an xhtml Serializer
+ In case you need people to edit HTML and have
it remain xml well-formed
+
+ -->
<map:serializer name="xhtml" mime-type="text/html"
src="org.apache.cocoon.serialization.XMLSerializer" pool-max="128"
pool-min="32" pool-grow="8"
logger="sitemap.core">
@@ -30,15 +33,18 @@
</map:serializers>
<map:transformers default="xslt">
- <!-- Define 'sourcewriter' as the name for SourceWritingTransformer -->
- <!-- You can set up the default Serialiser here -->
- <!-- You can also set it in the invocation tag below -->
- <!-- or place serializer="serializer-name" in the source:write tag -->
- <!-- if you leave it out altogether, 'xml' is used -->
-
+ <!--
+
+ Define 'sourcewriter' as the name for SourceWritingTransformer
+ You can set up the default Serialiser here
+ You can also set it in the invocation tag below
+ or place serializer="serializer-name" in the source:write tag
+ If you are using FileSource, you need to specify a Serializer.
+
+ -->
<map:transformer name="sourcewriter" logger="sitemap.transformer.tofile"
src="org.apache.cocoon.transformation.SourceWritingTransformer" label="source">
- <serializer>my-xml-serializer</serializer>
+ <serializer>xml</serializer>
</map:transformer>
</map:transformers>
@@ -61,86 +67,124 @@
<map:pipelines>
<map:pipeline internal-only="true">
- <!-- internal pipelines to collect and format the
appropriate content based on the requested behaviour and sub-editor -->
- <!-- see below, the 'put' behaviour is different for
'file' and 'page' sub-editors -->
- <!-- all other behaviours currently ignore the
sub-editor because I don't need them to do anything differnt at the moment -->
- <!-- If I do have this need later on, I still have to
option of selecting diferent '2editor' stylesheets based on sub-editor name
before I have to start making new matchers -->
-
- <!-- directory listing, limited to the contents of your
project's 'docs' folder -->
- <map:match pattern="fetch-dir(*,**,*)">
- <map:generate type="directory"
src="docs{2}{3}/"/> <!-- enforce
the use of 'docs'-->
- <map:transform
src="editor/stylesheets/dir2editor.xsl">
- <map:parameter name="sub-editor"
value="{1}"/>
- <map:parameter name="target-dir"
value="{2}{3}"/>
- </map:transform>
- <map:serialize type="xml"/>
- </map:match>
+
+ <!--
+
+ Internal pipelines to collect and format the
appropriate content based on the requested behaviour and sub-editor
+
+ eg. the 'put' behaviour is different for
'alpha' and 'bravo' sub-editors
+ All other behaviours currently ignore the
sub-editor because I don't need them to do anything different at the moment
+
+ -->
+
- <!-- need a special one for the default directory -->
- <map:match pattern="fetch-dir(*)">
- <map:generate type="directory" src="docs/"/>
<!-- enforce the use of 'docs'-->
+ <!--
+
+ Directory Listing
+
+ Uses the XPathDirectoryGenerator to extract the
'title' of each document
+ This one removes any filename from the path,
(which is a PIA to do in XSL!)
+ Enforces using 'docs' folder of the main
project as the root.
+
+ -->
+ <map:match pattern="fetch-dir(*,**/*)">
+ <map:generate type="xpathdirectory"
src="docs{2}/#/page/title"/>
<map:transform
src="editor/stylesheets/dir2editor.xsl">
<map:parameter name="sub-editor"
value="{1}"/>
- <map:parameter name="target-dir"
value="/"/>
+ <map:parameter name="target-path"
value="{2}/"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
- <!-- new page -->
- <!-- both my sub-editor edit the same doctype, so I can
do everything from one template -->
- <!-- to have different templates, you need new
sub-editors, and more specific pipelines to handle them -->
- <map:match pattern="fetch-new(*,**,*)">
+ <!--
+
+ New
+
+ Both my sub-editors edit the same doctype, so I
can do everything from one template
+ To have different templates, you need new
sub-editors, and possibly, more specific pipelines to handle them
+
+ -->
+ <map:match pattern="fetch-new(*,**)">
<map:generate src="editor/docs/template.xml"/>
<!-- get a template -->
<map:transform
src="editor/stylesheets/file2editor.xsl">
<map:parameter name="sub-editor"
value="{1}"/>
- <map:parameter name="target-file"
value="{3}"/>
- <map:parameter name="target-dir"
value="{2}"/>
+ <map:parameter name="target-path"
value="{2}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
- <!-- parse form data for the "alpha" sub-editor -->
- <map:match pattern="fetch-put(alpha,**,*)">
- <map:generate type="stream">
- <map:parameter name="form-name"
value="xml-field"/>
- </map:generate>
- <map:transform
src="editor/stylesheets/stream2editor.xsl">
- <map:parameter name="sub-editor"
value="alpha"/>
- <map:parameter name="target-file"
value="{2}"/>
- <map:parameter name="target-dir"
value="{1}"/>
- <map:parameter name="base"
value="docs"/>
- <!-- enforce saving in docs folder of
main project. Do not put a slash after docs, the target-dir already has the
correct ones -->
- </map:transform>
- <map:serialize type="xml"/>
+ <!--
+
+ 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="fetch-put(alpha,**)">
+ <map:act type="request">
+ <map:parameter name="parameters"
value="true"/>
+ <map:generate type="stream">
+ <map:parameter name="form-name"
value="xml-field"/>
+ </map:generate>
+ <map:transform
src="editor/stylesheets/stream2editor.xsl">
+ <map:parameter
name="sub-editor" value="alpha"/>
+ <map:parameter
name="target-path" value="{target-path}"/>
+ <map:parameter name="base"
value="docs"/>
+ </map:transform>
+ <map:transform type="sourcewriter"/>
+ <map:serialize type="xml"/>
+ </map:act>
</map:match>
- <!-- parse form data for the "bravo" sub-editor -->
- <map:match pattern="fetch-put(bravo,**,*)">
+ <!--
+
+ 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-editor"
value="bravo"/>
- <map:parameter name="target-file"
value="{2}"/>
- <map:parameter name="target-dir"
value="{1}"/>
<map:parameter name="base"
value="docs"/>
- <!-- enforce saving in docs folder of
main project. Do not put a slash after docs, the target-dir already has the
correct ones -->
</map:transform>
+ <map:transform type="sourcewriter"/>
<map:serialize type="xml"/>
</map:match>
- <!-- get or view a page, limited to the contents of
your project's 'docs' folder -->
- <map:match pattern="fetch-*(*,**,*)">
- <map:generate src="docs{3}{4}"/>
<!-- enforce the use of 'docs'-->
+ <!--
+
+ Get or See
+
+ Enforces using 'docs' folder of the main
project as the root.
+
+ NB. Do not put a slash at the end of the root
directory for the generator,
+ the target-path already has the correct ones
+
+ -->
+ <map:match pattern="fetch-*(*,**)">
+ <map:generate src="docs{3}"/>
<map:transform
src="editor/stylesheets/file2editor.xsl">
<map:parameter name="sub-editor"
value="{2}"/>
- <map:parameter name="target-file"
value="{4}"/>
- <map:parameter name="target-dir"
value="{3}"/>
- <map:parameter name="form-name"
value="xml-field"/>
+ <map:parameter name="target-path"
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>
</map:pipeline>
<map:pipeline>
+
<!-- the default page -->
<map:match pattern="">
<map:redirect-to uri="welcome"/>
@@ -161,52 +205,28 @@
<map:read src="editor/images/{2}.gif"
mime-type="image/gif"/>
</map:match>
- <!-- general purpose behaviour pipelines -->
-
- <!-- need a special one for the default directory -->
- <map:match pattern="dir(*)/">
- <map:aggregate element="dir" label="agg">
- <map:part
src="editor/docs/{1}-config.xml"/>
- <map:part
src="cocoon:raw:/fetch-dir({1})"/>
- </map:aggregate>
- <map:transform
src="editor/stylesheets/editor-page2html.xsl"/>
- <map:serialize type="xhtml"/>
- </map:match>
-
- <!-- need a special one for put -->
- <map:match pattern="put(*)">
- <map:act type="request">
- <map:parameter name="parameters"
value="true"/>
- <map:aggregate element="put"
label="agg">
- <map:part
src="editor/docs/{../1}-config.xml"/>
- <map:part
src="cocoon:/fetch-put({../1},{target-dir},{target-file})"/>
- </map:aggregate>
- <map:transform type="sourcewriter"/>
- <map:transform
src="editor/stylesheets/editor-page2html.xsl"/>
- <map:serialize type="xhtml"/>
- </map:act>
- </map:match>
-
- <!-- get|view|put|new a page as a form or a view, in the document root
-->
- <map:match pattern="*(*)/*">
- <map:aggregate element="{1}" label="agg">
- <map:part
src="editor/docs/{2}-config.xml"/>
- <map:part
src="cocoon:raw:/fetch-{1}({2},/,{3})"/>
<!-- enforce the use of 'docs'-->
- </map:aggregate>
- <map:transform
src="editor/stylesheets/editor-page2html.xsl"/>
- <map:serialize type="xhtml"/>
- </map:match>
-
- <!-- get|view|put|new a page as a form or a view, from the document
root -->
- <map:match pattern="*(*)/**/*">
+ <!--
+
+ General purpose behaviour pipeline
+ Retrieves a page as a form or a view, or retrieves a directory
listing
+
+ get(sub-editor-name)/path/to/file
- get a document for editing in a form
+ see(sub-editor-name)/path/to/file
- see a document with the editor
+ new(sub-editor-name)/path/to/file
- create a new document
+ put(sub-editor-name)
- save a modified
document from a form submission
+ dir(sub-editor-name)/path/to/directory/
- show a directory listing
+
+ -->
+ <map:match pattern="*(*)**">
<map:aggregate element="{1}" label="agg">
<map:part
src="editor/docs/{2}-config.xml"/>
- <map:part
src="cocoon:raw:/fetch-{1}({2},/{3}/,{4})"/>
+ <map:part
src="cocoon:/fetch-{1}({2},{3})"/>
</map:aggregate>
<map:transform
src="editor/stylesheets/editor-page2html.xsl"/>
<map:serialize type="xhtml"/>
</map:match>
+ <!-- generic error handlers -->
<map:handle-errors>
<map:transform
src="context://stylesheets/system/error2html.xsl"/>
<map:serialize status-code="500"/>
1.2 +10 -8
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- alpha-config.xml 13 Mar 2002 19:19:42 -0000 1.1
+++ alpha-config.xml 14 Mar 2002 19:59:17 -0000 1.2
@@ -9,26 +9,26 @@
<title behaviour="new">Make a new Page</title>
<title behaviour="get">Edit a Page</title>
<title behaviour="put">Save Results</title>
- <title behaviour="view">View a Page</title>
+ <title behaviour="see">View a Page</title>
<title behaviour="dir">Directory Listing</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="view">Viewing the File at</notify>
+ <notify behaviour="see">Viewing the File at</notify>
<notify behaviour="dir">Directory Listing 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="view">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</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>
<!-- The commands -->
<command behaviour="new" tip="Make a new File"
icon="new.gif">new(alpha)</command>
<command behaviour="get" tip="Edit this File"
icon="get.gif">get(alpha)</command>
<command behaviour="put">put(alpha)</command>
- <command behaviour="view" tip="View this File"
icon="view.gif">view(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>
<!-- text for form buttons -->
@@ -43,15 +43,15 @@
<tools behaviour="get">
<tool command="dir"/>
<tool command="new"/>
- <tool command="view"/>
+ <tool command="see"/>
</tools>
<tools behaviour="put">
<tool command="dir"/>
<tool command="new"/>
<tool command="get"/>
- <tool command="view"/>
+ <tool command="see"/>
</tools>
- <tools behaviour="view">
+ <tools behaviour="see">
<tool command="dir"/>
<tool command="new"/>
<tool command="get"/>
@@ -64,4 +64,6 @@
<parent-dir tip="View Parent Directory listing">..</parent-dir>
<!-- what to call the field the XML goes in -->
<xml-field-name>xml-field</xml-field-name>
+<!-- what to call new files -->
+ <default-new-file>new.xml</default-new-file>
</config>
1.2 +19 -17
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- bravo-config.xml 13 Mar 2002 19:19:42 -0000 1.1
+++ bravo-config.xml 14 Mar 2002 19:59:17 -0000 1.2
@@ -6,33 +6,33 @@
<!-- if you want to change the names of the 'behaviours' make the same
changes in the editor.xmap! -->
<!-- Various display strings -->
- <title behaviour="new">Make a new Page</title>
- <title behaviour="get">Edit a Page</title>
+ <title behaviour="new">Make a new Document</title>
+ <title behaviour="get">Edit a Document</title>
<title behaviour="put">Save Results</title>
- <title behaviour="view">View a Page</title>
+ <title behaviour="see">View a Document</title>
<title behaviour="dir">Directory Listing</title>
- <notify behaviour="new">Making a new Page at</notify>
- <notify behaviour="get">Editing the Page at</notify>
- <notify behaviour="put">Results of saving a Page at</notify>
- <notify behaviour="view">Viewing the Page at</notify>
+ <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>
- <notes behaviour="new">Please edit the XML, then click the 'Make New
Page' button above</notes>
+ <notes behaviour="new">Please edit the XML, then click the 'Make New
Document' 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="view">This is the editor-view of your Page, internal
links are not likely to work correctly.</notes>
- <notes behaviour="dir">Please choose a file to view</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>
<!-- The commands -->
- <command behaviour="new" tip="Make a new File"
icon="new.gif">new(bravo)</command>
- <command behaviour="get" tip="Edit this File"
icon="get.gif">get(bravo)</command>
+ <command behaviour="new" tip="Make a new Document"
icon="new.gif">new(bravo)</command>
+ <command behaviour="get" tip="Edit this Document"
icon="get.gif">get(bravo)</command>
<command behaviour="put">put(bravo)</command>
- <command behaviour="view" tip="View this File"
icon="view.gif">view(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>
<!-- text for form buttons -->
- <button behaviour="new">Make New Page</button>
+ <button behaviour="new">Make New Document</button>
<button behaviour="get">Save My Changes</button>
<!-- the tools available to each behaviour -->
@@ -43,15 +43,15 @@
<tools behaviour="get">
<tool command="dir"/>
<tool command="new"/>
- <tool command="view"/>
+ <tool command="see"/>
</tools>
<tools behaviour="put">
<tool command="dir"/>
<tool command="new"/>
<tool command="get"/>
- <tool command="view"/>
+ <tool command="see"/>
</tools>
- <tools behaviour="view">
+ <tools behaviour="see">
<tool command="dir"/>
<tool command="new"/>
<tool command="get"/>
@@ -62,4 +62,6 @@
<!-- what to call the parent directory link -->
<parent-dir tip="View Parent Directory listing">..</parent-dir>
+<!-- what to call new files -->
+ <default-new-file>new.xml</default-new-file>
</config>
1.4 +2 -2
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/welcome.xml
Index: welcome.xml
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/docs/welcome.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- welcome.xml 13 Mar 2002 19:19:42 -0000 1.3
+++ welcome.xml 14 Mar 2002 19:59:17 -0000 1.4
@@ -14,7 +14,7 @@
</para><para>
<img src="image/get.gif"/> Gives you a form to edit
this file.
</para><para>
- <img src="image/view.gif"/> View this file in the
editor, useful for proof reading etc.
+ <img src="image/see.gif"/> See this file in the editor,
useful for proof reading etc.
</para><para>
There is no Delete function available, though you can
overwrite files (no questions asked!).
</para><para>
@@ -101,7 +101,7 @@
<td>  </td><td>dir</td><td>your-project/edit/<b>dir(sub-editor)</b>/path/to/directory/</td><td>gives
you a directory listing</td>
</tr>
<tr valign="top">
-
<td></td><td>view</td><td>your-project/edit/<b>view(sub-editor)</b>/path/to/file</td><td>views
your page within the editor (it is not going to look the same, outside the
context of your project)</td>
+
<td></td><td>see</td><td>your-project/edit/<b>see(sub-editor)</b>/path/to/file</td><td>lets
you see your page within the editor (it is not going to look the same, outside
the context of your project)</td>
</tr>
<tr valign="top">
<td></td><td>get</td><td>your-project/edit/<b>get(sub-editor)</b>/path/to/file</td><td>converts
the file into an HTML Form for editing</td>
1.1
xml-cocoon2/src/scratchpad/webapp/mount/editor/editor/images/see.gif
<<Binary file>>
1.2 +2 -3
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dir2editor.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ dir2editor.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -6,11 +6,10 @@
>
<xsl:param name="sub-editor"/>
- <xsl:param name="target-file"/>
- <xsl:param name="target-dir"/>
+ <xsl:param name="target-path"/>
<xsl:template match="/">
- <editor sub-editor="{$sub-editor}" target-file="{$target-file}"
target-dir="{$target-dir}">
+ <editor sub-editor="{$sub-editor}" target-path="{$target-path}">
<xsl:copy>
<xsl:apply-templates select="@*|*"/>
</xsl:copy>
1.2 +1 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editor-alpha-components.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ editor-alpha-components.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -17,10 +17,9 @@
</tr>
<tr>
<td valign="middle">
- <span class="caption">Save
as:</span> <input type="text" name="target-file" value="{$newfile}" size="40"
title="Note: to make a new directory, prepend the filename with a directory
path"/>
+ <span class="caption">Save
as:</span> <input type="text" name="target-path" 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="target-dir" value="{$target-dir}"/>
<input type="hidden"
name="xml-field-name" value="{$config/xml-field-name}"/>
<input type="submit"
value="{$config/[EMAIL PROTECTED] = $behaviour]}"/>
</td>
1.2 +1 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editor-bravo-components.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ editor-bravo-components.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -18,10 +18,9 @@
</tr>
<tr>
<td valign="middle">
- <span class="caption">Save
as:</span> <input type="text" name="target-file" value="{$newfile}" size="40"
title="Note: to make a new directory, prepend the filename with a directory
path"/>
+ <span class="caption">Save
as:</span> <input type="text" name="target-path" 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="target-dir" value="{$target-dir}"/>
<input type="submit"
value="{$config/[EMAIL PROTECTED] = $behaviour]}"/>
</td>
</tr>
1.4 +15 -8
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- editor-components.xsl 13 Mar 2002 19:19:42 -0000 1.3
+++ editor-components.xsl 14 Mar 2002 19:59:17 -0000 1.4
@@ -12,7 +12,7 @@
<xsl:apply-templates select="."/>
</xsl:template>
- <xsl:template match="/view/editor/page" mode="sub-editor">
+ <xsl:template match="/see/editor/page" mode="sub-editor">
<xsl:apply-templates mode="editor-view"/>
</xsl:template>
@@ -33,7 +33,7 @@
<!-- Displays the directory listing -->
<xsl:template match="dir:directory">
- <table border="0" cellspacing="0" cellpadding="5" width="100%"
bgcolor="white">
+ <table border="0" cellspacing="2" cellpadding="0" width="100%"
bgcolor="white">
<tr>
<td width="20">
<a href="../" title="{$config/parent-dir/@tip}">
@@ -43,6 +43,7 @@
<td colspan="2">
<a href="../"
title="{$config/parent-dir/@tip}"><b><xsl:value-of
select="$config/parent-dir/text()"/></b></a>
</td>
+ <td></td>
<td><xsl:value-of select="@date"/></td>
</tr>
<xsl:apply-templates/>
@@ -52,6 +53,7 @@
<!-- Displays sub-directories -->
<xsl:template match="dir:directory/dir:directory">
<tr>
+ <xsl:if test="position() mod 2 = 0"><xsl:attribute
name="bgcolor">#EEFFFF</xsl:attribute></xsl:if>
<td></td>
<td width="20" align="right">
<a href="[EMAIL PROTECTED]/" title="{$config/[EMAIL PROTECTED] =
'dir']/@tip}">
@@ -61,6 +63,7 @@
<td>
<a href="[EMAIL PROTECTED]/" title="{$config/[EMAIL PROTECTED] =
'dir']/@tip}"><xsl:value-of select="@name"/></a>
</td>
+ <td></td>
<td>
<xsl:value-of select="@date"/>
</td>
@@ -70,18 +73,22 @@
<!-- Displays files in the directory listing -->
<xsl:template match="dir:file">
<tr>
+ <xsl:if test="position() mod 2 = 0"><xsl:attribute
name="bgcolor">#EEFFFF</xsl:attribute></xsl:if>
<td></td>
<td width="20" align="right">
- <a title="{$config/[EMAIL PROTECTED] = 'view']/@tip}">
- <xsl:attribute name="href"><xsl:value-of
select="$command-base"/><xsl:value-of select="$config/[EMAIL PROTECTED] =
'view']/text()"/><xsl:value-of select="$target-path"/><xsl:value-of
select="@name"/></xsl:attribute>
- <img src="{concat('image/',$config/[EMAIL PROTECTED] =
'view']/@icon)}" border="0"/>
+ <a title="{$config/[EMAIL PROTECTED] = 'see']/@tip}">
+ <xsl:attribute name="href"><xsl:value-of
select="$command-base"/><xsl:value-of select="$config/[EMAIL PROTECTED] =
'see']/text()"/><xsl:value-of select="$target-path"/><xsl:value-of
select="@name"/></xsl:attribute>
+ <img src="{concat('image/',$config/[EMAIL PROTECTED] = 'see']/@icon)}"
border="0"/>
</a>
</td>
- <td width="60%">
- <a title="{$config/[EMAIL PROTECTED] = 'view']/@tip}">
- <xsl:attribute name="href"><xsl:value-of
select="$command-base"/><xsl:value-of select="$config/[EMAIL PROTECTED] =
'view']/text()"/><xsl:value-of select="$target-path"/><xsl:value-of
select="@name"/></xsl:attribute>
+ <td width="40%">
+ <a title="{$config/[EMAIL PROTECTED] = 'see']/@tip}">
+ <xsl:attribute name="href"><xsl:value-of
select="$command-base"/><xsl:value-of select="$config/[EMAIL PROTECTED] =
'see']/text()"/><xsl:value-of select="$target-path"/><xsl:value-of
select="@name"/></xsl:attribute>
<xsl:value-of select="@name"/>
</a>
+ </td>
+ <td>
+ <xsl:value-of select="dir:xpath/title"/>
</td>
<td>
<xsl:value-of select="@date"/>
1.4 +17 -15
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- editor-page2html.xsl 13 Mar 2002 19:19:42 -0000 1.3
+++ editor-page2html.xsl 14 Mar 2002 19:59:17 -0000 1.4
@@ -3,7 +3,8 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
-
+
+
<!--
This is the main Editor Stylesheet
It adapts itself to the particular command being sent in the
structure of the XML.
@@ -16,10 +17,10 @@
<xsl:include href="editor-bravo-components.xsl"/>
<!-- "bravo" sub-editor display templates -->
<!-- add your "sub-editors" here -->
- <xsl:template match="get|new|view|put|dir">
+ <xsl:template match="get|new|see|put|dir">
<html>
<head>
- <title><xsl:value-of select="$config/@title"/> - <xsl:value-of
select="$config/[EMAIL PROTECTED] = $behaviour]"/> - <xsl:value-of
select="title"/></title>
+ <title><xsl:value-of select="$config/@title"/> - <xsl:value-of
select="$config/[EMAIL PROTECTED] = $behaviour]"/> - <xsl:value-of
select="$target-path"/></title>
<xsl:if test="$is-form = 'true'">
<script lang="JavaScript"><![CDATA[
var changed = false;
@@ -37,19 +38,19 @@
</xsl:if>
<style><![CDATA[
- <!--
a{text-decoration:none}
- a:hover{text-decoration:underline}
- body{font-family :
sans-serif,Arial,Tahoma;color:black;background-color : white;}
+ a:hover{text-decoration:underline;color:red}
+
body{font-size:12px;font-family:sans-serif,Arial,Tahoma;color:black;background:white;}
+
h1{font-size:18px;font-weight:bold;font-family:sans-serif,Arial,Tahoma;color:black;background:white;}
form{font-size:12px;background:#0086B2}
- .notify{font-size:15px;}
+ .notify{font-size:15px;background:white;}
.notes{font-size:12px;font-weight:bold;color:white;background:#0086B2}
- .result{font-size:12px;color:black}
+ .result{font-size:12px;color:black;background:white}
.failure{font-size:12px;font-weight:bold;color:red}
.success{font-size:12px;color:black}
.caption{font-size:12px;font-weight:bold;color:black;}
textarea{font-size:12px;font-family :
geneva,arial,sans-serif;}
- //-->]]>
+ ]]>
</style>
</head>
<body> <center>
@@ -58,7 +59,7 @@
<tr>
<td>
<table border="0" cellspacing="0"
cellpadding="5" width="100%" bgcolor="white">
- <tr>
+ <tr bgcolor="white">
<td
class="notify"><b><xsl:value-of select="$config/[EMAIL PROTECTED] =
$behaviour]"/>:</b> <xsl:value-of select="$target-path"/></td>
<xsl:apply-templates
select="$config/[EMAIL PROTECTED] = $behaviour]"/>
</tr>
@@ -87,17 +88,17 @@
</table>
</center>
- <!-- debug <table>
+ <!-- debug <table>
<tr>
- <td>target-file</td> <td><xsl:value-of
select="$target-file"/></td>
+ <td>target-path</td> <td><xsl:value-of
select="$target-path"/></td>
</tr>
<tr>
- <td>target-dir</td> <td><xsl:value-of
select="$target-dir"/></td>
+ <td>command-base</td> <td><xsl:value-of
select="$command-base"/></td>
</tr>
<tr>
<td>behaviour</td> <td><xsl:value-of
select="$behaviour"/></td>
</tr>
- </table> -->
+ </table> -->
<!-- / debug -->
<p align="center">
@@ -121,9 +122,10 @@
<xsl:attribute name="href">
<xsl:if test="$is-form =
'true'"><xsl:text>javascript:exit('</xsl:text></xsl:if>
<xsl:choose>
- <xsl:when test="$com =
'dir'"><xsl:value-of select="$command-base"/><xsl:value-of
select="$command/text()"/><xsl:value-of select="$target-dir"/></xsl:when>
+ <xsl:when test="$com =
'new'"><xsl:value-of select="$command-base"/><xsl:value-of
select="$command/text()"/><xsl:value-of select="$newfile"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$command-base"/><xsl:value-of
select="$command/text()"/><xsl:value-of select="$target-path"/></xsl:otherwise>
</xsl:choose>
+
<xsl:if test="$is-form =
'true'"><xsl:text>');</xsl:text></xsl:if>
</xsl:attribute>
<img
src="{concat('image/',$command/@icon)}" border="0"/>
1.3 +9 -15
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- editor-utils.xsl 13 Mar 2002 19:19:42 -0000 1.2
+++ editor-utils.xsl 14 Mar 2002 19:59:17 -0000 1.3
@@ -4,8 +4,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
- <xsl:variable name="target-file" select="/*/editor/@target-file"/>
- <xsl:variable name="target-dir" select="/*/editor/@target-dir"/>
+ <xsl:variable name="target-path" select="/*/editor/@target-path"/>
<xsl:variable name="behaviour" select="local-name(/*)"/>
<!-- the aggregated editor-config document -->
@@ -15,7 +14,7 @@
<xsl:variable name="command-base">
<xsl:if test="$behaviour != 'put'">
<xsl:call-template name="find-base">
- <xsl:with-param name="dir"><xsl:value-of
select="$target-dir"/></xsl:with-param>
+ <xsl:with-param name="path"><xsl:value-of
select="$target-path"/></xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:variable>
@@ -28,29 +27,24 @@
</xsl:choose>
</xsl:variable>
-<!-- the full target path, including filename, not including 'docs' -->
- <xsl:variable name="target-path">
- <xsl:value-of select="$target-dir"/><xsl:value-of
select="$target-file"/>
- </xsl:variable>
-
<!-- what to give as the default name of a new file -->
<xsl:variable name="newfile">
<xsl:choose>
- <!--<xsl:when test="$behaviour != 'new' and
$target-file != ''"><xsl:value-of select="$target-file"/></xsl:when>-->
- <xsl:when test="$target-file != ''"><xsl:value-of
select="$target-file"/></xsl:when>
- <xsl:when test="$config/default-new-file"><xsl:value-of
select="$config/default-new-file"/></xsl:when>
- <xsl:otherwise>new.xml</xsl:otherwise>
+ <xsl:when test="$target-path = '/'"><xsl:value-of
select="$target-path"/><xsl:value-of
select="$config/default-new-file"/></xsl:when>
+ <xsl:when
test="substring($target-path,string-length($target-path)) = '/'"><xsl:value-of
select="$target-path"/><xsl:value-of
select="$config/default-new-file"/></xsl:when>
+ <xsl:when test="$target-path != ''"><xsl:value-of
select="$target-path"/></xsl:when>
+ <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="dir"/>
+ <xsl:param name="path"/>
<xsl:param name="prefix"></xsl:param>
<xsl:choose>
- <xsl:when test="$dir != ''">
+ <xsl:when test="contains($path,'/')">
<xsl:call-template name="find-base">
- <xsl:with-param
name="dir"><xsl:value-of select="substring-after($dir,'/')"/></xsl:with-param>
+ <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>
1.2 +2 -3
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- file2editor.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ file2editor.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -5,11 +5,10 @@
>
<xsl:param name="sub-editor"/>
- <xsl:param name="target-file"/>
- <xsl:param name="target-dir"/>
+ <xsl:param name="target-path"/>
<xsl:template match="page">
- <editor sub-editor="{$sub-editor}" target-file="{$target-file}"
target-dir="{$target-dir}">
+ <editor sub-editor="{$sub-editor}" target-path="{$target-path}">
<xsl:copy>
<xsl:apply-templates select="@*|*" mode="copy"/>
</xsl:copy>
1.2 +3 -4
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- request2editor.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ request2editor.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -23,14 +23,13 @@
<xsl:param name="sub-editor"/>
- <xsl:param name="target-file"/>
- <xsl:param name="target-dir"/>
+ <xsl:variable name="target-path"
select="/request:request/request:requestParameters/request:[EMAIL PROTECTED] =
'target-path']/request:value"/>
<xsl:param name="base"/>
<xsl:template match="/">
-<editor sub-editor="{$sub-editor}" target-file="{$target-file}"
target-dir="{$target-dir}">
-<source:write src="{concat($base,$target-dir,$target-file)}"
xml:space="preserve">
+<editor sub-editor="{$sub-editor}" target-path="{$target-path}">
+<source:write src="{concat($base,$target-path)}" xml:space="preserve">
<page>
<title><xsl:value-of
select="request:request/request:requestParameters/request:[EMAIL PROTECTED] =
'title']/request:value"/></title>
<content>
1.2 +3 -4
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- stream2editor.xsl 13 Mar 2002 19:19:42 -0000 1.1
+++ stream2editor.xsl 14 Mar 2002 19:59:17 -0000 1.2
@@ -16,14 +16,13 @@
-->
<xsl:param name="sub-editor"/>
- <xsl:param name="target-file"/>
- <xsl:param name="target-dir"/>
+ <xsl:param name="target-path"/>
<xsl:param name="base"/>
<xsl:template match="page">
-<editor sub-editor="{$sub-editor}" target-file="{$target-file}"
target-dir="{$target-dir}">
-<source:write src="{concat($base,$target-dir,$target-file)}"
xml:space="preserve">
+<editor sub-editor="{$sub-editor}" target-path="{$target-path}">
+<source:write src="{concat($base,$target-path)}" xml:space="preserve">
<page><xsl:copy-of select="@*"/>
<title><xsl:value-of select="title[1]"/></title>
<content><xsl:copy-of select="content/@*"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]