chg: [warninglists:checkValue] Exposed feature in the UI

pull/7392/head
mokaddem 2021-05-03 16:53:04 +02:00
parent c295c630fc
commit e7a4b8decf
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
3 changed files with 48 additions and 2 deletions

View File

@ -283,6 +283,9 @@ class WarninglistsController extends AppController
throw new NotFoundException(__('No valid data received.'));
}
$data = $this->request->data;
if (is_array($data) && isset($data['Warninglist'])) {
$data = $data['Warninglist'];
}
if (!is_array($data)) {
$data = array($data);
}
@ -301,9 +304,15 @@ class WarninglistsController extends AppController
}
}
}
return $this->RestResponse->viewData($hits, $this->response->type());
if ($this->_isRest()) {
return $this->RestResponse->viewData($hits, $this->response->type());
}
$this->set('hits', $hits);
$this->set('data', $data);
} else {
return $this->RestResponse->describe('Warninglists', 'checkValue', false, $this->response->type());
if ($this->_isRest()) {
return $this->RestResponse->describe('Warninglists', 'checkValue', false, $this->response->type());
}
}
}
}

View File

@ -519,6 +519,12 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
'message' => __('Are you sure you want to update all warninglists?')
));
}
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
'element_id' => 'check_value',
'url' => $baseurl . '/warninglists/checkValue',
'text' => __('Search in Warninglists')
));
break;
case 'noticelist':

View File

@ -0,0 +1,31 @@
<div class="warninglist view">
<h2><?= __('Search in Warninglists') ?></h2>
<?php
echo $this->Form->create('Warninglist');
echo sprintf('<div class="input-append">%s%s</div>',
$this->Form->input('', array(
'label' => false,
'div' => false,
'type' => 'text',
'class' => 'input-xlarge',
)),
$this->Form->button(__('Search'), array('class' => 'btn btn-primary', 'placeholder' => __('Enter a value to search for')))
);
echo $this->Form->end();
?>
<?php if(!empty($hits)): ?>
<?php foreach ($hits as $value => $lists): ?>
<?= __('Result for <i>%s</i>:', h($value))?>
<ul>
<?php foreach ($lists as $list): ?>
<li><a href="<?= $baseurl . '/warninglists/view/' . h($list['id']) ?>"><?= h($list['name']) ?></a></li>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
<?php elseif (!empty($data)): ?>
<?= __('No hits for: <i>%s</i>', h($data)) ?>
<?php endif; ?>
</div>
<?= $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'warninglist', 'menuItem' => 'check_value')); ?>