Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
348011dbc3
|
@ -84,10 +84,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/playlist.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
||||
&& $_SERVER['REQUEST_URI'] != '/Dashboard/stream-player') {
|
||||
&& ($_SERVER['REQUEST_URI'] != '/Dashboard/stream-player' || $_SERVER['REQUEST_URI'] != '/Playlist/audio-preview-player')) {
|
||||
$client_id = Application_Model_Preference::GetClientId();
|
||||
$view->headScript()->appendScript("var livechat_client_id = '$client_id';");
|
||||
$view->headScript()->appendFile($baseUrl . '/js/airtime/common/livechat.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||
|
|
|
@ -103,7 +103,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$api_key = $this->_getParam('api_key');
|
||||
$download = ("true" == $this->_getParam('download'));
|
||||
|
||||
|
||||
$logger = Logging::getLogger();
|
||||
|
||||
|
@ -116,64 +116,123 @@ class ApiController extends Zend_Controller_Action
|
|||
return;
|
||||
}
|
||||
|
||||
$filename = $this->_getParam("file");
|
||||
$name = $this->_getParam("name");
|
||||
$filename = $this->_getParam("filename");
|
||||
|
||||
$file_id = substr($filename, 0, strpos($filename, "."));
|
||||
if (ctype_alnum($file_id) && strlen($file_id) == 32) {
|
||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||
if ($media != null && !PEAR::isError($media)) {
|
||||
$filepath = $media->getFilePath();
|
||||
if(is_file($filepath)){
|
||||
// possibly use fileinfo module here in the future.
|
||||
// http://www.php.net/manual/en/book.fileinfo.php
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
if ($ext == "ogg")
|
||||
header("Content-Type: audio/ogg");
|
||||
else if ($ext == "mp3")
|
||||
header("Content-Type: audio/mpeg");
|
||||
if ($download){
|
||||
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||
//We just want the basename which is the file name with the path
|
||||
//information stripped away. We are using Content-Disposition to specify
|
||||
//to the browser what name the file should be saved as.
|
||||
//
|
||||
// By james.moon:
|
||||
// I'm removing pathinfo() since it strips away UTF-8 characters.
|
||||
// Using manualy parsing
|
||||
if (ctype_alnum($file_id) && strlen($file_id) == 32)
|
||||
{
|
||||
$media = Application_Model_StoredFile::RecallByGunid($file_id);
|
||||
if ( $media != null && !PEAR::isError($media))
|
||||
{
|
||||
$filepath = $media->getFilePath();
|
||||
if(is_file($filepath)){
|
||||
$full_path = $media->getPropelOrm()->getDbFilepath();
|
||||
$file_base_name = strrchr($full_path, '/');
|
||||
$file_base_name = substr($file_base_name, 1);
|
||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||
// possibly use fileinfo module here in the future.
|
||||
// http://www.php.net/manual/en/book.fileinfo.php
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
//Download user left clicks a track and selects Download.
|
||||
if ("true" == $this->_getParam('download')){
|
||||
//path_info breaks up a file path into seperate pieces of informaiton.
|
||||
//We just want the basename which is the file name with the path
|
||||
//information stripped away. We are using Content-Disposition to specify
|
||||
//to the browser what name the file should be saved as.
|
||||
//
|
||||
// By james.moon:
|
||||
// I'm removing pathinfo() since it strips away UTF-8 characters.
|
||||
// Using manualy parsing
|
||||
header('Content-Disposition: attachment; filename="'.$file_base_name.'"');
|
||||
}else{
|
||||
//user clicks play button for track and downloads it.
|
||||
header("Content-Disposition: inline; filename=$file_base_name");
|
||||
}
|
||||
|
||||
$this->smartReadFile($filepath, $ext);
|
||||
exit;
|
||||
}else{
|
||||
header ("HTTP/1.1 404 Not Found");
|
||||
}
|
||||
$logger->info("Sending $filepath");
|
||||
header("Content-Length: " . filesize($filepath));
|
||||
|
||||
// !! binary mode !!
|
||||
$fp = fopen($filepath, 'rb');
|
||||
|
||||
//We can have multiple levels of output buffering. Need to
|
||||
//keep looping until all have been disabled!!!
|
||||
//http://www.php.net/manual/en/function.ob-end-flush.php
|
||||
while (@ob_end_flush());
|
||||
|
||||
fpassthru($fp);
|
||||
fclose($fp);
|
||||
|
||||
//make sure to exit here so that no other output is sent.
|
||||
exit;
|
||||
} else {
|
||||
$logger->err('Resource in database, but not in storage: "'.$filepath.'"');
|
||||
}
|
||||
} else {
|
||||
$logger->err('$media != null && !PEAR::isError($media)');
|
||||
}
|
||||
} else {
|
||||
$logger->err('ctype_alnum($file_id) && strlen($file_id) == 32');
|
||||
}
|
||||
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
||||
$logger->info("404 Not Found");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the requested portion of a file and sends its contents to the client with the appropriate headers.
|
||||
*
|
||||
* This HTTP_RANGE compatible read file function is necessary for allowing streaming media to be skipped around in.
|
||||
*
|
||||
* @param string $location
|
||||
* @param string $mimeType
|
||||
* @return void
|
||||
*
|
||||
* @link https://groups.google.com/d/msg/jplayer/nSM2UmnSKKA/Hu76jDZS4xcJ
|
||||
* @link http://php.net/manual/en/function.readfile.php#86244
|
||||
*/
|
||||
function smartReadFile($location, $mimeType = 'audio/mpeg')
|
||||
{
|
||||
$size= filesize($location);
|
||||
$time= date('r', filemtime($location));
|
||||
|
||||
$fm = @fopen($location, 'rb');
|
||||
if (!$fm)
|
||||
{
|
||||
header ("HTTP/1.1 505 Internal server error");
|
||||
return;
|
||||
}
|
||||
|
||||
$begin= 0;
|
||||
$end= $size - 1;
|
||||
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches))
|
||||
{
|
||||
$begin = intval($matches[1]);
|
||||
if (!empty($matches[2]))
|
||||
{
|
||||
$end = intval($matches[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
}
|
||||
else
|
||||
{
|
||||
header('HTTP/1.1 200 OK');
|
||||
}
|
||||
header("Content-Type: $mimeType");
|
||||
header('Cache-Control: public, must-revalidate, max-age=0');
|
||||
header('Pragma: no-cache');
|
||||
header('Accept-Ranges: bytes');
|
||||
header('Content-Length:' . (($end - $begin) + 1));
|
||||
if (isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
header("Content-Range: bytes $begin-$end/$size");
|
||||
}
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Last-Modified: $time");
|
||||
|
||||
//We can have multiple levels of output buffering. Need to
|
||||
//keep looping until all have been disabled!!!
|
||||
//http://www.php.net/manual/en/function.ob-end-flush.php
|
||||
while (@ob_end_flush());
|
||||
|
||||
$cur = $begin;
|
||||
fseek($fm, $begin, 0);
|
||||
|
||||
while(!feof($fm) && $cur <= $end && (connection_status() == 0))
|
||||
{
|
||||
echo fread($fm, min(1024 * 16, ($end - $cur) + 1));
|
||||
$cur += 1024 * 16;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the currently playing show as well as upcoming shows.
|
||||
* Number of shows returned and the time interval in which to
|
||||
|
|
|
@ -68,7 +68,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
global $CC_CONFIG;
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
|
@ -88,15 +88,17 @@ class LibraryController extends Zend_Controller_Action
|
|||
if (isset($this->pl_sess->id) && $screen == "playlist") {
|
||||
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "copy");
|
||||
}
|
||||
|
||||
//Open a jPlayer window and play the audio clip.
|
||||
$menu["play"] = array("name"=> "Play", "icon" => "big_play");
|
||||
|
||||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu["download"] = array("name" => "Download", "url" => $url);
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu["download"] = array("name" => "Download", "url" => $url);
|
||||
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('new', 'json')
|
||||
->addActionContext('edit', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('play', 'json')
|
||||
->addActionContext('set-playlist-fades', 'json')
|
||||
->addActionContext('get-playlist-fades', 'json')
|
||||
->addActionContext('set-playlist-name', 'json')
|
||||
|
@ -28,7 +29,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$pl = null;
|
||||
|
||||
if (isset($this->pl_sess->id)) {
|
||||
if (isset($this->pl_sess->id)) {
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
|
||||
$modified = $this->_getParam('modified', null);
|
||||
|
@ -111,9 +112,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
|
||||
try {
|
||||
if (isset($this->pl_sess->id)) {
|
||||
|
@ -194,6 +195,33 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function audioPreviewPlayerAction()
|
||||
{
|
||||
$name = $this->_getParam('name');
|
||||
$fileName = $this->_getParam('filename');
|
||||
$playlistIndex = $this->_getParam('index');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/preview_jplayer.js?'.filemtime($baseDir.'/js/airtime/library/preview_jplayer.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.filemtime($baseDir.'/js/jplayer/jquery.jplayer.min.js'),'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css?'.filemtime($baseDir.'/js/jplayer/skin/jplayer.audio-preview.blue.monday.css'));
|
||||
$this->_helper->layout->setLayout('audioPlayer');
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logo = "data:image/png;base64,$logo";
|
||||
} else {
|
||||
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||
}
|
||||
|
||||
$this->view->name = $name;
|
||||
$this->view->fileName = $fileName;
|
||||
$this->view->playlistIndex= $playlistIndex;
|
||||
}
|
||||
|
||||
public function addItemsAction()
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('builder');
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
|
||||
|
||||
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?php echo $this->doctype() ?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Audio Player</title>
|
||||
<?php echo $this->headScript() ?>
|
||||
<?php echo $this->headLink() ?>
|
||||
<?php echo isset($this->google_analytics)?$this->google_analytics:"" ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"><?php echo $this->layout()->content ?></div>
|
||||
</body>
|
||||
</html>
|
|
@ -82,7 +82,7 @@ class Application_Model_StoredFile {
|
|||
* @param array $p_md
|
||||
* example: $p_md['MDATA_KEY_URL'] = 'http://www.fake.com'
|
||||
*/
|
||||
public function setMetadata($p_md=null)
|
||||
public function setMetadata($p_md=null)
|
||||
{
|
||||
if (is_null($p_md)) {
|
||||
$this->setDbColMetadata();
|
||||
|
@ -105,7 +105,7 @@ class Application_Model_StoredFile {
|
|||
* @param array $p_md
|
||||
* example: $p_md['url'] = 'http://www.fake.com'
|
||||
*/
|
||||
public function setDbColMetadata($p_md=null)
|
||||
public function setDbColMetadata($p_md=null)
|
||||
{
|
||||
if (is_null($p_md)) {
|
||||
foreach ($this->_dbMD as $dbColumn => $propelColumn) {
|
||||
|
@ -395,6 +395,7 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
private function constructGetFileUrl($p_serverName, $p_serverPort){
|
||||
Logging::log("getting media! - 2");
|
||||
return "http://$p_serverName:$p_serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
@ -404,6 +405,7 @@ class Application_Model_StoredFile {
|
|||
*/
|
||||
public function getRelativeFileUrl($baseUrl)
|
||||
{
|
||||
Logging::log("getting media!");
|
||||
return $baseUrl."/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
|
||||
}
|
||||
|
||||
|
@ -559,7 +561,8 @@ class Application_Model_StoredFile {
|
|||
|
||||
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
|
||||
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
|
||||
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "language"
|
||||
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
|
||||
"language", "gunid", "filepath"
|
||||
);
|
||||
|
||||
$plSelect = array();
|
||||
|
@ -627,11 +630,10 @@ class Application_Model_StoredFile {
|
|||
$fromTable = $unionTable;
|
||||
}
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables);
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables);
|
||||
|
||||
//Used by the audio preview functionality in the library.
|
||||
foreach ($results['aaData'] as &$row) {
|
||||
|
||||
$row['id'] = intval($row['id']);
|
||||
|
||||
$formatter = new LengthFormatter($row['length']);
|
||||
|
@ -655,8 +657,10 @@ class Application_Model_StoredFile {
|
|||
//TODO url like this to work on both playlist/showbuilder screens.
|
||||
//datatable stuff really needs to be pulled out and generalized within the project
|
||||
//access to zend view methods to access url helpers is needed.
|
||||
if ($type == "au") {
|
||||
$row['image'] = '<img src="/css/images/icon_audioclip.png">';
|
||||
|
||||
if($type == "au"){//&& isset( $audioResults )) {
|
||||
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
||||
$row['image'] = '<div class="big_play"><span class="ui-icon ui-icon-play"></span></div>';
|
||||
}
|
||||
else {
|
||||
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
||||
|
@ -665,78 +669,78 @@ class Application_Model_StoredFile {
|
|||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function searchFiles($displayColumns, $fromTable, $data)
|
||||
{
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
|
||||
public static function searchFiles($displayColumns, $fromTable, $data)
|
||||
{
|
||||
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
|
||||
$where = array();
|
||||
|
||||
if ($data["sSearch"] !== "") {
|
||||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
}
|
||||
|
||||
$selectorCount = "SELECT COUNT(*) ";
|
||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||
|
||||
|
||||
if ($data["sSearch"] !== "") {
|
||||
$searchTerms = explode(" ", $data["sSearch"]);
|
||||
}
|
||||
|
||||
$selectorCount = "SELECT COUNT(*) ";
|
||||
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
|
||||
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$sqlTotalRows = $sql;
|
||||
|
||||
if (isset($searchTerms)) {
|
||||
$searchCols = array();
|
||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||
if ($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $data["mDataProp_{$i}"];
|
||||
}
|
||||
}
|
||||
|
||||
$outerCond = array();
|
||||
|
||||
foreach ($searchTerms as $term) {
|
||||
$innerCond = array();
|
||||
|
||||
foreach ($searchCols as $col) {
|
||||
|
||||
if (isset($searchTerms)) {
|
||||
$searchCols = array();
|
||||
for ($i = 0; $i < $data["iColumns"]; $i++) {
|
||||
if ($data["bSearchable_".$i] == "true") {
|
||||
$searchCols[] = $data["mDataProp_{$i}"];
|
||||
}
|
||||
}
|
||||
|
||||
$outerCond = array();
|
||||
|
||||
foreach ($searchTerms as $term) {
|
||||
$innerCond = array();
|
||||
|
||||
foreach ($searchCols as $col) {
|
||||
$escapedTerm = pg_escape_string($term);
|
||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||
}
|
||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||
}
|
||||
$where[] = "(".join(" AND ", $outerCond).")";
|
||||
}
|
||||
// End Where clause
|
||||
|
||||
// Order By clause
|
||||
$orderby = array();
|
||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||
$num = $data["iSortCol_".$i];
|
||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||
}
|
||||
$orderby[] = "id";
|
||||
$orderby = join("," , $orderby);
|
||||
// End Order By clause
|
||||
|
||||
if (count($where) > 0) {
|
||||
$where = join(" AND ", $where);
|
||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||
$sqlTotalDisplayRows = $sql;
|
||||
|
||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
||||
}
|
||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
||||
}
|
||||
$where[] = "(".join(" AND ", $outerCond).")";
|
||||
}
|
||||
// End Where clause
|
||||
|
||||
// Order By clause
|
||||
$orderby = array();
|
||||
for ($i = 0; $i < $data["iSortingCols"]; $i++){
|
||||
$num = $data["iSortCol_".$i];
|
||||
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
|
||||
}
|
||||
$orderby[] = "id";
|
||||
$orderby = join("," , $orderby);
|
||||
// End Order By clause
|
||||
|
||||
if (count($where) > 0) {
|
||||
$where = join(" AND ", $where);
|
||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||
$sqlTotalDisplayRows = $sql;
|
||||
|
||||
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
try {
|
||||
$r = $con->query($sqlTotalRows);
|
||||
$totalRows = $r->fetchColumn(0);
|
||||
|
||||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
||||
$r = $con->query($sqlTotalRows);
|
||||
$totalRows = $r->fetchColumn(0);
|
||||
|
||||
if (isset($sqlTotalDisplayRows)) {
|
||||
$r = $con->query($sqlTotalDisplayRows);
|
||||
$totalDisplayRows = $r->fetchColumn(0);
|
||||
}
|
||||
else {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
||||
$r = $con->query($sql);
|
||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$results = $r->fetchAll();
|
||||
|
@ -744,109 +748,109 @@ class Application_Model_StoredFile {
|
|||
catch (Exception $e) {
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
|
||||
//display sql executed in airtime log for testing
|
||||
Logging::log($sql);
|
||||
|
||||
return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results);
|
||||
}
|
||||
|
||||
//display sql executed in airtime log for testing
|
||||
Logging::log($sql);
|
||||
|
||||
return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results);
|
||||
}
|
||||
|
||||
public static function uploadFile($p_targetDir)
|
||||
{
|
||||
// HTTP headers for no cache etc
|
||||
header('Content-type: text/plain; charset=UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
// Settings
|
||||
$cleanupTargetDir = false; // Remove old files
|
||||
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||
|
||||
// 5 minutes execution time
|
||||
@set_time_limit(5 * 60);
|
||||
// usleep(5000);
|
||||
|
||||
// Get parameters
|
||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
header('Content-type: text/plain; charset=UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
// Settings
|
||||
$cleanupTargetDir = false; // Remove old files
|
||||
$maxFileAge = 60 * 60; // Temp file age in seconds
|
||||
|
||||
// 5 minutes execution time
|
||||
@set_time_limit(5 * 60);
|
||||
// usleep(5000);
|
||||
|
||||
// Get parameters
|
||||
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
|
||||
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
Logging::log(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir");
|
||||
// Clean the fileName for security reasons
|
||||
// Clean the fileName for security reasons
|
||||
//this needs fixing for songs not in ascii.
|
||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||
|
||||
// Create target dir
|
||||
if (!file_exists($p_targetDir))
|
||||
@mkdir($p_targetDir);
|
||||
|
||||
// Remove old temp files
|
||||
if (is_dir($p_targetDir) && ($dir = opendir($p_targetDir))) {
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
$filePath = $p_targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
// Remove temp files if they are older than the max age
|
||||
if (preg_match('/\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
|
||||
@unlink($filePath);
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
|
||||
|
||||
// Create target dir
|
||||
if (!file_exists($p_targetDir))
|
||||
@mkdir($p_targetDir);
|
||||
|
||||
// Remove old temp files
|
||||
if (is_dir($p_targetDir) && ($dir = opendir($p_targetDir))) {
|
||||
while (($file = readdir($dir)) !== false) {
|
||||
$filePath = $p_targetDir . DIRECTORY_SEPARATOR . $file;
|
||||
|
||||
// Remove temp files if they are older than the max age
|
||||
if (preg_match('/\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge))
|
||||
@unlink($filePath);
|
||||
}
|
||||
|
||||
closedir($dir);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}');
|
||||
|
||||
// Look for the content type header
|
||||
if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["HTTP_CONTENT_TYPE"];
|
||||
|
||||
if (isset($_SERVER["CONTENT_TYPE"]))
|
||||
$contentType = $_SERVER["CONTENT_TYPE"];
|
||||
|
||||
// create temp file name (CC-3086)
|
||||
// we are not using mktemp command anymore.
|
||||
// plupload support unique_name feature.
|
||||
$tempFilePath= $p_targetDir . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
// Open temp file
|
||||
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
return $tempFilePath;
|
||||
if (strpos($contentType, "multipart") !== false) {
|
||||
if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
|
||||
// Open temp file
|
||||
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen($_FILES['file']['tmp_name'], "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
unlink($_FILES['file']['tmp_name']);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
|
||||
} else {
|
||||
// Open temp file
|
||||
$out = fopen($tempFilePath, $chunk == 0 ? "wb" : "ab");
|
||||
if ($out) {
|
||||
// Read binary input stream and append it to temp file
|
||||
$in = fopen("php://input", "rb");
|
||||
|
||||
if ($in) {
|
||||
while ($buff = fread($in, 4096))
|
||||
fwrite($out, $buff);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
|
||||
|
||||
fclose($out);
|
||||
} else
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
|
||||
}
|
||||
|
||||
return $tempFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -873,8 +877,8 @@ class Application_Model_StoredFile {
|
|||
$md5 = md5_file($audio_file);
|
||||
$duplicate = Application_Model_StoredFile::RecallByMd5($md5);
|
||||
if ($duplicate) {
|
||||
if (PEAR::isError($duplicate)) {
|
||||
$result = array("code" => 105, "message" => $duplicate->getMessage());
|
||||
if (PEAR::isError($duplicate)) {
|
||||
$result = array("code" => 105, "message" => $duplicate->getMessage());
|
||||
}
|
||||
if (file_exists($duplicate->getFilePath())) {
|
||||
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
|
||||
|
@ -882,36 +886,35 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($result)){//The file has no duplicate, so procceed to copy.
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$stor = $storDir->getDirectory();
|
||||
if (!isset($result)){//The file has no duplicate, so procceed to copy.
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$stor = $storDir->getDirectory();
|
||||
|
||||
//check to see if there is enough space in $stor to continue.
|
||||
$result = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||
if (!isset($result)){//if result not set then there's enough disk space to copy the file over
|
||||
$stor .= "/organize";
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
//check to see if there is enough space in $stor to continue.
|
||||
$result = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||
if (!isset($result)){//if result not set then there's enough disk space to copy the file over
|
||||
$stor .= "/organize";
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
||||
if ($r === false) {
|
||||
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
||||
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||
unlink($audio_file);//remove the file from the organize after failed rename
|
||||
$result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
||||
if ($r === false) {
|
||||
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
||||
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||
unlink($audio_file);//remove the file from the organize after failed rename
|
||||
$result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public static function getFileCount()
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG["filesTable"];
|
||||
return $CC_DBC->GetOne($sql);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<div id="content" class="jp-container">
|
||||
<span class='name'><?php echo "$this->name" ?></span>
|
||||
<span class='filename'><?php echo "$this->fileName" ?></span>
|
||||
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
|
||||
<div id="jp_container_1" class="jp-audio">
|
||||
<div class="jp-type-single">
|
||||
<div class="jp-gui jp-interface">
|
||||
<ul class="jp-controls">
|
||||
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
|
||||
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
|
||||
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
|
||||
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
|
||||
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
|
||||
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
|
||||
</ul>
|
||||
<div class="jp-progress">
|
||||
<div class="jp-seek-bar">
|
||||
<div class="jp-play-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jp-volume-bar">
|
||||
<div class="jp-volume-bar-value"></div>
|
||||
</div>
|
||||
<div class="jp-time-holder">
|
||||
<div class="jp-current-time"></div>
|
||||
<div class="jp-duration"></div>
|
||||
|
||||
<ul class="jp-toggles">
|
||||
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
|
||||
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,15 +1,13 @@
|
|||
<?php
|
||||
$items = $this->pl->getContents();
|
||||
if (count($items)) : ?>
|
||||
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach($items as $item) : ?>
|
||||
<li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["CcFiles"]["gunid"]."_".$item["id"]; ?>">
|
||||
<div class="list-item-container">
|
||||
<a href="javascript:void(0);" class="big_play"
|
||||
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["filepath"], PATHINFO_EXTENSION);?>',
|
||||
'spl_<?php echo $item["id"] ?>')"><span class="ui-icon ui-icon-play"></span></a>
|
||||
|
||||
<div class="big_play" audioFile="<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]['filepath'], PATHINFO_EXTENSION); ?>">
|
||||
<span class="ui-icon ui-icon-play"></span>
|
||||
</div>
|
||||
<div class="text-row top">
|
||||
<span class="spl_playlength"><?php echo $item["cliplength"] ?></span>
|
||||
<span class="spl_cue ui-state-default"></span>
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
#side_playlist h3 + h4 {
|
||||
margin:0 0 11px 0;
|
||||
}
|
||||
#spl_sortable a.big_play {
|
||||
#spl_sortable div.big_play {
|
||||
display:block;
|
||||
width:20px;
|
||||
height:50px;
|
||||
|
@ -155,21 +155,21 @@
|
|||
background: -moz-linear-gradient(top, #707070 0, #666666 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666));
|
||||
}
|
||||
#spl_sortable a.big_play:hover {
|
||||
#spl_sortable div.big_play:hover {
|
||||
border:1px solid #282828;
|
||||
background-color: #3b3b3b;
|
||||
background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929));
|
||||
}
|
||||
#spl_sortable a.big_play .ui-icon-play {
|
||||
#spl_sortable div.big_play .ui-icon-play {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable a.big_play .ui-icon-pause {
|
||||
#spl_sortable div.big_play .ui-icon-pause {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable a.big_play:hover .ui-icon-play, #spl_sortable a.big_play:hover .ui-icon-pause {
|
||||
#spl_sortable div.big_play:hover .ui-icon-play, #spl_sortable div.big_play:hover .ui-icon-pause {
|
||||
background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png);
|
||||
}
|
||||
#spl_sortable .ui-icon-closethick {
|
||||
|
|
|
@ -186,43 +186,7 @@ function audioStream(){
|
|||
swfPath: "/js/jplayer",
|
||||
supplied: supplied
|
||||
});
|
||||
}
|
||||
|
||||
function audioPreview(filename, elemID){
|
||||
|
||||
var elems = $('.ui-icon.ui-icon-pause');
|
||||
elems.attr("class", "ui-icon ui-icon-play");
|
||||
|
||||
if ($("#jquery_jplayer_1").data("jPlayer") && $("#jquery_jplayer_1").data("jPlayer").status.paused != true){
|
||||
$('#jquery_jplayer_1').jPlayer('stop');
|
||||
return;
|
||||
}
|
||||
|
||||
var ext = getFileExt(filename);
|
||||
var uri = "/api/get-media/file/" + filename;
|
||||
|
||||
var media;
|
||||
var supplied;
|
||||
if (ext == "ogg"){
|
||||
media = {oga:uri};
|
||||
supplied = "oga";
|
||||
} else {
|
||||
media = {mp3:uri};
|
||||
supplied = "mp3";
|
||||
}
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer("destroy");
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", media).jPlayer("play");
|
||||
},
|
||||
swfPath: "/js/jplayer",
|
||||
supplied: supplied,
|
||||
wmode:"window"
|
||||
});
|
||||
|
||||
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
}
|
||||
}
|
||||
|
||||
function resizeImg(ele, targetWidth, targetHeight){
|
||||
var img = $(ele);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,73 @@
|
|||
|
||||
|
||||
function audioPreview(filename, elemID){
|
||||
console.log("in the audio preview");
|
||||
var elems = $('.ui-icon.ui-icon-pause');
|
||||
elems.attr("class", "ui-icon ui-icon-play");
|
||||
|
||||
if ($("#jquery_jplayer_1").data("jPlayer") && $("#jquery_jplayer_1").data("jPlayer").status.paused != true){
|
||||
$('#jquery_jplayer_1').jPlayer('stop');
|
||||
return;
|
||||
}
|
||||
|
||||
var ext = getFileExt(filename);
|
||||
var uri = "/api/get-media/file/" + filename;
|
||||
|
||||
var media;
|
||||
var supplied;
|
||||
if (ext == "ogg"){
|
||||
media = {oga:uri};
|
||||
supplied = "oga";
|
||||
} else {
|
||||
media = {mp3:uri};
|
||||
supplied = "mp3";
|
||||
}
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer("destroy");
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
$(this).jPlayer("setMedia", media).jPlayer("play");
|
||||
},
|
||||
swfPath: "/js/jplayer",
|
||||
supplied: supplied
|
||||
});
|
||||
|
||||
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
var filename = $(".filename").text();
|
||||
var name = $(".name").text();
|
||||
play(name, filename);
|
||||
});
|
||||
|
||||
function play(name, filename){
|
||||
var uri = "/api/get-media/name/"+name+"/filename/" + filename;
|
||||
var ext = getFileExt(filename);
|
||||
|
||||
|
||||
var media;
|
||||
var supplied;
|
||||
if (ext == "ogg"){
|
||||
media = {oga:uri};
|
||||
supplied = "oga";
|
||||
} else {
|
||||
media = {mp3:uri};
|
||||
supplied = "mp3";
|
||||
}
|
||||
|
||||
$("#jquery_jplayer_1").jPlayer("destroy");
|
||||
$.jPlayer.timeFormat.showHour = true;
|
||||
$("#jquery_jplayer_1").jPlayer({
|
||||
ready: function () {
|
||||
|
||||
$(this).jPlayer("setMedia", media).jPlayer("play");
|
||||
|
||||
},
|
||||
swfPath: "/js/jplayer",
|
||||
cssSelectorAncestor: '#jp_container_1',
|
||||
wmode: "window"
|
||||
});
|
||||
|
||||
}
|
||||
|
|
@ -245,6 +245,16 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
}
|
||||
|
||||
function openAudioPreview(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var name = $(this).parent().find('.spl_title').text();
|
||||
var audioFile = $(this).attr('audioFile');
|
||||
var id = "";
|
||||
|
||||
open_audio_preview(name, audioFile, id);
|
||||
}
|
||||
|
||||
function editName() {
|
||||
var nameElement = $(this),
|
||||
playlistName = nameElement.text(),
|
||||
|
@ -343,6 +353,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
$(el).delegate(".spl_cue",
|
||||
{"click": openCueEditor});
|
||||
|
||||
//add the play function to the play icon
|
||||
$(el).delegate(".big_play",
|
||||
{"click": openAudioPreview});
|
||||
}
|
||||
|
||||
//sets events dynamically for the cue editor.
|
||||
|
|
|
@ -0,0 +1,632 @@
|
|||
/*
|
||||
* Skin for jPlayer Plugin (jQuery JavaScript Library)
|
||||
* http://www.happyworm.com/jquery/jplayer
|
||||
*
|
||||
* Skin Name: Blue Monday
|
||||
*
|
||||
* Copyright (c) 2010-2011 Happyworm Ltd
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* - http://www.opensource.org/licenses/mit-license.php
|
||||
* - http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* Author: Silvia Benvenuti
|
||||
* Skin Version: 4.0 (jPlayer 2.1.0)
|
||||
* Date: 1st September 2011
|
||||
*/
|
||||
|
||||
div.jp-audio,
|
||||
div.jp-video {
|
||||
|
||||
/* Edit the font-size to counteract inherited font sizing.
|
||||
* Eg. 1.25em = 1 / 0.8em
|
||||
*/
|
||||
|
||||
font-size:1em; /* 1.25em for testing in site pages */ /* No parent CSS that can effect the size in the demos ZIP */
|
||||
|
||||
font-family:Verdana, Arial, sans-serif;
|
||||
line-height:1.6;
|
||||
color: #666;
|
||||
border:1px solid #009be3;
|
||||
background-color:#eee;
|
||||
position:relative;
|
||||
}
|
||||
div.jp-audio {
|
||||
width:420px;
|
||||
}
|
||||
div.jp-video-270p {
|
||||
width:480px;
|
||||
}
|
||||
div.jp-video-360p {
|
||||
width:640px;
|
||||
}
|
||||
div.jp-video-full {
|
||||
/* Rules for IE6 (full-screen) */
|
||||
width:480px;
|
||||
height:270px;
|
||||
/* Rules for IE7 (full-screen) - Otherwise the relative container causes other page items that are not position:static (default) to appear over the video/gui. */
|
||||
position:static !important; position:relative
|
||||
}
|
||||
|
||||
div.jp-video-full div.jp-jplayer {
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: fixed !important; position: relative; /* Rules for IE6 (full-screen) */
|
||||
overflow: hidden;
|
||||
z-index:1000;
|
||||
}
|
||||
|
||||
div.jp-video-full div.jp-gui {
|
||||
position: fixed !important; position: static; /* Rules for IE6 (full-screen) */
|
||||
top: 0;
|
||||
left: 0;
|
||||
width:100%;
|
||||
height:100%;
|
||||
z-index:1000;
|
||||
}
|
||||
|
||||
div.jp-video-full div.jp-interface {
|
||||
position: absolute !important; position: relative; /* Rules for IE6 (full-screen) */
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index:1000;
|
||||
}
|
||||
|
||||
div.jp-interface {
|
||||
position: relative;
|
||||
background-color:#eee;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
div.jp-audio div.jp-type-single div.jp-interface {
|
||||
height:80px;
|
||||
}
|
||||
div.jp-audio div.jp-type-playlist div.jp-interface {
|
||||
height:80px;
|
||||
}
|
||||
|
||||
div.jp-video div.jp-interface {
|
||||
border-top:1px solid #009be3;
|
||||
}
|
||||
|
||||
/* Used to hide the filename field **/
|
||||
span.filename {
|
||||
display:none;
|
||||
}
|
||||
span.name {
|
||||
display:none;
|
||||
}
|
||||
/* @group CONTROLS */
|
||||
|
||||
div.jp-controls-holder {
|
||||
clear: both;
|
||||
width:440px;
|
||||
margin:0 auto;
|
||||
position: relative;
|
||||
overflow:hidden;
|
||||
top:-8px; /* This negative value depends on the size of the text in jp-currentTime and jp-duration */
|
||||
}
|
||||
|
||||
div.jp-interface ul.jp-controls {
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding: 0;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
div.jp-audio ul.jp-controls {
|
||||
width: 380px;
|
||||
padding:20px 20px 0 20px;
|
||||
}
|
||||
|
||||
div.jp-video div.jp-type-single ul.jp-controls {
|
||||
width: 78px;
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
div.jp-video div.jp-type-playlist ul.jp-controls {
|
||||
width: 134px;
|
||||
margin-left: 172px;
|
||||
}
|
||||
div.jp-video ul.jp-controls,
|
||||
div.jp-interface ul.jp-controls li {
|
||||
display:inline;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.jp-interface ul.jp-controls a {
|
||||
display:block;
|
||||
overflow:hidden;
|
||||
text-indent:-9999px;
|
||||
}
|
||||
a.jp-play,
|
||||
a.jp-pause {
|
||||
width:40px;
|
||||
height:40px;
|
||||
}
|
||||
|
||||
a.jp-play {
|
||||
background: url("jplayer.blue.monday.jpg") 0 0 no-repeat;
|
||||
}
|
||||
a.jp-play:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -41px 0 no-repeat;
|
||||
}
|
||||
a.jp-pause {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -42px no-repeat;
|
||||
display: none;
|
||||
}
|
||||
a.jp-pause:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -41px -42px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-stop, a.jp-previous, a.jp-next {
|
||||
width:28px;
|
||||
height:28px;
|
||||
margin-top:6px;
|
||||
}
|
||||
|
||||
a.jp-stop {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -83px no-repeat;
|
||||
margin-left:10px;
|
||||
}
|
||||
|
||||
a.jp-stop:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -29px -83px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-previous {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -112px no-repeat;
|
||||
}
|
||||
a.jp-previous:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -29px -112px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-next {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -141px no-repeat;
|
||||
}
|
||||
a.jp-next:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -29px -141px no-repeat;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group progress bar */
|
||||
|
||||
div.jp-progress {
|
||||
overflow:hidden;
|
||||
background-color: #ddd;
|
||||
}
|
||||
div.jp-audio div.jp-progress {
|
||||
position: absolute;
|
||||
top:32px;
|
||||
height:15px;
|
||||
}
|
||||
div.jp-audio div.jp-type-single div.jp-progress {
|
||||
left:110px;
|
||||
width:186px;
|
||||
}
|
||||
div.jp-audio div.jp-type-playlist div.jp-progress {
|
||||
left:166px;
|
||||
width:130px;
|
||||
}
|
||||
div.jp-video div.jp-progress {
|
||||
top:0px;
|
||||
left:0px;
|
||||
width:100%;
|
||||
height:10px;
|
||||
}
|
||||
div.jp-seek-bar {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -202px repeat-x;
|
||||
width:0px;
|
||||
height:100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
div.jp-play-bar {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -218px repeat-x ;
|
||||
width:0px;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
/* The seeking class is added/removed inside jPlayer */
|
||||
div.jp-seeking-bg {
|
||||
background: url("jplayer.blue.monday.seeking.gif");
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group volume controls */
|
||||
|
||||
|
||||
a.jp-mute,
|
||||
a.jp-unmute,
|
||||
a.jp-volume-max {
|
||||
width:18px;
|
||||
height:15px;
|
||||
margin-top:12px;
|
||||
}
|
||||
|
||||
div.jp-audio div.jp-type-single a.jp-mute,
|
||||
div.jp-audio div.jp-type-single a.jp-unmute {
|
||||
margin-left: 210px;
|
||||
}
|
||||
|
||||
div.jp-audio div.jp-type-playlist a.jp-mute,
|
||||
div.jp-audio div.jp-type-playlist a.jp-unmute {
|
||||
margin-left: 154px;
|
||||
}
|
||||
|
||||
div.jp-audio a.jp-volume-max {
|
||||
margin-left: 56px;
|
||||
}
|
||||
|
||||
div.jp-video a.jp-mute,
|
||||
div.jp-video a.jp-unmute,
|
||||
div.jp-video a.jp-volume-max {
|
||||
position: absolute;
|
||||
top:12px;
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
div.jp-video a.jp-mute,
|
||||
div.jp-video a.jp-unmute {
|
||||
left: 50px;
|
||||
}
|
||||
|
||||
|
||||
div.jp-video a.jp-volume-max {
|
||||
left: 134px;
|
||||
}
|
||||
|
||||
a.jp-mute {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -170px no-repeat;
|
||||
}
|
||||
a.jp-mute:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -19px -170px no-repeat;
|
||||
}
|
||||
a.jp-unmute {
|
||||
background: url("jplayer.blue.monday.jpg") -60px -170px no-repeat;
|
||||
display: none;
|
||||
}
|
||||
a.jp-unmute:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -79px -170px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-volume-max {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -186px no-repeat;
|
||||
}
|
||||
a.jp-volume-max:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -19px -186px no-repeat;
|
||||
}
|
||||
|
||||
div.jp-volume-bar {
|
||||
position: absolute;
|
||||
overflow:hidden;
|
||||
background: url("jplayer.blue.monday.jpg") 0 -250px repeat-x;
|
||||
width:46px;
|
||||
height:5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
div.jp-audio div.jp-volume-bar {
|
||||
top:37px;
|
||||
left:330px;
|
||||
}
|
||||
div.jp-video div.jp-volume-bar {
|
||||
top:17px;
|
||||
left:72px;
|
||||
}
|
||||
div.jp-volume-bar-value {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -256px repeat-x;
|
||||
width:0px;
|
||||
height:5px;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group current time and duration */
|
||||
|
||||
div.jp-audio div.jp-time-holder {
|
||||
position:absolute;
|
||||
top:50px;
|
||||
}
|
||||
div.jp-audio div.jp-type-single div.jp-time-holder {
|
||||
left:110px;
|
||||
width:186px;
|
||||
}
|
||||
div.jp-audio div.jp-type-playlist div.jp-time-holder {
|
||||
left:166px;
|
||||
width:130px;
|
||||
}
|
||||
|
||||
div.jp-current-time,
|
||||
div.jp-duration {
|
||||
width:60px;
|
||||
font-size:.64em;
|
||||
font-style:oblique;
|
||||
}
|
||||
div.jp-current-time {
|
||||
float: left;
|
||||
display:inline;
|
||||
}
|
||||
div.jp-duration {
|
||||
float: right;
|
||||
display:inline;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.jp-video div.jp-current-time {
|
||||
margin-left:20px;
|
||||
}
|
||||
div.jp-video div.jp-duration {
|
||||
margin-right:20px;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group playlist */
|
||||
|
||||
div.jp-title {
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
div.jp-title,
|
||||
div.jp-playlist {
|
||||
width:100%;
|
||||
background-color:#ccc;
|
||||
border-top:1px solid #009be3;
|
||||
}
|
||||
div.jp-type-single div.jp-title,
|
||||
div.jp-type-playlist div.jp-title,
|
||||
div.jp-type-single div.jp-playlist {
|
||||
border-top:none;
|
||||
}
|
||||
div.jp-title ul,
|
||||
div.jp-playlist ul {
|
||||
list-style-type:none;
|
||||
margin:0;
|
||||
padding:0 20px;
|
||||
font-size:.72em;
|
||||
}
|
||||
|
||||
div.jp-title li {
|
||||
padding:5px 0;
|
||||
font-weight:bold;
|
||||
}
|
||||
div.jp-playlist li {
|
||||
padding:5px 0 4px 20px;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
|
||||
div.jp-playlist li div {
|
||||
display:inline;
|
||||
}
|
||||
|
||||
/* Note that the first-child (IE6) and last-child (IE6/7/8) selectors do not work on IE */
|
||||
|
||||
div.jp-type-playlist div.jp-playlist li:last-child {
|
||||
padding:5px 0 5px 20px;
|
||||
border-bottom:none;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist li.jp-playlist-current {
|
||||
list-style-type:square;
|
||||
list-style-position:inside;
|
||||
padding-left:7px;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist a:hover {
|
||||
color:#0d88c1;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist a.jp-playlist-current {
|
||||
color:#0d88c1;
|
||||
}
|
||||
|
||||
div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove {
|
||||
float:right;
|
||||
display:inline;
|
||||
text-align:right;
|
||||
margin-right:10px;
|
||||
font-weight:bold;
|
||||
color:#666;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist a.jp-playlist-item-remove:hover {
|
||||
color:#0d88c1;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist span.jp-free-media {
|
||||
float:right;
|
||||
display:inline;
|
||||
text-align:right;
|
||||
margin-right:10px;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist span.jp-free-media a{
|
||||
color:#666;
|
||||
}
|
||||
div.jp-type-playlist div.jp-playlist span.jp-free-media a:hover{
|
||||
color:#0d88c1;
|
||||
}
|
||||
span.jp-artist {
|
||||
font-size:.8em;
|
||||
color:#666;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
||||
div.jp-video-play {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
cursor:pointer;
|
||||
background-color:rgba(0,0,0,0); /* Makes IE9 work with the active area over the whole video area. IE6/7/8 only have the button as active area. */
|
||||
}
|
||||
div.jp-video-270p div.jp-video-play {
|
||||
height:270px;
|
||||
}
|
||||
div.jp-video-360p div.jp-video-play {
|
||||
height:360px;
|
||||
}
|
||||
div.jp-video-full div.jp-video-play {
|
||||
height:100%;
|
||||
z-index:1000;
|
||||
}
|
||||
a.jp-video-play-icon {
|
||||
position:relative;
|
||||
display:block;
|
||||
width: 112px;
|
||||
height: 100px;
|
||||
|
||||
margin-left:-56px;
|
||||
margin-top:-50px;
|
||||
left:50%;
|
||||
top:50%;
|
||||
|
||||
background: url("jplayer.blue.monday.video.play.png") 0 0 no-repeat;
|
||||
text-indent:-9999px;
|
||||
}
|
||||
div.jp-video-play:hover a.jp-video-play-icon {
|
||||
background: url("jplayer.blue.monday.video.play.png") 0 -100px no-repeat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
div.jp-jplayer audio,
|
||||
div.jp-jplayer {
|
||||
width:0px;
|
||||
height:0px;
|
||||
}
|
||||
|
||||
div.jp-jplayer {
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* @group TOGGLES */
|
||||
|
||||
/* The audio toggles are nested inside jp-time-holder */
|
||||
|
||||
ul.jp-toggles {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0 auto;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
div.jp-audio .jp-type-single ul.jp-toggles {
|
||||
width:25px;
|
||||
}
|
||||
div.jp-audio .jp-type-playlist ul.jp-toggles {
|
||||
width:55px;
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
left: 325px;
|
||||
top: 50px;
|
||||
}
|
||||
|
||||
div.jp-video ul.jp-toggles {
|
||||
margin-top:10px;
|
||||
width:100px;
|
||||
}
|
||||
|
||||
ul.jp-toggles li {
|
||||
display:block;
|
||||
float:right;
|
||||
}
|
||||
|
||||
ul.jp-toggles li a {
|
||||
display:block;
|
||||
width:25px;
|
||||
height:18px;
|
||||
text-indent:-9999px;
|
||||
line-height:100%; /* need this for IE6 */
|
||||
}
|
||||
|
||||
a.jp-full-screen {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -310px no-repeat;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
a.jp-full-screen:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -30px -310px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-restore-screen {
|
||||
background: url("jplayer.blue.monday.jpg") -60px -310px no-repeat;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
a.jp-restore-screen:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -90px -310px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-repeat {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -290px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-repeat:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -30px -290px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-repeat-off {
|
||||
background: url("jplayer.blue.monday.jpg") -60px -290px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-repeat-off:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -90px -290px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-shuffle {
|
||||
background: url("jplayer.blue.monday.jpg") 0 -270px no-repeat;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
a.jp-shuffle:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -30px -270px no-repeat;
|
||||
}
|
||||
|
||||
a.jp-shuffle-off {
|
||||
background: url("jplayer.blue.monday.jpg") -60px -270px no-repeat;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
a.jp-shuffle-off:hover {
|
||||
background: url("jplayer.blue.monday.jpg") -90px -270px no-repeat;
|
||||
}
|
||||
|
||||
|
||||
/* @end */
|
||||
|
||||
/* @group NO SOLUTION error feedback */
|
||||
|
||||
.jp-no-solution {
|
||||
position:absolute;
|
||||
width:390px;
|
||||
margin-left:-202px;
|
||||
left:50%;
|
||||
top: 10px;
|
||||
|
||||
padding:5px;
|
||||
font-size:.8em;
|
||||
background-color:#eee;
|
||||
border:2px solid #009be3;
|
||||
color:#000;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.jp-no-solution a {
|
||||
color:#000;
|
||||
}
|
||||
|
||||
.jp-no-solution span {
|
||||
font-size:1em;
|
||||
display:block;
|
||||
text-align:center;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* @end */
|
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Loading…
Reference in New Issue