Skip to content

Commit

Permalink
Identifiers,HistoryRecords,TelephoneNumbers,Names,AdHocAttributes,Per…
Browse files Browse the repository at this point in the history
…sonRoles
  • Loading branch information
Ioannis committed Apr 26, 2024
1 parent bd13c2c commit ab51d3c
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 98 deletions.
3 changes: 2 additions & 1 deletion app/src/Controller/ApiUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public function generate(string $id) {
// Let the view render
if(in_array($this->name, [
'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses',
'Groups', 'Servers', 'Types', 'Urls'
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
9 changes: 6 additions & 3 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ public function add() {
// Let the view render
if(in_array($this->name, [
'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses',
'Groups', 'Servers', 'Types', 'Urls'
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -431,7 +432,8 @@ public function edit(string $id) {

if(in_array($this->name, [
'Cous', 'CoSettings', 'ApiUsers', 'Cos', 'Addresses', 'EmailAddresses',
'Groups', 'Servers', 'Types', 'Urls'
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down Expand Up @@ -887,7 +889,8 @@ public function view($id = null) {
// Let the view render
if(in_array($this->name, [
'Cous', 'ApiUsers', 'CoSettings', 'Cos', 'Addresses', 'EmailAddresses',
'Groups', 'Servers', 'Types', 'Urls'
'Groups', 'Servers', 'Types', 'Urls', 'Identifiers', 'HistoryRecords',
'TelephoneNumbers', 'Names', 'AdHocAttributes', 'PersonRoles'
])
) {
$this->render('/Standard/add-edit-view-new');
Expand Down
3 changes: 2 additions & 1 deletion app/src/Model/Table/HistoryRecordsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class HistoryRecordsTable extends Table {
use \App\Lib\Traits\TableMetaTrait;
use \App\Lib\Traits\ValidationTrait;
use \App\Lib\Traits\SearchFilterTrait;

use \App\Lib\Traits\AutoViewVarsTrait;

/**
* Perform Cake Model initialization.
*
Expand Down
23 changes: 19 additions & 4 deletions app/templates/AdHocAttributes/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,26 @@
*/

if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') {
print $this->Field->control('tag');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'tag'
]]);

print $this->Field->control('value');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'value'
]]);

print $this->Field->control('frozen');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'frozen'
]]);
}

print $this->Field->sourceControl($vv_obj);
if($vv_action == 'edit' || $vv_action == 'view') {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'source',
'entity' => $vv_obj
]]);
}
103 changes: 62 additions & 41 deletions app/templates/HistoryRecords/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@

// This view does not support edit
if($vv_action == 'add' || $vv_action == 'view') {
print $this->Field->control('comment');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'comment',
]]);

if($vv_action == 'add') {
// On manual add insert action
Expand All @@ -39,7 +42,10 @@ if($vv_action == 'add' || $vv_action == 'view') {
}

if($vv_action == 'view') {
print $this->Field->control('action');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'action',
]]);

if(!empty($vv_obj->person->primary_name)) {
$viewLink = [
Expand All @@ -49,12 +55,14 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->person->id
],
];

print $this->Field->statusControl(
'person_id',
$vv_obj->person->primary_name->full_name,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'person_id',
'status' => $vv_obj->person->primary_name->full_name,
'link' => $viewLink
]
]);
}

if(!empty($vv_obj->person_role_id)) {
Expand All @@ -65,12 +73,14 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->person_role_id
],
];

print $this->Field->statusControl(
'person_role_id',
$vv_obj->person_role_id,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'person_role_id',
'status' => $vv_obj->person_role_id,
'link' => $viewLink
]
]);
}

if(!empty($vv_obj->external_identity->primary_name)) {
Expand All @@ -81,12 +91,14 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->external_identity->id
],
];

print $this->Field->statusControl(
'external_identity_id',
$vv_obj->external_identity->primary_name->full_name,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'external_identity_id',
'status' => $vv_obj->external_identity->primary_name->full_name,
'link' => $viewLink
]
]);
}

if(!empty($vv_obj->external_identity_role_id)) {
Expand All @@ -97,12 +109,14 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->external_identity_role_id
],
];

print $this->Field->statusControl(
'external_identity_role_id',
$vv_obj->external_identity_role_id,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'external_identity_role_id',
'status' => $vv_obj->external_identity_role_id,
'link' => $viewLink
]
]);
}

if(!empty($vv_obj->group_id)) {
Expand All @@ -113,12 +127,14 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->group_id
],
];

print $this->Field->statusControl(
'group_id',
$vv_obj->group->name,
$viewLink
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'group_id',
'status' => $vv_obj->group->name,
'link' => $viewLink
]
]);
}

if(!empty($vv_obj->actor_person->names)) {
Expand All @@ -129,15 +145,20 @@ if($vv_action == 'add' || $vv_action == 'view') {
$vv_obj->actor_person->id
],
];

print $this->Field->statusControl(
'actor_person_id',
$vv_obj->actor_person->names[0]->full_name,
$viewLink,
__d('field', 'actor')
);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'actor_person_id',
'status' => $vv_obj->actor_person->names[0]->full_name,
'link' => $viewLink,
'labelText' => __d('field', 'actor')
]
]);
}

print $this->Field->control('created');

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'created',
]]);
}
}
39 changes: 32 additions & 7 deletions app/templates/Identifiers/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,45 @@
*/

if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') {
print $this->Field->control('identifier');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'identifier',
]]);

print $this->Field->control('type_id', ['default' => $vv_default_type]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'type_id',
'options' => [
'default' => $vv_default_type
]
]]);

if($vv_primary_link_attr == 'person_id') {
// AR-Identifier-1 Only Persons can have a login flag
print $this->Field->control('login');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'login',
]]);
} else {
// Will be used by add-edit-view.php to append the hidden fields in the form
$hidden['login'] = false;
}

print $this->Field->control('status', ['empty' => false]);

print $this->Field->control('frozen');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'status',
]]);

print $this->Field->sourceControl($vv_obj);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'frozen'
]]);
}

if($vv_action == 'edit' || $vv_action == 'view') {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'source',
'entity' => $vv_obj
]]);
}
46 changes: 39 additions & 7 deletions app/templates/Names/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,54 @@ if($vv_action == 'add' || $vv_action == 'edit' || $vv_action == 'view') {

foreach(['honorific', 'given', 'middle', 'family', 'suffix'] as $f) {
if(in_array($f, $vv_permitted_fields)) {
print $this->Field->control($f);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => $f
]]);
}
}

print $this->Field->control('type_id', ['default' => $vv_default_type]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'type_id',
'options' => [
'default' => $vv_default_type
]
]]);

print $this->Field->control('language');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'language'
]]);

print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'display_name'
]]);

print $this->Field->control('display_name');

// We don't allow unsetting of primary_name here because we need to know what
// the new primary_name is, but we do allow this name to become primary
// because afterSave will unset the old one.
print $this->Field->control('primary_name', ['readonly' => $vv_obj->primary_name]);
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'description',
'options' => [
'readonly' => $vv_obj->primary_name
]
]]);

print $this->Field->control('frozen');
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'frozen'
]]);

print $this->Field->sourceControl($vv_obj);
}

if($vv_action == 'edit' || $vv_action == 'view') {
print $this->element('form/listItem', [
'arguments' => [
'fieldName' => 'source',
'entity' => $vv_obj
]]);
}
Loading

0 comments on commit ab51d3c

Please sign in to comment.