diff --git a/app/src/Controller/PeopleController.php b/app/src/Controller/PeopleController.php index c1d2e5e14..4577075c6 100644 --- a/app/src/Controller/PeopleController.php +++ b/app/src/Controller/PeopleController.php @@ -76,66 +76,4 @@ public function beforeRender(\Cake\Event\EventInterface $event) { return parent::beforeRender($event); } - - /** - * Person overview / canvas - * - * @since COmanage Registry v5.0.0 - */ - - public function canvas(string $id) { - /* XXX Simply including parent::edit() is nearly all that's required - but we need - to delve a little deeper to get data from underlying relationships. We might send a contains() - override to parent::edit() which would allow this to be more DRY - // Keep the following as an example for now. - parent::edit($id, false); - - // We've just set the vv_supertitle in the parent controller. - // Pass it to the title for use in the breadcrumbs. - $this->set('vv_title', $this->viewBuilder()->getVar('vv_supertitle')); - */ - - /* The following is nearly identical to parent::edit/view */ - $modelsName = $this->name; - $table = $this->$modelsName; - $tableName = $table->getTable(); - $query = $table->findById($id); - - // This contain() directive is the primary deviation from standard edit()/view(). - // We need to drill down to deeper related models for display. - $query = $query->contain([ - 'PrimaryName', - 'Names' => ['Types'], - 'Addresses' => ['Types'], - 'AdHocAttributes', - 'EmailAddresses' => ['Types'], - 'GroupMembers', - 'GroupOwners', - 'Identifiers' => ['Types'], - 'PersonRoles' => ['Cous','Types'], - 'Pronouns', - 'TelephoneNumbers' => ['Types'], - 'Urls' => ['Types'] - ]); - - try { - // Pull the current record - $obj = $query->firstOrFail(); - } catch(\Exception $e) { - // findById throws Cake\Datasource\Exception\RecordNotFoundException - $this->Flash->error($e->getMessage()); - // XXX This redirects to an Exception page because $id is not found. - // XXX A 404 with error would be better. - return $this->generateRedirect((int)$id); - } - - $this->set('vv_obj', $obj); - $this->getPrimaryLink(); - $this->populateAutoViewVars($obj); - - $this->set('vv_title', $table->generateDisplayField($obj)); - $this->set('vv_supertitle', $table->generateDisplayField($obj)); - // Pass the display field also into subtitle for dealing with External IDs - $this->set('vv_subtitle', $table->generateDisplayField($obj)); - } } \ No newline at end of file diff --git a/app/templates/People/canvas.php b/app/templates/People/canvas.php deleted file mode 100644 index 54b25ba3a..000000000 --- a/app/templates/People/canvas.php +++ /dev/null @@ -1,173 +0,0 @@ - 'person', - 'active' => 'canvas' - ]; - - $linkFilter = []; - if(!empty($vv_primary_link) && !empty($this->request->getQuery($vv_primary_link))) { - $linkFilter = [$vv_primary_link => $this->request->getQuery($vv_primary_link)]; - } - - $objId = null; - if(!empty($vv_obj)) { - $objId = $vv_obj->id; - } - - // Person Attributes to display. - $attributes = [ - 'names', - 'email_addresses', - 'identifiers', - 'ad_hoc_attributes', - 'addresses', - 'telephone_numbers', - 'urls', - 'pronouns' - ]; - - // Count the number of widgets that will be displayed - $widgetCount = 0; - foreach($attributes as $attr) { - if(!empty($vv_obj[$attr])) { - $widgetCount++; - } - } - -?> - - - -
- - -
- element( - 'mveaJs', - [ - 'htmlId' => 'person-canvas-' . $attr . '-js', - 'parentId' => $objId, - 'mveaType' => $attr, - 'entityType' => 'person' - ] - ); - } - } - ?> -
- - - -
- element( - 'mvea', - [ - 'vv_obj' => $vv_obj, - 'mveaType' => $attr, - 'entityType' => 'person' - ] - ); - } - } - ?> -
- - */ ?> - - -
-
-

- Html->link( - __d('controller', 'PersonRoles', [99]), - [ 'controller' => 'person_roles', - 'action' => 'index', - '?' => ['person_id' => $objId] - ] - ); ?> -

-
-
    - -
  • -
    - Html->link( - !(empty($role['title'])) ? $role['title'] : __d('information','global.title.none'), - [ 'controller' => 'person_roles', - 'action' => 'edit', - $role['id'] - ], - ['class' => 'row-link'] - ); ?> -
    -
    - - - - - -
    -
    - - - - - - - - - - - - - - - - -
    -
    -
  • - -
-
-
-
-
diff --git a/app/templates/People/columns.inc b/app/templates/People/columns.inc index 4e001764d..e64a5f37b 100644 --- a/app/templates/People/columns.inc +++ b/app/templates/People/columns.inc @@ -30,7 +30,7 @@ $indexColumns = [ 'type' => 'link', 'model' => 'primary_name', 'field' => 'full_name', - 'action' => 'canvas', + 'action' => 'edit', // XXX see comments in the controller about sorting on given vs family 'sortable' => 'PrimaryName.family' ], diff --git a/app/templates/Standard/add-edit-view.php b/app/templates/Standard/add-edit-view.php index 8925cddf8..7b1f8e8fc 100644 --- a/app/templates/Standard/add-edit-view.php +++ b/app/templates/Standard/add-edit-view.php @@ -72,78 +72,129 @@ } ?> -
-
- -

- - request->getParam('controller') == 'PersonRoles' - || $this->request->getParam('controller') == 'ExternalIdentities' - || $this->request->getParam('controller') == 'ExternalIdentityRoles'): ?> -

- -

- - -
+ + id; - - foreach(($topLinks ?? []) as $t) { - // TODO: fix the following test so that cross-model links can exist in top-links (e.g. History Records index) - //if($vv_permissions[ $t['link']['action'] ]) { - // We need to inject $linkFilter, but not overwrite any existing query params - if(!empty($t['link']['?'])) { - $t['link']['?'] = array_merge($t['link']['?'], $linkFilter); - } else { - $t['link']['?'] = $linkFilter; - } - - $action_args['vv_actions'][] = [ - 'order' => $this->Menu->getMenuOrder($t['order']), - 'icon' => $this->Menu->getMenuIcon($t['icon']), - 'url' => $this->Url->build($t['link']), - 'label' => $t['label'], - ]; - //} - } - - // Delete - if($vv_action != 'add' && !empty($vv_obj->id) && $vv_permissions['delete']) { - $actionPostBtnArray = ['action' => 'delete', $vv_obj->id]; - $actionUrl = $this->Url->build(['action' => 'delete', $vv_obj->id]); - $action_args['vv_actions'][] = array( - 'order' => $this->Menu->getMenuOrder('Delete'), - 'icon' => $this->Menu->getMenuIcon('Delete'), - 'url' => 'javascript:void(0);', - 'label' => __d('operation', 'delete'), - 'class' => 'deletebutton nospin', - 'onclick' => array( - 'dg_bd_txt' => __d('operation', 'delete.confirm', [$vv_obj->id]), - 'dg_post_btn_array' => $actionPostBtnArray, - 'dg_url' => $actionUrl, - 'dg_conf_btn' => __d('operation', 'remove'), - 'dg_cancel_btn' => __d('operation', 'cancel'), - 'dg_title' => __d('operation', 'remove'), - 'dg_bd_txt_repl_str' => '' - ) - ); - } - - if(!empty($action_args['vv_actions'])) { - print ''; + // Person Attributes to display. + $attributes = [ + 'names', + 'email_addresses', + 'identifiers', + 'ad_hoc_attributes', + 'addresses', + 'telephone_numbers', + 'urls', + 'pronouns' + ]; + + // Count the number of widgets that will be displayed + $widgetCount = 0; + foreach($attributes as $attr) { + if(!empty($vv_obj[$attr])) { + $widgetCount++; } + } + + $objId = null; + if(!empty($vv_obj)) { + $objId = $vv_obj->id; + } ?> -
+
+ +
+ element( + 'mveaJs', + [ + 'htmlId' => 'person-canvas-' . $attr . '-js', + 'parentId' => $objId, + 'mveaType' => $attr, + 'entityType' => 'person' + ] + ); + } + } + // XXX Add the DOB as its own special card. + ?> +
+
+ +
+
+ +

+ + request->getParam('controller') == 'PersonRoles' + || $this->request->getParam('controller') == 'ExternalIdentities' + || $this->request->getParam('controller') == 'ExternalIdentityRoles'): ?> +

+ +

+ + +
+ id; + + foreach(($topLinks ?? []) as $t) { + // TODO: fix the following test so that cross-model links can exist in top-links (e.g. History Records index) + //if($vv_permissions[ $t['link']['action'] ]) { + // We need to inject $linkFilter, but not overwrite any existing query params + if(!empty($t['link']['?'])) { + $t['link']['?'] = array_merge($t['link']['?'], $linkFilter); + } else { + $t['link']['?'] = $linkFilter; + } + + $action_args['vv_actions'][] = [ + 'order' => $this->Menu->getMenuOrder($t['order']), + 'icon' => $this->Menu->getMenuIcon($t['icon']), + 'url' => $this->Url->build($t['link']), + 'label' => $t['label'], + ]; + //} + } + + // Delete + if($vv_action != 'add' && !empty($vv_obj->id) && $vv_permissions['delete']) { + $actionPostBtnArray = ['action' => 'delete', $vv_obj->id]; + $actionUrl = $this->Url->build(['action' => 'delete', $vv_obj->id]); + $action_args['vv_actions'][] = array( + 'order' => $this->Menu->getMenuOrder('Delete'), + 'icon' => $this->Menu->getMenuIcon('Delete'), + 'url' => 'javascript:void(0);', + 'label' => __d('operation', 'delete'), + 'class' => 'deletebutton nospin', + 'onclick' => array( + 'dg_bd_txt' => __d('operation', 'delete.confirm', [$vv_obj->id]), + 'dg_post_btn_array' => $actionPostBtnArray, + 'dg_url' => $actionUrl, + 'dg_conf_btn' => __d('operation', 'remove'), + 'dg_cancel_btn' => __d('operation', 'cancel'), + 'dg_title' => __d('operation', 'remove'), + 'dg_bd_txt_repl_str' => '' + ) + ); + } + + if(!empty($action_args['vv_actions'])) { + print ''; + } + ?> +
+ diff --git a/app/templates/element/mveaJs.php b/app/templates/element/mveaJs.php index 517e777e7..aa404dae2 100644 --- a/app/templates/element/mveaJs.php +++ b/app/templates/element/mveaJs.php @@ -59,7 +59,7 @@ core: { parentId: '', mveaType: '', - mveaController: '', + mveaController: '', webroot: 'request->getAttribute('webroot') ?>' }, txt: JSON.parse('locales()) ?>'), diff --git a/app/templates/element/subnavigation.php b/app/templates/element/subnavigation.php index 8d23e4262..09a43ad79 100644 --- a/app/templates/element/subnavigation.php +++ b/app/templates/element/subnavigation.php @@ -88,7 +88,7 @@

- + @@ -294,19 +294,6 @@ $isGroupsTab = ($active == 'groups') ? true : false; ?> -
  • +
  • -
  • +
  • {{ this.txt.unverified }} @@ -78,9 +89,9 @@ export default {
  • -
  • +
  • @@ -88,19 +99,19 @@ export default {
  • -
  • +
  • {{ this.mvea.tag }}
  • -
  • +
  • - {{ this.mvea.room }} {{ this.mvea.street }} + {{ this.mvea.room }} {{ this.mvea.street }}
    {{ this.mvea.locality }}{{ this.mvea.locality != '' && this.mvea.state != '' ? ', ' : ''}}{{ this.mvea.state }}
    @@ -114,18 +125,18 @@ export default {
  • -
  • +
  • {{ this.mvea.type.display_name }}
  • -
  • +
  • @@ -133,9 +144,9 @@ export default {
  • -
  • +
  • {{ this.mvea.type.display_name }}