summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile2
-rw-r--r--README.markdown2
-rw-r--r--app/Controller/App.php24
-rw-r--r--app/Controller/Base.php3
-rw-r--r--app/Controller/Board.php2
-rw-r--r--app/Controller/Project.php9
-rw-r--r--app/Controller/Task.php4
-rw-r--r--app/Controller/Tasklink.php69
-rw-r--r--app/Integration/Base.php1
-rw-r--r--app/Integration/GithubWebhook.php14
-rw-r--r--app/Integration/GitlabWebhook.php2
-rw-r--r--app/Locale/da_DK/translations.php4
-rw-r--r--app/Locale/de_DE/translations.php100
-rw-r--r--app/Locale/es_ES/translations.php4
-rw-r--r--app/Locale/fi_FI/translations.php4
-rw-r--r--app/Locale/fr_FR/translations.php6
-rw-r--r--app/Locale/hu_HU/translations.php4
-rw-r--r--app/Locale/it_IT/translations.php4
-rw-r--r--app/Locale/ja_JP/translations.php4
-rw-r--r--app/Locale/nl_NL/translations.php4
-rw-r--r--app/Locale/pl_PL/translations.php4
-rw-r--r--app/Locale/pt_BR/translations.php31
-rw-r--r--app/Locale/ru_RU/translations.php4
-rw-r--r--app/Locale/sr_Latn_RS/translations.php4
-rw-r--r--app/Locale/sv_SE/translations.php4
-rw-r--r--app/Locale/th_TH/translations.php4
-rw-r--r--app/Locale/tr_TR/translations.php4
-rw-r--r--app/Locale/zh_CN/translations.php4
-rw-r--r--app/Model/Base.php2
-rw-r--r--app/Model/Link.php3
-rw-r--r--app/Model/TaskFilter.php9
-rw-r--r--app/Model/TaskFinder.php5
-rw-r--r--app/Model/TaskLink.php149
-rw-r--r--app/Subscriber/Base.php2
-rw-r--r--app/Template/board/assignee.php2
-rw-r--r--app/Template/board/tasklinks.php3
-rw-r--r--app/Template/tasklink/create.php10
-rw-r--r--app/Template/tasklink/edit.php34
-rw-r--r--app/Template/tasklink/show.php100
-rw-r--r--app/common.php1
-rw-r--r--assets/css/app.css6
-rw-r--r--assets/css/print.css2
-rw-r--r--assets/css/src/board.css2
-rw-r--r--assets/css/src/form.css4
-rw-r--r--assets/js/app.js6
-rw-r--r--assets/js/src/base.js9
-rw-r--r--docs/analytics.markdown11
-rw-r--r--docs/screenshots.markdown2
-rw-r--r--tests/units/GitlabWebhookTest.php5
-rw-r--r--tests/units/LinkTest.php12
-rw-r--r--tests/units/TaskLinkTest.php105
51 files changed, 646 insertions, 163 deletions
diff --git a/Dockerfile b/Dockerfile
index 96b34c88..c278fb6c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
FROM ubuntu:14.04
MAINTAINER Frederic Guillot <fred@kanboard.net>
-RUN apt-get update && apt-get install -y apache2 php5 php5-sqlite git curl && apt-get clean
+RUN apt-get update && apt-get install -y apache2 php5 php5-gd php5-sqlite git curl && apt-get clean
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN curl -sS https://getcomposer.org/installer | php -- --filename=/usr/local/bin/composer
RUN cd /var/www && git clone https://github.com/fguillot/kanboard.git
diff --git a/README.markdown b/README.markdown
index 08b885a7..a390d645 100644
--- a/README.markdown
+++ b/README.markdown
@@ -48,6 +48,7 @@ GNU Affero General Public License version 3: <http://www.gnu.org/licenses/agpl-3
Related projects
----------------
+- [Kanboard Presenter by David Eberlein](https://github.com/davideberlein/kanboard-presenter)
- [CSV2Kanboard by @ashbike](https://github.com/ashbike/csv2kanboard)
- [Kanboard for Yunohost by @mbugeia](https://github.com/mbugeia/kanboard_ynh)
- [Trello import script by @matueranet](https://github.com/matueranet/kanboard-import-trello)
@@ -201,6 +202,7 @@ Contributors:
- [Iterate From 0](https://github.com/freebsd-kanboard)
- [Jan Dittrich](https://github.com/jdittrich)
- [Janne Mäntyharju](https://github.com/JanneMantyharju)
+- [Jean-François Magnier](https://github.com/lefakir)
- [Jesusaplsoft](https://github.com/jesusaplsoft)
- [Karol J](https://github.com/dzudek)
- [Kiswa](https://github.com/kiswa)
diff --git a/app/Controller/App.php b/app/Controller/App.php
index ebe39670..e4a97f8e 100644
--- a/app/Controller/App.php
+++ b/app/Controller/App.php
@@ -110,13 +110,21 @@ class App extends Base
*/
public function autocomplete()
{
- $this->response->json(
- $this->taskFilter
- ->create()
- ->filterByProjects($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId()))
- ->excludeTasks(array($this->request->getIntegerParam('exclude_task_id')))
- ->filterByTitle($this->request->getStringParam('term'))
- ->toAutoCompletion()
- );
+ $search = $this->request->getStringParam('term');
+
+ $filter = $this->taskFilter
+ ->create()
+ ->filterByProjects($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId()))
+ ->excludeTasks(array($this->request->getIntegerParam('exclude_task_id')));
+
+ // Search by task id or by title
+ if (ctype_digit($search)) {
+ $filter->filterById($search);
+ }
+ else {
+ $filter->filterByTitle($search);
+ }
+
+ $this->response->json($filter->toAutoCompletion());
}
}
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 869d5d59..477d82a5 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -24,6 +24,9 @@ use Symfony\Component\EventDispatcher\Event;
* @property \Integration\GithubWebhook $githubWebhook
* @property \Integration\GitlabWebhook $gitlabWebhook
* @property \Integration\BitbucketWebhook $bitbucketWebhook
+ * @property \Integration\PostmarkWebhook $postmarkWebhook
+ * @property \Integration\SendgridWebhook $sendgridWebhook
+ * @property \Integration\MailgunWebhook $mailgunWebhook
* @property \Model\Acl $acl
* @property \Model\Authentication $authentication
* @property \Model\Action $action
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index 94a57e84..e92cfe37 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -197,7 +197,7 @@ class Board extends Base
{
$task = $this->getTask();
$this->response->html($this->template->render('board/tasklinks', array(
- 'links' => $this->taskLink->getLinks($task['id']),
+ 'links' => $this->taskLink->getAll($task['id']),
'task' => $task,
)));
}
diff --git a/app/Controller/Project.php b/app/Controller/Project.php
index 165ed2df..185c55be 100644
--- a/app/Controller/Project.php
+++ b/app/Controller/Project.php
@@ -405,7 +405,7 @@ class Project extends Base
$project = $this->project->getByToken($token);
// Token verification
- if (! $project) {
+ if (empty($project)) {
$this->forbidden(true);
}
@@ -531,13 +531,12 @@ class Project extends Base
$project_id = $this->project->create($values, $this->userSession->getId(), true);
- if ($project_id) {
+ if ($project_id > 0) {
$this->session->flash(t('Your project have been created successfully.'));
$this->response->redirect('?controller=project&action=show&project_id='.$project_id);
}
- else {
- $this->session->flashError(t('Unable to create your project.'));
- }
+
+ $this->session->flashError(t('Unable to create your project.'));
}
$this->create($values, $errors);
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 2f590695..060a478c 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -36,7 +36,7 @@ class Task extends Base
'project' => $project,
'comments' => $this->comment->getAll($task['id']),
'subtasks' => $this->subtask->getAll($task['id']),
- 'links' => $this->taskLink->getLinks($task['id']),
+ 'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
'task' => $task,
'columns_list' => $this->board->getColumnsList($task['project_id']),
'colors_list' => $this->color->getList(),
@@ -72,7 +72,7 @@ class Task extends Base
'images' => $this->file->getAllImages($task['id']),
'comments' => $this->comment->getAll($task['id']),
'subtasks' => $subtasks,
- 'links' => $this->taskLink->getLinks($task['id']),
+ 'links' => $this->taskLink->getAllGroupedByLabel($task['id']),
'task' => $task,
'values' => $values,
'link_label_list' => $this->link->getList(0, false),
diff --git a/app/Controller/Tasklink.php b/app/Controller/Tasklink.php
index 8376b75b..eccf149f 100644
--- a/app/Controller/Tasklink.php
+++ b/app/Controller/Tasklink.php
@@ -38,13 +38,7 @@ class Tasklink extends Base
$task = $this->getTask();
$ajax = $this->request->isAjax() || $this->request->getIntegerParam('ajax');
- if (empty($values)) {
- $values = array(
- 'task_id' => $task['id'],
- );
- }
-
- if ($ajax) {
+ if ($ajax && empty($errors)) {
$this->response->html($this->template->render('tasklink/create', array(
'values' => $values,
'errors' => $errors,
@@ -81,20 +75,73 @@ class Tasklink extends Base
if ($this->taskLink->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
$this->session->flash(t('Link added successfully.'));
+
if ($ajax) {
$this->response->redirect($this->helper->url('board', 'show', array('project_id' => $task['project_id'])));
}
+
$this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
}
- else {
- $this->session->flashError(t('Unable to create your link.'));
- }
+
+ $errors = array('title' => array(t('The exact same link already exists')));
+ $this->session->flashError(t('Unable to create your link.'));
}
$this->create($values, $errors);
}
/**
+ * Edit form
+ *
+ * @access public
+ */
+ public function edit(array $values = array(), array $errors = array())
+ {
+ $task = $this->getTask();
+ $task_link = $this->getTaskLink();
+
+ if (empty($values)) {
+ $opposite_task = $this->taskFinder->getById($task_link['opposite_task_id']);
+ $values = $task_link;
+ $values['title'] = '#'.$opposite_task['id'].' - '.$opposite_task['title'];
+ }
+
+ $this->response->html($this->taskLayout('tasklink/edit', array(
+ 'values' => $values,
+ 'errors' => $errors,
+ 'task_link' => $task_link,
+ 'task' => $task,
+ 'labels' => $this->link->getList(0, false),
+ 'title' => t('Edit link')
+ )));
+ }
+
+ /**
+ * Validation and update
+ *
+ * @access public
+ */
+ public function update()
+ {
+ $task = $this->getTask();
+ $values = $this->request->getValues();
+
+ list($valid, $errors) = $this->taskLink->validateModification($values);
+
+ if ($valid) {
+
+ if ($this->taskLink->update($values['id'], $values['task_id'], $values['opposite_task_id'], $values['link_id'])) {
+ $this->session->flash(t('Link updated successfully.'));
+ $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
+ }
+
+ $this->session->flashError(t('Unable to update your link.'));
+ }
+
+ $this->edit($values, $errors);
+ }
+
+ /**
* Confirmation dialog before removing a link
*
* @access public
@@ -127,6 +174,6 @@ class Tasklink extends Base
$this->session->flashError(t('Unable to remove this link.'));
}
- $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])));
+ $this->response->redirect($this->helper->url('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])).'#links');
}
}
diff --git a/app/Integration/Base.php b/app/Integration/Base.php
index 9daa3eb0..53f0ae8a 100644
--- a/app/Integration/Base.php
+++ b/app/Integration/Base.php
@@ -15,6 +15,7 @@ use Pimple\Container;
* @property \Model\Task $task
* @property \Model\TaskFinder $taskFinder
* @property \Model\User $user
+ * @property \Model\Project $project
*/
abstract class Base
{
diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php
index 121fdd1b..0070c309 100644
--- a/app/Integration/GithubWebhook.php
+++ b/app/Integration/GithubWebhook.php
@@ -139,7 +139,7 @@ class GithubWebhook extends Base
*/
public function parseCommentIssueEvent(array $payload)
{
- $task = $this->taskFinder->getByReference($payload['issue']['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $payload['issue']['number']);
$user = $this->user->getByUsername($payload['comment']['user']['login']);
if (! empty($task) && ! empty($user)) {
@@ -196,7 +196,7 @@ class GithubWebhook extends Base
*/
public function handleIssueClosed(array $issue)
{
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($task)) {
$event = array(
@@ -225,7 +225,7 @@ class GithubWebhook extends Base
*/
public function handleIssueReopened(array $issue)
{
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($task)) {
$event = array(
@@ -255,7 +255,7 @@ class GithubWebhook extends Base
public function handleIssueAssigned(array $issue)
{
$user = $this->user->getByUsername($issue['assignee']['login']);
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($user) && ! empty($task)) {
@@ -286,7 +286,7 @@ class GithubWebhook extends Base
*/
public function handleIssueUnassigned(array $issue)
{
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($task)) {
@@ -318,7 +318,7 @@ class GithubWebhook extends Base
*/
public function handleIssueLabeled(array $issue, array $label)
{
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($task)) {
@@ -350,7 +350,7 @@ class GithubWebhook extends Base
*/
public function handleIssueUnlabeled(array $issue, array $label)
{
- $task = $this->taskFinder->getByReference($issue['number']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['number']);
if (! empty($task)) {
diff --git a/app/Integration/GitlabWebhook.php b/app/Integration/GitlabWebhook.php
index dbba3663..e30a0b50 100644
--- a/app/Integration/GitlabWebhook.php
+++ b/app/Integration/GitlabWebhook.php
@@ -191,7 +191,7 @@ class GitlabWebhook extends Base
*/
public function handleIssueClosed(array $issue)
{
- $task = $this->taskFinder->getByReference($issue['id']);
+ $task = $this->taskFinder->getByReference($this->project_id, $issue['id']);
if (! empty($task)) {
$event = array(
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php
index b26d1958..3d166f5d 100644
--- a/app/Locale/da_DK/translations.php
+++ b/app/Locale/da_DK/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php
index 9ff10a55..0aab9fde 100644
--- a/app/Locale/de_DE/translations.php
+++ b/app/Locale/de_DE/translations.php
@@ -789,20 +789,20 @@ return array(
'Custom Stylesheet' => 'benutzerdefiniertes Stylesheet',
'download' => 'Download',
'Do you really want to remove this budget line?' => 'Soll diese Budgetlinie wirklich entfernt werden?',
- // 'EUR - Euro' => '',
+ 'EUR - Euro' => 'EUR - Euro',
'Expenses' => 'Kosten',
- // 'GBP - British Pound' => '',
- // 'INR - Indian Rupee' => '',
- // 'JPY - Japanese Yen' => '',
+ 'GBP - British Pound' => 'GBP - Britische Pfung',
+ 'INR - Indian Rupee' => 'INR - Indische Rupien',
+ 'JPY - Japanese Yen' => 'JPY - Japanischer Yen',
'New budget line' => 'Neue Budgetlinie',
- // 'NZD - New Zealand Dollar' => '',
+ 'NZD - New Zealand Dollar' => 'NZD - Neuseeland-Dollar',
'Remove a budget line' => 'Budgetlinie entfernen',
'Remove budget line' => 'Budgetlinie entfernen',
- // 'RSD - Serbian dinar' => '',
+ 'RSD - Serbian dinar' => 'RSD - Serbische Dinar',
'The budget line have been created successfully.' => 'Die Budgetlinie wurde erfolgreich angelegt.',
'Unable to create the budget line.' => 'Budgetlinie konnte nicht erstellt werden.',
'Unable to remove this budget line.' => 'Budgetlinie konnte nicht gelöscht werden.',
- // 'USD - US Dollar' => '',
+ 'USD - US Dollar' => 'USD - US Dollar',
'Remaining' => 'Verbleibend',
'Destination column' => 'Zielspalte',
'Move the task to another column when assigned to a user' => 'Aufgabe in eine andere Spalte verschieben, wenn ein User zugeordnet wurde.',
@@ -827,47 +827,51 @@ return array(
'Webhook URL' => 'Webhook URL',
'Help on Slack integration' => 'Hilfe für Slack integration.',
'%s remove the assignee of the task %s' => '%s Zuordnung für die Aufgabe %s entfernen',
- // 'Send notifications to Hipchat' => '',
- // 'API URL' => '',
- // 'Room API ID or name' => '',
- // 'Room notification token' => '',
- // 'Help on Hipchat integration' => '',
- // 'Enable Gravatar images' => '',
- // 'Information' => '',
- // 'Check two factor authentication code' => '',
- // 'The two factor authentication code is not valid.' => '',
- // 'The two factor authentication code is valid.' => '',
- // 'Code' => '',
- // 'Two factor authentication' => '',
- // 'Enable/disable two factor authentication' => '',
- // 'This QR code contains the key URI: ' => '',
- // 'Save the secret key in your TOTP software (by example Google Authenticator or FreeOTP).' => '',
- // 'Check my code' => '',
- // 'Secret key: ' => '',
- // 'Test your device' => '',
- // 'Assign a color when the task is moved to a specific column' => '',
- // '%s via Kanboard' => '',
- // 'uploaded by: %s' => '',
- // 'uploaded on: %s' => '',
- // 'size: %s' => '',
- // 'Burndown chart for "%s"' => '',
- // 'Burndown chart' => '',
- // 'This chart show the task complexity over the time (Work Remaining).' => '',
- // 'Screenshot taken %s' => '',
- // 'Add a screenshot' => '',
- // 'Take a screenshot and press CTRL+V or ⌘+V to paste here.' => '',
- // 'Screenshot uploaded successfully.' => '',
- // 'SEK - Swedish Krona' => '',
- // 'The project identifier is an optional alphanumeric code used to identify your project.' => '',
- // 'Identifier' => '',
- // 'Postmark (incoming emails)' => '',
- // 'Help on Postmark integration' => '',
- // 'Mailgun (incoming emails)' => '',
- // 'Help on Mailgun integration' => '',
- // 'Sendgrid (incoming emails)' => '',
- // 'Help on Sendgrid integration' => '',
- // 'Disable two factor authentication' => '',
- // 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ 'Send notifications to Hipchat' => 'Sende Benachrichtigung an Hipchat',
+ 'API URL' => 'API URL',
+ 'Room API ID or name' => 'Raum API ID oder Name',
+ 'Room notification token' => 'Raum Benachrichtigungstoken',
+ 'Help on Hipchat integration' => 'Hilfe bei Hipchat Integration',
+ 'Enable Gravatar images' => 'Aktiviere Gravatar Bilder',
+ 'Information' => 'Information',
+ 'Check two factor authentication code' => 'Prüfe Zwei-Faktor-Authentifizierungscode',
+ 'The two factor authentication code is not valid.' => 'Der Zwei-Faktor-Authentifizierungscode ist ungültig.',
+ 'The two factor authentication code is valid.' => 'Der Zwei-Faktor-Authentifizierungscode ist gültig.',
+ 'Code' => 'Code',
+ 'Two factor authentication' => 'Zwei-Faktor-Authentifizierung',
+ 'Enable/disable two factor authentication' => 'Aktiviere/Deaktiviere Zwei-Faktor-Authentifizierung',
+ 'This QR code contains the key URI: ' => 'Dieser QR-Code beinhaltet die Schlüssel-URI',
+ 'Save the secret key in your TOTP software (by example Google Authenticator or FreeOTP).' => 'Speichere den geheimen Schlüssel in deiner TOTP software (z.B. Google Authenticator oder FreeOTP).',
+ 'Check my code' => 'Überprüfe meinen Code',
+ 'Secret key: ' => 'Geheimer Schlüssel',
+ 'Test your device' => 'Teste dein Gerät',
+ 'Assign a color when the task is moved to a specific column' => 'Weise eine Farbe zu, wenn die Aufgabe zu einer bestimmten Spalte bewegt wird',
+ '%s via Kanboard' => '%s via Kanboard',
+ 'uploaded by: %s' => 'Hochgeladen von: %s',
+ 'uploaded on: %s' => 'Hochgeladen am: %s',
+ 'size: %s' => 'Größe: %s',
+ 'Burndown chart for "%s"' => 'Burndown-Chart für "%s"',
+ 'Burndown chart' => 'Burndown-Chart',
+ 'This chart show the task complexity over the time (Work Remaining).' => 'Dieses Diagramm zeigt die Aufgabenkomplexität über den Faktor Zeit (Verbleibende Arbeit).',
+ 'Screenshot taken %s' => 'Screenshot aufgenommen %s ',
+ 'Add a screenshot' => 'Füge einen Screenshot hinzu',
+ 'Take a screenshot and press CTRL+V or ⌘+V to paste here.' => 'Nimm einen Screenshot auf und drücke STRG+V oder ⌘+V um ihn hier einzufügen.',
+ 'Screenshot uploaded successfully.' => 'Screenshot erfolgreich hochgeladen.',
+ 'SEK - Swedish Krona' => 'SEK - Schwedische Kronen',
+ 'The project identifier is an optional alphanumeric code used to identify your project.' => 'Der Projektidentifikator ist ein optionaler alphanumerischer Code, der das Projekt identifiziert.',
+ 'Identifier' => 'Identifikator',
+ 'Postmark (incoming emails)' => 'Postmark (Eingehende E-Mails)',
+ 'Help on Postmark integration' => 'Hilfe bei Postmark-Integration',
+ 'Mailgun (incoming emails)' => 'Mailgun (Eingehende E-Mails)',
+ 'Help on Mailgun integration' => 'Hilfe bei Mailgun-Integration',
+ 'Sendgrid (incoming emails)' => 'Sendgrid (Eingehende E-Mails)',
+ 'Help on Sendgrid integration' => 'Hilfe bei Sendgrid-Integration',
+ 'Disable two factor authentication' => 'Deaktiviere Zwei-Faktor-Authentifizierung',
+ 'Do you really want to disable the two factor authentication for this user: "%s"?' => 'Willst du wirklich für folgenden Nutzer die Zwei-Faktor-Authentifizierung deaktivieren: "%s"?',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php
index e519aaaa..d89f7b1d 100644
--- a/app/Locale/es_ES/translations.php
+++ b/app/Locale/es_ES/translations.php
@@ -868,6 +868,10 @@ return array(
'Help on Sendgrid integration' => 'Ayuda sobre la integración con Sendgrid',
'Disable two factor authentication' => 'Desactivar la autenticación de dos factores',
'Do you really want to disable the two factor authentication for this user: "%s"?' => '¿Realmentes quieres desactuvar la autenticación de dos factores para este usuario: "%s?"',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php
index eb2a8387..ba01e7be 100644
--- a/app/Locale/fi_FI/translations.php
+++ b/app/Locale/fi_FI/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php
index 7f133179..934762d0 100644
--- a/app/Locale/fr_FR/translations.php
+++ b/app/Locale/fr_FR/translations.php
@@ -719,7 +719,7 @@ return array(
'is a child of' => 'est un enfant de',
'is a parent of' => 'est un parent de',
'targets milestone' => 'vise l\'étape importante',
- 'is a milestone of' => 'est une étape importante de',
+ 'is a milestone of' => 'est une étape importante incluant',
'fixes' => 'corrige',
'is fixed by' => 'est corrigée par',
'This task' => 'Cette tâche',
@@ -870,6 +870,10 @@ return array(
'Help on Sendgrid integration' => 'Aide sur l\'intégration avec Sendgrid',
'Disable two factor authentication' => 'Désactiver l\'authentification à deux facteurs',
'Do you really want to disable the two factor authentication for this user: "%s"?' => 'Voulez-vous vraiment désactiver l\'authentification à deux facteurs pour cet utilisateur : « %s » ?',
+ 'Edit a link' => 'Modifier un lien',
+ 'Start to type task title...' => 'Tappez le titre de la tâche...',
+ 'A task cannot be linked to itself' => 'Une tâche ne peut être liée à elle-même',
+ 'The exact same link already exists' => 'Un lien identique existe déjà',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php
index d5053670..3614f4cd 100644
--- a/app/Locale/hu_HU/translations.php
+++ b/app/Locale/hu_HU/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php
index 7a133965..11f4f47d 100644
--- a/app/Locale/it_IT/translations.php
+++ b/app/Locale/it_IT/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php
index 09397429..3d54b0c2 100644
--- a/app/Locale/ja_JP/translations.php
+++ b/app/Locale/ja_JP/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php
index f26396b0..2fb1637b 100644
--- a/app/Locale/nl_NL/translations.php
+++ b/app/Locale/nl_NL/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php
index 81bd7dc3..5065ddbf 100644
--- a/app/Locale/pl_PL/translations.php
+++ b/app/Locale/pl_PL/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php
index 68e975b3..576e1a8f 100644
--- a/app/Locale/pt_BR/translations.php
+++ b/app/Locale/pt_BR/translations.php
@@ -599,7 +599,7 @@ return array(
'Daily project summary export' => 'Exportação diária do resumo do projeto',
'Daily project summary export for "%s"' => 'Exportação diária do resumo do projeto para "%s"',
'Exports' => 'Exportar',
- // 'This export contains the number of tasks per column grouped per day.' => '',
+ 'This export contains the number of tasks per column grouped per day.' => 'Esta exportação contém o número de tarefas por coluna agrupada por dia.',
'Nothing to preview...' => 'Nada para pré-visualizar...',
'Preview' => 'Pré-visualizar',
'Write' => 'Escrever',
@@ -692,7 +692,7 @@ return array(
'Add a new link' => 'Adicionar uma nova associação',
'Do you really want to remove this link: "%s"?' => 'Você realmente deseja remover esta associação: "%s"?',
'Do you really want to remove this link with task #%d?' => 'Você realmente deseja remover esta associação com a tarefa n°%d?',
- // 'Field required' => '',
+ 'Field required' => 'Campo requerido',
'Link added successfully.' => 'Associação criada com sucesso.',
'Link updated successfully.' => 'Associação atualizada com sucesso.',
'Link removed successfully.' => 'Associação removida com sucesso.',
@@ -846,6 +846,33 @@ return array(
'Secret key: ' => 'Chave secreta:',
'Test your device' => 'Teste o seu dispositivo',
'Assign a color when the task is moved to a specific column' => 'Atribuir uma cor quando a tarefa é movida em uma coluna específica',
+<<<<<<< HEAD
+ '%s via Kanboard' => '%s via Kanboard',
+ 'uploaded by: %s' => 'carregado por: %s',
+ 'uploaded on: %s' => 'carregado em: %s',
+ 'size: %s' => 'tamanho: %s',
+ 'Burndown chart for "%s"' => 'Gráfico de Burndown para',
+ 'Burndown chart' => 'Gráfico de Burndown',
+ 'This chart show the task complexity over the time (Work Remaining).' => 'Este gráfico mostra a complexidade da tarefa ao longo do tempo (Trabalho Restante).',
+ 'Screenshot taken %s' => 'Screenshot tomada em %s',
+ 'Add a screenshot' => 'Adicionar uma Screenshot',
+ 'Take a screenshot and press CTRL+V or ⌘+V to paste here.' => 'Tomar um screenshot e pressione CTRL + V ou ⌘ + V para colar aqui.',
+ 'Screenshot uploaded successfully.' => 'Screenshot enviada com sucesso.',
+ 'SEK - Swedish Krona' => 'SEK - Coroa sueca',
+ 'The project identifier is an optional alphanumeric code used to identify your project.' => 'O identificador de projeto é um código alfanumérico opcional utilizado para identificar o seu projeto.',
+ 'Identifier' => 'Identificador',
+ 'Postmark (incoming emails)' => 'Postmark (e-mails recebidos)',
+ 'Help on Postmark integration' => 'Ajuda na integração do Postmark',
+ 'Mailgun (incoming emails)' => 'Mailgun (e-mails recebidos)',
+ 'Help on Mailgun integration' => 'Ajuda na integração do Mailgun',
+ 'Sendgrid (incoming emails)' => 'Sendgrid (e-mails recebidos)',
+ 'Help on Sendgrid integration' => 'Ajuda na integração do Sendgrid',
+ 'Disable two factor authentication' => 'Desativar autenticação à dois fatores',
+ 'Do you really want to disable the two factor authentication for this user: "%s"?' => 'Você deseja realmente desativar a autenticação à dois fatores para esse usuário: "%s"?',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// '%s via Kanboard' => '',
// 'uploaded by: %s' => '',
// 'uploaded on: %s' => '',
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index daec1d2b..14019773 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
'Disable two factor authentication' => 'Выключить двухфакторную авторизацию',
'Do you really want to disable the two factor authentication for this user: "%s"?' => 'Вы действительно хотите выключить двухфакторную авторизацию для пользователя "%s"?',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php
index d9b73679..521721b8 100644
--- a/app/Locale/sr_Latn_RS/translations.php
+++ b/app/Locale/sr_Latn_RS/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php
index 0cf075be..3303cede 100644
--- a/app/Locale/sv_SE/translations.php
+++ b/app/Locale/sv_SE/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php
index 782b96a3..045b1f66 100644
--- a/app/Locale/th_TH/translations.php
+++ b/app/Locale/th_TH/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php
index 0ddb6c6c..96e3e034 100644
--- a/app/Locale/tr_TR/translations.php
+++ b/app/Locale/tr_TR/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php
index 0c1b5b1b..5daa713a 100644
--- a/app/Locale/zh_CN/translations.php
+++ b/app/Locale/zh_CN/translations.php
@@ -868,6 +868,10 @@ return array(
// 'Help on Sendgrid integration' => '',
// 'Disable two factor authentication' => '',
// 'Do you really want to disable the two factor authentication for this user: "%s"?' => '',
+ // 'Edit a link' => '',
+ // 'Start to type task title...' => '',
+ // 'A task cannot be linked to itself' => '',
+ // 'The exact same link already exists' => '',
// 'Action date' => '',
// 'Base date to calculate new due date' => '',
// 'Base date to calculate new due date: %s' => '',
diff --git a/app/Model/Base.php b/app/Model/Base.php
index b0d82401..b4f9a9e2 100644
--- a/app/Model/Base.php
+++ b/app/Model/Base.php
@@ -46,7 +46,7 @@ use Pimple\Container;
* @property \Model\Timetable $timetable
* @property \Model\TimetableDay $timetableDay
* @property \Model\TimetableExtra $timetableExtra
- * @property \Model\TimetableOff $timetableOfff
+ * @property \Model\TimetableOff $timetableOff
* @property \Model\TimetableWeek $timetableWeek
* @property \Model\SubtaskTimeTracking $subtaskTimeTracking
* @property \Model\User $user
diff --git a/app/Model/Link.php b/app/Model/Link.php
index 87ba49c4..42b8382c 100644
--- a/app/Model/Link.php
+++ b/app/Model/Link.php
@@ -55,8 +55,7 @@ class Link extends Base
*/
public function getOppositeLinkId($link_id)
{
- $link = $this->getById($link_id);
- return $link['opposite_id'] ?: $link_id;
+ return $this->db->table(self::TABLE)->eq('id', $link_id)->findOneColumn('opposite_id') ?: $link_id;
}
/**
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index 31de2795..94f6bab0 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -24,6 +24,15 @@ class TaskFilter extends Base
return $this;
}
+ public function filterById($task_id)
+ {
+ if ($task_id > 0) {
+ $this->query->eq('id', $task_id);
+ }
+
+ return $this;
+ }
+
public function filterByTitle($title)
{
$this->query->ilike('title', '%'.$title.'%');
diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php
index 554279a5..6f53249a 100644
--- a/app/Model/TaskFinder.php
+++ b/app/Model/TaskFinder.php
@@ -211,12 +211,13 @@ class TaskFinder extends Base
* Fetch a task by the reference (external id)
*
* @access public
+ * @param integer $project_id Project id
* @param string $reference Task reference
* @return array
*/
- public function getByReference($reference)
+ public function getByReference($project_id, $reference)
{
- return $this->db->table(Task::TABLE)->eq('reference', $reference)->findOne();
+ return $this->db->table(Task::TABLE)->eq('project_id', $project_id)->eq('reference', $reference)->findOne();
}
/**
diff --git a/app/Model/TaskLink.php b/app/Model/TaskLink.php
index 62391371..7b696afc 100644
--- a/app/Model/TaskLink.php
+++ b/app/Model/TaskLink.php
@@ -35,13 +35,31 @@ class TaskLink extends Base
}
/**
+ * Get the opposite task link (use the unique index task_has_links_unique)
+ *
+ * @access public
+ * @param array $task_link
+ * @return array
+ */
+ public function getOppositeTaskLink(array $task_link)
+ {
+ $opposite_link_id = $this->link->getOppositeLinkId($task_link['link_id']);
+
+ return $this->db->table(self::TABLE)
+ ->eq('opposite_task_id', $task_link['task_id'])
+ ->eq('task_id', $task_link['opposite_task_id'])
+ ->eq('link_id', $opposite_link_id)
+ ->findOne();
+ }
+
+ /**
* Get all links attached to a task
*
* @access public
* @param integer $task_id Task id
* @return array
*/
- public function getLinks($task_id)
+ public function getAll($task_id)
{
return $this->db
->table(self::TABLE)
@@ -52,48 +70,123 @@ class TaskLink extends Base
Task::TABLE.'.title',
Task::TABLE.'.is_active',
Task::TABLE.'.project_id',
+ Task::TABLE.'.time_spent AS task_time_spent',
+ Task::TABLE.'.time_estimated AS task_time_estimated',
+ Task::TABLE.'.owner_id AS task_assignee_id',
+ User::TABLE.'.username AS task_assignee_username',
+ User::TABLE.'.name AS task_assignee_name',
Board::TABLE.'.title AS column_title'
)
->eq(self::TABLE.'.task_id', $task_id)
->join(Link::TABLE, 'id', 'link_id')
->join(Task::TABLE, 'id', 'opposite_task_id')
->join(Board::TABLE, 'id', 'column_id', Task::TABLE)
+ ->join(User::TABLE, 'id', 'owner_id', Task::TABLE)
->orderBy(Link::TABLE.'.id ASC, '.Board::TABLE.'.position ASC, '.Task::TABLE.'.is_active DESC, '.Task::TABLE.'.id', Table::SORT_ASC)
->findAll();
}
/**
+ * Get all links attached to a task grouped by label
+ *
+ * @access public
+ * @param integer $task_id Task id
+ * @return array
+ */
+ public function getAllGroupedByLabel($task_id)
+ {
+ $links = $this->getAll($task_id);
+ $result = array();
+
+ foreach ($links as $link) {
+
+ if (! isset($result[$link['label']])) {
+ $result[$link['label']] = array();
+ }
+
+ $result[$link['label']][] = $link;
+ }
+
+ return $result;
+ }
+
+ /**
* Create a new link
*
* @access public
* @param integer $task_id Task id
* @param integer $opposite_task_id Opposite task id
* @param integer $link_id Link id
- * @return boolean
+ * @return integer Task link id
*/
public function create($task_id, $opposite_task_id, $link_id)
{
$this->db->startTransaction();
- // Create the original link
+ // Get opposite link
+ $opposite_link_id = $this->link->getOppositeLinkId($link_id);
+
+ // Create the original task link
$this->db->table(self::TABLE)->insert(array(
'task_id' => $task_id,
'opposite_task_id' => $opposite_task_id,
'link_id' => $link_id,
));
- $link_id = $this->link->getOppositeLinkId($link_id);
+ $task_link_id = $this->db->getConnection()->getLastId();
- // Create the opposite link
+ // Create the opposite task link
$this->db->table(self::TABLE)->insert(array(
'task_id' => $opposite_task_id,
'opposite_task_id' => $task_id,
+ 'link_id' => $opposite_link_id,
+ ));
+
+ $this->db->closeTransaction();
+
+ return $task_link_id;
+ }
+
+ /**
+ * Update a task link
+ *
+ * @access public
+ * @param integer $task_link_id Task link id
+ * @param integer $task_id Task id
+ * @param integer $opposite_task_id Opposite task id
+ * @param integer $link_id Link id
+ * @return boolean
+ */
+ public function update($task_link_id, $task_id, $opposite_task_id, $link_id)
+ {
+ $this->db->startTransaction();
+
+ // Get original task link
+ $task_link = $this->getById($task_link_id);
+
+ // Find opposite task link
+ $opposite_task_link = $this->getOppositeTaskLink($task_link);
+
+ // Get opposite link
+ $opposite_link_id = $this->link->getOppositeLinkId($link_id);
+
+ // Update the original task link
+ $rs1 = $this->db->table(self::TABLE)->eq('id', $task_link_id)->update(array(
+ 'task_id' => $task_id,
+ 'opposite_task_id' => $opposite_task_id,
'link_id' => $link_id,
));
+ // Update the opposite link
+ $rs2 = $this->db->table(self::TABLE)->eq('id', $opposite_task_link['id'])->update(array(
+ 'task_id' => $opposite_task_id,
+ 'opposite_task_id' => $task_id,
+ 'link_id' => $opposite_link_id,
+ ));
+
$this->db->closeTransaction();
- return true;
+ return $rs1 && $rs2;
}
/**
@@ -124,6 +217,23 @@ class TaskLink extends Base
}
/**
+ * Common validation rules
+ *
+ * @access private
+ * @return array
+ */
+ private function commonValidationRules()
+ {
+ return array(
+ new Validators\Required('task_id', t('Field required')),
+ new Validators\Required('opposite_task_id', t('Field required')),
+ new Validators\Required('link_id', t('Field required')),
+ new Validators\NotEquals('opposite_task_id', 'task_id', t('A task cannot be linked to itself')),
+ new Validators\Exists('opposite_task_id', t('This linked task id doesn\'t exists'), $this->db->getConnection(), Task::TABLE, 'id')
+ );
+ }
+
+ /**
* Validate creation
*
* @access public
@@ -132,11 +242,28 @@ class TaskLink extends Base
*/
public function validateCreation(array $values)
{
- $v = new Validator($values, array(
- new Validators\Required('task_id', t('Field required')),
- new Validators\Required('link_id', t('Field required')),
- new Validators\Required('title', t('Field required')),
- ));
+ $v = new Validator($values, $this->commonValidationRules());
+
+ return array(
+ $v->execute(),
+ $v->getErrors()
+ );
+ }
+
+ /**
+ * Validate modification
+ *
+ * @access public
+ * @param array $values Form values
+ * @return array $valid, $errors [0] = Success or not, [1] = List of errors
+ */
+ public function validateModification(array $values)
+ {
+ $rules = array(
+ new Validators\Required('id', t('Field required')),
+ );
+
+ $v = new Validator($values, array_merge($rules, $this->commonValidationRules()));
return array(
$v->execute(),
diff --git a/app/Subscriber/Base.php b/app/Subscriber/Base.php
index 97e230b5..95f311e7 100644
--- a/app/Subscriber/Base.php
+++ b/app/Subscriber/Base.php
@@ -11,7 +11,7 @@ use Pimple\Container;
* @author Frederic Guillot
*
* @property \Integration\SlackWebhook $slackWebhook
- * @property \Integration\Hipchat $hipchat
+ * @property \Integration\HipchatWebhook $hipchatWebhook
* @property \Model\Board $board
* @property \Model\Config $config
* @property \Model\Comment $comment
diff --git a/app/Template/board/assignee.php b/app/Template/board/assignee.php
index c513f572..453b3f2d 100644
--- a/app/Template/board/assignee.php
+++ b/app/Template/board/assignee.php
@@ -9,7 +9,7 @@
<?= $this->formHidden('project_id', $values) ?>
<?= $this->formLabel(t('Assignee'), 'owner_id') ?>
- <?= $this->formSelect('owner_id', $users_list, $values) ?><br/>
+ <?= $this->formSelect('owner_id', $users_list, $values, array(), array('autofocus')) ?><br/>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
diff --git a/app/Template/board/tasklinks.php b/app/Template/board/tasklinks.php
index 9c4f52ca..f934cff9 100644
--- a/app/Template/board/tasklinks.php
+++ b/app/Template/board/tasklinks.php
@@ -9,6 +9,9 @@
false,
$link['is_active'] ? '' : 'task-link-closed'
) ?>
+ <?php if (! empty($link['task_assignee_username'])): ?>
+ [<?= $this->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>]
+ <?php endif ?>
</li>
<?php endforeach ?>
</ul>
diff --git a/app/Template/tasklink/create.php b/app/Template/tasklink/create.php
index acf9d6d1..3394271a 100644
--- a/app/Template/tasklink/create.php
+++ b/app/Template/tasklink/create.php
@@ -5,7 +5,7 @@
<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" method="post" autocomplete="off">
<?= $this->formCsrf() ?>
- <?= $this->formHidden('task_id', $values) ?>
+ <?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?>
<?= $this->formHidden('opposite_task_id', $values) ?>
<?= $this->formLabel(t('Label'), 'link_id') ?>
@@ -16,7 +16,13 @@
'title',
$values,
$errors,
- array('required', 'data-dst-field="opposite_task_id"', 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"'),
+ array(
+ 'required',
+ 'placeholder="'.t('Start to type task title...').'"',
+ 'title="'.t('Start to type task title...').'"',
+ 'data-dst-field="opposite_task_id"',
+ 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
+ ),
'task-autocomplete') ?>
<div class="form-actions">
diff --git a/app/Template/tasklink/edit.php b/app/Template/tasklink/edit.php
new file mode 100644
index 00000000..267bd627
--- /dev/null
+++ b/app/Template/tasklink/edit.php
@@ -0,0 +1,34 @@
+<div class="page-header">
+ <h2><?= t('Edit a link') ?></h2>
+</div>
+
+<form action="<?= $this->u('tasklink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'link_id' => $task_link['id'])) ?>" method="post" autocomplete="off">
+
+ <?= $this->formCsrf() ?>
+ <?= $this->formHidden('id', $values) ?>
+ <?= $this->formHidden('task_id', $values) ?>
+ <?= $this->formHidden('opposite_task_id', $values) ?>
+
+ <?= $this->formLabel(t('Label'), 'link_id') ?>
+ <?= $this->formSelect('link_id', $labels, $values, $errors) ?>
+
+ <?= $this->formLabel(t('Task'), 'title') ?>
+ <?= $this->formText(
+ 'title',
+ $values,
+ $errors,
+ array(
+ 'required',
+ 'placeholder="'.t('Start to type task title...').'"',
+ 'title="'.t('Start to type task title...').'"',
+ 'data-dst-field="opposite_task_id"',
+ 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
+ ),
+ 'task-autocomplete') ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?= $this->a(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/tasklink/show.php b/app/Template/tasklink/show.php
index 75e3c376..d4a3939b 100644
--- a/app/Template/tasklink/show.php
+++ b/app/Template/tasklink/show.php
@@ -2,63 +2,103 @@
<div class="page-header">
<h2><?= t('Links') ?></h2>
</div>
-<table class="table-fixed" id="links">
+<table id="links">
<tr>
- <th class="column-30"><?= t('Label') ?></th>
- <th class="column-40"><?= t('Task') ?></th>
- <th class="column-20"><?= t('Column') ?></th>
+ <th class="column-20"><?= t('Label') ?></th>
+ <th class="column-30"><?= t('Task') ?></th>
+ <th><?= t('Column') ?></th>
+ <th><?= t('Assignee') ?></th>
<?php if (! isset($not_editable)): ?>
<th><?= t('Action') ?></th>
<?php endif ?>
</tr>
- <?php foreach ($links as $link): ?>
- <tr>
- <td><?= t('This task') ?> <strong><?= t($link['label']) ?></strong></td>
- <?php if (! isset($not_editable)): ?>
+ <?php foreach ($links as $label => $grouped_links): ?>
+ <?php $hide_td = false ?>
+ <?php foreach ($grouped_links as $link): ?>
+ <tr>
+ <?php if (! $hide_td): ?>
+ <td rowspan="<?= count($grouped_links) ?>"><?= t('This task') ?> <strong><?= t($label) ?></strong></td>
+ <?php $hide_td = true ?>
+ <?php endif ?>
+
<td>
- <?= $this->a(
- $this->e('#'.$link['task_id'].' - '.$link['title']),
- 'task', 'show', array('task_id' => $link['task_id'], 'project_id' => $link['project_id']),
- false,
- $link['is_active'] ? '' : 'task-link-closed'
- ) ?>
+ <?php if (! isset($not_editable)): ?>
+ <?= $this->a(
+ $this->e('#'.$link['task_id'].' '.$link['title']),
+ 'task',
+ 'show',
+ array('task_id' => $link['task_id'], 'project_id' => $link['project_id']),
+ false,
+ $link['is_active'] ? '' : 'task-link-closed'
+ ) ?>
+ <?php else: ?>
+ <?= $this->a(
+ $this->e('#'.$link['task_id'].' '.$link['title']),
+ 'task',
+ 'readonly',
+ array('task_id' => $link['task_id'], 'token' => $project['token']),
+ false,
+ $link['is_active'] ? '' : 'task-link-closed'
+ ) ?>
+ <?php endif ?>
+
+ <br/>
+
+ <?php if (! empty($link['task_time_spent'])): ?>
+ <strong><?= $this->e($link['task_time_spent']).'h' ?></strong> <?= t('spent') ?>
+ <?php endif ?>
+
+ <?php if (! empty($link['task_time_estimated'])): ?>
+ <strong><?= $this->e($link['task_time_estimated']).'h' ?></strong> <?= t('estimated') ?>
+ <?php endif ?>
</td>
<td><?= $this->e($link['column_title']) ?></td>
<td>
- <?= $this->a(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?php if (! empty($link['task_assignee_username'])): ?>
+ <?php if (! isset($not_editable)): ?>
+ <?= $this->a($this->e($link['task_assignee_name'] ?: $link['task_assignee_username']), 'user', 'show', array('user_id' => $link['task_assignee_id'])) ?>
+ <?php else: ?>
+ <?= $this->e($link['task_assignee_name'] ?: $link['task_assignee_username']) ?>
+ <?php endif ?>
+ <?php endif ?>
</td>
- <?php else: ?>
+ <?php if (! isset($not_editable)): ?>
<td>
- <?= $this->a(
- $this->e('#'.$link['task_id'].' - '.$link['title']),
- 'task', 'readonly', array('task_id' => $link['task_id'], 'token' => $project['token']),
- false,
- $link['is_active'] ? '' : 'task-link-closed'
- ) ?>
+ <ul>
+ <li><?= $this->a(t('Edit'), 'tasklink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
+ <li><?= $this->a(t('Remove'), 'tasklink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
+ </ul>
</td>
- <td><?= $this->e($link['column_title']) ?></td>
- <?php endif ?>
- </tr>
+ <?php endif ?>
+ </tr>
+ <?php endforeach ?>
<?php endforeach ?>
</table>
<?php if (! isset($not_editable) && isset($link_label_list)): ?>
<form action="<?= $this->u('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>" method="post" autocomplete="off">
-
+
<?= $this->formCsrf() ?>
<?= $this->formHidden('task_id', array('task_id' => $task['id'])) ?>
<?= $this->formHidden('opposite_task_id', array()) ?>
-
+
<?= $this->formSelect('link_id', $link_label_list, array(), array()) ?>
-
+
<?= $this->formText(
'title',
array(),
array(),
- array('required', 'data-dst-field="opposite_task_id"', 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"'),
+ array(
+ 'required',
+ 'placeholder="'.t('Start to type task title...').'"',
+ 'title="'.t('Start to type task title...').'"',
+ 'data-dst-field="opposite_task_id"',
+ 'data-search-url="'.$this->u('app', 'autocomplete', array('exclude_task_id' => $task['id'])).'"',
+ ),
'task-autocomplete') ?>
-
+
<input type="submit" value="<?= t('Add') ?>" class="btn btn-blue"/>
</form>
<?php endif ?>
+
<?php endif ?>
diff --git a/app/common.php b/app/common.php
index a434a73f..01c3077b 100644
--- a/app/common.php
+++ b/app/common.php
@@ -11,6 +11,7 @@ if (getenv('DATABASE_URL')) {
define('DB_USERNAME', $dbopts["user"]);
define('DB_PASSWORD', $dbopts["pass"]);
define('DB_HOSTNAME', $dbopts["host"]);
+ define('DB_PORT', isset($dbopts["port"]) ? $dbopts["port"] : null);
define('DB_NAME', ltrim($dbopts["path"],'/'));
}
diff --git a/assets/css/app.css b/assets/css/app.css
index f03aa7d6..7ab009a5 100644
--- a/assets/css/app.css
+++ b/assets/css/app.css
@@ -262,6 +262,10 @@ select {
max-width: 95%;
}
+select:focus {
+ outline: 0;
+}
+
::-webkit-input-placeholder {
color: #ddd;
padding-top: 2px;
@@ -763,7 +767,7 @@ nav .active a {
}
.public-task {
- max-width: 700px;
+ max-width: 800px;
margin: 0 auto;
margin-top: 5px;
}
diff --git a/assets/css/print.css b/assets/css/print.css
index b2cbfb64..3069b194 100644
--- a/assets/css/print.css
+++ b/assets/css/print.css
@@ -157,7 +157,7 @@ th a:hover {
}
.public-task {
- max-width: 700px;
+ max-width: 800px;
margin: 0 auto;
margin-top: 5px;
}
diff --git a/assets/css/src/board.css b/assets/css/src/board.css
index 630594c0..75df5169 100644
--- a/assets/css/src/board.css
+++ b/assets/css/src/board.css
@@ -13,7 +13,7 @@
}
.public-task {
- max-width: 700px;
+ max-width: 800px;
margin: 0 auto;
margin-top: 5px;
}
diff --git a/assets/css/src/form.css b/assets/css/src/form.css
index 60dccd4c..dc101163 100644
--- a/assets/css/src/form.css
+++ b/assets/css/src/form.css
@@ -57,6 +57,10 @@ select {
max-width: 95%;
}
+select:focus {
+ outline: 0;
+}
+
::-webkit-input-placeholder {
color: #ddd;
padding-top: 2px;
diff --git a/assets/js/app.js b/assets/js/app.js
index 6afc8f95..bdceaf5b 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -141,9 +141,9 @@ $("#popover-content").click(function(a){a.stopPropagation()});$(".close-popover"
return""!=a?"visible"==document[a]:!0},SetStorageItem:function(a,c){"undefined"!==typeof Storage&&localStorage.setItem(a,c)},GetStorageItem:function(a){return"undefined"!==typeof Storage?localStorage.getItem(a):""},MarkdownPreview:function(a){a.preventDefault();var c=$(this),b=$(this).closest("ul"),d=$(".write-area"),e=$(".preview-area"),f=$("textarea");$.ajax({url:"?controller=app&action=preview",contentType:"application/json",type:"POST",processData:!1,dataType:"html",data:JSON.stringify({text:f.val()})}).done(function(a){b.find("li").removeClass("form-tab-selected");
c.parent().addClass("form-tab-selected");e.find(".markdown").html(a);e.css("height",f.css("height"));e.css("width",f.css("width"));d.hide();e.show()})},MarkdownWriter:function(a){a.preventDefault();$(this).closest("ul").find("li").removeClass("form-tab-selected");$(this).parent().addClass("form-tab-selected");$(".write-area").show();$(".preview-area").hide()},CheckSession:function(){$(".form-login").length||$.ajax({cache:!1,url:$("body").data("status-url"),statusCode:{401:function(){window.location=
$("body").data("login-url")}}})},Init:function(){$("#board-selector").chosen({width:180,no_results_text:$("#board-selector").data("notfound")});$("#board-selector").change(function(){window.location=$(this).attr("data-board-url").replace(/PROJECT_ID/g,$(this).val())});window.setInterval(Kanboard.CheckSession,6E4);Mousetrap.bindGlobal("mod+enter",function(){$("form").submit()});Mousetrap.bind("b",function(a){a.preventDefault();$("#board-selector").trigger("chosen:open")});$.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]);
-Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(document).on("click",".popover",Kanboard.Popover);$("input[autofocus]").each(function(a,c){$(this).focus()});$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit({triggerParentEl:"span"});
-$(".task-autocomplete").length&&($(".task-autocomplete").parent().find("input[type=submit]").attr("disabled","disabled"),$(".task-autocomplete").autocomplete({source:$(".task-autocomplete").data("search-url"),minLength:2,select:function(a,c){var b=$(".task-autocomplete").data("dst-field");$("input[name="+b+"]").val(c.item.id);$(".task-autocomplete").parent().find("input[type=submit]").removeAttr("disabled")}}));$(".column-tooltip").tooltip({content:function(){return'<div class="markdown">'+$(this).attr("title")+
-"</div>"},position:{my:"left-20 top",at:"center bottom+9",using:function(a,c){$(this).css(a);var b=c.target.left+c.target.width/2-c.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(c.vertical).addClass(0==b?"align-left":"align-right").appendTo(this)}}});Kanboard.Exists("screenshot-zone")&&Kanboard.Screenshot.Init()}}}();
+Kanboard.InitAfterAjax()},InitAfterAjax:function(){$(document).on("click",".popover",Kanboard.Popover);$("[autofocus]").each(function(a,c){$(this).focus()});$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:"yy-mm-dd",constrainInput:!1});$("#markdown-preview").click(Kanboard.MarkdownPreview);$("#markdown-write").click(Kanboard.MarkdownWriter);$(".auto-select").focus(function(){$(this).select()});$(".dropit-submenu").hide();$(".dropdown").not(".dropit").dropit({triggerParentEl:"span"});
+$(".task-autocomplete").length&&(""==$(".opposite_task_id").val()&&$(".task-autocomplete").parent().find("input[type=submit]").attr("disabled","disabled"),$(".task-autocomplete").autocomplete({source:$(".task-autocomplete").data("search-url"),minLength:1,select:function(a,c){var b=$(".task-autocomplete").data("dst-field");$("input[name="+b+"]").val(c.item.id);$(".task-autocomplete").parent().find("input[type=submit]").removeAttr("disabled")}}));$(".column-tooltip").tooltip({content:function(){return'<div class="markdown">'+
+$(this).attr("title")+"</div>"},position:{my:"left-20 top",at:"center bottom+9",using:function(a,c){$(this).css(a);var b=c.target.left+c.target.width/2-c.element.left-20;$("<div>").addClass("tooltip-arrow").addClass(c.vertical).addClass(0==b?"align-left":"align-right").appendTo(this)}}});Kanboard.Exists("screenshot-zone")&&Kanboard.Screenshot.Init()}}}();
Kanboard.Board=function(){function a(a){a.preventDefault();a.stopPropagation();Kanboard.Popover(a,Kanboard.InitAfterAjax)}function c(){Mousetrap.bind("n",function(){Kanboard.OpenPopover($("#board").data("task-creation-url"),Kanboard.InitAfterAjax)});Mousetrap.bind("s",function(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?(e(),Kanboard.SetStorageItem(d(),"collapsed")):(f(),Kanboard.SetStorageItem(d(),"expanded"))});Mousetrap.bind("c",function(){q()})}function b(){$(".filter-expand-link").click(function(a){a.preventDefault();
f();Kanboard.SetStorageItem(d(),"expanded")});$(".filter-collapse-link").click(function(a){a.preventDefault();e();Kanboard.SetStorageItem(d(),"collapsed")});g()}function d(){return"board_stacking_"+$("#board").data("project-id")}function e(){$(".filter-collapse").hide();$(".task-board-collapsed").show();$(".filter-expand").show();$(".task-board-expanded").hide()}function f(){$(".filter-collapse").show();$(".task-board-collapsed").hide();$(".filter-expand").hide();$(".task-board-expanded").show()}
function g(){"expanded"===(Kanboard.GetStorageItem(d())||"expanded")?f():e()}function h(){$(".column").sortable({delay:300,distance:5,connectWith:".column",placeholder:"draggable-placeholder",stop:function(a,b){k(b.item.attr("data-task-id"),b.item.parent().attr("data-column-id"),b.item.index()+1,b.item.parent().attr("data-swimlane-id"))}});$("#board").on("click",".task-board-popover",a);$("#board").on("click",".task-board",function(){window.location=$(this).data("task-url")});$(".task-board-tooltip").tooltip({track:!1,
diff --git a/assets/js/src/base.js b/assets/js/src/base.js
index 7ca3c234..bf61b1f3 100644
--- a/assets/js/src/base.js
+++ b/assets/js/src/base.js
@@ -200,7 +200,7 @@ var Kanboard = (function() {
$(document).on("click", ".popover", Kanboard.Popover);
// Autofocus fields (html5 autofocus works only with page onload)
- $("input[autofocus]").each(function(index, element) {
+ $("[autofocus]").each(function(index, element) {
$(this).focus();
})
@@ -227,11 +227,14 @@ var Kanboard = (function() {
// Task auto-completion
if ($(".task-autocomplete").length) {
- $(".task-autocomplete").parent().find("input[type=submit]").attr('disabled','disabled');
+
+ if ($('.opposite_task_id').val() == '') {
+ $(".task-autocomplete").parent().find("input[type=submit]").attr('disabled','disabled');
+ }
$(".task-autocomplete").autocomplete({
source: $(".task-autocomplete").data("search-url"),
- minLength: 2,
+ minLength: 1,
select: function(event, ui) {
var field = $(".task-autocomplete").data("dst-field");
$("input[name=" + field + "]").val(ui.item.id);
diff --git a/docs/analytics.markdown b/docs/analytics.markdown
index e088a221..a6685917 100644
--- a/docs/analytics.markdown
+++ b/docs/analytics.markdown
@@ -22,6 +22,8 @@ Cumulative flow diagram
This chart show the number of tasks cumulatively for each column over the time.
+Note: You need to have at least 2 days of data to see the graph.
+
Burndown chart
--------------
@@ -30,4 +32,11 @@ Burndown chart
The [burn down chart](http://en.wikipedia.org/wiki/Burn_down_chart) is available for each project.
This chart is a graphical representation of work left to do versus time.
-Kanboard use the complexity or story point to generate this diagram. \ No newline at end of file
+Kanboard use the complexity or story point to generate this diagram.
+
+Don't forget to run the daily job for stats calculation
+-------------------------------------------------------
+
+To generate accurate analytics data, you should run the daily cronjob **project daily summaries** just before midnight.
+
+[Read the documentation about Kanboard CLI](http://kanboard.net/documentation/cli)
diff --git a/docs/screenshots.markdown b/docs/screenshots.markdown
index 84bf605d..3ec6bc7a 100644
--- a/docs/screenshots.markdown
+++ b/docs/screenshots.markdown
@@ -22,4 +22,4 @@ On Mac OS X, you can use those shortcuts to take screenshots:
There are also several third-party applications that can be used to take screenshots with annotations and shapes.
-Note: This feature doesn't works with all browsers.
+**Note: This feature doesn't works with all browsers.**
diff --git a/tests/units/GitlabWebhookTest.php b/tests/units/GitlabWebhookTest.php
index 0f2a5c12..cea4e839 100644
--- a/tests/units/GitlabWebhookTest.php
+++ b/tests/units/GitlabWebhookTest.php
@@ -88,9 +88,12 @@ class GitlabWebhookTest extends Base
// Create a task with the issue reference
$this->assertEquals(1, $tc->create(array('title' => 'A', 'project_id' => 1, 'reference' => 103361)));
- $task = $tf->getByReference(103361);
+ $task = $tf->getByReference(1, 103361);
$this->assertNotEmpty($task);
+ $task = $tf->getByReference(2, 103361);
+ $this->assertEmpty($task);
+
$this->assertTrue($g->handleIssueClosed($event['object_attributes']));
$called = $this->container['dispatcher']->getCalledListeners();
diff --git a/tests/units/LinkTest.php b/tests/units/LinkTest.php
index ebcbcd39..076e1b3b 100644
--- a/tests/units/LinkTest.php
+++ b/tests/units/LinkTest.php
@@ -36,6 +36,18 @@ class LinkTest extends Base
$this->assertNotEquals($link1['opposite_id'], $link2['opposite_id']);
}
+ public function testGetOppositeLinkId()
+ {
+ $l = new Link($this->container);
+
+ $this->assertTrue($l->create('Link A'));
+ $this->assertTrue($l->create('Link B', 'Link C'));
+
+ $this->assertEquals(1, $l->getOppositeLinkId(1));
+ $this->assertEquals(3, $l->getOppositeLinkId(2));
+ $this->assertEquals(2, $l->getOppositeLinkId(3));
+ }
+
public function testUpdate()
{
$l = new Link($this->container);
diff --git a/tests/units/TaskLinkTest.php b/tests/units/TaskLinkTest.php
index b78ffd28..e213e25a 100644
--- a/tests/units/TaskLinkTest.php
+++ b/tests/units/TaskLinkTest.php
@@ -18,9 +18,9 @@ class TaskLinkTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
$this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
- $this->assertTrue($tl->create(1, 2, 1));
+ $this->assertEquals(1, $tl->create(1, 2, 1));
- $links = $tl->getLinks(1);
+ $links = $tl->getAll(1);
$this->assertNotEmpty($links);
$this->assertCount(1, $links);
$this->assertEquals('relates to', $links[0]['label']);
@@ -28,13 +28,27 @@ class TaskLinkTest extends Base
$this->assertEquals(2, $links[0]['task_id']);
$this->assertEquals(1, $links[0]['is_active']);
- $links = $tl->getLinks(2);
+ $links = $tl->getAll(2);
$this->assertNotEmpty($links);
$this->assertCount(1, $links);
$this->assertEquals('relates to', $links[0]['label']);
$this->assertEquals('A', $links[0]['title']);
$this->assertEquals(1, $links[0]['task_id']);
$this->assertEquals(1, $links[0]['is_active']);
+
+ $task_link = $tl->getById(1);
+ $this->assertNotEmpty($task_link);
+ $this->assertEquals(1, $task_link['id']);
+ $this->assertEquals(1, $task_link['task_id']);
+ $this->assertEquals(2, $task_link['opposite_task_id']);
+ $this->assertEquals(1, $task_link['link_id']);
+
+ $opposite_task_link = $tl->getOppositeTaskLink($task_link);
+ $this->assertNotEmpty($opposite_task_link);
+ $this->assertEquals(2, $opposite_task_link['id']);
+ $this->assertEquals(2, $opposite_task_link['task_id']);
+ $this->assertEquals(1, $opposite_task_link['opposite_task_id']);
+ $this->assertEquals(1, $opposite_task_link['link_id']);
}
public function testCreateTaskLinkWithOpposite()
@@ -46,9 +60,9 @@ class TaskLinkTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
$this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
- $this->assertTrue($tl->create(1, 2, 2));
+ $this->assertEquals(1, $tl->create(1, 2, 2));
- $links = $tl->getLinks(1);
+ $links = $tl->getAll(1);
$this->assertNotEmpty($links);
$this->assertCount(1, $links);
$this->assertEquals('blocks', $links[0]['label']);
@@ -56,13 +70,60 @@ class TaskLinkTest extends Base
$this->assertEquals(2, $links[0]['task_id']);
$this->assertEquals(1, $links[0]['is_active']);
- $links = $tl->getLinks(2);
+ $links = $tl->getAll(2);
$this->assertNotEmpty($links);
$this->assertCount(1, $links);
$this->assertEquals('is blocked by', $links[0]['label']);
$this->assertEquals('A', $links[0]['title']);
$this->assertEquals(1, $links[0]['task_id']);
$this->assertEquals(1, $links[0]['is_active']);
+
+ $task_link = $tl->getById(1);
+ $this->assertNotEmpty($task_link);
+ $this->assertEquals(1, $task_link['id']);
+ $this->assertEquals(1, $task_link['task_id']);
+ $this->assertEquals(2, $task_link['opposite_task_id']);
+ $this->assertEquals(2, $task_link['link_id']);
+
+ $opposite_task_link = $tl->getOppositeTaskLink($task_link);
+ $this->assertNotEmpty($opposite_task_link);
+ $this->assertEquals(2, $opposite_task_link['id']);
+ $this->assertEquals(2, $opposite_task_link['task_id']);
+ $this->assertEquals(1, $opposite_task_link['opposite_task_id']);
+ $this->assertEquals(3, $opposite_task_link['link_id']);
+ }
+
+ public function testUpdate()
+ {
+ $tl = new TaskLink($this->container);
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test1')));
+ $this->assertEquals(2, $p->create(array('name' => 'test2')));
+ $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $tc->create(array('project_id' => 2, 'title' => 'B')));
+ $this->assertEquals(3, $tc->create(array('project_id' => 1, 'title' => 'C')));
+
+ $this->assertEquals(1, $tl->create(1, 2, 5));
+ $this->assertTrue($tl->update(1, 1, 3, 11));
+
+ $links = $tl->getAll(1);
+ $this->assertNotEmpty($links);
+ $this->assertCount(1, $links);
+ $this->assertEquals('is fixed by', $links[0]['label']);
+ $this->assertEquals('C', $links[0]['title']);
+ $this->assertEquals(3, $links[0]['task_id']);
+
+ $links = $tl->getAll(2);
+ $this->assertEmpty($links);
+
+ $links = $tl->getAll(3);
+ $this->assertNotEmpty($links);
+ $this->assertCount(1, $links);
+ $this->assertEquals('fixes', $links[0]['label']);
+ $this->assertEquals('A', $links[0]['title']);
+ $this->assertEquals(1, $links[0]['task_id']);
}
public function testRemove()
@@ -74,35 +135,51 @@ class TaskLinkTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
$this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
- $this->assertTrue($tl->create(1, 2, 2));
+ $this->assertEquals(1, $tl->create(1, 2, 2));
- $links = $tl->getLinks(1);
+ $links = $tl->getAll(1);
$this->assertNotEmpty($links);
- $links = $tl->getLinks(2);
+ $links = $tl->getAll(2);
$this->assertNotEmpty($links);
$this->assertTrue($tl->remove($links[0]['id']));
- $links = $tl->getLinks(1);
+ $links = $tl->getAll(1);
$this->assertEmpty($links);
- $links = $tl->getLinks(2);
+ $links = $tl->getAll(2);
$this->assertEmpty($links);
}
public function testValidation()
{
$tl = new TaskLink($this->container);
+ $p = new Project($this->container);
+ $tc = new TaskCreation($this->container);
- $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1, 'title' => 'a'));
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
+ $this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
+
+ $links = $tl->getAll(1);
+ $this->assertEmpty($links);
+
+ $links = $tl->getAll(2);
+ $this->assertEmpty($links);
+
+ // Check validation
+ $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 2));
$this->assertTrue($r[0]);
$r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1));
$this->assertFalse($r[0]);
- $r = $tl->validateCreation(array('task_id' => 1, 'title' => 'a'));
+ $r = $tl->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
+ $this->assertFalse($r[0]);
+
+ $r = $tl->validateCreation(array('task_id' => 1, 'opposite_task_id' => 2));
$this->assertFalse($r[0]);
- $r = $tl->validateCreation(array('link_id' => 1, 'title' => 'a'));
+ $r = $tl->validateCreation(array('task_id' => 1, 'link_id' => 1, 'opposite_task_id' => 1));
$this->assertFalse($r[0]);
}
}