diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-25 07:47:52 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-12-25 07:47:52 +0000 |
commit | d6003655a9b266eeb20c15d53d77da873e9a6642 (patch) | |
tree | 60849827334171ebf4d50601416e91c3dd2e9f7b /lib/ui.lib.php | |
parent | 15f3664049d962820140bdf359a52dae5d143a0c (diff) | |
download | ampache-d6003655a9b266eeb20c15d53d77da873e9a6642.tar.gz ampache-d6003655a9b266eeb20c15d53d77da873e9a6642.tar.bz2 ampache-d6003655a9b266eeb20c15d53d77da873e9a6642.zip |
added new album option on song edit (Thx Picasso)
Diffstat (limited to 'lib/ui.lib.php')
-rw-r--r-- | lib/ui.lib.php | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/ui.lib.php b/lib/ui.lib.php index e932aaae..aa28af36 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -613,9 +613,22 @@ function show_playlist_import() { * This displays a select of every album that we've got in Ampache, (it can be hella long) it's used * by the Edit page, it takes a $name and a $album_id */ -function show_album_select($name='album',$album_id=0) { - - echo "<select name=\"$name\">\n"; +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; + + // Added ID field so we can easily observe this element + echo "<select name=\"$name\" id=\"$key\">\n"; $sql = "SELECT `id`, `name`, `prefix` FROM `album` ORDER BY `name`"; $db_results = Dba::query($sql); @@ -631,6 +644,11 @@ function show_album_select($name='album',$album_id=0) { } // end while + if ($allow_add) { + // Append additional option to the end with value=-1 + echo "\t<option value=\"-1\">Add New...</option>\n"; + } + echo "</select>\n"; } // show_album_select |