#mp3/www/admin/playlist-item-add-2.tcl ad_page_contract { Adds an item (e.g. an mp3) to a playlist @author Elizabeth Wirth (wirth@ybos.net) @creation-date 2001-03-05 } { mp3_id:naturalnum,notnull playlist_id:naturalnum,notnull insert_after_id:integer,notnull } #requires admin permission as under /admin #Always insert after another item, and pass the sort_key of that item in #as insert_after_sort_key. #If there are no items (insert_after_id was passed as -1), pass 0 in as sort_key. if {$insert_after_id != -1 } { set insert_after_sort_key [db_string sort_key "select sort_key from mp3_mp3_playlist_map where mp3_id=:insert_after_id and playlist_id=:playlist_id"] } else { set insert_after_sort_key 0 } if [catch { db_exec_plsql add_item " begin mp3_playlist.item_add ( mp3_id => :mp3_id, playlist_id => :playlist_id, sort_key => :insert_after_sort_key ); end; " } errmsg ] { set complaint " The database did not accept your input. See details for the error message below\n\n\t
$errmsg" ad_return_error "Database Error" "$complaint" ad_script_abort } else { ad_returnredirect one-playlist?playlist_id=$playlist_id }