diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-03-31 08:07:54 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-03-31 08:07:54 +0000 |
commit | 2f126626cbd951e97220d7c9ab1f2791f614f401 (patch) | |
tree | 739ca78b8d50c42829d45176829e2ba9e7ef39a3 | |
parent | 05a1cfe34904997715dd145af81d6d2170e120df (diff) | |
download | ampache-2f126626cbd951e97220d7c9ab1f2791f614f401.tar.gz ampache-2f126626cbd951e97220d7c9ab1f2791f614f401.tar.bz2 ampache-2f126626cbd951e97220d7c9ab1f2791f614f401.zip |
added download for size, and seriously cleaned up the /song.php file it actually is not ugly anymore.. yeah!
-rw-r--r-- | config/ampache.cfg.php.dist | 9 | ||||
-rwxr-xr-x | docs/CHANGELOG | 5 | ||||
-rw-r--r-- | lib/flag.php | 5 | ||||
-rw-r--r-- | lib/general.lib.php | 42 | ||||
-rw-r--r-- | lib/gettext.php | 2 | ||||
-rw-r--r-- | song.php | 121 | ||||
-rw-r--r-- | templates/list_flagged.inc | 89 | ||||
-rw-r--r-- | templates/show_album.inc | 25 | ||||
-rw-r--r-- | templates/show_albums.inc | 4 | ||||
-rw-r--r-- | templates/show_artist_box.inc.php | 4 | ||||
-rw-r--r-- | templates/show_artists.inc | 17 | ||||
-rw-r--r-- | templates/show_flag.inc.php | 56 | ||||
-rw-r--r-- | templates/show_random_play.inc | 118 | ||||
-rw-r--r-- | templates/show_random_play_bar.inc.php | 64 | ||||
-rw-r--r-- | templates/sidebar.inc.php | 6 |
15 files changed, 197 insertions, 370 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index e81db2a5..e7ccbf8b 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -257,6 +257,15 @@ max_upload_size = "10485760" # DEFAULT: iso-8859-1 site_charset = iso-8859-1 +# Locale Charset +# In some cases this has to be different +# in order for XHTML and other things to work +# This is disabled by default, enabled only +# if needed. It's specifically needed for Russian +# so that is the default +# Default: cp1251 +#lc_charset = cp1251 + ########################################################## # Public Registration settings, defaults to disabled diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 98c8f117..b91e4580 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,7 +4,12 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 + - Added Download to Random play along with Size limitation + usefull for downloading a set amount of music for your + mp3 player. - Fixed mime detection, wasn't strtolowering the value + - Fixed a few more Charset issues specificaly with Russian + (Thx Nikk) -------------------------------------------------------------------------- v.3.3.2-Beta2 diff --git a/lib/flag.php b/lib/flag.php index 5e16faeb..8f3d0dff 100644 --- a/lib/flag.php +++ b/lib/flag.php @@ -132,11 +132,6 @@ function get_flagged_songs($user = 0) return $arr; } -function show_flagged_songs($flags) -{ - require_once(conf('prefix').'/templates/list_flagged.inc'); -} - function accept_new_tags($flags) { if(!is_array($flags)) $flags = array($flags); diff --git a/lib/general.lib.php b/lib/general.lib.php index c8df6183..ad4d7519 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -490,8 +490,9 @@ function set_memory_limit($new_limit) { function get_random_songs( $options, $matchlist) { $dbh = dbh(); + /* Define the options */ - $limit = $options['limit']; + $limit = intval($options['limit']); /* If they've passed -1 as limit then don't get everything */ if ($options['limit'] == "-1") { unset($options['limit']); } @@ -524,7 +525,7 @@ function get_random_songs( $options, $matchlist) { $albums_where .= " OR song.album=" . $data[0]; } $albums_where = ltrim($albums_where," OR"); - $query = "SELECT song.id FROM song WHERE $albums_where ORDER BY song.track ASC"; + $query = "SELECT song.id,song.size FROM song WHERE $albums_where ORDER BY song.track ASC"; } elseif ($options['random_type'] == 'full_artist') { $query = "SELECT artist.id FROM song,artist WHERE song.artist=artist.id AND $where GROUP BY song.artist ORDER BY RAND() " . $options['limit']; @@ -533,17 +534,17 @@ function get_random_songs( $options, $matchlist) { $artists_where .= " OR song.artist=" . $data[0]; } $artists_where = ltrim($artists_where," OR"); - $query = "SELECT song.id FROM song WHERE $artists_where ORDER BY RAND()"; + $query = "SELECT song.id,song.size FROM song WHERE $artists_where ORDER BY RAND()"; } elseif ($options['random_type'] == 'unplayed') { - $uid = $_SESSION['userdata']['username']; - $query = "SELECT song.id FROM song LEFT JOIN object_count ON song.id = object_count.object_id " . + $uid = $GLOBALS['user']->id; + $query = "SELECT song.id,song.size FROM song LEFT JOIN object_count ON song.id = object_count.object_id " . "WHERE ($where) AND ((object_count.object_type='song' AND userid = '$uid') OR object_count.count IS NULL ) " . "ORDER BY CASE WHEN object_count.count IS NULL THEN RAND() WHEN object_count.count > 4 THEN RAND()*RAND()*object_count.count " . "ELSE RAND()*object_count.count END " . $options['limit']; } // If unplayed else { - $query = "SELECT id FROM song WHERE $where ORDER BY RAND() " . $options['limit']; + $query = "SELECT id,size FROM song WHERE $where ORDER BY RAND() " . $options['limit']; } $db_result = mysql_query($query, $dbh); @@ -551,10 +552,29 @@ function get_random_songs( $options, $matchlist) { $songs = array(); while ( $r = mysql_fetch_array($db_result) ) { - $songs[] = $r[0]; - } + /* If they've specified a filesize limit */ + if ($options['size_limit']) { + /* Turn it into MB */ + $new_size = ($r['1'] / 1024) / 1024; + + /* If we would go over the allowed size skip to the next song */ + if (($total + $new_size) > $options['size_limit']) { continue; } + + $total = $total + $new_size; + $songs[] = $r[0]; + + /* If we are within 4mb then that's good enough for Vollmer work */ + if (($options['size_limit'] - floor($total)) < 4) { return $songs; } + + } // end if we are defining a size limit + + /* If we aren't using a limit */ + else { + $songs[] = $r[0]; + } + } // while we fetch results - return ($songs); + return $songs; } // get_random_songs @@ -690,10 +710,10 @@ function show_info_box ($title, $type, $items) { if ($type == 'your_song') { - echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&your_popular_songs=$popular_threshold\">Play</a></td>\n"; + echo "<td>$title - <a href=\"$web_path/song.php?action=your_popular_songs&limit=$popular_threshold\">" . _('Play') . "</a></td>\n"; } elseif ($type == 'song') { - echo "<td>$title - <a href=\"$web_path/song.php?action=m3u&popular_songs=$popular_threshold\">Play</a></td>\n"; + echo "<td>$title - <a href=\"$web_path/song.php?action=popular_songs&limit=$popular_threshold\">" . _('Play') . "</a></td>\n"; } else { echo "<td>$title</td>\n"; diff --git a/lib/gettext.php b/lib/gettext.php index 6db831ac..56e175e9 100644 --- a/lib/gettext.php +++ b/lib/gettext.php @@ -32,7 +32,7 @@ function load_gettext() { $lang = conf('lang'); putenv("LANG=" . $lang); /* Try lang, lang + charset and lang + utf-8 */ - setlocale(LC_ALL, $lang,$lang . '_'. conf('site_charset'),$lang . '_UTF-8'); + setlocale(LC_ALL, $lang,$lang . '.'. conf('site_charset'),$lang . '.UTF-8',$lang . '.' . conf('lc_charset')); } } // load_gettext @@ -42,7 +42,11 @@ $web_path = conf('web_path'); $song_ids = array(); $web_path = conf('web_path'); +/* We need an action and a method */ $action = scrub_in($_REQUEST['action']); +$method = scrub_in($_REQUEST['method']); + + switch ($action) { case 'play_selected': $type = scrub_in($_REQUEST['type']); @@ -56,87 +60,86 @@ switch ($action) { else { $song_ids = $_POST['song']; } - $_REQUEST['action'] = 'm3u'; + break; + case 'your_popular_songs': + $song_ids = get_popular_songs($_REQUEST['limit'], 'your', $GLOBALS['user']->id); + break; + case 'popular_songs': + $song_ids = get_popular_songs($_REQUEST['limit'], 'global'); break; case 'genre': $genre = new Genre($_REQUEST['genre']); $song_ids = $genre->get_songs(); - $_REQUEST['action'] = 'm3u'; + break; + case 'artist': + $artist = new Artist($_REQUEST['artist_id']); + $song_ids = $artist->get_song_ids(); + break; + case 'artist_random': + $artist = new Artist($_REQUEST['artist_id']); + $artist->get_count(); + $song_ids = $artist->get_random_songs(); + break; + case 'album_random': + $album = new Album($_REQUEST['album_id']); + $song_ids = $album->get_random_songs(); + break; + case 'album': + $album = new Album($_REQUEST['album_id']); + $song_ids = $album->get_song_ids(); break; case 'random_genre': $genre = new Genre($_REQUEST['genre']); $song_ids = $genre->get_random_songs(); - $_REQUEST['action'] = 'm3u'; break; case 'playlist': $playlist = new Playlist($_REQUEST['playlist_id']); $song_ids = $playlist->get_songs($_REQUEST['song']); - $_REQUEST['action'] = 'm3u'; break; case 'playlist_random': $playlist = new Playlist($_REQUEST['playlist_id']); $song_ids = $playlist->get_random_songs(); - $_REQUEST['action'] = 'm3u'; + break; + case 'random': + if($_REQUEST['genre'][0] != '-1') { + $matchlist['genre'] = $_REQUEST['genre']; + } + if($_REQUEST['catalog'] != '-1') { + $matchlist['catalog'] = $_REQUEST['catalog']; + } + /* Setup the options array */ + $options = array('limit' => $_REQUEST['random'], 'random_type' => $_REQUEST['random_type'],'size_limit'=>$_REQUEST['size_limit']); + $song_ids = get_random_songs($options, $matchlist); break; default: break; } // end action switch -if ($_REQUEST['album']) { - $song_ids = get_song_ids_from_album( $_REQUEST['album'] ); -} -elseif ( $_REQUEST['artist'] ) { - $artist = new Artist($_REQUEST['artist']); - $song_ids = $artist->get_song_ids(); -} -/*! - @action Random Song - @discussion takes a genre and catalog and - returns random songs based upong that -*/ -elseif ( $_REQUEST['random'] ) { - - if($_REQUEST['genre'][0] != '-1') { - $matchlist['genre'] = $_REQUEST['genre']; - } - if($_REQUEST['catalog'] != '-1') { - $matchlist['catalog'] = $_REQUEST['catalog']; - } - /* Setup the options array */ - $options = array('limit' => $_REQUEST['random'], 'random_type' => $_REQUEST['random_type']); - $song_ids = get_random_songs($options, $matchlist); -} - -elseif ( $_REQUEST['artist_random'] ) { - $artist = new Artist($_REQUEST['artist_random']); - $artist->get_count(); - $song_ids = $artist->get_random_songs(); -} -elseif ( $_REQUEST['album_random'] ) { - $album = new Album($_REQUEST['album_random']); - $song_ids = $album->get_random_songs(); -} -elseif ( $_REQUEST['song'] AND !is_array($_REQUEST['song'])) { - $song_ids = array(); - $song_ids[0] = $_REQUEST['song']; -} -elseif ( $_REQUEST['popular_songs'] ) { - $song_ids = get_popular_songs($_REQUEST['popular_songs'], 'global'); -} -elseif ( $_REQUEST['your_popular_songs'] ) { - $song_ids = get_popular_songs($_REQUEST['your_popular_songs'], 'your', $user->username); -} - -/* FIXME! */ -if ( !$_REQUEST['action'] or $_REQUEST['action'] == 'm3u' ) { - $stream_type = conf('playlist_type'); +/* Now that we've gathered the song information we decide what + * we should do with it, this is a sensitive time for the song id's + * they don't know where they want to go.. let's help them out + */ +switch ($method) { + case 'download': + /* Make sure they are allowed to download */ + if (!batch_ok()) { break; } + $name = "AmpacheZip-" . date("m-d-Y",time()); + $song_files = get_song_files($song_ids); + set_memory_limit($song_files[1]+32); + send_zip($name,$song_files[0]); + break; + case 'stream': + default: + $stream_type = conf('playlist_type'); - if ($user->prefs['play_type'] != "stream" AND $user->prefs['play_type'] != "downsample") { - $stream_type = $user->prefs['play_type']; - } - $stream = new Stream($stream_type,$song_ids); - $stream->start(); -} // if streaming + if ($GLOBALS['user']->prefs['play_type'] != "stream" AND $GLOBALS['user']->prefs['play_type'] != "downsample") { + $stream_type = $user->prefs['play_type']; + } + /* Start the Stream */ + $stream = new Stream($stream_type,$song_ids); + $stream->start(); + break; +} // end method switch ?> diff --git a/templates/list_flagged.inc b/templates/list_flagged.inc deleted file mode 100644 index 2605c879..00000000 --- a/templates/list_flagged.inc +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/* - - Copyright (c) 2004 Ampache.org - All rights reserved. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -/*! - @header - A template file - -*/ -$web_path = conf('web_path'); -?> - -<p style="font-size: 10pt; font-weight: bold;">View Flagged Songs</p> -<p>This is the list of songs that have been flagged by you or other Ampache users. Use -this list to determine what songs you need to re-rip or tags you need to update.</p> - -<?php -if ($flags) { ?> - <form name="songs" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> - <table class="tabledata" cellspacing="0" cellpadding="0" > - <tr class="table-header"> - <td><a href="#" onclick="check_songs(); return false;">Select</a></td> - <td><?php echo _("Song"); ?></td> - <td><?php echo _("Flag"); ?></td> - <td><?php echo _("New Flag"); ?>:</td> - <td><?php echo _("Flagged by"); ?></td> - <td><?php echo _("ID3 Update"); ?>:</td> - <td><?php echo _("Comment"); ?>:</td> - </tr> - <?php - foreach ($flags as $flag) { - $song = new Song($flag['song']); - $song->format_song(); - $alt_title = $song->title; - $artist = $song->f_artist; - $alt_artist = $song->artist; - - echo "<tr class=\"even\">" . - "<td><input type=\"checkbox\" name=\"song[]\" id=\"flag_".$flag['song']."\" value=\"".$flag['song']."\"></input></td>" . - "<td><a href=\"".$web_path."/song.php?song=".$flag['song']."\" title=\"$alt_title\">$song->f_title</a> by " . - "<a href=\"".$web_path."/artist.php?action=show&artist=$song->artist_id\" title=\"$alt_artist\">$artist</a></td>" . - "<td>".$flag['type']."</td><td>"; - $onchange = "onchange=\"document.getElementById('flag_".$flag['song']."').checked='checked';\""; - show_flagged_popup($flag['type'],'type',$flag['song']."_newflag", $onchange); - echo "</td><td>".$flag['username']."<br />".date('m/d/y',$flag['date'])."</td>"; - if ($flag['type'] === 'newid3') { - echo "<td><input type=\"radio\" name=\"".$flag['song']."_accept\" value=\"accept\" $onchange />" . _("Accept") . "<br />"; - echo "<input type=\"radio\" name=\"".$flag['song']."_accept\" value=\"reject\" $onchange />" . _("Reject"); - echo "</td>"; - } - else { - echo "<td><a href=\"".$web_path."/admin/song.php?action=edit&song=".$flag['song']."\">edit/view</a></td>"; - } //end ($flag['type'] === 'newid3') and else - echo "<td>" . $flag['comment'] . "</td>"; - echo "</tr>\n"; - } //end foreach ($flags as $flag) - ?> - <tr class="even"> - <td colspan="7"> - <input type="submit" name="action" value="Update Flags"></input> - <input type="submit" name="action" value="Edit Selected"></input> - <input type="submit" name="action" value="Clear Edit List"></input> - </td> - </tr> - </table> - </form> -<?php } else { ?> -<p><?php echo _("You don't have any flagged songs"); ?></p> -<?php } ?> - - diff --git a/templates/show_album.inc b/templates/show_album.inc index b9a2aa2d..7eb181a4 100644 --- a/templates/show_album.inc +++ b/templates/show_album.inc @@ -27,21 +27,18 @@ $web_path = conf('web_path'); // Build array of the table classes we are using $row_classes = array('even','odd'); -//FIXME: I hate having to create this here again... LAME -$user = $GLOBALS['user']; - // Generate variables for the flash ratings //FIXME: -$album_id=$album->id; -$artist_id=$album->artist_id; -$username=$user->username; +$album_id = $album->id; +$artist_id = $album->artist_id; +$username = $GLOBALS['user']->username; ?> <br /> <table class="border" cellspacing="1" cellpadding="3" border="0"> <tr class="table-header"> <td colspan="2"> - <font size="+1"><?php echo htmlspecialchars($album->name); ?> -- + <font size="+1"><?php echo scrub_out($album->name); ?> -- <?php echo $album->f_artist; ?></font> </td> </tr> @@ -62,15 +59,15 @@ $username=$user->username; echo "<br />\n"; ?> <b>Actions:</b><br /> - <a href="<?php echo $web_path; ?>/song.php?action=m3u&album=<?php echo $album->id; ; ?>"><?php echo _("Play Album"); ; ?></a><br /> - <a href="<?php echo $web_path; ?>/song.php?action=m3u&album_random=<?php echo $album->id; ; ?>"><?php echo _("Play Random from Album"); ; ?></a><br /> - <a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ; ?>"><?php echo _("Reset Album Art"); ; ?></a><br /> - <a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ; ?>"><?php echo _("Find Album Art"); ; ?></a><br /> - <?php if (($user->has_access('100')) || (!conf('use_auth'))) { ?> - <a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&album_id=<?php echo $album->id; ; ?>"><?php echo _("Update from tags"); ?></a><br /> + <a href="<?php echo $web_path; ?>/song.php?action=album&album_id=<?php echo $album->id; ?>"><?php echo _("Play Album"); ; ?></a><br /> + <a href="<?php echo $web_path; ?>/song.php?action=album_random&album_id=<?php echo $album->id; ; ?>"><?php echo _("Play Random from Album"); ; ?></a><br /> + <a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ; ?>"><?php echo _("Reset Album Art"); ; ?></a><br /> + <a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ; ?>"><?php echo _("Find Album Art"); ; ?></a><br /> + <?php if (($GLOBALS['user']->has_access('100')) || (!conf('use_auth'))) { ?> + <a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&album_id=<?php echo $album->id; ; ?>"><?php echo _("Update from tags"); ?></a><br /> <?php } ?> <?php if (batch_ok()) { ?> - <a href="<?php echo $web_path; ?>/batch.php?action=alb&id=<?php echo $album->id; ; ?>"><?php echo _("Download"); ?></a><br /> + <a href="<?php echo $web_path; ?>/batch.php?action=alb&id=<?php echo $album->id; ; ?>"><?php echo _('Download'); ?></a><br /> <?php } ?> </td> </tr> diff --git a/templates/show_albums.inc b/templates/show_albums.inc index e23f88e8..99aa8e48 100644 --- a/templates/show_albums.inc +++ b/templates/show_albums.inc @@ -57,8 +57,8 @@ foreach ($albums as $album) { <td><?php echo $album->songs; ?></td> <td><?php echo $album->year; ?></td> <td nowrap="nowrap"> <?php echo _("Play"); ?> : - <a href="<?php echo $web_path; ?>/song.php?action=m3u&album=<?php echo $album->id; ?>"><?php echo _("All"); ?></a> | - <a href="<?php echo $web_path; ?>/song.php?action=m3u&album_random=<?php echo $album->id; ?>"><?php echo _("Random"); ?></a> + <a href="<?php echo $web_path; ?>/song.php?action=album&album_id=<?php echo $album->id; ?>"><?php echo _("All"); ?></a> | + <a href="<?php echo $web_path; ?>/song.php?action=album_random&album_id=<?php echo $album->id; ?>"><?php echo _("Random"); ?></a> <?php if (batch_ok()) { ?> | <a href="<?php echo $web_path; ?>/batch.php?action=alb&id=<?php echo $album->id; ?>"><?php echo _("Download"); ?></a> <?php } ?> diff --git a/templates/show_artist_box.inc.php b/templates/show_artist_box.inc.php index fdbedc82..8ed59615 100644 --- a/templates/show_artist_box.inc.php +++ b/templates/show_artist_box.inc.php @@ -26,8 +26,8 @@ $web_path = conf('web_path'); <br /><?php if (conf('ratings')) { show_rating($artist->id, 'artist'); } // end if ratings ?> <ul class="text-action"> <li><a href="<?php echo $web_path; ?>/artists.php?action=show_all_songs&artist=<?php echo $artist_id; ?>"><?php echo _("Show All Songs By") . " " . $artist->full_name; ?></a></li> - <li><a href="<?php echo $web_path; ?>/song.php?action=m3u&artist=<?php echo $artist_id; ?>"><?php echo _("Play All Songs By") . " " . $artist->full_name; ?></a></li> - <li><a href="<?php echo $web_path; ?>/song.php?action=m3u&artist_random=<?php echo $artist_id; ?>"><?php echo _("Play Random Songs By") . " " . $artist->full_name; ?></a></li> + <li><a href="<?php echo $web_path; ?>/song.php?action=artist&artist_id=<?php echo $artist_id; ?>"><?php echo _("Play All Songs By") . " " . $artist->full_name; ?></a></li> + <li><a href="<?php echo $web_path; ?>/song.php?action=artist_random&artist_id=<?php echo $artist_id; ?>"><?php echo _("Play Random Songs By") . " " . $artist->full_name; ?></a></li> <?php if ($GLOBALS['user']->has_access('100')) { ?> <li><a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&artist=<?php echo $artist_id; ?>"><?php echo _("Update from tags"); ?></a></li> <li><a href="<?php echo $web_path; ?>/artists.php?action=show_rename&artist=<?php echo $artist_id; ?>"><?php echo _("Rename Artist"); ?></a></li> diff --git a/templates/show_artists.inc b/templates/show_artists.inc index 19c174d1..c0bd8510 100644 --- a/templates/show_artists.inc +++ b/templates/show_artists.inc @@ -25,6 +25,7 @@ */ $web_path = conf('web_path'); + // Build array of the table classes we are using $total_items = $view->total_items; ?> @@ -38,9 +39,9 @@ $total_items = $view->total_items; <td> <a href="<?php echo $web_path; ?>/<?php echo $_SESSION['view_script']; ?>?action=<?php echo $_REQUEST['action']; ?>&keep_view=true&sort_type=artist.name&sort_order=0"> <?php echo _("Artist"); ?> </a> </td> - <td> <?php echo _("Songs"); ?> </td> - <td> <?php echo _("Albums"); ?> </td> - <td> <?php echo _("Action"); ?> </td> + <td> <?php echo _('Songs'); ?> </td> + <td> <?php echo _('Albums'); ?> </td> + <td> <?php echo _('Action'); ?> </td> </tr> <?php /* Foreach through every artist that has been passed to us */ @@ -51,8 +52,8 @@ foreach ($artists as $artist) { ?> <td><?php echo $artist['songs']; ?></td> <td><?php echo $artist['albums']; ?></td> <td nowrap="nowrap"> <?php echo _("Play"); ?> : - <a href="<?php echo $web_path; ?>/song.php?action=m3u&artist=<?php echo $artist['id']; ?>"><?php echo _("All"); ?></a> | - <a href="<?php echo $web_path; ?>/song.php?action=m3u&artist_random=<?php echo $artist['id']; ?>"><?php echo _("Random"); ?></a> + <a href="<?php echo $web_path; ?>/song.php?action=artist&artist_id=<?php echo $artist['id']; ?>"><?php echo _("All"); ?></a> | + <a href="<?php echo $web_path; ?>/song.php?action=artist_random&artist_id=<?php echo $artist['id']; ?>"><?php echo _("Random"); ?></a> </td> </tr> <?php } //end foreach ($artists as $artist) ?> @@ -60,9 +61,9 @@ foreach ($artists as $artist) { ?> <td> <a href="<?php echo $web_path; ?>/<?php echo $_SESSION['view_script']; ?>?action=<?php echo $_REQUEST['action']; ?>&keep_view=true&sort_type=artist.name&sort_order=0"> <?php echo _("Artist"); ?> </a> </td> - <td><?php echo _("Songs"); ?></td> - <td><?php echo _("Albums"); ?></td> - <td><?php echo _("Action"); ?></td> + <td><?php echo _('Songs'); ?></td> + <td><?php echo _('Albums'); ?></td> + <td><?php echo _('Action'); ?></td> </tr> <tr class="even" align="center"> diff --git a/templates/show_flag.inc.php b/templates/show_flag.inc.php index 571d822d..1a0038c1 100644 --- a/templates/show_flag.inc.php +++ b/templates/show_flag.inc.php @@ -78,59 +78,3 @@ switch ($type) { </tr> </table> </form> -<?php -// NOT USED YET! -if ($type == 'pigsfly') { -//elseif ($type == 'show_flagged_songs') { - $flags = get_flagged(); - -?> -<p style="font-size: 10pt; font-weight: bold;">View Flagged Songs</p> -<p>This is the list of songs that have been flagged by your Ampache users. Use -this list to determine what songs you need to re-rip or tags you need to update.</p> -<?php -if ($flags) { ?> - <form name="flag_update" action="<?php echo $web_path; ?>/flag.php" method="post"> - <table class="tabledata" cellspacing="0" cellpadding="0" border="1"> - <tr class="table-header"> - <td> </td> - <td>Song</td> - <td>Flag</td> - <td>New Flag:</td> - <td>Flagged by</td> - <td>ID3 Update:</td> - </tr> - <?php - foreach ($flags as $flag) { - $song = new Song($flag->song); - $song->format_song(); - $alt_title = $song->title; - $artist = $song->f_artist; - $alt_artist = $song->f_full_artist; - - echo "<tr class=\"even\">". - "<td><input type=\"checkbox\" id=\"flag_".$flag->id."\" name=\"flag[]\" value=\"".$flag->id."\"></input></td>". - "<td><a href=\"".$web_path."/song.php?song=$flag->song\" title=\"$alt_title\">$song->f_title</a> by ". - "<a href=\"".$web_path."/artist.php?action=show&artist=$song->artist_id\" title=\"$alt_artist\">$artist</a></td>". - "<td>$flag->type</td><td>"; - $onchange = "onchange=\"document.getElementById('flag_".$flag->id."').checked='checked';\""; - show_flagged_popup($flag->type, 'type', $flag->id."_newflag", $onchange); - echo "</td><td>".$flag->username."<br />".date('m/d/y',$flag->date)."</td>"; - /*echo "<td><a href=\"catalog.php?action=fixed&flag=$flag->id\">Fixed</a></td></tr>\n";*/ - if ($flag->type === 'newid3') { - echo "<td><input type=\"radio\" name=\"accept_".$flag->id."\" value=\"accept\" />Accept"; - echo "<input type=\"radio\" name=\"accept_".$flag->id."\" value=\"reject\" />Reject</td></tr>"; - } else { - echo "<td><a href=\"".$web_path."/admin/song.php?action=edit&song=".$flag->song."\">edit/view</a></td>"; - echo "</tr>\n"; - } // end if ($flag->type === 'newid3') and else - } // end foreach ($flags as $flag) - ?> - <tr class="even"><td colspan="6"><input type="submit" name="action" value="Update Flags"></input></td></tr> - </table> - </form> -?php } else { ?> -<p> You don't have any flagged songs. </p> -<?php } // end if ($flags) and else -} // end elseif ($type == 'show_flagged_songs') -?> diff --git a/templates/show_random_play.inc b/templates/show_random_play.inc index 5388dd8f..5dfd321c 100644 --- a/templates/show_random_play.inc +++ b/templates/show_random_play.inc @@ -22,61 +22,69 @@ ?> -<form name="random" method="post" enctype="multipart/form-data" action="<?php echo conf('web_path'); ?>/song.php"> -<table class="border" border="0" cellpadding="3" cellspacing="1"><!-- Random Play Table --> -<tr class="table-header"> - <td colspan="4"><?php echo _("Play Random Selection"); ?></td> +<form id="random" method="post" enctype="multipart/form-data" action="<?php echo conf('web_path'); ?>/song.php"> +<div class="text-box"> +<span class="header2"><?php echo _('Play Random Selection'); ?></span> +<table> +<tr> + <td><?php echo _("Item count"); ?></td> + <td> + <select name="random"> + <option value="1">1</option> + <option value="5" selected="selected">5</option> + <option value="10">10</option> + <option value="20">20</option> + <option value="30">30</option> + <option value="50">50</option> + <option value="100">100</option> + <option value="500">500</option> + <option value="1000">1000</option> + <option value="-1"><?php echo _('All'); ?></option> + </select> + </td> + <td rowspan="4" valign="top"><?php echo _('From genre'); ?></td> + <td rowspan="4"> + <?php show_genre_pulldown('genre','','5'); ?> + </td> </tr> -<tr class="even"> -<td> - <table border="0"> - <tr class="even"> - <td><?php echo _("Item count"); ?></td> - <td> - <select name="random"> - <option value="1">1</option> - <option value="5">5</option> - <option value="10">10</option> - <option value="20">20</option> - <option value="30">30</option> - <option value="50">50</option> - <option value="100">100</option> - <option value="500">500</option> - <option value="1000">1000</option> - <option value="-1"><?php echo _("All"); ?></option> - </select> - </td> - <td rowspan="3" valign="top"><?php echo _("From genre"); ?></td> - <td rowspan="3"> - <?php show_genre_pulldown('genre','','5'); ?> - </td> - </tr> - <tr class="even"> - <td colspan="2"> - Type: - <select name="random_type"> - <option value="normal"><?php echo _("Standard"); ?></option> - <option value="unplayed"><?php echo _("Favor Unplayed"); ?></option> - <option value="full_album"><?php echo _("Full Albums"); ?></option> - <option value="full_artist"><?php echo _("Full Artist"); ?></option> - </select> - </td> - </tr> - <tr class="even"> - <td nowrap="nowrap"><?php echo _("from catalog"); ?></td> - <td> - <?php show_catalog_pulldown('catalog',''); ?> - </td> - </tr> - <tr> - <td colspan="4"> - <input type="hidden" name="aaction" value="Play!" /> - <input type="hidden" name="action" value="m3u" /> - <input class="button" type="submit" name="aaction" value="<?php echo _("Play Random Songs"); ?>" /> - </td> - </tr> - </table> -</td> +<tr> + <td colspan="2"> + <?php echo _('Type'); ?>: + <select name="random_type"> + <option value="normal"><?php echo _("Standard"); ?></option> + <option value="unplayed"><?php echo _("Favor Unplayed"); ?></option> + <option value="full_album"><?php echo _("Full Albums"); ?></option> + <option value="full_artist"><?php echo _("Full Artist"); ?></option> + </select> + </td> </tr> -</table><!-- End Random Play Table --> +<tr> + <td nowrap="nowrap"><?php echo _('From catalog'); ?></td> + <td> + <?php show_catalog_pulldown('catalog',''); ?> + </td> +</tr> +<tr> + <td><?php echo _('Size Limit'); ?></td> + <td> + <select name="size_limit"> + <option value="0"><?php echo _('Unlimited'); ?></option> + <option value="64">64MB</option> + <option value="128">128MB</option> + <option value="256">256MB</option> + <option value="512">512MB</option> + <option value="1024">1024MB</option> + </select> + </td> +<tr> + <td colspan="4"> + <input type="hidden" name="action" value="random" /> + <input class="button" type="button" value="<?php echo _('Play'); ?>" onclick="return SubmitToPage('random','<?php echo conf('web_path'); ?>/song.php?action=random&method=stream');" /> + <?php if (batch_ok()) { ?> + <input class="button" type="button" value="<?php echo _('Download'); ?>" onclick="return SubmitToPage('random','<?php echo conf('web_path'); ?>/song.php?action=random&method=download');" /> + <?php } ?> + </td> +</tr> +</table> +</div> </form> diff --git a/templates/show_random_play_bar.inc.php b/templates/show_random_play_bar.inc.php deleted file mode 100644 index ce9bfa62..00000000 --- a/templates/show_random_play_bar.inc.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/* - -Copyright (c) 2001 - 2005 Ampache.org -All rights reserved. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -/** - * random play bar - * this is the simple random play bar, it is short sweet and to the point - */ -?> -<form name="random" method="post" enctype="multipart/form-data" action="<?php echo conf('web_path'); ?>/song.php" style="Display:inline"> -<input type="hidden" name="action" value="m3u" /> -<table class="border" width="100%" cellspacing="1" cellpadding="3" border="0"> -<tr class="table-header"> - <td><?php echo _("Play Random Selection"); ?></td> -</tr> -<tr class="even"> - <td> - <select name="random"> - <option value="1">1</option> - <option value="5">5</option> - <option value="10">10</option> - <option value="20">20</option> - <option value="30">30</option> - <option value="50">50</option> - <option value="100">100</option> - <option value="500">500</option> - <option value="1000">1000</option> - <option value="-1"><?php echo _("All"); ?></option> - </select> - <?php show_genre_pulldown('genre'); ?> - <select name="Quantifier"> - <option value="Songs"><?php echo _("Songs"); ?></option> - <option value="Minutes"><?php echo _("Minutes"); ?></option> - <option value="Full Artists"><?php echo _("Full Artists"); ?></option> - <option value="Full Albums"><?php echo _("Full Albums"); ?></option> - <option value="Less Played"><?php echo _("Less Played"); ?></option> - </select> - <?php echo _("from"); ?> - <?php show_catalog_pulldown( -1, 0); ?> - <input type="hidden" name="aaction" value="Play!" /> - <input class="button" type="submit" name="aaction" value="<?php echo _("Enqueue"); ?>" /> - <a href="<?php echo conf('web_path'); ?>/randomplay.php"><?php echo _("Advanced"); ?></a> - </td> -</tr> -</table> -</form> - diff --git a/templates/sidebar.inc.php b/templates/sidebar.inc.php index f403e97b..e3117e4a 100644 --- a/templates/sidebar.inc.php +++ b/templates/sidebar.inc.php @@ -146,8 +146,7 @@ $web_path = conf('web_path'); </li> <?php if ($GLOBALS['theme']['orientation'] != 'horizontal') { ?> <li> - <form name="sub_random" method="post" enctype="multipart/form-data" action="<?php echo $web_path; ?>/song.php" style="Display:inline"> - <input type="hidden" name="action" value="m3u" /> + <form name="sub_random" method="post" enctype="multipart/form-data" action="<?php echo $web_path; ?>/song.php?action=random&method=stream" style="Display:inline"> <select name="random" style="width:9em;"> <option value="1">1</option> <option value="5" selected="selected">5</option> @@ -172,8 +171,7 @@ $web_path = conf('web_path'); <br /> <?php show_catalog_pulldown('catalog','width:9em;'); ?> <br /> - <input type="hidden" name="aaction" value="Play!" /> - <input class="smallbutton" type="submit" name="aaction" value="<?php echo _("Enqueue"); ?>" /> + <input class="smallbutton" type="submit" value="<?php echo _('Enqueue'); ?>" /> </form> </li> <?php } // end if ($GLOBALS['theme']['orientation'] != 'horizontal') ?> |