unico 2004/03/17 09:27:59
Modified: src/blocks/slide/java/org/apache/cocoon/samples/slide
AdminHelper.java
src/blocks/slide/samples/styles locks2html.xsl
content2html.xsl
src/blocks/slide/samples flow.js sitemap.xmap
Log:
- fix content and properties viewing and path resolving
- make adding locks easier by providing list of options for type and subject
Revision Changes Path
1.7 +5 -2
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/samples/slide/AdminHelper.java
Index: AdminHelper.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/samples/slide/AdminHelper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AdminHelper.java 5 Mar 2004 13:02:23 -0000 1.6
+++ AdminHelper.java 17 Mar 2004 17:27:59 -0000 1.7
@@ -559,14 +559,17 @@
String path,
String subject,
String type,
+ String expiration,
String exclusive,
String inherit) throws Exception {
String uri = getUriFromPath(nat,path);
boolean isExclusive = Boolean.valueOf(exclusive).booleanValue();
boolean isInherit = Boolean.valueOf(inherit).booleanValue();
- // expires after one minute
- Date expire = new Date(System.currentTimeMillis() + 1000*60);
+
+ // expiration in minutes
+ int intExpiration = Integer.valueOf(expiration).intValue();
+ Date expire = new Date(System.currentTimeMillis() +
intExpiration*1000*60);
SlideToken slideToken = new SlideTokenImpl(new
CredentialsToken(caller));
Lock lock = nat.getLockHelper();
1.3 +41 -6 cocoon-2.1/src/blocks/slide/samples/styles/locks2html.xsl
Index: locks2html.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/slide/samples/styles/locks2html.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- locks2html.xsl 6 Mar 2004 02:25:51 -0000 1.2
+++ locks2html.xsl 17 Mar 2004 17:27:59 -0000 1.3
@@ -26,6 +26,11 @@
<xsl:param name="path"/>
<xsl:param name="type">locks</xsl:param>
+ <xsl:param name="userspath"/>
+ <xsl:param name="rolespath"/>
+ <xsl:param name="groupspath"/>
+ <xsl:param name="actionspath"/>
+
<xsl:template name="middle">
<column title="Locks">
<table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2"
width="100%" align="center">
@@ -38,7 +43,7 @@
<b>Type</b>
</td>
<td align="left">
- <b>Expiration</b>
+ <b>Expiration (mins)</b>
</td>
<td align="left">
<b>Inheritable</b>
@@ -79,13 +84,43 @@
<form action="{$base}/addlock" method="post">
<input type="hidden" name="resourcePath" value="{$path}"/>
<td align="left">
- <input name="subject" type="text" size="20" maxlength="40"/>
+ <select name="subject">
+ <option>self</option>
+ <option>owner</option>
+ <option>authenticated</option>
+ <option>unauthenticated</option>
+ <option>all</option>
+ <xsl:for-each select="/document/roles/role">
+ <xsl:variable name="roleuri" select="uri/text()" />
+ <xsl:variable name="rolename"
select="substring-after($roleuri,concat($rolespath,'/'))"/>
+ <option value="{$roleuri}">
+ role: <xsl:value-of select="$rolename"/>
+ </option>
+ </xsl:for-each>
+ <xsl:for-each select="/document/users/user">
+ <xsl:variable name="useruri" select="uri/text()" />
+ <xsl:variable name="username"
select="substring-after($useruri,concat($userspath,'/'))"/>
+ <option value="{$useruri}">
+ user: <xsl:value-of select="$username"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </td>
+ <td align="left">
+ <select name="type">
+ <option>all</option>
+ <option>default</option>
+ <xsl:for-each select="/document/privileges/privilege">
+ <xsl:variable name="actionuri" select="uri/text()" />
+ <xsl:variable name="actionname"
select="substring-after($actionuri,concat($actionspath,'/'))"/>
+ <option value="{$actionuri}">
+ <xsl:value-of select="$actionname"/>
+ </option>
+ </xsl:for-each>
+ </select>
</td>
<td align="left">
- <input name="type" type="text" size="15" maxlength="40"/>
- </td>
- <td align="left">
- <input name="expiration" type="text" size="15"
maxlength="40"/>
+ <input name="expiration" type="text" size="15"
maxlength="40" value="1"/>
</td>
<td align="left">
<select name="inheritable">
1.3 +18 -12
cocoon-2.1/src/blocks/slide/samples/styles/content2html.xsl
Index: content2html.xsl
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/slide/samples/styles/content2html.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- content2html.xsl 6 Mar 2004 02:25:51 -0000 1.2
+++ content2html.xsl 17 Mar 2004 17:27:59 -0000 1.3
@@ -18,6 +18,7 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:col="http://apache.org/cocoon/collection/1.0"
xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:DAV="DAV:"
version="1.0">
<xsl:import href="layout.xsl" />
@@ -60,16 +61,27 @@
<xsl:for-each select="col:collection|col:resource">
<tr>
<td align="left">  
- <a href="[EMAIL PROTECTED]"><xsl:value-of
select="@name"/></a>
+ <xsl:choose>
+ <xsl:when test="$path != ''">
+ <a href="{$base}/{$type}/{$path}/[EMAIL PROTECTED]">
+ <xsl:value-of select="@name"/>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <a href="{$base}/{$type}/[EMAIL PROTECTED]">
+ <xsl:value-of select="@name"/>
+ </a>
+ </xsl:otherwise>
+ </xsl:choose>
</td>
<td align="left">
- <xsl:value-of select="@mime-type"/>
+ <xsl:value-of select="col:properties/DAV:getcontenttype"/>
</td>
<td align="left">
- <xsl:value-of select="@contentlength"/>
+ <xsl:value-of
select="col:properties/DAV:getcontentlength"/>
</td>
<td align="left">
- <xsl:value-of select="@date"/>
+ <xsl:value-of
select="col:properties/DAV:modificationdate"/>
</td>
<td align="right">
<form action="{$base}/delete" method="post">
@@ -107,18 +119,12 @@
</font>
</table>
</xsl:when>
- <xsl:when test="@mime-type='image/gif'">
- <img src="../view/{$path}"/>
- </xsl:when>
- <xsl:when test="@mime-type='image/jpeg'">
- <img src="../view/{$path}"/>
- </xsl:when>
- <xsl:when test="@mime-type='text/plain'">
+ <xsl:when test="col:properties/DAV:getcontenttype='text/plain'">
<pre>
<xi:include href="slide://[EMAIL PROTECTED]/{$path}" parse="text"/>
</pre>
</xsl:when>
- <xsl:when test="@mime-type='text/xml'">
+ <xsl:when test="col:properties/DAV:getcontenttype='text/xml'">
<pre>
<xi:include href="slide://[EMAIL PROTECTED]/{$path}" parse="text"/>
</pre>
1.14 +2 -1 cocoon-2.1/src/blocks/slide/samples/flow.js
Index: flow.js
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/flow.js,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- flow.js 6 Mar 2004 02:26:14 -0000 1.13
+++ flow.js 17 Mar 2004 17:27:59 -0000 1.14
@@ -189,9 +189,10 @@
var subject = cocoon.request.getParameter("subject");
var type = cocoon.request.getParameter("type");
var exclusive = cocoon.request.getParameter("exclusive");
+ var expiration = cocoon.request.getParameter("expiration");
var inheritable = cocoon.request.getParameter("inheritable");
-
AdminHelper.addLock(nat,principal,resourcePath,subject,type,exclusive,inheritable);
+
AdminHelper.addLock(nat,principal,resourcePath,subject,type,expiration,exclusive,inheritable);
cocoon.redirectTo("locks/" + resourcePath);
}
1.24 +4 -0 cocoon-2.1/src/blocks/slide/samples/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/samples/sitemap.xmap,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sitemap.xmap 11 Mar 2004 16:25:49 -0000 1.23
+++ sitemap.xmap 17 Mar 2004 17:27:59 -0000 1.24
@@ -117,6 +117,7 @@
<map:parameter name="base" value="{global:base}"/>
<map:parameter name="contextPath" value="{request:contextPath}"/>
</map:transform>
+ <map:transform type="xinclude"/>
<map:serialize type="html"/>
</map:match>
@@ -161,6 +162,9 @@
<map:match pattern="locks/**">
<map:aggregate element="document" label="content">
<map:part src="cocoon:/screens/locks/{1}" />
+ <map:part src="cocoon:/screens/privileges/{1}" />
+ <map:part src="cocoon:/screens/users/{1}" />
+ <map:part src="cocoon:/screens/roles/{1}" />
<map:part src="cocoon:/description/{1}" />
</map:aggregate>
<map:transform src="styles/locks2html.xsl">