summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
commit5c92f467867b43034b9e66b46b3b465ba9db655c (patch)
treecb0855ea64d8bba3abe4dfe978c5dbabb745911d /app/Template
parentec66a779c9158830fe4bb0f96a44eadfe697ef00 (diff)
Add external links for tasks with plugin api
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/board/task_footer.php6
-rw-r--r--app/Template/board/task_menu.php1
-rw-r--r--app/Template/board/tooltip_external_links.php20
-rw-r--r--app/Template/comment/create.php4
-rw-r--r--app/Template/task/comments.php3
-rw-r--r--app/Template/task/show.php17
-rw-r--r--app/Template/task/sidebar.php22
-rw-r--r--app/Template/task_creation/form.php2
-rw-r--r--app/Template/task_external_link/create.php13
-rw-r--r--app/Template/task_external_link/edit.php13
-rw-r--r--app/Template/task_external_link/find.php32
-rw-r--r--app/Template/task_external_link/form.php13
-rw-r--r--app/Template/task_external_link/remove.php15
-rw-r--r--app/Template/task_external_link/show.php50
-rw-r--r--app/Template/tasklink/create.php4
-rw-r--r--app/Template/tasklink/show.php12
16 files changed, 204 insertions, 23 deletions
diff --git a/app/Template/board/task_footer.php b/app/Template/board/task_footer.php
index 26f3b1d4..1912dd83 100644
--- a/app/Template/board/task_footer.php
+++ b/app/Template/board/task_footer.php
@@ -35,7 +35,11 @@
<?php endif ?>
<?php if (! empty($task['nb_links'])): ?>
- <span title="<?= t('Links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork"></i>&nbsp;<?= $task['nb_links'] ?></span>
+ <span title="<?= t('Links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'tasklinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-code-fork fa-fw"></i><?= $task['nb_links'] ?></span>
+ <?php endif ?>
+
+ <?php if (! empty($task['nb_external_links'])): ?>
+ <span title="<?= t('External links') ?>" class="tooltip" data-href="<?= $this->url->href('BoardTooltip', 'externallinks', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>"><i class="fa fa-external-link fa-fw"></i><?= $task['nb_external_links'] ?></span>
<?php endif ?>
<?php if (! empty($task['nb_subtasks'])): ?>
diff --git a/app/Template/board/task_menu.php b/app/Template/board/task_menu.php
index b5ed125d..9e26e15b 100644
--- a/app/Template/board/task_menu.php
+++ b/app/Template/board/task_menu.php
@@ -7,6 +7,7 @@
<li><i class="fa fa-pencil-square-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Edit this task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-comment-o fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-code-fork fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
+ <li><i class="fa fa-external-link fa-fw"></i>&nbsp;<?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<li><i class="fa fa-camera fa-fw"></i>&nbsp;<?= $this->url->link(t('Add a screenshot'), 'BoardPopover', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
<?php if ($task['is_active'] == 1): ?>
<li><i class="fa fa-close fa-fw"></i>&nbsp;<?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'redirect' => 'board'), false, 'popover') ?></li>
diff --git a/app/Template/board/tooltip_external_links.php b/app/Template/board/tooltip_external_links.php
new file mode 100644
index 00000000..7681c06c
--- /dev/null
+++ b/app/Template/board/tooltip_external_links.php
@@ -0,0 +1,20 @@
+<table class="table-striped table-small">
+ <tr>
+ <th class="column-20"><?= t('Type') ?></th>
+ <th class="column-80"><?= t('Title') ?></th>
+ <th class="column-10"><?= t('Dependency') ?></th>
+ </tr>
+ <?php foreach ($links as $link): ?>
+ <tr>
+ <td>
+ <?= $link['type'] ?>
+ </td>
+ <td>
+ <a href="<?= $link['url'] ?>" target="_blank"><?= $this->e($link['title']) ?></a>
+ </td>
+ <td>
+ <?= $this->e($link['dependency_label']) ?>
+ </td>
+ </tr>
+ <?php endforeach ?>
+</table> \ No newline at end of file
diff --git a/app/Template/comment/create.php b/app/Template/comment/create.php
index e9a6404d..8ce9aac3 100644
--- a/app/Template/comment/create.php
+++ b/app/Template/comment/create.php
@@ -2,7 +2,7 @@
<h2><?= t('Add a comment') ?></h2>
</div>
-<form method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" autocomplete="off" class="form-comment">
+<form method="post" action="<?= $this->url->href('comment', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" autocomplete="off" class="form-comment">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('task_id', $values) ?>
<?= $this->form->hidden('user_id', $values) ?>
@@ -41,7 +41,7 @@
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?php if (! isset($skip_cancel)): ?>
<?= t('or') ?>
- <?php if (isset($ajax)): ?>
+ <?php if ($ajax): ?>
<?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id'])) ?>
<?php else: ?>
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
diff --git a/app/Template/task/comments.php b/app/Template/task/comments.php
index 57fb305f..ef85287b 100644
--- a/app/Template/task/comments.php
+++ b/app/Template/task/comments.php
@@ -28,7 +28,8 @@
'task_id' => $task['id'],
),
'errors' => array(),
- 'task' => $task
+ 'task' => $task,
+ 'ajax' => $ajax,
)) ?>
<?php endif ?>
</div>
diff --git a/app/Template/task/show.php b/app/Template/task/show.php
index f6d47e53..b848d49e 100644
--- a/app/Template/task/show.php
+++ b/app/Template/task/show.php
@@ -13,14 +13,6 @@
<?= $this->render('task/description', array('task' => $task)) ?>
-<?= $this->render('tasklink/show', array(
- 'task' => $task,
- 'links' => $links,
- 'link_label_list' => $link_label_list,
- 'editable' => $this->user->hasProjectAccess('tasklink', 'edit', $project['id']),
- 'is_public' => false,
-)) ?>
-
<?= $this->render('subtask/show', array(
'task' => $task,
'subtasks' => $subtasks,
@@ -29,6 +21,14 @@
'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']),
)) ?>
+<?= $this->render('tasklink/show', array(
+ 'task' => $task,
+ 'links' => $links,
+ 'link_label_list' => $link_label_list,
+ 'editable' => $this->user->hasProjectAccess('tasklink', 'edit', $project['id']),
+ 'is_public' => false,
+)) ?>
+
<?= $this->render('task/time_tracking_summary', array('task' => $task)) ?>
<?= $this->render('file/show', array(
@@ -42,4 +42,5 @@
'comments' => $comments,
'project' => $project,
'editable' => $this->user->hasProjectAccess('comment', 'edit', $project['id']),
+ 'ajax' => $ajax,
)) ?>
diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php
index f522c1c4..b5a2c4b4 100644
--- a/app/Template/task/sidebar.php
+++ b/app/Template/task/sidebar.php
@@ -21,6 +21,25 @@
<?= $this->hook->render('template:task:sidebar:information') ?>
</ul>
+
+ <h2><?= t('Links') ?></h2>
+ <ul>
+ <li <?= $this->app->checkMenuSelection('tasklink', 'show') ?>>
+ <?= $this->url->link(t('View internal links'), 'tasklink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('TaskExternalLink', 'show') ?>>
+ <?= $this->url->link(t('View external links'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </li>
+ <?php if ($this->user->hasProjectAccess('tasklink', 'create', $task['project_id'])): ?>
+ <li <?= $this->app->checkMenuSelection('tasklink', 'create') ?>>
+ <?= $this->url->link(t('Add internal link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </li>
+ <li <?= $this->app->checkMenuSelection('TaskExternalLink', 'find') ?>>
+ <?= $this->url->link(t('Add external link'), 'TaskExternalLink', 'find', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </li>
+ <?php endif ?>
+ </ul>
+
<?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?>
<h2><?= t('Actions') ?></h2>
<ul>
@@ -36,9 +55,6 @@
<li <?= $this->app->checkMenuSelection('subtask', 'create') ?>>
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->checkMenuSelection('tasklink', 'create') ?>>
- <?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
- </li>
<li <?= $this->app->checkMenuSelection('comment', 'create') ?>>
<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
diff --git a/app/Template/task_creation/form.php b/app/Template/task_creation/form.php
index eaf9024d..01b000f2 100644
--- a/app/Template/task_creation/form.php
+++ b/app/Template/task_creation/form.php
@@ -10,7 +10,7 @@
</div>
<?php endif ?>
-<form id="task-form" method="post" action="<?= $this->url->href('taskcreation', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off">
+<form id="task-form" class="popover-form" method="post" action="<?= $this->url->href('taskcreation', 'save', array('project_id' => $values['project_id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
diff --git a/app/Template/task_external_link/create.php b/app/Template/task_external_link/create.php
new file mode 100644
index 00000000..3179d6af
--- /dev/null
+++ b/app/Template/task_external_link/create.php
@@ -0,0 +1,13 @@
+<div class="page-header">
+ <h2><?= t('Add a new external link') ?></h2>
+</div>
+
+<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" method="post" autocomplete="off">
+ <?= $this->render('task_external_link/form', array('task' => $task, 'dependencies' => $dependencies, 'values' => $values, 'errors' => $errors)) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/task_external_link/edit.php b/app/Template/task_external_link/edit.php
new file mode 100644
index 00000000..cf9ddfed
--- /dev/null
+++ b/app/Template/task_external_link/edit.php
@@ -0,0 +1,13 @@
+<div class="page-header">
+ <h2><?= t('Edit external link') ?></h2>
+</div>
+
+<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'update', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" method="post" autocomplete="off">
+ <?= $this->render('task_external_link/form', array('task' => $task, 'dependencies' => $dependencies, 'values' => $values, 'errors' => $errors)) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/task_external_link/find.php b/app/Template/task_external_link/find.php
new file mode 100644
index 00000000..a2304014
--- /dev/null
+++ b/app/Template/task_external_link/find.php
@@ -0,0 +1,32 @@
+<div class="page-header">
+ <h2><?= t('Add a new external link') ?></h2>
+</div>
+
+<form class="popover-form" action="<?= $this->url->href('TaskExternalLink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" method="post" autocomplete="off">
+ <?= $this->form->csrf() ?>
+ <?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
+
+ <?= $this->form->label(t('External link'), 'text') ?>
+ <?= $this->form->text(
+ 'text',
+ $values,
+ $errors,
+ array(
+ 'required',
+ 'autofocus',
+ 'placeholder="'.t('Copy and paste your link here...').'"',
+ )) ?>
+
+ <?= $this->form->label(t('Link type'), 'type') ?>
+ <?= $this->form->select('type', $types, $values) ?>
+
+ <div class="form-actions">
+ <input type="submit" value="<?= t('Next') ?>" class="btn btn-blue"/>
+ <?= t('or') ?>
+ <?php if ($ajax): ?>
+ <?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?>
+ <?php else: ?>
+ <?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ <?php endif ?>
+ </div>
+</form> \ No newline at end of file
diff --git a/app/Template/task_external_link/form.php b/app/Template/task_external_link/form.php
new file mode 100644
index 00000000..932ca521
--- /dev/null
+++ b/app/Template/task_external_link/form.php
@@ -0,0 +1,13 @@
+<?= $this->form->csrf() ?>
+<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
+<?= $this->form->hidden('id', $values) ?>
+<?= $this->form->hidden('link_type', $values) ?>
+
+<?= $this->form->label(t('URL'), 'url') ?>
+<?= $this->form->text('url', $values, $errors, array('required')) ?>
+
+<?= $this->form->label(t('Title'), 'title') ?>
+<?= $this->form->text('title', $values, $errors, array('required')) ?>
+
+<?= $this->form->label(t('Dependency'), 'dependency') ?>
+<?= $this->form->select('dependency', $dependencies, $values, $errors) ?>
diff --git a/app/Template/task_external_link/remove.php b/app/Template/task_external_link/remove.php
new file mode 100644
index 00000000..f55e751c
--- /dev/null
+++ b/app/Template/task_external_link/remove.php
@@ -0,0 +1,15 @@
+<div class="page-header">
+ <h2><?= t('Remove a link') ?></h2>
+</div>
+
+<div class="confirm">
+ <p class="alert alert-info">
+ <?= t('Do you really want to remove this link: "%s"?', $link['title']) ?>
+ </p>
+
+ <div class="form-actions">
+ <?= $this->url->link(t('Yes'), 'TaskExternalLink', 'remove', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), true, 'btn btn-red') ?>
+ <?= t('or') ?>
+ <?= $this->url->link(t('cancel'), 'TaskExternalLink', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/Template/task_external_link/show.php b/app/Template/task_external_link/show.php
new file mode 100644
index 00000000..7e8b1948
--- /dev/null
+++ b/app/Template/task_external_link/show.php
@@ -0,0 +1,50 @@
+<div class="page-header">
+ <h2><?= t('External links') ?></h2>
+</div>
+
+<?php if (empty($links)): ?>
+ <p class="alert"><?= t('There is no external link for the moment.') ?></p>
+<?php else: ?>
+ <table class="table-stripped table-small">
+ <tr>
+ <th class="column-10"><?= t('Type') ?></th>
+ <th><?= t('Title') ?></th>
+ <th class="column-10"><?= t('Dependency') ?></th>
+ <th class="column-15"><?= t('Creator') ?></th>
+ <th class="column-15"><?= t('Date') ?></th>
+ <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?>
+ <th class="column-5"><?= t('Action') ?></th>
+ <?php endif ?>
+ </tr>
+ <?php foreach ($links as $link): ?>
+ <tr>
+ <td>
+ <?= $link['type'] ?>
+ </td>
+ <td>
+ <a href="<?= $link['url'] ?>" target="_blank"><?= $this->e($link['title']) ?></a>
+ </td>
+ <td>
+ <?= $this->e($link['dependency_label']) ?>
+ </td>
+ <td>
+ <?= $this->e($link['creator_name'] ?: $link['creator_username']) ?>
+ </td>
+ <td>
+ <?= dt('%B %e, %Y', $link['date_creation']) ?>
+ </td>
+ <?php if ($this->user->hasProjectAccess('TaskExternalLink', 'edit', $task['project_id'])): ?>
+ <td>
+ <div class="dropdown">
+ <a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>
+ <ul>
+ <li><?= $this->url->link(t('Edit'), 'TaskExternalLink', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
+ <li><?= $this->url->link(t('Remove'), 'TaskExternalLink', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?></li>
+ </ul>
+ </div>
+ </td>
+ <?php endif ?>
+ </tr>
+ <?php endforeach ?>
+ </table>
+<?php endif ?>
diff --git a/app/Template/tasklink/create.php b/app/Template/tasklink/create.php
index 2832bdc7..f4c3cdae 100644
--- a/app/Template/tasklink/create.php
+++ b/app/Template/tasklink/create.php
@@ -2,7 +2,7 @@
<h2><?= t('Add a new link') ?></h2>
</div>
-<form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => isset($ajax))) ?>" method="post" autocomplete="off">
+<form action="<?= $this->url->href('tasklink', 'save', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'ajax' => $ajax)) ?>" method="post" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->hidden('task_id', array('task_id' => $task['id'])) ?>
@@ -28,7 +28,7 @@
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/>
<?= t('or') ?>
- <?php if (isset($ajax)): ?>
+ <?php if ($ajax): ?>
<?= $this->url->link(t('cancel'), 'board', 'show', array('project_id' => $task['project_id']), false, 'close-popover') ?>
<?php else: ?>
<?= $this->url->link(t('cancel'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
diff --git a/app/Template/tasklink/show.php b/app/Template/tasklink/show.php
index 5843da17..11b12b73 100644
--- a/app/Template/tasklink/show.php
+++ b/app/Template/tasklink/show.php
@@ -1,15 +1,17 @@
-<?php if (! empty($links)): ?>
<div class="page-header">
- <h2><?= t('Links') ?></h2>
+ <h2><?= t('Internal links') ?></h2>
</div>
-<table id="links">
+<?php if (empty($links)): ?>
+ <p class="alert"><?= t('There is no internal link for the moment.') ?></p>
+<?php else: ?>
+<table id="links" class="table-small table-stripped">
<tr>
<th class="column-20"><?= t('Label') ?></th>
<th class="column-30"><?= t('Task') ?></th>
<th class="column-20"><?= t('Project') ?></th>
<th><?= t('Column') ?></th>
<th><?= t('Assignee') ?></th>
- <?php if ($editable): ?>
+ <?php if ($editable && $this->user->hasProjectAccess('Tasklink', 'edit', $task['project_id'])): ?>
<th class="column-5"><?= t('Action') ?></th>
<?php endif ?>
</tr>
@@ -64,7 +66,7 @@
<?php endif ?>
<?php endif ?>
</td>
- <?php if ($editable): ?>
+ <?php if ($editable && $this->user->hasProjectAccess('Tasklink', 'edit', $task['project_id'])): ?>
<td>
<div class="dropdown">
<a href="#" class="dropdown-menu dropdown-menu-link-icon"><i class="fa fa-cog fa-fw"></i><i class="fa fa-caret-down"></i></a>