diff --git a/app/src/Model/Table/PeopleTable.php b/app/src/Model/Table/PeopleTable.php index d7288c949..e8fd6b365 100644 --- a/app/src/Model/Table/PeopleTable.php +++ b/app/src/Model/Table/PeopleTable.php @@ -139,6 +139,19 @@ public function initialize(array $config): void { 'table' => [ 'add' => ['platformAdmin', 'coAdmin'], 'index' => ['platformAdmin', 'coAdmin'] + ], + // Related models whose permissions we'll need, typically for table views + 'related' => [ + 'Addresses', + 'AdHocAttributes', + 'Names', + 'EmailAddresses', + 'ExternalIdentities', + 'HistoryRecords', + 'Identifiers', + 'PersonRoles', + 'TelephoneNumbers', + 'Urls' ] ]); } diff --git a/app/templates/People/actions.inc b/app/templates/People/actions.inc new file mode 100644 index 000000000..5d0cfa8d1 --- /dev/null +++ b/app/templates/People/actions.inc @@ -0,0 +1,103 @@ + 'names', + 'action' => 'index', + 'icon' => 'account_box', + 'iconClass' => 'material-icons-outlined', + 'type' => 'tab' + ], + [ + 'controller' => 'email_addresses', + 'action' => 'index', + 'icon' => 'email', + 'iconClass' => 'material-icons-outlined', + 'type' => 'tab' + ], + [ + 'controller' => 'identifiers', + 'action' => 'index', + 'icon' => 'fingerprint', + 'type' => 'tab', + 'class' => 'bottom-border' + ], + [ + 'controller' => 'person_roles', + 'action' => 'index', + 'icon' => 'emoji_people', + 'type' => 'tab' + ], + [ + 'controller' => 'external_identities', + 'action' => 'index', + 'icon' => 'system_update_alt', + 'type' => 'tab', + 'class' => 'bottom-border' + ], + [ + 'controller' => 'ad_hoc_attributes', + 'action' => 'index', + 'icon' => 'check_box', + 'iconClass' => 'material-icons-outlined', + 'type' => 'tab' + ], + [ + 'controller' => 'addresses', + 'action' => 'index', + 'icon' => 'contact_mail', + 'iconClass' => 'material-icons-outlined', + 'type' => 'tab' + ], + [ + 'controller' => 'history_records', + 'action' => 'index', + 'icon' => 'history', + 'type' => 'tab' + ], + [ + 'controller' => 'telephone_numbers', + 'action' => 'index', + 'icon' => 'phone', + 'type' => 'tab' + ], + [ + 'controller' => 'urls', + 'action' => 'index', + 'icon' => 'link', + 'type' => 'tab' + ] +]; diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 3f8ce602a..656932ec9 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -237,30 +237,9 @@ function _column_key($modelsName, $c, $tz=null) { // Action list for command menu dropdown / button listing $action_args = array(); $action_args['vv_attr_id'] = $entity->id; - - // Edit / View - /* TODO: Keep as reference for now; ultimately remove. - * if($vv_permission_set[$entity->id]['edit']) { - $action_args['vv_actions'][] = array( - 'order' => $this->Menu->getMenuOrder('Edit'), - 'icon' => $this->Menu->getMenuIcon('Edit'), - 'url' => $this->Url->build(['action' => 'edit', $entity->id]), - 'label' => __d('operation', 'edit') - ); - } elseif($vv_permission_set[$entity->id]['view']) { - $action_args['vv_actions'][] = array( - 'order' => $this->Menu->getMenuOrder('View'), - 'icon' => $this->Menu->getMenuIcon('View'), - 'url' => $this->Url->build(['action' => 'view', $entity->id]), - 'label' => __d('operation', 'view') - ); - }*/ // Insert actions as per the .inc file - - // TODO: create an element or move this to MenuHelper so it can be used by topLinks as well as actions - // XXX this isn't quite the right test - // if(isset($entity->status) && $entity->status == StatusEnum::Active) { + // TODO: create an element or move this to MenuHelper so it can be used by topLinks as well as actions $actionOrderDefault = $this->Menu->getMenuOrder('Default'); foreach($actions as $a) { $ok = false; @@ -284,6 +263,7 @@ function _column_key($modelsName, $c, $tz=null) { if($ok) { $actionOrder = !empty($a['order']) ? $a['order'] : $actionOrderDefault++; $actionIcon = !empty($a['icon']) ? $a['icon'] : $this->Menu->getMenuIcon('Default'); + $actionIconClass = !empty($a['iconClass']) ? $a['iconClass'] : ''; $actionClass = !empty($a['class']) ? $a['class'] : ''; $actionUrl = ''; $actionLabel = ''; @@ -338,6 +318,7 @@ function _column_key($modelsName, $c, $tz=null) { $action_args['vv_actions'][] = array( 'order' => $actionOrder, 'icon' => $actionIcon, + 'iconClass' => $actionIconClass, 'url' => $actionUrl, 'label' => $actionLabel, 'class' => $actionClass, @@ -346,31 +327,6 @@ function _column_key($modelsName, $c, $tz=null) { } } -// } - - // Delete - /* TODO: Keep as reference for now - ultimately remove. - * if($vv_permission_set[$entity->id]['delete']) { - $actionPostBtnArray = ['action' => 'delete', $entity->id]; - $actionUrl = $this->Url->build(['action' => 'delete', $entity->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', [$entity->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' => '' - ), - ); - }*/ - ?>