summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBlueTeck <tili2@gmx.de>2015-10-10 17:23:41 +0200
committerBlueTeck <tili2@gmx.de>2015-10-10 17:23:41 +0200
commitc9ce5962a61d648f95d03a270ae485449f139ab7 (patch)
tree368924c2917891ff88c2b3dfad99dd1d8a9d0e6e /app
parente3521db6a83639b409e2dd7abb19417f3ac0a9cd (diff)
#1340 add append/replace option to dustom filters
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Customfilter.php4
-rw-r--r--app/Model/CustomFilter.php3
-rw-r--r--app/Schema/Mysql.php7
-rw-r--r--app/Schema/Postgres.php7
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/custom_filter/add.php4
-rw-r--r--app/Template/custom_filter/edit.php6
-rw-r--r--app/Template/custom_filter/index.php10
-rw-r--r--app/Template/project/filters.php2
9 files changed, 41 insertions, 9 deletions
diff --git a/app/Controller/Customfilter.php b/app/Controller/Customfilter.php
index c403cb4b..80d18a17 100644
--- a/app/Controller/Customfilter.php
+++ b/app/Controller/Customfilter.php
@@ -115,6 +115,10 @@ class Customfilter extends Base
if (! isset($values['is_shared'])) {
$values += array('is_shared' => 0);
}
+
+ if (! isset($values['append'])) {
+ $values += array('append' => 0);
+ }
list($valid, $errors) = $this->customFilter->validateModification($values);
diff --git a/app/Model/CustomFilter.php b/app/Model/CustomFilter.php
index 2c485247..b7ccdf99 100644
--- a/app/Model/CustomFilter.php
+++ b/app/Model/CustomFilter.php
@@ -40,7 +40,8 @@ class CustomFilter extends Base
self::TABLE.'.project_id',
self::TABLE.'.filter',
self::TABLE.'.name',
- self::TABLE.'.is_shared'
+ self::TABLE.'.is_shared',
+ self::TABLE.'.append'
)
->asc(self::TABLE.'.name')
->join(User::TABLE, 'id', 'user_id')
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index 37894dbd..6ece2785 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -6,7 +6,12 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 90;
+const VERSION = 91;
+
+function version_91($pdo)
+{
+ $pdo->exec("ALTER TABLE custom_filters ADD COLUMN append TINYINT(1) DEFAULT 0");
+}
function version_90($pdo)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 2a446e40..d4fae317 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,12 @@ use PDO;
use Core\Security;
use Model\Link;
-const VERSION = 70;
+const VERSION = 71;
+
+function version_71($pdo)
+{
+ $pdo->exec("ALTER TABLE custom_filters ADD COLUMN append BOOLEAN DEFAULT '0'");
+}
function version_70($pdo)
{
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index 633c90a7..2b9ceadc 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,12 @@ use Core\Security;
use PDO;
use Model\Link;
-const VERSION = 85;
+const VERSION = 86;
+
+function version_86($pdo)
+{
+ $pdo->exec("ALTER TABLE custom_filters ADD COLUMN append INTEGER DEFAULT 0");
+}
function version_85($pdo)
{
diff --git a/app/Template/custom_filter/add.php b/app/Template/custom_filter/add.php
index d4e102b3..dfdae72f 100644
--- a/app/Template/custom_filter/add.php
+++ b/app/Template/custom_filter/add.php
@@ -13,8 +13,10 @@
<?= $this->form->text('filter', $values, $errors, array('required', 'maxlength="100"')) ?>
<?php if ($this->user->isProjectManagementAllowed($project['id'])): ?>
- <?= $this->form->checkbox('is_shared', t('Share with all project members'), 1) ?>
+ <?= $this->form->checkbox('is_shared', t('Share with all project members'), 1) ?>
<?php endif ?>
+
+ <?= $this->form->checkbox('append', t('Append filter (instead of replacement)'), 1) ?>
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
diff --git a/app/Template/custom_filter/edit.php b/app/Template/custom_filter/edit.php
index 7525574c..f729152f 100644
--- a/app/Template/custom_filter/edit.php
+++ b/app/Template/custom_filter/edit.php
@@ -19,9 +19,11 @@
<?php if ($this->user->isProjectManagementAllowed($project['id'])): ?>
<?= $this->form->checkbox('is_shared', t('Share with all project members'), 1, $values['is_shared'] == 1) ?>
<?php else: ?>
- <?= $this->form->hidden('is_shared', $values) ?>
+ <?= $this->form->hidden('is_shared', $values) ?>
<?php endif ?>
-
+
+ <?= $this->form->checkbox('append', t('Append filter (instead of replacement)'), 1, $values['append'] == 1) ?>
+
<div class="form-actions">
<input type="submit" value="<?= t('Save') ?>" class="btn btn-blue">
<?= t('or') ?>
diff --git a/app/Template/custom_filter/index.php b/app/Template/custom_filter/index.php
index a53d0d0a..c857e206 100644
--- a/app/Template/custom_filter/index.php
+++ b/app/Template/custom_filter/index.php
@@ -8,6 +8,7 @@
<th><?= t('Name') ?></th>
<th><?= t('Filter') ?></th>
<th><?= t('Shared') ?></th>
+ <th><?= t('Append/Replace') ?></th>
<th><?= t('Owner') ?></th>
<th><?= t('Actions') ?></th>
</tr>
@@ -22,6 +23,13 @@
<?= t('No') ?>
<?php endif ?>
</td>
+ <td>
+ <?php if ($filter['append'] == 1): ?>
+ <?= t('Append') ?>
+ <?php else: ?>
+ <?= t('Replace') ?>
+ <?php endif ?>
+ </td>
<td><?= $this->e($filter['owner_name'] ?: $filter['owner_username']) ?></td>
<td>
<?php if ($filter['user_id'] == $this->user->getId() || $this->user->isProjectManagementAllowed($project['id'])): ?>
@@ -37,4 +45,4 @@
</div>
<?php endif ?>
-<?= $this->render('custom_filter/add', array('project' => $project, 'values' => $values, 'errors' => $errors)) ?> \ No newline at end of file
+<?= $this->render('custom_filter/add', array('project' => $project, 'values' => $values, 'errors' => $errors)) ?>
diff --git a/app/Template/project/filters.php b/app/Template/project/filters.php
index c22d7b4f..eee691c5 100644
--- a/app/Template/project/filters.php
+++ b/app/Template/project/filters.php
@@ -68,7 +68,7 @@
<i class="fa fa-caret-down"></i> <a href="#" class="dropdown-menu"><?= t('My filters') ?></a>
<ul>
<?php foreach ($custom_filters_list as $filter): ?>
- <li><a href="#" class="filter-helper" data-filter='<?= $this->e($filter['filter']) ?>'><?= $this->e($filter['name']) ?></a></li>
+ <li><a href="#" class="filter-helper" data-<?php if($filter['append']): ?><?= 'append-' ?><?php endif ?>filter='<?= $this->e($filter['filter']) ?>'><?= $this->e($filter['name']) ?></a></li>
<?php endforeach ?>
</ul>
</div>