fix: [UI] Undefined index

pull/8704/head
Jakub Onderka 2022-10-25 13:45:57 +02:00
parent 41aa9d225f
commit 9e0a2546ff
7 changed files with 27 additions and 33 deletions

View File

@ -35,8 +35,6 @@
<div id="galaxies_div">
<span class="title-section"><?= __('Galaxies') ?></span>
<?= $this->element('galaxyQuickViewNew', [
'mayModify' => $mayModify,
'isAclTagger' => $isAclTagger,
'data' => $event['Galaxy'],
'event' => $event,
'target_id' => $event['Event']['id'],

View File

@ -157,9 +157,7 @@
<td class="short" id="attribute_<?= $objectId ?>_galaxy">
<?php
echo $this->element('galaxyQuickViewNew', array(
'mayModify' => $mayModify,
'isAclTagger' => $isAclTagger,
'data' => (!empty($object['Galaxy']) ? $object['Galaxy'] : array()),
'data' => !empty($object['Galaxy']) ? $object['Galaxy'] : array(),
'event' => $event,
'target_id' => $objectId,
'target_type' => 'attribute',

View File

@ -81,13 +81,11 @@
$galaxies[$galaxy_id]['GalaxyCluster'][] = $galaxy_cluster;
}
echo $this->element('galaxyQuickViewNew', array(
'mayModify' => false,
'isAclTagger' => false,
'data' => $galaxies,
'event' => $event,
'target_id' => $eventId,
'target_type' => 'event',
'static_tags_only' => 1
'static_tags_only' => true,
));
}
?>

View File

@ -21,8 +21,8 @@
<td class="shortish">
<?php
echo $this->element('galaxyQuickViewNew', array(
'mayModify' => ($isSiteAdmin || $me['org_id'] == $item['TagCollection']['org_id']),
'isAclTagger' => $me['Role']['perm_tagger'],
'tagAccess' => ($isSiteAdmin || $me['org_id'] == $item['TagCollection']['org_id']),
'localTagAccess' => false,
'data' => $item['Galaxy'],
'target_id' => h($item['TagCollection']['id']),
'target_type' => 'tag_collection',

View File

@ -1,17 +1,18 @@
<?php
// When viewing remote server or feed event
if (isset($preview) && $preview) {
$mayModify = false;
$isAclTagger = false;
$static_tags_only = true;
} else {
$preview = false;
}
$tagAccess = $this->Acl->canModifyTag($event);
if (empty($local_tag_off) || !empty($event)) {
$localTagAccess = $this->Acl->canModifyTag($event, true);
} else {
$localTagAccess = false;
if ($target_type === 'event' || $target_type === 'attribute') {
$tagAccess = $this->Acl->canModifyTag($event);
if (empty($local_tag_off) || !empty($event)) {
$localTagAccess = $this->Acl->canModifyTag($event, true);
} else {
$localTagAccess = false;
}
}
$editButtonsEnabled = empty($static_tags_only) && $tagAccess;
@ -110,16 +111,19 @@ $generatePopover = function (array $cluster) use ($normalizeKey) {
]
];
if ($editButtonsEnabled || ($editButtonsLocalEnabled && $cluster['local'])) {
$action_items[] = [
'onClick' => sprintf(
"openGenericModal('%s/tags/modifyTagRelationship/%s/%s')",
$baseurl,
h($target_type),
h($cluster[$target_type . '_tag_id'])
),
'class' => 'useCursorPointer black fas fa-project-diagram',
'title' => __('Modify tag relationship')
];
if ($target_type !== 'tag_collection') {
$action_items[] = [
'url' => sprintf(
"%s/tags/modifyTagRelationship/%s/%s",
$baseurl,
h($target_type),
h($cluster[$target_type . '_tag_id'])
),
'onClick' => false,
'class' => 'useCursorPointer black fas fa-project-diagram modal-open',
'title' => __('Modify tag relationship')
];
}
$action_items[] = [
'url' => $baseurl . '/galaxy_clusters/detach/' . intval($target_id) . '/' . h($target_type) . '/' . h($cluster['tag_id']),
'onClick' => sprintf(
@ -129,7 +133,7 @@ $generatePopover = function (array $cluster) use ($normalizeKey) {
),
'class' => 'black fas fa-trash',
'aria_label' => __('Detach'),
'title' => __('Are you sure you want to detach %s from this event?', h($cluster['value'])),
'title' => __('Are you sure you want to detach %s from this %s?', h($cluster['value']), $target_type),
];
}
foreach ($action_items as $action_item) {

View File

@ -4,9 +4,7 @@ $event = $row['Event'];
echo '<div id="attribute_' . intval($attribute['id']) . '_galaxy">';
echo $this->element('galaxyQuickViewNew', array(
'mayModify' => $mayModify,
'isAclTagger' => $isAclTagger,
'data' => (!empty($attribute['Galaxy']) ? $attribute['Galaxy'] : array()),
'data' => !empty($attribute['Galaxy']) ? $attribute['Galaxy'] : array(),
'event' => ['Event' => $event],
'target_id' => $attribute['id'],
'target_type' => 'attribute',

View File

@ -3,8 +3,6 @@ if ($scope === 'event') {
echo '<span class="title-section">' . __('Galaxies') . '</span>';
}
echo $this->element('galaxyQuickViewNew', [
'mayModify' => $mayModify,
'isAclTagger' => $isAclTagger,
'data' => $object['Galaxy'],
'event' => $object,
'target_id' => $scope == 'event' ? $object['Event']['id'] : $object['Attribute']['id'],