summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-10-08 09:53:46 -0400
committerFrederic Guillot <fred@kanboard.net>2016-10-08 09:53:46 -0400
commit5e2e0272ed78e3b729d5673da3e957ce68a30fa2 (patch)
treef83973ae51d53ab62b1b89afd6559e5056be6457
parente5c449788a4239720b34e15d7441ff996c11231b (diff)
Send absolute links in email notifications
-rw-r--r--app/Helper/UrlHelper.php41
-rw-r--r--app/Template/notification/footer.php4
-rw-r--r--app/Template/notification/task_internal_link_create_update.php2
-rw-r--r--app/Template/notification/task_internal_link_delete.php2
-rw-r--r--app/Template/notification/task_open.php2
-rw-r--r--app/Template/notification/task_overdue.php8
-rw-r--r--app/Template/task_internal_link/table.php10
7 files changed, 45 insertions, 24 deletions
diff --git a/app/Helper/UrlHelper.php b/app/Helper/UrlHelper.php
index 2127c69e..93177ed5 100644
--- a/app/Helper/UrlHelper.php
+++ b/app/Helper/UrlHelper.php
@@ -51,20 +51,35 @@ class UrlHelper extends Base
* Link element
*
* @access public
- * @param string $label Link label
- * @param string $controller Controller name
- * @param string $action Action name
- * @param array $params Url parameters
- * @param boolean $csrf Add a CSRF token
- * @param string $class CSS class attribute
- * @param string $title
- * @param boolean $new_tab Open the link in a new tab
- * @param string $anchor Link Anchor
+ * @param string $label Link label
+ * @param string $controller Controller name
+ * @param string $action Action name
+ * @param array $params Url parameters
+ * @param boolean $csrf Add a CSRF token
+ * @param string $class CSS class attribute
+ * @param string $title Link title
+ * @param boolean $new_tab Open the link in a new tab
+ * @param string $anchor Link Anchor
+ * @param bool $absolute
+ * @return string
+ */
+ public function link($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false, $anchor = '', $absolute = false)
+ {
+ return '<a href="'.$this->href($controller, $action, $params, $csrf, $anchor, $absolute).'" class="'.$class.'" title=\''.$title.'\' '.($new_tab ? 'target="_blank"' : '').'>'.$label.'</a>';
+ }
+
+ /**
+ * Absolute link
+ *
+ * @param string $label
+ * @param string $controller
+ * @param string $action
+ * @param array $params
* @return string
*/
- public function link($label, $controller, $action, array $params = array(), $csrf = false, $class = '', $title = '', $new_tab = false, $anchor = '')
+ public function absoluteLink($label, $controller, $action, array $params = array())
{
- return '<a href="'.$this->href($controller, $action, $params, $csrf, $anchor).'" class="'.$class.'" title=\''.$title.'\' '.($new_tab ? 'target="_blank"' : '').'>'.$label.'</a>';
+ return $this->link($label, $controller, $action, $params, false, '', '', true, '', true);
}
/**
@@ -155,7 +170,7 @@ class UrlHelper extends Base
/**
* Build relative url
*
- * @access private
+ * @access protected
* @param string $separator Querystring argument separator
* @param string $controller Controller name
* @param string $action Action name
@@ -165,7 +180,7 @@ class UrlHelper extends Base
* @param boolean $absolute Absolute or relative link
* @return string
*/
- private function build($separator, $controller, $action, array $params = array(), $csrf = false, $anchor = '', $absolute = false)
+ protected function build($separator, $controller, $action, array $params = array(), $csrf = false, $anchor = '', $absolute = false)
{
$path = $this->route->findUrl($controller, $action, $params);
$qs = array();
diff --git a/app/Template/notification/footer.php b/app/Template/notification/footer.php
index 6ac260cb..da437eea 100644
--- a/app/Template/notification/footer.php
+++ b/app/Template/notification/footer.php
@@ -2,6 +2,6 @@
Kanboard
<?php if (isset($application_url) && ! empty($application_url)): ?>
- - <a href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the task on Kanboard') ?></a>
- - <a href="<?= $this->url->href('BoardViewController', 'show', array('project_id' => $task['project_id']), false, '', true) ?>"><?= t('view the board on Kanboard') ?></a>
+ - <?= $this->url->absoluteLink(t('view the task on Kanboard'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
+ - <?= $this->url->absoluteLink(t('view the board on Kanboard'), 'BoardViewController', 'show', array('project_id' => $task['project_id'])) ?>
<?php endif ?>
diff --git a/app/Template/notification/task_internal_link_create_update.php b/app/Template/notification/task_internal_link_create_update.php
index 73cad84d..b66a1531 100644
--- a/app/Template/notification/task_internal_link_create_update.php
+++ b/app/Template/notification/task_internal_link_create_update.php
@@ -3,7 +3,7 @@
<p>
<?= e(
'This task is now linked to the task %s with the relation "%s"',
- $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id'])),
+ $this->url->absoluteLink(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id'])),
$this->text->e($task_link['label'])
) ?>
</p>
diff --git a/app/Template/notification/task_internal_link_delete.php b/app/Template/notification/task_internal_link_delete.php
index bb54e0a7..d556fb20 100644
--- a/app/Template/notification/task_internal_link_delete.php
+++ b/app/Template/notification/task_internal_link_delete.php
@@ -4,7 +4,7 @@
<?= e(
'The link with the relation "%s" to the task %s have been removed',
$this->text->e($task_link['label']),
- $this->url->link(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id']))
+ $this->url->absoluteLink(t('#%d', $task_link['opposite_task_id']), 'TaskViewController', 'show', array('task_id' => $task_link['opposite_task_id']))
) ?>
</p>
diff --git a/app/Template/notification/task_open.php b/app/Template/notification/task_open.php
index 6eb4ec08..2c85e9f7 100644
--- a/app/Template/notification/task_open.php
+++ b/app/Template/notification/task_open.php
@@ -2,4 +2,4 @@
<p><?= t('The task #%d have been opened.', $task['id']) ?></p>
-<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file
+<?= $this->render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?>
diff --git a/app/Template/notification/task_overdue.php b/app/Template/notification/task_overdue.php
index 406e41f7..01ad0a01 100644
--- a/app/Template/notification/task_overdue.php
+++ b/app/Template/notification/task_overdue.php
@@ -13,16 +13,16 @@
<tr style="overflow: hidden; background: #fff; text-align: left; padding-top: .5em; padding-bottom: .5em; padding-left: 3px; padding-right: 3px;">
<td style="border: 1px solid #eee;">#<?= $task['id'] ?></td>
<td style="border: 1px solid #eee;">
- <?php if ($application_url): ?>
- <a href="<?= $this->url->href('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, '', true) ?>"><?= $this->text->e($task['title']) ?></a>
+ <?php if (! empty($application_url)): ?>
+ <?= $this->url->absoluteLink($this->text->e($task['title']), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
<?php else: ?>
<?= $this->text->e($task['title']) ?>
<?php endif ?>
</td>
<td style="border: 1px solid #eee;"><?= $this->dt->date($task['date_due']) ?></td>
- <td style="border: 1px solid #eee;"><?= $task['project_name'] ?></td>
+ <td style="border: 1px solid #eee;"><?= $this->text->e($task['project_name']) ?></td>
<td style="border: 1px solid #eee;">
- <?php if ($task['assignee_username']): ?>
+ <?php if (! empty($task['assignee_username'])): ?>
<?= $this->text->e($task['assignee_name'] ?: $task['assignee_username']) ?>
<?php endif ?>
</td>
diff --git a/app/Template/task_internal_link/table.php b/app/Template/task_internal_link/table.php
index 6584a33a..3a3a2b88 100644
--- a/app/Template/task_internal_link/table.php
+++ b/app/Template/task_internal_link/table.php
@@ -72,8 +72,14 @@
<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'), 'TaskInternalLinkController', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
- <li><?= $this->url->link(t('Remove'), 'TaskInternalLinkController', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?></li>
+ <li>
+ <i class="fa fa-edit fa-fw"></i>
+ <?= $this->url->link(t('Edit'), 'TaskInternalLinkController', 'edit', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
+ </li>
+ <li>
+ <i class="fa fa-trash-o fa-fw"></i>
+ <?= $this->url->link(t('Remove'), 'TaskInternalLinkController', 'confirm', array('link_id' => $link['id'], 'task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'popover') ?>
+ </li>
</ul>
</div>
</td>