I remember to have asked about this before, but the post seems to be missing from the forums.
Would it be possible to make the Tags section in the Admin page more browsable by adding pagination? We are still coping with about 45.500 Tags. I have made kind of a hack to be able to view them, but opening all of them in edit-mode makes the browser unresponsive.
The hack (still requests all tags server-side):
<?php
$canEdit = is_allowed('Tags', 'edit');
$canDelete = is_allowed('Tags', 'delete');
if ($canEdit):
queue_js_file(array('vendor/jquery.jeditable', 'tags'));
$pageTitle = __('Edit Tags');
else:
$pageTitle = __('Browse Tags');
endif;
$pageTitle .= ' ' . __('(%s total)', $total_tags);
echo head(array('title'=>$pageTitle,'bodyclass'=>'tags browse-tags'));
echo flash();
?>
<div id='search-filters'>
- <?php echo __('Record Type') . ': ' . $browse_for; ?>
</div>
<?php if ($total_tags): ?>
<?php if ($canEdit): ?>
<section class="three columns alpha">
<h2><?php echo __('Editing Tags'); ?></h2>
- <?php echo __('To view all items with a tag, click the number.'); ?>
- <?php echo __('To edit the tag name, click the name and begin editing, and hit "enter" to save. To cancel an edit, click the ESC key or click away from the tag.'); ?>
- <?php echo __('To delete a tag, click the X. Deleting a tag will not delete the tagged items.'); ?>
</section>
<section class="seven columns omega">
<?php else: ?>
<section>
<?php endif; ?>
<?php
$per_page = 750;
$page = 1;
if (isset($_GET["page"])) {
$page = $_GET["page"];
}
$pages = range(0, count($tags) / $per_page, 1);
$start = $page * $per_page;
$end = $start + $per_page;
$tags = array_slice($tags, $start, $end);
?>
<ul class="quick-filter-wrapper">
<ul class="dropdown">
<?php foreach($pages as $pg): ?>
<?php $st = $pg*$per_page; ?>
<?php endforeach; ?>
<div id="tags-nav">
<?php
$sortOptions = array(
__('Most') => array('sort_field' => 'count', 'sort_dir' => 'd'),
__('Least') => array('sort_field' => 'count','sort_dir' => 'a'),
__('Alphabetical') => array('sort_field' => 'name', 'sort_dir'=> 'a'),
__('Recent') => array('sort_field' => 'time', 'sort_dir' => 'd')
);
foreach ($sortOptions as $label => $params) {
$uri = html_escape(current_url($params));
$class = ($sort == $params) ? ' class="current"' : '';
echo "<span $class>$label</span>";
}
?>
<ul class="quick-filter-wrapper">
<ul class="dropdown">
<?php foreach($record_types as $record_type): ?>
<?php endforeach; ?>
</div>
<ul class="tag-list">
<?php foreach ($tags as $tag): ?>
name); ?>" class="count"><?php echo $tag['tagCount']; ?>
<?php else: ?>
<span class="count"><?php echo $tag['tagCount']; ?></span>
<?php endif; ?>
<?php if ($canEdit): ?>
<span class="tag edit-tag" id="<?php echo $tag->id; ?>"><?php echo $tag->name; ?></span>
<?php else: ?>
<span class="tag"><?php echo $tag->name; ?></span>
<?php endif; ?>
<?php if ($canDelete): ?>
<span class="delete-tag"><?php echo link_to($tag, 'delete-confirm', 'delete', array('class' => 'delete-confirm')); ?></span>
<?php endif; ?>
<?php endforeach; ?>
<?php fire_plugin_hook('admin_tags_browse', array('tags' => $tags, 'view' => $this)); ?>
</section>
<?php else: ?>
<p><?php echo __('There are no tags to display. You must first tag some items.'); ?></p>
<?php endif; ?>
<?php if($canEdit): ?>
<script type="text/javascript">
jQuery(document).ready(function () {
var editableURL = '<?php echo url('tags/rename-ajax'); ?>';
var tagURLBase = '<?php echo url('items/?tag='); ?>';
Omeka.Tags.enableEditInPlace(editableURL, tagURLBase);
});
</script>
<?php endif; ?>
<?php echo foot(); ?>