Add files upload

This commit is contained in:
Frédéric Guillot
2014-05-22 20:58:21 -04:00
parent 2230dd4e6b
commit 40917992e7
25 changed files with 549 additions and 53 deletions

View File

@@ -59,7 +59,7 @@
</div>
<?php endif ?>
<?php if (! empty($task['date_due']) || ! empty($task['nb_comments']) || ! empty($task['description'])): ?>
<?php if (! empty($task['date_due']) || ! empty($task['nb_files']) || ! empty($task['nb_comments']) || ! empty($task['description'])): ?>
<div class="task-footer">
<?php if (! empty($task['date_due'])): ?>
@@ -69,6 +69,10 @@
<?php endif ?>
<div class="task-icons">
<?php if (! empty($task['nb_files'])): ?>
<?= $task['nb_files'] ?> <i class="fa fa-paperclip"></i>
<?php endif ?>
<?php if (! empty($task['nb_comments'])): ?>
<?= $task['nb_comments'] ?> <i class="fa fa-comment-o" title="<?= p($task['nb_comments'], t('%d comment', $task['nb_comments']), t('%d comments', $task['nb_comments'])) ?>"></i>
<?php endif ?>

View File

@@ -1,3 +1,7 @@
<div class="page-header">
<h2><?= t('Close a task') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to close this task: "%s"?', Helper\escape($task['title'])) ?>

View File

@@ -13,4 +13,5 @@
<?= $task_content_for_layout ?>
</div>
</section>
</section>
</section>
<script type="text/javascript" src="assets/js/task.js"></script>

View File

@@ -1,16 +1,14 @@
<section id="main">
<div class="page-header">
<h2><?= t('Open a task') ?></h2>
</div>
<div class="page-header">
<h2><?= t('Open a task') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to open this task: "%s"?', Helper\escape($task['title'])) ?>
</p>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to open this task: "%s"?', Helper\escape($task['title'])) ?>
</p>
<div class="form-actions">
<a href="?controller=task&amp;action=open&amp;task_id=<?= $task['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
<div class="form-actions">
<a href="?controller=task&amp;action=open&amp;task_id=<?= $task['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</section>
</div>

View File

@@ -0,0 +1,6 @@
<div class="page-header">
<h2><?= Helper\escape($file['name']) ?></h2>
<div class="task-file-viewer">
<img src="?controller=task&amp;action=image&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $file['task_id'] ?>" alt="<?= Helper\escape($file['name']) ?>"/>
</div>
</div>

View File

@@ -1,3 +1,7 @@
<div class="page-header">
<h2><?= t('Remove a task') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to remove this task: "%s"?', Helper\escape($task['title'])) ?>

View File

@@ -0,0 +1,14 @@
<div class="page-header">
<h2><?= t('Remove a file') ?></h2>
</div>
<div class="confirm">
<p class="alert alert-info">
<?= t('Do you really want to remove this file: "%s"?', Helper\escape($file['name'])) ?>
</p>
<div class="form-actions">
<a href="?controller=task&amp;action=removeFile&amp;task_id=<?= $task['id'] ?>&amp;file_id=<?= $file['id'] ?>" class="btn btn-red"><?= t('Yes') ?></a>
<?= t('or') ?> <a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('cancel') ?></a>
</div>
</div>

View File

@@ -64,6 +64,23 @@
</form>
<?php endif ?>
<?php if (! empty($files)): ?>
<h2 id="attachments"><?= t('Attachments') ?></h2>
<ul class="task-show-files">
<?php foreach ($files as $file): ?>
<li>
<a href="?controller=task&amp;action=download&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= Helper\escape($file['name']) ?></a>
<span class="task-show-file-actions">
<?php if ($file['is_image']): ?>
<a href="?controller=task&amp;action=openFile&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>" class="popover"><?= t('open') ?></a>,
<?php endif ?>
<a href="?controller=task&amp;action=confirmRemoveFile&amp;file_id=<?= $file['id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('remove') ?></a>
</span>
</li>
<?php endforeach ?>
</ul>
<?php endif ?>
<h2><?= t('Comments') ?></h2>
<?php if ($comments): ?>
<ul id="comments">

View File

@@ -2,8 +2,10 @@
<h2><?= t('Actions') ?></h2>
<div class="task-show-actions">
<ul>
<li><a href="?controller=task&amp;action=duplicate&amp;project_id=<?= $task['project_id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('Duplicate') ?></a></li>
<li><a href="?controller=task&amp;action=show&amp;task_id=<?= $task['id'] ?>"><?= t('Description') ?></a></li>
<li><a href="?controller=task&amp;action=edit&amp;task_id=<?= $task['id'] ?>"><?= t('Edit') ?></a></li>
<li><a href="?controller=task&amp;action=file&amp;task_id=<?= $task['id'] ?>"><?= t('Attach a document') ?></a></li>
<li><a href="?controller=task&amp;action=duplicate&amp;project_id=<?= $task['project_id'] ?>&amp;task_id=<?= $task['id'] ?>"><?= t('Duplicate') ?></a></li>
<li>
<?php if ($task['is_active'] == 1): ?>
<a href="?controller=task&amp;action=confirmClose&amp;task_id=<?= $task['id'] ?>"><?= t('Close this task') ?></a>

View File

@@ -0,0 +1,10 @@
<div class="page-header">
<h2><?= t('Attach a document') ?></h2>
</div>
<form action="?controller=task&amp;action=upload&amp;task_id=<?= $task['id'] ?>" method="post" enctype="multipart/form-data">
<input type="file" name="files[]" multiple />
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
</div>
</form>