chg: [taxonomies] Migrated views to use the UI factories

pull/7487/head
mokaddem 2021-06-09 14:56:26 +02:00
parent 40aa613379
commit 2164a42c41
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
7 changed files with 446 additions and 239 deletions

View File

@ -58,6 +58,21 @@ class TaxonomiesController extends AppController
}
public function view($id)
{
$taxonomy = $this->Taxonomy->getTaxonomy($id, ['full' => $this->_isRest()]);
if (empty($taxonomy)) {
throw new NotFoundException(__('Taxonomy not found.'));
}
if ($this->_isRest()) {
return $this->RestResponse->viewData($taxonomy, $this->response->type());
}
$this->set('taxonomy', $taxonomy['Taxonomy']);
$this->set('id', $id);
}
public function taxonomy_tags($id)
{
if (isset($this->passedArgs['pages'])) {
$currentPage = $this->passedArgs['pages'];
@ -66,10 +81,13 @@ class TaxonomiesController extends AppController
}
$this->set('page', $currentPage);
$urlparams = '';
$passedArgs = array();
App::uses('CustomPaginationTool', 'Tools');
$filter = isset($this->passedArgs['filter']) ? $this->passedArgs['filter'] : false;
$taxonomy = $this->Taxonomy->getTaxonomy($id, array('full' => true, 'filter' => $filter));
$options = ['full' => true, 'filter' => $filter];
if (isset($this->passedArgs['enabled'])) {
$options['enabled'] = $this->passedArgs['enabled'];
}
$taxonomy = $this->Taxonomy->getTaxonomy($id, $options);
if (empty($taxonomy)) {
throw new NotFoundException(__('Taxonomy not found.'));
}
@ -105,11 +123,11 @@ class TaxonomiesController extends AppController
$this->set('entries', $taxonomy['entries']);
$this->set('urlparams', $urlparams);
$this->set('passedArgs', json_encode($passedArgs));
$this->set('passedArgsArray', $passedArgs);
$this->set('passedArgs', json_encode($this->passedArgs));
$this->set('passedArgsArray', $this->passedArgs);
$this->set('taxonomy', $taxonomy['Taxonomy']);
$this->set('id', $id);
$this->set('title_for_layout', __('%s Taxonomy Library', h(strtoupper($taxonomy['Taxonomy']['namespace']))));
$this->render('ajax/taxonomy_tags');
}
public function enable($id)
@ -269,40 +287,54 @@ class TaxonomiesController extends AppController
public function addTag($taxonomy_id = false)
{
if ((!$this->_isSiteAdmin() && !$this->userRole['perm_tagger']) || !$this->request->is('post')) {
if ((!$this->_isSiteAdmin() && !$this->userRole['perm_tagger'])) {
throw new NotFoundException(__('You don\'t have permission to do that.'));
}
if ($taxonomy_id) {
$result = $this->Taxonomy->addTags($taxonomy_id);
if (
$this->request->is('get') &&
(
empty($this->request->params['named']['taxonomy_id']) ||
empty($this->request->params['named']['name'])
)
) {
throw new MethodNotAllowedException(__('Taxonomy ID or tag name must be provided.'));
} else {
if (isset($this->request->data['Taxonomy'])) {
$this->request->data['Tag'] = $this->request->data['Taxonomy'];
unset($this->request->data['Taxonomy']);
}
if (isset($this->request->data['Tag']['request'])) {
$this->request->data['Tag'] = $this->request->data['Tag']['request'];
}
if (!isset($this->request->data['Tag']['nameList'])) {
$this->request->data['Tag']['nameList'] = array($this->request->data['Tag']['name']);
$this->request->data['Taxonomy']['taxonomy_id'] = $this->request->params['named']['taxonomy_id'];
$this->request->data['Taxonomy']['name'] = $this->request->params['named']['name'];
}
if ($this->request->is('post')) {
if ($taxonomy_id) {
$result = $this->Taxonomy->addTags($taxonomy_id);
} else {
$this->request->data['Tag']['nameList'] = json_decode($this->request->data['Tag']['nameList'], true);
if (isset($this->request->data['Taxonomy'])) {
$this->request->data['Tag'] = $this->request->data['Taxonomy'];
unset($this->request->data['Taxonomy']);
}
if (isset($this->request->data['Tag']['request'])) {
$this->request->data['Tag'] = $this->request->data['Tag']['request'];
}
if (!isset($this->request->data['Tag']['nameList'])) {
$this->request->data['Tag']['nameList'] = array($this->request->data['Tag']['name']);
} else {
$this->request->data['Tag']['nameList'] = json_decode($this->request->data['Tag']['nameList'], true);
}
$result = $this->Taxonomy->addTags($this->request->data['Tag']['taxonomy_id'], $this->request->data['Tag']['nameList']);
}
$result = $this->Taxonomy->addTags($this->request->data['Tag']['taxonomy_id'], $this->request->data['Tag']['nameList']);
if ($result) {
$message = __('The tag(s) has been saved.');
if ($this->_isRest()) {
return $this->RestResponse->saveSuccessResponse('Taxonomy', 'addTag', $taxonomy_id, $this->response->type(), $message);
}
$this->Flash->success($message);
} else {
$message = __('The tag(s) could not be saved. Please, try again.');
if ($this->_isRest()) {
return $this->RestResponse->saveFailResponse('Taxonomy', 'addTag', $taxonomy_id, $message, $this->response->type());
}
$this->Flash->error($message);
}
$this->redirect($this->referer());
}
if ($result) {
$message = __('The tag(s) has been saved.');
if ($this->_isRest()) {
return $this->RestResponse->saveSuccessResponse('Taxonomy', 'addTag', $taxonomy_id, $this->response->type(), $message);
}
$this->Flash->success($message);
} else {
$message = __('The tag(s) could not be saved. Please, try again.');
if ($this->_isRest()) {
return $this->RestResponse->saveFailResponse('Taxonomy', 'addTag', $taxonomy_id, $message, $this->response->type());
}
$this->Flash->error($message);
}
$this->redirect($this->referer());
}
public function hideTag($taxonomy_id = false)
@ -367,32 +399,46 @@ class TaxonomiesController extends AppController
public function disableTag($taxonomy_id = false)
{
if ((!$this->_isSiteAdmin() && !$this->userRole['perm_tagger']) || !$this->request->is('post')) {
if ((!$this->_isSiteAdmin() && !$this->userRole['perm_tagger'])) {
throw new NotFoundException(__('You don\'t have permission to do that.'));
}
if ($taxonomy_id) {
$result = $this->Taxonomy->disableTags($taxonomy_id);
if (
$this->request->is('get') &&
(
empty($this->request->params['named']['taxonomy_id']) ||
empty($this->request->params['named']['name'])
)
) {
throw new MethodNotAllowedException(__('Taxonomy ID or tag name must be provided.'));
} else {
if (isset($this->request->data['Taxonomy'])) {
$this->request->data['Tag'] = $this->request->data['Taxonomy'];
unset($this->request->data['Taxonomy']);
}
if (isset($this->request->data['Tag']['request'])) {
$this->request->data['Tag'] = $this->request->data['Tag']['request'];
}
if (!isset($this->request->data['Tag']['nameList'])) {
$this->request->data['Tag']['nameList'] = array($this->request->data['Tag']['name']);
$this->request->data['Taxonomy']['taxonomy_id'] = $this->request->params['named']['taxonomy_id'];
$this->request->data['Taxonomy']['name'] = $this->request->params['named']['name'];
}
if ($this->request->is('post')) {
if ($taxonomy_id) {
$result = $this->Taxonomy->disableTags($taxonomy_id);
} else {
$this->request->data['Tag']['nameList'] = json_decode($this->request->data['Tag']['nameList'], true);
if (isset($this->request->data['Taxonomy'])) {
$this->request->data['Tag'] = $this->request->data['Taxonomy'];
unset($this->request->data['Taxonomy']);
}
if (isset($this->request->data['Tag']['request'])) {
$this->request->data['Tag'] = $this->request->data['Tag']['request'];
}
if (!isset($this->request->data['Tag']['nameList'])) {
$this->request->data['Tag']['nameList'] = array($this->request->data['Tag']['name']);
} else {
$this->request->data['Tag']['nameList'] = json_decode($this->request->data['Tag']['nameList'], true);
}
$result = $this->Taxonomy->disableTags($this->request->data['Tag']['taxonomy_id'], $this->request->data['Tag']['nameList']);
}
$result = $this->Taxonomy->disableTags($this->request->data['Tag']['taxonomy_id'], $this->request->data['Tag']['nameList']);
if ($result) {
$this->Flash->success(__('The tag(s) has been hidden.'));
} else {
$this->Flash->error(__('The tag(s) could not be hidden. Please, try again.'));
}
$this->redirect($this->referer());
}
if ($result) {
$this->Flash->success(__('The tag(s) has been hidden.'));
} else {
$this->Flash->error(__('The tag(s) could not be hidden. Please, try again.'));
}
$this->redirect($this->referer());
}
public function taxonomyMassConfirmation($id)

View File

@ -325,10 +325,19 @@ class Taxonomy extends AppModel
}
$tagNames = array_column($taxonomy['entries'], 'tag');
$tags = $this->Tag->getTagsByName($tagNames, false);
$filterActive = false;
if (isset($options['enabled'])) {
$filterActive = true;
$enabledTag = isset($options['enabled']) ? $options['enabled'] : null;
}
if (isset($taxonomy['entries'])) {
foreach ($taxonomy['entries'] as $key => $temp) {
if (isset($tags[strtoupper($temp['tag'])])) {
$existingTag = $tags[strtoupper($temp['tag'])];
if ($filterActive && $options['enabled'] == $existingTag['Tag']['hide_tag']) {
unset($taxonomy['entries'][$key]);
continue;
}
$taxonomy['entries'][$key]['existing_tag'] = $existingTag;
// numerical_value is overridden at tag level. Propagate the override further up
if (isset($existingTag['Tag']['original_numerical_value'])) {
@ -336,7 +345,11 @@ class Taxonomy extends AppModel
$taxonomy['entries'][$key]['numerical_value'] = $existingTag['Tag']['numerical_value'];
}
} else {
$taxonomy['entries'][$key]['existing_tag'] = false;
if ($filterActive) {
unset($taxonomy['entries'][$key]);
} else {
$taxonomy['entries'][$key]['existing_tag'] = false;
}
}
}
}

View File

@ -0,0 +1,37 @@
<?php
$modelForForm = 'Taxonomy';
echo $this->element('genericElements/Form/genericForm', [
'form' => $this->Form,
'data' => [
'title' => empty($this->request->params['named']['enable']) ? __('Confirm creation of Taxonomy Tag') : __('Confirm enabling Taxonomy Tag'),
'description' => __('Tag `%s` will be %s.',
$this->request->data['Taxonomy']['name'],
!empty($this->request->params['named']['enable']) ?
__('enabled') : (
!empty($this->request->params['named']['update']) ? __('updated') : __('created')
)
),
'model' => $modelForForm,
'fields' => [
[
'field' => 'taxonomy_id',
'type' => 'hidden',
'class' => 'input-xxlarge',
],
[
'field' => 'name',
'type' => 'hidden',
'class' => 'input-xxlarge',
],
],
'submit' => [
'action' => $this->request->params['action'],
],
]
]);
?>
<?php
if (empty($ajax)) {
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'taxonomies', 'menuItem' => 'addTag'));
}
?>

View File

@ -0,0 +1,196 @@
<?php
$fields = [
[
'name' => __('Name'),
'sort' => 'tag',
'class' => 'short',
'data_path' => 'tag'
],
[
'name' => __('Expanded'),
'sort' => 'expanded',
'data_path' => 'expanded'
],
[
'name' => __('Numerical Value'),
'sort' => 'numerical_value',
'class' => 'short',
'data_path' => 'numerical_value',
'element' => 'custom',
'function' => function (array $row) {
$html = isset($row['numerical_value']) ? h($row['numerical_value']) : '';
if (isset($row['original_numerical_value'])) {
$html .= sprintf(' <i class="%s" title="%s" data-value-overriden="1"></i>',
$this->FontAwesome->getClass('exclamation-triangle'),
__('Numerical value overridden by userSetting.&#10;Original numerical_value = %s',
empty($row['original_numerical_value']) ? __('None') : h($row['original_numerical_value'])
)
);
}
return $html;
}
],
[
'name' => __('# Events'),
'sort' => 'events',
'class' => 'short',
'data_path' => 'events',
'element' => 'links',
'url' => '/events/index',
'url_params_data_paths' => ['searchtag' => 'existing_tag.Tag.id'],
],
[
'name' => __('# Attributes'),
'sort' => 'attributes',
'class' => 'short',
'data_path' => 'attributes',
'element' => 'links',
'url' => '/attributes/search',
'url_params_data_paths' => ['tags' => 'existing_tag.Tag.id'],
],
[
'name' => __('Tag'),
'sort' => 'tag',
'class' => 'short',
'data_path' => 'existing_tag',
'element' => 'tagSimple',
],
[
'name' => __('Enabled'),
'sort' => 'existing_tag.Tag.hide_tag',
'class' => 'short',
'data_path' => 'existing_tag.Tag.hide_tag',
'element' => 'booleanOrNA',
'boolean_reverse' => true
],
];
$actions = [
[
'title' => __('View Correlation Graph'),
'icon' => 'share-alt',
'url' => $baseurl . '/tags/viewGraph',
'url_params_data_paths' => ['existing_tag.Tag.id'],
'postLinkConfirm' => __('Are you sure you want to create this tag?'),
'requirement' => $isAclTagger && $taxonomy['enabled'],
],
[
'title' => __('Create Tag'),
'icon' => 'plus',
'onclick' => 'openGenericModal(\'' . $baseurl . sprintf('/taxonomies/addTag/taxonomy_id:%s/[onclick_params_data_path]\');', $taxonomy['id']),
'onclick_params_data_path' => ['name' => 'tag'],
'complex_requirement' => array(
'function' => function ($row, $options) {
return $options['isAclTagger'] && $options['taxonomyEnabled'] && empty($row['existing_tag']);
},
'options' => array(
'isAclTagger' => $isAclTagger,
'taxonomyEnabled' => $taxonomy['enabled']
)
),
],
[
'title' => __('Enable Tag'),
'icon' => 'play',
'onclick' => 'openGenericModal(\'' . $baseurl . sprintf('/taxonomies/addTag/taxonomy_id:%s/enable:1/[onclick_params_data_path]\');', $taxonomy['id']),
'onclick_params_data_path' => ['name' => 'tag'],
'complex_requirement' => array(
'function' => function ($row, $options) {
return $options['isAclTagger'] && $options['taxonomyEnabled'] && !empty($row['existing_tag'] && $options['datapath']['hide_tag']);
},
'options' => array(
'isAclTagger' => $isAclTagger,
'taxonomyEnabled' => $taxonomy['enabled'],
'datapath' => array(
'hide_tag' => 'existing_tag.Tag.hide_tag'
)
)
),
],
[
'title' => __('Update Tag'),
'icon' => 'sync',
'onclick' => 'openGenericModal(\'' . $baseurl . sprintf('/taxonomies/addTag/taxonomy_id:%s/update:1/[onclick_params_data_path]\');', $taxonomy['id']),
'onclick_params_data_path' => ['name' => 'tag'],
'complex_requirement' => array(
'function' => function ($row, $options) {
return $options['isAclTagger'] && $options['taxonomyEnabled'] &&
isset($row['existing_tag']) && $row['existing_tag'] !== false && !$options['datapath']['hide_tag'];
},
'options' => array(
'isAclTagger' => $isAclTagger,
'taxonomyEnabled' => $taxonomy['enabled'],
'datapath' => array(
'hide_tag' => 'existing_tag.Tag.hide_tag'
)
)
),
],
[
'title' => __('Disable Tag'),
'icon' => 'stop',
'onclick' => 'openGenericModal(\'' . $baseurl . sprintf('/taxonomies/disableTag/taxonomy_id:%s/[onclick_params_data_path]\');', $taxonomy['id']),
'onclick_params_data_path' => ['name' => 'tag'],
'complex_requirement' => array(
'function' => function ($row, $options) {
return $options['isAclTagger'] && $options['taxonomyEnabled'] &&
isset($row['existing_tag']) && $row['existing_tag'] !== false && !$options['datapath']['hide_tag'];
},
'options' => array(
'isAclTagger' => $isAclTagger,
'taxonomyEnabled' => $taxonomy['enabled'],
'datapath' => array(
'hide_tag' => 'existing_tag.Tag.hide_tag'
)
)
),
],
];
echo $this->element('/genericElements/IndexTable/scaffold', ['scaffold_data' => ['data' => [
'data' => $entries,
'stupid_pagination' => 1,
'top_bar' => [
'children' => [
[
'type' => 'simple',
'children' => [
[
'url' => $baseurl . sprintf('/taxonomies/view/%s', $taxonomy['id']),
'text' => __('All'),
'active' => !isset($passedArgsArray['enabled']),
],
[
'url' => $baseurl . sprintf('/taxonomies/view/%s/enabled:1', $taxonomy['id']),
'text' => __('Enabled'),
'active' => isset($passedArgsArray['enabled']) && $passedArgsArray['enabled'] === "1",
],
[
'url' => $baseurl . sprintf('/taxonomies/view/%s/enabled:0', $taxonomy['id']),
'text' => __('Disabled'),
'active' => isset($passedArgsArray['enabled']) && $passedArgsArray['enabled'] === "0",
]
]
],
[
'type' => 'search',
'button' => __('Filter'),
'placeholder' => __('Enter value to search'),
'searchKey' => 'filter',
'cancel' => array(
'fa-icon' => 'times',
'title' => __('Remove filters'),
'onClick' => 'cancelSearch',
)
]
]
],
'fields' => $fields,
'actions' => $actions,
'paginatorOptions' => [
'url' => [$taxonomy['id']]
],
'persistUrlParams' => ['filter']
],
'containerId' => 'preview_taxonomy_tags_container'
]]);

View File

@ -0,0 +1,31 @@
<?php
$modelForForm = 'Taxonomy';
echo $this->element('genericElements/Form/genericForm', [
'form' => $this->Form,
'data' => [
'title' => __('Confirm disabling Taxonomy Tag'),
'description' => __('Tag `%s` will be disabled.', $this->request->data['Taxonomy']['name']),
'model' => $modelForForm,
'fields' => [
[
'field' => 'taxonomy_id',
'type' => 'hidden',
'class' => 'input-xxlarge',
],
[
'field' => 'name',
'type' => 'hidden',
'class' => 'input-xxlarge',
],
],
'submit' => [
'action' => $this->request->params['action'],
],
]
]);
?>
<?php
if (empty($ajax)) {
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'taxonomies', 'menuItem' => 'disableTag'));
}
?>

View File

@ -1,188 +1,72 @@
<div class="taxonomy view">
<h2><?= __('%s Taxonomy Library', h(strtoupper($taxonomy['namespace'])));?></h2>
<div class="row-fluid"><div class="span8" style="margin:0">
<?php
$enabled = $taxonomy['enabled'] ? '<span class="green">'. __('Yes') . '</span>&nbsp;&nbsp;' : '<span class="red">' . __('No') . '</span>&nbsp;&nbsp;';
if ($isSiteAdmin) {
if ($taxonomy['enabled']) {
$enabled .= $this->Form->postLink(__('(disable)'), array('action' => 'disable', h($taxonomy['id'])), array('title' => __('Disable')), (__('Are you sure you want to disable this taxonomy library?')));
} else {
$enabled .= $this->Form->postLink(__('(enable)'), array('action' => 'enable', h($taxonomy['id'])), array('title' => __('Enable')), (__('Are you sure you want to enable this taxonomy library?')));
$filterTagsConditions = [];
$availableConditions = ['enabled', 'filter'];
foreach ($availableConditions as $key) {
if (isset($this->request->params['named'][$key])) {
$filterTagsConditions[$key] = $this->request->params['named'][$key];
}
}
$tableData = [
['key' => __('ID'), 'value' => $taxonomy['id']],
['key' => __('Namespace'), 'value' => $taxonomy['namespace']],
['key' => __('Description'), 'value' => $taxonomy['description']],
['key' => __('Version'), 'value' => $taxonomy['version']],
['key' => __('Enabled'), 'html' => $enabled],
];
echo $this->element('genericElements/viewMetaTable', ['table_data' => $tableData]);
?>
</div></div>
<br>
<div class="pagination">
<ul>
<?php
if (!empty($filter)) $url = array($id, 'filter:' . $filter);
else $url = array($id);
$this->Paginator->options(array(
'url' => $url,
));
$filterTags = '';
foreach ($filterTagsConditions as $key => $value) {
$filterTags .= sprintf('/%s:%s', h($key), h($value));
}
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
?>
</ul>
</div>
<div id="attributeList" class="attributeListContainer">
<div class="tabMenuFixedContainer">
<div class="tabMenu tabMenuEditBlock noPrint mass-select" style="float:left;top:-1px;">
<span id="multi-edit-button" title="Create / update selected tags" role="button" tabindex="0" aria-label="<?php echo __('Create and/or update selected tags');?>" class="icon-plus useCursorPointer" onClick="addSelectedTaxonomies(<?php echo $taxonomy['id']; ?>);"></span>
</div>
<div style="float:right !important;overflow:hidden;border:0px;padding:0px;padding-right:200px;">
<input type="text" id="quickFilterField" class="tabMenuFilterField taxFilter" value="<?php echo h($filter);?>" /><span id="quickFilterButton" class="useCursorPointer taxFilterButton" onClick='quickFilterTaxonomy("<?php echo h($taxonomy['id']);?>");'><?php echo __('Filter');?></span>
</div>
<span class="tabMenuFixed tabMenuFixedLeft tabMenuSides useCursorPointer noPrint mass-select" style="margin-left:50px;">
<span id="multi-edit-button" title="<?php echo __('Hide selected tags');?>" role="button" tabindex="1" aria-label="<?php echo __('Hide selected tags');?>" class="useCursorPointer" onClick="hideSelectedTags(<?php echo $taxonomy['id']; ?>);">
<?php echo __('Hide selected tags');?>
</span>
</span>
<span class="tabMenuFixed tabMenuFixedLeft tabMenuSides useCursorPointer noPrint mass-select">
<span id="multi-edit-button" title="<?php echo __('Unhide selected tags');?>" role="button" tabindex="2" aria-label="<?php echo __('Unhide selected tags');?>" class="useCursorPointer" onClick="unhideSelectedTags(<?php echo $taxonomy['id']; ?>);">
<?php echo __('Unhide selected tags');?>
</span>
</span>
</div>
<table class="table table-striped table-hover table-condensed">
<tr>
<?php if ($isAclTagger && !empty($entries)): ?>
<th><input class="select_all" type="checkbox" onClick="toggleAllTaxonomyCheckboxes();" /></th>
<?php endif;?>
<th><?php echo $this->Paginator->sort('tag', __('Tag'));?></th>
<th><?php echo $this->Paginator->sort('expanded', __('Expanded'));?></th>
<th><?php echo $this->Paginator->sort('numerical_value', __('Numerical value'));?></th>
<th><?php echo $this->Paginator->sort('events');?></th>
<th><?php echo $this->Paginator->sort('attributes');?></th>
<th><?php echo $this->Paginator->sort('tag', __('Tags'));?></th>
<th><?php echo __('Action');?></th>
</tr><?php
foreach ($entries as $k => $item): ?>
<tr>
<?php if ($isAclTagger): ?>
<td style="width:10px;">
<input id = "select_<?php echo h($k); ?>" class="select_taxonomy" type="checkbox" data-id="<?php echo h($k);?>" />
</td>
<?php endif; ?>
<td id="tag_<?php echo h($k); ?>" class="short"><?php echo h($item['tag']); ?></td>
<td><?php echo h($item['expanded']); ?></td>
<td class="short">
<?php echo isset($item['numerical_value']) ? h($item['numerical_value']) : ''; ?>&nbsp;
<?php if(isset($item['original_numerical_value'])): ?>
<i
class="<?= $this->FontAwesome->getClass('exclamation-triangle') ?>"
title="<?= __('Numerical value overridden by userSetting.&#10;Original numerical_value = %s', h($item['original_numerical_value'])) ?>"
data-value-overriden="1"
></i>
<?php endif; ?>
</td>
<td class="short">
<?php
if ($item['existing_tag']) {
?>
<a href="<?= $baseurl."/events/index/searchtag:". h($item['existing_tag']['Tag']['id']);?>"><?php echo h($item['events']);?></a>
<?php
} else {
echo __('N/A');
}
?>
</td>
<td class="short">
<?php
if ($item['existing_tag']):
?>
<a href="<?= $baseurl."/attributes/search/tags:". h($item['existing_tag']['Tag']['id']);?>"><?php echo h($item['attributes']);?></a>
<?php
else:
echo __('N/A');
endif;
?>
</td>
<td class="short">
<?php
if ($item['existing_tag']):
if ($item['existing_tag']['Tag']['hide_tag']):
?>
<span class="red bold"><?php echo __('Hidden');?></span>
<?php
else:
$url = $baseurl . '/events/index/searchtag:' . h($item['existing_tag']['Tag']['id']);
if ($isAclTagger) $url = $baseurl . '/tags/edit/' . h($item['existing_tag']['Tag']['id']);
?>
<a href="<?php echo $url;?>" data-tag-id="<?= h($item['existing_tag']['Tag']['id']) ?>" class="<?php echo $isAclTagger ? 'tag tagFirstHalf' : 'tag' ?>" style="background-color:<?php echo h($item['existing_tag']['Tag']['colour']);?>;color:<?php echo $this->TextColour->getTextColour($item['existing_tag']['Tag']['colour']);?>"><?php echo h($item['existing_tag']['Tag']['name']); ?></a>
<?php
endif;
echo '&nbsp;' . $this->Html->link('', array('controller' => 'tags', 'action' => 'viewGraph', $item['existing_tag']['Tag']['id']), array('class' => 'fa fa-share-alt black', 'title' => __('View correlation graph'), 'aria-label' => __('View correlation graph')));
endif;
?>
</td>
<td class="action">
<?php
if ($isAclTagger && $taxonomy['enabled']) {
echo $this->Form->create('Tag', array('id' => 'quick_' . h($k), 'url' => $baseurl . '/taxonomies/addTag/', 'style' => 'margin:0px;'));
echo $this->Form->input('name', array('type' => 'hidden', 'value' => $item['tag']));
echo $this->Form->input('taxonomy_id', array('type' => 'hidden', 'value' => $taxonomy['id']));
echo $this->Form->end();
if ($item['existing_tag'] && !$item['existing_tag']['Tag']['hide_tag']):
echo $this->Form->create('Tag', array('id' => 'quick_disable_' . h($k), 'url' => $baseurl . '/taxonomies/disableTag/', 'style' => 'margin:0px;'));
echo $this->Form->input('name', array('type' => 'hidden', 'value' => $item['tag']));
echo $this->Form->input('taxonomy_id', array('type' => 'hidden', 'value' => $taxonomy['id']));
echo $this->Form->end();
?>
<span class="fa fa-sync useCursorPointer" title="<?php echo __('Refresh');?>" role="button" tabindex="0" aria-label="<?php echo __('Refresh');?>" onClick="submitQuickTag('<?php echo 'quick_' . h($k); ?>');"></span>
<span class="icon-minus useCursorPointer" title="<?php echo __('Disable');?>" role="button" tabindex="0" aria-label="<?php echo __('Disable');?>" onClick="submitQuickTag('<?php echo 'quick_disable_' . h($k); ?>');"></span>
<?php
else:
?>
<span class="icon-plus useCursorPointer" title="<?php echo __('Enable');?>" role="button" tabindex="0" aria-label="<?php echo __('Refresh or enable');?>" onClick="submitQuickTag('<?php echo 'quick_' . h($k); ?>');"></span>
<?php
endif;
echo $this->Form->end();
} else {
echo __('N/A');
}
?>
</td>
</tr>
<?php endforeach; ?>
</table>
<p>
<?php
echo $this->Paginator->counter(array(
'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?>
</p>
<div class="pagination">
<ul>
<?php
echo $this->Paginator->prev('&laquo; ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
echo $this->Paginator->next(__('next') . ' &raquo;', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('input:checkbox').removeAttr('checked');
$('.mass-select').hide();
$('.select_taxonomy, .select_all').click(function(){
taxonomyListAnyCheckBoxesChecked();
});
$('[data-value-overriden="1"]').tooltip();
});
</script>
<?= $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'taxonomies', 'menuItem' => 'view'));
$enableHTML = '';
if ($isSiteAdmin) {
if ($taxonomy['enabled']) {
$enableHTML .= $this->Form->postLink(__('Disable taxonomy'), array('action' => 'disable', h($taxonomy['id'])), array('title' => __('Disable')), (__('Are you sure you want to disable this taxonomy library?')));
} else {
$enableHTML .= $this->Form->postLink(__('Enable taxonomy'), array('action' => 'enable', h($taxonomy['id'])), array('title' => __('Enable')), (__('Are you sure you want to enable this taxonomy library?')));
}
}
echo $this->element(
'genericElements/SingleViews/single_view',
[
'title' => __('%s Taxonomy Library', h(strtoupper($taxonomy['namespace']))),
'data' => $taxonomy,
'fields' => [
[
'key' => __('ID'),
'path' => 'id'
],
[
'key' => __('Namespace'),
'path' => 'namespace'
],
[
'key' => __('Description'),
'path' => 'description'
],
[
'key' => __('Version'),
'path' => 'version'
],
[
'key' => __('Enabled'),
'path' => 'enabled',
'type' => 'boolean'
],
[
'key' => __('Action'),
'type' => 'custom',
'requirement' => !empty($enableHTML),
'function' => function ($taxonomy) use ($enableHTML) {
return $enableHTML;
}
],
],
'children' => [
[
'url' => sprintf('/taxonomies/taxonomy_tags/{{0}}%s', $filterTags),
'url_params' => ['id'],
'title' => __('Taxonomy Tags'),
'elementId' => 'preview_taxonomy_tags_container',
'open' => true,
],
],
'menuData' => [
'menuList' => 'taxonomies',
'menuItem' => 'view'
]
]
);

View File

@ -2228,7 +2228,7 @@ function runIndexQuickFilterFixed(preserveParams, url, target) {
delete preserveParams[searchKey]
}
for (var key in preserveParams) {
if (typeof key == 'number') {
if (!isNaN(key)) {
url += "/" + preserveParams[key];
} else if (key !== 'page') {
url += "/" + key + ":" + preserveParams[key];