Beispiel #1
0
function sidebar()
{
    foreach (Playlists::get_all(false) as $playlist) {
        foreach ($playlist->get_tracks() as $track) {
            $tracks++;
            $total_length += $track->get_length();
        }
    }
    $return .= "\r\n\t<h4>Playlists</h4>\r\n\t<dl>\r\n\t\t<dt>Playlisted Tracks:</dt>\r\n\t\t<dd>" . $tracks . "</dd>\r\n\t\t<dt>Length of Playlists:</dt>\r\n\t\t<dd>" . Time::format_succinct($total_length) . "</dd>\r\n\t</dl>\r\n\t<h4>Sustainer Service</h4>\r\n\t<dl>\r\n\t\t<dt>Tracks on Sustainer</dt>\r\n\t\t<dd>" . Sustainer::get_total_tracks() . "</dd>\r\n\t\t<dt>Length of Sustainer Playlist</dt>\r\n\t\t<dd>" . Sustainer::get_total_length_formatted() . "</dd>\r\n\t</dl>";
    return $return;
}
Beispiel #2
0
    $pages->items_per_page = $limit;
    $pages->querystring = $query;
    $pages->index = implode(",", $index);
    $pages->mid_range = 5;
    $pages->items_total = $search["total"];
    $pages->paginate();
    $low = ($page - 1) * $limit + 1;
    $high = $low + $limit - 1 > $search["total"] ? $search["total"] : $low + $limit - 1;
    echo "<script>\r\n\t\t\$(function () {\r\n\t\t\t\$('.track-info').popover({\r\n\t\t\t\t'html': true, \r\n\t\t\t\t'trigger': 'hover',\r\n\t\t\t\t'title': function() { \r\n\t\t\t\t\treturn(\$(this).parent().parent().find('.title').html())\r\n\t\t\t\t},\r\n\t\t\t\t'content': function() {\r\n\t\t\t\t\treturn(\$(this).parent().find('.hover-info').html());\r\n\t\t\t\t}\r\n\t\t\t});\r\n" . (Session::is_group_user("Playlist Admin") ? "\r\n\t\tvar item;\r\n\t\t\$('.playlist-add').click(function() {\r\n\t\t\titem = \$(this).parent().parent();\r\n\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\r\n\t\t\t\$('.playlist-select').parent().removeClass('active');\r\n\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\r\n\t\t\t\$('.playlist-select').each(function() {\r\n\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\r\n\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\r\n\t\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\t\$('.playlist-select').click(function() {\r\n\t\t\tobj = \$(this);\r\n\t\t\tif(\$(this).parent().hasClass('active')) {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\tobj.parent().removeClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\r\n\t\t\t\t\$.ajax({\r\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\r\n\t\t\t\t\tdata: 'trackid='+item.attr('id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\r\n\t\t\t\t\ttype: 'POST',\r\n\t\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\r\n\t\t\t\t\t\talert(value.error);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\r\n\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\r\n\t\t\t\t\t\tobj.parent().addClass('active');\r\n\t\t\t\t\t\titem.find('.playlist-add').attr('data-playlists-in',values.playlists.join(','));\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\t\$(this).parent().addClass('active');\r\n\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\r\n\t\t\t}\r\n\t\t});\t\t\r\n" : "") . (Session::is_group_user("Music Admin") ? "\r\n\t\tvar trackid;\r\n\t\t\$('.track-delete').click(function() {\r\n\t\t\t\$('.delete-track-title').html(\$(this).parent().parent().find('.title').html());\r\n\t\t\ttrackid = \$(this).attr('data-dps-id');\r\n\t\t});\r\n\r\n\t\t\$('.yes-definitely-delete').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/delete-track.php',\r\n\t\t\t\tdata: 'id='+trackid,\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n" : "") . "\t\t});\r\n\t</script>";
    $indexes = implode(", ", $index);
    echo "<h3>" . $search["total"] . " results for " . $query . "<small> searching in " . $indexes . "</small></h3>";
    echo "<div class=\"row\"><div class=\"col-lg-5\"><h5>Showing results " . $low . " to " . $high . "</h5></div><div class=\"pull-right\">" . $pages->display_jump_menu() . $pages->display_items_per_page() . "</div></div>";
    echo "<table class=\"table table-striped\" cellspacing=\"0\">\r\n\t<thead>\r\n\t\t<tr>\r\n\t\t\t<th class=\"icon\"> </th>\r\n\t\t\t<th class=\"artist\">Artist</th>\r\n\t\t\t<th class=\"title\">Title</th>\r\n\t\t\t<th class=\"album\">Album</th>\r\n\t\t\t<th class=\"length nowrap\">Length</th> \r\n\t\t\t" . (Session::is_group_user("Playlist Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t\t" . (Session::is_group_user("Music Admin") ? "<th class=\"icon\"></th>" : "") . "\r\n\t\t</tr>\r\n\t</thead>";
    foreach ($tracks as $track_id) {
        $track = Tracks::get($track_id);
        echo "\r\n\t\t<tr id=\"" . $track->get_id() . "\">\r\n\t\t\t<td class=\"icon\">\r\n\t\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $track->get_id() . "\" class=\"track-info\">\r\n\t\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\r\n\t\t\t\t</a>\r\n\t\t\t\t<div class=\"hover-info\">\r\n\t\t\t\t\t<strong>Artist:</strong> " . $track->get_artists_str() . "<br />\r\n\t\t\t\t\t<strong>Album:</strong> " . $track->get_album()->get_name() . "<br />\r\n\t\t\t\t\t<strong>Year:</strong> " . $track->get_year() . "<br />\r\n\t\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($track->get_length()) . "<br />\r\n\t\t\t\t\t<strong>Origin:</strong> " . $track->get_origin() . "<br />\r\n\t\t\t\t\t" . ($track->get_reclibid() ? "<strong>Reclib ID:</strong> " . $track->get_reclibid() . "<br />" : "") . "\r\n\t\t\t\t\t<strong>Censored:</strong> " . ($track->is_censored() ? "Yes" : "No") . "<br /> \r\n\t\t\t\t</div>\r\n\t\t\t</td>\r\n\t\t\t<td class=\"artist\">" . $track->get_artists_str() . "</td>\r\n\t\t\t<td class=\"title\">" . $track->get_title() . "</td>\r\n\t\t\t<td class=\"album\">" . $track->get_album()->get_name() . "</td>\r\n\t\t\t<td class=\"length nowrap\">" . Time::format_succinct($track->get_length()) . "</td>";
        if (Session::is_group_user("Playlist Admin")) {
            $playlists = array();
            foreach ($track->get_playlists_in() as $playlist) {
                $playlists[] = $playlist->get_id();
            }
            echo "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#playlist-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" data-playlists-in=\"" . implode(",", $playlists) . "\" class=\"playlist-add\" title=\"Add to playlist\" rel=\"twipsy\">" . Bootstrap::glyphicon("plus-sign") . "</a></td>";
        }
        echo (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"#\" data-toggle=\"modal\" data-target=\"#delete-modal\" data-backdrop=\"true\" data-keyboard=\"true\" data-dps-id=\"" . $track->get_id() . "\" class=\"track-delete\" title=\"Delete this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</a></td>" : "") . "\r\n\t\t</tr>";
    }
    echo "</table>";
    echo $pages->return;
} else {
    if ($query) {
        echo "<h3>Sorry, no results for " . $query . "</h3>";
        echo "<h4>Try a more generic search term.</h4>";
Beispiel #3
0
                 case "Advert":
                     $type = "bullhorn";
                     break;
                 case 0:
                     $type = "music";
                     break;
             }
             if ($location->get_config("current_showitems_id")->get_val() == $item->get_id()) {
                 if ($location->get_config("next_on_showplan")->get_val() == $audio->get_md5()) {
                     $current = true;
                 }
             }
             $return .= "<div class=\"showplan-audio panel " . ($current ? "panel-primary" : "panel-default") . "\" data-item-id=\"" . $item->get_id() . "\">\r\n\t\t\t\t\t<div class=\"panel-heading\" data-toggle=\"collapse\">\r\n\t\t\t\t\t\t<h4 class=\"panel-title\">\r\n\t\t\t\t\t\t\t<div class=\"pull-right\">\r\n\t\t\t\t\t\t\t\t<div class=\"controls\">" . Bootstrap::glyphicon("remove") . "</div>\r\n\t\t\t\t\t\t\t\t<div class=\"duration\">" . Time::format_succinct($audio->get_length()) . "</div></div>\r\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon($type) . ($audio->get_artists() ? $audio->get_artists_str() . " - " : "") . $audio->get_title() . "\r\n\t\t\t\t\t\t</h4>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>";
         }
         if ($script = $item->get_script()) {
             $return .= "<div class=\"showplan-script panel panel-default\" data-item-id=\"" . $item->get_id() . "\">\r\n\t\t\t\t\t<div class=\"panel-heading\" data-toggle=\"collapse\" href=\"#item-" . $item->get_id() . "-toggle\">\r\n\t\t\t\t\t\t<h4 class=\"panel-title\">\r\n\t\t\t\t\t\t\t<div class=\"pull-right\">\r\n\t\t\t\t\t\t\t\t<div class=\"controls\">" . Bootstrap::glyphicon("remove") . "</div>\r\n\t\t\t\t\t\t\t\t<div class=\"duration\">" . ($script->get_length() > 0 ? Time::format_succinct($script->get_length()) : "") . "</div>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t" . Bootstrap::glyphicon("file") . $script->get_name() . "\r\n\t\t\t\t\t\t</h4>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div id=\"item-" . $item->get_id() . "-toggle\" class=\"panel-collapse collapse\">\r\n\t\t\t\t\t\t<div class=\"panel-body\">\r\n\t\t\t\t\t\t\t" . $script->get_contents() . "\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>";
         }
     }
     $return .= "</div>";
     echo $return;
     break;
 case "showplan-append":
     $showplan = Showplans::get_by_id($location->get_config("default_showplan")->get_val());
     $item = new ShowplanItem();
     $audio = Audio::get_by_id($_REQUEST["id"]);
     if (!$audio) {
         exit(json_encode(array("response" => "invalid")));
     }
     $item->set_title($audio->get_title());
     $item->set_audio($audio);
     $item->set_position($showplan->get_end_position());
Beispiel #4
0
echo "<strong>To flag a track for censorship, search for it in the music library, click the " . Bootstrap::glyphicon("info-sign") . " and click the \"Flag for censorship\" button.</strong>";
if ($flagged = Tracks::get_flagged()) {
    echo "\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
    foreach ($flagged as $flag) {
        echo "\n\t<tr id=\"" . $flag->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $flag->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $flag->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $flag->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $flag->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($flag->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $flag->get_origin() . "<br />\n\t\t\t\t" . ($flag->get_reclibid() ? "<strong>Reclib ID:</strong> " . $flag->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $flag->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $flag->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?censor=" . $flag->get_id() . "\" class=\"censor\" title=\"Approve censorship\" rel=\"twipsy\">" . Bootstrap::glyphicon("ok-sign") . "</td>\n\t\t<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?unflag=" . $flag->get_id() . "\" class=\"unflag\" title=\"Remove flag\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>";
    }
    echo "\n</table>";
} else {
    echo "<h4>No tracks currently flagged for censorship.</h4>";
}
$limit = isset($_REQUEST['n']) ? $_REQUEST['n'] : 10;
$page = isset($_REQUEST['p']) ? $_REQUEST['p'] : 1;
$num_of_censored = Tracks::count_censored();
if ($censored = Tracks::get_censored($limit, ($page - 1) * $limit)) {
    $pages = new Paginator();
    $pages->items_per_page = $limit;
    $pages->querystring = NULL;
    $pages->mid_range = 5;
    $pages->items_total = $num_of_censored;
    $pages->paginate();
    $low = ($page - 1) * $limit + 1;
    $high = $low + $limit - 1 > $num_of_censored ? $num_of_censored : $low + $limit - 1;
    echo "\n<h3>Censored Tracks</h3>\n<table class=\"table table-striped\" cellspacing=\"0\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th class=\"icon\"></th>\n\t\t\t<th class=\"artist\">Artist</th>\n\t\t\t<th class=\"title\">Title</th>\n\t\t\t" . (Session::is_group_user("Music Admin") ? "\n\t\t\t<th class=\"icon\"></th>" : "") . "\n\t\t</tr>\n\t</thead>";
    foreach ($censored as $censor) {
        echo "\n\t<tr id=\"" . $censor->get_id() . "\">\n\t\t<td class=\"icon\">\n\t\t\t<a href=\"" . LINK_ABS . "music/detail/" . $censor->get_id() . "\" class=\"track-info\">\n\t\t\t\t" . Bootstrap::glyphicon("info-sign") . "\n\t\t\t</a>\n\t\t\t<div class=\"hover-info\">\n\t\t\t\t<strong>Artist:</strong> " . $censor->get_artists_str() . "<br />\n\t\t\t\t<strong>Album:</strong> " . $censor->get_album()->get_name() . "<br />\n\t\t\t\t<strong>Year:</strong> " . $censor->get_year() . "<br />\n\t\t\t\t<strong>Length:</strong> " . Time::format_succinct($censor->get_length()) . "<br />\n\t\t\t\t<strong>Origin:</strong> " . $censor->get_origin() . "<br />\n\t\t\t\t" . ($censor->get_reclibid() ? "<strong>Reclib ID:</strong> " . $censor->get_reclibid() . "<br />" : "") . "\n\t\t\t</div>\n\t\t</td>\n\t\t<td class=\"artist\">" . $censor->get_artists_str() . "</td>\n\t\t<td class=\"title\">" . $censor->get_title() . "</td>\n\t\t" . (Session::is_group_user("Music Admin") ? "<td class=\"icon\"><a href=\"" . LINK_ABS . "music/censor/?uncensor=" . $censor->get_id() . "\" class=\"uncensor\" title=\"Uncensor this track\" rel=\"twipsy\">" . Bootstrap::glyphicon("remove-sign") . "</td>" : "") . "\n\t</tr>";
    }
    echo "\n</table>";
    echo $pages->return;
} else {
    echo "\n<strong>No censored tracks.</strong>";
}
Beispiel #5
0
if (!($track = Tracks::get($_GET["id"]))) {
    exit("<h3>Invalid track ID</h3><h4>If you got to this page via a link from somewhere else on the site, there may be a bug.  A bug you should bug the techies about!</h4>");
}
if (!Session::is_group_user("Music Admin")) {
    $disabled = " disabled";
} else {
    $disabled = "";
}
echo "\n\t<script>\n\t\t\$(function () {\n\t\t\t\$('.track-detail-form').submit(function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsubmit = \$(this).find('button[type=\"submit\"]');\n\t\t\t\tsubmit.find('span').removeClass('glyphicon-save').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-detail-update.php',\n\t\t\t\t\tdata: \$(this).serialize(),\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\tsubmit.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-save');\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+value.error+'", "Error!") . "');\n\t\t\t\t\t\tconsole.error(value.detail);\n\t\t\t\t\t\t\$('.alert-message').alert();\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\tsubmit.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-save');\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("success", "Track details altered.", "Success!", false) . "');\n\t\t\t\t\t\t\$('[id=new_artist]').val('');\n\t\t\t\t\t\t\$('[id=artist\\\\[\\\\]]').parent('.col-md-10').remove();\n\t\t\t\t\t\tartists_str = '';\n\t\t\t\t\t\tfirst = true;\n\t\t\t\t\t\t\$.each(values.artists, function(i, val) {\n\t\t\t\t\t\t\tartists_str += '<div class=\"col-md-10'+(first? '' : ' col-md-offset-2')+'\"><input type=\"text\" id=\"artist[]\" name=\"artist[]\" class=\"form-control" . $disabled . "\" value=\"'+val+'\"></div>';\n\t\t\t\t\t\t\tfirst = false;\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('[for=artist]').after(artists_str);\n\t\t\t\t\t\t\$('[id=new_keyword]').val('');\n\t\t\t\t\t\t\$('.keyword').parent().remove();\n\t\t\t\t\t\tkeywords_str = '';\n\t\t\t\t\t\t\$.each(values.keywords, function(i, val) {\n\t\t\t\t\t\t\tkeywords_str += '<div class=\"input-group\"><span class=\"input-group-addon\"><a class=\"keyword-remove\" href=\"" . LINK_ABS . "ajax/del-keywords.php?track_id=" . $track->get_id() . "&keyword='+val+'\">" . Bootstrap::glyphicon("remove-sign") . "</a></span><input type=\"text\" class=\"form-control\" disabled value=\"'+val+'\"></div></div>'\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('.for-keywords').html(keywords_str);\n\t\t\t\t\t\tsetTimeout(function() {\n    \t\t\t\t\t\t\$('.alert').hide('fast', function(){\n        \t\t\t\t\t\t\$(this).remove(); \n           \t\t\t\t});},4000);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t\$('.keyword-remove').on(\"click\", function(event) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tparent = \$(this).parent().parent();\n\t\t\t\t\$.get(\$(this).attr('href'), function(data) {\n\t\t\t\t\tif(data == \"success\") {\n\t\t\t\t\t\tparent.remove();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+data+'", "Error!") . "');\n\t\t\t\t\t\t\$('.alert-message').show('fast').alert();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t\$('[id=flag]').click(function() {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tt = \$(this);\n\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-warning-sign').addClass('glyphicon-refresh');\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . LINK_ABS . "ajax/flag.php',\n\t\t\t\t\tdata: 'id=" . $track->get_id() . "&flag=toggle',\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("danger", "'+value.error+'", "Error!") . "');\n\t\t\t\t\t\t\$('.alert-message').alert();\n\t\t\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-refresh').addClass('glyphicon-warning-sign');\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tt.find('.censor-flag').removeClass('glyphicon-refresh').addClass('glyphicon-warning-sign');\n\t\t\t\t\t\t\tif(value.response == 'flagged') {\n\t\t\t\t\t\t\t\tt.addClass('active');\n\t\t\t\t\t\t\t\tresponse = 'This track has been flagged for censorship and will be reviewed in due course.';\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tt.removeClass('active');\n\t\t\t\t\t\t\t\tresponse = 'This track has been unflagged.';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\$('h3').after('" . Bootstrap::alert_message_basic("warning", "'+response+'", "Success!", false) . "'); \n\t\t\t\t\t\t\tsetTimeout(function() {\n\t    \t\t\t\t\t\t\$('.alert').hide('fast', function(){\n\t        \t\t\t\t\t\t\$(this).remove(); \n\t           \t\t\t\t});},4000);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n" . (Session::is_group_user("Playlist Editor") ? "\n\t\t\tvar item;\n\t\t\t\$('.playlist-add').click(function() {\n\t\t\t\titem = \$(this);\n\t\t\t\tplaylists = \$(this).attr('data-playlists-in').split(',');\n\t\t\t\t\$('.playlist-select').parent().removeClass('active');\n\t\t\t\t\$('.playlist-select').find('span').removeClass('glyphicon-minus').addClass('glyphicon-plus');\n\t\t\t\t\$('.playlist-select').each(function() {\n\t\t\t\t\tif(\$.inArray(\$(this).attr('data-playlist-id'),playlists) > -1) {\n\t\t\t\t\t\t\$(this).find('span').removeClass('icon-plus').addClass('glyphicon-minus');\n\t\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t});\n\n\t\t\t\$('.playlist-select').click(function() {\n\t\t\t\tobj = \$(this);\n\t\t\t\tif(\$(this).parent().hasClass('active')) {\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-minus').addClass('glyphicon-refresh');\n\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\t\tdata: 'trackid='+item.attr('data-dps-id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=del',\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\t\tobj.parent().removeClass('active');\n\t\t\t\t\t\t\titem.attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-refresh');\n\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\turl: '" . LINK_ABS . "ajax/track-playlist-update.php',\n\t\t\t\t\t\tdata: 'trackid='+item.attr('data-dps-id')+'&playlistid='+obj.attr('data-playlist-id')+'&action=add',\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\terror: function(xhr,text,error) {\n\t\t\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-plus');\n\t\t\t\t\t\t\talert(value.error);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(data,text,xhr) {\n\t\t\t\t\t\t\tvalues = \$.parseJSON(data);\n\t\t\t\t\t\t\tobj.find('span').removeClass('glyphicon-refresh').addClass('glyphicon-minus');\n\t\t\t\t\t\t\tobj.parent().addClass('active');\n\t\t\t\t\t\t\titem.attr('data-playlists-in',values.playlists.join(','));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\$(this).parent().addClass('active');\n\t\t\t\t\t\$(this).find('span').removeClass('glyphicon-plus').addClass('glyphicon-minus');\n\t\t\t\t}\n\t\t\t});\t\t\n" : "") . "\n\t\t});\n\t</script>\n\t<h3>Edit Track: " . $track->get_id() . " <small>Added " . date("d/m/Y H:i", $track->get_import_date()) . "</small></h3>\n\t" . (Session::is_group_user("Music Admin") ? "" : Bootstrap::alert_message_basic("info", "You can't edit the details of this track, because you aren't a Music Admin.", "Notice:"));
echo $track->player() . "\n\t<form class=\"track-detail-form\" action=\"\" method=\"post\">\n\t\t<fieldset>\n\t\t\t<div class=\"row\">\n\t\t\t\t<div class=\"col-md-7 form-horizontal\">\n\t\t\t\t\t<input type=\"hidden\" id=\"id\" name=\"id\" value=\"" . $track->get_id() . "\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"title\">Title</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"title\" name=\"title\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_title() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"artist\">Artists</label>";
$first = true;
foreach ($track->get_artists() as $key => $artist) {
    echo "\n\t\t\t\t\t\t<div class=\"col-md-10" . (!$first ? " col-md-offset-2" : "") . "\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"artist[]\"  name=\"artist[]\" class=\"form-control\" " . $disabled . " value=\"" . $artist->get_name() . "\">\n\t\t\t\t\t\t</div>";
    $first = false;
}
echo "\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_artist\" name=\"new-artist\" class=\"form-control\" " . $disabled . " placeholder=\"Add new artist...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"album\">Album</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"album\" name=\"album\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_album()->get_name() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"year\">Year</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" id=\"year\" name=\"year\" " . $disabled . " value=\"" . $track->get_year() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"length\">Length</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<p class=\"form-control-static\">" . Time::format_succinct($track->get_length()) . "</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label class=\"control-label col-md-2\" for=\"origin\">Origin</label>\n\t\t\t\t\t\t<div class=\"col-md-10\">\n\t\t\t\t\t\t\t<input type=\"text\" id=\"origin\" name=\"origin\" class=\"form-control\" " . $disabled . " value=\"" . $track->get_origin() . "\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<div class=\"checkbox\">\n\t\t\t\t\t\t\t\t<label for=\"censored\">\n\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"censored\" name=\"censored\" " . $disabled . " " . ($track->is_censored() ? "checked" : "") . ">\n\t\t\t\t\t\t\t\t\tExplicit\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<div class=\"col-md-10 col-md-offset-2\">\n\t\t\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary btn-block\">\n\t\t\t\t\t\t\t\t" . Bootstrap::glyphicon("save save") . "\n\t\t\t\t\t\t\t\tSave\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"col-md-5 form\">\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"notes\">Notes</label>\n\t\t\t\t\t\t<textarea class=\"form-control\" id=\"notes\" name=\"notes\" " . $disabled . ">" . $track->get_notes() . "</textarea>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"keyword\">Keywords</label>\n\t\t\t\t\t\t<div class=\"for-keywords\">";
foreach ($track->get_keywords() as $keyword) {
    echo "\n\t\t\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t\t\t<span class=\"input-group-addon\"><a class=\"keyword-remove\" href=\"" . LINK_ABS . "ajax/del-keywords.php?track_id=" . $track->get_id() . "&keyword=" . $keyword->get_text() . "\">" . Bootstrap::glyphicon("remove-sign") . "</a></span>\n\t\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form-control\" disabled value=\"" . $keyword->get_text() . "\">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
}
echo "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"input-group\">\n\t\t\t\t\t\t\t<span class=\"input-group-addon\">" . Bootstrap::glyphicon("tag") . "</span>\n\t\t\t\t\t\t\t<input type=\"text\" id=\"new_keyword\" name=\"new_keyword\" class=\"form-control\" " . $disabled . " placeholder=\"Add new keyword...\">\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"form-group\">\n\t\t\t\t\t\t<label for=\"type\">Audio Type</label>\n\t\t\t\t\t\t<select class=\"selectpicker\" id=\"type\" name=\"type\" data-width=\"100%\" " . $disabled . ">";
foreach (AudioTypes::get_all() as $audiotype) {
    if ($audiotype->get_id() == $track->get_type()->get_id()) {
        echo "<option value=\"" . $audiotype->get_id() . "\" selected=\"selected\">" . $audiotype->get_name() . "</option>";
    } else {
        echo "<option value=\"" . $audiotype->get_id() . "\">" . $audiotype->get_name() . "</option>";
    }
}
echo "</select>\n\t\t\t\t\t</div>\n\t\t\t\t\t<hr />\n\t\t\t\t\t";
if (Session::is_group_user("Playlist Editor")) {
    $playlists = array();
    foreach ($track->get_playlists_in() as $playlist) {