diff --git a/app/resources/locales/en_US/operation.po b/app/resources/locales/en_US/operation.po index 52a618c5d..c157cd963 100644 --- a/app/resources/locales/en_US/operation.po +++ b/app/resources/locales/en_US/operation.po @@ -42,6 +42,9 @@ msgstr "Are you sure you wish to generate a new API Key?" msgid "applySchema" msgstr "Apply Database Schema" +msgid "assign" +msgstr "Assign" + msgid "cancel" msgstr "Cancel" @@ -57,6 +60,9 @@ msgstr "Close" msgid "confirm" msgstr "Confirm" +msgid "confirm.generic" +msgstr "Are you sure you want to confirm this action?" + msgid "configure.a" msgstr "Configure {0}" @@ -99,6 +105,9 @@ msgstr "Go" msgid "identifiers.assign" msgstr "Assign Identifiers" +msgid "identifiers.assign.confirm" +msgstr "Are you sure you want to assign identifiers to this record ({0})?" + msgid "last" msgstr "Last" @@ -138,6 +147,9 @@ msgstr "Add/Restore Default Types" msgid "reconcile" msgstr "Reconcile" +msgid "reconcile.confirm" +msgstr "Are you sure you want to reconcile this group ({0})?" + msgid "remove" msgstr "Remove" diff --git a/app/templates/Groups/columns.inc b/app/templates/Groups/columns.inc index ba15093f0..b572ebc63 100644 --- a/app/templates/Groups/columns.inc +++ b/app/templates/Groups/columns.inc @@ -64,15 +64,12 @@ $rowActions = [ 'action' => 'index', 'icon' => 'history' ], - [ - 'controller' => 'identifiers', - 'action' => 'index', - 'icon' => 'label', - 'if' => 'notAutomatic' - ], [ 'action' => 'reconcile', - 'icon' => 'sync' + 'icon' => 'sync', + 'confirm' => [ + 'dg_confirm_btn' => __d('operation', 'reconcile') + ] ] ]; diff --git a/app/templates/Groups/fields-nav.inc b/app/templates/Groups/fields-nav.inc index 355c896fe..9d9801cef 100644 --- a/app/templates/Groups/fields-nav.inc +++ b/app/templates/Groups/fields-nav.inc @@ -73,6 +73,11 @@ $topLinks = [ 'group_id' => $vv_obj->id ] ], + 'if' => 'notAutomatic', + 'confirm' => [ + 'dg_body_txt' => __d('operation', 'identifiers.assign.confirm',[$vv_obj->id]), + 'dg_confirm_btn' => __d('operation', 'assign') + ], 'class' => '' ], [ @@ -83,6 +88,10 @@ $topLinks = [ 'action' => 'reconcile', $vv_obj->id ], + 'confirm' => [ + 'dg_body_txt' => __d('operation', 'reconcile.confirm', [$vv_obj->id]), + 'dg_confirm_btn' => __d('operation', 'reconcile') + ], 'class' => '' ] ]; diff --git a/app/templates/IdentifierAssignments/columns.inc b/app/templates/IdentifierAssignments/columns.inc index ed843c2b5..44fe84b88 100644 --- a/app/templates/IdentifierAssignments/columns.inc +++ b/app/templates/IdentifierAssignments/columns.inc @@ -57,8 +57,11 @@ $rowActions = [ 'icon' => 'electrical_services' ] ]; - -// TODO: develop $bulkActions. For now, use a placeholder. + +/* +// When the $bulkActions variable exists in a columns.inc config, the "Bulk edit" switch will appear in the index. $bulkActions = [ + // TODO: develop bulk actions. For now, use a placeholder. 'delete' => true -]; \ No newline at end of file +]; +*/ \ No newline at end of file diff --git a/app/templates/People/fields-nav.inc b/app/templates/People/fields-nav.inc index 96ede675b..b97d5ec44 100644 --- a/app/templates/People/fields-nav.inc +++ b/app/templates/People/fields-nav.inc @@ -80,6 +80,10 @@ $topLinks = [ 'person_id' => $vv_obj->id ] ], + 'confirm' => [ + 'dg_body_txt' => __d('operation', 'identifiers.assign.confirm', [$vv_obj->id]), + 'dg_confirm_btn' => __d('operation', 'assign') + ], 'class' => '' ] ]; diff --git a/app/templates/ProvisioningTargets/status.php b/app/templates/ProvisioningTargets/status.php index 406ad3a14..4c8527537 100644 --- a/app/templates/ProvisioningTargets/status.php +++ b/app/templates/ProvisioningTargets/status.php @@ -79,27 +79,31 @@ [ 'order' => $this->Menu->getMenuOrder('Default'), 'icon' => 'start', - 'url' => $this->Url->build([ + 'url' => [ 'controller' => $vv_primary_link_model, 'action' => 'provision', $vv_primary_link_obj->id, '?' => [ 'provisioning_target_id' => $p['target']->id ] - ]), - 'label' => __d('operation', 'provision') + ], + 'label' => __d('operation', 'provision'), + 'confirm' => [ + 'dg_body_txt' => __d('operation', 'provision.confirm'), + 'dg_confirm_btn' => __d('operation', 'provision') + ] ], [ 'order' => $this->Menu->getMenuOrder('Default'), 'icon' => 'history', - 'url' => $this->Url->build([ + 'url' => [ 'controller' => 'provisioning_history_records', 'action' => 'index', '?' => [ 'provisioning_target_id' => $p['target']->id, StringUtilities::entityToForeignKey($vv_primary_link_obj) => $vv_primary_link_obj->id ] - ]), + ], 'label' => __d('controller', 'ProvisioningHistoryRecords', [99]) ] ]; diff --git a/app/templates/Standard/add-edit-view.php b/app/templates/Standard/add-edit-view.php index 520cd690a..39fc8818e 100644 --- a/app/templates/Standard/add-edit-view.php +++ b/app/templates/Standard/add-edit-view.php @@ -125,32 +125,29 @@ $action_args['vv_actions'][] = [ 'order' => $this->Menu->getMenuOrder($t['order']), 'icon' => $this->Menu->getMenuIcon($t['icon']), - 'url' => $this->Url->build($t['link']), + 'url' => $t['link'], 'label' => $t['label'], + 'class' => !empty($t['class']) ? $t['class'] : '', + 'confirm' => !empty($t['confirm']) ? $t['confirm'] : [] ]; } } // 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( + $action_args['vv_actions'][] = [ 'order' => $this->Menu->getMenuOrder('Delete'), 'icon' => $this->Menu->getMenuIcon('Delete'), - 'url' => 'javascript:void(0);', + 'url' => ['action' => 'delete', $vv_obj->id], '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'), + 'class' => 'deletebutton', + 'confirm' => [ + 'method' => 'post', 'dg_title' => __d('operation', 'remove'), - 'dg_bd_txt_repl_str' => '' - ) - ); + 'dg_body_txt' => __d('operation', 'delete.confirm', [$vv_obj->id]), + 'dg_confirm_btn' => __d('operation', 'remove') + ] + ]; } if(!empty($action_args['vv_actions'])) { diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 7315a375d..bfc62c035 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -105,13 +105,11 @@ $action_args['vv_actions'][] = [ 'order' => $this->Menu->getMenuOrder('Add'), 'icon' => $this->Menu->getMenuIcon('Add'), - 'url' => $this->Url->build( - [ - 'controller' => $modelsName, - 'action' => 'add', - '?' => $linkFilter - ] - ), + 'url' => [ + 'controller' => $modelsName, + 'action' => 'add', + '?' => $linkFilter + ], 'label' => __d('operation', 'add.a', __d('controller', $modelsName, [1])), ]; } @@ -128,8 +126,10 @@ $action_args['vv_actions'][] = [ 'order' => $this->Menu->getMenuOrder($t['order']), 'icon' => $this->Menu->getMenuIcon($t['icon']), - 'url' => $this->Url->build($t['link']), + 'url' => $t['link'], 'label' => $t['label'], + 'class' => !empty($t['class']) ? $t['class'] : '', + 'confirm' => !empty($t['confirm']) ? $t['confirm'] : [] ]; } } @@ -260,65 +260,60 @@ $actionIcon = !empty($a['icon']) ? $a['icon'] : $this->Menu->getMenuIcon('Default'); $actionIconClass = !empty($a['iconClass']) ? $a['iconClass'] : ''; $actionClass = !empty($a['class']) ? $a['class'] : ''; - $actionUrl = ''; - $actionLabel = ''; - $actionOnClick = []; // used for confirmation dialog + $actionUrl = ['action' => $a['action'], $entity->id]; + $actionLabel = !empty($a['label']) ? $a['label'] : __d('operation', $a['action']); - // Generate the link text and urls: - - // If we have a .confirm text, we need to generate a confirm dialog box - $confirmKey = $a['action'].'.confirm'; - $confirmTxt = __d('operation', $confirmKey); + if (!empty($a['controller'])) { + // We're linking into a related controller + $actionLabel = !empty($a['label']) ? $a['label'] : __d('controller', Inflector::camelize(Inflector::pluralize($a['controller'])), [99]); + $actionUrl = [ + 'controller' => $a['controller'], + 'action' => $a['action'], + '?' => [$tableFK => $entity->id] + ]; + } - if($confirmTxt != $confirmKey) { - // We found the localized string - $actionPostBtnArray = ['action' => $a['action'], $entity->id]; - $actionUrl = $this->Url->build(['action' => $a['action'], $entity->id]); - // XXX should be configurable which field we put in, maybe displayField? + // Generate the link text and urls: + + if(!empty($a['confirm'])) { + // Gather the default confirmation body text. By convention this is named + // [action].confirm in the operation.po file but can be overridden in the actions array. + $confirmKey = $a['action'].'.confirm'; + $confirmTxt = __d('operation', $confirmKey, [$entity->id]); + + // Gather the dialog text - we need to expand these (here) so we can provide the default confirmTxt when appropriate + $dialogBodyText = !empty($a['confirm']['dg_body_txt']) ? $a['confirm']['dg_body_txt'] : $confirmTxt; + $dialogTitle = !empty($a['confirm']['dg_title']) ? $a['confirm']['dg_title'] : $actionLabel; + $confirmButtonText = !empty($a['confirm']['dg_confirm_btn']) ? $a['confirm']['dg_confirm_btn'] : __d('operation','confirm'); + $cancelButtonText = !empty($a['confirm']['dg_cancel_btn']) ? $a['confirm']['dg_cancel_btn'] : __d('operation','cancel'); + $replacements = !empty($a['confirm']['dg_body_txt_replacements']) ? $a['confirm']['dg_body_txt_replacements'] : ''; + $action_args['vv_actions'][] = array( 'order' => $actionOrder, 'icon' => $actionIcon, - 'url' => 'javascript:void(0);', - 'label' => __d('operation', $a['action']), + 'iconClass' => $actionIconClass, + 'url' => $actionUrl, + 'label' => $actionLabel, 'class' => !empty($actionClass) ? $actionClass . ' nospin' : 'nospin', - 'onclick' => array( - 'dg_bd_txt' => __d('operation', $confirmKey, [$entity->id]), // dialog body text - 'dg_post_btn_array' => $actionPostBtnArray, // postButton array for building the postButton - 'dg_url' => $actionUrl, // action url for building a unique ID - 'dg_conf_btn' => __d('operation', 'confirm'), // dialog confirm button text - 'dg_cancel_btn' => __d('operation', 'cancel'), // dialog cancel button text - 'dg_title' => __d('operation', 'confirm'), // dialog box title - 'dg_bd_txt_repl_str' => '' // dialog body text replacement strings - ), - ); - } elseif(!empty($a['controller'])) { - // We're linking into a related controller - $actionLabel = __d('controller', Inflector::camelize(Inflector::pluralize($a['controller'])), [99]); - $actionUrl = $this->Url->build( - ['controller' => $a['controller'], - 'action' => $a['action'], - '?' => [ $tableFK => $entity->id] ] + 'confirm' => [ + 'dg_title' => $dialogTitle, + 'dg_body_txt' => $dialogBodyText, + 'dg_confirm_btn' => $confirmButtonText, + 'dg_cancel_btn' => $cancelButtonText, + 'dg_body_txt_replacements' => $replacements + ] ); } else { - $actionLabel = __d('operation', $a['action']); - $actionUrl = $this->Url->build(['action' => $a['action'], $entity->id]); - } - - // If a specific label is sent in the config, use it instead - if(!empty($a['label'])) { - $actionLabel = $a['label']; + // Set the action link configuration + $action_args['vv_actions'][] = array( + 'order' => $actionOrder, + 'icon' => $actionIcon, + 'iconClass' => $actionIconClass, + 'url' => $actionUrl, + 'label' => $actionLabel, + 'class' => $actionClass + ); } - - // Set the action link configuration - $action_args['vv_actions'][] = array( - 'order' => $actionOrder, - 'icon' => $actionIcon, - 'iconClass' => $actionIconClass, - 'url' => $actionUrl, - 'label' => $actionLabel, - 'class' => $actionClass, - 'onclick' => $actionOnClick - ); } } diff --git a/app/templates/element/menuAction.php b/app/templates/element/menuAction.php index b70d01337..ba1dcbc95 100644 --- a/app/templates/element/menuAction.php +++ b/app/templates/element/menuAction.php @@ -64,6 +64,7 @@ class="= $actionsMenuClass; ?>">
- */ ?> diff --git a/app/templates/element/subnavigation.php b/app/templates/element/subnavigation.php index bb624ad0c..9e8b10f0a 100644 --- a/app/templates/element/subnavigation.php +++ b/app/templates/element/subnavigation.php @@ -118,26 +118,23 @@ } } // delete - $actionPostBtnArray = ['action' => 'delete', $curId]; - $actionUrl = $this->Url->build(['action' => 'delete', $curId]); $action_args['vv_actions'][] = array( 'order' => $this->Menu->getMenuOrder('Delete'), 'icon' => $this->Menu->getMenuIcon('Delete'), - 'url' => 'javascript:void(0);', + 'url' => ['action' => 'delete', $curId], 'label' => __d('operation', 'delete'), 'class' => 'deletebutton nospin', - 'onclick' => array( - 'dg_bd_txt' => __d( + 'confirm' => array( + 'dg_body_txt' => __d( 'operation', 'delete.confirm', [$supertitle . ', ' . __d('information','entity.id',[$curId])] ), 'dg_post_btn_array' => $actionPostBtnArray, - 'dg_url' => $actionUrl, - 'dg_conf_btn' => __d('operation', 'remove'), + 'dg_confirm_btn' => __d('operation', 'remove'), 'dg_cancel_btn' => __d('operation', 'cancel'), 'dg_title' => __d('operation', 'remove'), - 'dg_bd_txt_repl_str' => '' + 'dg_body_txt_replacements' => '' ) ); ?> diff --git a/app/webroot/js/comanage/comanage.js b/app/webroot/js/comanage/comanage.js index 0dd271a1b..f57e94db1 100644 --- a/app/webroot/js/comanage/comanage.js +++ b/app/webroot/js/comanage/comanage.js @@ -67,18 +67,20 @@ function replaceTokens(text,replacements) { return processedString; } -// Generate a dialog box confirming