Move task import outside of project settings
This commit is contained in:
parent
14d6affe2e
commit
ed074d1764
|
|
@ -11,6 +11,7 @@ New features:
|
|||
|
||||
Improvements:
|
||||
|
||||
* Move task import to a separate section
|
||||
* Mark web notification as read when clicking on it
|
||||
* Support strtotime strings for date search
|
||||
* Reset failed login counter and unlock user when changing password
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ class TaskImportController extends BaseController
|
|||
* @param array $errors
|
||||
* @throws \Kanboard\Core\Controller\PageNotFoundException
|
||||
*/
|
||||
public function step1(array $values = array(), array $errors = array())
|
||||
public function show(array $values = array(), array $errors = array())
|
||||
{
|
||||
$project = $this->getProject();
|
||||
|
||||
$this->response->html($this->helper->layout->project('task_import/step1', array(
|
||||
$this->response->html($this->helper->layout->project('task_import/show', array(
|
||||
'project' => $project,
|
||||
'values' => $values,
|
||||
'errors' => $errors,
|
||||
|
|
@ -31,36 +31,35 @@ class TaskImportController extends BaseController
|
|||
'delimiters' => Csv::getDelimiters(),
|
||||
'enclosures' => Csv::getEnclosures(),
|
||||
'title' => t('Import tasks from CSV file'),
|
||||
)));
|
||||
), 'task_import/sidebar'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process CSV file
|
||||
*
|
||||
*/
|
||||
public function step2()
|
||||
public function save()
|
||||
{
|
||||
$project = $this->getProject();
|
||||
$values = $this->request->getValues();
|
||||
$filename = $this->request->getFilePath('file');
|
||||
|
||||
if (! file_exists($filename)) {
|
||||
$this->step1($values, array('file' => array(t('Unable to read your file'))));
|
||||
}
|
||||
|
||||
$this->taskImport->projectId = $project['id'];
|
||||
|
||||
$csv = new Csv($values['delimiter'], $values['enclosure']);
|
||||
$csv->setColumnMapping($this->taskImport->getColumnMapping());
|
||||
$csv->read($filename, array($this->taskImport, 'import'));
|
||||
|
||||
if ($this->taskImport->counter > 0) {
|
||||
$this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
|
||||
$this->show($values, array('file' => array(t('Unable to read your file'))));
|
||||
} else {
|
||||
$this->flash->failure(t('Nothing have been imported!'));
|
||||
}
|
||||
$this->taskImport->projectId = $project['id'];
|
||||
|
||||
$this->response->redirect($this->helper->url->to('TaskImportController', 'step1', array('project_id' => $project['id'])));
|
||||
$csv = new Csv($values['delimiter'], $values['enclosure']);
|
||||
$csv->setColumnMapping($this->taskImport->getColumnMapping());
|
||||
$csv->read($filename, array($this->taskImport, 'import'));
|
||||
|
||||
if ($this->taskImport->counter > 0) {
|
||||
$this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
|
||||
} else {
|
||||
$this->flash->failure(t('Nothing have been imported!'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('TaskImportController', 'show', array('project_id' => $project['id'])));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ class RouteProvider implements ServiceProviderInterface
|
|||
$container['route']->addRoute('project/:project_id/integrations', 'ProjectViewController', 'integrations');
|
||||
$container['route']->addRoute('project/:project_id/duplicate', 'ProjectViewController', 'duplicate');
|
||||
$container['route']->addRoute('project/:project_id/permissions', 'ProjectPermissionController', 'index');
|
||||
$container['route']->addRoute('project/:project_id/import', 'TaskImportController', 'step1');
|
||||
$container['route']->addRoute('project/:project_id/activity', 'ActivityController', 'project');
|
||||
|
||||
// Project Overview
|
||||
|
|
@ -89,6 +88,9 @@ class RouteProvider implements ServiceProviderInterface
|
|||
// Category routes
|
||||
$container['route']->addRoute('project/:project_id/categories', 'CategoryController', 'index');
|
||||
|
||||
// Import routes
|
||||
$container['route']->addRoute('project/:project_id/import', 'TaskImportController', 'show');
|
||||
|
||||
// Task routes
|
||||
$container['route']->addRoute('project/:project_id/task/:task_id', 'TaskViewController', 'show');
|
||||
$container['route']->addRoute('t/:task_id', 'TaskViewController', 'show');
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<div class="sidebar">
|
||||
<h2><?= t('Exports') ?></h2>
|
||||
<ul>
|
||||
<li <?= $this->app->getRouterAction() === 'tasks' ? 'class="active"' : '' ?>>
|
||||
<li <?= $this->app->checkMenuSelection('ExportController', 'tasks') ?>>
|
||||
<?= $this->url->link(t('Tasks'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<li <?= $this->app->getRouterAction() === 'subtasks' ? 'class="active"' : '' ?>>
|
||||
<li <?= $this->app->checkMenuSelection('ExportController', 'subtasks') ?>>
|
||||
<?= $this->url->link(t('Subtasks'), 'ExportController', 'subtasks', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<li <?= $this->app->getRouterAction() === 'transitions' ? 'class="active"' : '' ?>>
|
||||
<li <?= $this->app->checkMenuSelection('ExportController', 'transitions') ?>>
|
||||
<?= $this->url->link(t('Task transitions'), 'ExportController', 'transitions', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<li <?= $this->app->getRouterAction() === 'summary' ? 'class="active"' : '' ?>>
|
||||
<li <?= $this->app->checkMenuSelection('ExportController', 'summary') ?>>
|
||||
<?= $this->url->link(t('Daily project summary'), 'ExportController', 'summary', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?= $this->hook->render('template:export:sidebar') ?>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<li <?= $this->app->checkMenuSelection('SwimlaneController') ?>>
|
||||
<?= $this->url->link(t('Swimlanes'), 'SwimlaneController', 'index', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<li <?= $this->app->checkMenuSelection('category') ?>>
|
||||
<li <?= $this->app->checkMenuSelection('CategoryController') ?>>
|
||||
<?= $this->url->link(t('Categories'), 'CategoryController', 'index', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?php if ($project['is_private'] == 0): ?>
|
||||
|
|
@ -51,9 +51,6 @@
|
|||
<?= $this->url->link(t('Enable'), 'ProjectStatusController', 'confirmEnable', array('project_id' => $project['id']), false, 'popover') ?>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<li <?= $this->app->checkMenuSelection('TaskImportController') ?>>
|
||||
<?= $this->url->link(t('Import'), 'TaskImportController', 'step1', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?php if ($this->user->hasProjectAccess('ProjectStatusController', 'remove', $project['id'])): ?>
|
||||
<li>
|
||||
<?= $this->url->link(t('Remove'), 'ProjectStatusController', 'confirmRemove', array('project_id' => $project['id']), false, 'popover') ?>
|
||||
|
|
|
|||
|
|
@ -67,11 +67,18 @@
|
|||
|
||||
<?php if ($this->user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?>
|
||||
<li>
|
||||
<i class="fa fa-download fa-fw"></i>
|
||||
<i class="fa fa-upload fa-fw"></i>
|
||||
<?= $this->url->link(t('Exports'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->user->hasProjectAccess('TaskImportController', 'tasks', $project['id'])): ?>
|
||||
<li>
|
||||
<i class="fa fa-download fa-fw"></i>
|
||||
<?= $this->url->link(t('Imports'), 'TaskImportController', 'show', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($this->user->hasProjectAccess('ProjectEditController', 'edit', $project['id'])): ?>
|
||||
<li>
|
||||
<i class="fa fa-cog fa-fw"></i>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="page-header">
|
||||
<h2><?= t('Tasks Importation') ?></h2>
|
||||
</div>
|
||||
<form action="<?= $this->url->href('TaskImportController', 'step2', array('project_id' => $project['id'])) ?>" method="post" enctype="multipart/form-data">
|
||||
<form action="<?= $this->url->href('TaskImportController', 'save', array('project_id' => $project['id'])) ?>" method="post" enctype="multipart/form-data">
|
||||
<?= $this->form->csrf() ?>
|
||||
|
||||
<?= $this->form->label(t('Delimiter'), 'delimiter') ?>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<div class="sidebar">
|
||||
<h2><?= t('Imports') ?></h2>
|
||||
<ul>
|
||||
<li <?= $this->app->checkMenuSelection('TaskImportController', 'show') ?>>
|
||||
<?= $this->url->link(t('Tasks').' (CSV)', 'TaskImportController', 'show', array('project_id' => $project['id'])) ?>
|
||||
</li>
|
||||
<?= $this->hook->render('template:task-import:sidebar') ?>
|
||||
</ul>
|
||||
</div>
|
||||
Loading…
Reference in New Issue