-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cfm 324 attribute collector save attributes - improvements (#294)
* Fixes and improvements * Refactoring after EnvSource feature push * Remove unnecessary comments * FieldHelper fix date hidden field
- Loading branch information
Showing
18 changed files
with
305 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
app/plugins/EnvSource/src/View/Cell/EnvSourceCollectorsCell.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| <?php | ||
| /* | ||
| * COmanage Registry EnvSource Collectors Cell | ||
| * | ||
| * Portions licensed to the University Corporation for Advanced Internet | ||
| * Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * UCAID licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * @link https://www.internet2.edu/comanage COmanage Project | ||
| * @package registry | ||
| * @since COmanage Registry v5.1.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| * | ||
| * This generic modal dialog stub is used for confirmations, e.g. when deleting a record. | ||
| * The text of the box is overridden with JavaScript, and the confirm button is intended to | ||
| * click a CakePHP postLink or postButton in the DOM. Use jsConfirmGeneric() to call it. | ||
| */ | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace EnvSource\View\Cell; | ||
|
|
||
| use Cake\View\Cell; | ||
|
|
||
| /** | ||
| * EnvSourceCollectors cell | ||
| */ | ||
| class EnvSourceCollectorsCell extends Cell | ||
| { | ||
| /** | ||
| * List of valid options that can be passed into this | ||
| * cell's constructor. | ||
| * | ||
| * @var array<string, mixed> | ||
| */ | ||
| protected $_validCellOptions = [ | ||
| 'vv_obj', | ||
| 'vv_step', | ||
| 'viewVars', | ||
| ]; | ||
|
|
||
| /** | ||
| * Initialization logic run at the end of object construction. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function initialize(): void | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * Default display method. | ||
| * | ||
| * @param int $petitionId | ||
| * @return void | ||
| * @since COmanage Registry v5.1.0 | ||
| */ | ||
| public function display(int $petitionId): void | ||
| { | ||
| $EnvSourceCollectors = $this->fetchTable('EnvSourceCollectors'); | ||
|
|
||
| $this->set('vv_petition_env_identities', $EnvSourceCollectors | ||
| ->PetitionEnvIdentities | ||
| ->find() | ||
| ->where(['PetitionEnvIdentities.petition_id' => $petitionId]) | ||
| ->contain(['EnvSourceIdentities']) | ||
| ->firstOrFail()); | ||
|
|
||
| $this->set('vv_step', $this->vv_step); | ||
| $this->set('vv_obj', $this->vv_obj); | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
app/plugins/EnvSource/templates/cell/EnvSourceCollectors/display.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry EnvSource Collectors Cell Display | ||
| * | ||
| * Portions licensed to the University Corporation for Advanced Internet | ||
| * Development, Inc. ("UCAID") under one or more contributor license agreements. | ||
| * See the NOTICE file distributed with this work for additional information | ||
| * regarding copyright ownership. | ||
| * | ||
| * UCAID licenses this file to you under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with the | ||
| * License. You may obtain a copy of the License at: | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * @link https://www.internet2.edu/comanage COmanage Project | ||
| * @package registry | ||
| * @since COmanage Registry v5.1.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
|
|
||
| $env_attributes = json_decode($vv_petition_env_identities->env_source_identity->env_attributes); | ||
|
|
||
| ?> | ||
|
|
||
| <ul> | ||
| <li>Env Source Identity ID: <?= $vv_petition_env_identities->env_source_identity->id ?></li> | ||
| <li>Source Key: <?= $vv_petition_env_identities->env_source_identity->source_key ?></li> | ||
| <?php foreach($env_attributes as $k => $v): ?> | ||
| <li><?= __d('env_source', 'field.EnvSources.'.$k) . ": " . $v ?></li> | ||
| <?php endforeach ?> | ||
| </ul> |
13 changes: 0 additions & 13 deletions
13
app/plugins/EnvSource/templates/element/petition/envSourceCollectorsStep.php
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
app/plugins/EnvSource/tests/TestCase/View/Cell/EnvSourceCollectorsCellTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| namespace EnvSource\Test\TestCase\View\Cell; | ||
|
|
||
| use Cake\TestSuite\TestCase; | ||
| use EnvSource\View\Cell\EnvSourceCollectorsCell; | ||
|
|
||
| /** | ||
| * EnvSource\View\Cell\EnvSourceCollectorsCell Test Case | ||
| */ | ||
| class EnvSourceCollectorsCellTest extends TestCase | ||
| { | ||
| /** | ||
| * Request mock | ||
| * | ||
| * @var \Cake\Http\ServerRequest|\PHPUnit\Framework\MockObject\MockObject | ||
| */ | ||
| protected $request; | ||
|
|
||
| /** | ||
| * Response mock | ||
| * | ||
| * @var \Cake\Http\Response|\PHPUnit\Framework\MockObject\MockObject | ||
| */ | ||
| protected $response; | ||
|
|
||
| /** | ||
| * Test subject | ||
| * | ||
| * @var \EnvSource\View\Cell\EnvSourceCollectorsCell | ||
| */ | ||
| protected $EnvSourceCollectors; | ||
|
|
||
| /** | ||
| * setUp method | ||
| * | ||
| * @return void | ||
| */ | ||
| protected function setUp(): void | ||
| { | ||
| parent::setUp(); | ||
| $this->request = $this->getMockBuilder('Cake\Http\ServerRequest')->getMock(); | ||
| $this->response = $this->getMockBuilder('Cake\Http\Response')->getMock(); | ||
| $this->EnvSourceCollectors = new EnvSourceCollectorsCell($this->request, $this->response); | ||
| } | ||
|
|
||
| /** | ||
| * tearDown method | ||
| * | ||
| * @return void | ||
| */ | ||
| protected function tearDown(): void | ||
| { | ||
| unset($this->EnvSourceCollectors); | ||
|
|
||
| parent::tearDown(); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.