Ticket #1288 (closed enhancement: duplicate)
Suppression en masse de tags dans les billets-images de Gallery
| Reported by: | jojojr | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | module:plugins | Version: | 2.3 |
| Severity: | normal | Keywords: | Gallery,tags |
| Cc: |
Description
Gallery 0.4.2 sous DC 2.3.1. La suppression en masse de tags n'est pas implémentée.
Fix:
1.- Dans le fichier gallery/items.php vers la ligne 210 remplacer
$combo_action[__('Tags')] = array(
__('add tags') => 'tags'
);
par
$combo_action[__('Tags')] = array(
__('Add tags') => 'tags',
__('Remove tags') => 'tags_remove'
);
ce qui au passage corrige la petite erreur d'oubli de majuscule à la chaîne 'add tags'
2.- Dans le fichier gallery/item_actions
- vers la ligne 178, après elseif ($action == 'tags' && !empty($_POSTnew_tags?)) (juste avant DISPLAY) rajouter:
elseif ($action == 'tags_remove' && !empty($_POST['meta_id'])
&& $core->auth->check('delete,contentadmin',$core->blog->id)) {
try {
$meta =& $GLOBALS['core']->meta;
while ($posts->fetch()) {
foreach ($_POST['meta_id'] as $v) {
$meta->delPostMeta($posts->post_id,'tag',$v);
}
}
http::redirect($redir);
}
catch (Exception $e) {
$core->error->add($e->getMessage());
}
}
- vers la ligne 306 juste après elseif ($action == 'tags'), rajouter:
elseif ($action == 'tags_remove') {
$meta =& $GLOBALS['core']->meta;
$tags = array();
foreach ($_POST['entries'] as $id) {
$post_tags = $meta->getMetadata(array(
'meta_type' => 'tag',
'post_id' => (integer) $id))->toStatic()->rows();
foreach ($post_tags as $v) {
if (isset($tags[$v['meta_id']])) {
$tags[$v['meta_id']]++;
} else {
$tags[$v['meta_id']] = 1;
}
}
}
echo '<h2>'.__('Remove selected tags from entries').'</h2>';
if (empty($tags)) {
echo '<p>'.__('No tags for selected entries').'</p>';
return;
}
$posts_count = count($_POST['entries']);
echo
'<form action="plugin.php?p=gallery&m=itemsactions" method="post">'.
'<fieldset><legend>'.__('Following tags have been found in selected entries:').'</legend>';
foreach ($tags as $k => $n) {
$label = '<label class="classic">%s %s</label>';
if ($posts_count == $n) {
$label = sprintf($label,'%s','<strong>%s</strong>');
}
echo '<p>'.sprintf($label,
form::checkbox(array('meta_id[]'),html::escapeHTML($k)),
html::escapeHTML($k)).
'</p>';
}
echo
'<p><input type="submit" value="'.__('ok').'" /></p>'.
$hidden_fields.
$core->formNonce().
form::hidden(array('action'),'tags_remove').
'</fieldset></form>';
}
J'attache le fichier gallery/item_actions ainsi modifié.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


fichier gallery/items_actions modifié