Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
James 2012-02-24 14:15:06 -05:00
commit 446233fbd4
75 changed files with 1982 additions and 2960 deletions

View file

@ -25,7 +25,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('preference')) ->add(new Zend_Acl_Resource('preference'))
->add(new Zend_Acl_Resource('recorder')) ->add(new Zend_Acl_Resource('recorder'))
->add(new Zend_Acl_Resource('showbuilder')) ->add(new Zend_Acl_Resource('showbuilder'))
->add(new Zend_Acl_Resource('auth')); ->add(new Zend_Acl_Resource('auth'))
->add(new Zend_Acl_Resource('usersettings'));
/** Creating permissions */ /** Creating permissions */
$ccAcl->allow('G', 'index') $ccAcl->allow('G', 'index')
@ -34,11 +35,10 @@ $ccAcl->allow('G', 'index')
->allow('G', 'nowplaying') ->allow('G', 'nowplaying')
->allow('G', 'api') ->allow('G', 'api')
->allow('G', 'auth') ->allow('G', 'auth')
//->allow('G', 'plupload', array('upload-recorded'))
->allow('G', 'recorder') ->allow('G', 'recorder')
->allow('G', 'schedule') ->allow('G', 'schedule')
->allow('G', 'dashboard') ->allow('G', 'dashboard')
//->allow('H', 'plupload', array('plupload', 'upload', 'index')) ->allow('H', 'usersettings')
->allow('H', 'plupload') ->allow('H', 'plupload')
->allow('H', 'library') ->allow('H', 'library')
->allow('H', 'search') ->allow('H', 'search')

View file

@ -1,6 +1,6 @@
<?php <?php
define('AIRTIME_COPYRIGHT_DATE', '2010-2011'); define('AIRTIME_COPYRIGHT_DATE', '2010-2012');
define('AIRTIME_REST_VERSION', '1.1'); define('AIRTIME_REST_VERSION', '1.1');
define('AIRTIME_API_VERSION', '1.0'); define('AIRTIME_API_VERSION', '1.0');

View file

@ -24,7 +24,6 @@ class ApiController extends Zend_Controller_Action
->addActionContext('status', 'json') ->addActionContext('status', 'json')
->addActionContext('register-component', 'json') ->addActionContext('register-component', 'json')
->addActionContext('update-liquidsoap-status', 'json') ->addActionContext('update-liquidsoap-status', 'json')
->addActionContext('library-init', 'json')
->addActionContext('live-chat', 'json') ->addActionContext('live-chat', 'json')
->addActionContext('update-file-system-mount', 'json') ->addActionContext('update-file-system-mount', 'json')
->addActionContext('handle-watched-dir-missing', 'json') ->addActionContext('handle-watched-dir-missing', 'json')
@ -64,7 +63,7 @@ class ApiController extends Zend_Controller_Action
$jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion())); $jsonStr = json_encode(array("version"=>Application_Model_Preference::GetAirtimeVersion()));
echo $jsonStr; echo $jsonStr;
} }
/** /**
* Sets up and send init values used in the Calendar. * Sets up and send init values used in the Calendar.
* This is only being used by schedule.js at the moment. * This is only being used by schedule.js at the moment.
@ -72,16 +71,16 @@ class ApiController extends Zend_Controller_Action
public function calendarInitAction(){ public function calendarInitAction(){
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) { if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
return; return;
} }
$this->view->calendarInit = array( $this->view->calendarInit = array(
"timestamp" => time(), "timestamp" => time(),
"timezoneOffset" => date("Z"), "timezoneOffset" => date("Z"),
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(), "timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
"weekStartDay" => Application_Model_Preference::GetWeekStartDay() "weekStartDay" => Application_Model_Preference::GetWeekStartDay()
@ -178,9 +177,9 @@ class ApiController extends Zend_Controller_Action
* Retrieve the currently playing show as well as upcoming shows. * Retrieve the currently playing show as well as upcoming shows.
* Number of shows returned and the time interval in which to * Number of shows returned and the time interval in which to
* get the next shows can be configured as GET parameters. * get the next shows can be configured as GET parameters.
* *
* TODO: in the future, make interval length a parameter instead of hardcode to 48 * TODO: in the future, make interval length a parameter instead of hardcode to 48
* *
* Possible parameters: * Possible parameters:
* type - Can have values of "endofday" or "interval". If set to "endofday", * type - Can have values of "endofday" or "interval". If set to "endofday",
* the function will retrieve shows from now to end of day. * the function will retrieve shows from now to end of day.
@ -199,19 +198,19 @@ class ApiController extends Zend_Controller_Action
$date = new Application_Model_DateHelper; $date = new Application_Model_DateHelper;
$utcTimeNow = $date->getUtcTimestamp(); $utcTimeNow = $date->getUtcTimestamp();
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day $utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
$request = $this->getRequest(); $request = $this->getRequest();
$type = $request->getParam('type'); $type = $request->getParam('type');
if($type == "endofday") { if($type == "endofday") {
// make GetNextShows use end of day // make GetNextShows use end of day
$utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc(); $utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
} }
$limit = $request->getParam('limit'); $limit = $request->getParam('limit');
if($limit == "" || !is_numeric($limit)) { if($limit == "" || !is_numeric($limit)) {
$limit = "5"; $limit = "5";
} }
$result = array("env"=>APPLICATION_ENV, $result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"), "schedulerTime"=>gmdate("Y-m-d H:i:s"),
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow), "currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
@ -219,7 +218,7 @@ class ApiController extends Zend_Controller_Action
"timezone"=> date("T"), "timezone"=> date("T"),
"timezoneOffset"=> date("Z"), "timezoneOffset"=> date("Z"),
"AIRTIME_API_VERSION"=>AIRTIME_API_VERSION); //used by caller to determine if the airtime they are running or widgets in use is out of date. "AIRTIME_API_VERSION"=>AIRTIME_API_VERSION); //used by caller to determine if the airtime they are running or widgets in use is out of date.
//Convert from UTC to localtime for user. //Convert from UTC to localtime for user.
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
@ -233,7 +232,7 @@ class ApiController extends Zend_Controller_Action
exit; exit;
} }
} }
public function weekInfoAction() public function weekInfoAction()
{ {
if (Application_Model_Preference::GetAllow3rdPartyApi()){ if (Application_Model_Preference::GetAllow3rdPartyApi()){
@ -244,7 +243,7 @@ class ApiController extends Zend_Controller_Action
$date = new Application_Model_DateHelper; $date = new Application_Model_DateHelper;
$dayStart = $date->getWeekStartDate(); $dayStart = $date->getWeekStartDate();
$utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart); $utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart);
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"); $dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
$result = array(); $result = array();
@ -252,9 +251,9 @@ class ApiController extends Zend_Controller_Action
$utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart); $utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart);
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd); $shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
$utcDayStart = $utcDayEnd; $utcDayStart = $utcDayEnd;
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
$result[$dow[$i]] = $shows; $result[$dow[$i]] = $shows;
} }
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date. $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
@ -373,8 +372,8 @@ class ApiController extends Zend_Controller_Action
$now = new DateTime($today_timestamp); $now = new DateTime($today_timestamp);
$end_timestamp = $now->add(new DateInterval("PT2H")); $end_timestamp = $now->add(new DateInterval("PT2H"));
$end_timestamp = $end_timestamp->format("Y-m-d H:i:s"); $end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
$this->view->shows = Application_Model_Show::getShows(Application_Model_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()), $this->view->shows = Application_Model_Show::getShows(Application_Model_DateHelper::ConvertToUtcDateTime($today_timestamp, date_default_timezone_get()),
Application_Model_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()), Application_Model_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()),
$excludeInstance=NULL, $onlyRecord=TRUE); $excludeInstance=NULL, $onlyRecord=TRUE);
@ -405,7 +404,7 @@ class ApiController extends Zend_Controller_Action
$upload_dir = ini_get("upload_tmp_dir"); $upload_dir = ini_get("upload_tmp_dir");
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir); $tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
$tempFileName = basename($tempFilePath); $tempFileName = basename($tempFilePath);
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : ''; $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName); $result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
if (isset($result)){ if (isset($result)){
@ -456,19 +455,19 @@ class ApiController extends Zend_Controller_Action
} }
if (isset($show_name)) { if (isset($show_name)) {
$show_name = str_replace(" ", "-", $show_name); $show_name = str_replace(" ", "-", $show_name);
//2011-12-09-19-28-00-ofirrr-256kbps //2011-12-09-19-28-00-ofirrr-256kbps
$filename = $file->getName(); $filename = $file->getName();
//replace the showname in the filepath incase it has been edited since the show started recording //replace the showname in the filepath incase it has been edited since the show started recording
//(some old bug) //(some old bug)
$filename_parts = explode("-", $filename); $filename_parts = explode("-", $filename);
$new_name = array_slice($filename_parts, 0, 6); $new_name = array_slice($filename_parts, 0, 6);
$new_name[] = $show_name; $new_name[] = $show_name;
$new_name[] = $filename_parts[count($filename_parts)-1]; $new_name[] = $filename_parts[count($filename_parts)-1];
$tmpTitle = implode("-", $new_name); $tmpTitle = implode("-", $new_name);
} }
else { else {
@ -533,7 +532,7 @@ class ApiController extends Zend_Controller_Action
} }
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory(); $this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
$watchedDirs = Application_Model_MusicDir::getWatchedDirs(); $watchedDirs = Application_Model_MusicDir::getWatchedDirs();
$watchedDirsPath = array(); $watchedDirsPath = array();
foreach($watchedDirs as $wd){ foreach($watchedDirs as $wd){
@ -573,7 +572,7 @@ class ApiController extends Zend_Controller_Action
$filepath = str_replace("//", "/", $filepath); $filepath = str_replace("//", "/", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath); $file = Application_Model_StoredFile::RecallByFilepath($filepath);
if (is_null($file)) { if (is_null($file)) {
$file = Application_Model_StoredFile::Insert($md); $file = Application_Model_StoredFile::Insert($md);
} }
@ -737,10 +736,10 @@ class ApiController extends Zend_Controller_Action
$this->view->msg = Application_Model_MusicDir::setStorDir($path); $this->view->msg = Application_Model_MusicDir::setStorDir($path);
} }
public function getStreamSettingAction() { public function getStreamSettingAction() {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"])) if (!in_array($api_key, $CC_CONFIG["apiKey"]))
@ -752,10 +751,10 @@ class ApiController extends Zend_Controller_Action
$this->view->msg = Application_Model_StreamSetting::getStreamSetting(); $this->view->msg = Application_Model_StreamSetting::getStreamSetting();
} }
public function statusAction() { public function statusAction() {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
$getDiskInfo = $request->getParam('diskinfo') == "true"; $getDiskInfo = $request->getParam('diskinfo') == "true";
@ -767,7 +766,7 @@ class ApiController extends Zend_Controller_Action
exit; exit;
} }
*/ */
$status = array( $status = array(
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(), "platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(), "airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
@ -778,11 +777,11 @@ class ApiController extends Zend_Controller_Action
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus() "media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
) )
); );
if ($getDiskInfo){ if ($getDiskInfo){
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo(); $status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
} }
$this->view->status = $status; $this->view->status = $status;
} }
@ -795,40 +794,21 @@ class ApiController extends Zend_Controller_Action
Application_Model_ServiceRegister::Register($component, $remoteAddr); Application_Model_ServiceRegister::Register($component, $remoteAddr);
} }
public function updateLiquidsoapStatusAction(){ public function updateLiquidsoapStatusAction(){
$request = $this->getRequest(); $request = $this->getRequest();
$msg = $request->getParam('msg'); $msg = $request->getParam('msg');
$stream_id = $request->getParam('stream_id'); $stream_id = $request->getParam('stream_id');
$boot_time = $request->getParam('boot_time'); $boot_time = $request->getParam('boot_time');
Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time); Application_Model_StreamSetting::setLiquidsoapError($stream_id, $msg, $boot_time);
} }
/**
* Sets up and send init values used in the Library.
* This is being used by library.js
*/
public function libraryInitAction(){
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if(is_null(Zend_Auth::getInstance()->getStorage()->read())) {
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
return;
}
$this->view->libraryInit = array(
"numEntries"=>Application_Model_Preference::GetLibraryNumEntries()
);
}
// handles addition/deletion of mount point which watched dirs reside // handles addition/deletion of mount point which watched dirs reside
public function updateFileSystemMountAction(){ public function updateFileSystemMountAction(){
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"])) if (!in_array($api_key, $CC_CONFIG["apiKey"]))
@ -841,16 +821,16 @@ class ApiController extends Zend_Controller_Action
$params = $request->getParams(); $params = $request->getParams();
$added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']); $added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']);
$removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']); $removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']);
// get all watched dirs // get all watched dirs
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null); $watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
foreach( $added_list as $ad){ foreach( $added_list as $ad){
foreach( $watched_dirs as $dir ){ foreach( $watched_dirs as $dir ){
$dirPath = $dir->getDirectory(); $dirPath = $dir->getDirectory();
$ad .= '/'; $ad .= '/';
// if mount path itself was watched // if mount path itself was watched
if($dirPath == $ad){ if($dirPath == $ad){
Application_Model_MusicDir::addWatchedDir($dirPath, false); Application_Model_MusicDir::addWatchedDir($dirPath, false);
@ -883,7 +863,7 @@ class ApiController extends Zend_Controller_Action
// is new mount point within the watched dir? // is new mount point within the watched dir?
// pyinotify doesn't notify anyhing in this case, so we walk through all files within // pyinotify doesn't notify anyhing in this case, so we walk through all files within
// this watched dir in DB and mark them deleted. // this watched dir in DB and mark them deleted.
// In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to // In case of h) of use cases, due to pyinotify behaviour of noticing mounted dir, we need to
// compare agaisnt all files in cc_files table // compare agaisnt all files in cc_files table
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){ else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
$watchDir = Application_Model_MusicDir::getDirByPath($rd); $watchDir = Application_Model_MusicDir::getDirByPath($rd);
@ -902,13 +882,13 @@ class ApiController extends Zend_Controller_Action
} }
} }
} }
} }
// handles case where watched dir is missing // handles case where watched dir is missing
public function handleWatchedDirMissingAction(){ public function handleWatchedDirMissingAction(){
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"])) if (!in_array($api_key, $CC_CONFIG["apiKey"]))
@ -917,7 +897,7 @@ class ApiController extends Zend_Controller_Action
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
exit; exit;
} }
$dir = base64_decode($request->getParam('dir')); $dir = base64_decode($request->getParam('dir'));
Application_Model_MusicDir::removeWatchedDir($dir, false); Application_Model_MusicDir::removeWatchedDir($dir, false);
} }

View file

@ -47,7 +47,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorderResize.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -79,6 +79,10 @@ class LibraryController extends Zend_Controller_Action
$file = Application_Model_StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
if (isset($this->pl_sess->id) && $screen == "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "copy");
}
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}"); $menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
if ($user->isAdmin()) { if ($user->isAdmin()) {
@ -282,14 +286,4 @@ class LibraryController extends Zend_Controller_Action
$this->view->error_msg = $file->getSoundCloudErrorMsg(); $this->view->error_msg = $file->getSoundCloudErrorMsg();
} }
} }
/**
* Stores the number of entries user chose to show in the Library
* to the pref db
*/
public function setNumEntriesAction() {
$request = $this->getRequest();
$numEntries = $request->getParam('numEntries');
Application_Model_Preference::SetLibraryNumEntries($numEntries);
}
} }

View file

@ -15,25 +15,25 @@ class NowplayingController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time //nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$refer_sses = new Zend_Session_Namespace('referrer'); $refer_sses = new Zend_Session_Namespace('referrer');
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
if ($request->isPost()) { if ($request->isPost()) {
$form = new Application_Form_RegisterAirtime(); $form = new Application_Form_RegisterAirtime();
$values = $request->getPost(); $values = $request->getPost();
if ($values["Publicise"] != 1 && $form->isValid($values)){ if ($values["Publicise"] != 1 && $form->isValid($values)){
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
@ -49,10 +49,10 @@ class NowplayingController extends Zend_Controller_Action
Application_Model_Preference::SetEmail($values["Email"]); Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetPublicise($values["Publicise"]); Application_Model_Preference::SetPublicise($values["Publicise"]);
$form->Logo->receive(); $form->Logo->receive();
$imagePath = $form->Logo->getFileName(); $imagePath = $form->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["Country"]); Application_Model_Preference::SetStationCountry($values["Country"]);
Application_Model_Preference::SetStationCity($values["City"]); Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]); Application_Model_Preference::SetStationDescription($values["Description"]);
@ -75,10 +75,10 @@ class NowplayingController extends Zend_Controller_Action
//popup if previous page was login //popup if previous page was login
if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp() if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){ && !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
$form = new Application_Form_RegisterAirtime(); $form = new Application_Form_RegisterAirtime();
$logo = Application_Model_Preference::GetStationLogo(); $logo = Application_Model_Preference::GetStationLogo();
if($logo){ if($logo){
$this->view->logoImg = $logo; $this->view->logoImg = $logo;
@ -94,7 +94,7 @@ class NowplayingController extends Zend_Controller_Action
$viewType = $this->_request->getParam('view'); $viewType = $this->_request->getParam('view');
$dateString = $this->_request->getParam('date'); $dateString = $this->_request->getParam('date');
$this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString); $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString);
} }
/* /*
public function livestreamAction() public function livestreamAction()
@ -107,16 +107,16 @@ class NowplayingController extends Zend_Controller_Action
public function dayViewAction() public function dayViewAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time //nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
} }
@ -127,7 +127,7 @@ class NowplayingController extends Zend_Controller_Action
Application_Model_Preference::SetRemindMeDate(); Application_Model_Preference::SetRemindMeDate();
die(); die();
} }
public function donotshowregistrationpopupAction() public function donotshowregistrationpopupAction()
{ {
// unset session // unset session

View file

@ -30,6 +30,12 @@ class PlaylistController extends Zend_Controller_Action
if (isset($this->pl_sess->id)) { if (isset($this->pl_sess->id)) {
$pl = new Application_Model_Playlist($this->pl_sess->id); $pl = new Application_Model_Playlist($this->pl_sess->id);
$modified = $this->_getParam('modified', null);
if ($pl->getLastModified("U") !== $modified) {
$this->createFullResponse($pl);
throw new PlaylistOutDatedException("You are viewing an older version of {$pl->getName()}");
}
} }
return $pl; return $pl;
} }
@ -46,11 +52,14 @@ class PlaylistController extends Zend_Controller_Action
private function createUpdateResponse($pl) private function createUpdateResponse($pl)
{ {
$formatter = new LengthFormatter($pl->getLength());
$this->view->length = $formatter->format();
$this->view->pl = $pl; $this->view->pl = $pl;
$this->view->html = $this->view->render('playlist/update.phtml'); $this->view->html = $this->view->render('playlist/update.phtml');
$this->view->name = $pl->getName(); $this->view->name = $pl->getName();
$this->view->length = $pl->getLength();
$this->view->description = $pl->getDescription(); $this->view->description = $pl->getDescription();
$this->view->modified = $pl->getLastModified("U");
unset($this->view->pl); unset($this->view->pl);
} }
@ -58,6 +67,9 @@ class PlaylistController extends Zend_Controller_Action
private function createFullResponse($pl = null) private function createFullResponse($pl = null)
{ {
if (isset($pl)) { if (isset($pl)) {
$formatter = new LengthFormatter($pl->getLength());
$this->view->length = $formatter->format();
$this->view->pl = $pl; $this->view->pl = $pl;
$this->view->id = $pl->getId(); $this->view->id = $pl->getId();
$this->view->html = $this->view->render('playlist/index.phtml'); $this->view->html = $this->view->render('playlist/index.phtml');
@ -68,10 +80,33 @@ class PlaylistController extends Zend_Controller_Action
} }
} }
private function playlistOutdated($pl, $e)
{
$this->view->error = $e->getMessage();
}
private function playlistNotFound()
{
$this->view->error = "Playlist not found";
Logging::log("Playlist not found");
$this->changePlaylist(null);
$this->createFullResponse(null);
}
private function playlistUnknownError($e)
{
$this->view->error = "Something went wrong.";
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
}
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -81,18 +116,19 @@ class PlaylistController extends Zend_Controller_Action
$this->_helper->viewRenderer->setResponseSegment('spl'); $this->_helper->viewRenderer->setResponseSegment('spl');
try { try {
$pl = $this->getPlaylist(); if (isset($this->pl_sess->id)) {
$pl = new Application_Model_Playlist($this->pl_sess->id);
$this->view->pl = $pl;
if (isset($pl)) { $formatter = new LengthFormatter($pl->getLength());
$this->view->pl = $pl; $this->view->length = $formatter->format();
} }
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getMessage()}"); $this->playlistUnknownError($e);
} }
} }
@ -119,20 +155,15 @@ class PlaylistController extends Zend_Controller_Action
} }
try { try {
$pl = $this->getPlaylist(); $pl = new Application_Model_Playlist($id);
$this->createFullResponse($pl);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist {$id} not found"); $this->playlistNotFound();
$this->changePlaylist(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
$this->changePlaylist(null);
} }
$this->createFullResponse($pl);
} }
public function deleteAction() public function deleteAction()
@ -150,23 +181,18 @@ class PlaylistController extends Zend_Controller_Action
} }
else { else {
Logging::log("Not deleting currently active playlist"); Logging::log("Not deleting currently active playlist");
$pl = new Application_Model_Playlist($this->pl_sess->id);
} }
Application_Model_Playlist::DeletePlaylists($ids); Application_Model_Playlist::DeletePlaylists($ids);
$pl = $this->getPlaylist(); $this->createFullResponse($pl);
} }
catch(PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$pl = null;
} }
catch(Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
$this->createFullResponse($pl);
} }
public function addItemsAction() public function addItemsAction()
@ -176,24 +202,20 @@ class PlaylistController extends Zend_Controller_Action
$afterItem = $this->_getParam('afterItem', null); $afterItem = $this->_getParam('afterItem', null);
$addType = $this->_getParam('type', 'after'); $addType = $this->_getParam('type', 'after');
Logging::log("type is ".$addType);
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->addAudioClips($ids, $afterItem, $addType); $pl->addAudioClips($ids, $afterItem, $addType);
$this->createUpdateResponse($pl);
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
$this->createUpdateResponse($pl);
} }
public function moveItemsAction() public function moveItemsAction()
@ -201,46 +223,44 @@ class PlaylistController extends Zend_Controller_Action
$ids = $this->_getParam('ids'); $ids = $this->_getParam('ids');
$ids = (!is_array($ids)) ? array($ids) : $ids; $ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null); $afterItem = $this->_getParam('afterItem', null);
$modified = $this->_getParam('modified');
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->moveAudioClips($ids, $afterItem); $pl->moveAudioClips($ids, $afterItem);
$this->createUpdateResponse($pl);
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
$this->createUpdateResponse($pl);
} }
public function deleteItemsAction() public function deleteItemsAction()
{ {
$ids = $this->_getParam('ids'); $ids = $this->_getParam('ids');
$ids = (!is_array($ids)) ? array($ids) : $ids; $ids = (!is_array($ids)) ? array($ids) : $ids;
$modified = $this->_getParam('modified');
try { try {
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->delAudioClips($ids); $pl->delAudioClips($ids);
$this->createUpdateResponse($pl);
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
$this->createUpdateResponse($pl);
} }
public function setCueAction() public function setCueAction()
@ -253,21 +273,22 @@ class PlaylistController extends Zend_Controller_Action
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$response = $pl->changeClipLength($id, $cueIn, $cueOut); $response = $pl->changeClipLength($id, $cueIn, $cueOut);
$this->view->response = $response; if (!isset($response["error"])) {
$this->view->response = $response;
if(!isset($response["error"])) {
$this->createUpdateResponse($pl); $this->createUpdateResponse($pl);
} }
else {
$this->view->cue_error = $response["error"];
}
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
} }
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
} }
@ -281,21 +302,22 @@ class PlaylistController extends Zend_Controller_Action
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$response = $pl->changeFadeInfo($id, $fadeIn, $fadeOut); $response = $pl->changeFadeInfo($id, $fadeIn, $fadeOut);
$this->view->response = $response;
if (!isset($response["error"])) { if (!isset($response["error"])) {
$this->createUpdateResponse($pl); $this->createUpdateResponse($pl);
$this->view->response = $response;
}
else {
$this->view->fade_error = $response["error"];
} }
} }
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
}
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
} }
@ -309,15 +331,14 @@ class PlaylistController extends Zend_Controller_Action
$fades = $pl->getFadeInfo($pl->getSize()-1); $fades = $pl->getFadeInfo($pl->getSize()-1);
$this->view->fadeOut = $fades[1]; $this->view->fadeOut = $fades[1];
} }
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
}
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
} }
@ -335,15 +356,14 @@ class PlaylistController extends Zend_Controller_Action
$pl = $this->getPlaylist(); $pl = $this->getPlaylist();
$pl->setPlaylistfades($fadeIn, $fadeOut); $pl->setPlaylistfades($fadeIn, $fadeOut);
} }
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
}
catch (PlaylistNotFoundException $e) { catch (PlaylistNotFoundException $e) {
Logging::log("Playlist not found"); $this->playlistNotFound();
$this->changePlaylist(null);
$this->createFullResponse(null);
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log("{$e->getFile()}"); $this->playlistUnknownError($e);
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
} }
} }
@ -351,33 +371,42 @@ class PlaylistController extends Zend_Controller_Action
{ {
$name = $this->_getParam('name', 'Unknown Playlist'); $name = $this->_getParam('name', 'Unknown Playlist');
$pl = $this->getPlaylist(); try {
if($pl === false){ $pl = $this->getPlaylist();
$this->view->playlist_error = true; $pl->setName($name);
return false; $this->view->playlistName = $name;
$this->view->modified = $pl->getLastModified("U");
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);
}
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound();
}
catch (Exception $e) {
$this->playlistUnknownError($e);
} }
$pl->setName($name);
$this->view->playlistName = $name;
} }
public function setPlaylistDescriptionAction() public function setPlaylistDescriptionAction()
{ {
$description = $this->_getParam('description', false); $description = $this->_getParam('description', "");
$pl = $this->getPlaylist();
if($pl === false){
$this->view->playlist_error = true;
return false;
}
if($description != false) { try {
$pl = $this->getPlaylist();
$pl->setDescription($description); $pl->setDescription($description);
$this->view->description = $pl->getDescription();
$this->view->modified = $pl->getLastModified("U");
} }
else { catch (PlaylistOutDatedException $e) {
$description = $pl->getDescription(); $this->playlistOutdated($pl, $e);
}
catch (PlaylistNotFoundException $e) {
$this->playlistNotFound();
}
catch (Exception $e) {
$this->playlistUnknownError($e);
} }
$this->view->playlistDescription = $description;
} }
} }

View file

@ -20,7 +20,7 @@ class PreferenceController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -59,7 +59,7 @@ class PreferenceController extends Zend_Controller_Action
public function supportSettingAction() public function supportSettingAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -119,7 +119,7 @@ class PreferenceController extends Zend_Controller_Action
public function directoryConfigAction() public function directoryConfigAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -136,7 +136,7 @@ class PreferenceController extends Zend_Controller_Action
public function streamSettingAction() public function streamSettingAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
@ -206,10 +206,10 @@ class PreferenceController extends Zend_Controller_Action
$values['output_sound_device'] = $form->getValue('output_sound_device'); $values['output_sound_device'] = $form->getValue('output_sound_device');
} }
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); $values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
$values['streamFormat'] = $form->getValue('streamFormat'); $values['streamFormat'] = $form->getValue('streamFormat');
} }
if(!$error){ if(!$error){

View file

@ -15,12 +15,9 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('move-show', 'json') ->addActionContext('move-show', 'json')
->addActionContext('resize-show', 'json') ->addActionContext('resize-show', 'json')
->addActionContext('delete-show', 'json') ->addActionContext('delete-show', 'json')
->addActionContext('schedule-show', 'json')
->addActionContext('schedule-show-dialog', 'json')
->addActionContext('show-content-dialog', 'json') ->addActionContext('show-content-dialog', 'json')
->addActionContext('clear-show', 'json') ->addActionContext('clear-show', 'json')
->addActionContext('get-current-playlist', 'json') ->addActionContext('get-current-playlist', 'json')
->addActionContext('find-playlists', 'json')
->addActionContext('remove-group', 'json') ->addActionContext('remove-group', 'json')
->addActionContext('edit-show', 'json') ->addActionContext('edit-show', 'json')
->addActionContext('add-show', 'json') ->addActionContext('add-show', 'json')
@ -43,8 +40,6 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time //full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds"); $this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
@ -264,37 +259,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->items = $menu; $this->view->items = $menu;
} }
public function scheduleShowAction()
{
$showInstanceId = $this->sched_sess->showInstanceId;
$search = $this->_getParam('search', null);
$plId = $this->_getParam('plId');
if($search == "") {
$search = null;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
try{
$show = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){
$this->view->show_error = true;
return false;
}
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) {
$show->scheduleShow(array($plId));
}
$this->view->showContent = $show->getShowContent();
$this->view->timeFilled = $show->getTimeScheduled();
$this->view->percentFilled = $show->getPercentScheduled();
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
unset($this->view->showContent);
}
public function clearShowAction() public function clearShowAction()
{ {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
@ -336,27 +300,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->entries = $range; $this->view->entries = $range;
} }
public function findPlaylistsAction()
{
$post = $this->getRequest()->getPost();
try{
$show = new Application_Model_ShowInstance($this->sched_sess->showInstanceId);
}catch(Exception $e){
$this->view->show_error = true;
return false;
}
$playlists = $show->searchPlaylistsForShow($post);
foreach( $playlists['aaData'] as &$data){
// calling two functions to format time to 1 decimal place
$sec = Application_Model_Playlist::playlistTimeToSeconds($data['length']);
$data['length'] = Application_Model_Playlist::secondsToPlaylistTime($sec);
}
//for datatables
die(json_encode($playlists));
}
public function removeGroupAction() public function removeGroupAction()
{ {
$showInstanceId = $this->sched_sess->showInstanceId; $showInstanceId = $this->sched_sess->showInstanceId;
@ -383,44 +326,6 @@ class ScheduleController extends Zend_Controller_Action
unset($this->view->showContent); unset($this->view->showContent);
} }
public function scheduleShowDialogAction()
{
$showInstanceId = $this->_getParam('id');
$this->sched_sess->showInstanceId = $showInstanceId;
try{
$show = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){
$this->view->show_error = true;
return false;
}
$start_timestamp = $show->getShowInstanceStart();
$end_timestamp = $show->getShowInstanceEnd();
$dateInfo_s = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($start_timestamp)));
$dateInfo_e = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($end_timestamp)));
$this->view->showContent = $show->getShowContent();
$this->view->timeFilled = $show->getTimeScheduled();
$this->view->showName = $show->getName();
$this->view->showLength = $show->getShowLength();
$this->view->percentFilled = $show->getPercentScheduled();
$this->view->s_wday = $dateInfo_s['weekday'];
$this->view->s_month = $dateInfo_s['month'];
$this->view->s_day = $dateInfo_s['mday'];
$this->view->e_wday = $dateInfo_e['weekday'];
$this->view->e_month = $dateInfo_e['month'];
$this->view->e_day = $dateInfo_e['mday'];
$this->view->startTime = sprintf("%02d:%02d", $dateInfo_s['hours'], $dateInfo_s['minutes']);
$this->view->endTime = sprintf("%02d:%02d", $dateInfo_e['hours'], $dateInfo_e['minutes']);
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
$this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');
unset($this->view->showContent);
}
public function showContentDialogAction() public function showContentDialogAction()
{ {
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');

View file

@ -83,8 +83,8 @@ class ShowbuilderController extends Zend_Controller_Action
public function scheduleAddAction() { public function scheduleAddAction() {
$request = $this->getRequest(); $request = $this->getRequest();
$mediaItems = $request->getParam("mediaIds", null); $mediaItems = $request->getParam("mediaIds", array());
$scheduledIds = $request->getParam("schedIds", null); $scheduledIds = $request->getParam("schedIds", array());
try { try {
$scheduler = new Application_Model_Scheduler(); $scheduler = new Application_Model_Scheduler();
@ -102,14 +102,12 @@ class ShowbuilderController extends Zend_Controller_Action
Logging::log("{$e->getFile()}"); Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}"); Logging::log("{$e->getLine()}");
} }
$this->view->data = $json;
} }
public function scheduleRemoveAction() public function scheduleRemoveAction()
{ {
$request = $this->getRequest(); $request = $this->getRequest();
$items = $request->getParam("items", null); $items = $request->getParam("items", array());
try { try {
$scheduler = new Application_Model_Scheduler(); $scheduler = new Application_Model_Scheduler();
@ -151,8 +149,6 @@ class ShowbuilderController extends Zend_Controller_Action
Logging::log("{$e->getFile()}"); Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}"); Logging::log("{$e->getLine()}");
} }
$this->view->data = $json;
} }
public function scheduleReorderAction() { public function scheduleReorderAction() {

View file

@ -0,0 +1,49 @@
<?php
class UsersettingsController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('get-library-datatable', 'json')
->addActionContext('set-library-datatable', 'json')
->addActionContext('get-timeline-datatable', 'json')
->addActionContext('set-timeline-datatable', 'json')
->initContext();
}
public function setLibraryDatatableAction() {
$request = $this->getRequest();
$settings = $request->getParam("settings");
$data = serialize($settings);
Application_Model_Preference::SetValue("library_datatable", $data, true);
}
public function getLibraryDatatableAction() {
$data = Application_Model_Preference::GetValue("library_datatable", true);
if ($data != "") {
$this->view->settings = unserialize($data);
}
}
public function setTimelineDatatableAction() {
$request = $this->getRequest();
$settings = $request->getParam("settings");
$data = serialize($settings);
Application_Model_Preference::SetValue("timeline_datatable", $data, true);
}
public function getTimelineDatatableAction() {
$data = Application_Model_Preference::GetValue("timeline_datatable", true);
if ($data != "") {
$this->view->settings = unserialize($data);
}
}
}

View file

@ -22,7 +22,7 @@
<div class="wrapper"> <div class="wrapper">
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist--> <!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div> <div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="show_builder" style="width:500px;" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div> <div id="show_builder" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -22,7 +22,7 @@
<div class="wrapper"> <div class="wrapper">
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist--> <!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div> <div id="library_content" class="ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->spl ?></div> <div id="side_playlist" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->spl ?></div>
</div> </div>
</body> </body>

View file

@ -1,5 +1,7 @@
<?php <?php
require_once 'formatters/LengthFormatter.php';
/** /**
* *
* @package Airtime * @package Airtime
@ -89,7 +91,7 @@ class Application_Model_Playlist {
public function setName($p_newname) public function setName($p_newname)
{ {
$this->pl->setDbName($p_newname); $this->pl->setDbName($p_newname);
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
} }
@ -106,7 +108,7 @@ class Application_Model_Playlist {
public function setDescription($p_description) public function setDescription($p_description)
{ {
$this->pl->setDbDescription($p_description); $this->pl->setDbDescription($p_description);
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
} }
@ -123,7 +125,7 @@ class Application_Model_Playlist {
public function setCreator($p_id) { public function setCreator($p_id) {
$this->pl->setDbCreatorId($p_id); $this->pl->setDbCreatorId($p_id);
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
} }
@ -158,9 +160,15 @@ class Application_Model_Playlist {
$clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']); $clipSec = Application_Model_Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
//$files[$i]['cliplength'] = Application_Model_Playlist::secondsToPlaylistTime($clipSec);
$offset += $clipSec; $offset += $clipSec;
$files[$i]['offset'] = Application_Model_Playlist::secondsToPlaylistTime($offset); $offset_cliplength = Application_Model_Playlist::secondsToPlaylistTime($offset);
//format the length for UI.
$formatter = new LengthFormatter($files[$i]['cliplength']);
$files[$i]['cliplength'] = $formatter->format();
$formatter = new LengthFormatter($offset_cliplength);
$files[$i]['offset'] = $formatter->format();
$i++; $i++;
} }
@ -218,13 +226,18 @@ class Application_Model_Playlist {
{ {
$file = CcFilesQuery::create()->findPK($p_item, $this->con); $file = CcFilesQuery::create()->findPK($p_item, $this->con);
$entry = $this->plItem; if (isset($file) && $file->getDbFileExists()) {
$entry["id"] = $file->getDbId(); $entry = $this->plItem;
$entry["pos"] = $pos; $entry["id"] = $file->getDbId();
$entry["cliplength"] = $file->getDbLength(); $entry["pos"] = $pos;
$entry["cueout"] = $file->getDbLength(); $entry["cliplength"] = $file->getDbLength();
$entry["cueout"] = $file->getDbLength();
return $entry; return $entry;
}
else {
throw new Exception("trying to add a file that does not exist.");
}
} }
/* /*
@ -300,7 +313,7 @@ class Application_Model_Playlist {
$pos = $pos + 1; $pos = $pos + 1;
} }
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
$this->con->commit(); $this->con->commit();
@ -383,7 +396,7 @@ class Application_Model_Playlist {
$this->pl = CcPlaylistQuery::create()->findPK($this->id); $this->pl = CcPlaylistQuery::create()->findPK($this->id);
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
} }
@ -415,7 +428,7 @@ class Application_Model_Playlist {
$contents[$i]->save($this->con); $contents[$i]->save($this->con);
} }
$this->pl->setDbMtime(new DateTime("now"), new DateTimeZone("UTC")); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con); $this->pl->save($this->con);
$this->con->commit(); $this->con->commit();
@ -462,47 +475,52 @@ class Application_Model_Playlist {
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn; $fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut; $fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
$this->con->beginTransaction();
$errArray= array(); $errArray= array();
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
$row = CcPlaylistcontentsQuery::create()->findPK($id);
if (is_null($row)) {
$errArray["error"]="Playlist item does not exist.";
return $errArray;
}
$clipLength = $row->getDbCliplength();
if(!is_null($fadeIn)) {
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
$r = $con->query($sql);
if($r->fetchColumn(0)) {
//"Fade In can't be larger than overall playlength.";
$fadeIn = $clipLength;
}
$row->setDbFadein($fadeIn);
}
if(!is_null($fadeOut)){
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
$r = $con->query($sql);
if($r->fetchColumn(0)) {
//Fade Out can't be larger than overall playlength.";
$fadeOut = $clipLength;
}
$row->setDbFadeout($fadeOut);
}
try { try {
$row->save(); $row = CcPlaylistcontentsQuery::create()->findPK($id);
if (is_null($row)) {
throw new Exception("Playlist item does not exist.");
}
$clipLength = $row->getDbCliplength();
if (!is_null($fadeIn)) {
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$clipLength}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)) {
//"Fade In can't be larger than overall playlength.";
$fadeIn = $clipLength;
}
$row->setDbFadein($fadeIn);
}
if (!is_null($fadeOut)){
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$clipLength}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)) {
//Fade Out can't be larger than overall playlength.";
$fadeOut = $clipLength;
}
$row->setDbFadeout($fadeOut);
}
$row->save($this->con);
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
$this->pl->save($this->con);
$this->con->commit();
} }
catch (Exception $e) { catch (Exception $e) {
Logging::log($e->getMessage()); $this->con->rollback();
throw $e;
} }
return array("fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut); return array("fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
} }
public function setPlaylistfades($fadein, $fadeout) { public function setPlaylistfades($fadein, $fadeout) {
@ -512,7 +530,7 @@ class Application_Model_Playlist {
$row = CcPlaylistcontentsQuery::create() $row = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id) ->filterByDbPlaylistId($this->id)
->filterByDbPosition(0) ->filterByDbPosition(0)
->findOne(); ->findOne($this->con);
$this->changeFadeInfo($row->getDbId(), $fadein, null); $this->changeFadeInfo($row->getDbId(), $fadein, null);
} }
@ -521,7 +539,7 @@ class Application_Model_Playlist {
$row = CcPlaylistcontentsQuery::create() $row = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id) ->filterByDbPlaylistId($this->id)
->filterByDbPosition($this->getSize()-1) ->filterByDbPosition($this->getSize()-1)
->findOne(); ->findOne($this->con);
$this->changeFadeInfo($row->getDbId(), null, $fadeout); $this->changeFadeInfo($row->getDbId(), null, $fadeout);
} }
@ -540,126 +558,135 @@ class Application_Model_Playlist {
*/ */
public function changeClipLength($id, $cueIn, $cueOut) public function changeClipLength($id, $cueIn, $cueOut)
{ {
$this->con->beginTransaction();
$errArray= array(); $errArray= array();
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
if (is_null($cueIn) && is_null($cueOut)) { try {
$errArray["error"]="Cue in and cue out are null."; if (is_null($cueIn) && is_null($cueOut)) {
return $errArray; $errArray["error"] = "Cue in and cue out are null.";
}
$row = CcPlaylistcontentsQuery::create()
->joinWith(CcFilesPeer::OM_CLASS)
->filterByPrimaryKey($id)
->findOne();
if (is_null($row)) {
$errArray["error"]="Playlist item does not exist!.";
return $errArray;
}
$oldCueIn = $row->getDBCuein();
$oldCueOut = $row->getDbCueout();
$fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
$file = $row->getCcFiles();
$origLength = $file->getDbLength();
if(!is_null($cueIn) && !is_null($cueOut)){
if($cueOut === ""){
$cueOut = $origLength;
}
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
$r = $con->query($sql);
if($r->fetchColumn(0)) {
$errArray["error"]= "Can't set cue in to be larger than cue out.";
return $errArray; return $errArray;
} }
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'"; $row = CcPlaylistcontentsQuery::create()
$r = $con->query($sql); ->joinWith(CcFilesPeer::OM_CLASS)
if($r->fetchColumn(0)){ ->filterByPrimaryKey($id)
$errArray["error"] = "Can't set cue out to be greater than file length."; ->findOne($this->con);
return $errArray;
if (is_null($row)) {
throw new Exception("Playlist item does not exist.");
} }
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'"; $oldCueIn = $row->getDBCuein();
$r = $con->query($sql); $oldCueOut = $row->getDbCueout();
$cliplength = $r->fetchColumn(0); $fadeIn = $row->getDbFadein();
$fadeOut = $row->getDbFadeout();
$row->setDbCuein($cueIn); $file = $row->getCcFiles($this->con);
$row->setDbCueout($cueOut); $origLength = $file->getDbLength();
$row->setDBCliplength($cliplength);
} if (!is_null($cueIn) && !is_null($cueOut)){
else if(!is_null($cueIn)) {
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'"; if ($cueOut === ""){
$r = $con->query($sql); $cueOut = $origLength;
if($r->fetchColumn(0)) { }
$errArray["error"] = "Can't set cue in to be larger than cue out.";
return $errArray; $sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$cueOut}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)){
$errArray["error"] = "Can't set cue out to be greater than file length.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
$r = $this->con->query($sql);
$cliplength = $r->fetchColumn(0);
$row->setDbCuein($cueIn);
$row->setDbCueout($cueOut);
$row->setDBCliplength($cliplength);
}
else if (!is_null($cueIn)) {
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)) {
$errArray["error"] = "Can't set cue in to be larger than cue out.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'";
$r = $this->con->query($sql);
$cliplength = $r->fetchColumn(0);
$row->setDbCuein($cueIn);
$row->setDBCliplength($cliplength);
}
else if (!is_null($cueOut)) {
if ($cueOut === ""){
$cueOut = $origLength;
}
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)) {
$errArray["error"] = "Can't set cue out to be smaller than cue in.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
$r = $this->con->query($sql);
if ($r->fetchColumn(0)){
$errArray["error"] = "Can't set cue out to be greater than file length.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
$r = $this->con->query($sql);
$cliplength = $r->fetchColumn(0);
$row->setDbCueout($cueOut);
$row->setDBCliplength($cliplength);
} }
$sql = "SELECT INTERVAL '{$oldCueOut}' - INTERVAL '{$cueIn}'"; $cliplength = $row->getDbCliplength();
$r = $con->query($sql);
$cliplength = $r->fetchColumn(0);
$row->setDbCuein($cueIn); $sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
$row->setDBCliplength($cliplength); $r = $this->con->query($sql);
} if ($r->fetchColumn(0)){
else if(!is_null($cueOut)) { $fadeIn = $cliplength;
$row->setDbFadein($fadeIn);
if($cueOut === ""){
$cueOut = $origLength;
} }
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'"; $sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
$r = $con->query($sql); $r = $this->con->query($sql);
if($r->fetchColumn(0)) { if ($r->fetchColumn(0)){
$errArray["error"] ="Can't set cue out to be smaller than cue in."; $fadeOut = $cliplength;
return $errArray; $row->setDbFadein($fadeOut);
} }
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'"; $row->save($this->con);
$r = $con->query($sql); $this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
if($r->fetchColumn(0)){ $this->pl->save($this->con);
$errArray["error"] ="Can't set cue out to be greater than file length.";
return $errArray;
}
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'"; $this->con->commit();
$r = $con->query($sql); }
$cliplength = $r->fetchColumn(0); catch (Exception $e) {
$this->con->rollback();
$row->setDbCueout($cueOut); throw $e;
$row->setDBCliplength($cliplength);
} }
$cliplength = $row->getDbCliplength(); return array("cliplength"=> $cliplength, "cueIn"=> $cueIn, "cueOut"=> $cueOut, "length"=> $this->getLength(),
"fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
$r = $con->query($sql);
if($r->fetchColumn(0)){
$fadeIn = $cliplength;
$row->setDbFadein($fadeIn);
}
$sql = "SELECT INTERVAL '{$fadeOut}' > INTERVAL '{$cliplength}'";
$r = $con->query($sql);
if($r->fetchColumn(0)){
$fadeOut = $cliplength;
$row->setDbFadein($fadeOut);
}
$row->save();
return array("cliplength"=>$cliplength, "cueIn"=>$cueIn, "cueOut"=>$cueOut, "length"=>$this->getLength(),
"fadeIn"=>$fadeIn, "fadeOut"=>$fadeOut);
} }
public function getAllPLMetaData() public function getAllPLMetaData()

View file

@ -38,6 +38,7 @@ class Application_Model_Scheduler {
$data = $this->fileInfo; $data = $this->fileInfo;
$data["id"] = $id; $data["id"] = $id;
$data["cliplength"] = $file->getDbLength(); $data["cliplength"] = $file->getDbLength();
$data["cueout"] = $file->getDbLength();
$files[] = $data; $files[] = $data;
} }

View file

@ -1396,7 +1396,7 @@ class Application_Model_Show {
Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp); Application_Model_Preference::SetShowsPopulatedUntil($end_timestamp);
} }
$sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name, $sql = "SELECT starts, ends, record, rebroadcast, instance_id, show_id, name,
color, background_color, file_id, cc_show_instances.id AS instance_id color, background_color, file_id, cc_show_instances.id AS instance_id
FROM cc_show_instances FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
@ -1538,7 +1538,7 @@ class Application_Model_Show {
$event["end"] = $endDateTime->format("Y-m-d H:i:s"); $event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["endUnix"] = $endDateTime->format("U"); $event["endUnix"] = $endDateTime->format("U");
$event["allDay"] = false; $event["allDay"] = false;
$event["description"] = $show["description"]; //$event["description"] = $show["description"];
$event["showId"] = intval($show["show_id"]); $event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]); $event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]); $event["rebroadcast"] = intval($show["rebroadcast"]);

View file

@ -1,5 +1,7 @@
<?php <?php
require_once 'formatters/LengthFormatter.php';
class Application_Model_ShowBuilder { class Application_Model_ShowBuilder {
private $timezone; private $timezone;
@ -9,12 +11,13 @@ class Application_Model_ShowBuilder {
private $opts; private $opts;
private $contentDT; private $contentDT;
private $epoch_now;
private $defaultRowArray = array( private $defaultRowArray = array(
"header" => false, "header" => false,
"footer" => false, "footer" => false,
"empty" => false, "empty" => false,
"checkbox" => false, "allowed" => false,
"id" => 0, "id" => 0,
"instance" => "", "instance" => "",
"starts" => "", "starts" => "",
@ -37,26 +40,7 @@ class Application_Model_ShowBuilder {
$this->timezone = date_default_timezone_get(); $this->timezone = date_default_timezone_get();
$this->user = Application_Model_User::GetCurrentUser(); $this->user = Application_Model_User::GetCurrentUser();
$this->opts = $p_opts; $this->opts = $p_opts;
} $this->epoch_now = time();
/*
* @param DateInterval $p_interval
*
* @return string $runtime
*/
private function formatDuration($p_interval){
$hours = $p_interval->format("%h");
$mins = $p_interval->format("%i");
if( $hours == 0) {
$runtime = $p_interval->format("%i:%S");
}
else {
$runtime = $p_interval->format("%h:%I:%S");
}
return $runtime;
} }
private function formatTimeFilled($p_sec) { private function formatTimeFilled($p_sec) {
@ -89,6 +73,7 @@ class Application_Model_ShowBuilder {
private function makeFooterRow($p_item) { private function makeFooterRow($p_item) {
$row = $this->defaultRowArray; $row = $this->defaultRowArray;
$this->isAllowed($p_item, $row);
$row["footer"] = true; $row["footer"] = true;
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
@ -101,6 +86,39 @@ class Application_Model_ShowBuilder {
return $row; return $row;
} }
private function isAllowed($p_item, &$row) {
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
//can only schedule the show if it hasn't started and you are allowed.
if ($this->epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
$row["allowed"] = true;
}
}
private function getItemStatus($p_item, &$row) {
$showEndDT = new DateTime($p_item["si_ends"]);
$schedStartDT = new DateTime($p_item["sched_starts"]);
$schedEndDT = new DateTime($p_item["sched_ends"]);
$showEndEpoch = intval($showEndDT->format("U"));
$schedStartEpoch = intval($schedStartDT->format("U"));
$schedEndEpoch = intval($schedEndDT->format("U"));
if ($schedEndEpoch < $showEndEpoch) {
$status = 0; //item will playout in full
}
else if ($schedStartEpoch < $showEndEpoch && $schedEndEpoch > $showEndEpoch) {
$status = 1; //item is on boundry
}
else {
$status = 2; //item is overscheduled won't play.
}
$row["status"] = $status;
}
private function getRowTimestamp($p_item, &$row) { private function getRowTimestamp($p_item, &$row) {
if (is_null($p_item["si_last_scheduled"])) { if (is_null($p_item["si_last_scheduled"])) {
@ -116,7 +134,9 @@ class Application_Model_ShowBuilder {
private function makeHeaderRow($p_item) { private function makeHeaderRow($p_item) {
$row = $this->defaultRowArray; $row = $this->defaultRowArray;
$this->getRowTimestamp($p_item, &$row); $this->isAllowed($p_item, $row);
Logging::log("making header for show id ".$p_item["show_id"]);
$this->getRowTimestamp($p_item, $row);
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
$showStartDT->setTimezone(new DateTimeZone($this->timezone)); $showStartDT->setTimezone(new DateTimeZone($this->timezone));
@ -137,15 +157,9 @@ class Application_Model_ShowBuilder {
private function makeScheduledItemRow($p_item) { private function makeScheduledItemRow($p_item) {
$row = $this->defaultRowArray; $row = $this->defaultRowArray;
$epoch_now = time();
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); $this->isAllowed($p_item, $row);
$this->getRowTimestamp($p_item, &$row); $this->getRowTimestamp($p_item, $row);
//can only schedule the show if it hasn't started and you are allowed.
if ($epoch_now < $showStartDT->format('U') && $this->user->canSchedule($p_item["show_id"]) == true) {
$row["checkbox"] = true;
}
if (isset($p_item["sched_starts"])) { if (isset($p_item["sched_starts"])) {
@ -154,13 +168,16 @@ class Application_Model_ShowBuilder {
$schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC")); $schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC"));
$schedEndDT->setTimezone(new DateTimeZone($this->timezone)); $schedEndDT->setTimezone(new DateTimeZone($this->timezone));
$runtime = $schedStartDT->diff($schedEndDT); $this->getItemStatus($p_item, $row);
$row["id"] = intval($p_item["sched_id"]); $row["id"] = intval($p_item["sched_id"]);
$row["instance"] = intval($p_item["si_id"]); $row["instance"] = intval($p_item["si_id"]);
$row["starts"] = $schedStartDT->format("H:i:s"); $row["starts"] = $schedStartDT->format("H:i:s");
$row["ends"] = $schedEndDT->format("H:i:s"); $row["ends"] = $schedEndDT->format("H:i:s");
$row["runtime"] = $this->formatDuration($runtime);
$formatter = new LengthFormatter($p_item['file_length']);
$row['runtime'] = $formatter->format();
$row["title"] = $p_item["file_track_title"]; $row["title"] = $p_item["file_track_title"];
$row["creator"] = $p_item["file_artist_name"]; $row["creator"] = $p_item["file_artist_name"];
$row["album"] = $p_item["file_album_title"]; $row["album"] = $p_item["file_album_title"];
@ -172,6 +189,8 @@ class Application_Model_ShowBuilder {
$row["empty"] = true; $row["empty"] = true;
$row["id"] = 0 ; $row["id"] = 0 ;
$row["instance"] = intval($p_item["si_id"]); $row["instance"] = intval($p_item["si_id"]);
//return null;
} }
return $row; return $row;
@ -219,7 +238,11 @@ class Application_Model_ShowBuilder {
} }
//make a normal data row. //make a normal data row.
$display_items[] = $this->makeScheduledItemRow($item); $row = $this->makeScheduledItemRow($item);
//don't display the empty rows.
if (isset($row)) {
$display_items[] = $row;
}
} }
//make the last footer if there were any scheduled items. //make the last footer if there were any scheduled items.

View file

@ -1,5 +1,7 @@
<?php <?php
require_once 'formatters/LengthFormatter.php';
class Application_Model_ShowInstance { class Application_Model_ShowInstance {
private $_instanceId; private $_instanceId;
@ -599,9 +601,14 @@ class Application_Model_ShowInstance {
{ {
$time = $this->_showInstance->getDbTimeFilled(); $time = $this->_showInstance->getDbTimeFilled();
if(is_null($time)) { if (is_null($time)) {
$time = "00:00:00"; $time = "00:00:00";
} }
else {
$formatter = new LengthFormatter($time);
$time = $formatter->format();
}
return $time; return $time;
} }
@ -631,15 +638,11 @@ class Application_Model_ShowInstance {
public function getShowLength() public function getShowLength()
{ {
global $CC_DBC; $start = $this->getShowInstanceStart(null);
$end = $this->getShowInstanceEnd(null);
$start_timestamp = $this->getShowInstanceStart(); $interval = $start->diff($end);
$end_timestamp = $this->getShowInstanceEnd(); return $interval->format("%h:%I:%S");
$sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' ";
$length = $CC_DBC->GetOne($sql);
return $length;
} }
public function searchPlaylistsForShow($datatables) public function searchPlaylistsForShow($datatables)
@ -657,47 +660,22 @@ class Application_Model_ShowInstance {
WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts"; WHERE s.instance_id = '{$this->_instanceId}' ORDER BY starts";
return $CC_DBC->GetAll($sql); Logging::log($sql);
}
public function getShowContent() $results = $CC_DBC->GetAll($sql);
{
global $CC_DBC;
$res = $this->getShowListContent(); foreach ($results as &$row) {
if(count($res) <= 0) { $dt = new DateTime($row["starts"], new DateTimeZone("UTC"));
return $res; $dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
$row["starts"] = $dt->format("Y-m-d H:i:s");
$formatter = new LengthFormatter($row["clip_length"]);
$row["clip_length"] = $formatter->format();
} }
$items = array();
$currGroupId = -1;
$pl_counter = -1;
$f_counter = -1;
foreach ($res as $row) {
if($currGroupId != $row["group_id"]){
$currGroupId = $row["group_id"];
$pl_counter = $pl_counter + 1;
$f_counter = -1;
$items[$pl_counter]["pl_name"] = $row["name"]; return $results;
$items[$pl_counter]["pl_creator"] = $row["creator"];
$items[$pl_counter]["pl_description"] = $row["description"];
$items[$pl_counter]["pl_group"] = $row["group_id"];
$sql = "SELECT SUM(clip_length) FROM cc_schedule WHERE group_id = '{$currGroupId}'";
$length = $CC_DBC->GetOne($sql);
$items[$pl_counter]["pl_length"] = $length;
}
$f_counter = $f_counter + 1;
$items[$pl_counter]["pl_content"][$f_counter]["f_name"] = $row["track_title"];
$items[$pl_counter]["pl_content"][$f_counter]["f_artist"] = $row["artist_name"];
$items[$pl_counter]["pl_content"][$f_counter]["f_length"] = $row["length"];
}
return $items;
} }
public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end) public static function GetShowsInstancesIdsInRange($p_timeNow, $p_start, $p_end)

View file

@ -1,312 +0,0 @@
<?
define('INDCH', ' ');
require_once("XmlParser.php");
/**
* SmilPlaylist class
*
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class SmilPlaylist {
/**
* Parse SMIL file or string
*
* @param string $data
* local path to SMIL file or SMIL string
* @param string $loc
* location: 'file'|'string'
* @return array
* reference, parse result tree (or PEAR::error)
*/
private static function &parse($data='', $loc='file')
{
return XmlParser::parse($data, $loc);
}
/**
* Import SMIL file to storage
*
* @param GreenBox $gb
* reference to GreenBox object
* @param string $aPath
* absolute path part of imported file (e.g. /home/user/airtime)
* @param string $rPath
* relative path/filename part of imported file
* (e.g. playlists/playlist_1.smil)
* @param array $gunids
* hash relation from filenames to gunids
* @param string $plid
* playlist gunid
* @param int $subjid
* local subject (user) id (id of user doing the import)
* @return Playlist
*/
public static function &import(&$gb, $aPath, $rPath, &$gunids, $plid, $subjid=NULL)
{
$parr = compact('subjid', 'aPath', 'plid', 'rPath');
$path = realpath("$aPath/$rPath");
if (FALSE === $path) {
return PEAR::raiseError(
"SmilPlaylist::import: file doesn't exist ($aPath/$rPath)"
);
}
$lspl = SmilPlaylist::convert2lspl($gb, $path, $gunids, $parr);
if (PEAR::isError($lspl)) {
return $lspl;
}
require_once("Playlist.php");
$pl =& Application_Model_Playlist::create($gb, $plid, "imported_SMIL");
if (PEAR::isError($pl)) {
return $pl;
}
$r = $pl->lock($gb, $subjid);
if (PEAR::isError($r)) {
return $r;
}
$r = $pl->setMetadata($lspl, 'string', 'playlist');
if (PEAR::isError($r)) {
return $r;
}
$r = $pl->unlock($gb);
if (PEAR::isError($r)) {
return $r;
}
return $pl;
}
/**
* Import SMIL file to storage.
*
* @param GreenBox $gb
* @param string $data
* local path to SMIL file
* @param hasharray $gunids
* hash relation from filenames to gunids
* @param array $parr
* array of subjid, aPath, plid, rPath
* @return string
* XML of playlist in Airtime playlist format
*/
public static function convert2lspl(&$gb, $data, &$gunids, $parr)
{
extract($parr);
$tree = SmilPlaylist::parse($data);
if (PEAR::isError($tree)) {
return $tree;
}
if ($tree->name != 'smil') {
return PEAR::raiseError("SmilPlaylist::parse: smil tag expected");
}
if (isset($tree->children[1])) {
return PEAR::raiseError(sprintf(
"SmilPlaylist::parse: unexpected tag %s in tag smil",
$tree->children[1]->name
));
}
$res = SmilPlaylistBodyElement::convert2lspl(
$gb, $tree->children[0], &$gunids, $parr);
return $res;
}
} // SmilPlaylist
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class SmilPlaylistBodyElement {
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
$ind2 = $ind.INDCH;
if ($tree->name != 'body') {
return PEAR::raiseError("SmilPlaylist::parse: body tag expected");
}
if (isset($tree->children[1])) {
return PEAR::raiseError(sprintf(
"SmilPlaylist::parse: unexpected tag %s in tag body",
$tree->children[1]->name
));
}
$res = SmilPlaylistParElement::convert2lspl(
$gb, $tree->children[0], &$gunids, $parr, $ind2);
if (PEAR::isError($res)) {
return $res;
}
$title = basename($rPath);
$playlength = '0';
$res = "$ind<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n".
"$ind<playlist id=\"$plid\" playlength=\"$playlength\" title=\"$title\">\n".
"$ind2<metadata/>\n".
"$res".
"$ind</playlist>\n";
return $res;
}
} // class SmilPlaylistBodyElement
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class SmilPlaylistParElement {
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
if ($tree->name != 'par') {
return PEAR::raiseError("SmilPlaylist::parse: par tag expected");
}
$res = '';
foreach ($tree->children as $i => $ch) {
$ch =& $tree->children[$i];
$r = SmilPlaylistAudioElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind.INDCH);
if (PEAR::isError($r)) {
return $r;
}
$res .= $r;
}
return $res;
}
}
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class SmilPlaylistAudioElement {
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
$uri = $tree->attrs['src']->val;
$gunid = ( isset($gunids[basename($uri)]) ? $gunids[basename($uri)] : NULL);
$ind2 = $ind.INDCH;
if ($tree->name != 'audio') {
return PEAR::raiseError("SmilPlaylist::parse: audio tag expected");
}
if (isset($tree->children[2])) {
return PEAR::raiseError(sprintf(
"SmilPlaylist::parse: unexpected tag %s in tag audio",
$tree->children[2]->name
));
}
$res = ''; $fadeIn = 0; $fadeOut = 0;
foreach ($tree->children as $i => $ch) {
$ch =& $tree->children[$i];
$r = SmilPlaylistAnimateElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind2);
if (PEAR::isError($r)) {
return $r;
}
switch ($r['type']) {
case "fadeIn": $fadeIn = $r['val']; break;
case "fadeOut": $fadeOut = $r['val']; break;
}
}
if ($fadeIn > 0 || $fadeOut > 0) {
$fiGunid = Application_Model_StoredFile::CreateGunid();
$fadeIn = Application_Model_Playlist::secondsToPlaylistTime($fadeIn);
$fadeOut = Application_Model_Playlist::secondsToPlaylistTime($fadeOut);
$fInfo = "$ind2<fadeInfo id=\"$fiGunid\" fadeIn=\"$fadeIn\" fadeOut=\"$fadeOut\"/>\n";
} else {
$fInfo = '';
}
$plElGunid = Application_Model_StoredFile::CreateGunid();
$acGunid = $gunid;
$type = 'audioClip';
if (preg_match("|\.([a-zA-Z0-9]+)$|", $uri, $va)) {
switch (strtolower($ext = $va[1])) {
case "lspl":
case "xml":
case "smil":
case "m3u":
$type = 'playlist';
$acId = $gb->bsImportPlaylistRaw($gunid,
$aPath, $uri, $ext, $gunids, $subjid);
if (PEAR::isError($acId)) {
return $r;
}
//break;
default:
$ac = Application_Model_StoredFile::RecallByGunid($gunid);
if (is_null($ac) || PEAR::isError($ac)) {
return $ac;
}
$r = $ac->md->getMetadataElement('dcterms:extent');
if (PEAR::isError($r)) {
return $r;
}
$playlength = $r[0]['value'];
}
}
$title = basename($tree->attrs['src']->val);
$offset = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
$clipStart = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
$clipEnd = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
$clipLength = Application_Model_Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
$res = "$ind<playlistElement id=\"$plElGunid\" relativeOffset=\"$offset\" clipStart=\"$clipStart\" clipEnd=\"$clipEnd\" clipLength=\"$clipLength\">\n".
"$ind2<$type id=\"$acGunid\" playlength=\"$playlength\" title=\"$title\"/>\n".
$fInfo.
"$ind</playlistElement>\n";
return $res;
}
} // class SmilPlaylistAudioElement
/**
* @package Airtime
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
class SmilPlaylistAnimateElement {
public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind='')
{
extract($parr);
if ($tree->name != 'animate') {
return PEAR::raiseError("SmilPlaylist::parse: animate tag expected");
}
if ($tree->attrs['attributeName']->val == 'soundLevel' &&
$tree->attrs['from']->val == '0%' &&
$tree->attrs['to']->val == '100%' &&
$tree->attrs['calcMode']->val == 'linear' &&
$tree->attrs['fill']->val == 'freeze' &&
$tree->attrs['begin']->val == '0s' &&
preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $va)
) {
return array('type'=>'fadeIn', 'val'=>intval($va[1]));
}
if ($tree->attrs['attributeName']->val == 'soundLevel' &&
$tree->attrs['from']->val == '100%' &&
$tree->attrs['to']->val == '0%' &&
$tree->attrs['calcMode']->val == 'linear' &&
$tree->attrs['fill']->val == 'freeze' &&
preg_match("|^([0-9.]+)s$|", $tree->attrs['begin']->val, $vaBegin) &&
preg_match("|^([0-9.]+)s$|", $tree->attrs['end']->val, $vaEnd)
) {
return array('type'=>'fadeOut', 'val'=>($vaEnd[1] - $vaBegin[1]));
}
return PEAR::raiseError(
"SmilPlaylistAnimateElement::convert2lspl: animate parameters too general"
);
}
} // class SmilPlaylistAnimateElement

View file

@ -1,5 +1,9 @@
<?php <?php
require_once 'formatters/LengthFormatter.php';
require_once 'formatters/SamplerateFormatter.php';
require_once 'formatters/BitrateFormatter.php';
/** /**
* Application_Model_StoredFile class * Application_Model_StoredFile class
* *
@ -551,97 +555,98 @@ class Application_Model_StoredFile {
return $res; return $res;
} }
/* public static function searchFilesForPlaylistBuilder($datatables) {
* @param DateInterval $p_interval
*
* @return string $runtime
*/
private static function formatDuration($dt){
$hours = $dt->format("H"); $displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
$min = $dt->format("i"); "year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
$sec = $dt->format("s"); "bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "language"
);
$time = "PT{$hours}H{$min}M{$sec}S"; $plSelect = array();
$fileSelect = array();
foreach ($displayColumns as $key) {
$p_interval = new DateInterval($time); if ($key === "id") {
$plSelect[] = "PL.id AS ".$key;
$hours = $p_interval->format("%h"); $fileSelect[] = $key;
$mins = $p_interval->format("%i"); }
else if ($key === "track_title") {
if( $hours == 0) { $plSelect[] = "name AS ".$key;
$runtime = $p_interval->format("%i:%S"); $fileSelect[] = $key;
} }
else { else if ($key === "ftype") {
$runtime = $p_interval->format("%h:%I:%S"); $plSelect[] = "'playlist'::varchar AS ".$key;
} $fileSelect[] = $key;
}
return $runtime; else if ($key === "artist_name") {
} $plSelect[] = "login AS ".$key;
$fileSelect[] = $key;
public static function searchFilesForPlaylistBuilder($datatables) }
{ //same columns in each table.
global $CC_CONFIG; else if(in_array($key, array("length", "utime", "mtime"))) {
$plSelect[] = $key;
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype", "track_number"); $fileSelect[] = $key;
}
$plSelect = "SELECT "; else if ($key === "year") {
$fileSelect = "SELECT "; $plSelect[] = "EXTRACT(YEAR FROM utime)::varchar AS ".$key;
foreach ($displayData as $key) { $fileSelect[] = $key;
}
if ($key === "track_title") { //need to cast certain data as ints for the union to search on.
$plSelect .= "name AS ".$key.", "; else if (in_array($key, array("track_number"))){
$fileSelect .= $key.", "; $plSelect[] = "NULL::int AS ".$key;
} else if ($key === "ftype") { $fileSelect[] = $key;
$plSelect .= "'playlist' AS ".$key.", "; }
$fileSelect .= $key.", "; else {
} else if ($key === "artist_name") { $plSelect[] = "NULL::text AS ".$key;
$plSelect .= "login AS ".$key.", "; $fileSelect[] = $key;
$fileSelect .= $key.", ";
} else if ($key === "length") {
$plSelect .= $key.", ";
$fileSelect .= $key."::interval, ";
} else if ($key === "year") {
$plSelect .= "CAST(utime AS varchar) AS ".$key.", ";
$fileSelect .= $key.", ";
} else if ($key === "utime") {
$plSelect .= $key.", ";
$fileSelect .= $key.", ";
} else if ($key === "mtime") {
$plSelect .= $key.", ";
$fileSelect .= $key.", ";
} else if ($key === "track_number") {
$plSelect .= "NULL AS ".$key.", ";
$fileSelect .= $key.", ";
} else {
$plSelect .= "NULL AS ".$key.", ";
$fileSelect .= $key.", ";
} }
} }
$fromTable = " ((".$plSelect."PL.id $plSelect = "SELECT ". join(",", $plSelect);
FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id)) $fileSelect = "SELECT ". join(",", $fileSelect);
UNION
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables); $type = intval($datatables["type"]);
$plTable = "({$plSelect} FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))";
$fileTable = "({$fileSelect} FROM cc_files AS FILES WHERE file_exists = 'TRUE')";
$unionTable = "({$plTable} UNION {$fileTable} ) AS RESULTS";
//choose which table we need to select data from.
switch ($type) {
case 0:
$fromTable = $unionTable;
break;
case 1:
$fromTable = $fileTable." AS File"; //need an alias for the table if it's standalone.
break;
case 2:
$fromTable = $plTable." AS Playlist"; //need an alias for the table if it's standalone.
break;
default:
$fromTable = $unionTable;
}
$results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables);
foreach($results['aaData'] as &$row){ foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']); $row['id'] = intval($row['id']);
//$length = new DateTime($row['length']); $formatter = new LengthFormatter($row['length']);
//$row['length'] = self::formatDuration($length); $row['length'] = $formatter->format();
if ($row['ftype'] === "audioclip") {
$formatter = new SamplerateFormatter($row['sample_rate']);
$row['sample_rate'] = $formatter->format();
$formatter = new BitrateFormatter($row['bit_rate']);
$row['bit_rate'] = $formatter->format();
}
// add checkbox row // add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>"; $row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
// a full timestamp is being returned for playlists' year column;
// split it and grab only the year info
$yearSplit = explode('-', $row['year']);
$row['year'] = $yearSplit[0];
$type = substr($row['ftype'], 0, 2); $type = substr($row['ftype'], 0, 2);
$row['tr_id'] = "{$type}_{$row['id']}"; $row['tr_id'] = "{$type}_{$row['id']}";
@ -649,7 +654,7 @@ class Application_Model_StoredFile {
//TODO url like this to work on both playlist/showbuilder screens. //TODO url like this to work on both playlist/showbuilder screens.
//datatable stuff really needs to be pulled out and generalized within the project //datatable stuff really needs to be pulled out and generalized within the project
//access to zend view methods to access url helpers is needed. //access to zend view methods to access url helpers is needed.
if($type == "au") { if ($type == "au") {
$row['image'] = '<img src="/css/images/icon_audioclip.png">'; $row['image'] = '<img src="/css/images/icon_audioclip.png">';
} }
else { else {
@ -660,55 +665,35 @@ class Application_Model_StoredFile {
return $results; return $results;
} }
public static function searchPlaylistsForSchedule($datatables) public static function searchFiles($displayColumns, $fromTable, $data)
{
$fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id";
//$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'";
$datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'";
return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
}
public static function searchFiles($fromTable, $data)
{ {
global $CC_CONFIG, $CC_DBC; $con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
$where = array();
$columnsDisplayed = explode(",", $data["sColumns"]); if ($data["sSearch"] !== "") {
if($data["sSearch"] !== "")
$searchTerms = explode(" ", $data["sSearch"]); $searchTerms = explode(" ", $data["sSearch"]);
$selectorCount = "SELECT COUNT(*)";
foreach( $columnsDisplayed as $key=>$col){
if($col == ''){
unset($columnsDisplayed[$key]);
}
} }
//$selectorRows = "SELECT " . join(',', $columnsDisplayed );
$selectorRows = "SELECT * "; $selectorCount = "SELECT COUNT(*) ";
$selectorRows = "SELECT ".join(",", $displayColumns)." ";
$sql = $selectorCount." FROM ".$fromTable; $sql = $selectorCount." FROM ".$fromTable;
$totalRows = $CC_DBC->getOne($sql); $sqlTotalRows = $sql;
// Where clause if (isset($searchTerms)) {
if(isset($data["optWhere"])) {
$where[] = join(" AND ", $data["optWhere"]);
}
if(isset($searchTerms)) {
$searchCols = array(); $searchCols = array();
for($i=0; $i<$data["iColumns"]; $i++) { for ($i = 0; $i < $data["iColumns"]; $i++) {
if($data["bSearchable_".$i] == "true") { if ($data["bSearchable_".$i] == "true") {
$searchCols[] = $columnsDisplayed[$i]; $searchCols[] = $data["mDataProp_{$i}"];
} }
} }
$outerCond = array(); $outerCond = array();
foreach($searchTerms as $term) { foreach ($searchTerms as $term) {
$innerCond = array(); $innerCond = array();
foreach($searchCols as $col) { foreach ($searchCols as $col) {
$escapedTerm = pg_escape_string($term); $escapedTerm = pg_escape_string($term);
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'"; $innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
} }
@ -720,31 +705,47 @@ class Application_Model_StoredFile {
// Order By clause // Order By clause
$orderby = array(); $orderby = array();
for($i=0; $i<$data["iSortingCols"]; $i++){ for ($i = 0; $i < $data["iSortingCols"]; $i++){
$orderby[] = $columnsDisplayed[$data["iSortCol_".$i]]." ".$data["sSortDir_".$i]; $num = $data["iSortCol_".$i];
$orderby[] = $data["mDataProp_{$num}"]." ".$data["sSortDir_".$i];
} }
$orderby[] = "id"; $orderby[] = "id";
$orderby = join("," , $orderby); $orderby = join("," , $orderby);
// End Order By clause // End Order By clause
if(isset($where)) { if (count($where) > 0) {
$where = join(" AND ", $where); $where = join(" AND ", $where);
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where; $sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
$totalDisplayRows = $CC_DBC->getOne($sql); $sqlTotalDisplayRows = $sql;
$sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"]; $sql = $selectorRows." FROM ".$fromTable." WHERE ".$where." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
} }
else { else {
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"]; $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($sql);
$r->setFetchMode(PDO::FETCH_ASSOC);
$results = $r->fetchAll();
}
catch (Exception $e) {
Logging::log($e->getMessage());
}
//display sql executed in airtime log for testing //display sql executed in airtime log for testing
//Logging::log($sql); Logging::log($sql);
$results = $CC_DBC->getAll($sql);
if(!isset($totalDisplayRows)) {
$totalDisplayRows = $totalRows;
}
return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results); return array("sEcho" => intval($data["sEcho"]), "iTotalDisplayRecords" => $totalDisplayRows, "iTotalRecords" => $totalRows, "aaData" => $results);
} }

View file

@ -37,15 +37,16 @@ class Application_Model_User {
public function canSchedule($p_showId) { public function canSchedule($p_showId) {
$type = $this->getType(); $type = $this->getType();
$result = false;
if ( $type === UTYPE_ADMIN || if ( $type === UTYPE_ADMIN ||
$type === UTYPE_PROGRAM_MANAGER || $type === UTYPE_PROGRAM_MANAGER ||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 ) CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
{ {
return true; $result = true;
} }
return false; return $result;
} }
public function isUserType($type, $showId=''){ public function isUserType($type, $showId=''){
@ -240,6 +241,7 @@ class Application_Model_User {
public static function getUsersDataTablesInfo($datatables_post) { public static function getUsersDataTablesInfo($datatables_post) {
$displayColumns = array("id", "login", "first_name", "last_name", "type");
$fromTable = "cc_subjs"; $fromTable = "cc_subjs";
// get current user // get current user
@ -250,7 +252,7 @@ class Application_Model_User {
$username = $auth->getIdentity()->login; $username = $auth->getIdentity()->login;
} }
$res = Application_Model_StoredFile::searchFiles($fromTable, $datatables_post); $res = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables_post);
// mark record which is for the current user // mark record which is for the current user
foreach($res['aaData'] as &$record){ foreach($res['aaData'] as &$record){

View file

@ -57,7 +57,7 @@ class CcFilesTableMap extends TableMap {
$this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null); $this->addColumn('BIT_RATE', 'DbBitRate', 'VARCHAR', false, 32, null);
$this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null); $this->addColumn('SAMPLE_RATE', 'DbSampleRate', 'VARCHAR', false, 32, null);
$this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null); $this->addColumn('FORMAT', 'DbFormat', 'VARCHAR', false, 128, null);
$this->addColumn('LENGTH', 'DbLength', 'TIME', false, null, null); $this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null); $this->addColumn('ALBUM_TITLE', 'DbAlbumTitle', 'VARCHAR', false, 512, null);
$this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null); $this->addColumn('GENRE', 'DbGenre', 'VARCHAR', false, 64, null);
$this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null); $this->addColumn('COMMENTS', 'DbComments', 'LONGVARCHAR', false, null, null);

View file

@ -39,17 +39,14 @@ class CcScheduleTableMap extends TableMap {
$this->setPrimaryKeyMethodInfo('cc_schedule_id_seq'); $this->setPrimaryKeyMethodInfo('cc_schedule_id_seq');
// columns // columns
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null); $this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
$this->addColumn('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', false, null, null);
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null); $this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null); $this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addColumn('GROUP_ID', 'DbGroupId', 'INTEGER', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null); $this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00'); $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00'); $this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00'); $this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00'); $this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00');
$this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00'); $this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
$this->addColumn('SCHEDULE_GROUP_PLAYED', 'DbScheduleGroupPlayed', 'BOOLEAN', false, null, false);
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false); $this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null); $this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
// validators // validators

View file

@ -146,6 +146,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
/** /**
* The value for the length field. * The value for the length field.
* Note: this column has a database default value of: '00:00:00'
* @var string * @var string
*/ */
protected $length; protected $length;
@ -456,6 +457,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
$this->filepath = ''; $this->filepath = '';
$this->state = 'empty'; $this->state = 'empty';
$this->currentlyaccessing = 0; $this->currentlyaccessing = 0;
$this->length = '00:00:00';
$this->file_exists = true; $this->file_exists = true;
} }
@ -729,36 +731,13 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
} }
/** /**
* Get the [optionally formatted] temporal [length] column value. * Get the [length] column value.
* *
* * @return string
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
*/ */
public function getDbLength($format = '%X') public function getDbLength()
{ {
if ($this->length === null) { return $this->length;
return null;
}
try {
$dt = new DateTime($this->length);
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->length, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
} }
/** /**
@ -1657,50 +1636,21 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
} // setDbFormat() } // setDbFormat()
/** /**
* Sets the value of [length] column to a normalized version of the date/time value specified. * Set the value of [length] column.
* *
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will * @param string $v new value
* be treated as NULL for temporal objects.
* @return CcFiles The current object (for fluent API support) * @return CcFiles The current object (for fluent API support)
*/ */
public function setDbLength($v) public function setDbLength($v)
{ {
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now') if ($v !== null) {
// -- which is unexpected, to say the least. $v = (string) $v;
if ($v === null || $v === '') {
$dt = null;
} elseif ($v instanceof DateTime) {
$dt = $v;
} else {
// some string/numeric value passed; we normalize that so that we can
// validate it.
try {
if (is_numeric($v)) { // if it's a unix timestamp
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
// We have to explicitly specify and then change the time zone because of a
// DateTime bug: http://bugs.php.net/bug.php?id=43003
$dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
} else {
$dt = new DateTime($v);
}
} catch (Exception $x) {
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
}
} }
if ( $this->length !== null || $dt !== null ) { if ($this->length !== $v || $this->isNew()) {
// (nested ifs are a little easier to read in this case) $this->length = $v;
$this->modifiedColumns[] = CcFilesPeer::LENGTH;
$currNorm = ($this->length !== null && $tmpDt = new DateTime($this->length)) ? $tmpDt->format('H:i:s') : null; }
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
if ( ($currNorm !== $newNorm) // normalized values don't match
)
{
$this->length = ($dt ? $dt->format('H:i:s') : null);
$this->modifiedColumns[] = CcFilesPeer::LENGTH;
}
} // if either are not null
return $this; return $this;
} // setDbLength() } // setDbLength()
@ -2579,6 +2529,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
return false; return false;
} }
if ($this->length !== '00:00:00') {
return false;
}
if ($this->file_exists !== true) { if ($this->file_exists !== true) {
return false; return false;
} }

View file

@ -863,29 +863,20 @@ abstract class BaseCcFilesQuery extends ModelCriteria
/** /**
* Filter the query on the length column * Filter the query on the length column
* *
* @param string|array $dbLength The value to use as filter. * @param string $dbLength The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue) * Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return CcFilesQuery The current query, for fluid interface * @return CcFilesQuery The current query, for fluid interface
*/ */
public function filterByDbLength($dbLength = null, $comparison = null) public function filterByDbLength($dbLength = null, $comparison = null)
{ {
if (is_array($dbLength)) { if (null === $comparison) {
$useMinMax = false; if (is_array($dbLength)) {
if (isset($dbLength['min'])) {
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbLength['max'])) {
$this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $dbLength)) {
$dbLength = str_replace('*', '%', $dbLength);
$comparison = Criteria::LIKE;
} }
} }
return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison); return $this->addUsingAlias(CcFilesPeer::LENGTH, $dbLength, $comparison);

View file

@ -30,12 +30,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
protected $id; protected $id;
/**
* The value for the playlist_id field.
* @var int
*/
protected $playlist_id;
/** /**
* The value for the starts field. * The value for the starts field.
* @var string * @var string
@ -48,12 +42,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
protected $ends; protected $ends;
/**
* The value for the group_id field.
* @var int
*/
protected $group_id;
/** /**
* The value for the file_id field. * The value for the file_id field.
* @var int * @var int
@ -95,13 +83,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
protected $cue_out; protected $cue_out;
/**
* The value for the schedule_group_played field.
* Note: this column has a database default value of: false
* @var boolean
*/
protected $schedule_group_played;
/** /**
* The value for the media_item_played field. * The value for the media_item_played field.
* Note: this column has a database default value of: false * Note: this column has a database default value of: false
@ -155,7 +136,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->fade_out = '00:00:00'; $this->fade_out = '00:00:00';
$this->cue_in = '00:00:00'; $this->cue_in = '00:00:00';
$this->cue_out = '00:00:00'; $this->cue_out = '00:00:00';
$this->schedule_group_played = false;
$this->media_item_played = false; $this->media_item_played = false;
} }
@ -179,16 +159,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->id; return $this->id;
} }
/**
* Get the [playlist_id] column value.
*
* @return int
*/
public function getDbPlaylistId()
{
return $this->playlist_id;
}
/** /**
* Get the [optionally formatted] temporal [starts] column value. * Get the [optionally formatted] temporal [starts] column value.
* *
@ -255,16 +225,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} }
} }
/**
* Get the [group_id] column value.
*
* @return int
*/
public function getDbGroupId()
{
return $this->group_id;
}
/** /**
* Get the [file_id] column value. * Get the [file_id] column value.
* *
@ -440,16 +400,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} }
} }
/**
* Get the [schedule_group_played] column value.
*
* @return boolean
*/
public function getDbScheduleGroupPlayed()
{
return $this->schedule_group_played;
}
/** /**
* Get the [media_item_played] column value. * Get the [media_item_played] column value.
* *
@ -490,26 +440,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this; return $this;
} // setDbId() } // setDbId()
/**
* Set the value of [playlist_id] column.
*
* @param int $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbPlaylistId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->playlist_id !== $v) {
$this->playlist_id = $v;
$this->modifiedColumns[] = CcSchedulePeer::PLAYLIST_ID;
}
return $this;
} // setDbPlaylistId()
/** /**
* Sets the value of [starts] column to a normalized version of the date/time value specified. * Sets the value of [starts] column to a normalized version of the date/time value specified.
* *
@ -608,26 +538,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this; return $this;
} // setDbEnds() } // setDbEnds()
/**
* Set the value of [group_id] column.
*
* @param int $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbGroupId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->group_id !== $v) {
$this->group_id = $v;
$this->modifiedColumns[] = CcSchedulePeer::GROUP_ID;
}
return $this;
} // setDbGroupId()
/** /**
* Set the value of [file_id] column. * Set the value of [file_id] column.
* *
@ -902,26 +812,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this; return $this;
} // setDbCueOut() } // setDbCueOut()
/**
* Set the value of [schedule_group_played] column.
*
* @param boolean $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbScheduleGroupPlayed($v)
{
if ($v !== null) {
$v = (boolean) $v;
}
if ($this->schedule_group_played !== $v || $this->isNew()) {
$this->schedule_group_played = $v;
$this->modifiedColumns[] = CcSchedulePeer::SCHEDULE_GROUP_PLAYED;
}
return $this;
} // setDbScheduleGroupPlayed()
/** /**
* Set the value of [media_item_played] column. * Set the value of [media_item_played] column.
* *
@ -996,10 +886,6 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return false; return false;
} }
if ($this->schedule_group_played !== false) {
return false;
}
if ($this->media_item_played !== false) { if ($this->media_item_played !== false) {
return false; return false;
} }
@ -1027,19 +913,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
try { try {
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->playlist_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null; $this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->starts = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null; $this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->ends = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null; $this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->group_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null; $this->clip_length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->file_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null; $this->fade_in = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->clip_length = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->fade_out = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->fade_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; $this->cue_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->fade_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; $this->cue_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->cue_in = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; $this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
$this->cue_out = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
$this->schedule_group_played = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
$this->media_item_played = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
$this->instance_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
$this->resetModified(); $this->resetModified();
$this->setNew(false); $this->setNew(false);
@ -1048,7 +931,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->ensureConsistency(); $this->ensureConsistency();
} }
return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS). return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) { } catch (Exception $e) {
throw new PropelException("Error populating CcSchedule object", $e); throw new PropelException("Error populating CcSchedule object", $e);
@ -1398,42 +1281,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->getDbId(); return $this->getDbId();
break; break;
case 1: case 1:
return $this->getDbPlaylistId();
break;
case 2:
return $this->getDbStarts(); return $this->getDbStarts();
break; break;
case 3: case 2:
return $this->getDbEnds(); return $this->getDbEnds();
break; break;
case 4: case 3:
return $this->getDbGroupId();
break;
case 5:
return $this->getDbFileId(); return $this->getDbFileId();
break; break;
case 6: case 4:
return $this->getDbClipLength(); return $this->getDbClipLength();
break; break;
case 7: case 5:
return $this->getDbFadeIn(); return $this->getDbFadeIn();
break; break;
case 8: case 6:
return $this->getDbFadeOut(); return $this->getDbFadeOut();
break; break;
case 9: case 7:
return $this->getDbCueIn(); return $this->getDbCueIn();
break; break;
case 10: case 8:
return $this->getDbCueOut(); return $this->getDbCueOut();
break; break;
case 11: case 9:
return $this->getDbScheduleGroupPlayed();
break;
case 12:
return $this->getDbMediaItemPlayed(); return $this->getDbMediaItemPlayed();
break; break;
case 13: case 10:
return $this->getDbInstanceId(); return $this->getDbInstanceId();
break; break;
default: default:
@ -1461,19 +1335,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$keys = CcSchedulePeer::getFieldNames($keyType); $keys = CcSchedulePeer::getFieldNames($keyType);
$result = array( $result = array(
$keys[0] => $this->getDbId(), $keys[0] => $this->getDbId(),
$keys[1] => $this->getDbPlaylistId(), $keys[1] => $this->getDbStarts(),
$keys[2] => $this->getDbStarts(), $keys[2] => $this->getDbEnds(),
$keys[3] => $this->getDbEnds(), $keys[3] => $this->getDbFileId(),
$keys[4] => $this->getDbGroupId(), $keys[4] => $this->getDbClipLength(),
$keys[5] => $this->getDbFileId(), $keys[5] => $this->getDbFadeIn(),
$keys[6] => $this->getDbClipLength(), $keys[6] => $this->getDbFadeOut(),
$keys[7] => $this->getDbFadeIn(), $keys[7] => $this->getDbCueIn(),
$keys[8] => $this->getDbFadeOut(), $keys[8] => $this->getDbCueOut(),
$keys[9] => $this->getDbCueIn(), $keys[9] => $this->getDbMediaItemPlayed(),
$keys[10] => $this->getDbCueOut(), $keys[10] => $this->getDbInstanceId(),
$keys[11] => $this->getDbScheduleGroupPlayed(),
$keys[12] => $this->getDbMediaItemPlayed(),
$keys[13] => $this->getDbInstanceId(),
); );
if ($includeForeignObjects) { if ($includeForeignObjects) {
if (null !== $this->aCcShowInstances) { if (null !== $this->aCcShowInstances) {
@ -1517,42 +1388,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->setDbId($value); $this->setDbId($value);
break; break;
case 1: case 1:
$this->setDbPlaylistId($value);
break;
case 2:
$this->setDbStarts($value); $this->setDbStarts($value);
break; break;
case 3: case 2:
$this->setDbEnds($value); $this->setDbEnds($value);
break; break;
case 4: case 3:
$this->setDbGroupId($value);
break;
case 5:
$this->setDbFileId($value); $this->setDbFileId($value);
break; break;
case 6: case 4:
$this->setDbClipLength($value); $this->setDbClipLength($value);
break; break;
case 7: case 5:
$this->setDbFadeIn($value); $this->setDbFadeIn($value);
break; break;
case 8: case 6:
$this->setDbFadeOut($value); $this->setDbFadeOut($value);
break; break;
case 9: case 7:
$this->setDbCueIn($value); $this->setDbCueIn($value);
break; break;
case 10: case 8:
$this->setDbCueOut($value); $this->setDbCueOut($value);
break; break;
case 11: case 9:
$this->setDbScheduleGroupPlayed($value);
break;
case 12:
$this->setDbMediaItemPlayed($value); $this->setDbMediaItemPlayed($value);
break; break;
case 13: case 10:
$this->setDbInstanceId($value); $this->setDbInstanceId($value);
break; break;
} // switch() } // switch()
@ -1580,19 +1442,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$keys = CcSchedulePeer::getFieldNames($keyType); $keys = CcSchedulePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]); if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setDbPlaylistId($arr[$keys[1]]); if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbStarts($arr[$keys[2]]); if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbEnds($arr[$keys[3]]); if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbGroupId($arr[$keys[4]]); if (array_key_exists($keys[4], $arr)) $this->setDbClipLength($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbFileId($arr[$keys[5]]); if (array_key_exists($keys[5], $arr)) $this->setDbFadeIn($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbClipLength($arr[$keys[6]]); if (array_key_exists($keys[6], $arr)) $this->setDbFadeOut($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbFadeIn($arr[$keys[7]]); if (array_key_exists($keys[7], $arr)) $this->setDbCueIn($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbFadeOut($arr[$keys[8]]); if (array_key_exists($keys[8], $arr)) $this->setDbCueOut($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbCueIn($arr[$keys[9]]); if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbCueOut($arr[$keys[10]]); if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbScheduleGroupPlayed($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbMediaItemPlayed($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDbInstanceId($arr[$keys[13]]);
} }
/** /**
@ -1605,17 +1464,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$criteria = new Criteria(CcSchedulePeer::DATABASE_NAME); $criteria = new Criteria(CcSchedulePeer::DATABASE_NAME);
if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id); if ($this->isColumnModified(CcSchedulePeer::ID)) $criteria->add(CcSchedulePeer::ID, $this->id);
if ($this->isColumnModified(CcSchedulePeer::PLAYLIST_ID)) $criteria->add(CcSchedulePeer::PLAYLIST_ID, $this->playlist_id);
if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts); if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends); if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
if ($this->isColumnModified(CcSchedulePeer::GROUP_ID)) $criteria->add(CcSchedulePeer::GROUP_ID, $this->group_id);
if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id); if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length); if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length);
if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in); if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in);
if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out); if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out);
if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in); if ($this->isColumnModified(CcSchedulePeer::CUE_IN)) $criteria->add(CcSchedulePeer::CUE_IN, $this->cue_in);
if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out); if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
if ($this->isColumnModified(CcSchedulePeer::SCHEDULE_GROUP_PLAYED)) $criteria->add(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $this->schedule_group_played);
if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played); if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id); if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
@ -1679,17 +1535,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/ */
public function copyInto($copyObj, $deepCopy = false) public function copyInto($copyObj, $deepCopy = false)
{ {
$copyObj->setDbPlaylistId($this->playlist_id);
$copyObj->setDbStarts($this->starts); $copyObj->setDbStarts($this->starts);
$copyObj->setDbEnds($this->ends); $copyObj->setDbEnds($this->ends);
$copyObj->setDbGroupId($this->group_id);
$copyObj->setDbFileId($this->file_id); $copyObj->setDbFileId($this->file_id);
$copyObj->setDbClipLength($this->clip_length); $copyObj->setDbClipLength($this->clip_length);
$copyObj->setDbFadeIn($this->fade_in); $copyObj->setDbFadeIn($this->fade_in);
$copyObj->setDbFadeOut($this->fade_out); $copyObj->setDbFadeOut($this->fade_out);
$copyObj->setDbCueIn($this->cue_in); $copyObj->setDbCueIn($this->cue_in);
$copyObj->setDbCueOut($this->cue_out); $copyObj->setDbCueOut($this->cue_out);
$copyObj->setDbScheduleGroupPlayed($this->schedule_group_played);
$copyObj->setDbMediaItemPlayed($this->media_item_played); $copyObj->setDbMediaItemPlayed($this->media_item_played);
$copyObj->setDbInstanceId($this->instance_id); $copyObj->setDbInstanceId($this->instance_id);
@ -1843,17 +1696,14 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
public function clear() public function clear()
{ {
$this->id = null; $this->id = null;
$this->playlist_id = null;
$this->starts = null; $this->starts = null;
$this->ends = null; $this->ends = null;
$this->group_id = null;
$this->file_id = null; $this->file_id = null;
$this->clip_length = null; $this->clip_length = null;
$this->fade_in = null; $this->fade_in = null;
$this->fade_out = null; $this->fade_out = null;
$this->cue_in = null; $this->cue_in = null;
$this->cue_out = null; $this->cue_out = null;
$this->schedule_group_played = null;
$this->media_item_played = null; $this->media_item_played = null;
$this->instance_id = null; $this->instance_id = null;
$this->alreadyInSave = false; $this->alreadyInSave = false;

View file

@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
const TM_CLASS = 'CcScheduleTableMap'; const TM_CLASS = 'CcScheduleTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 14; const NUM_COLUMNS = 11;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
@ -34,18 +34,12 @@ abstract class BaseCcSchedulePeer {
/** the column name for the ID field */ /** the column name for the ID field */
const ID = 'cc_schedule.ID'; const ID = 'cc_schedule.ID';
/** the column name for the PLAYLIST_ID field */
const PLAYLIST_ID = 'cc_schedule.PLAYLIST_ID';
/** the column name for the STARTS field */ /** the column name for the STARTS field */
const STARTS = 'cc_schedule.STARTS'; const STARTS = 'cc_schedule.STARTS';
/** the column name for the ENDS field */ /** the column name for the ENDS field */
const ENDS = 'cc_schedule.ENDS'; const ENDS = 'cc_schedule.ENDS';
/** the column name for the GROUP_ID field */
const GROUP_ID = 'cc_schedule.GROUP_ID';
/** the column name for the FILE_ID field */ /** the column name for the FILE_ID field */
const FILE_ID = 'cc_schedule.FILE_ID'; const FILE_ID = 'cc_schedule.FILE_ID';
@ -64,9 +58,6 @@ abstract class BaseCcSchedulePeer {
/** the column name for the CUE_OUT field */ /** the column name for the CUE_OUT field */
const CUE_OUT = 'cc_schedule.CUE_OUT'; const CUE_OUT = 'cc_schedule.CUE_OUT';
/** the column name for the SCHEDULE_GROUP_PLAYED field */
const SCHEDULE_GROUP_PLAYED = 'cc_schedule.SCHEDULE_GROUP_PLAYED';
/** the column name for the MEDIA_ITEM_PLAYED field */ /** the column name for the MEDIA_ITEM_PLAYED field */
const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED'; const MEDIA_ITEM_PLAYED = 'cc_schedule.MEDIA_ITEM_PLAYED';
@ -89,12 +80,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/ */
private static $fieldNames = array ( private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbPlaylistId', 'DbStarts', 'DbEnds', 'DbGroupId', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbScheduleGroupPlayed', 'DbMediaItemPlayed', 'DbInstanceId', ), BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbPlaylistId', 'dbStarts', 'dbEnds', 'dbGroupId', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbScheduleGroupPlayed', 'dbMediaItemPlayed', 'dbInstanceId', ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::PLAYLIST_ID, self::STARTS, self::ENDS, self::GROUP_ID, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::SCHEDULE_GROUP_PLAYED, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ), BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'PLAYLIST_ID', 'STARTS', 'ENDS', 'GROUP_ID', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'SCHEDULE_GROUP_PLAYED', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'playlist_id', 'starts', 'ends', 'group_id', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'schedule_group_played', 'media_item_played', 'instance_id', ), BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
); );
/** /**
@ -104,12 +95,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
private static $fieldKeys = array ( private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbPlaylistId' => 1, 'DbStarts' => 2, 'DbEnds' => 3, 'DbGroupId' => 4, 'DbFileId' => 5, 'DbClipLength' => 6, 'DbFadeIn' => 7, 'DbFadeOut' => 8, 'DbCueIn' => 9, 'DbCueOut' => 10, 'DbScheduleGroupPlayed' => 11, 'DbMediaItemPlayed' => 12, 'DbInstanceId' => 13, ), BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbPlaylistId' => 1, 'dbStarts' => 2, 'dbEnds' => 3, 'dbGroupId' => 4, 'dbFileId' => 5, 'dbClipLength' => 6, 'dbFadeIn' => 7, 'dbFadeOut' => 8, 'dbCueIn' => 9, 'dbCueOut' => 10, 'dbScheduleGroupPlayed' => 11, 'dbMediaItemPlayed' => 12, 'dbInstanceId' => 13, ), BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::PLAYLIST_ID => 1, self::STARTS => 2, self::ENDS => 3, self::GROUP_ID => 4, self::FILE_ID => 5, self::CLIP_LENGTH => 6, self::FADE_IN => 7, self::FADE_OUT => 8, self::CUE_IN => 9, self::CUE_OUT => 10, self::SCHEDULE_GROUP_PLAYED => 11, self::MEDIA_ITEM_PLAYED => 12, self::INSTANCE_ID => 13, ), BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'PLAYLIST_ID' => 1, 'STARTS' => 2, 'ENDS' => 3, 'GROUP_ID' => 4, 'FILE_ID' => 5, 'CLIP_LENGTH' => 6, 'FADE_IN' => 7, 'FADE_OUT' => 8, 'CUE_IN' => 9, 'CUE_OUT' => 10, 'SCHEDULE_GROUP_PLAYED' => 11, 'MEDIA_ITEM_PLAYED' => 12, 'INSTANCE_ID' => 13, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'playlist_id' => 1, 'starts' => 2, 'ends' => 3, 'group_id' => 4, 'file_id' => 5, 'clip_length' => 6, 'fade_in' => 7, 'fade_out' => 8, 'cue_in' => 9, 'cue_out' => 10, 'schedule_group_played' => 11, 'media_item_played' => 12, 'instance_id' => 13, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
); );
/** /**
@ -182,32 +173,26 @@ abstract class BaseCcSchedulePeer {
{ {
if (null === $alias) { if (null === $alias) {
$criteria->addSelectColumn(CcSchedulePeer::ID); $criteria->addSelectColumn(CcSchedulePeer::ID);
$criteria->addSelectColumn(CcSchedulePeer::PLAYLIST_ID);
$criteria->addSelectColumn(CcSchedulePeer::STARTS); $criteria->addSelectColumn(CcSchedulePeer::STARTS);
$criteria->addSelectColumn(CcSchedulePeer::ENDS); $criteria->addSelectColumn(CcSchedulePeer::ENDS);
$criteria->addSelectColumn(CcSchedulePeer::GROUP_ID);
$criteria->addSelectColumn(CcSchedulePeer::FILE_ID); $criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
$criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH); $criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH);
$criteria->addSelectColumn(CcSchedulePeer::FADE_IN); $criteria->addSelectColumn(CcSchedulePeer::FADE_IN);
$criteria->addSelectColumn(CcSchedulePeer::FADE_OUT); $criteria->addSelectColumn(CcSchedulePeer::FADE_OUT);
$criteria->addSelectColumn(CcSchedulePeer::CUE_IN); $criteria->addSelectColumn(CcSchedulePeer::CUE_IN);
$criteria->addSelectColumn(CcSchedulePeer::CUE_OUT); $criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
$criteria->addSelectColumn(CcSchedulePeer::SCHEDULE_GROUP_PLAYED);
$criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED); $criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID); $criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
} else { } else {
$criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.PLAYLIST_ID');
$criteria->addSelectColumn($alias . '.STARTS'); $criteria->addSelectColumn($alias . '.STARTS');
$criteria->addSelectColumn($alias . '.ENDS'); $criteria->addSelectColumn($alias . '.ENDS');
$criteria->addSelectColumn($alias . '.GROUP_ID');
$criteria->addSelectColumn($alias . '.FILE_ID'); $criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.CLIP_LENGTH'); $criteria->addSelectColumn($alias . '.CLIP_LENGTH');
$criteria->addSelectColumn($alias . '.FADE_IN'); $criteria->addSelectColumn($alias . '.FADE_IN');
$criteria->addSelectColumn($alias . '.FADE_OUT'); $criteria->addSelectColumn($alias . '.FADE_OUT');
$criteria->addSelectColumn($alias . '.CUE_IN'); $criteria->addSelectColumn($alias . '.CUE_IN');
$criteria->addSelectColumn($alias . '.CUE_OUT'); $criteria->addSelectColumn($alias . '.CUE_OUT');
$criteria->addSelectColumn($alias . '.SCHEDULE_GROUP_PLAYED');
$criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED'); $criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
$criteria->addSelectColumn($alias . '.INSTANCE_ID'); $criteria->addSelectColumn($alias . '.INSTANCE_ID');
} }

View file

@ -7,32 +7,26 @@
* *
* *
* @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column * @method CcScheduleQuery orderByDbId($order = Criteria::ASC) Order by the id column
* @method CcScheduleQuery orderByDbPlaylistId($order = Criteria::ASC) Order by the playlist_id column
* @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column * @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
* @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column * @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
* @method CcScheduleQuery orderByDbGroupId($order = Criteria::ASC) Order by the group_id column
* @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column * @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column * @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
* @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column * @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
* @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column * @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
* @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column * @method CcScheduleQuery orderByDbCueIn($order = Criteria::ASC) Order by the cue_in column
* @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column * @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
* @method CcScheduleQuery orderByDbScheduleGroupPlayed($order = Criteria::ASC) Order by the schedule_group_played column
* @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column * @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
* @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column * @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
* *
* @method CcScheduleQuery groupByDbId() Group by the id column * @method CcScheduleQuery groupByDbId() Group by the id column
* @method CcScheduleQuery groupByDbPlaylistId() Group by the playlist_id column
* @method CcScheduleQuery groupByDbStarts() Group by the starts column * @method CcScheduleQuery groupByDbStarts() Group by the starts column
* @method CcScheduleQuery groupByDbEnds() Group by the ends column * @method CcScheduleQuery groupByDbEnds() Group by the ends column
* @method CcScheduleQuery groupByDbGroupId() Group by the group_id column
* @method CcScheduleQuery groupByDbFileId() Group by the file_id column * @method CcScheduleQuery groupByDbFileId() Group by the file_id column
* @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column * @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column
* @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column * @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
* @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column * @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
* @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column * @method CcScheduleQuery groupByDbCueIn() Group by the cue_in column
* @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column * @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
* @method CcScheduleQuery groupByDbScheduleGroupPlayed() Group by the schedule_group_played column
* @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column * @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
* @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column * @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
* *
@ -52,32 +46,26 @@
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found * @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
* *
* @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column * @method CcSchedule findOneByDbId(int $id) Return the first CcSchedule filtered by the id column
* @method CcSchedule findOneByDbPlaylistId(int $playlist_id) Return the first CcSchedule filtered by the playlist_id column
* @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column * @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
* @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column * @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
* @method CcSchedule findOneByDbGroupId(int $group_id) Return the first CcSchedule filtered by the group_id column
* @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column * @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
* @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column * @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
* @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column * @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
* @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column * @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
* @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column * @method CcSchedule findOneByDbCueIn(string $cue_in) Return the first CcSchedule filtered by the cue_in column
* @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column * @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
* @method CcSchedule findOneByDbScheduleGroupPlayed(boolean $schedule_group_played) Return the first CcSchedule filtered by the schedule_group_played column
* @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column * @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
* @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column * @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
* *
* @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column * @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
* @method array findByDbPlaylistId(int $playlist_id) Return CcSchedule objects filtered by the playlist_id column
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column * @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column * @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
* @method array findByDbGroupId(int $group_id) Return CcSchedule objects filtered by the group_id column
* @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column * @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
* @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column * @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
* @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column * @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
* @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column * @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
* @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column * @method array findByDbCueIn(string $cue_in) Return CcSchedule objects filtered by the cue_in column
* @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column * @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
* @method array findByDbScheduleGroupPlayed(boolean $schedule_group_played) Return CcSchedule objects filtered by the schedule_group_played column
* @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column * @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
* @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column * @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
* *
@ -206,37 +194,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison); return $this->addUsingAlias(CcSchedulePeer::ID, $dbId, $comparison);
} }
/**
* Filter the query on the playlist_id column
*
* @param int|array $dbPlaylistId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbPlaylistId($dbPlaylistId = null, $comparison = null)
{
if (is_array($dbPlaylistId)) {
$useMinMax = false;
if (isset($dbPlaylistId['min'])) {
$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbPlaylistId['max'])) {
$this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcSchedulePeer::PLAYLIST_ID, $dbPlaylistId, $comparison);
}
/** /**
* Filter the query on the starts column * Filter the query on the starts column
* *
@ -299,37 +256,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison); return $this->addUsingAlias(CcSchedulePeer::ENDS, $dbEnds, $comparison);
} }
/**
* Filter the query on the group_id column
*
* @param int|array $dbGroupId The value to use as filter.
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbGroupId($dbGroupId = null, $comparison = null)
{
if (is_array($dbGroupId)) {
$useMinMax = false;
if (isset($dbGroupId['min'])) {
$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbGroupId['max'])) {
$this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcSchedulePeer::GROUP_ID, $dbGroupId, $comparison);
}
/** /**
* Filter the query on the file_id column * Filter the query on the file_id column
* *
@ -516,23 +442,6 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison); return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
} }
/**
* Filter the query on the schedule_group_played column
*
* @param boolean|string $dbScheduleGroupPlayed The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbScheduleGroupPlayed($dbScheduleGroupPlayed = null, $comparison = null)
{
if (is_string($dbScheduleGroupPlayed)) {
$schedule_group_played = in_array(strtolower($dbScheduleGroupPlayed), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
}
return $this->addUsingAlias(CcSchedulePeer::SCHEDULE_GROUP_PLAYED, $dbScheduleGroupPlayed, $comparison);
}
/** /**
* Filter the query on the media_item_played column * Filter the query on the media_item_played column
* *

View file

@ -0,0 +1,24 @@
<?php
class BitrateFormatter {
/**
* @string length
*/
private $_bitrate;
/*
* @param string $bitrate (bits per second)
*/
public function __construct($bitrate)
{
$this->_bitrate = $bitrate;
}
public function format()
{
$Kbps = bcdiv($this->_bitrate, 1000, 0);
return "{$Kbps} Kbps";
}
}

View file

@ -0,0 +1,56 @@
<?php
class LengthFormatter {
/**
* @string length
*/
private $_length;
/*
* @param string $length formatted H:i:s.u (can be > 24 hours)
*/
public function __construct($length)
{
$this->_length = $length;
}
public function format() {
$pieces = explode(":", $this->_length);
$seconds = round($pieces[2], 1);
$seconds = number_format($seconds, 1);
list($seconds, $milliStr) = explode(".", $seconds);
if (intval($pieces[0]) !== 0) {
$hours = ltrim($pieces[0], "0");
}
$minutes = $pieces[1];
//length is less than 1 hour
if (!isset($hours)) {
if (intval($minutes) !== 0) {
$minutes = ltrim($minutes, "0");
}
//length is less than 1 minute
else {
unset($minutes);
}
}
if (isset($hours) && isset($minutes) && isset($seconds)) {
$time = sprintf("%d:%02d:%02d.%s", $hours, $minutes, $seconds, $milliStr);
}
else if (isset($minutes) && isset($seconds)) {
$time = sprintf("%d:%02d.%s", $minutes, $seconds, $milliStr);
}
else {
$time = sprintf("%d.%s", $seconds, $milliStr);
}
return $time;
}
}

View file

@ -0,0 +1,24 @@
<?php
class SamplerateFormatter {
/**
* @string sample rate
*/
private $_samplerate;
/*
* @param string $samplerate Hz
*/
public function __construct($samplerate)
{
$this->_samplerate = $samplerate;
}
public function format()
{
$kHz = bcdiv($this->_samplerate, 1000, 1);
return "{$kHz} kHz";
}
}

View file

@ -1,3 +0,0 @@
<?php
header ("location: html/");
exit;

View file

@ -1,7 +1,3 @@
<ul> <div id="import_status" style="display:none">File import in progress...</div>
<li><a href="#simpleSearch">Search</a></li> <table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
</ul>
<div id="simpleSearch">
<div id="import_status" style="visibility:hidden">File import in progress...</div>
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
</div>

View file

@ -14,7 +14,7 @@
<a id="playlist_name_display"><?php echo $this->pl->getName(); ?></a> <a id="playlist_name_display"><?php echo $this->pl->getName(); ?></a>
<input type="text" maxlength="255" size="40" class="element_hidden" id="playlist_name_input" /> <input type="text" maxlength="255" size="40" class="element_hidden" id="playlist_name_input" />
</h3> </h3>
<h4 id="spl_length"><?php echo $this->pl->getLength(); ?></h4> <h4 id="spl_length"><?php echo $this->length; ?></h4>
</div> </div>
<fieldset class="toggle closed" id="fieldset-metadate_change"> <fieldset class="toggle closed" id="fieldset-metadate_change">

View file

@ -1,11 +0,0 @@
<li id="sp_<?php echo $this->id ?>" class="ui-widget-content">
<span><?php echo $this->name ?></span>
<span><?php echo $this->length ?></span>
<div>
<span>Creator: <?php echo $this->creator ?></span>
<?php if($this->state === "edited") : ?>
<span>Editing: <?php echo $this->login ?></span>
<?php endif ?>
</div>
<div><?php echo $this->description ?></div>
</li>

View file

@ -1,8 +0,0 @@
<?php
if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
}
else {
echo "No Playlists Fit Duration";
}
?>

View file

@ -1,8 +0,0 @@
<?php
if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
}
else {
echo "No Playlists Fit Duration";
}
?>

View file

@ -1,34 +0,0 @@
<div id="schedule_playlist_dialog">
<h2 id="scheduled_playlist_name">
<?php echo $this->showName; ?>: <span><?php echo $this->s_wday." ".$this->s_month." ".$this->s_day." ".$this->startTime.
" - ".$this->e_wday." ".$this->e_month." ".$this->e_day." ".$this->endTime; ?></span>
</h2>
<div class="clearfix">
<div class="wrapp-one">
<table id="schedule_playlists" cellpadding="0" cellspacing="0" class="datatable">
<thead>
<tr>
<th>Id</th>
<th>Description</th>
<th>Title</th>
<th>Creator</th>
<th>Length</th>
<th>Editing</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="wrapp-two">
<div><h4>Items In This Show:</h4></div>
<ul id="schedule_playlist_chosen"></ul>
<div id="show_time_info">
<span id="show_time_filled" class="time"><?php echo $this->timeFilled; ?></span>
<div id="show_progressbar"></div>
<span id="show_length" class="time"><?php echo $this->showLength; ?></span>
</div>
<div id="show_time_warning" style="display:none"></div>
</div>
</div>
</div>

View file

@ -1,26 +0,0 @@
<?php if(count($this->showContent) > 0) : ?>
<?php foreach($this->showContent as $pl) : ?>
<li id="g_<?php echo $pl["pl_group"] ?>" >
<h3 class="ui-accordion-header ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-triangle-1-e"></span>
<span class="ui-icon ui-icon-close"></span>
<div class="sh_pl_name"><?php echo $pl["pl_name"] ?></div>
<div class="sh_pl_creator"><?php echo $pl["pl_creator"] ?></div>
<div class="sh_pl_time"><?php echo $pl["pl_length"] ?></div>
</h3>
<div class="group_list ui-widget-content ui-corner-bottom" style="display:none">
<div class="sched_description"><?php echo $pl["pl_description"] ?></div>
<?php foreach($pl["pl_content"] as $file) : ?>
<div>
<span class="sh_file_name"><?php echo $file["f_name"] ?></span>
<span><?php echo $file["f_length"] ?></span>
</div>
<div class="sh_file_artist"><?php echo $file["f_artist"] ?></div>
<?php endforeach; ?>
</div>
</li>
<?php endforeach; ?>
<?php else : ?>
<li>Nothing Scheduled</li>
<?php endif; ?>

View file

@ -12,13 +12,11 @@
<?php $i=0; ?> <?php $i=0; ?>
<?php foreach($this->showContent as $row): ?> <?php foreach($this->showContent as $row): ?>
<tr id="au_<?php echo $row["file_id"] ?>" class="<?php if($i&1){echo "even";}else{echo "odd";}?>"> <tr id="au_<?php echo $row["file_id"] ?>" class="<?php if($i&1){echo "even";}else{echo "odd";}?>">
<td><?php $dt = new DateTime($row["starts"], new DateTimeZone("UTC")); <td><?php echo $row["starts"] ?></td>
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
echo $dt->format("Y-m-d H:i:s") ?></td>
<td><?php echo $row["track_title"] ?></td> <td><?php echo $row["track_title"] ?></td>
<td><?php echo $row["artist_name"] ?></td> <td><?php echo $row["artist_name"] ?></td>
<td><?php echo $row["album_title"] ?></td> <td><?php echo $row["album_title"] ?></td>
<td><?php echo $row["clip_length"] ?></td> <td class="library_length"><?php echo $row["clip_length"] ?></td>
<td><?php echo $row["genre"] ?></td> <td><?php echo $row["genre"] ?></td>
</tr> </tr>
<?php $i=$i+1; ?> <?php $i=$i+1; ?>

View file

@ -54,7 +54,7 @@
<column name="bit_rate" phpName="DbBitRate" type="VARCHAR" size="32" required="false"/> <column name="bit_rate" phpName="DbBitRate" type="VARCHAR" size="32" required="false"/>
<column name="sample_rate" phpName="DbSampleRate" type="VARCHAR" size="32" required="false"/> <column name="sample_rate" phpName="DbSampleRate" type="VARCHAR" size="32" required="false"/>
<column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false"/> <column name="format" phpName="DbFormat" type="VARCHAR" size="128" required="false"/>
<column name="length" phpName="DbLength" type="TIME" required="false"/> <column name="length" phpName="DbLength" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" required="false"/>
<column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false"/> <column name="album_title" phpName="DbAlbumTitle" type="VARCHAR" size="512" required="false"/>
<column name="genre" phpName="DbGenre" type="VARCHAR" size="64" required="false"/> <column name="genre" phpName="DbGenre" type="VARCHAR" size="64" required="false"/>
<column name="comments" phpName="DbComments" type="LONGVARCHAR" required="false"/> <column name="comments" phpName="DbComments" type="LONGVARCHAR" required="false"/>
@ -270,17 +270,14 @@
</table> </table>
<table name="cc_schedule" phpName="CcSchedule"> <table name="cc_schedule" phpName="CcSchedule">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> <column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="playlist_id" phpName="DbPlaylistId" type="INTEGER" required="false"/>
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/> <column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/> <column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
<column name="group_id" phpName="DbGroupId" type="INTEGER" required="false"/>
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/> <column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
<column name="clip_length" phpName="DbClipLength" type="TIME" required="false" defaultValue="00:00:00"/> <column name="clip_length" phpName="DbClipLength" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00"/> <column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00"/> <column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cue_in" phpName="DbCueIn" type="TIME" required="false" defaultValue="00:00:00"/> <column name="cue_in" phpName="DbCueIn" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/> <column name="cue_out" phpName="DbCueOut" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="schedule_group_played" phpName="DbScheduleGroupPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
<column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/> <column name="media_item_played" phpName="DbMediaItemPlayed" type="BOOLEAN" required="false" defaultValue="0"/>
<column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/> <column name="instance_id" phpName="DbInstanceId" type="INTEGER" required="true"/>
<!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore. <!-- This foreign key is still useful even though it may seem we don't ever delete cc_show_instances anymore.

View file

@ -80,7 +80,7 @@ CREATE TABLE "cc_files"
"bit_rate" VARCHAR(32), "bit_rate" VARCHAR(32),
"sample_rate" VARCHAR(32), "sample_rate" VARCHAR(32),
"format" VARCHAR(128), "format" VARCHAR(128),
"length" TIME, "length" interval default '00:00:00',
"album_title" VARCHAR(512), "album_title" VARCHAR(512),
"genre" VARCHAR(64), "genre" VARCHAR(64),
"comments" TEXT, "comments" TEXT,
@ -361,17 +361,14 @@ DROP TABLE "cc_schedule" CASCADE;
CREATE TABLE "cc_schedule" CREATE TABLE "cc_schedule"
( (
"id" serial NOT NULL, "id" serial NOT NULL,
"playlist_id" INTEGER,
"starts" TIMESTAMP NOT NULL, "starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL, "ends" TIMESTAMP NOT NULL,
"group_id" INTEGER,
"file_id" INTEGER, "file_id" INTEGER,
"clip_length" TIME default '00:00:00', "clip_length" TIME default '00:00:00',
"fade_in" TIME default '00:00:00', "fade_in" TIME default '00:00:00',
"fade_out" TIME default '00:00:00', "fade_out" TIME default '00:00:00',
"cue_in" TIME default '00:00:00', "cue_in" TIME default '00:00:00',
"cue_out" TIME default '00:00:00', "cue_out" TIME default '00:00:00',
"schedule_group_played" BOOLEAN default 'f',
"media_item_played" BOOLEAN default 'f', "media_item_played" BOOLEAN default 'f',
"instance_id" INTEGER NOT NULL, "instance_id" INTEGER NOT NULL,
PRIMARY KEY ("id") PRIMARY KEY ("id")

View file

@ -1,39 +0,0 @@
div.jjmenu {
position:absolute;
background:#d2d2d2;
border-bottom:2px solid #5b5b5b;
border-right:1px solid #5b5b5b;
padding:0px;
z-index: 1011;
font-size:11px;
}
div.jj_menu_item {
color:black;
border:1px solid #5b5b5b;
border-bottom:none;
background:#d2d2d2;
background: -moz-linear-gradient(center top , #d2d2d2 0pt, #bcbcbc 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #d2d2d2), color-stop(100%, #bcbcbc));
cursor:pointer;
}
div.jj_menu_item span {
display:block;
padding:4px 10px;
}
div.jj_menu_item_more span {
background:url(images/more.gif) right no-repeat;
}
div.jj_menu_item_more span {
padding-right:20px;
}
div.jj_menu_item_hover {
background:#6e6e6e;
background: -moz-linear-gradient(center top , #868686 0pt, #6e6e6e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #868686), color-stop(100%, #6e6e6e));
color:#FFF;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,019 B

View file

@ -75,3 +75,7 @@
.datatable_checkbox .DataTables_sort_wrapper { .datatable_checkbox .DataTables_sort_wrapper {
text-align: center; text-align: center;
} }
.library_year {
text-align: center;
}

View file

@ -1,5 +1,37 @@
@CHARSET "UTF-8"; @CHARSET "UTF-8";
#show_builder {
width:45%;
}
#show_builder input.input_text { #show_builder input.input_text {
width:100px; width:100px;
}
table.datatable tr.cursor-selected-row td, table.datatable tr.cursor-selected-row th {
border-bottom: 2px solid #db0000 !important;
}
.innerWrapper {
position:relative;
width:100%;
}
.marker {
position:absolute;
bottom:-10px;
left:-14px;
width:9px;
height:9px;
background:url(images/tl-arrow.png) no-repeat 0 0;
display:block;
}
tr.cursor-selected-row .marker {
background-position: 0 -15px;
}
.sb-boundry {
background-color:#e66a31;
}
.sb-over {
background-color:#ff3030;
} }

View file

@ -559,6 +559,12 @@ dl.inline-list dd {
float: left; float: left;
margin: 0 3px 0 -2px; margin: 0 3px 0 -2px;
} }
.dataTables_type {
float:right;
margin:0 8px 0 0;
}
.dataTables_length { .dataTables_length {
float:right; float:right;
margin:0 8px 0 0; margin:0 8px 0 0;
@ -574,7 +580,7 @@ dl.inline-list dd {
margin:8px 0 0 8px; margin:8px 0 0 8px;
} }
.dataTables_filter .auto-search { .dataTables_filter .auto-search {
width:60%; width:55%;
} }
.dataTables_processing { .dataTables_processing {
font-size:11px; font-size:11px;
@ -652,6 +658,11 @@ button.ColVis_Button.ColVis_ShowAll {
margin: 0.5em 0.2em -0.5em 0.2em; margin: 0.5em 0.2em -0.5em 0.2em;
} }
.library_length {
text-align: right;
padding-right: 1em !important;
}
/*----END Data Table----*/ /*----END Data Table----*/
fieldset { fieldset {

View file

@ -19,20 +19,15 @@ var AIRTIME = (function(AIRTIME){
mod.fnDrawCallback = function() { mod.fnDrawCallback = function() {
$('#library_display tr[id ^= "au"]').draggable({ $('#library_display tr[id ^= "au"]').draggable({
helper: 'clone', helper: function(){
/* customize the helper on dragging to look like a pl item var selected = $('#library_display tr:not(:first) input:checked').parents('tr[id^="au"]');
* if (selected.length === 0) {
helper: function(ev) { selected = $(this);
var data, li; }
var container = $('<div/>').attr('id', 'draggingContainer');
data = $(ev.currentTarget).data("aData"); container.append(selected.clone());
return container;
li = $("<li></li>"); },
li.append(data.track_title);
return li;
},
*/
cursor: 'pointer', cursor: 'pointer',
connectToSortable: '#spl_sortable' connectToSortable: '#spl_sortable'
}); });
@ -46,11 +41,6 @@ var AIRTIME = (function(AIRTIME){
fnResetCol, fnResetCol,
fnAddSelectedItems; fnAddSelectedItems;
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
fnAddSelectedItems = function() { fnAddSelectedItems = function() {
var oLibTT = TableTools.fnGetInstance('library_display'), var oLibTT = TableTools.fnGetInstance('library_display'),
aData = oLibTT.fnGetSelectedData(), aData = oLibTT.fnGetSelectedData(),
@ -73,9 +63,8 @@ var AIRTIME = (function(AIRTIME){
//[1] = id //[1] = id
//[2] = enabled //[2] = enabled
//[3] = click event //[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol], aButtons = [["Delete", "library_group_delete", true, AIRTIME.library.fnDeleteSelectedItems],
["Delete", "library_group_delete", true, AIRTIME.library.fnDeleteSelectedItems], ["Add", "library_group_add", true, fnAddSelectedItems]];
["Add", "library_group_add", true, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons); addToolBarButtonsLibrary(aButtons);
}; };

View file

@ -19,7 +19,15 @@ var AIRTIME = (function(AIRTIME){
mod.fnDrawCallback = function() { mod.fnDrawCallback = function() {
$('#library_display tr:not(:first)').draggable({ $('#library_display tr:not(:first)').draggable({
helper: 'clone', helper: function(){
var selected = $('#library_display tr:not(:first) input:checked').parents('tr');
if (selected.length === 0) {
selected = $(this);
}
var container = $('<div/>').attr('id', 'draggingContainer');
container.append(selected.clone());
return container;
},
cursor: 'pointer', cursor: 'pointer',
connectToSortable: '#show_builder_table' connectToSortable: '#show_builder_table'
}); });
@ -31,50 +39,40 @@ var AIRTIME = (function(AIRTIME){
fnResetCol, fnResetCol,
fnAddSelectedItems, fnAddSelectedItems,
fnResetCol = function () {
ColReorder.fnReset( oLibTable );
return false;
};
fnAddSelectedItems = function() { fnAddSelectedItems = function() {
var oLibTT = TableTools.fnGetInstance('library_display'), var oLibTT = TableTools.fnGetInstance('library_display'),
oSchedTT = TableTools.fnGetInstance('show_builder_table'),
aData = oLibTT.fnGetSelectedData(), aData = oLibTT.fnGetSelectedData(),
item, i,
length,
temp, temp,
aMediaIds = [], aMediaIds = [],
aSchedIds = []; aSchedIds = [];
//process selected files/playlists. //process selected files/playlists.
for (item in aData) { for (i=0, length = aData.length; i < length; i++) {
temp = aData[item]; temp = aData[i];
if (temp !== null && temp.hasOwnProperty('id')) { aMediaIds.push({"id": temp.id, "type": temp.ftype});
aMediaIds.push({"id": temp.id, "type": temp.ftype});
}
}
aData = oSchedTT.fnGetSelectedData();
//process selected schedule rows to add media after.
for (item in aData) {
temp = aData[item];
if (temp !== null && temp.hasOwnProperty('id')) {
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
}
} }
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds, function(){ aData = [];
oLibTT.fnSelectNone(); $("#show_builder_table tr.cursor-selected-row").each(function(i, el){
aData.push($(el).data("aData"));
}); });
//process selected schedule rows to add media after.
for (i=0, length = aData.length; i < length; i++) {
temp = aData[i];
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
}
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
}; };
//[0] = button text //[0] = button text
//[1] = id //[1] = id
//[2] = enabled //[2] = enabled
//[3] = click event //[3] = click event
aButtons = [["Reset Order", "library_order_reset", true, fnResetCol], aButtons = [["Delete", "library_group_delete", true, AIRTIME.library.fnDeleteSelectedItems],
["Delete", "library_group_delete", true, AIRTIME.library.fnDeleteSelectedItems], ["Add", "library_group_add", true, fnAddSelectedItems]];
["Add", "library_group_add", true, fnAddSelectedItems]];
addToolBarButtonsLibrary(aButtons); addToolBarButtonsLibrary(aButtons);
}; };

View file

@ -83,9 +83,10 @@ function checkImportStatus(){
$.getJSON('/Preference/is-import-in-progress', function(data){ $.getJSON('/Preference/is-import-in-progress', function(data){
var div = $('#import_status'); var div = $('#import_status');
if (data == true){ if (data == true){
div.css('visibility', 'visible'); div.show();
}else{ }
div.css('visibility', 'hidden'); else{
div.hide();
} }
}); });
} }
@ -211,118 +212,179 @@ function addQtipToSCIcons(){
}); });
} }
function fnCreatedRow( nRow, aData, iDataIndex ) { $(document).ready(function() {
var oTable;
//call the context menu so we can prevent the event from propagating.
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
$(this).contextMenu();
return false;
});
//add a tool tip to appear when the user clicks on the type icon.
$(nRow.children[1]).qtip({
content: {
text: "Loading...",
title: {
text: aData.track_title
},
ajax: {
url: "/Library/get-file-meta-data",
type: "get",
data: ({format: "html", id : aData.id, type: aData.ftype}),
success: function(data, status) {
this.set('content.text', data);
}
}
},
position: {
my: 'left center',
at: 'right center', // Position the tooltip above the link
viewport: $(window), // Keep the tooltip on-screen at all times
effect: false // Disable positioning animation
},
style: {
classes: "ui-tooltip-dark"
},
show: {
event: 'click',
solo: true // Only show one tooltip at a time
},
hide: 'mouseout'
}).click(function(event) {
event.preventDefault();
event.stopPropagation();
});
}
/**
* Updates pref db when user changes the # of entries to show
*/
function saveNumEntriesSetting() {
$('select[name=library_display_length]').change(function() {
var url = '/Library/set-num-entries/format/json';
$.post(url, {numEntries: $(this).val()});
});
}
/**
* Use user preference for number of entries to show
*/
function getNumEntriesPreference(data) {
return parseInt(data.libraryInit.numEntries, 10);
}
function createDataTable(data) {
var oTable;
oTable = $('#library_display').dataTable( { oTable = $('#library_display').dataTable( {
"aoColumns": [
/* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "mDataProp": "checkbox", "bSortable": false, "bSearchable": false, "sWidth": "25px", "sClass": "library_checkbox"},
/* Type */ {"sTitle": "", "mDataProp": "image", "bSearchable": false, "sWidth": "25px", "sClass": "library_type", "iDataSort": 2},
/* ftype */ {"sTitle": "", "mDataProp": "ftype", "bSearchable": false, "bVisible": false},
/* Title */ {"sTitle": "Title", "mDataProp": "track_title", "sClass": "library_title"},
/* Creator */ {"sTitle": "Creator", "mDataProp": "artist_name", "sClass": "library_creator"},
/* Album */ {"sTitle": "Album", "mDataProp": "album_title", "sClass": "library_album"},
/* Genre */ {"sTitle": "Genre", "mDataProp": "genre", "sClass": "library_genre"},
/* Year */ {"sTitle": "Year", "mDataProp": "year", "sClass": "library_year", "sWidth": "60px"},
/* Length */ {"sTitle": "Length", "mDataProp": "length", "sClass": "library_length", "sWidth": "80px"},
/* Upload Time */ {"sTitle": "Uploaded", "mDataProp": "utime", "sClass": "library_upload_time"},
/* Last Modified */ {"sTitle": "Last Modified", "mDataProp": "mtime", "bVisible": false, "sClass": "library_modified_time"},
/* Track Number */ {"sTitle": "Track", "mDataProp": "track_number", "bSearchable": false, "bVisible": false, "sClass": "library_track"},
/* Mood */ {"sTitle": "Mood", "mDataProp": "mood", "bSearchable": false, "bVisible": false, "sClass": "library_mood"},
/* BPM */ {"sTitle": "BPM", "mDataProp": "bpm", "bSearchable": false, "bVisible": false, "sClass": "library_bpm"},
/* Composer */ {"sTitle": "Composer", "mDataProp": "composer", "bSearchable": false, "bVisible": false, "sClass": "library_composer"},
/* Website */ {"sTitle": "Website", "mDataProp": "info_url", "bSearchable": false, "bVisible": false, "sClass": "library_url"},
/* Bit Rate */ {"sTitle": "Bit Rate", "mDataProp": "bit_rate", "bSearchable": false, "bVisible": false, "sClass": "library_bitrate"},
/* Sameple Rate */ {"sTitle": "Sample Rate", "mDataProp": "sample_rate", "bSearchable": false, "bVisible": false, "sClass": "library_sr"},
/* ISRC Number */ {"sTitle": "ISRC", "mDataProp": "isrc_number", "bSearchable": false, "bVisible": false, "sClass": "library_isrc"},
/* Encoded */ {"sTitle": "Encoded", "mDataProp": "encoded_by", "bSearchable": false, "bVisible": false, "sClass": "library_encoded"},
/* Label */ {"sTitle": "Label", "mDataProp": "label", "bSearchable": false, "bVisible": false, "sClass": "library_label"},
/* Copyright */ {"sTitle": "Copyright", "mDataProp": "copyright", "bSearchable": false, "bVisible": false, "sClass": "library_copyright"},
/* Mime */ {"sTitle": "Mime", "mDataProp": "mime", "bSearchable": false, "bVisible": false, "sClass": "library_mime"},
/* Language */ {"sTitle": "Language", "mDataProp": "language", "bSearchable": false, "bVisible": false, "sClass": "library_language"}
],
"bProcessing": true, "bProcessing": true,
"bServerSide": true, "bServerSide": true,
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
//remove oData components we don't want to save.
delete oData.oSearch;
delete oData.aoSearchCols;
},
"fnStateSave": function (oSettings, oData) {
$.ajax({
url: "/usersettings/set-library-datatable",
type: "POST",
data: {settings : oData, format: "json"},
dataType: "json",
success: function(){},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
});
},
"fnStateLoad": function (oSettings) {
var o;
$.ajax({
url: "/usersettings/get-library-datatable",
type: "GET",
data: {format: "json"},
dataType: "json",
async: false,
success: function(json){
o = json.settings;
},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
});
return o;
},
"fnStateLoadParams": function (oSettings, oData) {
var i,
length,
a = oData.abVisCols;
//putting serialized data back into the correct js type to make
//sure everything works properly.
for (i = 0, length = a.length; i < length; i++) {
a[i] = (a[i] === "true") ? true : false;
}
a = oData.ColReorder;
for (i = 0, length = a.length; i < length; i++) {
a[i] = parseInt(a[i], 10);
}
oData.iCreate = parseInt(oData.iCreate, 10);
},
"sAjaxSource": "/Library/contents", "sAjaxSource": "/Library/contents",
"fnServerData": function ( sSource, aoData, testCallback ) { "fnServerData": function ( sSource, aoData, fnCallback ) {
var type;
aoData.push( { name: "format", value: "json"} ); aoData.push( { name: "format", value: "json"} );
//push whether to search files/playlists or all.
type = $("#library_display_type").find("select").val();
type = (type === undefined) ? 0 : type;
aoData.push( { name: "type", value: type} );
$.ajax( { $.ajax( {
"dataType": 'json', "dataType": 'json',
"type": "GET", "type": "GET",
"url": sSource, "url": sSource,
"data": aoData, "data": aoData,
"success": testCallback "success": fnCallback
} ); } );
}, },
"fnRowCallback": AIRTIME.library.events.fnRowCallback, "fnRowCallback": AIRTIME.library.events.fnRowCallback,
"fnCreatedRow": fnCreatedRow, "fnCreatedRow": function( nRow, aData, iDataIndex ) {
//call the context menu so we can prevent the event from propagating.
$(nRow).find('td:not(.library_checkbox):not(.library_type)').click(function(e){
$(this).contextMenu();
return false;
});
//add a tool tip to appear when the user clicks on the type icon.
$(nRow.children[1]).qtip({
content: {
text: "Loading...",
title: {
text: aData.track_title
},
ajax: {
url: "/Library/get-file-meta-data",
type: "get",
data: ({format: "html", id : aData.id, type: aData.ftype}),
success: function(data, status) {
this.set('content.text', data);
}
}
},
position: {
my: 'left center',
at: 'right center', // Position the tooltip above the link
viewport: $(window), // Keep the tooltip on-screen at all times
effect: false // Disable positioning animation
},
style: {
classes: "ui-tooltip-dark"
},
show: {
event: 'click',
solo: true // Only show one tooltip at a time
},
hide: 'mouseout'
}).click(function(event) {
event.preventDefault();
event.stopPropagation();
});
},
"fnDrawCallback": AIRTIME.library.events.fnDrawCallback, "fnDrawCallback": AIRTIME.library.events.fnDrawCallback,
"fnHeaderCallback": function(nHead) { "fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false); $(nHead).find("input[type=checkbox]").attr("checked", false);
}, },
"aoColumns": [ "aaSorting": [[3, 'asc']],
/* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"},
/* Type */ {"sName": "ftype", "bSearchable": false, "mDataProp": "image", "sWidth": "25px", "sClass": "library_type"},
/* Title */ {"sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"},
/* Creator */ {"sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"},
/* Album */ {"sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"},
/* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sClass": "library_genre"},
/* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sClass": "library_year"},
/* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sClass": "library_length"},
/* Upload Time */ {"sTitle": "Uploaded", "sName": "utime", "mDataProp": "utime", "sClass": "library_upload_time"},
/* Last Modified */ {"sTitle": "Last Modified", "sName": "mtime", "bVisible": false, "mDataProp": "mtime", "sClass": "library_modified_time"},
/* Track Number */ {"sTitle": "Track", "sName": "track", "bSearchable": false, "bVisible": false, "mDataProp": "track_number", "sClass": "library_track"}
],
"aaSorting": [[2,'asc']],
"sPaginationType": "full_numbers", "sPaginationType": "full_numbers",
"bJQueryUI": true, "bJQueryUI": true,
"bAutoWidth": false, "bAutoWidth": false,
"oLanguage": { "oLanguage": {
"sSearch": "" "sSearch": ""
}, },
"iDisplayLength": getNumEntriesPreference(data),
// R = ColReorder, C = ColVis, T = TableTools // R = ColReorder, C = ColVis, T = TableTools
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>', "sDom": 'Rl<"#library_display_type">fr<"H"T<"library_toolbar"C>>t<"F"ip>',
"oTableTools": { "oTableTools": {
"sRowSelect": "multi", "sRowSelect": "multi",
@ -352,20 +414,30 @@ function createDataTable(data) {
"oColVis": { "oColVis": {
"buttonText": "Show/Hide Columns", "buttonText": "Show/Hide Columns",
"sAlign": "right", "sAlign": "right",
"aiExclude": [0, 1], "aiExclude": [0, 1, 2],
"sSize": "css", "sSize": "css"
"bShowAll": true
}, },
"oColReorder": { "oColReorder": {
"iFixedColumns": 2, "iFixedColumns": 2
"aiOrder": [ 0,1,2,3,4,5,6,7,8,9,10 ]
} }
}); });
oTable.fnSetFilteringDelay(350); oTable.fnSetFilteringDelay(350);
AIRTIME.library.events.setupLibraryToolbar(oTable); AIRTIME.library.events.setupLibraryToolbar(oTable);
$("#library_display_type")
.addClass("dataTables_type")
.append('<select name="library_display_type" />')
.find("select")
.append('<option value="0">All</option>')
.append('<option value="1">Files</option>')
.append('<option value="2">Playlists</option>')
.end()
.change(function(ev){
oTable.fnDraw();
});
$('[name="pl_cb_all"]').click(function(){ $('[name="pl_cb_all"]').click(function(){
var oTT = TableTools.fnGetInstance('library_display'); var oTT = TableTools.fnGetInstance('library_display');
@ -377,13 +449,6 @@ function createDataTable(data) {
oTT.fnSelectNone(); oTT.fnSelectNone();
} }
}); });
}
$(document).ready(function() {
$('.tabs').tabs();
$.ajax({url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
error:function(jqXHR, textStatus, errorThrown){}});
checkImportStatus(); checkImportStatus();
setInterval( checkImportStatus, 5000 ); setInterval( checkImportStatus, 5000 );
@ -405,6 +470,16 @@ $(document).ready(function() {
function processMenuItems(oItems) { function processMenuItems(oItems) {
//define an add to playlist callback.
if (oItems.pl_add !== undefined) {
callback = function() {
AIRTIME.playlist.fnAddItems([data.id], undefined, 'after');
};
oItems.pl_add.callback = callback;
}
//define an edit callback. //define an edit callback.
if (oItems.edit !== undefined) { if (oItems.edit !== undefined) {

View file

@ -19,6 +19,10 @@ var AIRTIME = (function(AIRTIME){
return regExpr.test(fade); return regExpr.test(fade);
} }
function playlistError(json) {
alert(json.error);
openPlaylist(json);
}
function stopAudioPreview() { function stopAudioPreview() {
// stop any preview playing // stop any preview playing
@ -51,130 +55,151 @@ var AIRTIME = (function(AIRTIME){
function changeCueIn(event) { function changeCueIn(event) {
event.stopPropagation(); event.stopPropagation();
var id, url, cueIn, li, unqid; var span = $(this),
id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-cue",
cueIn = $.trim(span.text()),
li = span.parents("li"),
unqid = li.attr("unqid"),
lastMod = getModified();
span = $(this); if (!isTimeValid(cueIn)){
id = span.parent().attr("id").split("_").pop();
url = "/Playlist/set-cue";
cueIn = $.trim(span.text());
li = span.parent().parent().parent().parent();
unqid = li.attr("unqid");
if(!isTimeValid(cueIn)){
showError(span, "please put in a time '00:00:00 (.000000)'"); showError(span, "please put in a time '00:00:00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", cueIn: cueIn, id: id, type: event.type}, function(json){ $.post(url,
{format: "json", cueIn: cueIn, id: id, modified: lastMod},
function(json){
if(json.response !== undefined && json.response.error) { if (json.error !== undefined){
showError(span, json.response.error); playlistError(json);
return; return;
} }
if (json.cue_error !== undefined) {
setPlaylistContent(json); showError(span, json.cue_error);
return;
li = $('#side_playlist li[unqid='+unqid+']'); }
li.find(".cue-edit").toggle();
highlightActive(li); setPlaylistContent(json);
highlightActive(li.find('.spl_cue'));
}); li = $('#side_playlist li[unqid='+unqid+']');
li.find(".cue-edit").toggle();
highlightActive(li);
highlightActive(li.find('.spl_cue'));
});
} }
function changeCueOut(event) { function changeCueOut(event) {
event.stopPropagation(); event.stopPropagation();
var id, url, cueOut, li, unqid; var span = $(this),
id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-cue",
cueOut = $.trim(span.text()),
li = span.parents("li"),
unqid = li.attr("unqid"),
lastMod = getModified();
span = $(this); if (!isTimeValid(cueOut)){
id = span.parent().attr("id").split("_").pop();
url = "/Playlist/set-cue";
cueOut = $.trim(span.text());
li = span.parent().parent().parent().parent();
unqid = li.attr("unqid");
if(!isTimeValid(cueOut)){
showError(span, "please put in a time '00:00:00 (.000000)'"); showError(span, "please put in a time '00:00:00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", cueOut: cueOut, id: id}, function(json){ $.post(url,
{format: "json", cueOut: cueOut, id: id, modified: lastMod},
function(json){
if(json.response !== undefined && json.response.error) { if (json.error !== undefined){
showError(span, json.response.error); playlistError(json);
return; return;
} }
if (json.cue_error !== undefined) {
setPlaylistContent(json); showError(span, json.cue_error);
return;
li = $('#side_playlist li[unqid='+unqid+']'); }
li.find(".cue-edit").toggle();
highlightActive(li); setPlaylistContent(json);
highlightActive(li.find('.spl_cue'));
}); li = $('#side_playlist li[unqid='+unqid+']');
li.find(".cue-edit").toggle();
highlightActive(li);
highlightActive(li.find('.spl_cue'));
});
} }
function changeFadeIn(event) { function changeFadeIn(event) {
event.stopPropagation(); event.stopPropagation();
var id, url, fadeIn, li, unqid; var span = $(this),
id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-fade",
fadeIn = $.trim(span.text()),
li = span.parents("li"),
unqid = li.attr("unqid"),
lastMod = getModified();
span = $(this); if (!isFadeValid(fadeIn)){
id = span.parent().attr("id").split("_").pop();
url = "/Playlist/set-fade";
fadeIn = $.trim(span.text());
li = span.parent().parent().parent().parent();
unqid = li.attr("unqid");
if(!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'"); showError(span, "please put in a time in seconds '00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", fadeIn: fadeIn, id: id}, function(json){ $.post(url,
{format: "json", fadeIn: fadeIn, id: id, modified: lastMod},
function(json){
if(json.response !== undefined && json.response.error) { if (json.error !== undefined){
showError(span, json.response.error); playlistError(json);
return; return;
} }
if (json.fade_error !== undefined) {
setPlaylistContent(json); showError(span, json.fade_error);
return;
li = $('#side_playlist li[unqid='+unqid+']'); }
li.find('.crossfade').toggle();
highlightActive(li.find('.spl_fade_control')); setPlaylistContent(json);
});
li = $('#side_playlist li[unqid='+unqid+']');
li.find('.crossfade').toggle();
highlightActive(li.find('.spl_fade_control'));
});
} }
function changeFadeOut(event) { function changeFadeOut(event) {
event.stopPropagation(); event.stopPropagation();
var id, url, fadeOut, li, unqid; var span = $(this),
id = span.parent().attr("id").split("_").pop(),
url = "/Playlist/set-fade",
fadeOut = $.trim(span.text()),
li = span.parents("li"),
unqid = li.attr("unqid"),
lastMod = getModified();
span = $(this); if (!isFadeValid(fadeOut)){
id = span.parent().attr("id").split("_").pop();
url = "/Playlist/set-fade";
fadeOut = $.trim(span.text());
li = span.parent().parent().parent().parent();
unqid = li.attr("unqid");
if(!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'"); showError(span, "please put in a time in seconds '00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", fadeOut: fadeOut, id: id}, function(json){ $.post(url,
if(json.response !== undefined && json.response.error) { {format: "json", fadeOut: fadeOut, id: id, modified: lastMod},
showError(span, json.response.error); function(json){
return;
} if (json.error !== undefined){
playlistError(json);
setPlaylistContent(json); return;
}
li = $('#side_playlist li[unqid='+unqid+']'); if (json.fade_error !== undefined) {
li.find('.crossfade').toggle(); showError(span, json.fade_error);
highlightActive(li.find('.spl_fade_control')); return;
}); }
setPlaylistContent(json);
li = $('#side_playlist li[unqid='+unqid+']');
li.find('.crossfade').toggle();
highlightActive(li.find('.spl_fade_control'));
});
} }
function submitOnEnter(event) { function submitOnEnter(event) {
@ -221,27 +246,33 @@ var AIRTIME = (function(AIRTIME){
} }
function editName() { function editName() {
var nameElement = $(this); var nameElement = $(this),
var playlistName = nameElement.text(); playlistName = nameElement.text(),
lastMod = getModified();
$("#playlist_name_input") $("#playlist_name_input")
.removeClass('element_hidden') .removeClass('element_hidden')
.val(playlistName) .val(playlistName)
.keydown(function(event){ .keydown(function(event){
if(event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault(); event.preventDefault();
var input = $(this); var input = $(this),
var url; url = '/Playlist/set-playlist-name';
url = '/Playlist/set-playlist-name';
$.post(url, {format: "json", name: input.val()}, function(json){ $.post(url,
if(json.playlist_error == true){ {format: "json", name: input.val(), modified: lastMod},
alertPlaylistErrorAndReload(); function(json){
}
input.addClass('element_hidden'); if (json.error !== undefined) {
nameElement.text(json.playlistName); playlistError(json);
redrawLib(); }
}); else {
setModified(json.modified);
input.addClass('element_hidden');
nameElement.text(json.playlistName);
redrawLib();
}
});
} }
}) })
.focus(); .focus();
@ -269,7 +300,9 @@ var AIRTIME = (function(AIRTIME){
$('#spl_sortable') $('#spl_sortable')
.empty() .empty()
.append(json.html); .append(json.html);
setModified(json.modified);
redrawLib(); redrawLib();
} }
@ -281,6 +314,10 @@ var AIRTIME = (function(AIRTIME){
return parseInt($("#pl_lastMod").val(), 10); return parseInt($("#pl_lastMod").val(), 10);
} }
function setModified(modified) {
$("#pl_lastMod").val(modified);
}
function openPlaylist(json) { function openPlaylist(json) {
$("#side_playlist") $("#side_playlist")
@ -335,9 +372,11 @@ var AIRTIME = (function(AIRTIME){
function setUpPlaylist(playlist) { function setUpPlaylist(playlist) {
var playlist = $("#side_playlist"), var playlist = $("#side_playlist"),
sortableConf; sortableConf,
cachedDescription;
playlist.find("#spl_crossfade").on("click", function(){ playlist.find("#spl_crossfade").on("click", function() {
var lastMod = getModified();
if ($(this).hasClass("ui-state-active")) { if ($(this).hasClass("ui-state-active")) {
$(this).removeClass("ui-state-active"); $(this).removeClass("ui-state-active");
@ -348,19 +387,23 @@ var AIRTIME = (function(AIRTIME){
var url = '/Playlist/get-playlist-fades'; var url = '/Playlist/get-playlist-fades';
$.get(url, {format: "json"}, function(json){ $.get(url,
if(json.playlist_error == true){ {format: "json", modified: lastMod},
alertPlaylistErrorAndReload(); function(json){
} if (json.error !== undefined){
playlist.find("#spl_fade_in_main").find("span") playlistError(json);
.empty() }
.append(json.fadeIn); else {
playlist.find("#spl_fade_out_main").find("span") playlist.find("#spl_fade_in_main").find("span")
.empty() .empty()
.append(json.fadeOut); .append(json.fadeIn);
playlist.find("#spl_fade_out_main").find("span")
playlist.find("#crossfade_main").show(); .empty()
}); .append(json.fadeOut);
playlist.find("#crossfade_main").show();
}
});
} }
}); });
@ -369,7 +412,8 @@ var AIRTIME = (function(AIRTIME){
playlist.find("#fieldset-metadate_change > legend").on("click", function(){ playlist.find("#fieldset-metadate_change > legend").on("click", function(){
var descriptionElement = $(this).parent(); var descriptionElement = $(this).parent();
if(descriptionElement.hasClass("closed")) { if (descriptionElement.hasClass("closed")) {
cachedDescription = playlist.find("#fieldset-metadate_change textarea").val();
descriptionElement.removeClass("closed"); descriptionElement.removeClass("closed");
} }
else { else {
@ -380,77 +424,71 @@ var AIRTIME = (function(AIRTIME){
playlist.find("#description_save").on("click", function(){ playlist.find("#description_save").on("click", function(){
var textarea = playlist.find("#fieldset-metadate_change textarea"), var textarea = playlist.find("#fieldset-metadate_change textarea"),
description = textarea.val(), description = textarea.val(),
url; url,
lastMod = getModified();;
url = '/Playlist/set-playlist-description'; url = '/Playlist/set-playlist-description';
$.post(url, {format: "json", description: description}, function(json){ $.post(url,
if(json.playlist_error == true){ {format: "json", description: description, modified: lastMod},
alertPlaylistErrorAndReload(); function(json){
} if (json.error !== undefined){
else{ playlistError(json);
textarea.val(json.playlistDescription); }
} else{
setModified(json.modified);
playlist.find("#fieldset-metadate_change").addClass("closed"); textarea.val(json.description);
redrawLib(); playlist.find("#fieldset-metadate_change").addClass("closed");
}); redrawLib();
}
});
}); });
playlist.find("#description_cancel").on("click", function(){ playlist.find("#description_cancel").on("click", function(){
var textarea = playlist.find("#fieldset-metadate_change textarea"), var textarea = playlist.find("#fieldset-metadate_change textarea");
url;
url = '/Playlist/set-playlist-description'; textarea.val(cachedDescription);
playlist.find("#fieldset-metadate_change").addClass("closed");
$.post(url, {format: "json"}, function(json){
if(json.playlist_error == true){
alertPlaylistErrorAndReload();
}
else{
textarea.val(json.playlistDescription);
}
playlist.find("#fieldset-metadate_change").addClass("closed");
});
}); });
playlist.find("#spl_fade_in_main span:first").on("blur", function(event){ playlist.find("#spl_fade_in_main span:first").on("blur", function(event){
event.stopPropagation(); event.stopPropagation();
var url, fadeIn, span; var url = "/Playlist/set-playlist-fades",
span = $(this); span = $(this),
url = "/Playlist/set-playlist-fades"; fadeIn = $.trim(span.text()),
fadeIn = $.trim(span.text()); lastMod = getModified();
if(!isFadeValid(fadeIn)){ if (!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'"); showError(span, "please put in a time in seconds '00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", fadeIn: fadeIn}, function(json){ $.post(url,
{format: "json", fadeIn: fadeIn, modified: lastMod},
hideError(span); function(json){
}); hideError(span);
});
}); });
playlist.find("#spl_fade_out_main span:last").on("blur", function(event){ playlist.find("#spl_fade_out_main span:last").on("blur", function(event){
event.stopPropagation(); event.stopPropagation();
var url, fadeOut, span; var url = "/Playlist/set-playlist-fades",
span = $(this),
span = $(this); fadeOut = $.trim(span.text()),
url = "/Playlist/set-playlist-fades"; lastMod = getModified();
fadeOut = $.trim(span.text());
if(!isFadeValid(fadeOut)){ if(!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'"); showError(span, "please put in a time in seconds '00 (.000000)'");
return; return;
} }
$.post(url, {format: "json", fadeOut: fadeOut}, function(json){ $.post(url,
hideError(span); {format: "json", fadeOut: fadeOut, modified: lastMod},
}); function(json){
hideError(span);
});
}); });
playlist.find("#spl_fade_in_main span:first, #spl_fade_out_main span:first") playlist.find("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
@ -462,17 +500,19 @@ var AIRTIME = (function(AIRTIME){
}); });
sortableConf = (function(){ sortableConf = (function(){
var origRow, var origTrs,
html,
fnReceive, fnReceive,
fnUpdate; fnUpdate;
fnReceive = function(event, ui) { fnReceive = function(event, ui) {
origRow = ui.item; origTrs = ui.helper.find('tr[id^="au"]');
html = ui.helper.html();
}; };
fnUpdate = function(event, ui) { fnUpdate = function(event, ui) {
var prev, var prev,
aItem = [], aItems = [],
iAfter, iAfter,
sAddType; sAddType;
@ -487,21 +527,29 @@ var AIRTIME = (function(AIRTIME){
} }
//item was dragged in from library datatable //item was dragged in from library datatable
if (origRow !== undefined) { if (origTrs !== undefined) {
aItem.push(origRow.data("aData").id);
origRow = undefined; playlist.find("tr.ui-draggable")
AIRTIME.playlist.fnAddItems(aItem, iAfter, sAddType); .after(html)
.empty();
origTrs.each(function(i, el){
aItems.push($("#"+$(el).attr("id")).data("aData").id);
});
origTrs = undefined;
AIRTIME.playlist.fnAddItems(aItems, iAfter, sAddType);
} }
//item was reordered. //item was reordered.
else { else {
aItem.push(parseInt(ui.item.attr("id").split("_").pop(), 10)); aItems.push(parseInt(ui.item.attr("id").split("_").pop(), 10));
AIRTIME.playlist.fnMoveItems(aItem, iAfter); AIRTIME.playlist.fnMoveItems(aItems, iAfter);
} }
}; };
return { return {
items: 'li', items: 'li',
placeholder: "placeholder lib-placeholder ui-state-highlight", placeholder: "placeholder ui-state-highlight",
forcePlaceholderSize: true, forcePlaceholderSize: true,
handle: 'div.list-item-container', handle: 'div.list-item-container',
start: function(event, ui) { start: function(event, ui) {
@ -518,30 +566,28 @@ var AIRTIME = (function(AIRTIME){
} }
mod.fnNew = function() { mod.fnNew = function() {
var url; var url = '/Playlist/new';
stopAudioPreview(); stopAudioPreview();
url = '/Playlist/new';
$.post(url,
$.post(url, {format: "json"}, function(json){ {format: "json"},
openPlaylist(json); function(json){
redrawLib(); openPlaylist(json);
}); redrawLib();
});
}; };
mod.fnEdit = function(id) { mod.fnEdit = function(id) {
var url; var url = '/Playlist/edit';;
stopAudioPreview(); stopAudioPreview();
url = '/Playlist/edit';
$.post(url, $.post(url,
{format: "json", id: id}, {format: "json", id: id},
function(json){ function(json){
openPlaylist(json); openPlaylist(json);
//redrawLib(); });
});
}; };
mod.fnDelete = function(plid) { mod.fnDelete = function(plid) {
@ -557,33 +603,51 @@ var AIRTIME = (function(AIRTIME){
function(json){ function(json){
openPlaylist(json); openPlaylist(json);
redrawLib(); redrawLib();
}); });
}; };
mod.fnAddItems = function(aItems, iAfter, sAddType) { mod.fnAddItems = function(aItems, iAfter, sAddType) {
var lastMod = getModified();
$.post("/playlist/add-items", $.post("/playlist/add-items",
{format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType}, {format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType, "modified": lastMod},
function(json){ function(json){
setPlaylistContent(json); if (json.error !== undefined) {
playlistError(json);
}
else {
setPlaylistContent(json);
}
}); });
}; };
mod.fnMoveItems = function(aIds, iAfter) { mod.fnMoveItems = function(aIds, iAfter) {
var lastMod = getModified();
$.post("/playlist/move-items", $.post("/playlist/move-items",
{format: "json", "ids": aIds, "afterItem": iAfter}, {format: "json", "ids": aIds, "afterItem": iAfter, "modified": lastMod},
function(json){ function(json){
setPlaylistContent(json); if (json.error !== undefined) {
playlistError(json);
}
else {
setPlaylistContent(json);
}
}); });
}; };
mod.fnDeleteItems = function(aItems) { mod.fnDeleteItems = function(aItems) {
var lastMod = getModified();
$.post("/playlist/delete-items", $.post("/playlist/delete-items",
{format: "json", "ids": aItems}, {format: "json", "ids": aItems, "modified": lastMod},
function(json){ function(json){
setPlaylistContent(json); if (json.error !== undefined) {
playlistError(json);
}
else {
setPlaylistContent(json);
}
}); });
}; };

View file

@ -26,155 +26,8 @@ function checkShowLength(json) {
} }
} }
function setScheduleDialogHtml(json) {
var dt;
dt = $('#schedule_playlists').dataTable();
dt.fnDraw();
$("#schedule_playlist_chosen")
.empty()
.append(json.chosen);
$("#show_time_filled").empty().append(json.timeFilled);
$("#show_progressbar").progressbar( "value" , json.percentFilled );
checkShowLength(json);
}
function setScheduleDialogEvents(dialog) {
dialog.find(".ui-icon-triangle-1-e").click(function(){
var span = $(this);
if(span.hasClass("ui-icon-triangle-1-s")) {
span
.removeClass("ui-icon-triangle-1-s")
.addClass("ui-icon ui-icon-triangle-1-e");
$(this).parent().parent().find(".group_list").hide();
}
else if(span.hasClass("ui-icon-triangle-1-e")) {
span
.removeClass("ui-icon-triangle-1-e")
.addClass("ui-icon ui-icon-triangle-1-s");
$(this).parent().parent().find(".group_list").show();
}
});
dialog.find(".ui-icon-close").click(function(){
var groupId, url;
groupId = $(this).parent().parent().attr("id").split("_").pop();
url = '/Schedule/remove-group';
$.post(url,
{format: "json", groupId: groupId},
function(json){
if(json.show_error == true){
alertShowErrorAndReload();
}
var dialog = $("#schedule_playlist_dialog");
setScheduleDialogHtml(json);
setScheduleDialogEvents(dialog);
});
});
}
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var id = "pl_" + aData['id'];
$(nRow).attr("id", id);
return nRow;
}
function addDtPlaylistEvents() {
$('#schedule_playlists tbody tr')
.draggable({
helper: 'clone'
});
}
function dtDrawCallback() {
addDtPlaylistEvents();
}
function makeScheduleDialog(dialog, json) {
if(json.show_error == true){
alertShowErrorAndReload();
}
dialog.find('#schedule_playlists').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Schedule/find-playlists/format/json",
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"fnRowCallback": dtRowCallback,
"fnDrawCallback": dtDrawCallback,
"aoColumns": [
/* Id */ {"sTitle": "ID", "sName": "pl.id", "bSearchable": false, "bVisible": false, "mDataProp": "id"},
/* Description */ {"sTitle": "Description", "sName": "pl.description", "bSearchable": false, "bVisible": false, "mDataProp": "description"},
/* Name */ {"sTitle": "Title", "sName": "pl.name", "mDataProp": "name"},
/* Creator */ {"sTitle": "Creator", "sName": "pl.creator", "mDataProp": "creator"},
/* Length */ {"sTitle": "Length", "sName": "plt.length", "mDataProp": "length"},
/* Editing */ {"sTitle": "Editing", "sName": "sub.login", "mDataProp": "login"}
],
"aaSorting": [[2,'asc']],
"sPaginationType": "full_numbers",
"bJQueryUI": true,
"bAutoWidth": false
});
//classes added for Vladimir's styles.css
dialog.find("#schedule_playlists_length select").addClass('input_select');
dialog.find("#schedule_playlists_filter input").addClass('input_text auto-search');
dialog.find("#schedule_playlist_chosen")
.append(json.chosen)
.droppable({
drop: function(event, ui) {
var pl_id, url, search;
search = $("#schedule_playlist_search").val();
pl_id = $(ui.helper).attr("id").split("_").pop();
url = '/Schedule/schedule-show/format/json';
$.post(url,
{plId: pl_id, search: search},
function(json){
if(json.show_error == true){
alertShowErrorAndReload();
}
var dialog = $("#schedule_playlist_dialog");
setScheduleDialogHtml(json);
setScheduleDialogEvents(dialog);
});
}
});
dialog.find("#show_progressbar").progressbar({
value: json.percentFilled
});
setScheduleDialogEvents(dialog);
}
function confirmCancelShow(show_instance_id){ function confirmCancelShow(show_instance_id){
if(confirm('Erase current show and stop playback?')){ if (confirm('Erase current show and stop playback?')){
var url = "/Schedule/cancel-current-show/id/"+show_instance_id; var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
$.ajax({ $.ajax({
url: url, url: url,
@ -184,7 +37,7 @@ function confirmCancelShow(show_instance_id){
} }
function confirmCancelRecordedShow(show_instance_id){ function confirmCancelRecordedShow(show_instance_id){
if(confirm('Erase current show and stop recording?')){ if (confirm('Erase current show and stop recording?')){
var url = "/Schedule/cancel-current-show/id/"+show_instance_id; var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
$.ajax({ $.ajax({
url: url, url: url,
@ -214,45 +67,42 @@ function uploadToSoundCloud(show_instance_id){
} }
} }
function buildContentDialog(json){ function buildContentDialog (json){
if(json.show_error == true){ var dialog = $(json.dialog),
viewportwidth,
viewportheight,
height,
width;
if (json.show_error == true){
alertShowErrorAndReload(); alertShowErrorAndReload();
} }
var dialog = $(json.dialog);
dialog.find("#show_progressbar").progressbar({ dialog.find("#show_progressbar").progressbar({
value: json.percentFilled value: json.percentFilled
}); });
var viewportwidth;
var viewportheight;
// the more standards compliant browsers (mozilla/netscape/opera/IE7) use // the more standards compliant browsers (mozilla/netscape/opera/IE7) use
// window.innerWidth and window.innerHeight // window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined') { if (typeof window.innerWidth != 'undefined') {
viewportwidth = window.innerWidth, viewportheight = window.innerHeight; viewportwidth = window.innerWidth, viewportheight = window.innerHeight;
} }
// IE6 in standards compliant mode (i.e. with a valid doctype as the first // IE6 in standards compliant mode (i.e. with a valid doctype as the first
// line in the document) // line in the document)
else if (typeof document.documentElement != 'undefined' else if (typeof document.documentElement != 'undefined'
&& typeof document.documentElement.clientWidth != 'undefined' && typeof document.documentElement.clientWidth != 'undefined'
&& document.documentElement.clientWidth != 0) { && document.documentElement.clientWidth != 0) {
viewportwidth = document.documentElement.clientWidth; viewportwidth = document.documentElement.clientWidth;
viewportheight = document.documentElement.clientHeight; viewportheight = document.documentElement.clientHeight;
} }
// older versions of IE // older versions of IE
else { else {
viewportwidth = document.getElementsByTagName('body')[0].clientWidth; viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
viewportheight = document.getElementsByTagName('body')[0].clientHeight; viewportheight = document.getElementsByTagName('body')[0].clientHeight;
} }
var height = viewportheight * 2/3; height = viewportheight * 2/3;
var width = viewportwidth * 4/5; width = viewportwidth * 4/5;
dialog.dialog({ dialog.dialog({
autoOpen: false, autoOpen: false,
@ -269,37 +119,6 @@ function buildContentDialog(json){
dialog.dialog('open'); dialog.dialog('open');
} }
function buildScheduleDialog(json){
var dialog;
if(json.show_error == true){
alertShowErrorAndReload();
}
if(json.error) {
alert(json.error);
return;
}
dialog = $(json.dialog);
makeScheduleDialog(dialog, json);
dialog.dialog({
autoOpen: false,
title: 'Schedule Media',
width: 1100,
height: 550,
modal: true,
close: closeDialog,
buttons: {"Ok": function() {
dialog.remove();
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
}}
});
dialog.dialog('open');
checkShowLength(json);
}
/** /**
* Use user preference for time scale; defaults to month if preference was never set * Use user preference for time scale; defaults to month if preference was never set
*/ */
@ -412,7 +231,6 @@ $(document).ready(function() {
//define a content callback. //define a content callback.
if (oItems.content !== undefined) { if (oItems.content !== undefined) {
//delete a single instance
callback = function() { callback = function() {
$.get(oItems.content.url, {format: "json", id: data.id}, function(json){ $.get(oItems.content.url, {format: "json", id: data.id}, function(json){
buildContentDialog(json); buildContentDialog(json);

View file

@ -13,17 +13,15 @@ var AIRTIME = (function(AIRTIME){
} }
} }
mod.fnAdd = function(aMediaIds, aSchedIds, callback) { mod.fnAdd = function(aMediaIds, aSchedIds) {
var oLibTT = TableTools.fnGetInstance('library_display');
$.post("/showbuilder/schedule-add", $.post("/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds}, {"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){ function(json){
checkError(json); checkError(json);
oSchedTable.fnDraw(); oSchedTable.fnDraw();
oLibTT.fnSelectNone();
if ($.isFunction(callback)) {
callback();
}
}); });
}; };
@ -64,8 +62,7 @@ $(document).ready(function() {
fnAddSelectedItems, fnAddSelectedItems,
fnRemoveSelectedItems, fnRemoveSelectedItems,
oRange, oRange,
fnServerData, fnServerData;
fnShowBuilderRowCallback;
oBaseDatePickerSettings = { oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd', dateFormat: 'yy-mm-dd',
@ -180,87 +177,17 @@ $(document).ready(function() {
fnServerData.start = oRange.start; fnServerData.start = oRange.start;
fnServerData.end = oRange.end; fnServerData.end = oRange.end;
fnShowBuilderRowCallback = function ( nRow, aData, iDisplayIndex, iDisplayIndexFull ){
var i,
sSeparatorHTML,
fnPrepareSeparatorRow,
node,
cl="";
//save some info for reordering purposes.
$(nRow).data({"aData": aData});
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
node = nRow.children[iNodeIndex];
node.innerHTML = sRowContent;
node.setAttribute('colspan',100);
for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) {
node = nRow.children[i];
node.innerHTML = "";
node.setAttribute("style", "display : none");
}
nRow.className = sClass;
};
if (aData.header === true) {
cl = 'sb-header';
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
}
else if (aData.footer === true) {
node = nRow.children[0];
cl = 'sb-footer';
//check the show's content status.
if (aData.runtime > 0) {
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
cl = cl + ' ui-state-highlight';
}
else {
node.innerHTML = '<span class="ui-icon ui-icon-notice"></span>';
cl = cl + ' ui-state-error';
}
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
}
else {
//$(nRow).attr("id", "sched_"+aData.id);
node = nRow.children[0];
if (aData.checkbox === true) {
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
}
else {
node.innerHTML = '';
cl = cl + " sb-not-allowed";
}
if (aData.empty === true) {
sSeparatorHTML = '<span>Show Empty</span>';
cl = cl + " sb-empty odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
}
}
};
fnRemoveSelectedItems = function() { fnRemoveSelectedItems = function() {
var oTT = TableTools.fnGetInstance('show_builder_table'), var oTT = TableTools.fnGetInstance('show_builder_table'),
aData = oTT.fnGetSelectedData(), aData = oTT.fnGetSelectedData(),
item, i,
length,
temp, temp,
aItems = []; aItems = [];
for (item in aData) { for (i=0, length = aData.length; i < length; i++) {
temp = aData[item]; temp = aData[i];
if (temp !== null && temp.hasOwnProperty('id')) { aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
}
} }
AIRTIME.showbuilder.fnRemove(aItems); AIRTIME.showbuilder.fnRemove(aItems);
@ -268,10 +195,10 @@ $(document).ready(function() {
oTable = tableDiv.dataTable( { oTable = tableDiv.dataTable( {
"aoColumns": [ "aoColumns": [
/* checkbox */ {"mDataProp": "checkbox", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"}, /* checkbox */ {"mDataProp": "allowed", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
/* starts */{"mDataProp": "starts", "sTitle": "Airtime"}, /* starts */{"mDataProp": "starts", "sTitle": "Start"},
/* ends */{"mDataProp": "ends", "sTitle": "Off Air"}, /* ends */{"mDataProp": "ends", "sTitle": "End"},
/* runtime */{"mDataProp": "runtime", "sTitle": "Runtime"}, /* runtime */{"mDataProp": "runtime", "sTitle": "Duration", "sClass": "library_length"},
/* title */{"mDataProp": "title", "sTitle": "Title"}, /* title */{"mDataProp": "title", "sTitle": "Title"},
/* creator */{"mDataProp": "creator", "sTitle": "Creator"}, /* creator */{"mDataProp": "creator", "sTitle": "Creator"},
/* album */{"mDataProp": "album", "sTitle": "Album"} /* album */{"mDataProp": "album", "sTitle": "Album"}
@ -284,9 +211,167 @@ $(document).ready(function() {
"bServerSide": true, "bServerSide": true,
"bInfo": false, "bInfo": false,
"bAutoWidth": false, "bAutoWidth": false,
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
//remove oData components we don't want to save.
delete oData.oSearch;
delete oData.aoSearchCols;
},
"fnStateSave": function (oSettings, oData) {
$.ajax({
url: "/usersettings/set-timeline-datatable",
type: "POST",
data: {settings : oData, format: "json"},
dataType: "json",
success: function(){},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
});
},
"fnStateLoad": function (oSettings) {
var o;
$.ajax({
url: "/usersettings/get-timeline-datatable",
type: "GET",
data: {format: "json"},
dataType: "json",
async: false,
success: function(json){
o = json.settings;
},
error: function (jqXHR, textStatus, errorThrown) {
var x;
}
});
return o;
},
"fnStateLoadParams": function (oSettings, oData) {
var i,
length,
a = oData.abVisCols;
//putting serialized data back into the correct js type to make
//sure everything works properly.
for (i = 0, length = a.length; i < length; i++) {
a[i] = (a[i] === "true") ? true : false;
}
a = oData.ColReorder;
for (i = 0, length = a.length; i < length; i++) {
a[i] = parseInt(a[i], 10);
}
oData.iCreate = parseInt(oData.iCreate, 10);
},
"fnServerData": fnServerData, "fnServerData": fnServerData,
"fnRowCallback": fnShowBuilderRowCallback, "fnRowCallback": function ( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var i,
sSeparatorHTML,
fnPrepareSeparatorRow,
node,
cl="";
//save some info for reordering purposes.
$(nRow).data({"aData": aData});
if (aData.allowed !== true) {
$(nRow).addClass("sb-not-allowed");
}
//status used to colour tracks.
if (aData.status === 1) {
$(nRow).addClass("sb-boundry");
}
else if (aData.status === 2) {
$(nRow).addClass("sb-over");
}
fnPrepareSeparatorRow = function(sRowContent, sClass, iNodeIndex) {
node = nRow.children[iNodeIndex];
node.innerHTML = sRowContent;
node.setAttribute('colspan',100);
for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) {
node = nRow.children[i];
node.innerHTML = "";
node.setAttribute("style", "display : none");
}
$(nRow).addClass(sClass);
};
if (aData.header === true) {
cl = 'sb-header';
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
}
else if (aData.footer === true) {
node = nRow.children[0];
cl = 'sb-footer';
//check the show's content status.
if (aData.runtime > 0) {
node.innerHTML = '<span class="ui-icon ui-icon-check"></span>';
cl = cl + ' ui-state-highlight';
}
else {
node.innerHTML = '<span class="ui-icon ui-icon-notice"></span>';
cl = cl + ' ui-state-error';
}
sSeparatorHTML = '<span>'+aData.fRuntime+'</span>';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
}
else if (aData.empty === true) {
sSeparatorHTML = '<span>Show Empty</span>';
cl = cl + " sb-empty odd";
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
}
else {
node = nRow.children[0];
if (aData.allowed === true) {
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
}
else {
node.innerHTML = '';
}
}
},
"fnDrawCallback": function(oSettings, json) {
var wrapperDiv,
markerDiv,
td;
//create cursor arrows.
tableDiv.find("tr:not(:first, .sb-footer, .sb-empty, .sb-not-allowed)").each(function(i, el) {
td = $(el).find("td:first");
if (td.hasClass("dataTables_empty")) {
return false;
}
wrapperDiv = $("<div />", {
"class": "innerWrapper",
"css": {
"height": td.height()
}
});
markerDiv = $("<div />", {
"class": "marker"
});
td.append(markerDiv).wrapInner(wrapperDiv);
});
},
"fnHeaderCallback": function(nHead) { "fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false); $(nHead).find("input[type=checkbox]").attr("checked", false);
}, },
@ -311,8 +396,9 @@ $(document).ready(function() {
var node = e.currentTarget; var node = e.currentTarget;
//don't select separating rows, or shows without privileges. //don't select separating rows, or shows without privileges.
if ($(node).hasClass("sb-header") if ($(node).hasClass("sb-header")
|| $(node).hasClass("sb-footer") || $(node).hasClass("sb-footer")
|| $(node).hasClass("sb-not-allowed")) { || $(node).hasClass("sb-empty")
|| $(node).hasClass("sb-not-allowed")) {
return false; return false;
} }
return true; return true;
@ -353,7 +439,7 @@ $(document).ready(function() {
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
var allowedNodes; var allowedNodes;
allowedNodes = oTable.find('tr:not(:first):not(.sb-header):not(.sb-footer):not(.sb-not-allowed)'); allowedNodes = oTable.find('tr:not(:first, .sb-header, .sb-empty, .sb-footer, .sb-not-allowed)');
allowedNodes.each(function(i, el){ allowedNodes.each(function(i, el){
oTT.fnSelect(el); oTT.fnSelect(el);
@ -394,21 +480,26 @@ $(document).ready(function() {
}); });
var sortableConf = (function(){ var sortableConf = (function(){
var origRow, var origTrs,
oItemData, aItemData = [],
oPrevData, oPrevData,
fnAdd, fnAdd,
fnMove, fnMove,
fnReceive, fnReceive,
fnUpdate; fnUpdate,
i,
html;
fnAdd = function() { fnAdd = function() {
var aMediaIds = [], var aMediaIds = [],
aSchedIds = []; aSchedIds = [],
oLibTT = TableTools.fnGetInstance('library_display');
for(i=0; i < aItemData.length; i++) {
aMediaIds.push({"id": aItemData[i].id, "type": aItemData[i].ftype});
}
aSchedIds.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp}); aSchedIds.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp});
aMediaIds.push({"id": oItemData.id, "type": oItemData.ftype});
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds); AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
}; };
@ -416,28 +507,38 @@ $(document).ready(function() {
var aSelect = [], var aSelect = [],
aAfter = []; aAfter = [];
aSelect.push({"id": oItemData.id, "instance": oItemData.instance, "timestamp": oItemData.timestamp}); aSelect.push({"id": aItemData[0].id, "instance": aItemData[0].instance, "timestamp": aItemData[0].timestamp});
aAfter.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp}); aAfter.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp});
AIRTIME.showbuilder.fnMove(aSelect, aAfter); AIRTIME.showbuilder.fnMove(aSelect, aAfter);
}; };
fnReceive = function(event, ui) { fnReceive = function(event, ui) {
origRow = ui.item; origTrs = ui.helper.find("tr");
html = ui.helper.html();
}; };
fnUpdate = function(event, ui) { fnUpdate = function(event, ui) {
aItemData = [];
oPrevData = ui.item.prev().data("aData"); oPrevData = ui.item.prev().data("aData");
//item was dragged in //item was dragged in
if (origRow !== undefined) { if (origTrs !== undefined) {
oItemData = origRow.data("aData");
origRow = undefined; $("#show_builder_table tr.ui-draggable")
.empty()
.after(html);
origTrs.each(function(i, el){
aItemData.push($("#"+$(el).attr("id")).data("aData"));
});
origTrs = undefined;
fnAdd(); fnAdd();
} }
//item was reordered. //item was reordered.
else { else {
oItemData = ui.item.data("aData"); aItemData.push(ui.item.data("aData"));
fnMove(); fnMove();
} }
}; };
@ -445,7 +546,7 @@ $(document).ready(function() {
return { return {
placeholder: "placeholder show-builder-placeholder ui-state-highlight", placeholder: "placeholder show-builder-placeholder ui-state-highlight",
forcePlaceholderSize: true, forcePlaceholderSize: true,
items: 'tr:not(:first):not(.sb-header):not(.sb-footer):not(.sb-not-allowed)', items: 'tr:not(:first, :last, .sb-header, .sb-footer, .sb-not-allowed)',
receive: fnReceive, receive: fnReceive,
update: fnUpdate, update: fnUpdate,
start: function(event, ui) { start: function(event, ui) {
@ -463,4 +564,18 @@ $(document).ready(function() {
//set things like a reference to the table. //set things like a reference to the table.
AIRTIME.showbuilder.init(oTable); AIRTIME.showbuilder.init(oTable);
//add event to cursors.
tableDiv.find("tbody").on("click", "div.marker", function(event){
var tr = $(this).parents("tr");
if (tr.hasClass("cursor-selected-row")) {
tr.removeClass("cursor-selected-row");
}
else {
tr.addClass("cursor-selected-row");
}
return false;
});
}); });

View file

@ -1,7 +1,7 @@
/** /**
* @summary DataTables * @summary DataTables
* @description Paginate, search and sort HTML tables * @description Paginate, search and sort HTML tables
* @version 1.9.0 * @version 1.9.1.dev
* @file jquery.dataTables.js * @file jquery.dataTables.js
* @author Allan Jardine (www.sprymedia.co.uk) * @author Allan Jardine (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact * @contact www.sprymedia.co.uk/contact
@ -1272,6 +1272,7 @@
var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] ); var aPreDraw = _fnCallbackFire( oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings] );
if ( $.inArray( false, aPreDraw ) !== -1 ) if ( $.inArray( false, aPreDraw ) !== -1 )
{ {
_fnProcessingDisplay( oSettings, false );
return; return;
} }
@ -1787,8 +1788,8 @@
function _fnAjaxParameters( oSettings ) function _fnAjaxParameters( oSettings )
{ {
var iColumns = oSettings.aoColumns.length; var iColumns = oSettings.aoColumns.length;
var aoData = [], mDataProp; var aoData = [], mDataProp, aaSort, aDataSort;
var i; var i, j;
aoData.push( { "name": "sEcho", "value": oSettings.iDraw } ); aoData.push( { "name": "sEcho", "value": oSettings.iDraw } );
aoData.push( { "name": "iColumns", "value": iColumns } ); aoData.push( { "name": "iColumns", "value": iColumns } );
@ -1819,20 +1820,24 @@
/* Sorting */ /* Sorting */
if ( oSettings.oFeatures.bSort !== false ) if ( oSettings.oFeatures.bSort !== false )
{ {
var iFixed = oSettings.aaSortingFixed !== null ? oSettings.aaSortingFixed.length : 0; var iCounter = 0;
var iUser = oSettings.aaSorting.length;
aoData.push( { "name": "iSortingCols", "value": iFixed+iUser } ); aaSort = ( oSettings.aaSortingFixed !== null ) ?
for ( i=0 ; i<iFixed ; i++ ) oSettings.aaSortingFixed.concat( oSettings.aaSorting ) :
{ oSettings.aaSorting.slice();
aoData.push( { "name": "iSortCol_"+i, "value": oSettings.aaSortingFixed[i][0] } );
aoData.push( { "name": "sSortDir_"+i, "value": oSettings.aaSortingFixed[i][1] } );
}
for ( i=0 ; i<iUser ; i++ ) for ( i=0 ; i<aaSort.length ; i++ )
{ {
aoData.push( { "name": "iSortCol_"+(i+iFixed), "value": oSettings.aaSorting[i][0] } ); aDataSort = oSettings.aoColumns[ aaSort[i][0] ].aDataSort;
aoData.push( { "name": "sSortDir_"+(i+iFixed), "value": oSettings.aaSorting[i][1] } );
for ( j=0 ; j<aDataSort.length ; j++ )
{
aoData.push( { "name": "iSortCol_"+iCounter, "value": aDataSort[j] } );
aoData.push( { "name": "sSortDir_"+iCounter, "value": aaSort[i][1] } );
iCounter++;
}
} }
aoData.push( { "name": "iSortingCols", "value": iCounter } );
for ( i=0 ; i<iColumns ; i++ ) for ( i=0 ; i<iColumns ; i++ )
{ {
@ -1953,7 +1958,12 @@
nFilter.id = oSettings.sTableId+'_filter'; nFilter.id = oSettings.sTableId+'_filter';
} }
var jqFilter = $("input", nFilter); var jqFilter = $('input[type="text"]', nFilter);
// Store a reference to the input element, so other input elements could be
// added to the filter wrapper if needed (submit button for example)
nFilter._DT_Input = jqFilter[0];
jqFilter.val( oPreviousSearch.sSearch.replace('"','&quot;') ); jqFilter.val( oPreviousSearch.sSearch.replace('"','&quot;') );
jqFilter.bind( 'keyup.DT', function(e) { jqFilter.bind( 'keyup.DT', function(e) {
/* Update all other filter input elements for the new display */ /* Update all other filter input elements for the new display */
@ -1962,7 +1972,7 @@
{ {
if ( n[i] != $(this).parents('div.dataTables_filter')[0] ) if ( n[i] != $(this).parents('div.dataTables_filter')[0] )
{ {
$('input', n[i]).val( this.value ); $(n[i]._DT_Input).val( this.value );
} }
} }
@ -3048,6 +3058,7 @@
nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0], nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
nScrollBody = o.nTable.parentNode, nScrollBody = o.nTable.parentNode,
i, iLen, j, jLen, anHeadToSize, anHeadSizers, anFootSizers, anFootToSize, oStyle, iVis, i, iLen, j, jLen, anHeadToSize, anHeadSizers, anFootSizers, anFootToSize, oStyle, iVis,
nTheadSize, nTfootSize,
iWidth, aApplied=[], iSanityWidth, iWidth, aApplied=[], iSanityWidth,
nScrollFootInner = (o.nTFoot !== null) ? o.nScrollFoot.getElementsByTagName('div')[0] : null, nScrollFootInner = (o.nTFoot !== null) ? o.nScrollFoot.getElementsByTagName('div')[0] : null,
nScrollFootTable = (o.nTFoot !== null) ? nScrollFootInner.getElementsByTagName('table')[0] : null, nScrollFootTable = (o.nTFoot !== null) ? nScrollFootInner.getElementsByTagName('table')[0] : null,
@ -3058,22 +3069,7 @@
*/ */
/* Remove the old minimised thead and tfoot elements in the inner table */ /* Remove the old minimised thead and tfoot elements in the inner table */
var nTheadSize = o.nTable.getElementsByTagName('thead'); $(o.nTable).children('thead, tfoot').remove();
if ( nTheadSize.length > 0 )
{
o.nTable.removeChild( nTheadSize[0] );
}
var nTfootSize;
if ( o.nTFoot !== null )
{
/* Remove the old minimised footer element in the cloned header */
nTfootSize = o.nTable.getElementsByTagName('tfoot');
if ( nTfootSize.length > 0 )
{
o.nTable.removeChild( nTfootSize[0] );
}
}
/* Clone the current header and footer elements and then place it into the inner table */ /* Clone the current header and footer elements and then place it into the inner table */
nTheadSize = o.nTHead.cloneNode(true); nTheadSize = o.nTHead.cloneNode(true);
@ -3127,7 +3123,7 @@
if ( ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight || if ( ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||
$(nScrollBody).css('overflow-y') == "scroll") ) $(nScrollBody).css('overflow-y') == "scroll") )
{ {
o.nTable.style.width = _fnStringToCss( $(o.nTable).outerWidth()-o.oScroll.iBarWidth ); o.nTable.style.width = _fnStringToCss( $(o.nTable).outerWidth() - o.oScroll.iBarWidth);
} }
} }
else else
@ -3304,12 +3300,21 @@
var iOuterWidth = $(o.nTable).outerWidth(); var iOuterWidth = $(o.nTable).outerWidth();
nScrollHeadTable.style.width = _fnStringToCss( iOuterWidth ); nScrollHeadTable.style.width = _fnStringToCss( iOuterWidth );
nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth ); nScrollHeadInner.style.width = _fnStringToCss( iOuterWidth );
// Figure out if there are scrollbar present - if so then we need a the header and footer to
// provide a bit more space to allow "overflow" scrolling (i.e. past the scrollbar)
var bScrolling = $(o.nTable).height() > nScrollBody.clientHeight || $(nScrollBody).css('overflow-y') == "scroll";
nScrollHeadInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth+"px" : "0px";
if ( o.nTFoot !== null ) if ( o.nTFoot !== null )
{ {
nScrollFootInner.style.width = _fnStringToCss( o.nTable.offsetWidth ); nScrollFootTable.style.width = _fnStringToCss( iOuterWidth );
nScrollFootTable.style.width = _fnStringToCss( o.nTable.offsetWidth ); nScrollFootInner.style.width = _fnStringToCss( iOuterWidth );
nScrollFootInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth+"px" : "0px";
} }
/* Adjust the position of the header incase we loose the y-scrollbar */
$(nScrollBody).scroll();
/* If sorting or filtering has occurred, jump the scrolling back to the top */ /* If sorting or filtering has occurred, jump the scrolling back to the top */
if ( o.bSorted || o.bFiltered ) if ( o.bSorted || o.bFiltered )
@ -3777,14 +3782,9 @@
if ( !oSettings.oFeatures.bServerSide && if ( !oSettings.oFeatures.bServerSide &&
(oSettings.aaSorting.length !== 0 || oSettings.aaSortingFixed !== null) ) (oSettings.aaSorting.length !== 0 || oSettings.aaSortingFixed !== null) )
{ {
if ( oSettings.aaSortingFixed !== null ) aaSort = ( oSettings.aaSortingFixed !== null ) ?
{ oSettings.aaSortingFixed.concat( oSettings.aaSorting ) :
aaSort = oSettings.aaSortingFixed.concat( oSettings.aaSorting ); oSettings.aaSorting.slice();
}
else
{
aaSort = oSettings.aaSorting.slice();
}
/* If there is a sorting data type, and a fuction belonging to it, then we need to /* If there is a sorting data type, and a fuction belonging to it, then we need to
* get the data from the developer's function and apply it for this column * get the data from the developer's function and apply it for this column
@ -3797,9 +3797,16 @@
if ( DataTable.ext.afnSortData[sDataType] ) if ( DataTable.ext.afnSortData[sDataType] )
{ {
var aData = DataTable.ext.afnSortData[sDataType]( oSettings, iColumn, iVisColumn ); var aData = DataTable.ext.afnSortData[sDataType]( oSettings, iColumn, iVisColumn );
for ( j=0, jLen=aoData.length ; j<jLen ; j++ ) if ( aData.length === aoData.length )
{ {
_fnSetCellData( oSettings, j, iColumn, aData[j] ); for ( j=0, jLen=aoData.length ; j<jLen ; j++ )
{
_fnSetCellData( oSettings, j, iColumn, aData[j] );
}
}
else
{
_fnLog( oSettings, 0, "Returned data sort array (col "+iColumn+") is the wrong length" );
} }
} }
} }
@ -4532,11 +4539,11 @@
} }
else else
{ {
throw sAlert; throw new Error(sAlert);
} }
return; return;
} }
else if ( console !== undefined && console.log ) else if ( window.console && console.log )
{ {
console.log( sAlert ); console.log( sAlert );
} }
@ -4577,9 +4584,9 @@
*/ */
function _fnExtend( oOut, oExtender ) function _fnExtend( oOut, oExtender )
{ {
for ( var prop in oOut ) for ( var prop in oExtender )
{ {
if ( oOut.hasOwnProperty(prop) && oExtender[prop] !== undefined ) if ( oExtender.hasOwnProperty(prop) )
{ {
if ( typeof oInit[prop] === 'object' && $.isArray(oExtender[prop]) === false ) if ( typeof oInit[prop] === 'object' && $.isArray(oExtender[prop]) === false )
{ {
@ -4609,8 +4616,8 @@
{ {
$(n) $(n)
.bind( 'click.DT', oData, function (e) { .bind( 'click.DT', oData, function (e) {
fn(e);
n.blur(); // Remove focus outline for mouse users n.blur(); // Remove focus outline for mouse users
fn(e);
} ) } )
.bind( 'keypress.DT', oData, function (e){ .bind( 'keypress.DT', oData, function (e){
if ( e.which === 13 ) { if ( e.which === 13 ) {
@ -5384,7 +5391,7 @@
var n = oSettings.aanFeatures.f; var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i<iLen ; i++ ) for ( var i=0, iLen=n.length ; i<iLen ; i++ )
{ {
$('input', n[i]).val( sInput ); $(n[i]._DT_Input).val( sInput );
} }
} }
} }
@ -6219,8 +6226,8 @@
_fnMap( oSettings.oScroll, oInit, "bScrollInfinite", "bInfinite" ); _fnMap( oSettings.oScroll, oInit, "bScrollInfinite", "bInfinite" );
_fnMap( oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap" ); _fnMap( oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap" );
_fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" ); _fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" );
_fnMap( oSettings, oInit, "asStripClasses", "asStripeClasses" ); // legacy
_fnMap( oSettings, oInit, "asStripeClasses" ); _fnMap( oSettings, oInit, "asStripeClasses" );
_fnMap( oSettings, oInit, "asStripClasses", "asStripeClasses" ); // legacy
_fnMap( oSettings, oInit, "fnServerData" ); _fnMap( oSettings, oInit, "fnServerData" );
_fnMap( oSettings, oInit, "fnFormatNumber" ); _fnMap( oSettings, oInit, "fnFormatNumber" );
_fnMap( oSettings, oInit, "sServerMethod" ); _fnMap( oSettings, oInit, "sServerMethod" );
@ -6542,7 +6549,7 @@
* @type string * @type string
* @default Version number * @default Version number
*/ */
DataTable.version = "1.9.0"; DataTable.version = "1.9.1.dev";
/** /**
* Private data store, containing all of the settings objects that are created for the * Private data store, containing all of the settings objects that are created for the
@ -8446,7 +8453,7 @@
* $(document).ready(function() { * $(document).ready(function() {
* $('#example').dataTable( { * $('#example').dataTable( {
* "bStateSave": true, * "bStateSave": true,
* "fnStateSave": function (oSettings, oData) { * "fnStateLoad": function (oSettings, oData) {
* var o; * var o;
* *
* // Send an Ajax request to the server to get the data. Note that * // Send an Ajax request to the server to get the data. Note that
@ -8497,7 +8504,7 @@
* $('#example').dataTable( { * $('#example').dataTable( {
* "bStateSave": true, * "bStateSave": true,
* "fnStateLoadParams": function (oSettings, oData) { * "fnStateLoadParams": function (oSettings, oData) {
* oData.oFilter.sSearch = ""; * oData.oSearch.sSearch = "";
* } ); * } );
* } ); * } );
* *
@ -8528,7 +8535,7 @@
* $('#example').dataTable( { * $('#example').dataTable( {
* "bStateSave": true, * "bStateSave": true,
* "fnStateLoaded": function (oSettings, oData) { * "fnStateLoaded": function (oSettings, oData) {
* alert( 'Saved filter was: '+oData.oFilter.sSearch ); * alert( 'Saved filter was: '+oData.oSearch.sSearch );
* } ); * } );
* } ); * } );
*/ */
@ -8589,8 +8596,8 @@
* $(document).ready(function() { * $(document).ready(function() {
* $('#example').dataTable( { * $('#example').dataTable( {
* "bStateSave": true, * "bStateSave": true,
* "fnStateLoadParams": function (oSettings, oData) { * "fnStateSaveParams": function (oSettings, oData) {
* oData.oFilter.sSearch = ""; * oData.oSearch.sSearch = "";
* } ); * } );
* } ); * } );
*/ */
@ -9736,9 +9743,10 @@
* <li>string - read an object property from the data source. Note that you can * <li>string - read an object property from the data source. Note that you can
* use Javascript dotted notation to read deep properties/arrays from the * use Javascript dotted notation to read deep properties/arrays from the
* data source.</li> * data source.</li>
* <li>null - the sDafaultContent option will use used for the cell (empty * <li>null - the sDefaultContent option will be used for the cell (null
* string by default. This can be useful on generated columns such as * by default, so you will need to specify the default content you want -
* edit / delete action columns.</li> * typically an empty string). This can be useful on generated columns such
* as edit / delete action columns.</li>
* <li>function - the function given will be executed whenever DataTables * <li>function - the function given will be executed whenever DataTables
* needs to set or get the data for a cell in the column. The function * needs to set or get the data for a cell in the column. The function
* takes three parameters: * takes three parameters:
@ -11335,7 +11343,9 @@
*/ */
"string-pre": function ( a ) "string-pre": function ( a )
{ {
if ( typeof a != 'string' ) { a = ''; } if ( typeof a != 'string' ) {
a = (a !== null && a.toString) ? a.toString() : '';
}
return a.toLowerCase(); return a.toLowerCase();
}, },

View file

@ -1,153 +0,0 @@
/*
* File: jquery.dataTables.min.js
* Version: 1.9.0
* Author: Allan Jardine (www.sprymedia.co.uk)
* Info: www.datatables.net
*
* Copyright 2008-2012 Allan Jardine, all rights reserved.
*
* This source file is free software, under either the GPL v2 license or a
* BSD style license, available at:
* http://datatables.net/license_gpl2
* http://datatables.net/license_bsd
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*/
(function(i,aa,k,l){var j=function(e){function o(a,b){var c=j.defaults.columns,d=a.aoColumns.length,c=i.extend({},j.models.oColumn,c,{sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,nTh:b?b:k.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mDataProp:c.mDataProp?c.oDefaults:d});a.aoColumns.push(c);if(a.aoPreSearchCols[d]===l||null===a.aoPreSearchCols[d])a.aoPreSearchCols[d]=i.extend({},j.models.oSearch);else{c=a.aoPreSearchCols[d];
if(c.bRegex===l)c.bRegex=!0;if(c.bSmart===l)c.bSmart=!0;if(c.bCaseInsensitive===l)c.bCaseInsensitive=!0}E(a,d,null)}function E(a,b,c){b=a.aoColumns[b];if(c!==l&&null!==c){if(c.sType!==l)b.sType=c.sType,b._bAutoType=!1;i.extend(b,c);n(b,c,"sWidth","sWidthOrig");if(c.iDataSort!==l)b.aDataSort=[c.iDataSort];n(b,c,"aDataSort")}b.fnGetData=V(b.mDataProp);b.fnSetData=sa(b.mDataProp);if(!a.oFeatures.bSort)b.bSortable=!1;if(!b.bSortable||-1==i.inArray("asc",b.asSorting)&&-1==i.inArray("desc",b.asSorting))b.sSortingClass=
a.oClasses.sSortableNone,b.sSortingClassJUI="";else if(b.bSortable||-1==i.inArray("asc",b.asSorting)&&-1==i.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortable,b.sSortingClassJUI=a.oClasses.sSortJUI;else if(-1!=i.inArray("asc",b.asSorting)&&-1==i.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortableAsc,b.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed;else if(-1==i.inArray("asc",b.asSorting)&&-1!=i.inArray("desc",b.asSorting))b.sSortingClass=a.oClasses.sSortableDesc,b.sSortingClassJUI=
a.oClasses.sSortJUIDescAllowed}function r(a){if(!1===a.oFeatures.bAutoWidth)return!1;ba(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function s(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++)if(!0===a.aoColumns[d].bVisible&&c++,c==b)return d;return null}function t(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++)if(!0===a.aoColumns[d].bVisible&&c++,d==b)return!0===a.aoColumns[d].bVisible?c:null;return null}function v(a){for(var b=0,c=0;c<a.aoColumns.length;c++)!0===
a.aoColumns[c].bVisible&&b++;return b}function B(a){for(var b=j.ext.aTypes,c=b.length,d=0;d<c;d++){var f=b[d](a);if(null!==f)return f}return"string"}function D(a,b){for(var c=b.split(","),d=[],f=0,h=a.aoColumns.length;f<h;f++)for(var g=0;g<h;g++)if(a.aoColumns[f].sName==c[g]){d.push(g);break}return d}function x(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";return b.length==d?"":b.slice(0,-1)}function I(a,b,c,d){var f,h,g,e,q;if(b)for(f=b.length-1;0<=f;f--){var m=b[f].aTargets;
i.isArray(m)||F(a,1,"aTargets must be an array of targets, not a "+typeof m);for(h=0,g=m.length;h<g;h++)if("number"===typeof m[h]&&0<=m[h]){for(;a.aoColumns.length<=m[h];)o(a);d(m[h],b[f])}else if("number"===typeof m[h]&&0>m[h])d(a.aoColumns.length+m[h],b[f]);else if("string"===typeof m[h])for(e=0,q=a.aoColumns.length;e<q;e++)("_all"==m[h]||i(a.aoColumns[e].nTh).hasClass(m[h]))&&d(e,b[f])}if(c)for(f=0,a=c.length;f<a;f++)d(f,c[f])}function G(a,b){var c;c=i.isArray(b)?b.slice():i.extend(!0,{},b);var d=
a.aoData.length;c=i.extend(!0,{},j.models.oRow,{_aData:c});a.aoData.push(c);for(var f,h=0,g=a.aoColumns.length;h<g;h++)if(c=a.aoColumns[h],"function"===typeof c.fnRender&&c.bUseRendered&&null!==c.mDataProp&&J(a,d,h,R(a,d,h)),c._bAutoType&&"string"!=c.sType&&(f=w(a,d,h,"type"),null!==f&&""!==f))if(f=B(f),null===c.sType)c.sType=f;else if(c.sType!=f&&"html"!=c.sType)c.sType="string";a.aiDisplayMaster.push(d);a.oFeatures.bDeferRender||ca(a,d);return d}function ta(a){var b,c,d,f,h,g,e,q,m;if(a.bDeferLoading||
null===a.sAjaxSource){e=a.nTBody.childNodes;for(b=0,c=e.length;b<c;b++)if("TR"==e[b].nodeName.toUpperCase()){q=a.aoData.length;e[b]._DT_RowIndex=q;a.aoData.push(i.extend(!0,{},j.models.oRow,{nTr:e[b]}));a.aiDisplayMaster.push(q);g=e[b].childNodes;h=0;for(d=0,f=g.length;d<f;d++)if(m=g[d].nodeName.toUpperCase(),"TD"==m||"TH"==m)J(a,q,h,i.trim(g[d].innerHTML)),h++}}e=S(a);g=[];for(b=0,c=e.length;b<c;b++)for(d=0,f=e[b].childNodes.length;d<f;d++)h=e[b].childNodes[d],m=h.nodeName.toUpperCase(),("TD"==m||
"TH"==m)&&g.push(h);for(f=0,e=a.aoColumns.length;f<e;f++){m=a.aoColumns[f];if(null===m.sTitle)m.sTitle=m.nTh.innerHTML;h=m._bAutoType;q="function"===typeof m.fnRender;var o=null!==m.sClass,r=m.bVisible,l,n;if(h||q||o||!r)for(b=0,c=a.aoData.length;b<c;b++){d=a.aoData[b];l=g[b*e+f];if(h&&"string"!=m.sType&&(n=w(a,b,f,"type"),""!==n))if(n=B(n),null===m.sType)m.sType=n;else if(m.sType!=n&&"html"!=m.sType)m.sType="string";if("function"===typeof m.mDataProp)l.innerHTML=w(a,b,f,"display");if(q)n=R(a,b,f),
l.innerHTML=n,m.bUseRendered&&J(a,b,f,n);o&&(l.className+=" "+m.sClass);r?d._anHidden[f]=null:(d._anHidden[f]=l,l.parentNode.removeChild(l));m.fnCreatedCell&&m.fnCreatedCell.call(a.oInstance,l,w(a,b,f,"display"),d._aData,b,f)}}if(0!==a.aoRowCreatedCallback.length)for(b=0,c=a.aoData.length;b<c;b++)d=a.aoData[b],C(a,"aoRowCreatedCallback",null,[d.nTr,d._aData,b])}function K(a,b){return b._DT_RowIndex!==l?b._DT_RowIndex:null}function da(a,b,c){for(var b=L(a,b),d=0,a=a.aoColumns.length;d<a;d++)if(b[d]===
c)return d;return-1}function W(a,b,c){for(var d=[],f=0,h=a.aoColumns.length;f<h;f++)d.push(w(a,b,f,c));return d}function w(a,b,c,d){var f=a.aoColumns[c];if((c=f.fnGetData(a.aoData[b]._aData,d))===l){if(a.iDrawError!=a.iDraw&&null===f.sDefaultContent)F(a,0,"Requested unknown parameter '"+f.mDataProp+"' from the data source for row "+b),a.iDrawError=a.iDraw;return f.sDefaultContent}if(null===c&&null!==f.sDefaultContent)c=f.sDefaultContent;else if("function"===typeof c)return c();return"display"==d&&
null===c?"":c}function J(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function V(a){if(null===a)return function(){return null};if("function"===typeof a)return function(b,d){return a(b,d)};if("string"===typeof a&&-1!=a.indexOf(".")){var b=a.split(".");return function(a){for(var d=0,f=b.length;d<f;d++)if(a=a[b[d]],a===l)return l;return a}}return function(b){return b[a]}}function sa(a){if(null===a)return function(){};if("function"===typeof a)return function(b,d){a(b,"set",d)};if("string"===
typeof a&&-1!=a.indexOf(".")){var b=a.split(".");return function(a,d){for(var f=0,h=b.length-1;f<h;f++)a=a[b[f]];a[b[b.length-1]]=d}}return function(b,d){b[a]=d}}function X(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function ea(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);z(a)}function fa(a,b){for(var c=-1,d=0,f=a.length;d<f;d++)a[d]==b?c=d:a[d]>b&&a[d]--; -1!=c&&a.splice(c,
1)}function R(a,b,c){var d=a.aoColumns[c];return d.fnRender({iDataRow:b,iDataColumn:c,oSettings:a,aData:a.aoData[b]._aData,mDataProp:d.mDataProp},w(a,b,c,"display"))}function ca(a,b){var c=a.aoData[b],d;if(null===c.nTr){c.nTr=k.createElement("tr");c.nTr._DT_RowIndex=b;if(c._aData.DT_RowId)c.nTr.id=c._aData.DT_RowId;c._aData.DT_RowClass&&i(c.nTr).addClass(c._aData.DT_RowClass);for(var f=0,h=a.aoColumns.length;f<h;f++){var g=a.aoColumns[f];d=k.createElement("td");d.innerHTML="function"===typeof g.fnRender&&
(!g.bUseRendered||null===g.mDataProp)?R(a,b,f):w(a,b,f,"display");if(null!==g.sClass)d.className=g.sClass;g.bVisible?(c.nTr.appendChild(d),c._anHidden[f]=null):c._anHidden[f]=d;g.fnCreatedCell&&g.fnCreatedCell.call(a.oInstance,d,w(a,b,f,"display"),c._aData,b,f)}C(a,"aoRowCreatedCallback",null,[c.nTr,c._aData,b])}}function ua(a){var b,c,d;if(0!==a.nTHead.getElementsByTagName("th").length)for(b=0,d=a.aoColumns.length;b<d;b++){if(c=a.aoColumns[b].nTh,c.setAttribute("role","columnheader"),a.aoColumns[b].bSortable&&
(c.setAttribute("tabindex",a.iTabIndex),c.setAttribute("aria-controls",a.sTableId)),null!==a.aoColumns[b].sClass&&i(c).addClass(a.aoColumns[b].sClass),a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}else{var f=k.createElement("tr");for(b=0,d=a.aoColumns.length;b<d;b++)c=a.aoColumns[b].nTh,c.innerHTML=a.aoColumns[b].sTitle,c.setAttribute("tabindex","0"),null!==a.aoColumns[b].sClass&&i(c).addClass(a.aoColumns[b].sClass),f.appendChild(c);i(a.nTHead).html("")[0].appendChild(f);T(a.aoHeader,
a.nTHead)}i(a.nTHead).children("tr").attr("role","row");if(a.bJUI)for(b=0,d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;f=k.createElement("div");f.className=a.oClasses.sSortJUIWrapper;i(c).contents().appendTo(f);var h=k.createElement("span");h.className=a.oClasses.sSortIcon;f.appendChild(h);c.appendChild(f)}if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)!1!==a.aoColumns[b].bSortable?ga(a,a.aoColumns[b].nTh,b):i(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);""!==a.oClasses.sFooterTH&&
i(a.nTFoot).children("tr").children("th").addClass(a.oClasses.sFooterTH);if(null!==a.nTFoot){c=O(a,null,a.aoFooter);for(b=0,d=a.aoColumns.length;b<d;b++)if(c[b])a.aoColumns[b].nTf=c[b],a.aoColumns[b].sClass&&i(c[b]).addClass(a.aoColumns[b].sClass)}}function U(a,b,c){var d,f,h,g=[],e=[],i=a.aoColumns.length,m;c===l&&(c=!1);for(d=0,f=b.length;d<f;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(h=i-1;0<=h;h--)!a.aoColumns[h].bVisible&&!c&&g[d].splice(h,1);e.push([])}for(d=0,f=g.length;d<f;d++){if(a=g[d].nTr)for(;h=
a.firstChild;)a.removeChild(h);for(h=0,b=g[d].length;h<b;h++)if(m=i=1,e[d][h]===l){a.appendChild(g[d][h].cell);for(e[d][h]=1;g[d+i]!==l&&g[d][h].cell==g[d+i][h].cell;)e[d+i][h]=1,i++;for(;g[d][h+m]!==l&&g[d][h].cell==g[d][h+m].cell;){for(c=0;c<i;c++)e[d+c][h+m]=1;m++}g[d][h].cell.rowSpan=i;g[d][h].cell.colSpan=m}}}function y(a){var b,c,d=[],f=0,h=a.asStripeClasses.length;b=a.aoOpenRows.length;c=C(a,"aoPreDrawCallback","preDraw",[a]);if(-1===i.inArray(!1,c)){a.bDrawing=!0;if(a.iInitDisplayStart!==
l&&-1!=a.iInitDisplayStart)a._iDisplayStart=a.oFeatures.bServerSide?a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart,a.iInitDisplayStart=-1,z(a);if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++;else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!va(a))return}else a.iDraw++;if(0!==a.aiDisplay.length){var g=a._iDisplayStart;c=a._iDisplayEnd;if(a.oFeatures.bServerSide)g=0,c=a.aoData.length;for(;g<c;g++){var e=a.aoData[a.aiDisplay[g]];null===e.nTr&&ca(a,a.aiDisplay[g]);
var q=e.nTr;if(0!==h){var m=a.asStripeClasses[f%h];if(e._sRowStripe!=m)i(q).removeClass(e._sRowStripe).addClass(m),e._sRowStripe=m}C(a,"aoRowCallback",null,[q,a.aoData[a.aiDisplay[g]]._aData,f,g]);d.push(q);f++;if(0!==b)for(e=0;e<b;e++)if(q==a.aoOpenRows[e].nParent){d.push(a.aoOpenRows[e].nTr);break}}}else{d[0]=k.createElement("tr");if(a.asStripeClasses[0])d[0].className=a.asStripeClasses[0];h=a.oLanguage.sZeroRecords.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()));if(1==a.iDraw&&null!==a.sAjaxSource&&
!a.oFeatures.bServerSide)h=a.oLanguage.sLoadingRecords;else if(a.oLanguage.sEmptyTable&&0===a.fnRecordsTotal())h=a.oLanguage.sEmptyTable;b=k.createElement("td");b.setAttribute("valign","top");b.colSpan=v(a);b.className=a.oClasses.sRowEmpty;b.innerHTML=h;d[f].appendChild(b)}C(a,"aoHeaderCallback","header",[i(a.nTHead).children("tr")[0],X(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);C(a,"aoFooterCallback","footer",[i(a.nTFoot).children("tr")[0],X(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay]);
f=k.createDocumentFragment();b=k.createDocumentFragment();if(a.nTBody){h=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered)for(;b=a.nTBody.firstChild;)a.nTBody.removeChild(b);for(b=0,c=d.length;b<c;b++)f.appendChild(d[b]);a.nTBody.appendChild(f);null!==h&&h.appendChild(a.nTBody)}C(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1;a.oFeatures.bServerSide&&(H(a,!1),a._bInitComplete||Y(a))}}function Z(a){a.oFeatures.bSort?
P(a,a.oPreviousSearch):a.oFeatures.bFilter?M(a,a.oPreviousSearch):(z(a),y(a))}function wa(a){var b=i("<div></div>")[0];a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=i('<div id="'+a.sTableId+'_wrapper" class="'+a.oClasses.sWrapper+'" role="grid"></div>')[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,h,g,e,q,m,o,l=0;l<d.length;l++){h=0;g=d[l];if("<"==g){e=i("<div></div>")[0];q=d[l+1];if("'"==q||'"'==q){m="";for(o=2;d[l+o]!=q;)m+=d[l+o],
o++;"H"==m?m="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix":"F"==m&&(m="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix");-1!=m.indexOf(".")?(q=m.split("."),e.id=q[0].substr(1,q[0].length-1),e.className=q[1]):"#"==m.charAt(0)?e.id=m.substr(1,m.length-1):e.className=m;l+=o}c.appendChild(e);c=e}else if(">"==g)c=c.parentNode;else if("l"==g&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange)f=xa(a),h=1;else if("f"==g&&a.oFeatures.bFilter)f=
ya(a),h=1;else if("r"==g&&a.oFeatures.bProcessing)f=za(a),h=1;else if("t"==g)f=Aa(a),h=1;else if("i"==g&&a.oFeatures.bInfo)f=Ba(a),h=1;else if("p"==g&&a.oFeatures.bPaginate)f=Ca(a),h=1;else if(0!==j.ext.aoFeatures.length){e=j.ext.aoFeatures;o=0;for(q=e.length;o<q;o++)if(g==e[o].cFeature){(f=e[o].fnInit(a))&&(h=1);break}}1==h&&null!==f&&("object"!==typeof a.aanFeatures[g]&&(a.aanFeatures[g]=[]),a.aanFeatures[g].push(f),c.appendChild(f))}b.parentNode.replaceChild(a.nTableWrapper,b)}function T(a,b){var c=
i(b).children("tr"),d,f,h,g,e,q,m,j;a.splice(0,a.length);for(f=0,q=c.length;f<q;f++)a.push([]);for(f=0,q=c.length;f<q;f++)for(h=0,m=c[f].childNodes.length;h<m;h++)if(d=c[f].childNodes[h],"TD"==d.nodeName.toUpperCase()||"TH"==d.nodeName.toUpperCase()){var o=1*d.getAttribute("colspan"),l=1*d.getAttribute("rowspan"),o=!o||0===o||1===o?1:o,l=!l||0===l||1===l?1:l;for(g=0;a[f][g];)g++;j=g;for(e=0;e<o;e++)for(g=0;g<l;g++)a[f+g][j+e]={cell:d,unique:1==o?!0:!1},a[f+g].nTr=c[f]}}function O(a,b,c){var d=[];
if(!c)c=a.aoHeader,b&&(c=[],T(c,b));for(var b=0,f=c.length;b<f;b++)for(var h=0,g=c[b].length;h<g;h++)if(c[b][h].unique&&(!d[h]||!a.bSortCellsTop))d[h]=c[b][h].cell;return d}function va(a){if(a.bAjaxDataGet){a.iDraw++;H(a,!0);var b=Da(a);ha(a,b);a.fnServerData.call(a.oInstance,a.sAjaxSource,b,function(b){Ea(a,b)},a);return!1}return!0}function Da(a){var b=a.aoColumns.length,c=[],d,f;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:x(a)});c.push({name:"iDisplayStart",
value:a._iDisplayStart});c.push({name:"iDisplayLength",value:!1!==a.oFeatures.bPaginate?a._iDisplayLength:-1});for(f=0;f<b;f++)d=a.aoColumns[f].mDataProp,c.push({name:"mDataProp_"+f,value:"function"===typeof d?"function":d});if(!1!==a.oFeatures.bFilter){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(f=0;f<b;f++)c.push({name:"sSearch_"+f,value:a.aoPreSearchCols[f].sSearch}),c.push({name:"bRegex_"+f,value:a.aoPreSearchCols[f].bRegex}),
c.push({name:"bSearchable_"+f,value:a.aoColumns[f].bSearchable})}if(!1!==a.oFeatures.bSort){d=null!==a.aaSortingFixed?a.aaSortingFixed.length:0;var h=a.aaSorting.length;c.push({name:"iSortingCols",value:d+h});for(f=0;f<d;f++)c.push({name:"iSortCol_"+f,value:a.aaSortingFixed[f][0]}),c.push({name:"sSortDir_"+f,value:a.aaSortingFixed[f][1]});for(f=0;f<h;f++)c.push({name:"iSortCol_"+(f+d),value:a.aaSorting[f][0]}),c.push({name:"sSortDir_"+(f+d),value:a.aaSorting[f][1]});for(f=0;f<b;f++)c.push({name:"bSortable_"+
f,value:a.aoColumns[f].bSortable})}return c}function ha(a,b){C(a,"aoServerParams","serverParams",[b])}function Ea(a,b){if(b.sEcho!==l){if(1*b.sEcho<a.iDraw)return;a.iDraw=1*b.sEcho}(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))&&ea(a);a._iRecordsTotal=parseInt(b.iTotalRecords,10);a._iRecordsDisplay=parseInt(b.iTotalDisplayRecords,10);var c=x(a),c=b.sColumns!==l&&""!==c&&b.sColumns!=c,d;c&&(d=D(a,b.sColumns));for(var f=V(a.sAjaxDataProp)(b),h=0,g=f.length;h<g;h++)if(c){for(var e=
[],i=0,m=a.aoColumns.length;i<m;i++)e.push(f[h][d[i]]);G(a,e)}else G(a,f[h]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;y(a);a.bAjaxDataGet=!0;H(a,!1)}function ya(a){var b=a.oPreviousSearch,c=a.oLanguage.sSearch,c=-1!==c.indexOf("_INPUT_")?c.replace("_INPUT_",'<input type="text" />'):""===c?'<input type="text" />':c+' <input type="text" />',d=k.createElement("div");d.className=a.oClasses.sFilter;d.innerHTML="<label>"+c+"</label>";if(!a.aanFeatures.f)d.id=a.sTableId+"_filter";c=i("input",
d);c.val(b.sSearch.replace('"',"&quot;"));c.bind("keyup.DT",function(){for(var c=a.aanFeatures.f,d=0,g=c.length;d<g;d++)c[d]!=i(this).parents("div.dataTables_filter")[0]&&i("input",c[d]).val(this.value);this.value!=b.sSearch&&M(a,{sSearch:this.value,bRegex:b.bRegex,bSmart:b.bSmart,bCaseInsensitive:b.bCaseInsensitive})});c.attr("aria-controls",a.sTableId).bind("keypress.DT",function(a){if(13==a.keyCode)return!1});return d}function M(a,b,c){var d=a.oPreviousSearch,f=a.aoPreSearchCols,h=function(a){d.sSearch=
a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};if(a.oFeatures.bServerSide)h(b);else{Fa(a,b.sSearch,c,b.bRegex,b.bSmart,b.bCaseInsensitive);h(b);for(b=0;b<a.aoPreSearchCols.length;b++)Ga(a,f[b].sSearch,b,f[b].bRegex,f[b].bSmart,f[b].bCaseInsensitive);Ha(a)}a.bFiltered=!0;i(a.oInstance).trigger("filter",a);a._iDisplayStart=0;z(a);y(a);ia(a,0)}function Ha(a){for(var b=j.ext.afnFiltering,c=0,d=b.length;c<d;c++)for(var f=0,h=0,g=a.aiDisplay.length;h<g;h++){var e=a.aiDisplay[h-
f];b[c](a,W(a,e,"filter"),e)||(a.aiDisplay.splice(h-f,1),f++)}}function Ga(a,b,c,d,f,h){if(""!==b)for(var g=0,b=ja(b,d,f,h),d=a.aiDisplay.length-1;0<=d;d--)f=ka(w(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType),b.test(f)||(a.aiDisplay.splice(d,1),g++)}function Fa(a,b,c,d,f,h){d=ja(b,d,f,h);f=a.oPreviousSearch;c||(c=0);0!==j.ext.afnFiltering.length&&(c=1);if(0>=b.length)a.aiDisplay.splice(0,a.aiDisplay.length),a.aiDisplay=a.aiDisplayMaster.slice();else if(a.aiDisplay.length==a.aiDisplayMaster.length||
f.sSearch.length>b.length||1==c||0!==b.indexOf(f.sSearch)){a.aiDisplay.splice(0,a.aiDisplay.length);ia(a,1);for(b=0;b<a.aiDisplayMaster.length;b++)d.test(a.asDataSearch[b])&&a.aiDisplay.push(a.aiDisplayMaster[b])}else for(b=c=0;b<a.asDataSearch.length;b++)d.test(a.asDataSearch[b])||(a.aiDisplay.splice(b-c,1),c++)}function ia(a,b){if(!a.oFeatures.bServerSide){a.asDataSearch.splice(0,a.asDataSearch.length);for(var c=b&&1===b?a.aiDisplayMaster:a.aiDisplay,d=0,f=c.length;d<f;d++)a.asDataSearch[d]=la(a,
W(a,c[d],"filter"))}}function la(a,b){var c="";if(a.__nTmpFilter===l)a.__nTmpFilter=k.createElement("div");for(var d=a.__nTmpFilter,f=0,h=a.aoColumns.length;f<h;f++)a.aoColumns[f].bSearchable&&(c+=ka(b[f],a.aoColumns[f].sType)+" ");if(-1!==c.indexOf("&"))d.innerHTML=c,c=d.textContent?d.textContent:d.innerText,c=c.replace(/\n/g," ").replace(/\r/g,"");return c}function ja(a,b,c,d){if(c)return a=b?a.split(" "):ma(a).split(" "),a="^(?=.*?"+a.join(")(?=.*?")+").*$",RegExp(a,d?"i":"");a=b?a:ma(a);return RegExp(a,
d?"i":"")}function ka(a,b){return"function"===typeof j.ext.ofnSearch[b]?j.ext.ofnSearch[b](a):"html"==b?a.replace(/[\r\n]/g," ").replace(/<.*?>/g,""):"string"===typeof a?a.replace(/[\r\n]/g," "):null===a?"":a}function ma(a){return a.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)","g"),"\\$1")}function Ba(a){var b=k.createElement("div");b.className=a.oClasses.sInfo;if(!a.aanFeatures.i)a.aoDrawCallback.push({fn:Ia,sName:"information"}),b.id=a.sTableId+"_info";a.nTable.setAttribute("aria-describedby",
a.sTableId+"_info");return b}function Ia(a){if(a.oFeatures.bInfo&&0!==a.aanFeatures.i.length){var b=a._iDisplayStart+1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),h=a.fnFormatNumber(b),g=a.fnFormatNumber(c),e=a.fnFormatNumber(d),q=a.fnFormatNumber(f);a.oScroll.bInfinite&&(h=a.fnFormatNumber(1));h=0===a.fnRecordsDisplay()&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:0===a.fnRecordsDisplay()?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",
e)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",h).replace("_END_",g).replace("_TOTAL_",q)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",h).replace("_END_",g).replace("_TOTAL_",q)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;null!==a.oLanguage.fnInfoCallback&&(h=a.oLanguage.fnInfoCallback.call(a.oInstance,a,b,c,d,f,h));a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)i(a[b]).html(h)}}
function $(a){var b,c,d=a.iInitDisplayStart;if(!1===a.bInitialised)setTimeout(function(){$(a)},200);else{wa(a);ua(a);U(a,a.aoHeader);a.nTFoot&&U(a,a.aoFooter);H(a,!0);a.oFeatures.bAutoWidth&&ba(a);for(b=0,c=a.aoColumns.length;b<c;b++)if(null!==a.aoColumns[b].sWidth)a.aoColumns[b].nTh.style.width=p(a.aoColumns[b].sWidth);a.oFeatures.bSort?P(a):a.oFeatures.bFilter?M(a,a.oPreviousSearch):(a.aiDisplay=a.aiDisplayMaster.slice(),z(a),y(a));null!==a.sAjaxSource&&!a.oFeatures.bServerSide?(c=[],ha(a,c),a.fnServerData.call(a.oInstance,
a.sAjaxSource,c,function(c){var h=""!==a.sAjaxDataProp?V(a.sAjaxDataProp)(c):c;for(b=0;b<h.length;b++)G(a,h[b]);a.iInitDisplayStart=d;a.oFeatures.bSort?P(a):(a.aiDisplay=a.aiDisplayMaster.slice(),z(a),y(a));H(a,!1);Y(a,c)},a)):a.oFeatures.bServerSide||(H(a,!1),Y(a))}}function Y(a,b){a._bInitComplete=!0;C(a,"aoInitComplete","init",[a,b])}function na(a){!a.sEmptyTable&&a.sZeroRecords&&n(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&a.sZeroRecords&&n(a,a,"sZeroRecords","sLoadingRecords")}function xa(a){if(a.oScroll.bInfinite)return null;
var b='<select size="1" '+('name="'+a.sTableId+'_length"')+">",c,d,f=a.aLengthMenu;if(2==f.length&&"object"===typeof f[0]&&"object"===typeof f[1])for(c=0,d=f[0].length;c<d;c++)b+='<option value="'+f[0][c]+'">'+f[1][c]+"</option>";else for(c=0,d=f.length;c<d;c++)b+='<option value="'+f[c]+'">'+f[c]+"</option>";b+="</select>";f=k.createElement("div");if(!a.aanFeatures.l)f.id=a.sTableId+"_length";f.className=a.oClasses.sLength;f.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";
i('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",!0);i("select",f).bind("change.DT",function(){var b=i(this).val(),f=a.aanFeatures.l;for(c=0,d=f.length;c<d;c++)f[c]!=this.parentNode&&i("select",f[c]).val(b);a._iDisplayLength=parseInt(b,10);z(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()&&(a._iDisplayStart=a.fnDisplayEnd()-a._iDisplayLength,0>a._iDisplayStart))a._iDisplayStart=0;if(-1==a._iDisplayLength)a._iDisplayStart=0;y(a)});i("select",f).attr("aria-controls",a.sTableId);return f}
function z(a){a._iDisplayEnd=!1===a.oFeatures.bPaginate?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||-1==a._iDisplayLength?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Ca(a){if(a.oScroll.bInfinite)return null;var b=k.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;j.ext.oPagination[a.sPaginationType].fnInit(a,b,function(a){z(a);y(a)});a.aanFeatures.p||a.aoDrawCallback.push({fn:function(a){j.ext.oPagination[a.sPaginationType].fnUpdate(a,
function(a){z(a);y(a)})},sName:"pagination"});return b}function oa(a,b){var c=a._iDisplayStart;if("number"===typeof b){if(a._iDisplayStart=b*a._iDisplayLength,a._iDisplayStart>a.fnRecordsDisplay())a._iDisplayStart=0}else if("first"==b)a._iDisplayStart=0;else if("previous"==b){if(a._iDisplayStart=0<=a._iDisplayLength?a._iDisplayStart-a._iDisplayLength:0,0>a._iDisplayStart)a._iDisplayStart=0}else if("next"==b)0<=a._iDisplayLength?a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay()&&(a._iDisplayStart+=
a._iDisplayLength):a._iDisplayStart=0;else if("last"==b)if(0<=a._iDisplayLength){var d=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(d-1)*a._iDisplayLength}else a._iDisplayStart=0;else F(a,0,"Unknown paging action: "+b);i(a.oInstance).trigger("page",a);return c!=a._iDisplayStart}function za(a){var b=k.createElement("div");if(!a.aanFeatures.r)b.id=a.sTableId+"_processing";b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,
a.nTable);return b}function H(a,b){if(a.oFeatures.bProcessing)for(var c=a.aanFeatures.r,d=0,f=c.length;d<f;d++)c[d].style.visibility=b?"visible":"hidden";i(a.oInstance).trigger("processing",[a,b])}function Aa(a){if(""===a.oScroll.sX&&""===a.oScroll.sY)return a.nTable;var b=k.createElement("div"),c=k.createElement("div"),d=k.createElement("div"),f=k.createElement("div"),h=k.createElement("div"),g=k.createElement("div"),e=a.nTable.cloneNode(!1),q=a.nTable.cloneNode(!1),m=a.nTable.getElementsByTagName("thead")[0],
j=0===a.nTable.getElementsByTagName("tfoot").length?null:a.nTable.getElementsByTagName("tfoot")[0],o=a.oClasses;c.appendChild(d);h.appendChild(g);f.appendChild(a.nTable);b.appendChild(c);b.appendChild(f);d.appendChild(e);e.appendChild(m);null!==j&&(b.appendChild(h),g.appendChild(q),q.appendChild(j));b.className=o.sScrollWrapper;c.className=o.sScrollHead;d.className=o.sScrollHeadInner;f.className=o.sScrollBody;h.className=o.sScrollFoot;g.className=o.sScrollFootInner;if(a.oScroll.bAutoCss)c.style.overflow=
"hidden",c.style.position="relative",h.style.overflow="hidden",f.style.overflow="auto";c.style.border="0";c.style.width="100%";h.style.border="0";d.style.width="150%";e.removeAttribute("id");e.style.marginLeft="0";a.nTable.style.marginLeft="0";if(null!==j)q.removeAttribute("id"),q.style.marginLeft="0";d=i(a.nTable).children("caption");g=0;for(q=d.length;g<q;g++)e.appendChild(d[g]);if(""!==a.oScroll.sX){c.style.width=p(a.oScroll.sX);f.style.width=p(a.oScroll.sX);if(null!==j)h.style.width=p(a.oScroll.sX);
i(f).scroll(function(){c.scrollLeft=this.scrollLeft;if(null!==j)h.scrollLeft=this.scrollLeft})}if(""!==a.oScroll.sY)f.style.height=p(a.oScroll.sY);a.aoDrawCallback.push({fn:Ja,sName:"scrolling"});a.oScroll.bInfinite&&i(f).scroll(function(){!a.bDrawing&&0!==i(this).scrollTop()&&i(this).scrollTop()+i(this).height()>i(a.nTable).height()-a.oScroll.iLoadGap&&a.fnDisplayEnd()<a.fnRecordsDisplay()&&(oa(a,"next"),z(a),y(a))});a.nScrollHead=c;a.nScrollFoot=h;return b}function Ja(a){var b=a.nScrollHead.getElementsByTagName("div")[0],
c=b.getElementsByTagName("table")[0],d=a.nTable.parentNode,f,h,g,e,j,m,o,l,r=[],n=null!==a.nTFoot?a.nScrollFoot.getElementsByTagName("div")[0]:null,E=null!==a.nTFoot?n.getElementsByTagName("table")[0]:null,k=i.browser.msie&&7>=i.browser.version;g=a.nTable.getElementsByTagName("thead");0<g.length&&a.nTable.removeChild(g[0]);null!==a.nTFoot&&(j=a.nTable.getElementsByTagName("tfoot"),0<j.length&&a.nTable.removeChild(j[0]));g=a.nTHead.cloneNode(!0);a.nTable.insertBefore(g,a.nTable.childNodes[0]);null!==
a.nTFoot&&(j=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(j,a.nTable.childNodes[1]));if(""===a.oScroll.sX)d.style.width="100%",b.parentNode.style.width="100%";var t=O(a,g);for(f=0,h=t.length;f<h;f++)o=s(a,f),t[f].style.width=a.aoColumns[o].sWidth;null!==a.nTFoot&&N(function(a){a.style.width=""},j.getElementsByTagName("tr"));f=i(a.nTable).outerWidth();if(""===a.oScroll.sX){if(a.nTable.style.width="100%",k&&(i("tbody",d).height()>d.offsetHeight||"scroll"==i(d).css("overflow-y")))a.nTable.style.width=
p(i(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(""!==a.oScroll.sXInner)a.nTable.style.width=p(a.oScroll.sXInner);else if(f==i(d).width()&&i(d).height()<i(a.nTable).height()){if(a.nTable.style.width=p(f-a.oScroll.iBarWidth),i(a.nTable).outerWidth()>f-a.oScroll.iBarWidth)a.nTable.style.width=p(f)}else a.nTable.style.width=p(f);f=i(a.nTable).outerWidth();h=a.nTHead.getElementsByTagName("tr");g=g.getElementsByTagName("tr");N(function(a,b){m=a.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth=
"0";m.borderBottomWidth="0";m.height=0;l=i(a).width();b.style.width=p(l);r.push(l)},g,h);i(g).height(0);null!==a.nTFoot&&(e=j.getElementsByTagName("tr"),j=a.nTFoot.getElementsByTagName("tr"),N(function(a,b){m=a.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;l=i(a).width();b.style.width=p(l);r.push(l)},e,j),i(e).height(0));N(function(a){a.innerHTML="";a.style.width=p(r.shift())},g);null!==a.nTFoot&&N(function(a){a.innerHTML="";a.style.width=p(r.shift())},
e);if(i(a.nTable).outerWidth()<f){e=d.scrollHeight>d.offsetHeight||"scroll"==i(d).css("overflow-y")?f+a.oScroll.iBarWidth:f;if(k&&(d.scrollHeight>d.offsetHeight||"scroll"==i(d).css("overflow-y")))a.nTable.style.width=p(e-a.oScroll.iBarWidth);d.style.width=p(e);b.parentNode.style.width=p(e);if(null!==a.nTFoot)n.parentNode.style.width=p(e);""===a.oScroll.sX?F(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width."):
""!==a.oScroll.sXInner&&F(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else if(d.style.width=p("100%"),b.parentNode.style.width=p("100%"),null!==a.nTFoot)n.parentNode.style.width=p("100%");if(""===a.oScroll.sY&&k)d.style.height=p(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(""!==a.oScroll.sY&&a.oScroll.bCollapse&&(d.style.height=p(a.oScroll.sY),k=""!==a.oScroll.sX&&a.nTable.offsetWidth>
d.offsetWidth?a.oScroll.iBarWidth:0,a.nTable.offsetHeight<d.offsetHeight))d.style.height=p(i(a.nTable).height()+k);k=i(a.nTable).outerWidth();c.style.width=p(k);b.style.width=p(k);if(null!==a.nTFoot)n.style.width=p(a.nTable.offsetWidth),E.style.width=p(a.nTable.offsetWidth);if(a.bSorted||a.bFiltered)d.scrollTop=0}function N(a,b,c){for(var d=0,f=b.length;d<f;d++)for(var h=0,g=b[d].childNodes.length;h<g;h++)1==b[d].childNodes[h].nodeType&&(c?a(b[d].childNodes[h],c[d].childNodes[h]):a(b[d].childNodes[h]))}
function Ka(a,b){if(!a||null===a||""===a)return 0;b||(b=k.getElementsByTagName("body")[0]);var c,d=k.createElement("div");d.style.width=p(a);b.appendChild(d);c=d.offsetWidth;b.removeChild(d);return c}function ba(a){var b=0,c,d=0,f=a.aoColumns.length,h,g=i("th",a.nTHead),e=a.nTable.getAttribute("width");for(h=0;h<f;h++)if(a.aoColumns[h].bVisible&&(d++,null!==a.aoColumns[h].sWidth)){c=Ka(a.aoColumns[h].sWidthOrig,a.nTable.parentNode);if(null!==c)a.aoColumns[h].sWidth=p(c);b++}if(f==g.length&&0===b&&
d==f&&""===a.oScroll.sX&&""===a.oScroll.sY)for(h=0;h<a.aoColumns.length;h++){if(c=i(g[h]).width(),null!==c)a.aoColumns[h].sWidth=p(c)}else{b=a.nTable.cloneNode(!1);h=a.nTHead.cloneNode(!0);d=k.createElement("tbody");c=k.createElement("tr");b.removeAttribute("id");b.appendChild(h);null!==a.nTFoot&&(b.appendChild(a.nTFoot.cloneNode(!0)),N(function(a){a.style.width=""},b.getElementsByTagName("tr")));b.appendChild(d);d.appendChild(c);d=i("thead th",b);0===d.length&&(d=i("tbody tr:eq(0)>td",b));g=O(a,
h);for(h=d=0;h<f;h++){var j=a.aoColumns[h];j.bVisible&&null!==j.sWidthOrig&&""!==j.sWidthOrig?g[h-d].style.width=p(j.sWidthOrig):j.bVisible?g[h-d].style.width="":d++}for(h=0;h<f;h++)a.aoColumns[h].bVisible&&(d=La(a,h),null!==d&&(d=d.cloneNode(!0),""!==a.aoColumns[h].sContentPadding&&(d.innerHTML+=a.aoColumns[h].sContentPadding),c.appendChild(d)));f=a.nTable.parentNode;f.appendChild(b);if(""!==a.oScroll.sX&&""!==a.oScroll.sXInner)b.style.width=p(a.oScroll.sXInner);else if(""!==a.oScroll.sX){if(b.style.width=
"",i(b).width()<f.offsetWidth)b.style.width=p(f.offsetWidth)}else if(""!==a.oScroll.sY)b.style.width=p(f.offsetWidth);else if(e)b.style.width=p(e);b.style.visibility="hidden";Ma(a,b);f=i("tbody tr:eq(0)",b).children();0===f.length&&(f=O(a,i("thead",b)[0]));if(""!==a.oScroll.sX){for(h=d=c=0;h<a.aoColumns.length;h++)a.aoColumns[h].bVisible&&(c=null===a.aoColumns[h].sWidthOrig?c+i(f[d]).outerWidth():c+(parseInt(a.aoColumns[h].sWidth.replace("px",""),10)+(i(f[d]).outerWidth()-i(f[d]).width())),d++);b.style.width=
p(c);a.nTable.style.width=p(c)}for(h=d=0;h<a.aoColumns.length;h++)if(a.aoColumns[h].bVisible){c=i(f[d]).width();if(null!==c&&0<c)a.aoColumns[h].sWidth=p(c);d++}f=i(b).css("width");a.nTable.style.width=-1!==f.indexOf("%")?f:p(i(b).outerWidth());b.parentNode.removeChild(b)}if(e)a.nTable.style.width=p(e)}function Ma(a,b){if(""===a.oScroll.sX&&""!==a.oScroll.sY)i(b).width(),b.style.width=p(i(b).outerWidth()-a.oScroll.iBarWidth);else if(""!==a.oScroll.sX)b.style.width=p(i(b).outerWidth())}function La(a,
b){var c=Na(a,b);if(0>c)return null;if(null===a.aoData[c].nTr){var d=k.createElement("td");d.innerHTML=w(a,c,b,"");return d}return L(a,c)[b]}function Na(a,b){for(var c=-1,d=-1,f=0;f<a.aoData.length;f++){var h=w(a,f,b,"display")+"",h=h.replace(/<.*?>/g,"");if(h.length>c)c=h.length,d=f}return d}function p(a){if(null===a)return"0px";if("number"==typeof a)return 0>a?"0px":a+"px";var b=a.charCodeAt(a.length-1);return 48>b||57<b?a:a+"px"}function Oa(){var a=k.createElement("p"),b=a.style;b.width="100%";
b.height="200px";b.padding="0px";var c=k.createElement("div"),b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";b.height="150px";b.padding="0px";b.overflow="hidden";c.appendChild(a);k.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";a=a.offsetWidth;if(b==a)a=c.clientWidth;k.body.removeChild(c);return b-a}function P(a,b){var c,d,f,h,g,e,o=[],m=[],r=j.ext.oSort,n=a.aoData,k=a.aoColumns,E=a.oLanguage.oAria;if(!a.oFeatures.bServerSide&&(0!==a.aaSorting.length||
null!==a.aaSortingFixed)){o=null!==a.aaSortingFixed?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<o.length;c++)if(d=o[c][0],f=t(a,d),h=a.aoColumns[d].sSortDataType,j.ext.afnSortData[h]){g=j.ext.afnSortData[h](a,d,f);for(f=0,h=n.length;f<h;f++)J(a,f,d,g[f])}for(c=0,d=a.aiDisplayMaster.length;c<d;c++)m[a.aiDisplayMaster[c]]=c;var p=o.length,s;for(c=0,d=n.length;c<d;c++)for(f=0;f<p;f++){s=k[o[f][0]].aDataSort;for(g=0,e=s.length;g<e;g++)h=k[s[g]].sType,h=r[(h?h:"string")+"-pre"],
n[c]._aSortData[s[g]]=h?h(w(a,c,s[g],"sort")):w(a,c,s[g],"sort")}a.aiDisplayMaster.sort(function(a,b){var c,d,f,h,g;for(c=0;c<p;c++){g=k[o[c][0]].aDataSort;for(d=0,f=g.length;d<f;d++)if(h=k[g[d]].sType,h=r[(h?h:"string")+"-"+o[c][1]](n[a]._aSortData[g[d]],n[b]._aSortData[g[d]]),0!==h)return h}return r["numeric-asc"](m[a],m[b])})}(b===l||b)&&!a.oFeatures.bDeferRender&&Q(a);for(c=0,d=a.aoColumns.length;c<d;c++)f=k[c].nTh,f.removeAttribute("aria-sort"),f.removeAttribute("aria-label"),k[c].bSortable?
0<o.length&&o[0][0]==c?(f.setAttribute("aria-sort","asc"==o[0][1]?"ascending":"descending"),f.setAttribute("aria-label",k[c].sTitle+("asc"==(k[c].asSorting[o[0][2]+1]?k[c].asSorting[o[0][2]+1]:k[c].asSorting[0])?E.sSortAscending:E.sSortDescending))):f.setAttribute("aria-label",k[c].sTitle+("asc"==k[c].asSorting[0]?E.sSortAscending:E.sSortDescending)):f.setAttribute("aria-label",k[c].sTitle);a.bSorted=!0;i(a.oInstance).trigger("sort",a);a.oFeatures.bFilter?M(a,a.oPreviousSearch,1):(a.aiDisplay=a.aiDisplayMaster.slice(),
a._iDisplayStart=0,z(a),y(a))}function ga(a,b,c,d){Pa(b,{},function(b){if(!1!==a.aoColumns[c].bSortable){var h=function(){var d,h;if(b.shiftKey){for(var e=!1,i=0;i<a.aaSorting.length;i++)if(a.aaSorting[i][0]==c){e=!0;d=a.aaSorting[i][0];h=a.aaSorting[i][2]+1;a.aoColumns[d].asSorting[h]?(a.aaSorting[i][1]=a.aoColumns[d].asSorting[h],a.aaSorting[i][2]=h):a.aaSorting.splice(i,1);break}!1===e&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}else 1==a.aaSorting.length&&a.aaSorting[0][0]==c?(d=a.aaSorting[0][0],
h=a.aaSorting[0][2]+1,a.aoColumns[d].asSorting[h]||(h=0),a.aaSorting[0][1]=a.aoColumns[d].asSorting[h],a.aaSorting[0][2]=h):(a.aaSorting.splice(0,a.aaSorting.length),a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0]));P(a)};a.oFeatures.bProcessing?(H(a,!0),setTimeout(function(){h();a.oFeatures.bServerSide||H(a,!1)},0)):h();"function"==typeof d&&d(a)}})}function Q(a){var b,c,d,f,h,g=a.aoColumns.length,e=a.oClasses;for(b=0;b<g;b++)a.aoColumns[b].bSortable&&i(a.aoColumns[b].nTh).removeClass(e.sSortAsc+
" "+e.sSortDesc+" "+a.aoColumns[b].sSortingClass);f=null!==a.aaSortingFixed?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){h=a.aoColumns[b].sSortingClass;d=-1;for(c=0;c<f.length;c++)if(f[c][0]==b){h="asc"==f[c][1]?e.sSortAsc:e.sSortDesc;d=c;break}i(a.aoColumns[b].nTh).addClass(h);a.bJUI&&(c=i("span."+e.sSortIcon,a.aoColumns[b].nTh),c.removeClass(e.sSortJUIAsc+" "+e.sSortJUIDesc+" "+e.sSortJUI+" "+e.sSortJUIAscAllowed+" "+e.sSortJUIDescAllowed),
c.addClass(-1==d?a.aoColumns[b].sSortingClassJUI:"asc"==f[d][1]?e.sSortJUIAsc:e.sSortJUIDesc))}else i(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);h=e.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){d=L(a);if(a.oFeatures.bDeferRender)i(d).removeClass(h+"1 "+h+"2 "+h+"3");else if(d.length>=g)for(b=0;b<g;b++)if(-1!=d[b].className.indexOf(h+"1"))for(c=0,a=d.length/g;c<a;c++)d[g*c+b].className=i.trim(d[g*c+b].className.replace(h+"1",""));else if(-1!=d[b].className.indexOf(h+
"2"))for(c=0,a=d.length/g;c<a;c++)d[g*c+b].className=i.trim(d[g*c+b].className.replace(h+"2",""));else if(-1!=d[b].className.indexOf(h+"3"))for(c=0,a=d.length/g;c<a;c++)d[g*c+b].className=i.trim(d[g*c+b].className.replace(" "+h+"3",""));var e=1,j;for(b=0;b<f.length;b++){j=parseInt(f[b][0],10);for(c=0,a=d.length/g;c<a;c++)d[g*c+j].className+=" "+h+e;3>e&&e++}}}function pa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b,c;b=a.oScroll.bInfinite;var d={iCreate:(new Date).getTime(),iStart:b?0:a._iDisplayStart,
iEnd:b?a._iDisplayLength:a._iDisplayEnd,iLength:a._iDisplayLength,aaSorting:i.extend(!0,[],a.aaSorting),oSearch:i.extend(!0,{},a.oPreviousSearch),aoSearchCols:i.extend(!0,[],a.aoPreSearchCols),abVisCols:[]};for(b=0,c=a.aoColumns.length;b<c;b++)d.abVisCols.push(a.aoColumns[b].bVisible);C(a,"aoStateSaveParams","stateSaveParams",[a,d]);a.fnStateSave.call(a.oInstance,a,d)}}function Qa(a,b){if(a.oFeatures.bStateSave){var c=a.fnStateLoad.call(a.oInstance,a);if(c){var d=C(a,"aoStateLoadParams","stateLoadParams",
[a,c]);if(-1===i.inArray(!1,d)){a.oLoadedState=i.extend(!0,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();i.extend(a.oPreviousSearch,c.oSearch);i.extend(!0,a.aoPreSearchCols,c.aoSearchCols);b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++)b.saved_aoColumns[d]={},b.saved_aoColumns[d].bVisible=c.abVisCols[d];C(a,"aoStateLoaded","stateLoaded",[a,c])}}}}function Ra(a){for(var b=
aa.location.pathname.split("/"),a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=",b=k.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];" "==d.charAt(0);)d=d.substring(1,d.length);if(0===d.indexOf(a))return decodeURIComponent(d.substring(a.length,d.length))}return null}function u(a){for(var b=0;b<j.settings.length;b++)if(j.settings[b].nTable===a)return j.settings[b];return null}function S(a){for(var b=[],a=a.aoData,c=0,d=a.length;c<d;c++)null!==a[c].nTr&&b.push(a[c].nTr);return b}function L(a,
b){var c=[],d,f,h,e,i,j;f=0;var o=a.aoData.length;b!==l&&(f=b,o=b+1);for(h=f;h<o;h++)if(j=a.aoData[h],null!==j.nTr){f=[];for(e=0,i=j.nTr.childNodes.length;e<i;e++)d=j.nTr.childNodes[e].nodeName.toLowerCase(),("td"==d||"th"==d)&&f.push(j.nTr.childNodes[e]);d=0;for(e=0,i=a.aoColumns.length;e<i;e++)a.aoColumns[e].bVisible?c.push(f[e-d]):(c.push(j._anHidden[e]),d++)}return c}function F(a,b,c){a=null===a?"DataTables warning: "+c:"DataTables warning (table id = '"+a.sTableId+"'): "+c;if(0===b)if("alert"==
j.ext.sErrMode)alert(a);else throw a;else console!==l&&console.log&&console.log(a)}function n(a,b,c,d){d===l&&(d=c);b[c]!==l&&(a[d]=b[c])}function Sa(a,b){for(var c in a)a.hasOwnProperty(c)&&b[c]!==l&&("object"===typeof e[c]&&!1===i.isArray(b[c])?i.extend(!0,a[c],b[c]):a[c]=b[c]);return a}function Pa(a,b,c){i(a).bind("click.DT",b,function(b){c(b);a.blur()}).bind("keypress.DT",b,function(a){13===a.which&&c(a)}).bind("selectstart.DT",function(){return!1})}function A(a,b,c,d){c&&a[b].push({fn:c,sName:d})}
function C(a,b,c,d){for(var b=a[b],f=[],h=b.length-1;0<=h;h--)f.push(b[h].fn.apply(a.oInstance,d));null!==c&&i(a.oInstance).trigger(c,d);return f}function Ta(a){return function(){var b=[u(this[j.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return j.ext.oApi[a].apply(this,b)}}var Ua=aa.JSON?JSON.stringify:function(a){var b=typeof a;if("object"!==b||null===a)return"string"===b&&(a='"'+a+'"'),a+"";var c,d,f=[],h=i.isArray(a);for(c in a)d=a[c],b=typeof d,"string"===b?d='"'+d+'"':"object"===
b&&null!==d&&(d=Ua(d)),f.push((h?"":'"'+c+'":')+d);return(h?"[":"{")+f+(h?"]":"}")};this.$=function(a,b){var c,d,f=[],h=u(this[j.ext.iApiIndex]);b||(b={});b=i.extend({},{filter:"none",order:"current",page:"all"},b);if("current"==b.page)for(c=h._iDisplayStart,d=h.fnDisplayEnd();c<d;c++)f.push(h.aoData[h.aiDisplay[c]].nTr);else if("current"==b.order&&"none"==b.filter)for(c=0,d=h.aiDisplayMaster.length;c<d;c++)f.push(h.aoData[h.aiDisplayMaster[c]].nTr);else if("current"==b.order&&"applied"==b.filter)for(c=
0,d=h.aiDisplay.length;c<d;c++)f.push(h.aoData[h.aiDisplay[c]].nTr);else if("original"==b.order&&"none"==b.filter)for(c=0,d=h.aoData.length;c<d;c++)f.push(h.aoData[c].nTr);else if("original"==b.order&&"applied"==b.filter)for(c=0,d=h.aoData.length;c<d;c++)-1!==i.inArray(c,h.aiDisplay)&&f.push(h.aoData[c].nTr);else F(h,1,"Unknown selection options");d=i(f);c=d.filter(a);d=d.find(a);return i([].concat(i.makeArray(c),i.makeArray(d)))};this._=function(a,b){var c=[],d,f,h=this.$(a,b);for(d=0,f=h.length;d<
f;d++)c.push(this.fnGetData(h[d]));return c};this.fnAddData=function(a,b){if(0===a.length)return[];var c=[],d,f=u(this[j.ext.iApiIndex]);if("object"===typeof a[0]&&null!==a[0])for(var h=0;h<a.length;h++){d=G(f,a[h]);if(-1==d)return c;c.push(d)}else{d=G(f,a);if(-1==d)return c;c.push(d)}f.aiDisplay=f.aiDisplayMaster.slice();(b===l||b)&&Z(f);return c};this.fnAdjustColumnSizing=function(a){var b=u(this[j.ext.iApiIndex]);r(b);a===l||a?this.fnDraw(!1):(""!==b.oScroll.sX||""!==b.oScroll.sY)&&this.oApi._fnScrollDraw(b)};
this.fnClearTable=function(a){var b=u(this[j.ext.iApiIndex]);ea(b);(a===l||a)&&y(b)};this.fnClose=function(a){for(var b=u(this[j.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a)return(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr),b.aoOpenRows.splice(c,1),0;return 1};this.fnDeleteRow=function(a,b,c){var d=u(this[j.ext.iApiIndex]),f,h,a="object"===typeof a?K(d,a):a,e=d.aoData.splice(a,1);for(f=0,h=d.aoData.length;f<h;f++)if(null!==d.aoData[f].nTr)d.aoData[f].nTr._DT_RowIndex=
f;f=i.inArray(a,d.aiDisplay);d.asDataSearch.splice(f,1);fa(d.aiDisplayMaster,a);fa(d.aiDisplay,a);"function"===typeof b&&b.call(this,d,e);if(d._iDisplayStart>=d.aiDisplay.length&&(d._iDisplayStart-=d._iDisplayLength,0>d._iDisplayStart))d._iDisplayStart=0;if(c===l||c)z(d),y(d);return e};this.fnDestroy=function(a){var b=u(this[j.ext.iApiIndex]),c=b.nTableWrapper.parentNode,d=b.nTBody,f,e,a=a===l?!1:!0;b.bDestroying=!0;for(f=0,e=b.aoDestroyCallback.length;f<e;f++)b.aoDestroyCallback[f].fn();for(f=0,
e=b.aoColumns.length;f<e;f++)!1===b.aoColumns[f].bVisible&&this.fnSetColumnVis(f,!0);i(b.nTableWrapper).find("*").andSelf().unbind(".DT");i("tbody>tr>td."+b.oClasses.sRowEmpty,b.nTable).parent().remove();b.nTable!=b.nTHead.parentNode&&(i(b.nTable).children("thead").remove(),b.nTable.appendChild(b.nTHead));b.nTFoot&&b.nTable!=b.nTFoot.parentNode&&(i(b.nTable).children("tfoot").remove(),b.nTable.appendChild(b.nTFoot));b.nTable.parentNode.removeChild(b.nTable);i(b.nTableWrapper).remove();b.aaSorting=
[];b.aaSortingFixed=[];Q(b);i(S(b)).removeClass(b.asStripeClasses.join(" "));i("th, td",b.nTHead).removeClass([b.oClasses.sSortable,b.oClasses.sSortableAsc,b.oClasses.sSortableDesc,b.oClasses.sSortableNone].join(" "));b.bJUI&&(i("th span."+b.oClasses.sSortIcon+", td span."+b.oClasses.sSortIcon,b.nTHead).remove(),i("th, td",b.nTHead).each(function(){var a=i("div."+b.oClasses.sSortJUIWrapper,this),c=a.contents();i(this).append(c);a.remove()}));!a&&b.nTableReinsertBefore?c.insertBefore(b.nTable,b.nTableReinsertBefore):
a||c.appendChild(b.nTable);for(f=0,e=b.aoData.length;f<e;f++)null!==b.aoData[f].nTr&&d.appendChild(b.aoData[f].nTr);if(!0===b.oFeatures.bAutoWidth)b.nTable.style.width=p(b.sDestroyWidth);i(d).children("tr:even").addClass(b.asDestroyStripes[0]);i(d).children("tr:odd").addClass(b.asDestroyStripes[1]);for(f=0,e=j.settings.length;f<e;f++)j.settings[f]==b&&j.settings.splice(f,1);b=null};this.fnDraw=function(a){var b=u(this[j.ext.iApiIndex]);a?(z(b),y(b)):Z(b)};this.fnFilter=function(a,b,c,d,f,e){var g=
u(this[j.ext.iApiIndex]);if(g.oFeatures.bFilter){if(c===l||null===c)c=!1;if(d===l||null===d)d=!0;if(f===l||null===f)f=!0;if(e===l||null===e)e=!0;if(b===l||null===b){if(M(g,{sSearch:a+"",bRegex:c,bSmart:d,bCaseInsensitive:e},1),f&&g.aanFeatures.f){b=g.aanFeatures.f;c=0;for(d=b.length;c<d;c++)i("input",b[c]).val(a)}}else i.extend(g.aoPreSearchCols[b],{sSearch:a+"",bRegex:c,bSmart:d,bCaseInsensitive:e}),M(g,g.oPreviousSearch,1)}};this.fnGetData=function(a,b){var c=u(this[j.ext.iApiIndex]);if(a!==l){var d=
a;if("object"===typeof a){var f=a.nodeName.toLowerCase();"tr"===f?d=K(c,a):"td"===f&&(d=K(c,a.parentNode),b=da(c,d,a))}return b!==l?w(c,d,b,""):c.aoData[d]!==l?c.aoData[d]._aData:null}return X(c)};this.fnGetNodes=function(a){var b=u(this[j.ext.iApiIndex]);return a!==l?b.aoData[a]!==l?b.aoData[a].nTr:null:S(b)};this.fnGetPosition=function(a){var b=u(this[j.ext.iApiIndex]),c=a.nodeName.toUpperCase();if("TR"==c)return K(b,a);return"TD"==c||"TH"==c?(c=K(b,a.parentNode),a=da(b,c,a),[c,t(b,a),a]):null};
this.fnIsOpen=function(a){for(var b=u(this[j.ext.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a)return!0;return!1};this.fnOpen=function(a,b,c){var d=u(this[j.ext.iApiIndex]),f=S(d);if(-1!==i.inArray(a,f)){this.fnClose(a);var f=k.createElement("tr"),e=k.createElement("td");f.appendChild(e);e.className=c;e.colSpan=v(d);"string"===typeof b?e.innerHTML=b:i(e).html(b);b=i("tr",d.nTBody);-1!=i.inArray(a,b)&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f}};this.fnPageChange=
function(a,b){var c=u(this[j.ext.iApiIndex]);oa(c,a);z(c);(b===l||b)&&y(c)};this.fnSetColumnVis=function(a,b,c){var d=u(this[j.ext.iApiIndex]),f,e,g=d.aoColumns,i=d.aoData,o,m;if(g[a].bVisible!=b){if(b){for(f=e=0;f<a;f++)g[f].bVisible&&e++;m=e>=v(d);if(!m)for(f=a;f<g.length;f++)if(g[f].bVisible){o=f;break}for(f=0,e=i.length;f<e;f++)null!==i[f].nTr&&(m?i[f].nTr.appendChild(i[f]._anHidden[a]):i[f].nTr.insertBefore(i[f]._anHidden[a],L(d,f)[o]))}else for(f=0,e=i.length;f<e;f++)null!==i[f].nTr&&(o=L(d,
f)[a],i[f]._anHidden[a]=o,o.parentNode.removeChild(o));g[a].bVisible=b;U(d,d.aoHeader);d.nTFoot&&U(d,d.aoFooter);for(f=0,e=d.aoOpenRows.length;f<e;f++)d.aoOpenRows[f].nTr.colSpan=v(d);if(c===l||c)r(d),y(d);pa(d)}};this.fnSettings=function(){return u(this[j.ext.iApiIndex])};this.fnSort=function(a){var b=u(this[j.ext.iApiIndex]);b.aaSorting=a;P(b)};this.fnSortListener=function(a,b,c){ga(u(this[j.ext.iApiIndex]),a,b,c)};this.fnUpdate=function(a,b,c,d,f){var e=u(this[j.ext.iApiIndex]),b="object"===typeof b?
K(e,b):b;if(e.__fnUpdateDeep===l&&i.isArray(a)&&"object"===typeof a){e.aoData[b]._aData=a.slice();e.__fnUpdateDeep=!0;for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(w(e,b,c),b,c,!1,!1);e.__fnUpdateDeep=l}else if(e.__fnUpdateDeep===l&&null!==a&&"object"===typeof a){e.aoData[b]._aData=i.extend(!0,{},a);e.__fnUpdateDeep=!0;for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(w(e,b,c),b,c,!1,!1);e.__fnUpdateDeep=l}else{J(e,b,c,a);var a=w(e,b,c,"display"),g=e.aoColumns[c];null!==g.fnRender&&(a=R(e,b,c),g.bUseRendered&&
J(e,b,c,a));if(null!==e.aoData[b].nTr)L(e,b)[c].innerHTML=a}c=i.inArray(b,e.aiDisplay);e.asDataSearch[c]=la(e,W(e,b,"filter"));(f===l||f)&&r(e);(d===l||d)&&Z(e);return 0};this.fnVersionCheck=j.ext.fnVersionCheck;this.oApi={_fnExternApiFunc:Ta,_fnInitialise:$,_fnInitComplete:Y,_fnLanguageCompat:na,_fnAddColumn:o,_fnColumnOptions:E,_fnAddData:G,_fnCreateTr:ca,_fnGatherData:ta,_fnBuildHead:ua,_fnDrawHead:U,_fnDraw:y,_fnReDraw:Z,_fnAjaxUpdate:va,_fnAjaxParameters:Da,_fnAjaxUpdateDraw:Ea,_fnServerParams:ha,
_fnAddOptionsHtml:wa,_fnFeatureHtmlTable:Aa,_fnScrollDraw:Ja,_fnAdjustColumnSizing:r,_fnFeatureHtmlFilter:ya,_fnFilterComplete:M,_fnFilterCustom:Ha,_fnFilterColumn:Ga,_fnFilter:Fa,_fnBuildSearchArray:ia,_fnBuildSearchRow:la,_fnFilterCreateSearch:ja,_fnDataToSearch:ka,_fnSort:P,_fnSortAttachListener:ga,_fnSortingClasses:Q,_fnFeatureHtmlPaginate:Ca,_fnPageChange:oa,_fnFeatureHtmlInfo:Ba,_fnUpdateInfo:Ia,_fnFeatureHtmlLength:xa,_fnFeatureHtmlProcessing:za,_fnProcessingDisplay:H,_fnVisibleToColumnIndex:s,
_fnColumnIndexToVisible:t,_fnNodeToDataIndex:K,_fnVisbleColumns:v,_fnCalculateEnd:z,_fnConvertToWidth:Ka,_fnCalculateColumnWidths:ba,_fnScrollingWidthAdjust:Ma,_fnGetWidestNode:La,_fnGetMaxLenString:Na,_fnStringToCss:p,_fnDetectType:B,_fnSettingsFromNode:u,_fnGetDataMaster:X,_fnGetTrNodes:S,_fnGetTdNodes:L,_fnEscapeRegex:ma,_fnDeleteIndex:fa,_fnReOrderIndex:D,_fnColumnOrdering:x,_fnLog:F,_fnClearTable:ea,_fnSaveState:pa,_fnLoadState:Qa,_fnCreateCookie:function(a,b,c,d,e){var h=new Date;h.setTime(h.getTime()+
1E3*c);var c=aa.location.pathname.split("/"),a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase(),g;null!==e?(g="function"===typeof i.parseJSON?i.parseJSON(b):eval("("+b+")"),b=e(a,g,h.toGMTString(),c.join("/")+"/")):b=a+"="+encodeURIComponent(b)+"; expires="+h.toGMTString()+"; path="+c.join("/")+"/";e="";h=9999999999999;if(4096<(null!==Ra(a)?k.cookie.length:b.length+k.cookie.length)+10){for(var a=k.cookie.split(";"),j=0,o=a.length;j<o;j++)if(-1!=a[j].indexOf(d)){var m=a[j].split("=");try{g=eval("("+
decodeURIComponent(m[1])+")")}catch(l){continue}if(g.iCreate&&g.iCreate<h)e=m[0],h=g.iCreate}if(""!==e)k.cookie=e+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+c.join("/")+"/"}k.cookie=b},_fnReadCookie:Ra,_fnDetectHeader:T,_fnGetUniqueThs:O,_fnScrollBarWidth:Oa,_fnApplyToChildren:N,_fnMap:n,_fnGetRowData:W,_fnGetCellData:w,_fnSetCellData:J,_fnGetObjectDataFn:V,_fnSetObjectDataFn:sa,_fnApplyColumnDefs:I,_fnBindAction:Pa,_fnExtend:Sa,_fnCallbackReg:A,_fnCallbackFire:C,_fnJsonString:Ua,_fnRender:R,
_fnNodeToColumnIndex:da};i.extend(j.ext.oApi,this.oApi);for(var qa in j.ext.oApi)qa&&(this[qa]=Ta(qa));var ra=this;return this.each(function(){var a=0,b,c,d;c=this.getAttribute("id");var f=!1,h=!1;if("table"!=this.nodeName.toLowerCase())F(null,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{for(a=0,b=j.settings.length;a<b;a++){if(j.settings[a].nTable==this){if(e===l||e.bRetrieve)return j.settings[a].oInstance;if(e.bDestroy){j.settings[a].oInstance.fnDestroy();
break}else{F(j.settings[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy");return}}if(j.settings[a].sTableId==this.id){j.settings.splice(a,1);break}}if(null===c)this.id=c="DataTables_Table_"+j.ext._oExternConfig.iNextUnique++;var g=i.extend(!0,{},j.models.oSettings,{nTable:this,oApi:ra.oApi,oInit:e,sDestroyWidth:i(this).width(),sInstance:c,sTableId:c});j.settings.push(g);g.oInstance=1===ra.length?
ra:i(this).dataTable();e||(e={});e.oLanguage&&na(e.oLanguage);e=Sa(i.extend(!0,{},j.defaults),e);n(g.oFeatures,e,"bPaginate");n(g.oFeatures,e,"bLengthChange");n(g.oFeatures,e,"bFilter");n(g.oFeatures,e,"bSort");n(g.oFeatures,e,"bInfo");n(g.oFeatures,e,"bProcessing");n(g.oFeatures,e,"bAutoWidth");n(g.oFeatures,e,"bSortClasses");n(g.oFeatures,e,"bServerSide");n(g.oFeatures,e,"bDeferRender");n(g.oScroll,e,"sScrollX","sX");n(g.oScroll,e,"sScrollXInner","sXInner");n(g.oScroll,e,"sScrollY","sY");n(g.oScroll,
e,"bScrollCollapse","bCollapse");n(g.oScroll,e,"bScrollInfinite","bInfinite");n(g.oScroll,e,"iScrollLoadGap","iLoadGap");n(g.oScroll,e,"bScrollAutoCss","bAutoCss");n(g,e,"asStripClasses","asStripeClasses");n(g,e,"asStripeClasses");n(g,e,"fnServerData");n(g,e,"fnFormatNumber");n(g,e,"sServerMethod");n(g,e,"aaSorting");n(g,e,"aaSortingFixed");n(g,e,"aLengthMenu");n(g,e,"sPaginationType");n(g,e,"sAjaxSource");n(g,e,"sAjaxDataProp");n(g,e,"iCookieDuration");n(g,e,"sCookiePrefix");n(g,e,"sDom");n(g,e,
"bSortCellsTop");n(g,e,"iTabIndex");n(g,e,"oSearch","oPreviousSearch");n(g,e,"aoSearchCols","aoPreSearchCols");n(g,e,"iDisplayLength","_iDisplayLength");n(g,e,"bJQueryUI","bJUI");n(g,e,"fnCookieCallback");n(g,e,"fnStateLoad");n(g,e,"fnStateSave");n(g.oLanguage,e,"fnInfoCallback");A(g,"aoDrawCallback",e.fnDrawCallback,"user");A(g,"aoServerParams",e.fnServerParams,"user");A(g,"aoStateSaveParams",e.fnStateSaveParams,"user");A(g,"aoStateLoadParams",e.fnStateLoadParams,"user");A(g,"aoStateLoaded",e.fnStateLoaded,
"user");A(g,"aoRowCallback",e.fnRowCallback,"user");A(g,"aoRowCreatedCallback",e.fnCreatedRow,"user");A(g,"aoHeaderCallback",e.fnHeaderCallback,"user");A(g,"aoFooterCallback",e.fnFooterCallback,"user");A(g,"aoInitComplete",e.fnInitComplete,"user");A(g,"aoPreDrawCallback",e.fnPreDrawCallback,"user");g.oFeatures.bServerSide&&g.oFeatures.bSort&&g.oFeatures.bSortClasses?A(g,"aoDrawCallback",Q,"server_side_sort_classes"):g.oFeatures.bDeferRender&&A(g,"aoDrawCallback",Q,"defer_sort_classes");if(e.bJQueryUI){if(i.extend(g.oClasses,
j.ext.oJUIClasses),e.sDom===j.defaults.sDom&&"lfrtip"===j.defaults.sDom)g.sDom='<"H"lfr>t<"F"ip>'}else i.extend(g.oClasses,j.ext.oStdClasses);i(this).addClass(g.oClasses.sTable);if(""!==g.oScroll.sX||""!==g.oScroll.sY)g.oScroll.iBarWidth=Oa();if(g.iInitDisplayStart===l)g.iInitDisplayStart=e.iDisplayStart,g._iDisplayStart=e.iDisplayStart;if(e.bStateSave)g.oFeatures.bStateSave=!0,Qa(g,e),A(g,"aoDrawCallback",pa,"state_save");if(null!==e.iDeferLoading)g.bDeferLoading=!0,g._iRecordsTotal=e.iDeferLoading,
g._iRecordsDisplay=e.iDeferLoading;null!==e.aaData&&(h=!0);""!==e.oLanguage.sUrl?(g.oLanguage.sUrl=e.oLanguage.sUrl,i.getJSON(g.oLanguage.sUrl,null,function(a){na(a);i.extend(!0,g.oLanguage,e.oLanguage,a);$(g)}),f=!0):i.extend(!0,g.oLanguage,e.oLanguage);c=!1;d=i(this).children("tbody").children("tr");for(a=0,b=g.asStripeClasses.length;a<b;a++)if(d.filter(":lt(2)").hasClass(g.asStripeClasses[a])){c=!0;break}if(c)g.asDestroyStripes=["",""],i(d[0]).hasClass(g.oClasses.sStripeOdd)&&(g.asDestroyStripes[0]+=
g.oClasses.sStripeOdd+" "),i(d[0]).hasClass(g.oClasses.sStripeEven)&&(g.asDestroyStripes[0]+=g.oClasses.sStripeEven),i(d[1]).hasClass(g.oClasses.sStripeOdd)&&(g.asDestroyStripes[1]+=g.oClasses.sStripeOdd+" "),i(d[1]).hasClass(g.oClasses.sStripeEven)&&(g.asDestroyStripes[1]+=g.oClasses.sStripeEven),d.removeClass(g.asStripeClasses.join(" "));c=[];a=this.getElementsByTagName("thead");0!==a.length&&(T(g.aoHeader,a[0]),c=O(g));if(null===e.aoColumns){d=[];for(a=0,b=c.length;a<b;a++)d.push(null)}else d=
e.aoColumns;for(a=0,b=d.length;a<b;a++){if(e.saved_aoColumns!==l&&e.saved_aoColumns.length==b)null===d[a]&&(d[a]={}),d[a].bVisible=e.saved_aoColumns[a].bVisible;o(g,c?c[a]:null)}I(g,e.aoColumnDefs,d,function(a,b){E(g,a,b)});for(a=0,b=g.aaSorting.length;a<b;a++){g.aaSorting[a][0]>=g.aoColumns.length&&(g.aaSorting[a][0]=0);var r=g.aoColumns[g.aaSorting[a][0]];g.aaSorting[a][2]===l&&(g.aaSorting[a][2]=0);e.aaSorting===l&&g.saved_aaSorting===l&&(g.aaSorting[a][1]=r.asSorting[0]);for(c=0,d=r.asSorting.length;c<
d;c++)if(g.aaSorting[a][1]==r.asSorting[c]){g.aaSorting[a][2]=c;break}}Q(g);a=i(this).children("thead");0===a.length&&(a=[k.createElement("thead")],this.appendChild(a[0]));g.nTHead=a[0];a=i(this).children("tbody");0===a.length&&(a=[k.createElement("tbody")],this.appendChild(a[0]));g.nTBody=a[0];g.nTBody.setAttribute("role","alert");g.nTBody.setAttribute("aria-live","polite");g.nTBody.setAttribute("aria-relevant","all");a=i(this).children("tfoot");if(0<a.length)g.nTFoot=a[0],T(g.aoFooter,g.nTFoot);
if(h)for(a=0;a<e.aaData.length;a++)G(g,e.aaData[a]);else ta(g);g.aiDisplay=g.aiDisplayMaster.slice();g.bInitialised=!0;!1===f&&$(g)}})};j.version="1.9.0";j.settings=[];j.models={};j.models.ext={afnFiltering:[],afnSortData:[],aoFeatures:[],aTypes:[],fnVersionCheck:function(e){for(var i=function(e,i){for(;e.length<i;)e+="0";return e},l=j.ext.sVersion.split("."),e=e.split("."),r="",k="",t=0,v=e.length;t<v;t++)r+=i(l[t],3),k+=i(e[t],3);return parseInt(r,10)>=parseInt(k,10)},iApiIndex:0,ofnSearch:{},oApi:{},
oStdClasses:{},oJUIClasses:{},oPagination:{},oSort:{},sVersion:j.version,sErrMode:"alert",_oExternConfig:{iNextUnique:0}};j.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};j.models.oRow={nTr:null,_aData:[],_aSortData:[],_anHidden:[],_sRowStripe:""};j.models.oColumn={aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bUseRendered:null,bVisible:null,_bAutoType:!0,fnCreatedCell:null,fnGetData:null,fnRender:null,fnSetData:null,mDataProp:null,nTh:null,nTf:null,sClass:null,
sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};j.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:["odd","even"],bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bJQueryUI:!1,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollAutoCss:!0,bScrollCollapse:!1,
bScrollInfinite:!1,bServerSide:!1,bSort:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCookieCallback:null,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(e){if(1E3>e)return e;for(var i=e+"",e=i.split(""),j="",i=i.length,l=0;l<i;l++)0===l%3&&0!==l&&(j=this.oLanguage.sInfoThousands+j),j=e[i-l-1]+j;return j},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:function(e,j,l,k){k.jqXHR=i.ajax({url:e,
data:j,success:function(e){i(k.oInstance).trigger("xhr",k);l(e)},dataType:"json",cache:!1,type:k.sServerMethod,error:function(e,i){"parsererror"==i&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})},fnServerParams:null,fnStateLoad:function(e){var e=this.oApi._fnReadCookie(e.sCookiePrefix+e.sInstance),j;try{j="function"===typeof i.parseJSON?i.parseJSON(e):eval("("+e+")")}catch(l){j=null}return j},fnStateLoadParams:null,fnStateLoaded:null,
fnStateSave:function(e,i){this.oApi._fnCreateCookie(e.sCookiePrefix+e.sInstance,this.oApi._fnJsonString(i),e.iCookieDuration,e.sCookiePrefix,e.fnCookieCallback)},fnStateSaveParams:null,iCookieDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iScrollLoadGap:100,iTabIndex:0,oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",
sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sInfoThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sUrl:"",sZeroRecords:"No matching records found"},oSearch:i.extend({},j.models.oSearch),sAjaxDataProp:"aaData",sAjaxSource:null,sCookiePrefix:"SpryMedia_DataTables_",sDom:"lfrtip",sPaginationType:"two_button",sScrollX:"",
sScrollXInner:"",sScrollY:"",sServerMethod:"GET"};j.defaults.columns={aDataSort:null,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bUseRendered:!0,bVisible:!0,fnCreatedCell:null,fnRender:null,iDataSort:-1,mDataProp:null,sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};j.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,
bSortClasses:null,bStateSave:null},oScroll:{bAutoCss:null,bCollapse:null,bInfinite:null,iBarWidth:0,iLoadGap:null,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aoColumns:[],aoHeader:[],aoFooter:[],asDataSearch:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:null,asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],
aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,sPaginationType:"two_button",iCookieDuration:0,sCookiePrefix:"",fnCookieCallback:null,aoStateSave:[],aoStateLoad:[],oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,
aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iDisplayEnd:10,_iRecordsTotal:0,_iRecordsDisplay:0,bJUI:null,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length},fnRecordsDisplay:function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length},fnDisplayEnd:function(){return this.oFeatures.bServerSide?
!1===this.oFeatures.bPaginate||-1==this._iDisplayLength?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd},oInstance:null,sInstance:null,iTabIndex:0};j.ext=i.extend(!0,{},j.models.ext);i.extend(j.ext.oStdClasses,{sTable:"dataTable",sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",
sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",
sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",
sFooterTH:""});i.extend(j.ext.oJUIClasses,j.ext.oStdClasses,{sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",
sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPageLast:"last ui-corner-tr ui-corner-br",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",
sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollFoot:"dataTables_scrollFoot ui-state-default",sFooterTH:"ui-state-default"});i.extend(j.ext.oPagination,
{two_button:{fnInit:function(e,j,l){var k=e.oLanguage.oPaginate,s=function(i){e.oApi._fnPageChange(e,i.data.action)&&l(e)},k=!e.bJUI?'<a class="'+e.oClasses.sPagePrevDisabled+'" tabindex="'+e.iTabIndex+'" role="button">'+k.sPrevious+'</a><a class="'+e.oClasses.sPageNextDisabled+'" tabindex="'+e.iTabIndex+'" role="button">'+k.sNext+"</a>":'<a class="'+e.oClasses.sPagePrevDisabled+'" tabindex="'+e.iTabIndex+'" role="button"><span class="'+e.oClasses.sPageJUIPrev+'"></span></a><a class="'+e.oClasses.sPageNextDisabled+
'" tabindex="'+e.iTabIndex+'" role="button"><span class="'+e.oClasses.sPageJUINext+'"></span></a>';i(j).append(k);var t=i("a",j),k=t[0],t=t[1];e.oApi._fnBindAction(k,{action:"previous"},s);e.oApi._fnBindAction(t,{action:"next"},s);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_previous",t.id=e.sTableId+"_next",k.setAttribute("aria-controls",e.sTableId),t.setAttribute("aria-controls",e.sTableId)},fnUpdate:function(e){if(e.aanFeatures.p)for(var i=e.oClasses,j=e.aanFeatures.p,l=0,
k=j.length;l<k;l++)if(0!==j[l].childNodes.length)j[l].childNodes[0].className=0===e._iDisplayStart?i.sPagePrevDisabled:i.sPagePrevEnabled,j[l].childNodes[1].className=e.fnDisplayEnd()==e.fnRecordsDisplay()?i.sPageNextDisabled:i.sPageNextEnabled}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(e,j,l){var k=e.oLanguage.oPaginate,s=e.oClasses,t=function(i){e.oApi._fnPageChange(e,i.data.action)&&l(e)};i(j).append('<a tabindex="'+e.iTabIndex+'" class="'+s.sPageButton+" "+s.sPageFirst+'">'+k.sFirst+
'</a><a tabindex="'+e.iTabIndex+'" class="'+s.sPageButton+" "+s.sPagePrevious+'">'+k.sPrevious+'</a><span></span><a tabindex="'+e.iTabIndex+'" class="'+s.sPageButton+" "+s.sPageNext+'">'+k.sNext+'</a><a tabindex="'+e.iTabIndex+'" class="'+s.sPageButton+" "+s.sPageLast+'">'+k.sLast+"</a>");var v=i("a",j),k=v[0],s=v[1],B=v[2],v=v[3];e.oApi._fnBindAction(k,{action:"first"},t);e.oApi._fnBindAction(s,{action:"previous"},t);e.oApi._fnBindAction(B,{action:"next"},t);e.oApi._fnBindAction(v,{action:"last"},
t);if(!e.aanFeatures.p)j.id=e.sTableId+"_paginate",k.id=e.sTableId+"_first",s.id=e.sTableId+"_previous",B.id=e.sTableId+"_next",v.id=e.sTableId+"_last"},fnUpdate:function(e,l){if(e.aanFeatures.p){var k=j.ext.oPagination.iFullNumbersShowPages,r=Math.floor(k/2),s=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),t=Math.ceil(e._iDisplayStart/e._iDisplayLength)+1,v="",B,D=e.oClasses,x,I=e.aanFeatures.p,G=function(i){e.oApi._fnBindAction(this,{page:i+B-1},function(i){e.oApi._fnPageChange(e,i.data.page);
l(e);i.preventDefault()})};s<k?(B=1,r=s):t<=r?(B=1,r=k):t>=s-r?(B=s-k+1,r=s):(B=t-Math.ceil(k/2)+1,r=B+k-1);for(k=B;k<=r;k++)v+=t!==k?'<a tabindex="'+e.iTabIndex+'" class="'+D.sPageButton+'">'+e.fnFormatNumber(k)+"</a>":'<a tabindex="'+e.iTabIndex+'" class="'+D.sPageButtonActive+'">'+e.fnFormatNumber(k)+"</a>";for(k=0,r=I.length;k<r;k++)0!==I[k].childNodes.length&&(i("span:eq(0)",I[k]).html(v).children("a").each(G),x=I[k].getElementsByTagName("a"),x=[x[0],x[1],x[x.length-2],x[x.length-1]],i(x).removeClass(D.sPageButton+
" "+D.sPageButtonActive+" "+D.sPageButtonStaticDisabled),i([x[0],x[1]]).addClass(1==t?D.sPageButtonStaticDisabled:D.sPageButton),i([x[2],x[3]]).addClass(0===s||t===s||-1===e._iDisplayLength?D.sPageButtonStaticDisabled:D.sPageButton))}}}});i.extend(j.ext.oSort,{"string-pre":function(e){"string"!=typeof e&&(e="");return e.toLowerCase()},"string-asc":function(e,i){return e<i?-1:e>i?1:0},"string-desc":function(e,i){return e<i?1:e>i?-1:0},"html-pre":function(e){return e.replace(/<.*?>/g,"").toLowerCase()},
"html-asc":function(e,i){return e<i?-1:e>i?1:0},"html-desc":function(e,i){return e<i?1:e>i?-1:0},"date-pre":function(e){e=Date.parse(e);if(isNaN(e)||""===e)e=Date.parse("01/01/1970 00:00:00");return e},"date-asc":function(e,i){return e-i},"date-desc":function(e,i){return i-e},"numeric-pre":function(e){return"-"==e||""===e?0:1*e},"numeric-asc":function(e,i){return e-i},"numeric-desc":function(e,i){return i-e}});i.extend(j.ext.aTypes,[function(e){if("number"===typeof e)return"numeric";if("string"!==
typeof e)return null;var i,j=!1;i=e.charAt(0);if(-1=="0123456789-".indexOf(i))return null;for(var k=1;k<e.length;k++){i=e.charAt(k);if(-1=="0123456789.".indexOf(i))return null;if("."==i){if(j)return null;j=!0}}return"numeric"},function(e){var i=Date.parse(e);return null!==i&&!isNaN(i)||"string"===typeof e&&0===e.length?"date":null},function(e){return"string"===typeof e&&-1!=e.indexOf("<")&&-1!=e.indexOf(">")?"html":null}]);i.fn.DataTable=j;i.fn.dataTable=j;i.fn.dataTableSettings=j.settings;i.fn.dataTableExt=
j.ext})(jQuery,window,document,void 0);

View file

@ -1,6 +1,6 @@
/* /*
* File: ColReorder.js * File: ColReorder.js
* Version: 1.0.4 * Version: 1.0.5
* CVS: $Id$ * CVS: $Id$
* Description: Controls for column visiblity in DataTables * Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk) * Author: Allan Jardine (www.sprymedia.co.uk)
@ -163,7 +163,11 @@ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
/* Data column sorting (the column which the sort for a given column should take place on) */ /* Data column sorting (the column which the sort for a given column should take place on) */
for ( i=0, iLen=iCols ; i<iLen ; i++ ) for ( i=0, iLen=iCols ; i<iLen ; i++ )
{ {
oSettings.aoColumns[i].iDataSort = aiInvertMapping[ oSettings.aoColumns[i].iDataSort ]; oCol = oSettings.aoColumns[i];
for ( j=0, jLen=oCol.aDataSort.length ; j<jLen ; j++ )
{
oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ];
}
} }
/* Update the Get and Set functions for each column */ /* Update the Get and Set functions for each column */
@ -464,12 +468,9 @@ ColReorder.prototype = {
} }
/* State saving */ /* State saving */
this.s.dt.aoStateSave.push( { this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
"fn": function (oS, sVal) { that._fnStateSave.call( that, oData );
return that._fnStateSave.call( that, sVal ); }, "ColReorder_State" );
},
"sName": "ColReorder_State"
} );
/* An initial column order has been specified */ /* An initial column order has been specified */
var aiOrder = null; var aiOrder = null;
@ -556,72 +557,41 @@ ColReorder.prototype = {
/** /**
* This function effectively replaces the state saving function in DataTables (this is needed * Because we change the indexes of columns in the table, relative to their starting point
* because otherwise DataTables would state save the columns in their reordered state, not the * we need to reorder the state columns to what they are at the starting point so we can
* original which is needed on first draw). This is sensitive to any changes in the DataTables * then rearrange them again on state load!
* state saving method!
* @method _fnStateSave * @method _fnStateSave
* @param string sCurrentVal * @param object oState DataTables state
* @returns string JSON encoded cookie string for DataTables * @returns string JSON encoded cookie string for DataTables
* @private * @private
*/ */
"_fnStateSave": function ( sCurrentVal ) "_fnStateSave": function ( oState )
{ {
var i, iLen, sTmp; var i, iLen, aCopy, iOrigColumn;
var sValue = sCurrentVal.split('"aaSorting"')[0];
var a = [];
var oSettings = this.s.dt; var oSettings = this.s.dt;
/* Sorting */ /* Sorting */
sValue += '"aaSorting":[ '; for ( i=0 ; i<oState.aaSorting.length ; i++ )
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
{ {
sValue += '['+oSettings.aoColumns[ oSettings.aaSorting[i][0] ]._ColReorder_iOrigCol+ oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
',"'+oSettings.aaSorting[i][1]+'"],';
} }
sValue = sValue.substring(0, sValue.length-1);
sValue += "],"; aSearchCopy = $.extend( true, [], oState.aoSearchCols );
oState.ColReorder = [];
/* Column filter */
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{ {
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = { iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
"sSearch": encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch),
"bRegex": !oSettings.aoPreSearchCols[i].bRegex /* Column filter */
}; oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
}
/* Visibility */
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
sValue += '"aaSearchCols":[ '; /* Column reordering */
for ( i=0 ; i<a.length ; i++ ) oState.ColReorder.push( iOrigColumn );
{
sValue += '["'+a[i].sSearch+'",'+a[i].bRegex+'],';
} }
sValue = sValue.substring(0, sValue.length-1);
sValue += "],";
/* Visibility */
a = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
{
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = oSettings.aoColumns[i].bVisible;
}
sValue += '"abVisCols":[ ';
for ( i=0 ; i<a.length ; i++ )
{
sValue += a[i]+",";
}
sValue = sValue.substring(0, sValue.length-1);
sValue += "],";
/* Column reordering */
a = [];
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) {
a.push( oSettings.aoColumns[i]._ColReorder_iOrigCol );
}
sValue += '"ColReorder":['+a.join(',')+']';
return sValue;
}, },
@ -944,7 +914,7 @@ ColReorder.prototype.CLASS = "ColReorder";
* @type String * @type String
* @default As code * @default As code
*/ */
ColReorder.VERSION = "1.0.4"; ColReorder.VERSION = "1.0.5";
ColReorder.prototype.VERSION = ColReorder.VERSION; ColReorder.prototype.VERSION = ColReorder.VERSION;
@ -960,7 +930,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION;
*/ */
if ( typeof $.fn.dataTable == "function" && if ( typeof $.fn.dataTable == "function" &&
typeof $.fn.dataTableExt.fnVersionCheck == "function" && typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
$.fn.dataTableExt.fnVersionCheck('1.8.0') ) $.fn.dataTableExt.fnVersionCheck('1.9.0') )
{ {
$.fn.dataTableExt.aoFeatures.push( { $.fn.dataTableExt.aoFeatures.push( {
"fnInit": function( oDTSettings ) { "fnInit": function( oDTSettings ) {
@ -981,7 +951,7 @@ if ( typeof $.fn.dataTable == "function" &&
} }
else else
{ {
alert( "Warning: ColReorder requires DataTables 1.8.0 or greater - www.datatables.net/download"); alert( "Warning: ColReorder requires DataTables 1.9.0 or greater - www.datatables.net/download");
} }
})(jQuery, window, document); })(jQuery, window, document);

View file

@ -1,6 +1,6 @@
/* /*
* File: ColVis.js * File: ColVis.js
* Version: 1.0.7.dev * Version: 1.0.7
* CVS: $Id$ * CVS: $Id$
* Description: Controls for column visiblity in DataTables * Description: Controls for column visiblity in DataTables
* Author: Allan Jardine (www.sprymedia.co.uk) * Author: Allan Jardine (www.sprymedia.co.uk)
@ -873,7 +873,7 @@ ColVis.prototype = {
/** /**
* * Alter the colspan on any fnOpen rows
*/ */
"_fnAdjustOpenRows": function () "_fnAdjustOpenRows": function ()
{ {
@ -958,7 +958,7 @@ ColVis.prototype.CLASS = "ColVis";
* @type String * @type String
* @default See code * @default See code
*/ */
ColVis.VERSION = "1.0.7.dev"; ColVis.VERSION = "1.0.7";
ColVis.prototype.VERSION = ColVis.VERSION; ColVis.prototype.VERSION = ColVis.VERSION;

View file

@ -77,6 +77,8 @@ ln -sf /usr/lib/airtime/utils/airtime-import/airtime-import /usr/bin/airtime-imp
ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings ln -sf /usr/lib/airtime/utils/airtime-update-db-settings /usr/bin/airtime-update-db-settings
ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system ln -sf /usr/lib/airtime/utils/airtime-check-system /usr/bin/airtime-check-system
ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log ln -sf /usr/lib/airtime/utils/airtime-log /usr/bin/airtime-log
ln -sf /usr/lib/airtime/utils/airtime-test-soundcard /usr/bin/airtime-test-soundcard
ln -sf /usr/lib/airtime/utils/airtime-test-stream /usr/bin/airtime-test-stream
if [ "$web" = "t" ]; then if [ "$web" = "t" ]; then
echo "* Creating /usr/share/airtime" echo "* Creating /usr/share/airtime"

View file

@ -46,6 +46,8 @@ rm -f /usr/bin/airtime-import
rm -f /usr/bin/airtime-update-db-settings rm -f /usr/bin/airtime-update-db-settings
rm -f /usr/bin/airtime-check-system rm -f /usr/bin/airtime-check-system
rm -f /usr/bin/airtime-log rm -f /usr/bin/airtime-log
rm -f /usr/bin/airtime-test-soundcard
rm -f /usr/bin/airtime-test-stream
rm -rf /usr/lib/airtime rm -rf /usr/lib/airtime
rm -rf /usr/share/airtime rm -rf /usr/share/airtime

View file

@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# Value needed to access the API
#api_key = 'AAA'
#base_url = 'http://localhost/'
# Path to the base of the API
#api_base = ''
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# Value needed to access the API
#api_key = 'AAA'
#base_url = 'http://localhost/'
# Path to the base of the API
#api_base = ''
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# Value needed to access the API
#api_key = 'AAA'
#base_url = 'http://localhost/'
# Path to the base of the API
#api_base = ''
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -87,24 +87,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
# ??? # ???
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -87,24 +87,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
# ??? # ???
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -88,23 +88,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -88,23 +88,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med
generate_range_url = 'generate_range_dp.php' generate_range_url = 'generate_range_dp.php'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -95,23 +95,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
#URL to update liquidsoap status #URL to update liquidsoap status
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -95,23 +95,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
#URL to update liquidsoap status #URL to update liquidsoap status
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -101,23 +101,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
#URL to update liquidsoap status #URL to update liquidsoap status
update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%'
##############
# OBP config #
##############
# URL to get the version number of the server API
#version_url = 'api/pypo/status/json'
# Schedule export path.
# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm
# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm
# Update whether an item has been played.
#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%'
# Update whether an item is currently playing.
#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%'
# ???
#generate_range_url = 'api/pypo/generate_range_dp/'

View file

@ -641,231 +641,3 @@ class AirTimeApiClient(ApiClientInterface):
logger.error('Exception: %s', e) logger.error('Exception: %s', e)
logger.error("traceback: %s", top) logger.error("traceback: %s", top)
################################################################################
# OpenBroadcast API Client
################################################################################
# Also check out the php counterpart that handles the api requests:
# https://lab.digris.ch/svn/elgg/trunk/unstable/mod/medialibrary/application/controllers/api/pypo.php
OBP_MIN_VERSION = 2010100101 # required obp version
class ObpApiClient():
def __init__(self, config):
self.config = config
self.api_auth = urllib.urlencode({'api_key': self.config["api_key"]})
def is_server_compatible(self, verbose = True):
logger = logging.getLogger()
obp_version = self.get_obp_version()
if obp_version == 0:
if (verbose):
logger.error('Unable to get OBP version. Is OBP up and running?\n')
return False
elif obp_version < OBP_MIN_VERSION:
if (verbose):
logger.warn('OBP version: ' + str(obp_version))
logger.warn('OBP min-version: ' + str(OBP_MIN_VERSION))
logger.warn('pypo not compatible with this version of OBP\n')
return False
else:
if (verbose):
logger.warn('OBP API: ' + str(API_BASE))
logger.warn('OBP version: ' + str(obp_version))
logger.warn('OBP min-version: ' + str(OBP_MIN_VERSION))
logger.warn('pypo is compatible with this version of OBP\n')
return True
def get_obp_version(self):
logger = logging.getLogger()
# lookup OBP version
#url = self.config["base_url"] + self.config["api_base"]+ self.config["version_url"]
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["version_url"])
try:
logger.debug("Trying to contact %s", url)
response = urllib.urlopen(url, self.api_auth)
response_json = json.loads(response.read())
obp_version = int(response_json['version'])
logger.debug("OBP Version %s detected", obp_version)
except Exception, e:
try:
if e[1] == 401:
logger.error('#####################################')
logger.error('# YOUR API KEY SEEMS TO BE INVALID')
logger.error('# ' + self.config["api_auth"])
logger.error('#####################################')
sys.exit()
except Exception, e:
pass
try:
if e[1] == 404:
logger.error('#####################################')
logger.error('# Unable to contact the OBP-API')
logger.error('# ' + url)
logger.error('#####################################')
sys.exit()
except Exception, e:
pass
obp_version = 0
logger.error("Unable to detect OBP Version - %s", e)
return obp_version
"""
NOTE: The server currently ignores start and end parameters we send to it.
"""
def get_schedule(self, start=None, end=None):
logger = logging.getLogger()
"""
calculate start/end time range (format: YYYY-DD-MM-hh-mm-ss,YYYY-DD-MM-hh-mm-ss)
(seconds are ignored, just here for consistency)
"""
if (not start):
tstart = time.gmtime(time.time() - 3600 * int(self.config["cache_for"]))
start = "%04d-%02d-%02d-%02d-%02d" % (tstart[0], tstart[1], tstart[2], tstart[3], tstart[4])
if (not end):
tend = time.gmtime(time.time() + 3600 * int(self.config["prepare_ahead"]))
end = "%04d-%02d-%02d-%02d-%02d" % (tend[0], tend[1], tend[2], tend[3], tend[4])
range = {}
range['start'] = start
range['end'] = end
# Construct the URL
#export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"]
export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["export_url"])
# Insert the start and end times into the URL
export_url = export_url.replace('%%api_key%%', self.config["api_key"])
export_url = export_url.replace('%%from%%', range['start'])
export_url = export_url.replace('%%to%%', range['end'])
logger.info("export from %s", export_url)
response = ""
status = 0
try:
response_json = urllib.urlopen(export_url).read()
logger.debug("%s", response_json)
response = json.loads(response_json)
logger.info("export status %s", response['check'])
status = response['check']
except Exception, e:
logger.error(e)
return status, response
def get_media(self, src, dest):
try:
logger.info('** urllib auth with: ' + self.api_auth)
urllib.urlretrieve(src, dst, False, self.api_auth)
logger.info("downloaded %s to %s", src, dst)
except Exception, e:
logger.error("%s", e)
"""
Tell server that the scheduled *playlist* has started.
"""
def notify_scheduled_item_start_playing(self, pkey, schedule):
#def update_scheduled_item(self, item_id, value):
logger = logging.getLogger()
#url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"]
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_item_url"])
url = url.replace("%%item_id%%", str(schedule[pkey]["id"]))
url = url.replace("%%played%%", "1")
try:
response = urllib.urlopen(url, self.api_auth)
response = json.loads(response.read())
logger.info("API-Status %s", response['status'])
logger.info("API-Message %s", response['message'])
except Exception, e:
api_status = False
logger.error("Unable to connect to the OBP API - %s", e)
return response
"""
This is a callback from liquidsoap, we use this to notify about the
currently playing *song*. We get passed a JSON string which we handed to
liquidsoap in get_liquidsoap_data().
"""
def notify_media_item_start_playing(self, data, media_id):
# def update_start_playing(self, playlist_type, export_source, media_id, playlist_id, transmission_id):
logger = logging.getLogger()
playlist_type = data["playlist_type"]
export_source = data["export_source"]
playlist_id = data["playlist_id"]
transmission_id = data["transmission_id"]
#url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"]
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_start_playing_url"])
url = url.replace("%%playlist_type%%", str(playlist_type))
url = url.replace("%%export_source%%", str(export_source))
url = url.replace("%%media_id%%", str(media_id))
url = url.replace("%%playlist_id%%", str(playlist_id))
url = url.replace("%%transmission_id%%", str(transmission_id))
logger.info(url)
try:
response = urllib.urlopen(url, self.api_auth)
response = json.loads(response.read())
logger.info("API-Status %s", response['status'])
logger.info("API-Message %s", response['message'])
logger.info("TXT %s", response['str_dls'])
except Exception, e:
api_status = False
logger.error("Unable to connect to the OBP API - %s", e)
return response
def generate_range_dp(self):
logger = logging.getLogger()
#url = self.config["base_url"] + self.config["api_base"] + self.config["generate_range_url"]
url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["generate_range_url"])
try:
response = urllib.urlopen(url, self.api_auth)
response = json.loads(response.read())
logger.debug("Trying to contact %s", url)
logger.info("API-Status %s", response['status'])
logger.info("API-Message %s", response['message'])
except Exception, e:
api_status = False
logger.error("Unable to handle the OBP API request - %s", e)
return response
def get_liquidsoap_data(self, pkey, schedule):
playlist = schedule[pkey]
data = dict()
#data["ptype"] = playlist['subtype']
try:
data["user_id"] = playlist['user_id']
data["playlist_id"] = playlist['id']
data["transmission_id"] = playlist['schedule_id']
except Exception, e:
data["playlist_id"] = 0
data["user_id"] = 0
data["transmission_id"] = 0
data = json.dumps(data)
return data

View file

@ -1,4 +0,0 @@
# -*- coding: utf-8 -*-
from json import *
from status import *

View file

@ -1,57 +0,0 @@
# -*- coding: utf-8 -*-
import sys
import time
import urllib
import logging
import telnetlib
import json
import os
ALLOWED_EXTS = ('mp3')
class Callable:
def __init__(self, anycallable):
self.__call__ = anycallable
class Status:
def __init__(self, status_url):
self.status_url = status_url
def get_obp_version(self):
logger = logging.getLogger("status.get_obp_version")
# lookup OBP version
try:
response = urllib.urlopen(self.status_url)
response_json = json.loads(response.read())
obp_version = int(response_json['version'])
logger.debug("OBP Version %s detected", obp_version)
except Exception, e:
print e
obp_version = 0
logger.error("Unable to detect OBP Version - %s", e)
return obp_version
def check_ls(self, ls_host, ls_port):
logger = logging.getLogger("status.get_ls_version")
# lookup OBP version
try:
tn = telnetlib.Telnet(ls_host, ls_port)
tn.write("\n")
tn.write("version\n")
tn.write("exit\n")
print tn.read_all()
logger.info("liquidsoap connection ok")
return 1
except Exception, e:
obp_version = 0
logger.error("Unable to connect to liquidsoap")
return 0

33
utils/airtime-test-soundcard Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2011 Sourcefabric O.P.S.
#
# This file is part of the Airtime project.
# http://airtime.sourcefabric.org/
#
# Airtime is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Airtime is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Airtime; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script send data to data collection server
#
# Absolute path to this script
SCRIPT=`readlink -f $0`
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH
python airtime-test-soundcard.py "$@" || exit 1

View file

@ -0,0 +1,91 @@
import subprocess
import os
import pwd
import grp
import sys
import getopt
"""
we need to run the program as non-root because Liquidsoap refuses to run as root.
It is possible to run change the effective user id (seteuid) before calling Liquidsoap
but this introduces other problems (fake root user is not part of audio group after calling seteuid)
"""
if os.geteuid() == 0:
print "Please run this program as non-root"
sys.exit(1)
def printUsage():
print "airtime-test-soundcard [-v] [-o alsa | ao | oss | portaudio | pulseaudio ] [-h]"
print " Where: "
print " -v verbose mode"
print " -o Linux Sound API (default: alsa)"
print " -h show help menu "
def find_liquidsoap_binary():
"""
Starting with Airtime 2.0, we don't know the exact location of the Liquidsoap
binary because it may have been installed through a debian package. Let's find
the location of this binary.
"""
rv = subprocess.call("which liquidsoap > /dev/null", shell=True)
if rv == 0:
return "liquidsoap"
else:
if os.path.exists("/usr/lib/airtime/pypo/bin/liquidsoap_bin/liquidsoap"):
return "/usr/lib/airtime/pypo/bin/liquidsoap_bin/liquidsoap"
return None
try:
optlist, args = getopt.getopt(sys.argv[1:], 'hvo:')
except getopt.GetoptError, g:
printUsage()
sys.exit(1)
sound_api_types = set(["alsa", "ao", "oss", "portaudio", "pulseaudio"])
verbose = False
sound_api = "alsa"
for o, a in optlist:
if "-v" == o:
verbose = True
if "-o" == o:
if a.lower() in sound_api_types:
sound_api = a.lower()
else:
print "Unknown sound api type\n"
printUsage()
sys.exit(1)
if "-h" == o and len(optlist) == 1:
printUsage()
sys.exit(0)
try:
print "Sound API: %s" % sound_api
print "Outputting to soundcard. You should be able to hear a monotonous tone. Press ctrl-c to quit."
liquidsoap_exe = find_liquidsoap_binary()
if liquidsoap_exe is None:
raise Exception("Liquidsoap not found!")
command = "%s 'output.%s(sine())'" % (liquidsoap_exe, sound_api)
if not verbose:
command += " > /dev/null"
#print command
rv = subprocess.call(command, shell=True)
#if we reach this point, it means that our subprocess exited without the user
#doing a keyboard interrupt. This means there was a problem outputting to the
#soundcard. Print appropriate message.
print "There was an error using the selected sound API. Please select a different API " + \
"and run this program again. Use the -h option for help"
except KeyboardInterrupt, ki:
print "\nExiting"
except Exception, e:
raise

33
utils/airtime-test-stream Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2011 Sourcefabric O.P.S.
#
# This file is part of the Airtime project.
# http://airtime.sourcefabric.org/
#
# Airtime is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Airtime is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Airtime; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script send data to data collection server
#
# Absolute path to this script
SCRIPT=`readlink -f $0`
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH
python airtime-test-stream.py "$@" || exit 1

View file

@ -0,0 +1,118 @@
import subprocess
import os
import pwd
import grp
import sys
import getopt
"""
we need to run the program as non-root because Liquidsoap refuses to run as root.
It is possible to run change the effective user id (seteuid) before calling Liquidsoap
but this introduces other problems (fake root user is not part of audio group after calling seteuid)
"""
if os.geteuid() == 0:
print "Please run this program as non-root"
sys.exit(1)
def printUsage():
print "airtime-test-stream [-v] [-o icecast | shoutcast ] [-H hostname] [-P port] [-u username] [-p password] [-m mount]"
print " Where: "
print " -v verbose mode"
print " -o stream server type (default: icecast)"
print " -H hostname (default: localhost) "
print " -P port (default: 8000) "
print " -u port (default: source) "
print " -p password (default: hackme) "
print " -m mount (default: test) "
def find_liquidsoap_binary():
"""
Starting with Airtime 2.0, we don't know the exact location of the Liquidsoap
binary because it may have been installed through a debian package. Let's find
the location of this binary.
"""
rv = subprocess.call("which liquidsoap > /dev/null", shell=True)
if rv == 0:
return "liquidsoap"
else:
if os.path.exists("/usr/lib/airtime/pypo/bin/liquidsoap_bin/liquidsoap"):
return "/usr/lib/airtime/pypo/bin/liquidsoap_bin/liquidsoap"
return None
optlist, args = getopt.getopt(sys.argv[1:], 'hvo:H:P:u:p:')
stream_types = set(["shoutcast", "icecast"])
verbose = False
stream_type = "icecast"
host = "localhost"
port = 8000
user = "source"
password = "hackme"
mount = "test"
for o, a in optlist:
if "-v" == o:
verbose = True
if "-o" == o:
if a.lower() in stream_types:
stream_type = a.lower()
else:
print "Unknown stream type\n"
printUsage()
sys.exit(1)
if "-h" == o:
printUsage()
sys.exit(0)
if "-H" == o:
host = a
if "-P" == o:
port = a
if "-u" == o:
user = a
if "-p" == o:
password = a
if "-m" == o:
mount = a
try:
print "Protocol: %s " % stream_type
print "Host: %s" % host
print "Port: %s" % port
print "User: %s" % user
print "Password: %s" % password
print "Mount: %s\n" % mount
url = "http://%s:%s/%s" % (host, port, mount)
print "Outputting to %s streaming server. You should be able to hear a monotonous tone on '%s'. Press ctrl-c to quit." % (stream_type, url)
liquidsoap_exe = find_liquidsoap_binary()
if liquidsoap_exe is None:
raise Exception("Liquidsoap not found!")
if stream_type == "icecast":
command = "%s 'output.icecast(%%vorbis, host = \"%s\", port = %s, user= \"%s\", password = \"%s\", mount=\"%s\", sine())'" % (liquidsoap_exe, host, port, user, password, mount)
else:
command = "%s 'output.shoutcast(%%mp3, host=\"%s\", port = %s, user= \"%s\", password = \"%s\", mount=\"%s\", sine())'" % (liquidsoap_exe, host, port, user, password, mount)
if not verbose:
command += " 2>/dev/null | grep \"failed\""
#print command
rv = subprocess.call(command, shell=True)
#if we reach this point, it means that our subprocess exited without the user
#doing a keyboard interrupt. This means there was a problem outputting to the
#stream server. Print appropriate message.
print "There was an error with your stream configuration. Please review your configuration " + \
"and run this program again. Use the -h option for help"
except KeyboardInterrupt, ki:
print "\nExiting"
except Exception, e:
raise