Skip to content

Commit

Permalink
Change stem to folder name in ui
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel Stohn authored and Axel Stohn committed Sep 20, 2022
1 parent 34ec623 commit 060c958
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
26 changes: 18 additions & 8 deletions Model/GrouperGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GrouperGroup extends GrouperLiteAppModel
'app:sympa:internet2',
'app:sympa:incommon',
'ref:incommon-collab',
'ref:Internet2-collab'
'ref:internet2-collab'
);

//Stem for email groups, only email groups using this stem are viewable
Expand Down Expand Up @@ -622,10 +622,9 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
$len = strlen($stem);
if (substr(strtolower($group['name']), 0, $len) === $stem) {
$stemSections = explode(':', $group['name']);
//Get second to last stem section
$sectionCount = count($stemSections) - 2;
if (in_array($stemSections[$sectionCount], $topLevelWG) === false) {
$topLevelWG[] = $stemSections[$sectionCount];
//Get third section, since will always by after ref:something:here
if (in_array($stemSections[2], $topLevelWG) === false) {
$topLevelWG[] = $stemSections[2];
}
}
}
Expand All @@ -638,13 +637,15 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
// if match to name of group within WG mapping then start making a WG group array
if (substr(strtolower($group['name']), 0, $len) === $stem) {
$stemSections = explode(':', $group['name']);
$displaySections = explode(':', $group['displayName']);
//Get second to last stem section
$sectionCount = count($stemSections) - 2;
$sectionCount = 2;
//If group not part of a top level WG, then do not show!
if (in_array($stemSections[$sectionCount], $topLevelWG) === false) {
break;
}
$group['WGName'] = $stemSections[$sectionCount];
$group['WGShowName'] = $displaySections[$sectionCount];
//Get user type, which is after the WG name
if (isset($stemSections[$sectionCount + 1])) {
$group['WGRole'] = $stemSections[$sectionCount + 1];
Expand Down Expand Up @@ -693,17 +694,26 @@ private function getFriendlyWorkingGroupName(array $groups, $method)
foreach ($workingGroups as $workingGroup) {
//Need to set first group in final Working Group array
if (count($finalWorkingGroups) == 0) {
$finalWorkingGroups[] = array('WGName' => $workingGroup['WGName'], 'Groups' => array($workingGroup));
$finalWorkingGroups[] = array(
'WGName' => $workingGroup['WGName'],
'WGShowName' => $workingGroup['WGShowName'],
'Groups' => array($workingGroup)
);
} else {
$foundMatch = false;
foreach ($finalWorkingGroups as &$finalWorkingGroup) {
if ($finalWorkingGroup['WGName'] == $workingGroup['WGName']) {
$finalWorkingGroup['WGShowName'] = $workingGroup['WGShowName'];
$finalWorkingGroup['Groups'][] = $workingGroup;
$foundMatch = true;
}
}
if (!$foundMatch) {
$finalWorkingGroups[] = array('WGName' => $workingGroup['WGName'], 'Groups' => array($workingGroup));
$finalWorkingGroups[] = array(
'WGName' => $workingGroup['WGName'],
'WGShowName' => $workingGroup['WGShowName'],
'Groups' => array($workingGroup)
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupmember.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
<tr class="table-light <?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns - 2; ?>">
<button type="button" class="btn btn-link btn-text collapse-btn fw-bold m-0 <?php echo $collapsed ? 'collapsed' : ''; ?>" data-toggle="collapse" data-target=".collapse-wg-<?php echo $wggroup['WGName']; ?>" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>">
<?php echo $wggroup['WGName'] ?? "No Name"; ?>
<?php echo $wggroup['WGShowName'] ?? "No Name"; ?>
<em class="material-icons mt-0" aria-hidden="true"><?php echo $collapsed ? 'arrow_drop_down' : 'arrow_right' ?></em>
</button>
</td>
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupoptin.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
<?php foreach ($wgoptins as $i => $wgoptin) : ?>
<tr class="<?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns - 2; ?>">
<span class="h6"><?php echo $wgoptin['WGName'] ?? "No Name"; ?></span>
<span class="h6"><?php echo $wgoptin['WGShowName'] ?? "No Name"; ?></span>
</td>
<td>
<?php echo $wgoptin['workingDesc'] ?? " "; ?>
Expand Down
2 changes: 1 addition & 1 deletion View/GrouperGroups/groupowner.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ $collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false;
<tr class="table-light <?php echo $collapsed ? 'collapse' : 'show'; ?> collapse-wg-working-group-parent">
<td colspan="<?php echo $numColumns - 3; ?>">
<button type="button" class="btn btn-link btn-text collapse-btn fw-bold m-0 <?php echo $collapsed ? 'collapsed' : ''; ?>" data-toggle="collapse" data-target=".collapse-wg-<?php echo $wggroup['WGName']; ?>" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>">
<?php echo $wggroup['WGName'] ?? "No Name"; ?>
<?php echo $wggroup['WGShowName'] ?? "No Name"; ?>
<em class="material-icons mt-0" aria-hidden="true"><?php echo $collapsed ? 'arrow_drop_down' : 'arrow_right' ?></em>
</button>
</td>
Expand Down

0 comments on commit 060c958

Please sign in to comment.