-
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.
Changelog and entity-metadata layout (CFM-476)
- Loading branch information
Showing
10 changed files
with
293 additions
and
159 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,108 +1,141 @@ | ||
| <?php | ||
| /* | ||
| * COmanage Registry Changelog Element | ||
| * | ||
| * 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.2.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| */ | ||
| /* | ||
| * COmanage Registry Changelog Element | ||
| * | ||
| * 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.2.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| */ | ||
|
|
||
| use App\Lib\Enum\ApplicationStateEnum; | ||
|
|
||
| if(empty($vv_obj)) { | ||
| return; | ||
| } | ||
|
|
||
| if(empty($vv_obj)) | ||
| return; | ||
| // If this is an archived record, include a link to the parent (active) record | ||
| $clAttr = $vv_obj->changelogAttributeName(); | ||
| $parentUrl = null; | ||
|
|
||
| // If this is an archived record, include a link to the parent (active) record | ||
| $clAttr = $vv_obj->changelogAttributeName(); | ||
| $parentLink = null; | ||
| if(!empty($vv_obj->$clAttr)) { | ||
| $parentUrl = $this->Url->build( | ||
| ['action' => 'edit', $vv_obj->$clAttr] | ||
| ); | ||
| } | ||
|
|
||
| if(!empty($vv_obj->$clAttr)) { | ||
| $parentLink = $this->Html->link( | ||
| $vv_obj->$clAttr, | ||
| ['action' => 'edit', $vv_obj->$clAttr] | ||
| ); | ||
| } | ||
| // Get the change log open/closed state | ||
| $changeLogState = $this->ApplicationState->getValue(ApplicationStateEnum::ChangeLogState, ''); | ||
| $changeLogStateId = $this->ApplicationState->getId(ApplicationStateEnum::ChangeLogState); | ||
|
|
||
| // We'll render an index of all archived records if we are the current active record, | ||
| // or just the current metadata if we are an archived record | ||
| // We'll render an index of all archived records if we are the current active record, | ||
| // or just the current metadata if we are an archived record | ||
| ?> | ||
|
|
||
| <?= __d('information', 'changelog') ?> | ||
|
|
||
| <?php if(!empty($vv_archives)): // $vv_obj is an active record ?> | ||
| <div class="table-container"> | ||
| <table> | ||
| <tr> | ||
| <th><?= __d('field', 'id') ?></th> | ||
| <th><?= __d('field', 'changelog.revision') ?></th> | ||
| <th><?= __d('field', 'modified') ?></th> | ||
| <th><?= __d('field', 'changelog.actor_identifier') ?></th> | ||
| </tr> | ||
| <!-- start with the current record --> | ||
| <tr> | ||
| <td><?= | ||
| // In general it's confusing to have a link back to the record currently being displayed, | ||
| // so just echo the ID without making it a link | ||
| $vv_obj->id | ||
| ?></td> | ||
| <td><?= $vv_obj->revision ?></td> | ||
| <td><?= $vv_obj->modified ?></td> | ||
| <td><?= $vv_obj->actor_identifier ?></td> | ||
| </tr> | ||
| <?php foreach($vv_archives as $archive): ?> | ||
| <tr> | ||
| <td><?= | ||
| $this->Html->link( | ||
| $archive->id, | ||
| ['action' => 'view', $archive->id] | ||
| ) | ||
| ?></td> | ||
| <td><?= $archive->revision ?></td> | ||
| <td><?= $archive->modified ?></td> | ||
| <td><?= $archive->actor_identifier ?></td> | ||
| </tr> | ||
| <?php endforeach; // $archive ?> | ||
| </table> | ||
| </div> | ||
| <?php else: // $vv_archives -- $vv_obj is an archive record ?> | ||
| <div class="table-container"> | ||
| <table> | ||
| <tr> | ||
| <th><?= __d('field', 'changelog.deleted') ?></th> | ||
| <td><?= __d('enumeration', 'YesBooleanEnum.'.($vv_obj->deleted ? '1' : '0')) ?></td> | ||
| </tr> | ||
| <tr> | ||
| <th><?= __d('field', 'changelog.revision') ?></th> | ||
| <td><?= $vv_obj->revision; ?></td> | ||
| </tr> | ||
| <tr> | ||
| <th><?= __d('field', 'modified') ?></th> | ||
| <td><?= $vv_obj->modified ?></td> | ||
| </tr> | ||
| <tr> | ||
| <th><?= __d('field', 'changelog.actor_identifier') ?></th> | ||
| <td><?= $vv_obj->actor_identifier ?></td> | ||
| </tr> | ||
| <tr> | ||
| <th><?= __d('field', 'changelog.parent') ?></th> | ||
| <td><?= $parentLink ?></td> | ||
| </tr> | ||
| </table> | ||
| <div id="changelog-container" class="accordion"> | ||
| <div class="accordion-item"> | ||
| <h2 class="accordion-header"> | ||
| <button class="accordion-button<?= $changeLogState !== 'show' ? ' collapsed' : ''?>" | ||
| type="button" | ||
| data-coid="<?= $vv_cur_co->id ?? '' ?>" | ||
| data-appstateid="<?= $changeLogStateId ?>" | ||
| data-stateattr="<?= ApplicationStateEnum::ChangeLogState?>" | ||
| data-webroot="<?= $this->request->getAttribute('webroot') ?>" | ||
| data-username="<?= $vv_user['username'] ?? '' ?>" | ||
| data-personid="<?= $vv_person_id ?? '' ?>" | ||
| data-bs-toggle="collapse" | ||
| data-bs-target="#changelog" | ||
| aria-expanded="false" | ||
| aria-controls="changelog" | ||
| aria-label="<?= $changeLogState === 'show' ? | ||
| __d('information','changelog.aria.expanded') : | ||
| __d('information','changelog.aria.collapsed')?>"> | ||
| <?= __d('information', 'changelog') ?> | ||
| </button> | ||
| </h2> | ||
| <div id="changelog" class="accordion-collapse collapse <?= $changeLogState ?>" data-bs-parent="#changelog-container"> | ||
| <div class="accordion-body"> | ||
| <?php if(empty($vv_obj->$clAttr && !empty($vv_archives))): // $vv_obj is an active record ?> | ||
| <table> | ||
| <tr> | ||
| <th><?= __d('field', 'id') ?></th> | ||
| <th><?= __d('field', 'changelog.revision') ?></th> | ||
| <th><?= __d('field', 'modified') ?></th> | ||
| <th><?= __d('field', 'changelog.actor_identifier') ?></th> | ||
| </tr> | ||
| <!-- start with the current record --> | ||
| <tr> | ||
| <td><?= | ||
| // In general it's confusing to have a link back to the record currently being displayed, | ||
| // so just echo the ID without making it a link | ||
| $vv_obj->id | ||
| ?></td> | ||
| <td><?= $vv_obj->revision ?></td> | ||
| <td><?= $vv_obj->modified ?></td> | ||
| <td><?= $vv_obj->actor_identifier ?></td> | ||
| </tr> | ||
| <?php foreach($vv_archives as $archive): ?> | ||
| <tr> | ||
| <td><?= | ||
| $this->Html->link( | ||
| $archive->id, | ||
| ['action' => 'view', $archive->id] | ||
| ) | ||
| ?></td> | ||
| <td><?= $archive->revision ?></td> | ||
| <td><?= $archive->modified ?></td> | ||
| <td><?= $archive->actor_identifier ?></td> | ||
| </tr> | ||
| <?php endforeach; // $archive ?> | ||
| </table> | ||
| <?php else: // $vv_archives -- $vv_obj is an archive record ?> | ||
| <ul> | ||
| <li> | ||
| <div class="fieldname"><?= __d('field', 'changelog.deleted') ?></div> | ||
| <div class="fieldval"><?= __d('enumeration', 'YesBooleanEnum.' . ($vv_obj->deleted ? '1' : '0')) ?></div> | ||
| </li> | ||
| <li> | ||
| <div class="fieldname"><?= __d('field', 'changelog.revision') ?></div> | ||
| <div class="fieldval"><?= $vv_obj->revision; ?></div> | ||
| </li> | ||
| <li> | ||
| <div class="fieldname"><?= __d('field', 'changelog.actor_identifier') ?></div> | ||
| <div class="fieldval"><?= $vv_obj->actor_identifier ?></div> | ||
| </li> | ||
| <li> | ||
| <div class="fieldname"><?= __d('field', 'changelog.parent') ?></div> | ||
| <div class="fieldval"> | ||
| <?php if(!empty($vv_obj->$clAttr)): ?> | ||
| <a class="changelog-parent-link" href="<?= $parentUrl ?>"> | ||
| <div class="changelog-parent-id"><?= $vv_obj->$clAttr ?></div> | ||
| <div class="changelog-parent-link-button btn btn-sm btn-primary"> | ||
| <?= __d('information','changelog.return') ?> | ||
| </div> | ||
| </a> | ||
| <?php endif; ?> | ||
| </div> | ||
| </li> | ||
| </ul> | ||
| <?php endif; // $vv_archives ?> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <?php endif; // $vv_archives ?> | ||
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,45 @@ | ||
| <?php | ||
| /** | ||
| * COmanage Registry Entity Metadata Element | ||
| * | ||
| * 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.3.0 | ||
| * @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
| */ | ||
|
|
||
| declare(strict_types = 1); | ||
| ?> | ||
|
|
||
| <?php if(isset($vv_obj?->id)): ?> | ||
| <div id="entity-metadata"> | ||
| <div id="cm-entity-id"> | ||
| <?= __d('information', 'entity.id', $vv_obj->id) ?> | ||
| </div> | ||
| <div id="cm-entity-created"> | ||
| <?= __d('information', 'entity.created', $vv_obj->created) ?> | ||
| </div> | ||
| <?php if($vv_obj->created != $vv_obj->modified): ?> | ||
| <div id="cm-entity-modified"> | ||
| <?= __d('information', 'entity.modified', $vv_obj->modified) ?> | ||
| </div> | ||
| <?php endif; ?> | ||
| </div> | ||
| <?php endif; ?> |
Oops, something went wrong.