1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +02:00

changes suggested by @SUTJael

This commit is contained in:
John Moore 2014-09-11 19:04:49 -07:00
parent f50b1a2138
commit 038a1024d9
3 changed files with 20 additions and 19 deletions

View file

@ -191,10 +191,15 @@ class Tag extends database_object implements library_item
$sql = 'UPDATE `tag` SET `name` = ? WHERE `id` = ?';
Dba::write($sql, array($data[name], $this->id));
if ($data['split_tag']) {
$split_to = Tag::construct_from_name($data['split_tag']);
if ($split_to->id) {
$this->split($split_to->id);
if ($data['clone_tags']) {
$tag_names = explode(',', $data['clone_tags']);
foreach($tag_names as $tag){
$split_to = Tag::construct_from_name($tag);
if ($split_to->id == 0) {
Tag::add_tag($tag);
$split_to = Tag::construct_from_name($tag);
}
$this->clone_tag($split_to->id);
}
}
@ -236,10 +241,10 @@ class Tag extends database_object implements library_item
}
/**
* split
* Splits this tag to two.
* clone_tag
* Clones this tag to another one.
*/
public function split($split_to)
public function clone_tag($split_to)
{
if ($this->id != $split_to) {
debug_event('tag', 'Splitting tag ' . $this->id . ' into ' . $split_to . ')...', '5');

View file

@ -242,9 +242,12 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
});
}
if ($('#split_tag').length > 0) {
$.each(parent.editTagChoices, function (i, tagtext) {
$("#split_tag").append(new Option(tagtext, tagtext));
if ($('#clone_tags').length > 0) {
$("#clone_tags").tagit({
allowSpaces: true,
singleField: true,
singleFieldDelimiter: ',',
availableTags: parent.editTagChoices
});
}
});

View file

@ -47,16 +47,9 @@
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td class="edit_dialog_content_header"><?php echo T_('Split this tag into') ?></td>
<td class="edit_dialog_content_header"><?php echo T_('Clone this tag into') ?></td>
<td>
<select name="split_tag" id="split_tag">
<option value=""></option>
<?php
if ($libitem->merged_to) {
echo "<option value='" . $libitem->merged_to . "'>" . $libitem->merged_to . "</option>";
}
?>
</select>
<input type="text" name="clone_tags" id="clone_tags" />
</td>
</tr>
</table>