From 9be6b3cdda8007ec04aa348be5241b5b54c7335e Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Mon, 18 Jul 2022 16:51:06 -0400 Subject: [PATCH 1/6] Render version on configuration page (CO-2450) --- app/resources/locales/en_US/default.po | 2 +- app/templates/Matchgrids/configure.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/resources/locales/en_US/default.po b/app/resources/locales/en_US/default.po index fc241661..53a59b73 100644 --- a/app/resources/locales/en_US/default.po +++ b/app/resources/locales/en_US/default.po @@ -43,7 +43,7 @@ msgid "match.meta.powered" msgstr "Powered By" msgid "match.meta.version" -msgstr "Version {0}" +msgstr "COmanage Match v{0}" ### Banners msgid "match.banner.api_users.matchgrid" diff --git a/app/templates/Matchgrids/configure.php b/app/templates/Matchgrids/configure.php index c7b2d66e..e21a15e0 100644 --- a/app/templates/Matchgrids/configure.php +++ b/app/templates/Matchgrids/configure.php @@ -33,6 +33,8 @@ </div> </div> +<?= __('match.meta.version', [chop(file_get_contents(CONFIG . DS . "VERSION"))]); ?> + <section class="inner-content"> <!-- Matchgrid Configuration --> <?php From 2417df458efe4c23b5ef9ff719760349ae462593 Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Mon, 1 Aug 2022 14:12:49 -0400 Subject: [PATCH 2/6] Sort SoR list in ApiUser fields (NOJIRA) --- app/src/Model/Table/ApiUsersTable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/Model/Table/ApiUsersTable.php b/app/src/Model/Table/ApiUsersTable.php index 7007d413..3c9ead2b 100644 --- a/app/src/Model/Table/ApiUsersTable.php +++ b/app/src/Model/Table/ApiUsersTable.php @@ -70,7 +70,8 @@ public function initialize(array $config): void { 'systemsOfRecord' => [ 'type' => 'select', 'model' => 'SystemsOfRecord', - 'find' => 'filterPrimaryLink' + 'find' => 'filterPrimaryLink', + 'order' => ['label' => 'ASC'] ] ]); } From 5f89259593ac82c80452da7ea284cc9f0020d7b3 Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Fri, 5 Aug 2022 17:14:40 -0400 Subject: [PATCH 3/6] Render request and resolution times in matchgrid record view (NOJIRA) --- app/resources/locales/en_US/default.po | 3 +++ app/src/View/Helper/FieldHelper.php | 23 ++++++++++++++++++++--- app/templates/MatchgridRecords/fields.inc | 5 +++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/resources/locales/en_US/default.po b/app/resources/locales/en_US/default.po index 53a59b73..64146274 100644 --- a/app/resources/locales/en_US/default.po +++ b/app/resources/locales/en_US/default.po @@ -453,6 +453,9 @@ msgstr "Required" msgid "match.fd.resolution_mode" msgstr "Resolution Mode" +msgid "match.fd.resolution_time" +msgstr "Resolution Time" + msgid "match.fd.RuleAttributes.match_empty" msgstr "Match Empty Values" diff --git a/app/src/View/Helper/FieldHelper.php b/app/src/View/Helper/FieldHelper.php index 57028dfd..c94fe17c 100644 --- a/app/src/View/Helper/FieldHelper.php +++ b/app/src/View/Helper/FieldHelper.php @@ -34,7 +34,7 @@ use \Cake\View\Helper; class FieldHelper extends Helper { - public $helpers = ['Form']; + public $helpers = ['Form', 'Time']; // Is this read-only or read-write? protected $editable = true; @@ -65,6 +65,7 @@ public function control(string $fieldName, array $childControls=[]) { $coptions = $options; $coptions['label'] = false; + $isRequired = $required; // We might override this below $label = null; $desc = null; @@ -106,6 +107,17 @@ public function control(string $fieldName, } } + $control = ''; + + if(is_object($this->viewObj->$fieldName) + && get_class($this->viewObj->$fieldName) == 'Cake\I18n\FrozenTime') { + // This is a read-only timestamp, use the field to render itself + $control = $this->viewObj->$fieldName->nice(); + $isRequired = false; + } else { + $control = $this->Form->control($fieldName, $coptions); + } + $children = ''; if(!empty($childControls)) { @@ -120,18 +132,23 @@ public function control(string $fieldName, $children .= "</ul>"; } + if(isset($options['readonly']) && $options['readonly']) { + // Read only attributes can't be required + $isRequired = false; + } + return '<li> <div class="field-name"> <div class="field-title"> ' . ($this->editable ? $this->Form->label($fieldName, $label) : $label) - . ($required ? ' <span class="required">*</span>' : '') . ' + . ($isRequired ? ' <span class="required">*</span>' : '') . ' </div> ' . ($desc ? '<span class="field-desc">' . $desc . '</span>' : "") .' </div> <div class="field-info"> - ' . $this->Form->control($fieldName, $coptions) . ' + ' . $control . ' ' . $children . ' </div> </li> diff --git a/app/templates/MatchgridRecords/fields.inc b/app/templates/MatchgridRecords/fields.inc index 79cad513..b39a255f 100644 --- a/app/templates/MatchgridRecords/fields.inc +++ b/app/templates/MatchgridRecords/fields.inc @@ -51,4 +51,9 @@ if($action == 'add' || $action == 'edit') { } print $this->Field->control('referenceid', [], false, __('match.fd.referenceid', [1])); +} + +if($action == 'edit') { + print $this->Field->control('request_time'); + print $this->Field->control('resolution_time'); } \ No newline at end of file From 80bd522b3e8d148b55ada848564494618bac68b6 Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Fri, 5 Aug 2022 17:15:37 -0400 Subject: [PATCH 4/6] Replace deprecated strftotime call (NOJIRA) --- app/src/Lib/Match/ResultManager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/Lib/Match/ResultManager.php b/app/src/Lib/Match/ResultManager.php index 3b7639a5..00a70979 100644 --- a/app/src/Lib/Match/ResultManager.php +++ b/app/src/Lib/Match/ResultManager.php @@ -137,8 +137,8 @@ protected function filterMetadata($parsed, $referenceId=null) { case 'request_time': case 'resolution_time': // Timestamps, format and inflect name - $ret['meta'][\Cake\Utility\Inflector::variable($attr)] = strftime("%FT%TZ", - strtotime($parsed[$attr])); + $ret['meta'][\Cake\Utility\Inflector::variable($attr)] = date("Y-m-d\TH:i:s\Z", + strtotime($parsed[$attr])); break; case 'sor': $ret['meta']['sorLabel'] = $parsed[$attr]; From e6f58e89bfe6fc5006626b634c41727fc8fedea5 Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Sun, 7 Aug 2022 06:53:23 -0400 Subject: [PATCH 5/6] Fix handling of resolution_time for unresolved requests (NOJIRA) --- app/templates/MatchgridRecords/fields.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/templates/MatchgridRecords/fields.inc b/app/templates/MatchgridRecords/fields.inc index b39a255f..204e9d4a 100644 --- a/app/templates/MatchgridRecords/fields.inc +++ b/app/templates/MatchgridRecords/fields.inc @@ -55,5 +55,6 @@ if($action == 'add' || $action == 'edit') { if($action == 'edit') { print $this->Field->control('request_time'); - print $this->Field->control('resolution_time'); + // Force resolution to read only since it might not be populated + print $this->Field->control('resolution_time', ['readonly' => true]); } \ No newline at end of file From 55b7752c9423b47fba80dc74ecee729261351499 Mon Sep 17 00:00:00 2001 From: Benn Oshrin <boshrin@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:49:22 -0400 Subject: [PATCH 6/6] Fix installation of English Nicknames (CO-2476) --- app/templates/AttributeMappings/columns.inc | 6 ++++-- app/templates/Standard/index.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/templates/AttributeMappings/columns.inc b/app/templates/AttributeMappings/columns.inc index 87bd4a30..0b65c532 100644 --- a/app/templates/AttributeMappings/columns.inc +++ b/app/templates/AttributeMappings/columns.inc @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * @link http://www.internet2.edu/comanage COmanage Project + * @link https://www.internet2.edu/comanage COmanage Project * @package match * @since COmanage Match v1.0.0 * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) @@ -43,8 +43,10 @@ $topLinks = [ 'label' => '<em class="material-icons" aria-hidden="true">file_download</em> ' . __('match.op.AttributeMappings.install.nicknames.en'), 'link' => [ - 'action' => 'install', + 'action' => 'install', + '?' => [ 'mapping' => 'nicknames.en' + ] ], 'class' => 'buildbutton' ] diff --git a/app/templates/Standard/index.php b/app/templates/Standard/index.php index 78b93eed..404f7c0a 100644 --- a/app/templates/Standard/index.php +++ b/app/templates/Standard/index.php @@ -104,7 +104,7 @@ function _column_key($modelsName, $c, $tz=null) { print '<li>' . $this->Html->link( $t['label'], - array_merge($linkFilter, $t['link']), + array_merge_recursive($linkFilter, $t['link']), ['escape' => false, 'class' => $t['class']] ) . ' </li>';