new: [open] spaces added
- public interfaces that are configurable, early iterationremotes/origin/main
parent
7d74ee7241
commit
151e033d19
|
@ -105,6 +105,7 @@ class AppController extends Controller
|
||||||
$this->ACL->checkAccess();
|
$this->ACL->checkAccess();
|
||||||
$this->set('menu', $this->{$this->modelClass}->getMenu());
|
$this->set('menu', $this->{$this->modelClass}->getMenu());
|
||||||
$this->set('ajax', $this->request->is('ajax'));
|
$this->set('ajax', $this->request->is('ajax'));
|
||||||
|
$this->request->getParam('prefix');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function authApiUser(): void
|
private function authApiUser(): void
|
||||||
|
|
|
@ -8,6 +8,8 @@ use Cake\Http\Exception\NotFoundException;
|
||||||
use Cake\Http\Exception\MethodNotAllowedException;
|
use Cake\Http\Exception\MethodNotAllowedException;
|
||||||
use Cake\Http\Exception\ForbiddenException;
|
use Cake\Http\Exception\ForbiddenException;
|
||||||
use Cake\ORM\TableRegistry;
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
use Cake\Core\Configure\Engine\PhpConfig;
|
||||||
|
|
||||||
class ACLComponent extends Component
|
class ACLComponent extends Component
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller\Open;
|
||||||
|
|
||||||
|
use App\Controller\AppController;
|
||||||
|
use Cake\Utility\Hash;
|
||||||
|
use Cake\Utility\Text;
|
||||||
|
use \Cake\Database\Expression\QueryExpression;
|
||||||
|
use Cake\Http\Exception\NotFoundException;
|
||||||
|
use Cake\Http\Exception\MethodNotAllowedException;
|
||||||
|
use Cake\Http\Exception\ForbiddenException;
|
||||||
|
use Cake\Event\EventInterface;
|
||||||
|
|
||||||
|
class OrganisationsController extends AppController
|
||||||
|
{
|
||||||
|
public function beforeFilter(EventInterface $event)
|
||||||
|
{
|
||||||
|
parent::beforeFilter($event);
|
||||||
|
$this->Authentication->allowUnauthenticated(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->CRUD->index([
|
||||||
|
'filters' => ['name', 'uuid', 'nationality', 'sector', 'type', 'url', 'Alignments.id'],
|
||||||
|
'quickFilters' => ['name', 'uuid', 'nationality', 'sector', 'type', 'url'],
|
||||||
|
'contain' => ['Alignments' => 'Individuals']
|
||||||
|
]);
|
||||||
|
if ($this->ParamHandler->isRest()) {
|
||||||
|
return $this->restResponsePayload;
|
||||||
|
}
|
||||||
|
$this->set('alignmentScope', 'individuals');
|
||||||
|
$this->set('metaGroup', 'Public');
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ namespace App\Model\Table;
|
||||||
|
|
||||||
use Cake\ORM\Table;
|
use Cake\ORM\Table;
|
||||||
use Cake\Validation\Validator;
|
use Cake\Validation\Validator;
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
use Cake\Core\Configure\Engine\PhpConfig;
|
||||||
|
|
||||||
class AppTable extends Table
|
class AppTable extends Table
|
||||||
{
|
{
|
||||||
|
@ -13,6 +15,7 @@ class AppTable extends Table
|
||||||
|
|
||||||
public function getMenu()
|
public function getMenu()
|
||||||
{
|
{
|
||||||
|
$open = Configure::read('Cerebrate.open');
|
||||||
return [
|
return [
|
||||||
'ContactDB' => [
|
'ContactDB' => [
|
||||||
'Individuals' => [
|
'Individuals' => [
|
||||||
|
@ -193,6 +196,30 @@ class AppTable extends Table
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
'Open' => [
|
||||||
|
'Organisations' => [
|
||||||
|
'label' => __('Organisations'),
|
||||||
|
'url' => '/open/organisations/index',
|
||||||
|
'children' => [
|
||||||
|
'index' => [
|
||||||
|
'url' => '/open/organisations/index',
|
||||||
|
'label' => __('List organisations')
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'open' => in_array('organisations', Configure::read('Cerebrate.open'))
|
||||||
|
],
|
||||||
|
'Individuals' => [
|
||||||
|
'label' => __('Individuals'),
|
||||||
|
'url' => '/open/individuals/index',
|
||||||
|
'children' => [
|
||||||
|
'index' => [
|
||||||
|
'url' => '/open/individuals/index',
|
||||||
|
'label' => __('List individuals')
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'open' => in_array('individuals', Configure::read('Cerebrate.open'))
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?php
|
||||||
|
echo $this->element('genericElements/IndexTable/index_table', [
|
||||||
|
'data' => [
|
||||||
|
'data' => $data,
|
||||||
|
'top_bar' => [
|
||||||
|
'pull' => 'right',
|
||||||
|
'children' => [
|
||||||
|
[
|
||||||
|
'type' => 'simple',
|
||||||
|
'children' => [
|
||||||
|
'data' => [
|
||||||
|
'type' => 'simple',
|
||||||
|
'text' => __('Add organisation'),
|
||||||
|
'class' => 'btn btn-primary',
|
||||||
|
'popover_url' => '/organisations/add'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'type' => 'search',
|
||||||
|
'button' => __('Filter'),
|
||||||
|
'placeholder' => __('Enter value to search'),
|
||||||
|
'data' => '',
|
||||||
|
'searchKey' => 'value'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'fields' => [
|
||||||
|
[
|
||||||
|
'name' => '#',
|
||||||
|
'sort' => 'id',
|
||||||
|
'class' => 'short',
|
||||||
|
'data_path' => 'id',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('Name'),
|
||||||
|
'class' => 'short',
|
||||||
|
'data_path' => 'name',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('UUID'),
|
||||||
|
'sort' => 'uuid',
|
||||||
|
'class' => 'short',
|
||||||
|
'data_path' => 'uuid',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('Members'),
|
||||||
|
'data_path' => 'alignments',
|
||||||
|
'element' => 'count_summary',
|
||||||
|
'url' => '/individuals/index/?Organisations.id={{url_data}}',
|
||||||
|
'url_data_path' => 'id'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('URL'),
|
||||||
|
'sort' => 'url',
|
||||||
|
'class' => 'short',
|
||||||
|
'data_path' => 'url',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('Nationality'),
|
||||||
|
'data_path' => 'nationality',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('Sector'),
|
||||||
|
'data_path' => 'sector',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => __('Type'),
|
||||||
|
'data_path' => 'type',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'title' => __('ContactDB Organisation Index'),
|
||||||
|
'description' => __('A list of organisations known by your Cerebrate instance. This list can get populated either directly, by adding new organisations or by fetching them from trusted remote sources.'),
|
||||||
|
'pull' => 'right',
|
||||||
|
'actions' => [
|
||||||
|
[
|
||||||
|
'url' => '/organisations/view',
|
||||||
|
'url_params_data_paths' => ['id'],
|
||||||
|
'icon' => 'eye'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'onclick' => 'populateAndLoadModal(\'/organisations/edit/[onclick_params_data_path]\');',
|
||||||
|
'onclick_params_data_path' => 'id',
|
||||||
|
'icon' => 'edit'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'onclick' => 'populateAndLoadModal(\'/organisations/delete/[onclick_params_data_path]\');',
|
||||||
|
'onclick_params_data_path' => 'id',
|
||||||
|
'icon' => 'trash'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
echo '</div>';
|
||||||
|
?>
|
|
@ -1,13 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* echo $this->element('/genericElements/IndexTable/index_table', array(
|
* echo $this->element('/genericElements/IndexTable/index_table', [
|
||||||
* 'top_bar' => (
|
* 'top_bar' => (
|
||||||
* // search/filter bar information compliant with ListTopBar
|
* // search/filter bar information compliant with ListTopBar
|
||||||
* ),
|
* ),
|
||||||
* 'data' => array(
|
* 'data' => [
|
||||||
// the actual data to be used
|
// the actual data to be used
|
||||||
* ),
|
* ),
|
||||||
* 'fields' => array(
|
* 'fields' => [
|
||||||
* // field list with information for the paginator, the elements used for the individual cells, etc
|
* // field list with information for the paginator, the elements used for the individual cells, etc
|
||||||
* ),
|
* ),
|
||||||
* 'title' => optional title,
|
* 'title' => optional title,
|
||||||
|
@ -32,13 +32,13 @@
|
||||||
}
|
}
|
||||||
$skipPagination = isset($data['skip_pagination']) ? $data['skip_pagination'] : 0;
|
$skipPagination = isset($data['skip_pagination']) ? $data['skip_pagination'] : 0;
|
||||||
if (!$skipPagination) {
|
if (!$skipPagination) {
|
||||||
$paginationData = !empty($data['paginatorOptions']) ? $data['paginatorOptions'] : array();
|
$paginationData = !empty($data['paginatorOptions']) ? $data['paginatorOptions'] : [];
|
||||||
echo $this->element(
|
echo $this->element(
|
||||||
'/genericElements/IndexTable/pagination',
|
'/genericElements/IndexTable/pagination',
|
||||||
array(
|
[
|
||||||
'paginationOptions' => $paginationData,
|
'paginationOptions' => $paginationData,
|
||||||
'tableRandomValue' => $tableRandomValue
|
'tableRandomValue' => $tableRandomValue
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
if (!$ajax) {
|
if (!$ajax) {
|
||||||
echo $this->element(
|
echo $this->element(
|
||||||
|
@ -49,17 +49,20 @@
|
||||||
if (!empty($data['top_bar'])) {
|
if (!empty($data['top_bar'])) {
|
||||||
echo $this->element(
|
echo $this->element(
|
||||||
'/genericElements/ListTopBar/scaffold',
|
'/genericElements/ListTopBar/scaffold',
|
||||||
array(
|
[
|
||||||
'data' => $data['top_bar'],
|
'data' => $data['top_bar'],
|
||||||
'tableRandomValue' => $tableRandomValue
|
'tableRandomValue' => $tableRandomValue
|
||||||
)
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$rows = '';
|
$rows = '';
|
||||||
$row_element = isset($data['row_element']) ? $data['row_element'] : 'row';
|
$row_element = isset($data['row_element']) ? $data['row_element'] : 'row';
|
||||||
$options = isset($data['options']) ? $data['options'] : array();
|
$options = isset($data['options']) ? $data['options'] : [];
|
||||||
$actions = isset($data['actions']) ? $data['actions'] : array();
|
$actions = isset($data['actions']) ? $data['actions'] : [];
|
||||||
$dblclickActionArray = isset($data['actions']) ? $this->Hash->extract($data['actions'], '{n}[dbclickAction]') : array();
|
if ($this->request->getParam('prefix') === 'Open') {
|
||||||
|
$actions = [];
|
||||||
|
}
|
||||||
|
$dblclickActionArray = !empty($actions) ? $this->Hash->extract($actions, '{n}[dbclickAction]') : [];
|
||||||
$dbclickAction = '';
|
$dbclickAction = '';
|
||||||
foreach ($data['data'] as $k => $data_row) {
|
foreach ($data['data'] as $k => $data_row) {
|
||||||
$primary = null;
|
$primary = null;
|
||||||
|
@ -78,7 +81,7 @@
|
||||||
empty($data['class']) ? '' : h($data['row_class']),
|
empty($data['class']) ? '' : h($data['row_class']),
|
||||||
$this->element(
|
$this->element(
|
||||||
'/genericElements/IndexTable/' . $row_element,
|
'/genericElements/IndexTable/' . $row_element,
|
||||||
array(
|
[
|
||||||
'k' => $k,
|
'k' => $k,
|
||||||
'row' => $data_row,
|
'row' => $data_row,
|
||||||
'fields' => $data['fields'],
|
'fields' => $data['fields'],
|
||||||
|
@ -86,7 +89,7 @@
|
||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
'primary' => $primary,
|
'primary' => $primary,
|
||||||
'tableRandomValue' => $tableRandomValue
|
'tableRandomValue' => $tableRandomValue
|
||||||
)
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -96,12 +99,12 @@
|
||||||
$tableRandomValue,
|
$tableRandomValue,
|
||||||
$this->element(
|
$this->element(
|
||||||
'/genericElements/IndexTable/headers',
|
'/genericElements/IndexTable/headers',
|
||||||
array(
|
[
|
||||||
'fields' => $data['fields'],
|
'fields' => $data['fields'],
|
||||||
'paginator' => $this->Paginator,
|
'paginator' => $this->Paginator,
|
||||||
'actions' => (empty($data['actions']) ? false : true),
|
'actions' => (empty($actions) ? false : true),
|
||||||
'tableRandomValue' => $tableRandomValue
|
'tableRandomValue' => $tableRandomValue
|
||||||
)
|
]
|
||||||
),
|
),
|
||||||
$tbody
|
$tbody
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue