Skip to content

Commit

Permalink
Added 'Delete all below' in track menu in 'Now Playing'
Browse files Browse the repository at this point in the history
Added missing 'Add all tracks' button in other song' versions search results
  • Loading branch information
ArturSierzant committed Mar 12, 2018
1 parent 475d6bf commit ea58609
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/library.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ function moveSubMenu($i, $bottom) {
<div class="menuSubRight" id="menu-sub-track<?php echo $i ?>" onclick='offMenuSub(<?php echo $i ?>);'>
<div class="icon-anchor" id="track<?php echo $i; ?>_delete" <?php if ($cfg['access_play'])
echo 'onclick="javascript:showSpinner();ajaxRequest(\'play.php?action=deleteIndex&amp;index=' . $i . '&amp;menu=playlist\',evaluateListpos);"'; ?>>Remove <i class="fa fa-times-circle fa-fw icon-small"></i></div>
<div class="icon-anchor" id="track<?php echo $i; ?>_delete_below" <?php if ($cfg['access_play'])
echo 'onclick="javascript:showSpinner();ajaxRequest(\'play.php?action=deleteBelowIndex&amp;index=' . $i . '&amp;menu=playlist\',evaluateListpos);"'; ?>>Remove all below<i class="fa fa-times-circle-o fa-fw icon-small"></i></div>
<div class="icon-anchor" id="track<?php echo $i; ?>_play_next" <?php if ($cfg['access_play'])
echo 'onclick="javascript:moveTrack(\'playNext\',' . $i . ',false);"'; ?>>Play next <i class="fa fa-caret-square-o-right fa-fw icon-small"></i></div>
<div class="icon-anchor" id="track<?php echo $i; ?>_move_top" <?php if ($cfg['access_play'])
Expand Down
33 changes: 30 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,11 @@ function view3all() {
<table cellspacing="0" cellpadding="0" class="border">
<tr class="header">
<td class="icon">&nbsp;</td><!-- track menu -->
<td class="icon">&nbsp;</td><!-- add track -->
<td class="icon">
<span onMouseOver="return overlib('Add all tracks');" onMouseOut="return nd();">
<?php if ($cfg['access_add']) echo '<i id="add_all_VER" class="fa fa-plus-circle fa-fw icon-small pointer"></i>';?>
</span>
</td><!-- add track -->
<td class="track-list-artist"><a <?php echo ($order_bitmap_artist == '<span class="typcn"></span>') ? '':'class="sort_selected"';?> href="<?php echo $url; ?>&amp;order=artist&amp;sort=<?php echo $sort_artist; ?>">Artist&nbsp;<?php echo $order_bitmap_artist; ?></a></td>
<td><a <?php echo ($order_bitmap_title == '<span class="typcn"></span>') ? '':'class="sort_selected"';?> href="<?php echo $url; ?>&amp;order=title&amp;sort=<?php echo $sort_title; ?>">Title&nbsp;<?php echo $order_bitmap_title; ?></a></td>
<td><a <?php echo ($order_bitmap_album == '<span class="typcn"></span>') ? '':'class="sort_selected"';?> href="<?php echo $url; ?>&amp;order=album&amp;sort=<?php echo $sort_album; ?>">Album&nbsp;<?php echo $order_bitmap_album; ?></a></td>
Expand All @@ -2174,6 +2178,7 @@ function view3all() {

<?php
$i=0;
$VER_ids = '';
//$query = mysqli_query($db, 'SELECT track.artist, track.title, track.number, track.featuring, track.album_id, track.track_id, track.miliseconds, track.relative_file, album.image_id, album.album FROM track, album ' . $filter_query . ' ' . $order_query);

$q = 'SELECT * FROM
Expand All @@ -2194,7 +2199,9 @@ function view3all() {

//$query = mysqli_query($db, 'SELECT track.artist, track.title, track.featuring, track.album_id, track.track_id, track.miliseconds FROM track ' . $filter_query . ' ' . $order_query);

while ($track = mysqli_fetch_assoc($query)) { ?>
while ($track = mysqli_fetch_assoc($query)) {
$VER_ids = ($VER_ids == '' ? $track['tid'] : $VER_ids . ';' . $track['tid']);
?>
<tr class="<?php echo ($i++ & 1) ? 'even' : 'odd'; ?> mouseover">
<td class="icon">
<span id="menu-track<?php echo $i ?>">
Expand Down Expand Up @@ -2290,7 +2297,27 @@ function view3all() {

<?php
}
echo '</table>' . "\n";
?>
</table>
<script>
$("#add_all_VER").click(function(){

$.ajax({
type: "GET",
url: "play.php",
data: { 'action': 'addMultitrack', 'track_ids': '<?php echo $VER_ids; ?>', 'addType':'all_VER'},
dataType : 'json',
success : function(json) {
evaluateAdd(json);
},
error : function() {
$("#add_all_VER").removeClass('fa-cog fa-spin icon-selected').addClass('fa-plus-circle');
}
});
});
</script>
<?php
//echo '</table>' . "\n";
require_once('include/footer.inc.php');
}

Expand Down
24 changes: 24 additions & 0 deletions play.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
elseif ($action == 'seekImageMap') seekImageMap();
elseif ($action == 'playIndex') playIndex();
elseif ($action == 'deleteIndex') deleteIndex();
elseif ($action == 'deleteBelowIndex') deleteBelowIndex();
elseif ($action == 'deleteIndexAjax') deleteIndexAjax();
elseif ($action == 'deletePlayed') deletePlayed();
elseif ($action == 'crop') crop();
Expand Down Expand Up @@ -1039,6 +1040,29 @@ function deleteIndex() {



// +------------------------------------------------------------------------+
// | Delete all below index |
// +------------------------------------------------------------------------+
function deleteBelowIndex() {
global $cfg, $db;
authenticate('access_play');
require_once('include/play.inc.php');

$index = (int) get('index');
$status = mpd('status');

mpd('delete ' . ($index + 1) . ':' . $status['playlistlength']);
if (get('menu') == 'playlist') {
$data = array();
$data['index'] = (string) $index;
echo safe_json_encode($data);
}

}




// +------------------------------------------------------------------------+
// | Delete played |
// +------------------------------------------------------------------------+
Expand Down

0 comments on commit ea58609

Please sign in to comment.