Skip to content

Initial theming commit (CFM-55) #2

Merged
merged 4 commits into from Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/.editorconfig
Expand Up @@ -7,8 +7,8 @@ root = true
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
insert_final_newline = false
trim_trailing_whitespace = false

[*.bat]
end_of_line = crlf
Expand Down
2 changes: 1 addition & 1 deletion app/config/app.php
Expand Up @@ -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 registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Expand Down
9 changes: 9 additions & 0 deletions app/resources/locales/en_US/information.po
Expand Up @@ -30,5 +30,14 @@ msgstr "API Users created in the COmanage CO are given full privileges to all Re
msgid "api.key"
msgstr "This newly generated API Key cannot be recovered. If it is lost a new key must be generated."

msgid "cos.none"
msgstr "No collaborations (COs) yet exist. Please have an administrator create one."

msgid "cos.select"
msgstr "Please select the collaboration (CO) you wish to manage."

msgid "pagination.format"
msgstr "Page {{page}} of {{pages}}, Viewing {{start}}-{{end}} of {{count}}"

msgid "global.records.none"
msgstr "There are no records to display."
18 changes: 18 additions & 0 deletions app/resources/locales/en_US/operation.po
Expand Up @@ -33,6 +33,21 @@ msgstr "Generate API Key"
msgid "api.key.generate.confirm"
msgstr "Are you sure you wish to generate a new API Key?"

msgid "cancel"
msgstr "Cancel"

msgid "clear"
msgstr "Clear"

msgid "clear.filters"
msgstr "{0,plural,=1{Clear Filter} other{Clear Filters}}"

msgid "close"
msgstr "Close"

msgid "confirm"
msgstr "Confirm"

msgid "dashboard.configuration"
msgstr "Manage {0} Configuration"

Expand All @@ -51,6 +66,9 @@ msgstr "Edit"
msgid "edit.a"
msgstr "Edit {0}"

msgid "filter"
msgstr "Filter"

msgid "first"
msgstr "First"

Expand Down
2 changes: 1 addition & 1 deletion app/src/Controller/AppController.php
Expand Up @@ -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 registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Expand Down
2 changes: 2 additions & 0 deletions app/src/Controller/Component/RegistryAuthComponent.php
Expand Up @@ -321,6 +321,8 @@ public function getMenuPermissions() {
$permissions = [];

// XXX need to set permissions according to current user's roles
benno marked this conversation as resolved.
Show resolved Hide resolved
$permissions['platform'] = true;

// Can access the Configuration Dashboard for the current CO
$permissions['configuration'] = true;

Expand Down
2 changes: 1 addition & 1 deletion app/src/Lib/Enum/SuspendableStatusEnum.php
Expand Up @@ -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 registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Expand Down
2 changes: 1 addition & 1 deletion app/src/Lib/Random/RandomString.php
Expand Up @@ -20,7 +20,7 @@
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package match
* @package registry
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
Expand Down
48 changes: 23 additions & 25 deletions app/templates/Cos/select.php
Expand Up @@ -28,46 +28,44 @@
// XXX See registry/app/View/Pages/home.ctp for various error messages we should
// render based on the user's state, include op.home.no.collabs if empty
?>
<div class="titleNavContainer">
<div class="pageTitle">
<h1><?= __('registry.home.collab'); ?></h1>
</div>
</div>

<div id="fpDashboard">
<!-- XXX add lastlogin from registry/app/View/Pages/home.ctp -->

<h2><?= __('registry.home.collab'); ?></h2>
<!-- XXX color of div has switched from blue to gray, do we care? -->
<div id="fpCoList" class="co-grid co-grid-with-header mdl-shadow--2dp">
<div class="mdl-grid co-grid-header">
<div class="mdl-cell mdl-cell--6-col"><?= __d('field', 'name'); ?></div>
<div class="mdl-cell mdl-cell--6-col"><?= __d('field', 'description'); ?></div>
<?php if(count($vv_available_cos) == 0): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?= __d('information','cos.none'); ?>
</div>
<?php else: // vv_available_cos ?>
<p><?= __d('information', 'cos.select'); ?></p>
<div id="fpList" class="co-grid co-grid-with-header container">
<div class="co-grid-header row">
<div class="col"><?= __d('field', 'name'); ?></div>
<div class="col"><?= __d('field', 'description'); ?></div>
</div>

<?php foreach($vv_available_cos as $co): ?>
<div class="mdl-grid co-row spin">
<div class="mdl-cell mdl-cell--6-col collab-name">
<div class="row co-row linked-row spin">
<div class=col collab-name">
<?= $this->Html->link(
// XXX do we need filter_var?
$co->name,
['plugin' => null,
'controller' => 'dashboards',
'action' => 'dashboard',
'?' => [
'co_id' => $co->id
]],
['class' => 'co-link']
['class' => 'row-link']
); ?>
</div>
<div class="mdl-cell mdl-cell--6-col collab-desc">
<!-- XXX need to add "Not a Member" tag, maybe as a separate column instead of part of the link -->
<div class="col collab-desc">
<!-- XXX need to add "Not a Member" tag, maybe as a separate column instead of part of the link -->
<?= filter_var($co->description, FILTER_SANITIZE_SPECIAL_CHARS); ?>
</div>
</div>
<?php endforeach; // vv_available_cos ?>
</div>
</div>
<!-- Allow the whole div to be clicked: -->
<script type="text/javascript">
$(function() {
$("#fpCoList .co-row").click(function () {
location.href = $(this).find(".collab-name > a.co-link").attr('href');
});
});
</script>
<?php endif; ?>
100 changes: 74 additions & 26 deletions app/templates/Standard/index.php
Expand Up @@ -40,6 +40,10 @@
// XXX backport to match?
$tableName = \Cake\Utility\Inflector::tableize(\Cake\Utility\Inflector::singularize($this->name));

// Do we have records for this index? This will be set to true during render if we do.
// Otherwise, we'll print out a "no records" message.
$recordsExist = false;

// Our default link actions, in order of preference, unless the column config overrides it
$linkActions = ['edit', 'view'];

Expand Down Expand Up @@ -85,23 +89,11 @@ function _column_key($modelsName, $c, $tz=null) {
<div class="pageTitle">
<h1><?= $vv_title; ?></h1>
</div>

<?php
if(!empty($banners)) {
foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $banners
}
?>

<?php if($vv_permissions['add']): ?>
<ul id="topLinks">
<li>
<?php print $this->Html->link(
'<em class="material-icons" aria-hidden="true">add_circle</em> ' .
<?= $this->Html->link('<em class="material-icons" aria-hidden="true">add_circle</em> ' .
__d('operation', 'add.a', __d('controller', $modelsName, [1])),
['action' => 'add', '?' => $linkFilter],
['escape' => false]); ?>
Expand All @@ -117,12 +109,11 @@ function _column_key($modelsName, $c, $tz=null) {
$t['link']['?'] = $linkFilter;
}

print '
<li>' .
print '<li>' .
$this->Html->link(
'<em class="material-icons" aria-hidden="true">' . $t['icon']. '</em> ' . $t['label'],
$t['link'],
['escape' => false]
['escape' => false, 'class' => $t['class']]
) . '
</li>';
}
Expand All @@ -133,18 +124,34 @@ function _column_key($modelsName, $c, $tz=null) {
<?php endif; ?>
</div>
<?php if(!empty($indexBanners)): ?>
<?php foreach($indexBanners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?php print $b; ?>
</div>
<?php endforeach; // $indexBanners ?>
<?php foreach($indexBanners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?= $b; ?>
</div>
<?php endforeach; // $indexBanners ?>
<?php endif; // $indexBanners ?>

<?php if(!empty($banners)): ?>
<?php foreach($banners as $b): ?>
<div class="co-info-topbox">
<em class="material-icons">info</em>
<?= $b; ?>
</div>
<?php endforeach; // $banners ?>
<?php endif; // $banners ?>

<!-- Search block -->
<?php if(!empty($enableSearch)): ?>
<?= $this->element('search'); ?>
<?php endif; // $enableSearch ?>

<!-- Index table -->
<div class="table-container">
<table id="<?= $tableName . '-table'; ?>">
<tr>
<?php foreach($indexColumns as $col => $cfg): ?>
<th>
<th<?= !empty($cfg['cssClass']) ? ' class="' . $cfg['cssClass'] . '"' : ''; ?>>
<?php
$label = !empty($cfg['label']) ? $cfg['label'] : _column_key($modelsName, $col, $vv_tz);

Expand All @@ -165,7 +172,7 @@ function _column_key($modelsName, $c, $tz=null) {
<?php foreach($$tableName as $entity): ?>
<tr>
<?php foreach($indexColumns as $col => $cfg): ?>
<td>
<td<?= !empty($cfg['cssClass']) ? ' class="' . $cfg['cssClass'] . '"' : ''; ?>>
<?php
switch($cfg['type']) {
case 'boolean':
Expand All @@ -180,6 +187,7 @@ function _column_key($modelsName, $c, $tz=null) {
break;
case 'enum':
if($entity->$col) {
// XXX Need to add badging - see index.php in Match
print __d('enumeration', $cfg['class'].'.'.$entity->$col);
}
break;
Expand All @@ -203,6 +211,38 @@ function _column_key($modelsName, $c, $tz=null) {
print $entity->$col;
}
break;
case 'button':
if(!empty($entity->$col)) {
$buttonAttrs = [];
$buttonText = $entity->$col;
if(!empty($cfg['button']['attrs'])) {
$buttonAttrs = $cfg['button']['attrs'];
}
$buttonAttrs['type'] = 'button';
if(!empty($cfg['button']['text']) && $cfg['button']['text'] != 'fieldVal') {
$buttonText = $cfg['button']['text'];
}
if(!empty($cfg['truncate']) && is_int($cfg['truncate'])) {
// We check for $truncate + 1 because there's no point trimming
// the last character if we're just going to replace it with ...
$buttonText = (strlen($buttonText) > $cfg['truncate'] + 1) ? substr($buttonText,0,$cfg['truncate']).'...' : $buttonText;
}
if(!empty($cfg['button']['popover'])) {
if($cfg['button']['popover'] == 'fieldVal') {
$buttonAttrs['data-bs-content'] = $entity->$col;
} else {
$buttonAttrs['data-bs-content'] = $cfg['button']['popover'];
}
$label = !empty($cfg['label']) ? $cfg['label'] : _column_key($modelsName, $col, $vv_tz);
$buttonAttrs['title'] = $label;
$buttonAttrs['data-bs-toggle'] = 'popover';
$buttonAttrs['data-bs-container'] = 'body';
$buttonAttrs['data-bs-placement'] = 'top';
$buttonAttrs['data-bs-animation'] = 'false';
}
print $this->Form->button($buttonText, $buttonAttrs);
}
break;
case 'link':
case 'echo':
default:
Expand All @@ -224,6 +264,7 @@ function _column_key($modelsName, $c, $tz=null) {
foreach($linkActions as $a) {
// Does this user have permission for this action?
if($vv_permission_set[$entity->id][$a]) {
// XXX Check this against Match
print $this->Html->link($label, ['action' => $a, $entity->id]);
$linked = true;
break 2;
Expand All @@ -241,8 +282,10 @@ function _column_key($modelsName, $c, $tz=null) {
?>
</td>
<?php endforeach; // $indexColumns ?>
<td>
<td class="actions">
<?php

// XXX Convert this to use the actionMenu element as in Match 1.0
if($vv_permission_set[$entity->id]['edit']) {
print $this->Html->link(
__d('operation', 'edit'),
Expand All @@ -269,8 +312,9 @@ function _column_key($modelsName, $c, $tz=null) {
);
}

// Insert additional actions as per the .inc file
// XXX Check all this against Match 1.0 (which should be newer)
if(!empty($indexActions)) {
// Insert additional actions as per the .inc file

// XXX this isn't quite the right test
// if(isset($entity->status) && $entity->status == StatusEnum::Active) {
Expand Down Expand Up @@ -305,7 +349,11 @@ function _column_key($modelsName, $c, $tz=null) {
?>
</td>
</tr>
<?php $recordsExist = true; ?>
<?php endforeach; // $$tablename ?>
<?php if(!$recordsExist): ?>
<tr><td colspan="<?= count($indexColumns); ?>"><?= __d('information','global.records.none') ?></td></tr>
<?php endif; ?>
</table>
</div>

Expand Down