| <!--! |
| 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. |
| --> |
| |
| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" |
| xmlns:py="http://genshi.edgewall.org/" |
| xmlns:xi="http://www.w3.org/2001/XInclude" |
| xmlns:i18n="http://genshi.edgewall.org/i18n" |
| py:with="parent = attachments.parent if attachments else attachment.resource.parent"> |
| <xi:include href="layout.html" /> |
| <head> |
| <title py:choose="mode"> |
| <py:when test="'new'">${name_of(parent)} – Attachment</py:when> |
| <py:when test="'list'">${name_of(parent)} – Attachments</py:when> |
| <py:otherwise><i18n:msg params="filename, parent">${attachment.filename} on ${name_of(parent)} – Attachment</i18n:msg></py:otherwise> |
| </title> |
| <py:if test="preview"> |
| <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script> |
| <script type="text/javascript"> |
| jQuery(document).ready(function($) { |
| $('#preview table.code').enableCollapsibleColumns($('#preview table.code thead th.content')); |
| }); |
| </script> |
| </py:if> |
| </head> |
| |
| <body> |
| <div py:choose="mode" id="content" class="attachment row"> |
| <py:when test="'new'"> |
| <h1 i18n:msg="parent" class="span12"> |
| Add Attachment to <a href="${url_of(parent)}">${name_of(parent)}</a> |
| </h1> |
| <div class="span12"> |
| <form id="attachment" method="post" enctype="multipart/form-data" action=""> |
| <label>File<py:if test="max_size >= 0"> |
| <i18n:msg params="value"> |
| (size limit ${pretty_size(max_size)})</i18n:msg></py:if>: |
| <br /> |
| <input type="file" name="attachment" /> |
| </label> |
| <div class="well"> |
| <fieldset> |
| <legend>Attachment Info</legend> |
| <py:if test="authname == 'anonymous'"> |
| <label>Your email or username:</label> |
| <input type="text" class="input-xlarge" name="author" |
| value="${attachment.author or author}" /> |
| <br /> |
| </py:if> |
| <label>Description of the file:</label> |
| <input type="text" name="description" class="input-xlarge" |
| placeholder="optional" value="$attachment.description" /> |
| <br /> |
| <label py:if="authname and authname != 'anonymous'" |
| class="checkbox"> |
| <input type="checkbox" name="replace" |
| checked="${is_replace or None}" /> |
| Replace existing attachment of the same name |
| </label> |
| </fieldset> |
| </div> |
| <div class="control-group"> |
| <input type="hidden" name="action" value="new" /> |
| <input type="hidden" name="realm" value="$parent.realm" /> |
| <input type="hidden" name="id" value="$parent.id" /> |
| <input class="btn" type="submit" |
| value="${_('Add attachment')}" /> |
| <input class="btn-link" type="submit" name="cancel" |
| value="${_('Cancel')}" /> |
| </div> |
| </form> |
| </div> |
| </py:when> |
| |
| <py:when test="'delete'"> |
| <div class="span12"> |
| <h1><a href="${url_of(parent)}">${name_of(parent)}</a>: $attachment.filename</h1> |
| <p class="alert alert-error"> |
| <span class="label label-important">Caution</span> |
| <strong>Are you sure you want to delete this attachment?</strong><br /> |
| This is an irreversible operation. |
| </p> |
| <div class="control-group"> |
| <form method="post" action=""> |
| <div id="delete"> |
| <input type="hidden" name="action" value="delete" /> |
| <input class="btn" type="submit" |
| value="${_('Delete attachment')}" /> |
| <input class="btn-link" type="submit" name="cancel" |
| value="${_('Cancel')}" /> |
| </div> |
| </form> |
| </div> |
| </div> |
| </py:when> |
| |
| <py:when test="'list'"> |
| <h1 class="span12"><a href="${url_of(parent)}">${name_of(parent)}</a></h1> |
| <div class="span12"> |
| <py:with vars="context = context.child(parent)"> |
| <?python add_button_title = _('Attach another file') ?> |
| <xi:include href="bh_list_of_attachments.html" py:with="alist = attachments"/> |
| </py:with> |
| </div> |
| </py:when> |
| |
| <py:otherwise> <!--! 'render' mode --> |
| <h1 class="span12"> |
| <a href="${url_of(parent)}">${name_of(parent)}</a>: |
| $attachment.filename |
| </h1> |
| <table id="info" class="span12" summary="Description"> |
| <tbody> |
| <tr> |
| <th scope="col" i18n:msg="file,size,author,date"> |
| File $attachment.filename, |
| <span title="${_('%(size)s bytes', size=attachment.size)}"> |
| ${pretty_size(attachment.size)} |
| </span> |
| (added by ${authorinfo(attachment.author)}, |
| ${pretty_dateinfo(attachment.date)}) |
| </th> |
| </tr> |
| <tr> |
| <td class="message searchable" xml:space="preserve"> |
| ${wiki_to_html(context.child(parent), attachment.description)} |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| |
| <div py:if="preview" id="preview" class="searchable span12"> |
| <xi:include href="bh_preview_file.html" py:with="preview = preview"/> |
| </div> |
| |
| <py:if test="attachment and 'ATTACHMENT_DELETE' in perm(attachment.resource)"> |
| <div class="span12"> |
| <form method="get" action=""> |
| <div id="delete control-group"> |
| <input type="hidden" name="action" value="delete" /> |
| <input type="submit" class="btn" |
| value="${_('Delete attachment')}" /> |
| </div> |
| </form> |
| </div> |
| </py:if> |
| </py:otherwise> |
| |
| </div> |
| </body> |
| </html> |