diff --git a/app/resources/locales/en_US/default.po b/app/resources/locales/en_US/default.po index dde5e45aa..86a6ea082 100644 --- a/app/resources/locales/en_US/default.po +++ b/app/resources/locales/en_US/default.po @@ -536,6 +536,9 @@ msgstr "Clear" msgid "match.op.clear.filters" msgstr "{0,plural,=1{Clear Filter} other{Clear Filters}}" +msgid "match.op.configure" +msgstr "Configure" + msgid "match.op.configure.a" msgstr "Configure {0}" diff --git a/app/src/Controller/MatchgridsController.php b/app/src/Controller/MatchgridsController.php index cb18f560e..83e3bf0b6 100644 --- a/app/src/Controller/MatchgridsController.php +++ b/app/src/Controller/MatchgridsController.php @@ -50,7 +50,7 @@ class MatchgridsController extends StandardController { public function beforeFilter(EventInterface $event) { // Only certain actions require a matchgrid ID if(in_array($this->request->getParam('action'), - ['build', 'manage', 'pending', 'reconcile'])) { + ['build', 'manage', 'configure', 'pending', 'reconcile'])) { $this->Matchgrids->setRequiresMatchgrid(true); } @@ -102,6 +102,7 @@ public function isAuthorized(Array $user) { 'edit' => $platformAdmin, 'index' => $platformAdmin, 'manage' => $platformAdmin || $mgAdmin, + 'configure' => $platformAdmin || $mgAdmin, 'pending' => $platformAdmin || $mgAdmin || $recMgr, 'reconcile' => $platformAdmin || $mgAdmin || $recMgr, // We allow anyone to access select since we don't have a matchgrid context yet. @@ -124,6 +125,17 @@ public function isAuthorized(Array $user) { public function manage(string $id) { $this->set('vv_title', __('match.op.manage.a', [$this->cur_mg->table_name])); } + + /** + * Configure a matchgrid. This is an index of items to configure for the matchgrid. + * + * @since COmanage Match v1.0.0 + * @param String $id Matchgrid ID + */ + + public function configure(string $id) { + $this->set('vv_title', __('match.op.configure.a', [$this->cur_mg->table_name])); + } /** * Display the set of pending requests. diff --git a/app/src/Model/Table/MatchgridsTable.php b/app/src/Model/Table/MatchgridsTable.php index c4968bd2f..707dc22cb 100644 --- a/app/src/Model/Table/MatchgridsTable.php +++ b/app/src/Model/Table/MatchgridsTable.php @@ -90,7 +90,7 @@ public function initialize(array $config): void { ] ]); - $this->setAllowLookupPrimaryLink(['build', 'manage', 'pending', 'reconcile']); + $this->setAllowLookupPrimaryLink(['build', 'manage', 'configure', 'pending', 'reconcile']); } /** diff --git a/app/templates/MatchgridRecords/columns.inc b/app/templates/MatchgridRecords/columns.inc index 5472432e1..3e4637663 100644 --- a/app/templates/MatchgridRecords/columns.inc +++ b/app/templates/MatchgridRecords/columns.inc @@ -36,7 +36,7 @@ $enableSearch = true; // force the model's table only to the one associated with the matchgrid $indexColumns = [ 'id' => [ - 'type' => 'echo', + 'type' => 'link', 'sortable' => true ], 'sor' => [ diff --git a/app/templates/Matchgrids/configure.php b/app/templates/Matchgrids/configure.php new file mode 100644 index 000000000..c7b2d66e7 --- /dev/null +++ b/app/templates/Matchgrids/configure.php @@ -0,0 +1,116 @@ + +
+
+

+
+
+ +
+ + 'settings', + 'api_users' => 'vpn_key', + 'attributes' => 'edit', + 'attribute_groups' => 'storage', + 'attribute_maps' => 'swap_horiz', + 'rules' => 'assignment', + 'systems_of_record' => 'gavel', + ]; + + // We'll get most users simply by checking for build permission + $renderConfig = $vv_permissions['build']; + + if(!$renderConfig) { + foreach(array_keys($models) as $m) { + if(isset($vv_menu_permissions[$m]) && $vv_menu_permissions[$m]===true) { + $renderConfig = true; + break; + } + } + } + } + ?> + + + +
diff --git a/app/templates/Matchgrids/manage.php b/app/templates/Matchgrids/manage.php index 274bd7d72..c33a7167e 100644 --- a/app/templates/Matchgrids/manage.php +++ b/app/templates/Matchgrids/manage.php @@ -34,6 +34,12 @@
+ description)): ?> +

+ description; ?> +

+ +
@@ -56,84 +62,4 @@
- - - 'settings', - 'api_users' => 'vpn_key', - 'attributes' => 'edit', - 'attribute_groups' => 'storage', - 'attribute_maps' => 'swap_horiz', - 'rules' => 'assignment', - 'systems_of_record' => 'gavel', - ]; - - // We'll get most users simply by checking for build permission - $renderConfig = $vv_permissions['build']; - - if(!$renderConfig) { - foreach(array_keys($models) as $m) { - if(isset($vv_menu_permissions[$m]) && $vv_menu_permissions[$m]===true) { - $renderConfig = true; - break; - } - } - } - } - ?> - -

- -
diff --git a/app/templates/Matchgrids/reconcile.php b/app/templates/Matchgrids/reconcile.php index 7b362c987..b366187f1 100644 --- a/app/templates/Matchgrids/reconcile.php +++ b/app/templates/Matchgrids/reconcile.php @@ -111,7 +111,7 @@ 'referenceid' => (!empty($c['referenceid']) ? $c['referenceid'] : 'new') ], 'confirm' => __('match.op.assign.confirm'), - 'class' => 'btn btn-primary']); + 'class' => 'btn btn-primary nospin']); ?> diff --git a/app/templates/Matchgrids/select.php b/app/templates/Matchgrids/select.php index 41ccff109..e7896ce1f 100644 --- a/app/templates/Matchgrids/select.php +++ b/app/templates/Matchgrids/select.php @@ -46,7 +46,6 @@
-
-
-
- Html->link(__('match.op.manage'), - ['controller' => 'Matchgrids', - 'action' => 'manage', - $mg['id']], - ['class' => 'btn btn-primary btn-sm']); - } - ?>
diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 3bad83f09..4c0b7dc1d 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -263,7 +263,7 @@ function _column_key($modelsName, $c, $tz=null) { foreach($linkActions as $a) { // Does this user have permission for this action? if($vv_permissions[$a]) { - print $this->Html->link($label, ['action' => $a, $entity->id]); + print $this->Html->link($label, ['action' => $a, $entity->id]); $linked = true; break 2; } @@ -306,7 +306,7 @@ function _column_key($modelsName, $c, $tz=null) { array_merge_recursive(['action' => 'delete'], $linkArgs), // XXX should be configurable which field we put in, maybe displayField? ['confirm' => __($product.'.op.delete.confirm', [$entity->id]), - 'class' => 'deletebutton'] + 'class' => 'deletebutton nospin'] ); } @@ -329,7 +329,7 @@ function _column_key($modelsName, $c, $tz=null) { array_merge_recursive(['action' => $a['action']], $linkArgs), // XXX should be configurable which field we put in, maybe displayField? ['confirm' => __($confirmKey, [$entity->id]), - 'class' => $a['class']] + 'class' => $a['class'] . ' nospin'] ); } elseif(!empty($a['controller'])) { // We're linking into a related controller diff --git a/app/templates/element/breadcrumbs.php b/app/templates/element/breadcrumbs.php index 74189ee10..4b7fa6351 100644 --- a/app/templates/element/breadcrumbs.php +++ b/app/templates/element/breadcrumbs.php @@ -30,9 +30,8 @@ if($this->request->getRequestTarget(false) != '/') { // Don't bother rendering breadcrumbs if we're already at the top page + $controller = $this->request->getParam('controller'); $action = $this->request->getParam('action'); - // $this->name = Models - $modelsName = $this->name; $this->Breadcrumbs->setTemplates([ 'wrapper' => '{{content}}', @@ -48,7 +47,7 @@ ); if(!empty($vv_cur_mg) - && ($modelsName != 'Matchgrids' || $action != 'manage')) { + && ($controller != 'Matchgrids' || $action != 'manage')) { // Link to matchgrid if set $this->Breadcrumbs->add( $vv_cur_mg->table_name, @@ -82,15 +81,38 @@ $vv_primary_link_obj->id] ); } + + // Insert Matchgrid "Configure" breadcrumb for matchgrid configuration pages + if (!empty($vv_cur_mg) && + ($controller == 'MatchgridSettings' || + $controller == 'Attributes' || + $controller == 'ApiUsers' || + $controller == 'AttributeGroups' || + $controller == 'AttributeMaps' || + $controller == 'Rules' || + $controller == 'RuleAttributes' || + $controller == 'SystemsOfRecord')) { + $crumbLinkText = 'match.op.configure'; + $target = [ + 'controller' => 'matchgrids', + 'action' => 'configure', + $vv_cur_mg->id + ]; + + $this->Breadcrumbs->add( + __($crumbLinkText, [99]), + $target + ); + } - if($action != 'index' && $action != 'manage' - && !($modelsName == 'Matchgrids' && $action == 'pending')) { + if($action != 'index' && $action != 'manage' && $action != 'configure' + && !($controller == 'Matchgrids' && $action == 'pending')) { // Default parent is index, to which we might need to append the Primary Link ID - $crumbLinkText = 'match.ct.'.$modelsName; + $crumbLinkText = 'match.ct.'.$controller; $target = [ - 'controller' => Inflector::dasherize($modelsName), + 'controller' => Inflector::dasherize($controller), 'action' => 'index' ]; @@ -99,10 +121,10 @@ } // Non-index special cases - if ($modelsName == 'Matchgrids' && $action == 'reconcile') { + if ($controller == 'Matchgrids' && $action == 'reconcile') { $crumbLinkText = 'match.ac.PendingRequests'; $target = [ - 'controller' => Inflector::dasherize($modelsName), + 'controller' => Inflector::dasherize($controller), 'action' => 'pending', $vv_cur_mg->id // will always be set for reconcile ]; diff --git a/app/templates/element/javascript.php b/app/templates/element/javascript.php index ecef779dd..53b06a0bc 100644 --- a/app/templates/element/javascript.php +++ b/app/templates/element/javascript.php @@ -259,19 +259,15 @@ location.href = $(this).find('a.row-link').attr('href'); }); - // Add a spinner when a form is submitted or when any item is clicked with a "spin" class - $("input[type='submit'], .spin").click(function() { + // Add loading animation when a form is submitted, when any item with a "spin" class is clicked, + // or on any button or anchor tag lacking the .nospin class. + $("input[type='submit'], button:not(.nospin), a:not(.nospin), .spin").click(function() { - var spinnerDiv = '
'; - $("body").append(spinnerDiv); - - var coSpinnerTarget = document.getElementById('coSpinner'); - // coSpinnerOpts are set in js/comanage.js - var coSpinner = new Spinner(coSpinnerOpts).spin(coSpinnerTarget); + displaySpinner(); // Test for invalid fields (HTML5) and turn off spinner explicitly if found if(document.querySelectorAll(":invalid").length) { - coSpinner.stop(); + stopSpinner(); } }); diff --git a/app/templates/element/menuMain.php b/app/templates/element/menuMain.php index 1537d4f27..284bcf873 100644 --- a/app/templates/element/menuMain.php +++ b/app/templates/element/menuMain.php @@ -66,4 +66,16 @@ ?> + +
  • + Html->link( + ' + ' . __('match.op.configure') . '', + ['controller' => 'Matchgrids', + 'action' => 'configure', + $vv_cur_mg->id], + ['escape' => false]); + ?> +
  • + diff --git a/app/templates/element/menuTop.php b/app/templates/element/menuTop.php index 17601a687..99c95d100 100644 --- a/app/templates/element/menuTop.php +++ b/app/templates/element/menuTop.php @@ -30,11 +30,11 @@