From 0635397ab2bd5afc6789cef56b9a9d87bd52bcfd Mon Sep 17 00:00:00 2001 From: pb1dft Date: Sat, 25 Nov 2006 22:58:24 +0000 Subject: Fixed some stuff on album art added ability to sort albums on name/year in artist.php --- albums.php | 2 +- artists.php | 32 +++++++++++++++++++++++++++++++- lib/class/artist.class.php | 8 ++++---- templates/show_album.inc | 2 +- templates/show_albums.inc | 2 +- templates/show_artist.inc | 4 ++-- templates/show_get_albumart.inc.php | 2 +- templates/show_songs.inc | 12 ++++++------ 8 files changed, 47 insertions(+), 17 deletions(-) diff --git a/albums.php b/albums.php index 553330ba..e679eafb 100644 --- a/albums.php +++ b/albums.php @@ -91,7 +91,7 @@ elseif ($_REQUEST['action'] === 'find_art') { $search = $artist . " " . $album_name; //Find out if the cover url is a local filename or an url - if (empty($_FILES['file'])){ + if (empty($_FILES['file']['tmp_name'])){ $coverurl = $_REQUEST['cover']; // Attempt to find the art with what we've got diff --git a/artists.php b/artists.php index 8e8a8612..b84e1ed1 100644 --- a/artists.php +++ b/artists.php @@ -41,8 +41,38 @@ switch($action) { show_box_top(); show_alphabet_list('artists','artists.php'); show_box_bottom(); + + // Setup the View Ojbect + $view = new View(); + $view->import_session_view(); + + $artist = new Artist($_REQUEST['artist']); - $artist->show_albums(); + + $sql = "SELECT DISTINCT(album.id) FROM song,album WHERE song.album=album.id AND song.artist='$artist->id'"; + + if ($_REQUEST['keep_view']) { + $view->initialize(); + } + + // If we aren't keeping the view then initlize it + elseif ($sql) { + if (!$sort_order) { $sort_order = 'album.name'; } + $db_results = mysql_query($sql, dbh()); + $total_items = mysql_num_rows($db_results); + if ($match != "Show_all") { $offset_limit = $_SESSION['userdata']['offset_limit']; } + $view = new View($sql, 'artists.php',$sort_order,$total_items,$offset_limit); + } + + else { $view = false; } + + if ($view->base_sql) { + $artist->show_albums($view->sql); + } + + + + //$artist->show_albums(); break; case 'show_all_songs': diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index 10843086..b43d9c90 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -78,11 +78,11 @@ class Artist { @function get_albums @discussion gets the albums for this artist */ - function get_albums() { + function get_albums($sql) { $results = array(); - $sql = "SELECT DISTINCT(album.id) FROM song,album WHERE song.album=album.id AND song.artist='$this->id' ORDER BY album.name"; +// $sql = "SELECT DISTINCT(album.id) FROM song,album WHERE song.album=album.id AND song.artist='$this->id' ORDER BY album.name"; $db_results = mysql_query($sql, dbh()); while ($r = mysql_fetch_object($db_results)) { @@ -279,12 +279,12 @@ class Artist { @function show_albums @discussion displays the show albums by artist page */ - function show_albums() { + function show_albums($sql = 0) { /* Set Vars */ $web_path = conf('web_path'); - $albums = $this->get_albums(); + $albums = $this->get_albums($sql); $this->format_artist(); $artist = $this; diff --git a/templates/show_album.inc b/templates/show_album.inc index 69814d02..2768cc3b 100644 --- a/templates/show_album.inc +++ b/templates/show_album.inc @@ -63,7 +63,7 @@ $title = scrub_out($album->name) . ' -- ' . $album->f_artist;   
-   
+    
diff --git a/templates/show_albums.inc b/templates/show_albums.inc index 4fdfc2d2..e9fb597d 100644 --- a/templates/show_albums.inc +++ b/templates/show_albums.inc @@ -61,7 +61,7 @@ foreach ($albums as $album) { | - | + | <?php echo _('Download'); ?> diff --git a/templates/show_artist.inc b/templates/show_artist.inc index 748f5b75..1521f728 100644 --- a/templates/show_artist.inc +++ b/templates/show_artist.inc @@ -34,8 +34,8 @@ $web_path = conf('web_path');    - - + + diff --git a/templates/show_get_albumart.inc.php b/templates/show_get_albumart.inc.php index 246e2254..3375ae18 100644 --- a/templates/show_get_albumart.inc.php +++ b/templates/show_get_albumart.inc.php @@ -21,7 +21,7 @@ */ ?> -
+ diff --git a/templates/show_songs.inc b/templates/show_songs.inc index 396f9848..300749ef 100644 --- a/templates/show_songs.inc +++ b/templates/show_songs.inc @@ -130,20 +130,20 @@ foreach ($song_ids as $song_id) { -- cgit
- + <?php echo _('Flag'); ?> has_access('100')) { ?> - | | + | <?php echo _('Edit'); ?> | enabled) { ?> - + <?php echo _('Disable'); ?> - + <?php echo _('Enable'); ?> prefs['download']) { ?> - | title . "." . $song->type); ?>"> + | title . "." . $song->type); ?>"><?php echo _('Download'); ?> prefs['direct_link']) { ?> - | + | <?php echo _('Direct Link'); ?>