blob: 9b3ab4f82545f7ba3f6da6c222c10288630d982d [file] [log] [blame]
<?xml version="1.0"?>
<!--
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.
-->
<!-- $Id$ -->
<page:page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1" >
<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/head.jx"/>
<page:body>
<jx:import uri="fallback://lenya/modules/sitemanagement/usecases/tab/sitetree.jx"/>
<jx:import uri="fallback://lenya/modules/usecase/templates/tabs.jx"/>
<div id="contentblock1" class="lenya-tab-sitetree">
<h1><i18n:text>Assets</i18n:text></h1>
<jx:choose>
<jx:when test="${usecase.getParameter('resourceDocuments').size() == 0}">
<i18n:text>no-assets</i18n:text>
</jx:when>
<jx:otherwise>
<table class="lenya-table-list-noborder">
<tr>
<th><i18n:text>Title</i18n:text></th>
<th><i18n:text>Preview</i18n:text></th>
<th><i18n:text>File Size</i18n:text></th>
<th><i18n:text>Dimension (w x h)</i18n:text></th>
<th><i18n:text>Creation Date</i18n:text></th>
</tr>
<jx:forEach var="doc" items="${usecase.getParameter('resourceDocuments')}">
<tr>
<jx:set var="title" value="${doc.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/>
<td>
<a href="${doc.getCanonicalWebappURL()}"><jx:out value="${title}"/></a>
</td>
<td>
<jx:set var="mimeType" value="${doc.getMimeType()}"/>
<jx:if test="${mimeType.startsWith('image/')}">
<jx:set var="extension" value="${doc.getSourceExtension()}"/>
<jx:set var="url" value="${doc.getCanonicalWebappURL()}"/>
<jx:set var="imageUrl" value="${url.replaceFirst('\.html', '\.' + extension)}"/>
<img src="${imageUrl}"
style="height: 32px; vertical-align: middle;"/>&#160;
</jx:if>
</td>
<td align="right"><jx:out value="${doc.getContentLength() / 1000}"/> kB</td>
<td align="right">
<jx:if test="${mimeType.startsWith('image/')}">
<jx:set var="mediaMeta" value="${doc.getMetaData('http://apache.org/lenya/metadata/media/1.0')}"/>
<jx:out value="${mediaMeta.getFirstValue('width')}"/> x <jx:out value="${mediaMeta.getFirstValue('height')}"/>
</jx:if>
</td>
<td align="right"><jx:out value="${java.text.DateFormat.getDateInstance().format(doc.getLastModified())}"/></td>
</tr>
</jx:forEach>
</table>
</jx:otherwise>
</jx:choose>
<jx:if test="${usecase.getParameter('document').getArea().equals('authoring')}">
<form method="GET" id="form-add_asset" style="margin-top: 20px">
<input type="hidden" name="lenya.usecase" value="resource.create"/>
<input type="hidden" name="doctype" value="resource"/>
<input type="hidden" name="lenya.exitUsecase" value="tab.assets"/>
<input type="hidden" name="lenya.exitUri" value="${usecase.getParameter('document').getCanonicalWebappURL()}"/>
<input i18n:attr="value" name="submit" type="submit" value="New Asset"/>
</form>
</jx:if>
</div>
</page:body>
</page:page>