CMIS browser update

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28473 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Florian Mü
2011-06-20 09:55:44 +00:00
parent 80ae8d10ee
commit 007bcdd6ab
7 changed files with 946 additions and 180 deletions

View File

@@ -463,7 +463,7 @@
<servlet> <servlet>
<servlet-name>CMISFileShareServlet</servlet-name> <servlet-name>CMISFileShareServlet</servlet-name>
<servlet-class>org.apache.opencmis.browser.BrowseServlet</servlet-class> <servlet-class>org.apache.chemistry.opencmis.browser.BrowseServlet</servlet-class>
<init-param> <init-param>
<param-name>auxroot</param-name> <param-name>auxroot</param-name>
<param-value>cmisfs/browser/</param-value> <param-value>cmisfs/browser/</param-value>
@@ -496,6 +496,18 @@
<param-name>stylesheet:application/cmisacl+xml</param-name> <param-name>stylesheet:application/cmisacl+xml</param-name>
<param-value>/cmisfs/stylesheets/acl.xsl</param-value> <param-value>/cmisfs/stylesheets/acl.xsl</param-value>
</init-param> </init-param>
<init-param>
<param-name>override-stylesheet:renditions</param-name>
<param-value>/cmisfs/stylesheets/renditions.xsl</param-value>
</init-param>
<init-param>
<param-name>override-stylesheet:relationships</param-name>
<param-value>/cmisfs/stylesheets/relationships.xsl</param-value>
</init-param>
<init-param>
<param-name>override-stylesheet:thumbnails</param-name>
<param-value>/cmisfs/stylesheets/thumbnails.xsl</param-value>
</init-param>
</servlet> </servlet>
<servlet> <servlet>

View File

@@ -1,3 +1,24 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
@CHARSET "UTF-8"; @CHARSET "UTF-8";
body { body {
@@ -33,7 +54,7 @@ a:hover {
} }
a:active { a:active {
color: #a40000; color: a40000;
text-decoration: underline; text-decoration: underline;
} }

View File

@@ -26,6 +26,7 @@
<xsl:param name="browseUrl"/> <xsl:param name="browseUrl"/>
<xsl:param name="auxRoot"/> <xsl:param name="auxRoot"/>
<xsl:param name="browseOverrideStylesheet"/>
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
@@ -81,11 +82,11 @@
</xsl:if> </xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='alternate']"> <xsl:if test="atom:entry/atom:link[@rel='alternate']">
<xsl:for-each select="atom:entry/atom:link[@rel='alternate']"> <xsl:for-each select="atom:entry/atom:link[@rel='alternate']">
<a href="{@href}">Rendition (<xsl:value-of select="@cmisra:renditionType"></xsl:value-of>)</a> - <a href="{@href}">Rendition (<xsl:value-of select="@cmisra:renditionKind"></xsl:value-of>)</a> -
</xsl:for-each> </xsl:for-each>
</xsl:if> </xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']"> <xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}">Relationships</a> - <a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}&amp;relationshipDirection=either{$browseOverrideStylesheet}relationships">Relationships</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']"> <xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}">Allowable Actions</a> - <a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}">Allowable Actions</a> -
@@ -108,6 +109,41 @@
</div> </div>
</xsl:if> </xsl:if>
<xsl:if test="contains(atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:relationship')">
<h2>Relationship</h2>
<table class="entrytable">
<tr>
<th>Source Id</th>
<th>Target Id</th>
</tr>
<tr>
<xsl:variable name="objectId">
<xsl:value-of select="atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:objectId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="entryUrl">
<xsl:value-of select="atom:entry/atom:link[@rel='self']/@href"></xsl:value-of>
</xsl:variable>
<xsl:variable name="sourceId">
<xsl:value-of select="atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:sourceId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="targetId">
<xsl:value-of select="atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:targetId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="sourceEntryUrl">
<xsl:value-of select="substring-before($entryUrl, $objectId)"></xsl:value-of>
<xsl:value-of select="$sourceId"></xsl:value-of>
</xsl:variable>
<xsl:variable name="targetEntryUrl">
<xsl:value-of select="substring-before($entryUrl, $objectId)"></xsl:value-of>
<xsl:value-of select="$targetId"></xsl:value-of>
</xsl:variable>
<td style="font-weight: bold;"><a href="{$browseUrl}{$sourceEntryUrl}"><xsl:value-of select="$sourceId"></xsl:value-of></a></td>
<td style="font-weight: bold;"><a href="{$browseUrl}{$targetEntryUrl}"><xsl:value-of select="$targetId"></xsl:value-of></a></td>
</tr>
</table>
</xsl:if>
<h2>Properties</h2> <h2>Properties</h2>
<table class="entrytable"> <table class="entrytable">
<xsl:for-each select="atom:entry/cmisra:object/cmis:properties/*"> <xsl:for-each select="atom:entry/cmisra:object/cmis:properties/*">

View File

@@ -17,30 +17,41 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
--> -->
<xsl:stylesheet version="1.0" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" version="1.0">
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:app="http://www.w3.org/2007/app" <xsl:output method="html"/>
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<xsl:output method="html" />
<xsl:param name="browseUrl"/> <xsl:param name="browseUrl"/>
<xsl:param name="auxRoot"/> <xsl:param name="auxRoot"/>
<xsl:param name="browseOverrideStylesheet"/>
<xsl:variable name="filter">
<xsl:text>cmis:baseTypeId,cmis:name,cmis:objectTypeId,cmis:contentStreamMimeType,cmis:contentStreamLength,cmis:createdBy,cmis:creationDate,cmis:versionLabel,cmis:isMajorVersion,cmis:lastModifiedBy,cmis:lastModificationDate,cmis:isLatestVersion</xsl:text>
</xsl:variable>
<xsl:template match="/"> <xsl:template match="/">
<html> <html>
<head> <head>
<title><xsl:value-of select="atom:feed/atom:title" /></title> <title>
<link rel="stylesheet" type="text/css" href="{$auxRoot}browser.css" /> <xsl:value-of select="atom:feed/atom:title"/>
</title>
<link rel="stylesheet" type="text/css" href="{$auxRoot}browser.css"/>
</head> </head>
<body> <body>
<img src="{$auxRoot}cmis.png" style="float: right;" /> <img src="{$auxRoot}cmis.png" style="float: right;"/>
<h1><xsl:value-of select="atom:feed/atom:title" /></h1> <h1>
<xsl:value-of select="atom:feed/atom:title"/>
</h1>
<div class="navigationbox"> <div class="navigationbox">
<form name="urlform">
<input type="text" name="url" value="" size="100"/>
<input type="hidden" name="browseUrl" value="{$browseUrl}"/>
<input type="button" value="Go" onClick="load()"/>
<input type="button" value="Atom" onClick="loadAtom()"/>
</form>
<script type="text/javascript"> var x = window.location.search.indexOf("="); if(x > -1) { document.forms.urlform.url.value = decodeURI(window.location.search.substring(x+1)); } function load() { window.location.href = document.forms.urlform.browseUrl.value + document.forms.urlform.url.value; } function loadAtom() { window.location.href = document.forms.urlform.url.value; }</script>
<xsl:if test="atom:feed/atom:link[@rel='service']"> <xsl:if test="atom:feed/atom:link[@rel='service']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='service']/@href}">Service</a> - <a href="{$browseUrl}{atom:feed/atom:link[@rel='service']/@href}">Service</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='seld']"> <xsl:if test="atom:feed/atom:link[@rel='self']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='self']/@href}">Entry</a> - <a href="{$browseUrl}{atom:feed/atom:link[@rel='self']/@href}">Entry</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='up']"> <xsl:if test="atom:feed/atom:link[@rel='up']">
@@ -48,7 +59,7 @@
</xsl:if> </xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='down']"> <xsl:if test="atom:feed/atom:link[@rel='down']">
<xsl:for-each select="atom:feed/atom:link[@rel='down']"> <xsl:for-each select="atom:feed/atom:link[@rel='down']">
<a href="{$browseUrl}{@href}">Down (<xsl:value-of select="@type" />)</a> - <a href="{$browseUrl}{@href}">Down (<xsl:value-of select="@type"/>)</a> -
</xsl:for-each> </xsl:for-each>
</xsl:if> </xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='first']"> <xsl:if test="atom:feed/atom:link[@rel='first']">
@@ -76,28 +87,59 @@
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']/@href}">Policies</a> - <a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']/@href}">Policies</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='describedby']"> <xsl:if test="atom:feed/atom:link[@rel='describedby']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='describedby']/@href}">Type</a> <a href="{$browseUrl}{atom:feed/atom:link[@rel='describedby']/@href}"> Type</a>
</xsl:if> </xsl:if>
</div> </div>
<xsl:if test="atom:feed/atom:entry/cmisra:object"> <xsl:if test="atom:feed/atom:entry/cmisra:object">
<table class="feedtable"> <table class="feedtable">
<tr> <tr>
<th></th> <th/>
<th>Name</th> <th>Name</th>
<th>Type</th> <th>Type</th>
<th>MIME Type</th> <th>MIME Type</th>
<th>Size</th> <th>Size</th>
<th>Created By /<br/> Last Modified By</th> <th>Created By /<br/>Last Modified By</th>
<th>Creation Date /<br/> Last Modification Date</th> <th>Creation Date /<br/>Last Modification Date</th>
<th>Version Label</th> <th>Version Label</th>
<th>Major /<br/> Latest</th> <th>Major /<br/> Latest</th>
</tr> </tr>
<xsl:for-each select="atom:feed/atom:entry"> <xsl:for-each select="atom:feed/atom:entry">
<xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId']" /> <xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId']"/>
<xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:name']" /> <xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:name']"/>
<xsl:call-template name="object">
<xsl:with-param name="depth"> 0</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</table>
</xsl:if>
<xsl:if test="atom:feed/atom:entry/cmisra:type">
<table class="feedtable">
<tr>
<th/>
<th>Id</th>
<th>Local Name</th>
<th>Local Namespace</th>
<th>Display Name</th>
<th>Query Name</th>
<th>Base Id</th>
<th>Description</th>
</tr>
<xsl:for-each select="atom:feed/atom:entry">
<xsl:call-template name="type">
<xsl:with-param name="depth"> 0</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:template name="object">
<xsl:param name="depth"/>
<xsl:variable name="odd"> <xsl:variable name="odd">
<xsl:if test="(position() mod 2) != 1"></xsl:if> <xsl:if test="(position() mod 2) != 1"/>
<xsl:if test="(position() mod 2) = 1">-odd</xsl:if> <xsl:if test="(position() mod 2) = 1">-odd</xsl:if>
</xsl:variable> </xsl:variable>
@@ -105,60 +147,78 @@
<td class="tdlinks{$odd}" rowspan="2"> <td class="tdlinks{$odd}" rowspan="2">
<xsl:choose> <xsl:choose>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<img src="{$auxRoot}document.png" /> <img src="{$auxRoot}document.png"/>
</xsl:when> </xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<img src="{$auxRoot}folder.png" /> <img src="{$auxRoot}folder.png"/>
</xsl:when> </xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:relationship')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:relationship')">
<img src="{$auxRoot}relationship.png" /> <img src="{$auxRoot}relationship.png"/>
</xsl:when> </xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:policy')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:policy')">
<img src="{$auxRoot}policy.png" /> <img src="{$auxRoot}policy.png"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<img src="{$auxRoot}unknown.png" /> <img src="{$auxRoot}unknown.png"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</td> </td>
<td class="tdinfo{$odd}" style="font-weight: bold;"> <td class="tdinfo{$odd}" style="font-weight: bold;">
<xsl:if test="$depth &gt; 0">
<xsl:value-of select="substring('********************', 1, $depth)"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<a href="{atom:content/@src}"> <a href="{atom:content/@src}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" /> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']"/>
</a> </a>
</xsl:when> </xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')"> <xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<a href="{$browseUrl}{atom:link[@rel='down']/@href}"> <a href="{$browseUrl}{atom:link[@rel='down']/@href}&amp;filter={$filter}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" /> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']"/>
</a> </a>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<a href="{$browseUrl}{atom:link[@rel='self']/@href}"> <a href="{$browseUrl}{atom:link[@rel='self']/@href}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" /> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']"/>
</a> </a>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</td> </td>
<td class="tdinfo{$odd}"> <td class="tdinfo{$odd}">
<a href="{$browseUrl}{atom:link[@rel='describedby']/@href}"> <a href="{$browseUrl}{atom:link[@rel='describedby']/@href}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:objectTypeId']" /> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:objectTypeId']"/>
</a> </a>
</td> </td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:contentStreamMimeType']" /></td> <td class="tdinfo{$odd}">
<td class="tdinfo{$odd}" align="right"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyInteger[@propertyDefinitionId='cmis:contentStreamLength']" /></td> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:contentStreamMimeType']"/>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:createdBy']" /></td> </td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:creationDate']" /></td> <td class="tdinfo{$odd}" align="right">
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:versionLabel']" /></td> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyInteger[@propertyDefinitionId='cmis:contentStreamLength']"/>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyBoolean[@propertyDefinitionId='cmis:isMajorVersion']" /></td> </td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:createdBy']"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:creationDate']"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:versionLabel']"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyBoolean[@propertyDefinitionId='cmis:isMajorVersion']"/>
</td>
</tr> </tr>
<tr> <tr>
<td class="tdlinks{$odd}" colspan="4"> <td class="tdlinks{$odd}" colspan="4">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}" class="actionlink">Entry</a> - <a href="{$browseUrl}{atom:link[@rel='self']/@href}" class="actionlink">Entry</a> -
<xsl:if test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}&amp;renditionFilter=*{$browseOverrideStylesheet}renditions" class="actionlink">Renditions</a> -
</xsl:if>
<a href="{$browseUrl}{atom:link[@rel='describedby']/@href}" class="actionlink">Type Info</a> - <a href="{$browseUrl}{atom:link[@rel='describedby']/@href}" class="actionlink">Type Info</a> -
<xsl:if test="atom:link[@rel='down']"> <xsl:if test="atom:link[@rel='down']">
<xsl:for-each select="atom:link[@rel='down']"> <xsl:for-each select="atom:link[@rel='down']">
<a href="{$browseUrl}{@href}" class="actionlink">Down (<xsl:value-of select="@type" />)</a> - <a href="{$browseUrl}{@href}" class="actionlink">Down (<xsl:value-of select="@type"/>)</a> -
</xsl:for-each> </xsl:for-each>
</xsl:if> </xsl:if>
<xsl:if test="atom:content"> <xsl:if test="atom:content">
@@ -169,61 +229,81 @@
</xsl:if> </xsl:if>
<xsl:if test="atom:link[@rel='alternate']"> <xsl:if test="atom:link[@rel='alternate']">
<xsl:for-each select="atom:link[@rel='alternate']"> <xsl:for-each select="atom:link[@rel='alternate']">
<a href="{@href}" class="actionlink">Rendition (<xsl:value-of select="@cmisra:renditionType"></xsl:value-of>)</a> - <a href="{@href}" class="actionlink">Rendition (<xsl:value-of select="@cmisra:renditionKind"/>)</a> -
</xsl:for-each> </xsl:for-each>
</xsl:if> </xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']"> <xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}">Relationships</a> - <a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}&amp;relationshipDirection=either{$browseOverrideStylesheet}relationships" class="actionlink">Relationships</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']"> <xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}" class="actionlink">Allowable Actions</a> - <a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}" class="actionlink">Allowable Actions</a> -
</xsl:if> </xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']"> <xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}" class="actionlink">ACL</a> <a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}" class="actionlink">ACL</a> -
</xsl:if>
<xsl:if test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<a href="{$browseUrl}{atom:link[@rel='down']/@href}&amp;filter={$filter}&amp;renditionFilter=cmis:thumbnail{$browseOverrideStylesheet}thumbnails" class="actionlink">Thumbnails</a>
</xsl:if> </xsl:if>
</td> </td>
<td class="tdinfo2{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:lastModifiedBy']" /></td> <td class="tdinfo2{$odd}">
<td class="tdinfo2{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:lastModificationDate']" /></td> <xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:lastModifiedBy']"/>
<td class="tdinfo2{$odd}"> </td> </td>
<td class="tdinfo2{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyBoolean[@propertyDefinitionId='cmis:isLatestVersion']" /></td> <td class="tdinfo2{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:lastModificationDate']"/>
</td>
<td class="tdinfo2{$odd}"/>
<td class="tdinfo2{$odd}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyBoolean[@propertyDefinitionId='cmis:isLatestVersion']"/>
</td>
</tr> </tr>
</xsl:for-each>
</table>
</xsl:if>
<xsl:if test="atom:feed/atom:entry/cmisra:type">
<table class="feedtable"> <xsl:for-each select="cmisra:children/atom:feed/atom:entry">
<tr> <xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId']"/>
<th></th> <xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:name']"/>
<th>Id</th> <xsl:call-template name="object">
<th>Local Name</th> <xsl:with-param name="depth" select="$depth + 1"/>
<th>Local Namespace</th> </xsl:call-template>
<th>Display Name</th> </xsl:for-each>
<th>Query Name</th> </xsl:template>
<th>Base Id</th>
<th>Description</th> <xsl:template name="type">
</tr> <xsl:param name="depth"/>
<xsl:for-each select="atom:feed/atom:entry">
<xsl:variable name="odd"> <xsl:variable name="odd">
<xsl:if test="(position() mod 2) != 1"></xsl:if> <xsl:if test="(position() mod 2) != 1"/>
<xsl:if test="(position() mod 2) = 1">-odd</xsl:if> <xsl:if test="(position() mod 2) = 1">-odd</xsl:if>
</xsl:variable> </xsl:variable>
<tr> <tr>
<td class="tdlinks{$odd}" rowspan="2"> <td class="tdlinks{$odd}" rowspan="2">
<img src="{$auxRoot}type.png" /> <img src="{$auxRoot}type.png"/>
</td> </td>
<td class="tdinfo{$odd}"> <td class="tdinfo{$odd}">
<xsl:if test="$depth &gt; 0">
<xsl:value-of select="substring('********************', 1, $depth)"/><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
</xsl:if>
<a href="{$browseUrl}{atom:link[@rel='self']/@href}" style="font-weight: bold;"> <a href="{$browseUrl}{atom:link[@rel='self']/@href}" style="font-weight: bold;">
<xsl:value-of select="cmisra:type/cmis:id" /> <xsl:value-of select="cmisra:type/cmis:id"/>
</a> </a>
</td> </td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:localName" /></td> <td class="tdinfo{$odd}">
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:localNamespace" /></td> <xsl:value-of select="cmisra:type/cmis:localName"/>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:displayName" /></td> </td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:queryName" /></td> <td class="tdinfo{$odd}">
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:baseId" /></td> <xsl:value-of select="cmisra:type/cmis:localNamespace"/>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:description" /></td> </td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:type/cmis:displayName"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:type/cmis:queryName"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:type/cmis:baseId"/>
</td>
<td class="tdinfo{$odd}">
<xsl:value-of select="cmisra:type/cmis:description"/>
</td>
</tr> </tr>
<tr> <tr>
<td class="tdlinks{$odd}" colspan="7"> <td class="tdlinks{$odd}" colspan="7">
@@ -234,11 +314,12 @@
</xsl:if> </xsl:if>
</td> </td>
</tr> </tr>
</xsl:for-each>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:for-each select="cmisra:children/atom:feed/atom:entry">
<xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:name']"/>
<xsl:call-template name="type">
<xsl:with-param name="depth" select="$depth + 1"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@@ -0,0 +1,280 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<xsl:output method="html" />
<xsl:param name="browseUrl"/>
<xsl:param name="auxRoot"/>
<xsl:param name="browseOverrideStylesheet"/>
<xsl:variable name="filter">
<xsl:text>cmis:baseTypeId,cmis:name,cmis:objectTypeId,cmis:contentStreamMimeType,cmis:contentStreamLength,cmis:createdBy,cmis:creationDate,cmis:versionLabel,cmis:isMajorVersion,cmis:lastModifiedBy,cmis:lastModificationDate,cmis:isLatestVersion</xsl:text>
</xsl:variable>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="atom:feed/atom:title" /></title>
<link rel="stylesheet" type="text/css" href="{$auxRoot}browser.css" />
</head>
<body>
<img src="{$auxRoot}cmis.png" style="float: right;" />
<h1><xsl:value-of select="atom:feed/atom:title" /></h1>
<div class="navigationbox">
<form name="urlform">
<input type="text" name="url" value="" size="100"/>
<input type="hidden" name="browseUrl" value="{$browseUrl}" />
<input type="button" value="Go" onClick="load()" />
<input type="button" value="Atom" onClick="loadAtom()" />
</form>
<script type="text/javascript">
var x = window.location.search.indexOf("=");
if(x > -1) {
document.forms.urlform.url.value = decodeURI(window.location.search.substring(x+1));
}
function load() { window.location.href = document.forms.urlform.browseUrl.value + document.forms.urlform.url.value; }
function loadAtom() { window.location.href = document.forms.urlform.url.value; }
</script>
<xsl:if test="atom:feed/atom:link[@rel='service']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='service']/@href}">Service</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='self']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='self']/@href}">Entry</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='up']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='up']/@href}">Up</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='down']">
<xsl:for-each select="atom:feed/atom:link[@rel='down']">
<a href="{$browseUrl}{@href}">Down (<xsl:value-of select="@type" />)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='first']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='first']/@href}">First</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='previous']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='previous']/@href}">Previous</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='next']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='next']/@href}">Next</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='last']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='last']/@href}">Last</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']/@href}">Folder Tree</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}">Allowable Actions</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}">ACL</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']/@href}">Policies</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='describedby']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='describedby']/@href}">Type</a>
</xsl:if>
</div>
<xsl:if test="atom:feed/atom:entry/cmisra:object">
<h2>Relationships</h2>
<table class="feedtable">
<tr>
<th></th>
<th>Name</th>
<th>Type</th>
<th>Source</th>
<th>Target</th>
<th>Creation Date /<br/> Last Modification Date</th>
</tr>
<xsl:for-each select="atom:feed/atom:entry">
<xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId']" />
<xsl:sort select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:name']" />
<xsl:variable name="odd">
<xsl:if test="(position() mod 2) != 1"></xsl:if>
<xsl:if test="(position() mod 2) = 1">-odd</xsl:if>
</xsl:variable>
<tr>
<td class="tdlinks{$odd}" rowspan="2">
<xsl:choose>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<img src="{$auxRoot}document.png" />
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<img src="{$auxRoot}folder.png" />
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:relationship')">
<img src="{$auxRoot}relationship.png" />
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:policy')">
<img src="{$auxRoot}policy.png" />
</xsl:when>
<xsl:otherwise>
<img src="{$auxRoot}unknown.png" />
</xsl:otherwise>
</xsl:choose>
</td>
<td class="tdinfo{$odd}" style="font-weight: bold;">
<xsl:choose>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<a href="{atom:content/@src}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" />
</a>
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<a href="{$browseUrl}{atom:link[@rel='down']/@href}&amp;filter={$filter}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" />
</a>
</xsl:when>
<xsl:otherwise>
<a href="{$browseUrl}{atom:link[@rel='self']/@href}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" />
</a>
</xsl:otherwise>
</xsl:choose>
</td>
<td class="tdinfo{$odd}">
<a href="{$browseUrl}{atom:link[@rel='describedby']/@href}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:objectTypeId']" />
</a>
</td>
<xsl:variable name="objectId">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:objectId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="entryUrl">
<xsl:value-of select="atom:link[@rel='self']/@href"></xsl:value-of>
</xsl:variable>
<xsl:variable name="sourceId">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:sourceId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="targetId">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:targetId']/cmis:value"></xsl:value-of>
</xsl:variable>
<xsl:variable name="sourceEntryUrl">
<xsl:value-of select="substring-before($entryUrl, $objectId)"></xsl:value-of>
<xsl:value-of select="$sourceId"></xsl:value-of>
</xsl:variable>
<xsl:variable name="targetEntryUrl">
<xsl:value-of select="substring-before($entryUrl, $objectId)"></xsl:value-of>
<xsl:value-of select="$targetId"></xsl:value-of>
</xsl:variable>
<td class="tdinfo{$odd}"><a href="{$browseUrl}{$sourceEntryUrl}"><xsl:value-of select="$sourceId"></xsl:value-of></a></td>
<td class="tdinfo{$odd}"><a href="{$browseUrl}{$targetEntryUrl}"><xsl:value-of select="$targetId"></xsl:value-of></a></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:creationDate']" /></td>
</tr>
<tr>
<td class="tdlinks{$odd}" colspan="4">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}" class="actionlink">Entry</a> -
<xsl:if test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}&amp;renditionFilter=*{$browseOverrideStylesheet}renditions" class="actionlink">Renditions</a> -
</xsl:if>
<a href="{$browseUrl}{atom:link[@rel='describedby']/@href}" class="actionlink">Type Info</a> -
<xsl:if test="atom:link[@rel='down']">
<xsl:for-each select="atom:link[@rel='down']">
<a href="{$browseUrl}{@href}" class="actionlink">Down (<xsl:value-of select="@type" />)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:content">
<a href="{atom:content/@src}" class="actionlink">Download</a> -
</xsl:if>
<xsl:if test="atom:link[@rel='version-history']">
<a href="{$browseUrl}{atom:link[@rel='version-history']/@href}" class="actionlink">All Versions</a> -
</xsl:if>
<xsl:if test="atom:link[@rel='alternate']">
<xsl:for-each select="atom:link[@rel='alternate']">
<a href="{@href}" class="actionlink">Rendition (<xsl:value-of select="@cmisra:renditionKind"></xsl:value-of>)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}{$browseOverrideStylesheet}relationships">Relationships</a> -
</xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}" class="actionlink">Allowable Actions</a> -
</xsl:if>
<xsl:if test="atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']">
<a href="{$browseUrl}{atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}" class="actionlink">ACL</a>
</xsl:if>
</td>
<td class="tdinfo2{$odd}"><xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyDateTime[@propertyDefinitionId='cmis:lastModificationDate']" /></td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
<xsl:if test="atom:feed/atom:entry/cmisra:type">
<table class="feedtable">
<tr>
<th></th>
<th>Id</th>
<th>Local Name</th>
<th>Local Namespace</th>
<th>Display Name</th>
<th>Query Name</th>
<th>Base Id</th>
<th>Description</th>
</tr>
<xsl:for-each select="atom:feed/atom:entry">
<xsl:variable name="odd">
<xsl:if test="(position() mod 2) != 1"></xsl:if>
<xsl:if test="(position() mod 2) = 1">-odd</xsl:if>
</xsl:variable>
<tr>
<td class="tdlinks{$odd}" rowspan="2">
<img src="{$auxRoot}type.png" />
</td>
<td class="tdinfo{$odd}">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}" style="font-weight: bold;">
<xsl:value-of select="cmisra:type/cmis:id" />
</a>
</td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:localName" /></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:localNamespace" /></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:displayName" /></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:queryName" /></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:baseId" /></td>
<td class="tdinfo{$odd}"><xsl:value-of select="cmisra:type/cmis:description" /></td>
</tr>
<tr>
<td class="tdlinks{$odd}" colspan="7">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}" class="actionlink">Entry</a> -
<a href="{$browseUrl}{atom:link[@rel='describedby']/@href}" class="actionlink">Type Info</a> -
<xsl:if test="atom:link[@rel='down']">
<a href="{$browseUrl}{atom:link[@rel='down']/@href}" class="actionlink">Down</a>
</xsl:if>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<xsl:output method="html" />
<xsl:param name="browseUrl"/>
<xsl:param name="auxRoot"/>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="atom:entry/atom:title" /></title>
<link rel="stylesheet" type="text/css" href="{$auxRoot}browser.css" />
</head>
<body>
<img src="{$auxRoot}cmis.png" style="float: right;" />
<h1>
<xsl:choose>
<xsl:when test="contains(atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<img src="{$auxRoot}document.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:when>
<xsl:when test="contains(atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<img src="{$auxRoot}folder.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:when>
<xsl:when test="contains(atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:relationship')">
<img src="{$auxRoot}relationship.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:when>
<xsl:when test="contains(atom:entry/cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:policy')">
<img src="{$auxRoot}policy.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:when>
<xsl:when test="atom:entry/cmisra:type">
<img src="{$auxRoot}type.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:when>
<xsl:otherwise>
<img src="{$auxRoot}unknown.png" style="vertical-align:middle; padding-right: 10px;" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="atom:entry/atom:title" /></h1>
<div class="navigationbox">
<xsl:if test="atom:entry/atom:link[@rel='service']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='service']/@href}">Service</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='up']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='up']/@href}">Up</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='down']">
<xsl:for-each select="atom:entry/atom:link[@rel='down']">
<a href="{$browseUrl}{@href}">Down (<xsl:value-of select="@type" />)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']/@href}">Folder Tree</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:content">
<a href="{atom:entry/atom:content/@src}">Download</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='version-history']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='version-history']/@href}">All Versions</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='alternate']">
<xsl:for-each select="atom:entry/atom:link[@rel='alternate']">
<a href="{@href}">Rendition (<xsl:value-of select="@cmisra:renditionKind"></xsl:value-of>)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/relationships']/@href}">Relationships</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}">Allowable Actions</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}">ACL</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']/@href}">Policies</a> -
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='describedby']">
<a href="{$browseUrl}{atom:entry/atom:link[@rel='describedby']/@href}">Type</a>
</xsl:if>
</div>
<xsl:if test="atom:entry/atom:summary">
<h2>Summary</h2>
<div class="entrysummary">
<xsl:value-of select="atom:entry/atom:summary" disable-output-escaping="yes"/>
</div>
</xsl:if>
<xsl:if test="atom:entry/atom:link[@rel='alternate']">
<h2>Renditions</h2>
<table>
<tr>
<td>
<xsl:if test="atom:entry/atom:link[@rel='alternate' and @cmisra:renditionKind='cmis:thumbnail']">
<img src="{atom:entry/atom:link[@rel='alternate' and @cmisra:renditionKind='cmis:thumbnail']/@href}" />
</xsl:if>
</td>
<td>
<table class="entrytable">
<tr>
<th>Kind</th>
<th>MIME Type</th>
<th>Size</th>
<th>Height</th>
<th>Width</th>
</tr>
<xsl:for-each select="atom:entry/cmisra:object/cmis:rendition">
<xsl:variable name="odd">
<xsl:if test="(position() mod 2) != 1"></xsl:if>
<xsl:if test="(position() mod 2) = 1">-odd</xsl:if>
</xsl:variable>
<xsl:variable name="renditionKind">
<xsl:value-of select="cmis:kind"></xsl:value-of>
</xsl:variable>
<xsl:variable name="renditionURL">
<xsl:for-each select="//atom:entry/atom:link[@rel='alternate']">
<xsl:if test="@cmisra:renditionKind = $renditionKind">
<xsl:value-of select="@href"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<tr>
<td class="tdlinks{$odd}"><a href="{$renditionURL}"><xsl:value-of select="$renditionKind"></xsl:value-of></a></td>
<td class="tdlinks{$odd}"><xsl:value-of select="cmis:mimetype"></xsl:value-of></td>
<td class="tdlinks{$odd}"><xsl:value-of select="cmis:length"></xsl:value-of></td>
<td class="tdlinks{$odd}"><xsl:value-of select="cmis:height"></xsl:value-of></td>
<td class="tdlinks{$odd}"><xsl:value-of select="cmis:width"></xsl:value-of></td>
</tr>
</xsl:for-each>
</table>
</td>
</tr>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/"
xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<xsl:output method="html" />
<xsl:param name="browseUrl"/>
<xsl:param name="auxRoot"/>
<xsl:param name="browseOverrideStylesheet"/>
<xsl:variable name="filter">
<xsl:text>cmis:baseTypeId,cmis:name,cmis:objectTypeId,cmis:contentStreamMimeType,cmis:contentStreamLength,cmis:createdBy,cmis:creationDate,cmis:versionLabel,cmis:isMajorVersion,cmis:lastModifiedBy,cmis:lastModificationDate,cmis:isLatestVersion</xsl:text>
</xsl:variable>
<xsl:template match="*">
<xsl:variable name="width">
<xsl:value-of select="cmisra:object/cmis:rendition/cmis:kind[text() = 'cmis:thumbnail']/../cmis:width"></xsl:value-of>
</xsl:variable>
<xsl:variable name="height">
<xsl:value-of select="cmisra:object/cmis:rendition/cmis:kind[text() = 'cmis:thumbnail']/../cmis:height"></xsl:value-of>
</xsl:variable>
<table class="feedtable">
<tr>
<td class="tdthumb">
<xsl:choose>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:document')">
<a href="{atom:content/@src}">
<xsl:choose>
<xsl:when test="atom:link[@rel='alternate' and @cmisra:renditionKind='cmis:thumbnail']/@href">
<img src="{atom:link[@rel='alternate' and @cmisra:renditionKind='cmis:thumbnail']/@href}" width="{$width}px" height="{$height}px"/>
</xsl:when>
<xsl:otherwise>
<img src="{$auxRoot}unknown.png"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:folder')">
<a href="{$browseUrl}{atom:link[@rel='down']/@href}&amp;filter={$filter}">
<img src="{$auxRoot}folder.png"/>
</a>
</xsl:when>
<xsl:when test="contains(cmisra:object/cmis:properties/cmis:propertyId[@propertyDefinitionId='cmis:baseTypeId'],'cmis:policy')">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}">
<img src="{$auxRoot}policy.png"/>
</a>
</xsl:when>
<xsl:otherwise>
<a href="{$browseUrl}{atom:link[@rel='self']/@href}">
<img src="{$auxRoot}unknown.png"/>
</a>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr>
<td class="tdthumbId">
<a href="{$browseUrl}{atom:link[@rel='self']/@href}">
<xsl:value-of select="cmisra:object/cmis:properties/cmis:propertyString[@propertyDefinitionId='cmis:name']" />
</a>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="atom:feed/atom:title" /></title>
<link rel="stylesheet" type="text/css" href="{$auxRoot}browser.css" />
</head>
<body>
<img src="{$auxRoot}cmis.png" style="float: right;" />
<h1><xsl:value-of select="atom:feed/atom:title" /></h1>
<div class="navigationbox">
<form name="urlform">
<input type="text" name="url" value="" size="100"/>
<input type="hidden" name="browseUrl" value="{$browseUrl}" />
<input type="button" value="Go" onClick="load()" />
<input type="button" value="Atom" onClick="loadAtom()" />
</form>
<script type="text/javascript">
var x = window.location.search.indexOf("=");
if(x > -1) {
document.forms.urlform.url.value = decodeURI(window.location.search.substring(x+1));
}
function load() { window.location.href = document.forms.urlform.browseUrl.value + document.forms.urlform.url.value; }
function loadAtom() { window.location.href = document.forms.urlform.url.value; }
</script>
<xsl:if test="atom:feed/atom:link[@rel='service']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='service']/@href}">Service</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='self']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='self']/@href}">Entry</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='up']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='up']/@href}">Up</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='down']">
<xsl:for-each select="atom:feed/atom:link[@rel='down']">
<a href="{$browseUrl}{@href}">Down (<xsl:value-of select="@type" />)</a> -
</xsl:for-each>
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='first']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='first']/@href}{$browseOverrideStylesheet}thumbnails">First</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='previous']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='previous']/@href}{$browseOverrideStylesheet}thumbnails">Previous</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='next']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='next']/@href}{$browseOverrideStylesheet}thumbnails">Next</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='last']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='last']/@href}{$browseOverrideStylesheet}thumbnails">Last</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/foldertree']/@href}">Folder Tree</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/allowableactions']/@href}">Allowable Actions</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/acl']/@href}">ACL</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='http://docs.oasis-open.org/ns/cmis/link/200908/policies']/@href}">Policies</a> -
</xsl:if>
<xsl:if test="atom:feed/atom:link[@rel='describedby']">
<a href="{$browseUrl}{atom:feed/atom:link[@rel='describedby']/@href}">Type</a>
</xsl:if>
</div>
<xsl:if test="atom:feed/atom:entry/cmisra:object">
<table>
<tr>
<td valign="top">
<xsl:apply-templates select="atom:feed/atom:entry[position() mod 3 = 1]"/>
</td>
<td valign="top">
<xsl:apply-templates select="atom:feed/atom:entry[position() mod 3 = 2]"/>
</td>
<td valign="top">
<xsl:apply-templates select="atom:feed/atom:entry[position() mod 3 = 0]"/>
</td>
</tr>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:stylesheet>