diff --git a/app/resources/locales/en_US/field.po b/app/resources/locales/en_US/field.po index 2849fe1eb..78a55efec 100644 --- a/app/resources/locales/en_US/field.po +++ b/app/resources/locales/en_US/field.po @@ -420,6 +420,9 @@ msgstr "Direct" msgid "GroupNestings.group_id" msgstr "Nested Group" +msgid "GroupNestings.group_id.desc" +msgstr "The current group. It will be nested into the Target Group." + msgid "GroupNestings.negate" msgstr "Negate Nesting" @@ -429,6 +432,9 @@ msgstr "If true, members of the Nested Group will not be eligible to be a member msgid "GroupNestings.target_group_id" msgstr "Target Group" +msgid "GroupNestings.target_group_id.desc" +msgstr "Where the current group will be nested" + msgid "Groups.desc.admins" msgstr "{0} Administrators" diff --git a/app/resources/locales/en_US/result.po b/app/resources/locales/en_US/result.po index 5e5a9b029..73e8159c8 100644 --- a/app/resources/locales/en_US/result.po +++ b/app/resources/locales/en_US/result.po @@ -102,6 +102,9 @@ msgstr "Added {0} as an owner of group {1}" msgid "GroupOwners.deleted" msgstr "Removed {0} as an owner of group {1}" +msgid "GroupNesting.deleted" +msgstr "Removed nesting from group" + msgid "IdentifierAssignments.assigned.already" msgstr "Identifiers Already Assigned ({0})" diff --git a/app/src/Controller/GroupNestingsController.php b/app/src/Controller/GroupNestingsController.php index a42f86c2f..169c5e2da 100644 --- a/app/src/Controller/GroupNestingsController.php +++ b/app/src/Controller/GroupNestingsController.php @@ -47,21 +47,38 @@ class GroupNestingsController extends StandardController { */ public function beforeRender(\Cake\Event\EventInterface $event) { - // Pull the Group name for breadcrumb rendering - - $link = $this->getPrimaryLink(true); - - if(!empty($link->value)) { - $this->set('vv_bc_parent_obj', $this->GroupNestings->Groups->get($link->value)); - $this->set('vv_bc_parent_displayfield', $this->GroupNestings->Groups->getDisplayField()); + if($this->request->getParam('action') != 'deleted') { + // Pull the Group name for breadcrumb rendering + $link = $this->getPrimaryLink(true); + + if(!empty($link->value)) { + $this->set('vv_bc_parent_obj', $this->GroupNestings->Groups->get($link->value)); + $this->set('vv_bc_parent_displayfield', $this->GroupNestings->Groups->getDisplayField()); + } + + // We need to calculate the available set of groups for nesting. We do this + // here rather than via autoViewVars because we need to know the current + // group (to exclude it). + + $this->set('targetGroups', $this->GroupNestings->availableGroups((int)$link->value)); + + return parent::beforeRender($event); } + } + + /** + * Handle the deleted action for a Group Nesting. + * This is used to set a flash message and override the target window. + * + * @since COmanage Registry v5.0.0 + */ + + public function deleted() { + // Add a flash message + $this->Flash->information(__d('result','GroupNesting.deleted')); + // Set the target window + $this->set('vv_target_window', 'top'); - // We need to calculate the available set of groups for nesting. We do this - // here rather than via autoViewVars because we need to know the current - // group (to exclude it). - - $this->set('targetGroups', $this->GroupNestings->availableGroups((int)$link->value)); - - return parent::beforeRender($event); + return parent::deleted(); } } \ No newline at end of file diff --git a/app/src/Model/Table/GroupNestingsTable.php b/app/src/Model/Table/GroupNestingsTable.php index 0fdda7cb2..29342f22f 100644 --- a/app/src/Model/Table/GroupNestingsTable.php +++ b/app/src/Model/Table/GroupNestingsTable.php @@ -46,6 +46,19 @@ class GroupNestingsTable extends Table { use \App\Lib\Traits\TableMetaTrait; use \App\Lib\Traits\ValidationTrait; + /** + * Provide the default layout + * + * @since COmanage Registry v5.0.0 + * @return string Type of redirect + */ + public function getLayout(string $action = ''): string { + return match($action) { + 'add','edit','view','deleted' => 'iframe', + default => 'default' + }; + } + /** * Perform Cake Model initialization. * @@ -76,6 +89,8 @@ public function initialize(array $config): void { $this->setPrimaryLink('group_id'); $this->setRequiresCO(true); + $this->setRedirectGoal('self'); + $this->setRedirectGoal(action: 'delete', goal: 'deleted'); $this->setEditContains(['Groups', 'GroupMembers', 'TargetGroups']); @@ -92,7 +107,8 @@ public function initialize(array $config): void { // Actions that operate over a table (ie: do not require an $id) 'table' => [ 'add' => ['platformAdmin', 'coAdmin'], - 'index' => ['platformAdmin', 'coAdmin'] + 'index' => ['platformAdmin', 'coAdmin'], + 'deleted' => ['platformAdmin', 'coAdmin'] ] ]); diff --git a/app/templates/GroupMembers/fields.inc b/app/templates/GroupMembers/fields.inc index b87a2ddf3..ce4a7f671 100644 --- a/app/templates/GroupMembers/fields.inc +++ b/app/templates/GroupMembers/fields.inc @@ -32,7 +32,7 @@ if($vv_action == 'add') { 'person_id' => $vv_selected_person['id'] ]; - // Present the person information in the view + // Present the person name in the view print $this->element('form/listItem', [ 'arguments' => [ 'fieldName' => '', @@ -64,6 +64,21 @@ if($vv_action == 'add') { $hidden = [ 'person_id' => $vv_obj->person_id ]; + + // Set the selected person for edit and view also + // so we can display the name and link to the person canvas. + $selectedPerson = [ + 'id' => $vv_obj->person_id, + 'name' => $vv_obj->person->primary_name->full_name + ]; + $this->set('vv_selected_person', $selectedPerson); + print $this->element('form/listItem', [ + 'arguments' => [ + 'fieldName' => '', + 'fieldLabel' => __d('field','name'), + 'groupmember' => $selectedPerson + ] + ]); } print $this->element('form/listItem', [ diff --git a/app/templates/GroupNestings/columns.inc b/app/templates/GroupNestings/columns.inc index 8be567c4c..e2c5b90d5 100644 --- a/app/templates/GroupNestings/columns.inc +++ b/app/templates/GroupNestings/columns.inc @@ -26,14 +26,44 @@ */ $indexColumns = [ - 'name' => [ - 'label' => __d('field', 'GroupNestings.target_group_id'), - 'type' => 'relatedLink', - 'model' => 'target_group', - 'field' => 'name' + 'id' => [ + 'type' => 'link', + 'class' => 'cm-modal-link nospin', // launch this in a modal + 'dataAttrs' => [ + ['data-cm-modal-title', __d('controller', 'GroupNestings', 1)] + ] + ], + 'group' => [ + 'label' => __d('field', 'GroupNestings.target_group_id'), + 'type' => 'relatedLink', + 'model' => 'target_group', + 'field' => 'name', + 'class' => 'cm-modal-link nospin', // launch this in a modal + 'dataAttrs' => [ + ['data-cm-modal-title', __d('controller', 'GroupNestings', 1)] + ] + ] +]; + +// $topLinks appear as an upper right menu +$topLinks = [ + [ + 'icon' => $this->Menu->getMenuIcon('Add'), + 'order' => $this->Menu->getMenuOrder('Add'), + 'label' => __d('operation', 'add.a',[__d('controller', 'GroupNestings', 1)]), + 'link' => [ + 'action' => 'add' + ], + 'class' => 'cm-modal-link nospin', // launch this in a modal + 'dataAttrs' => [ + ['data-cm-modal-title', __d('controller', 'GroupNestings', 1)] + ] ] ]; +// Suppress the normal add link in lieu of the one above +$suppressAddLink = true; + /* // When the $bulkActions variable exists in a columns.inc config, the "Bulk edit" switch will appear in the index. $bulkActions = [ diff --git a/app/templates/GroupNestings/fields-nav.inc b/app/templates/GroupNestings/fields-nav.inc deleted file mode 100644 index 1374feaae..000000000 --- a/app/templates/GroupNestings/fields-nav.inc +++ /dev/null @@ -1,34 +0,0 @@ - 'group', - 'active' => 'nestings' -]; \ No newline at end of file diff --git a/app/templates/GroupNestings/fields.inc b/app/templates/GroupNestings/fields.inc index 673e5b005..a82c8dc48 100644 --- a/app/templates/GroupNestings/fields.inc +++ b/app/templates/GroupNestings/fields.inc @@ -36,14 +36,16 @@ if($vv_action == 'add') { 'url' => [ 'controller' => 'groups', 'action' => 'edit', - $vv_obj->target_group_id] + $vv_obj->target_group_id + ], + 'target' => '_top' ]; // The target group can't be changed after adding print $this->element('form/listItem', [ 'arguments' => [ 'fieldName' => 'target_group_id', 'status' => $vv_obj->target_group->name, - 'link' => $link, + 'link' => $link ] ]); } @@ -53,14 +55,16 @@ if($vv_action == 'add' || $vv_action == 'edit') { 'url' => [ 'controller' => 'groups', 'action' => 'edit', - $vv_bc_parent_obj->id] + $vv_bc_parent_obj->id, + ], + 'target' => '_top' ]; // The target group can't be changed after adding print $this->element('form/listItem', [ 'arguments' => [ 'fieldName' => 'group_id', 'status' => $vv_bc_parent_obj->name, - 'link' => $link, + 'link' => $link ] ]); diff --git a/app/templates/element/form/infoDiv/groupMember.php b/app/templates/element/form/infoDiv/groupMember.php index 85f1baa17..9adf17448 100644 --- a/app/templates/element/form/infoDiv/groupMember.php +++ b/app/templates/element/form/infoDiv/groupMember.php @@ -33,10 +33,18 @@
- - + + Html->link( + $vv_selected_person['name'], + ['plugin' => null, + 'controller' => 'people', + 'action' => 'edit', + $vv_selected_person['id'] + ], + ['target' => '_top'] + );?> - + ()
diff --git a/app/webroot/css/co-base.css b/app/webroot/css/co-base.css index 07997bd8b..62d008fc9 100644 --- a/app/webroot/css/co-base.css +++ b/app/webroot/css/co-base.css @@ -1802,7 +1802,7 @@ li[data-pc-section="emptymessage"] { padding: 1em; gap: 4px; } -.group-member-to-add-name { +.group-member-name { margin-right: 0.5em; font-size: 1.4em; }