Rename File controller to TaskFile

This commit is contained in:
Frederic Guillot 2016-02-14 15:49:59 -05:00
parent 8e25c875f2
commit 8477da2643
13 changed files with 29 additions and 31 deletions

View File

@ -93,7 +93,7 @@ class BoardPopover extends Base
{
$task = $this->getTask();
$this->response->html($this->template->render('file/screenshot', array(
$this->response->html($this->template->render('task_file/screenshot', array(
'task' => $task,
)));
}

View File

@ -5,12 +5,12 @@ namespace Kanboard\Controller;
use Kanboard\Core\ObjectStorage\ObjectStorageException;
/**
* File controller
* File File Controller
*
* @package controller
* @author Frederic Guillot
*/
class File extends Base
class TaskFile extends Base
{
/**
* Screenshot
@ -26,7 +26,7 @@ class File extends Base
return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true);
}
$this->response->html($this->helper->layout->task('file/screenshot', array(
$this->response->html($this->helper->layout->task('task_file/screenshot', array(
'task' => $task,
)));
}
@ -40,7 +40,7 @@ class File extends Base
{
$task = $this->getTask();
$this->response->html($this->helper->layout->task('file/new', array(
$this->response->html($this->helper->layout->task('task_file/new', array(
'task' => $task,
'max_size' => $this->helper->text->phpToBytes(ini_get('upload_max_filesize')),
)));
@ -95,7 +95,7 @@ class File extends Base
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
if ($file['task_id'] == $task['id']) {
$this->response->html($this->template->render('file/open', array(
$this->response->html($this->template->render('task_file/open', array(
'file' => $file,
'task' => $task,
)));
@ -178,7 +178,7 @@ class File extends Base
$task = $this->getTask();
$file = $this->taskFile->getById($this->request->getIntegerParam('file_id'));
$this->response->html($this->helper->layout->task('file/remove', array(
$this->response->html($this->helper->layout->task('task_file/remove', array(
'task' => $task,
'file' => $file,
)));

View File

@ -76,7 +76,7 @@ class AuthenticationProvider implements ServiceProviderInterface
$acl->add('Comment', '*', Role::PROJECT_MEMBER);
$acl->add('Customfilter', '*', Role::PROJECT_MEMBER);
$acl->add('Export', '*', Role::PROJECT_MANAGER);
$acl->add('File', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER);
$acl->add('TaskFile', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER);
$acl->add('Gantt', '*', Role::PROJECT_MANAGER);
$acl->add('Project', array('share', 'integrations', 'notifications', 'duplicate', 'disable', 'enable', 'remove'), Role::PROJECT_MANAGER);
$acl->add('ProjectPermission', '*', Role::PROJECT_MANAGER);

View File

@ -94,8 +94,6 @@ class RouteProvider implements ServiceProviderInterface
$container['route']->addRoute('public/task/:task_id/:token', 'task', 'readonly');
$container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task');
$container['route']->addRoute('project/:project_id/task/:task_id/screenshot', 'file', 'screenshot');
$container['route']->addRoute('project/:project_id/task/:task_id/upload', 'file', 'create');
$container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions');
$container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics');
$container['route']->addRoute('project/:project_id/task/:task_id/subtasks', 'subtask', 'show');

View File

@ -8,9 +8,9 @@
</tr>
<tr>
<td>
<i class="fa fa-download fa-fw"></i><?= $this->url->link(t('download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<i class="fa fa-download fa-fw"></i><?= $this->url->link(t('download'), 'TaskFile', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<?php if ($file['is_image'] == 1): ?>
&nbsp;<i class="fa fa-eye"></i> <?= $this->url->link(t('open file'), 'file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
&nbsp;<i class="fa fa-eye"></i> <?= $this->url->link(t('open file'), 'TaskFile', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
<?php endif ?>
</td>
</tr>

View File

@ -1,6 +0,0 @@
<div class="page-header">
<h2><?= $this->e($file['name']) ?></h2>
<div class="task-file-viewer">
<img src="<?= $this->url->href('file', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/>
</div>
</div>

View File

@ -38,11 +38,11 @@
</li>
<li>
<i class="fa fa-file fa-fw"></i>
<?= $this->url->link(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
<?= $this->url->link(t('Attach a document'), 'TaskFile', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li>
<li>
<i class="fa fa-camera fa-fw"></i>
<?= $this->url->link(t('Add a screenshot'), 'file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
<?= $this->url->link(t('Add a screenshot'), 'TaskFile', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
</li>
<li>
<i class="fa fa-files-o fa-fw"></i>

View File

@ -25,7 +25,7 @@
<?= $this->render('task/time_tracking_summary', array('task' => $task)) ?>
<?= $this->render('file/show', array(
<?= $this->render('task_file/show', array(
'task' => $task,
'files' => $files,
'images' => $images

View File

@ -18,7 +18,7 @@
<div
id="file-dropzone"
data-max-size="<?= $max_size ?>"
data-url="<?= $this->url->href('file', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>">
data-url="<?= $this->url->href('TaskFile', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>">
<div id="file-dropzone-inner">
<?= t('Drag and drop your files here') ?> <?= t('or') ?> <a href="#" id="file-browser"><?= t('choose files') ?></a>
</div>

View File

@ -0,0 +1,6 @@
<div class="page-header">
<h2><?= $this->e($file['name']) ?></h2>
<div class="task-file-viewer">
<img src="<?= $this->url->href('TaskFile', 'image', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" alt="<?= $this->e($file['name']) ?>"/>
</div>
</div>

View File

@ -8,7 +8,7 @@
</p>
<div class="form-actions">
<?= $this->url->link(t('Yes'), 'file', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?>
<?= $this->url->link(t('Yes'), 'TaskFile', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?>
<?= t('or') ?>
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
</div>

View File

@ -6,7 +6,7 @@
<p id="screenshot-inner"><?= t('Take a screenshot and press CTRL+V or ⌘+V to paste here.') ?></p>
</div>
<form class="popover-form" action="<?= $this->url->href('file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post">
<form class="popover-form" action="<?= $this->url->href('TaskFile', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post">
<input type="hidden" name="screenshot"/>
<?= $this->form->csrf() ?>
<div class="form-actions">

View File

@ -8,21 +8,21 @@
<div class="file-thumbnails">
<?php foreach ($images as $file): ?>
<div class="file-thumbnail">
<a href="<?= $this->url->href('file', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('file', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->e($file['name']) ?>" alt="<?= $this->e($file['name']) ?>"></a>
<a href="<?= $this->url->href('TaskFile', 'open', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>" class="popover"><img src="<?= $this->url->href('TaskFile', 'thumbnail', array('file_id' => $file['id'], 'project_id' => $task['project_id'], 'task_id' => $file['task_id'])) ?>" title="<?= $this->e($file['name']) ?>" alt="<?= $this->e($file['name']) ?>"></a>
<div class="file-thumbnail-content">
<div class="file-thumbnail-title">
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
<ul>
<?php if ($this->user->hasProjectAccess('file', 'remove', $task['project_id'])): ?>
<?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?>
<li>
<i class="fa fa-trash fa-fw"></i>
<?= $this->url->link(t('Remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
<?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
</li>
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<?= $this->url->link(t('Download'), 'TaskFile', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>
@ -54,15 +54,15 @@
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-text"><?= $this->e($file['name']) ?> <i class="fa fa-caret-down"></i></a>
<ul>
<?php if ($this->user->hasProjectAccess('file', 'remove', $task['project_id'])): ?>
<?php if ($this->user->hasProjectAccess('TaskFile', 'remove', $task['project_id'])): ?>
<li>
<i class="fa fa-trash fa-fw"></i>
<?= $this->url->link(t('Remove'), 'file', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
<?= $this->url->link(t('Remove'), 'TaskFile', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?>
</li>
<?php endif ?>
<li>
<i class="fa fa-download fa-fw"></i>
<?= $this->url->link(t('Download'), 'file', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
<?= $this->url->link(t('Download'), 'TaskFile', 'download', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
</li>
</ul>
</div>