summaryrefslogtreecommitdiffstats
path: root/lib/ui.lib.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-31 03:20:29 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-31 03:20:29 +0000
commit748e50ade1b0c7034eddaadbe2285e5bf3a20fc6 (patch)
tree759b02a66ea840abc91419c9d7d00a08b2fceb8c /lib/ui.lib.php
parent4e716204e84fc7546372bdae79121e47b92412bc (diff)
downloadampache-748e50ade1b0c7034eddaadbe2285e5bf3a20fc6.tar.gz
ampache-748e50ade1b0c7034eddaadbe2285e5bf3a20fc6.tar.bz2
ampache-748e50ade1b0c7034eddaadbe2285e5bf3a20fc6.zip
added ability to do add new on other elements of song edit (Thx picasso) added export catalog to csv
Diffstat (limited to 'lib/ui.lib.php')
-rw-r--r--lib/ui.lib.php51
1 files changed, 35 insertions, 16 deletions
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 "<select name=\"$name\" id=\"$key\">\n";
@@ -657,9 +652,16 @@ function show_album_select($name='album',$album_id=0,$allow_add=0,$song_id=0) {
* show_artist_select
* This is the same as the album select except it's *gasp* for artists how inventive!
*/
-function show_artist_select($name='artist', $artist_id=0) {
+function show_artist_select($name='artist', $artist_id=0, $allow_add=0, $song_id=0) {
+ // Generate key to use for HTML element ID
+ static $id_cnt;
+ if ($song_id) {
+ $key = "artist_select_$song_id";
+ } else {
+ $key = "artist_select_c" . ++$id_cnt;
+ }
- echo "<select name=\"$name\">\n";
+ echo "<select name=\"$name\" id=\"$key\">\n";
$sql = "SELECT `id`, `name`, `prefix` FROM `artist` ORDER BY `name`";
$db_results = Dba::query($sql);
@@ -675,6 +677,11 @@ function show_artist_select($name='artist', $artist_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_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 "<select name=\"$name\"$multiple_txt>\n";
+ echo "<select name=\"$name\"$multiple_txt id=\"$key\">\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<option value=\"-1\">Add New...</option>\n";
+ }
+
echo "</select>\n";
} // show_genre_select