summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--albums.php9
-rwxr-xr-xdocs/CHANGELOG4
-rw-r--r--index.php35
-rw-r--r--lib/class/view.class.php11
-rw-r--r--lib/song.php26
-rw-r--r--templates/show_album.inc7
-rw-r--r--templates/show_albums.inc2
-rw-r--r--templates/show_recently_played.inc.php46
-rw-r--r--templates/show_songs.inc24
9 files changed, 118 insertions, 46 deletions
diff --git a/albums.php b/albums.php
index e679eafb..d7e21e5f 100644
--- a/albums.php
+++ b/albums.php
@@ -132,7 +132,7 @@ elseif ($_REQUEST['action'] === 'find_art') {
fclose($handle);
if (!empty($art)){
$album->insert_art($art,$mime);
- show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id");
+ show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id");
}
else {
show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write acces error, or the file is not received corectly.'),"/albums.php?action=show&album=" . $album->id);
@@ -160,7 +160,7 @@ elseif ($_REQUEST['action'] === 'select_art') {
$album = new Album($album_id);
$album->insert_art($image_data,$mime);
- show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id");
+ show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id");
} // end select art
@@ -232,8 +232,7 @@ else {
if ($match != 'Browse' && $match != 'Show_missing_art' && $match != 'Show_all') {
$match_string = " AND album.name LIKE '$match%'";
}
-// unset($_REQUEST['keep_view']);
- $sql = "SELECT album.id, IF(COUNT(DISTINCT(song.artist)) > 1,'Various', artist.name) AS artist_name " .
+ $sort_sql = "SELECT album.id, IF(COUNT(DISTINCT(song.artist)) > 1,'Various', artist.name) AS artist_name " .
"FROM song,artist,album WHERE song.album=album.id AND song.artist=artist.id $match_string" .
"GROUP BY album.name,album.year ".
"HAVING COUNT(song.id) > $min_album_size ";
@@ -246,7 +245,7 @@ else {
// if we are returning
if ($_REQUEST['keep_view']) {
- $view->initialize();
+ $view->initialize($sort_sql);
}
// If we aren't keeping the view then initlize it
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index b220d77d..e8561612 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,10 @@
--------------------------------------------------------------------------
v.3.3.3-Beta1
+ - Tweaked home page a little, remove pop songs and recent artists
+ - Added Recently Played to Main Page
+ - Fixed an issue on Browse by Albums and sorting by Artist after
+ sorting by something else
- Added initial Tag writting script (Thx Jirwin)
- Updated flag class to make it easier to create a tag writer
- Fixed some potential issues with sort_files.php.inc
diff --git a/index.php b/index.php
index 0b06892d..5db87f4c 100644
--- a/index.php
+++ b/index.php
@@ -46,13 +46,16 @@ if (conf('refresh_limit') > 5) {
<div id="np_data">
<?php show_now_playing(); ?>
</div> <!-- Close Now Playing Div -->
-
+<!-- Recently Played -->
+<div id="recently_played">
+ <?php
+ $data = get_recently_played();
+ if (count($data)) { require_once(conf('prefix') . '/templates/show_recently_played.inc.php'); }
+ ?>
+</div>
<!-- Big Daddy Table -->
<?php show_box_top(); ?>
-<table id="bigdaddy">
-<tr>
- <td valign="top">
- <table border="0"><!-- Left table -->
+<table id="biddaddy"><!-- The Table -->
<tr>
<td valign="top">
<?php show_local_catalog_info(); ?>
@@ -65,8 +68,6 @@ if (conf('refresh_limit') > 5) {
?>
</td>
</tr>
- <tr><td colspan="2">&nbsp;</td></tr>
- <tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td valign="top">
<?php
@@ -77,23 +78,6 @@ if (conf('refresh_limit') > 5) {
</td>
<td valign="top">
<?php
- if ($items = get_global_popular('song')) {
- show_info_box(_('Most Popular Songs'), 'song', $items);
- }
- ?>
- </td>
- </tr>
- <tr><td colspan="2">&nbsp;</td></tr>
- <tr>
- <td valign="top">
- <?php
- if ($items = get_newest('artist')) {
- show_info_box(_('Newest Artist Additions'), '', $items);
- }
- ?>
- </td>
- <td valign="top">
- <?php
if ($items = get_newest('album')) {
show_info_box(_('Newest Album Additions'), '', $items);
}
@@ -101,9 +85,6 @@ if (conf('refresh_limit') > 5) {
</td>
</tr>
</table><!-- End Left table -->
- </td>
-</tr>
-</table>
<?php show_box_bottom(); ?>
<!-- End Big Daddy Table -->
<?php show_footer(); ?>
diff --git a/lib/class/view.class.php b/lib/class/view.class.php
index afc81b22..4f58677a 100644
--- a/lib/class/view.class.php
+++ b/lib/class/view.class.php
@@ -167,8 +167,15 @@ class View {
@discussion initializes the view object, checks $_REQUEST
for changes to the view object
*/
- function initialize() {
-
+ function initialize($sql='') {
+
+ /* From time to time we need to change the SQL statement while
+ * maintaining the paging
+ */
+ if ($sql) {
+ $this->change_sql($sql);
+ }
+
if ($_REQUEST['sort_type']) {
$this->change_sort_type($_REQUEST['sort_type']);
}
diff --git a/lib/song.php b/lib/song.php
index 5156ca88..b1d3579d 100644
--- a/lib/song.php
+++ b/lib/song.php
@@ -42,7 +42,31 @@ function get_songs($sql, $action=0) {
return $results;
-} // get_albums
+} // get_songs
+
+/**
+ * get_recently_played
+ * This function returns the last X songs that have been played
+ * It uses the 'popular' threshold to determine how many to pull
+ */
+function get_recently_played() {
+
+ $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " .
+ "FROM object_count " .
+ "WHERE object_type='song' " .
+ "ORDER by object_count.date DESC " .
+ "LIMIT " . conf('popular_threshold');
+ $db_results = mysql_query($sql, dbh());
+
+ $results = array();
+
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $results[] = $r;
+ }
+
+ return $results;
+
+} // get_recently_played
/*!
@function format_song
diff --git a/templates/show_album.inc b/templates/show_album.inc
index 2768cc3b..d1251407 100644
--- a/templates/show_album.inc
+++ b/templates/show_album.inc
@@ -5,9 +5,8 @@
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.
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -63,7 +62,7 @@ $title = scrub_out($album->name) . ' -- ' . $album->f_artist;
&nbsp;&nbsp;<a href="<?php echo $web_path; ?>/albums.php?action=update_from_tags&amp;album_id=<?php echo $album->id; ; ?>"><?php echo _("Update from tags"); ?></a><br />
<?php } ?>
<?php if (batch_ok()) { ?>
- &nbsp;&nbsp;<a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ; ?>"><img src="<?php echo $web_path; ?>/images/icon_download.gif" border="0" />&nbsp;<?php echo _('Download'); ?></a><br />
+ &nbsp;&nbsp;<a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ; ?>"><?php echo _('Download'); ?></a><br />
<?php } ?>
</div>
<?php require (conf('prefix') . '/templates/show_box_bottom.inc.php'); ?>
diff --git a/templates/show_albums.inc b/templates/show_albums.inc
index e9fb597d..e76d2b1a 100644
--- a/templates/show_albums.inc
+++ b/templates/show_albums.inc
@@ -61,7 +61,7 @@ foreach ($albums as $album) {
<a href="<?php echo $web_path; ?>/song.php?action=album&amp;album_id=<?php echo $album->id; ?>"><?php echo _("All"); ?></a> |
<a href="<?php echo $web_path; ?>/song.php?action=album_random&amp;album_id=<?php echo $album->id; ?>"><?php echo _("Random"); ?></a>
<?php if (batch_ok()) { ?>
- | <a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ?>"><img src="<?php echo $web_path; ?>/images/icon_download.gif" border="0" alt="<?php echo _('Download'); ?>" /></a>
+ | <a href="<?php echo $web_path; ?>/batch.php?action=alb&amp;id=<?php echo $album->id; ?>"><?php echo _('Download'); ?></a>
<?php } ?>
</td>
</tr>
diff --git a/templates/show_recently_played.inc.php b/templates/show_recently_played.inc.php
new file mode 100644
index 00000000..eeae6186
--- /dev/null
+++ b/templates/show_recently_played.inc.php
@@ -0,0 +1,46 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2006 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 v2
+ as published by the Free Software Foundation.
+
+ 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.
+
+*/
+?>
+<?php show_box_top(_('Recently Played')); ?>
+<table>
+<tr class="table-header">
+ <td><?php echo _('Username'); ?></td>
+ <td><?php echo _('Song'); ?></td>
+ <td><?php echo _('Date'); ?></td>
+</tr>
+<?php foreach ($data as $row) {
+ $row_user = new User($row['user']);
+ $song = new Song($row['object_id']);
+ $song->format_song();
+ /* Prepare the variables */
+ $title = scrub_out(truncate_with_ellipse($song->title,'25'));
+ $album = scrub_out(truncate_with_ellipse($song->f_album_full,'25'));
+ $artist = scrub_out(truncate_with_ellipse($song->f_artist_full,'25'));
+ $song_name = $title . ' - ' . $album . '/' . $artist;
+?>
+<tr>
+ <td><?php echo scrub_out($row_user->fullname); ?></td>
+ <td><?php echo $song_name; ?></td>
+ <td><?php echo date("d/m/Y H:i:s",$row['date']); ?></td>
+</tr>
+<?php } ?>
+</table>
+<?php show_box_bottom(); ?>
diff --git a/templates/show_songs.inc b/templates/show_songs.inc
index 300749ef..0aca4c17 100644
--- a/templates/show_songs.inc
+++ b/templates/show_songs.inc
@@ -130,20 +130,32 @@ foreach ($song_ids as $song_id) {
</a>
</td>
<td>
- <a href="<?php echo $web_path; ?>/flag.php?action=show_flag&amp;type=song&amp;id=<?php echo $song->id; ?>"><img src="<?php echo $web_path; ?>/images/icon_flag.gif" "border="0" alt="<?php echo _('Flag'); ?>" title="<?php echo _('Flag'); ?>"/></a>
+ <a href="<?php echo $web_path; ?>/flag.php?action=show_flag&amp;type=song&amp;id=<?php echo $song->id; ?>">
+ <?php echo get_user_icon('flag'); ?>
+ </a>
<?php if ($GLOBALS['user']->has_access('100')) { ?>
- | <a href="<?php echo $web_path; ?>/admin/flag.php?action=show_edit_song&amp;song=<?php echo $song->id; ?>"><img src="<?php echo $web_path; ?>/images/icon_edit.gif" "border="0" alt="<?php echo _('Edit'); ?>" title="<?php echo _('Edit'); ?> "/></a> |
+ | <a href="<?php echo $web_path; ?>/admin/flag.php?action=show_edit_song&amp;song=<?php echo $song->id; ?>">
+ <?php echo get_user_icon('edit'); ?>
+ </a> |
<?php if ($song->enabled) { ?>
- <a href="<?php echo $web_path; ?>/admin/flag.php?action=disable&amp;song_ids=<?php echo $song->id; ?>"><img src="<?php echo $web_path; ?>/images/icon_disable.gif" "border="0" alt="<?php echo _('Disable'); ?>" title="<?php echo _('Disable'); ?>" /></a>
+ <a href="<?php echo $web_path; ?>/admin/flag.php?action=disable&amp;song_ids=<?php echo $song->id; ?>">
+ <?php echo get_user_icon('disable'); ?>
+ </a>
<?php } else { ?>
- <a href="<?php echo $web_path; ?>/admin/flag.php?action=enabled&amp;song_ids=<?php echo $song->id; ?>"><img src="<?php echo $web_path; ?>/images/icon_enable.gif" "border="0" alt="<?php echo _('Enable'); ?>" title="<?php echo _('Enable'); ?>" /></a>
+ <a href="<?php echo $web_path; ?>/admin/flag.php?action=enabled&amp;song_ids=<?php echo $song->id; ?>">
+ <?php echo get_user_icon('enable'); ?>
+ </a>
<?php } //status ?>
<?php } //access ?>
<?php if ($GLOBALS['user']->prefs['download']) { ?>
- | <a href="<?php echo $web_path; ?>/download/index.php?action=download&amp;song_id=<?php echo $song->id; ?>&amp;sid=<?php echo scrub_out(session_id()); ?>&amp;fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>"><img src="<?php echo $web_path; ?>/images/icon_download.gif" "border="0" alt="<?php echo _('Download'); ?>" title="<?php echo _('Download'); ?>" /></a>
+ | <a href="<?php echo $web_path; ?>/download/index.php?action=download&amp;song_id=<?php echo $song->id; ?>&amp;sid=<?php echo scrub_out(session_id()); ?>&amp;fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>">
+ <?php echo get_user_icon('download'); ?>
+ </a>
<?php } ?>
<?php if ($GLOBALS['user']->prefs['direct_link']) { ?>
- | <a href="<?php echo scrub_out($song->get_url()); ?>"><img src="<?php echo $web_path; ?>/images/icon_link.gif" "border="0" alt="<?php echo _('Direct Link'); ?>" title="<?php echo _('Direct Link'); ?>" /></a>
+ | <a href="<?php echo scrub_out($song->get_url()); ?>">
+ <?php echo get_user_icon('link'); ?>
+ </a>
<?php } ?>
</td>
<?php if(conf('ratings')) { ?>