mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-23 08:46:49 +01:00
* [MOD] Improve item actions filtering. Actions can be filtered out by several source values.
This commit is contained in:
@@ -99,17 +99,17 @@ class Notices extends GridBase
|
||||
$GridActionNew->setOnClickFunction('notice/show');
|
||||
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
};
|
||||
}
|
||||
|
||||
$GridActionNew = new DataGridAction();
|
||||
$GridActionNew->setId(self::ACTION_NOT_USER_VIEW);
|
||||
$GridActionNew->setType(DataGridActionType::VIEW_ITEM);
|
||||
$GridActionNew->setName(__('Ver Notificación'));
|
||||
$GridActionNew->setTitle(__('Ver Notificación'));
|
||||
$GridActionNew->setIcon($this->icons->getIconView());
|
||||
$GridActionNew->setOnClickFunction('notice/show');
|
||||
$GridActionView = new DataGridAction();
|
||||
$GridActionView->setId(self::ACTION_NOT_USER_VIEW);
|
||||
$GridActionView->setType(DataGridActionType::VIEW_ITEM);
|
||||
$GridActionView->setName(__('Ver Notificación'));
|
||||
$GridActionView->setTitle(__('Ver Notificación'));
|
||||
$GridActionView->setIcon($this->icons->getIconView());
|
||||
$GridActionView->setOnClickFunction('notice/show');
|
||||
|
||||
$Grid->setDataActions($GridActionNew);
|
||||
$Grid->setDataActions($GridActionView);
|
||||
|
||||
$GridActionCheck = new DataGridAction();
|
||||
$GridActionCheck->setId(self::ACTION_NOT_USER_CHECK);
|
||||
@@ -117,7 +117,7 @@ class Notices extends GridBase
|
||||
$GridActionCheck->setTitle(__('Marcar Notificación'));
|
||||
$GridActionCheck->setIcon($this->icons->getIconEnabled());
|
||||
$GridActionCheck->setOnClickFunction('notice/check');
|
||||
$GridActionCheck->setFilterRowSource('notice_checked', 1);
|
||||
$GridActionCheck->setFilterRowSource('notice_checked');
|
||||
|
||||
$Grid->setDataActions($GridActionCheck);
|
||||
|
||||
@@ -139,9 +139,9 @@ class Notices extends GridBase
|
||||
$GridActionDel->setOnClickFunction('appMgmt/delete');
|
||||
|
||||
if (!$isAdminApp) {
|
||||
$GridActionCheck->setFilterRowSource('notice_sticky', 1);
|
||||
$GridActionEdit->setFilterRowSource('notice_sticky', 1);
|
||||
$GridActionDel->setFilterRowSource('notice_sticky', 1);
|
||||
$GridActionCheck->setFilterRowSource('notice_sticky');
|
||||
$GridActionEdit->setFilterRowSource('notice_sticky');
|
||||
$GridActionDel->setFilterRowSource('notice_sticky');
|
||||
}
|
||||
|
||||
$Grid->setDataActions($GridActionDel);
|
||||
|
||||
@@ -134,6 +134,7 @@ abstract class DataGridActionBase implements DataGridActionInterface
|
||||
* @param string $class
|
||||
* @param string $method
|
||||
* @return $this
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function setReflectionFilter($class, $method)
|
||||
{
|
||||
@@ -309,7 +310,7 @@ abstract class DataGridActionBase implements DataGridActionInterface
|
||||
*/
|
||||
public function setFilterRowSource($rowSource, $value = 1)
|
||||
{
|
||||
$this->_filterRowSource = ['field' => $rowSource, 'value' => $value];
|
||||
$this->_filterRowSource[] = ['field' => $rowSource, 'value' => $value];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17042003;
|
||||
$build = 17042004;
|
||||
$version = [2, 1, 7];
|
||||
|
||||
if ($normalized === true) {
|
||||
|
||||
@@ -35,21 +35,28 @@ use SP\Html\Html;
|
||||
<div>
|
||||
<?php if (count($data->getDataActions()) > 0): ?>
|
||||
<?php foreach ($data->getDataActions() as $action): ?>
|
||||
<?php if (!$action->isSkip()): ?>
|
||||
|
||||
<?php
|
||||
<?php if (!$action->isSkip()):
|
||||
$filter = $action->getFilterRowSource();
|
||||
if ($filter !== null && $dataItem->{$filter['field']} == $filter['value']): continue; endif; ?>
|
||||
<i id="btn-action-<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}, '-', $action->getId(); ?>"
|
||||
class="btn-action material-icons <?php echo $action->getIcon()->getClass(); ?>"
|
||||
data-action-id="<?php echo $action->getId(); ?>"
|
||||
data-nextaction-id="<?php echo $actionId; ?>"
|
||||
data-item-id="<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}; ?>"
|
||||
data-activetab="<?php echo $index; ?>"
|
||||
data-onclick="<?php echo $action->getOnClick(); ?>"><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
<span
|
||||
for="btn-action-<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}, '-', $action->getId(); ?>"
|
||||
class="mdl-tooltip mdl-tooltip--top"><?php echo $action->getTitle(); ?></span>
|
||||
|
||||
if ($filter !== null) {
|
||||
/** @var array $filter */
|
||||
foreach ($filter as $f) {
|
||||
if ($dataItem->{$f['field']} == $f['value']) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<i id="btn-action-<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}, '-', $action->getId(); ?>"
|
||||
class="btn-action material-icons <?php echo $action->getIcon()->getClass(); ?>"
|
||||
data-action-id="<?php echo $action->getId(); ?>"
|
||||
data-nextaction-id="<?php echo $actionId; ?>"
|
||||
data-item-id="<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}; ?>"
|
||||
data-activetab="<?php echo $index; ?>"
|
||||
data-onclick="<?php echo $action->getOnClick(); ?>"><?php echo $action->getIcon()->getIcon(); ?></i>
|
||||
<span
|
||||
for="btn-action-<?php echo $dataItem->{$data->getData()->getDataRowSourceId()}, '-', $action->getId(); ?>"
|
||||
class="mdl-tooltip mdl-tooltip--top"><?php echo $action->getTitle(); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
|
||||
Reference in New Issue
Block a user