From 748e50ade1b0c7034eddaadbe2285e5bf3a20fc6 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 31 Dec 2007 03:20:29 +0000 Subject: added ability to do add new on other elements of song edit (Thx picasso) added export catalog to csv --- lib/ui.lib.php | 51 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'lib/ui.lib.php') diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 691e8f7d..b27124fc 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -614,18 +614,13 @@ function show_playlist_import() { * by the Edit page, it takes a $name and a $album_id */ function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0) { - // Probably superfluous code to ensure we never generate two album_select - // elements with the same ID on the same page. - static $id_inc; - static $keys; - if (!isset($keys)) $keys = array(); - if (!isset($id_inc)) $id_inc = 1; - else $id_inc++; - $key = "album_select_$song_id"; - if (!empty($keys[$key])) $key = "album_select_$name"; - if (!empty($keys[$key])) $key = "album_select_x$id_inc"; - if (!empty($keys[$key])) $key = "album_select_{$name}_x{$id_inc}"; - $keys[$key] = true; + // Generate key to use for HTML element ID + static $id_cnt; + if ($song_id) { + $key = "album_select_$song_id"; + } else { + $key = "album_select_c" . ++$id_cnt; + } // Added ID field so we can easily observe this element echo "\n"; + echo "\n"; } // show_artist_select @@ -684,13 +691,20 @@ function show_artist_select($name='artist', $artist_id=0) { * It's amazing we have three of these funtions now, this one shows a select of genres and take s name * and a selected genre... Woot! */ -function show_genre_select($name='genre',$genre_id=0,$size='') { +function show_genre_select($name='genre',$genre_id=1,$size='', $allow_add=0, $song_id=0) { + // Generate key to use for HTML element ID + static $id_cnt; + if ($song_id) { + $key = "genre_select_$song_id"; + } else { + $key = "genre_select_c" . ++$id_cnt; + } if ($size > 0) { $multiple_txt = " multiple=\"multiple\" size=\"$size\""; } - echo "\n"; $sql = "SELECT `id`, `name` FROM `genre` ORDER BY `name`"; $db_results = Dba::query($sql); @@ -706,6 +720,11 @@ function show_genre_select($name='genre',$genre_id=0,$size='') { } // end while + if ($allow_add) { + // Append additional option to the end with value=-1 + echo "\t\n"; + } + echo "\n"; } // show_genre_select -- cgit