Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
86e5c116f5
|
@ -24,7 +24,6 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('status', 'json')
|
||||
->addActionContext('register-component', 'json')
|
||||
->addActionContext('update-liquidsoap-status', 'json')
|
||||
->addActionContext('library-init', 'json')
|
||||
->addActionContext('live-chat', 'json')
|
||||
->addActionContext('update-file-system-mount', '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()));
|
||||
echo $jsonStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets up and send init values used in the Calendar.
|
||||
* This is only being used by schedule.js at the moment.
|
||||
|
@ -72,16 +71,16 @@ class ApiController extends Zend_Controller_Action
|
|||
public function calendarInitAction(){
|
||||
$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->calendarInit = array(
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timestamp" => time(),
|
||||
"timezoneOffset" => date("Z"),
|
||||
"timeScale" => Application_Model_Preference::GetCalendarTimeScale(),
|
||||
"timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(),
|
||||
"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.
|
||||
* Number of shows returned and the time interval in which to
|
||||
* get the next shows can be configured as GET parameters.
|
||||
*
|
||||
*
|
||||
* TODO: in the future, make interval length a parameter instead of hardcode to 48
|
||||
*
|
||||
*
|
||||
* Possible parameters:
|
||||
* type - Can have values of "endofday" or "interval". If set to "endofday",
|
||||
* 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;
|
||||
$utcTimeNow = $date->getUtcTimestamp();
|
||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
// make GetNextShows use end of day
|
||||
$utcTimeEnd = Application_Model_DateHelper::GetDayEndTimestampInUtc();
|
||||
}
|
||||
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
if($limit == "" || !is_numeric($limit)) {
|
||||
$limit = "5";
|
||||
}
|
||||
|
||||
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||
"currentShow"=>Application_Model_Show::GetCurrentShow($utcTimeNow),
|
||||
|
@ -219,7 +218,7 @@ class ApiController extends Zend_Controller_Action
|
|||
"timezone"=> date("T"),
|
||||
"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.
|
||||
|
||||
|
||||
//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["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
@ -233,7 +232,7 @@ class ApiController extends Zend_Controller_Action
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function weekInfoAction()
|
||||
{
|
||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
||||
|
@ -244,7 +243,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$date = new Application_Model_DateHelper;
|
||||
$dayStart = $date->getWeekStartDate();
|
||||
$utcDayStart = Application_Model_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
||||
|
||||
|
||||
$dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
|
||||
|
||||
$result = array();
|
||||
|
@ -252,9 +251,9 @@ class ApiController extends Zend_Controller_Action
|
|||
$utcDayEnd = Application_Model_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
|
||||
|
||||
$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.
|
||||
|
@ -373,8 +372,8 @@ class ApiController extends Zend_Controller_Action
|
|||
$now = new DateTime($today_timestamp);
|
||||
$end_timestamp = $now->add(new DateInterval("PT2H"));
|
||||
$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()),
|
||||
$excludeInstance=NULL, $onlyRecord=TRUE);
|
||||
|
||||
|
@ -405,7 +404,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$upload_dir = ini_get("upload_tmp_dir");
|
||||
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
|
||||
$tempFileName = basename($tempFilePath);
|
||||
|
||||
|
||||
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
|
||||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||
if (isset($result)){
|
||||
|
@ -456,19 +455,19 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if (isset($show_name)) {
|
||||
|
||||
|
||||
$show_name = str_replace(" ", "-", $show_name);
|
||||
|
||||
|
||||
//2011-12-09-19-28-00-ofirrr-256kbps
|
||||
$filename = $file->getName();
|
||||
|
||||
|
||||
//replace the showname in the filepath incase it has been edited since the show started recording
|
||||
//(some old bug)
|
||||
$filename_parts = explode("-", $filename);
|
||||
$new_name = array_slice($filename_parts, 0, 6);
|
||||
$new_name[] = $show_name;
|
||||
$new_name[] = $filename_parts[count($filename_parts)-1];
|
||||
|
||||
|
||||
$tmpTitle = implode("-", $new_name);
|
||||
}
|
||||
else {
|
||||
|
@ -533,7 +532,7 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$this->view->stor = Application_Model_MusicDir::getStorDir()->getDirectory();
|
||||
|
||||
|
||||
$watchedDirs = Application_Model_MusicDir::getWatchedDirs();
|
||||
$watchedDirsPath = array();
|
||||
foreach($watchedDirs as $wd){
|
||||
|
@ -573,7 +572,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$filepath = str_replace("//", "/", $filepath);
|
||||
|
||||
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
|
||||
|
||||
|
||||
if (is_null($file)) {
|
||||
$file = Application_Model_StoredFile::Insert($md);
|
||||
}
|
||||
|
@ -737,10 +736,10 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$this->view->msg = Application_Model_MusicDir::setStorDir($path);
|
||||
}
|
||||
|
||||
|
||||
public function getStreamSettingAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
public function statusAction() {
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
$getDiskInfo = $request->getParam('diskinfo') == "true";
|
||||
|
@ -767,7 +766,7 @@ class ApiController extends Zend_Controller_Action
|
|||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$status = array(
|
||||
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
|
||||
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
|
||||
|
@ -779,11 +778,11 @@ class ApiController extends Zend_Controller_Action
|
|||
"media_monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
if ($getDiskInfo){
|
||||
$status["partitions"] = Application_Model_Systemstatus::GetDiskInfo();
|
||||
}
|
||||
|
||||
|
||||
$this->view->status = $status;
|
||||
}
|
||||
|
||||
|
@ -796,40 +795,21 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
}
|
||||
|
||||
|
||||
public function updateLiquidsoapStatusAction(){
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$msg = $request->getParam('msg');
|
||||
$stream_id = $request->getParam('stream_id');
|
||||
$boot_time = $request->getParam('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
|
||||
public function updateFileSystemMountAction(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
|
@ -842,16 +822,16 @@ class ApiController extends Zend_Controller_Action
|
|||
$params = $request->getParams();
|
||||
$added_list = empty($params['added_dir'])?array():explode(',',$params['added_dir']);
|
||||
$removed_list = empty($params['removed_dir'])?array():explode(',',$params['removed_dir']);
|
||||
|
||||
|
||||
// get all watched dirs
|
||||
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
|
||||
|
||||
|
||||
foreach( $added_list as $ad){
|
||||
foreach( $watched_dirs as $dir ){
|
||||
$dirPath = $dir->getDirectory();
|
||||
|
||||
|
||||
$ad .= '/';
|
||||
|
||||
|
||||
// if mount path itself was watched
|
||||
if($dirPath == $ad){
|
||||
Application_Model_MusicDir::addWatchedDir($dirPath, false);
|
||||
|
@ -884,7 +864,7 @@ class ApiController extends Zend_Controller_Action
|
|||
// is new mount point within the watched dir?
|
||||
// pyinotify doesn't notify anyhing in this case, so we walk through all files within
|
||||
// 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
|
||||
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
|
||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||
|
@ -903,13 +883,13 @@ class ApiController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// handles case where watched dir is missing
|
||||
public function handleWatchedDirMissingAction(){
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$api_key = $request->getParam('api_key');
|
||||
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
|
||||
|
@ -918,7 +898,7 @@ class ApiController extends Zend_Controller_Action
|
|||
print 'You are not allowed to access this resource.';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$dir = base64_decode($request->getParam('dir'));
|
||||
Application_Model_MusicDir::removeWatchedDir($dir, false);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -56,16 +58,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
|
||||
$form = new Application_Form_AdvancedSearch();
|
||||
$form->addGroup(1, 1);
|
||||
|
||||
$this->search_sess->next_group = 2;
|
||||
$this->search_sess->next_row[1] = 2;
|
||||
$this->view->form = $form;
|
||||
$this->view->md = $this->search_sess->md;
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
|
@ -290,14 +282,4 @@ class LibraryController extends Zend_Controller_Action
|
|||
$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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,12 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
if (isset($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;
|
||||
}
|
||||
|
@ -51,6 +57,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
$this->view->modified = $pl->getLastModified("U");
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
@ -68,10 +75,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()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -81,18 +111,16 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
||||
if (isset($pl)) {
|
||||
$this->view->pl = $pl;
|
||||
if (isset($this->pl_sess->id)) {
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
$this->view->pl = $pl;
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,20 +147,15 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl = new Application_Model_Playlist($id);
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$id} not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->changePlaylist(null);
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
|
@ -150,23 +173,18 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
else {
|
||||
Logging::log("Not deleting currently active playlist");
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
}
|
||||
|
||||
Application_Model_Playlist::DeletePlaylists($ids);
|
||||
$pl = $this->getPlaylist();
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
catch(PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$pl = null;
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch(Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function addItemsAction()
|
||||
|
@ -176,24 +194,20 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$afterItem = $this->_getParam('afterItem', null);
|
||||
$addType = $this->_getParam('type', 'after');
|
||||
|
||||
Logging::log("type is ".$addType);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->addAudioClips($ids, $afterItem, $addType);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function moveItemsAction()
|
||||
|
@ -201,46 +215,44 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
$modified = $this->_getParam('modified');
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->moveAudioClips($ids, $afterItem);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function deleteItemsAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$modified = $this->_getParam('modified');
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->delAudioClips($ids);
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function setCueAction()
|
||||
|
@ -253,21 +265,22 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeClipLength($id, $cueIn, $cueOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
if(!isset($response["error"])) {
|
||||
if (!isset($response["error"])) {
|
||||
$this->view->response = $response;
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
else {
|
||||
$this->view->cue_error = $response["error"];
|
||||
}
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,21 +294,22 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeFadeInfo($id, $fadeIn, $fadeOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
if (!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
$this->view->response = $response;
|
||||
}
|
||||
else {
|
||||
$this->view->fade_error = $response["error"];
|
||||
}
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,15 +323,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$fades = $pl->getFadeInfo($pl->getSize()-1);
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,15 +348,14 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$pl = $this->getPlaylist();
|
||||
$pl->setPlaylistfades($fadeIn, $fadeOut);
|
||||
}
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,33 +363,42 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$name = $this->_getParam('name', 'Unknown Playlist');
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->setName($name);
|
||||
$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()
|
||||
{
|
||||
$description = $this->_getParam('description', false);
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
$description = $this->_getParam('description', "");
|
||||
|
||||
if($description != false) {
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->setDescription($description);
|
||||
$this->view->description = $pl->getDescription();
|
||||
$this->view->modified = $pl->getLastModified("U");
|
||||
}
|
||||
else {
|
||||
$description = $pl->getDescription();
|
||||
catch (PlaylistOutDatedException $e) {
|
||||
$this->playlistOutdated($pl, $e);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
|
||||
$this->view->playlistDescription = $description;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,15 @@ class PreferenceController extends Zend_Controller_Action
|
|||
->addActionContext('is-import-in-progress', 'json')
|
||||
->addActionContext('change-stream-setting', 'json')
|
||||
->addActionContext('get-liquidsoap-status', 'json')
|
||||
->addActionContext('get-library-datatable', 'json')
|
||||
->addActionContext('set-library-datatable', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -59,7 +61,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function supportSettingAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -119,7 +121,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function directoryConfigAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
@ -136,7 +138,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
public function streamSettingAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -206,10 +208,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
|
||||
}
|
||||
if(!$error){
|
||||
|
@ -331,6 +333,26 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
die(json_encode($out));
|
||||
}
|
||||
|
||||
public function setLibraryDatatableAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$settings = $request->getParam("settings");
|
||||
|
||||
$data = serialize($settings);
|
||||
Logging::log("library datatable");
|
||||
Logging::log($data);
|
||||
|
||||
Application_Model_Preference::SetValue("library_datatable", $data, true);
|
||||
|
||||
}
|
||||
|
||||
public function getLibraryDatatableAction() {
|
||||
|
||||
$data = Application_Model_Preference::GetValue("library_datatable", true);
|
||||
|
||||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -204,15 +204,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
&& !$instance->isRecorded()
|
||||
&& !$instance->isRebroadcast()) {
|
||||
|
||||
$menu["schedule"] = array("name"=> "Add / Remove Content", "url" => "/showbuilder/index/");
|
||||
$menu["schedule"] = array("name"=> "Add / Remove Content",
|
||||
"url" => "/showbuilder/index/");
|
||||
|
||||
$menu["clear"] = array("name"=> "Remove All Content", "icon" => "delete", "url" => "/schedule/clear-show");
|
||||
|
||||
/*
|
||||
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params,
|
||||
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Remove All Content');
|
||||
*/
|
||||
$menu["clear"] = array("name"=> "Remove All Content", "icon" => "delete",
|
||||
"url" => "/schedule/clear-show");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
public function builderAction() {
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('builder');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -37,10 +39,15 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$end = DateTime::createFromFormat("U", $to, new DateTimeZone("UTC"));
|
||||
$end->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
|
||||
$this->view->start_date = $start->format("Y-m-d");
|
||||
$this->view->start_time = $start->format("H:i");
|
||||
$this->view->end_date = $end->format("Y-m-d");
|
||||
$this->view->end_time = $end->format("H:i");
|
||||
$form = new Application_Form_ShowBuilder();
|
||||
$form->populate(array(
|
||||
'sb_date_start' => $start->format("Y-m-d"),
|
||||
'sb_time_start' => $start->format("H:i"),
|
||||
'sb_date_end' => $end->format("Y-m-d"),
|
||||
'sb_time_end' => $end->format("H:i")
|
||||
));
|
||||
|
||||
$this->view->sb_form = $form;
|
||||
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
|
@ -48,8 +55,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css');
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('builder');
|
||||
}
|
||||
|
||||
public function builderFeedAction() {
|
||||
|
@ -60,6 +65,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$starts_epoch = $request->getParam("start", $current_time);
|
||||
//default ends is 24 hours after starts.
|
||||
$ends_epoch = $request->getParam("end", $current_time + (60*60*24));
|
||||
$show_filter = intval($request->getParam("showFilter", 0));
|
||||
$my_shows = intval($request->getParam("myShows", 0));
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
@ -67,7 +74,8 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
Logging::log("showbuilder starts {$startsDT->format("Y-m-d H:i:s")}");
|
||||
Logging::log("showbuilder ends {$endsDT->format("Y-m-d H:i:s")}");
|
||||
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT);
|
||||
$opts = array("myShows" => $my_shows, "showFilter" => $show_filter);
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
|
||||
|
||||
$this->view->schedule = $showBuilder->GetItems();
|
||||
}
|
||||
|
@ -75,21 +83,24 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
public function scheduleAddAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$mediaItems = $request->getParam("mediaIds", null);
|
||||
$scheduledIds = $request->getParam("schedIds", null);
|
||||
|
||||
$json = array();
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->scheduleAfter($scheduledIds, $mediaItems);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
|
@ -98,45 +109,98 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
public function scheduleRemoveAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$ids = $request->getParam("ids", null);
|
||||
|
||||
$json = array();
|
||||
$items = $request->getParam("items", null);
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->removeItems($ids);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
$scheduler->removeItems($items);
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
}
|
||||
|
||||
public function scheduleMoveAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$selectedItem = $request->getParam("selectedItem");
|
||||
$afterItem = $request->getParam("afterItem");
|
||||
|
||||
$json = array();
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->moveItem($selectedItem, $afterItem);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
}
|
||||
catch (OutDatedScheduleException $e) {
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
$this->view->error = $e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
}
|
||||
|
||||
public function scheduleReorderAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$showInstance = $request->getParam("instanceId");
|
||||
}
|
||||
|
||||
/*
|
||||
* make sure any incoming requests for scheduling are ligit.
|
||||
*
|
||||
* @param array $items, an array containing pks of cc_schedule items.
|
||||
*/
|
||||
private function filterSelected($items) {
|
||||
|
||||
$allowed = array();
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
$type = $user->getType();
|
||||
|
||||
//item must be within the host's show.
|
||||
if ($type === UTYPE_HOST) {
|
||||
|
||||
$hosted = CcShowHostsQuery::create()
|
||||
->filterByDbHost($user->getId())
|
||||
->find();
|
||||
|
||||
$allowed_shows = array();
|
||||
foreach ($hosted as $host) {
|
||||
$allowed_shows[] = $host->getDbShow();
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($items); $i++) {
|
||||
|
||||
$instance = $items[$i]["instance"];
|
||||
|
||||
if (in_array($instance, $allowed_shows)) {
|
||||
$allowed[] = $items[$i];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->shows = $res;
|
||||
}
|
||||
//they can schedule anything.
|
||||
else if ($type === UTYPE_ADMIN || $type === UTYPE_PROGRAM_MANAGER) {
|
||||
$allowed = $items;
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearch extends Zend_Form
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_group')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the submit button
|
||||
$this->addElement('button', 'search_submit', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Save',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_submit')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addGroup($group_id, $row_id=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchGroup(), 'group_'.$group_id, $group_id);
|
||||
$this->getSubForm('group_'.$group_id)->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($row_id)) {
|
||||
$subGroup = $this->getSubForm('group_'.$group_id);
|
||||
$subGroup->addRow($row_id);
|
||||
}
|
||||
}
|
||||
|
||||
public function preValidation(array $data) {
|
||||
|
||||
function findId($name) {
|
||||
$t = explode("_", $name);
|
||||
return $t[1];
|
||||
}
|
||||
|
||||
function findFields($field) {
|
||||
return strpos($field, 'group') !== false;
|
||||
}
|
||||
|
||||
$groups = array_filter(array_keys($data), 'findFields');
|
||||
|
||||
foreach ($groups as $group) {
|
||||
|
||||
$group_id = findId($group);
|
||||
$this->addGroup($group_id);
|
||||
|
||||
$subGroup = $this->getSubForm($group);
|
||||
|
||||
foreach (array_keys($data[$group]) as $row) {
|
||||
|
||||
$row_id = findId($row);
|
||||
$subGroup->addRow($row_id, $data[$group][$row]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchGroup extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_add_row', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Add',
|
||||
'order' => '-2'
|
||||
));
|
||||
$this->getElement('search_add_row')->removeDecorator('DtDdWrapper');
|
||||
|
||||
// Add the add button
|
||||
$this->addElement('button', 'search_remove_group', array(
|
||||
'ignore' => true,
|
||||
'label' => 'Remove',
|
||||
'order' => '-1'
|
||||
));
|
||||
$this->getElement('search_remove_group')->removeDecorator('DtDdWrapper');
|
||||
}
|
||||
|
||||
public function addRow($row_id, $data=null) {
|
||||
|
||||
$this->addSubForm(new Application_Form_AdvancedSearchRow(), 'row_'.$row_id, $row_id);
|
||||
$row = $this->getSubForm('row_'.$row_id);
|
||||
$row->removeDecorator('DtDdWrapper');
|
||||
|
||||
if(!is_null($data)) {
|
||||
$row->setDefaults($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_AdvancedSearchRow extends Zend_Form_SubForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->addElement(
|
||||
'select',
|
||||
'metadata',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"dc:title" => "Title",
|
||||
"dc:format" => "Format",
|
||||
"dc:creator" => "Artist/Creator",
|
||||
"dc:source" => "Album",
|
||||
"ls:bitrate" => "Bitrate",
|
||||
"ls:samplerate" => "Samplerate",
|
||||
"dcterms:extent" => "Length",
|
||||
"dc:description" => "Comments",
|
||||
"dc:type" => "Genre",
|
||||
"ls:channels" => "channels",
|
||||
"ls:year" => "Year",
|
||||
"ls:track_num" => "track_number",
|
||||
"ls:mood" => "mood",
|
||||
"ls:bpm" => "BPM",
|
||||
"ls:rating" => "rating",
|
||||
"ls:encoded_by" => "encoded_by",
|
||||
"dc:publisher" => "label",
|
||||
"ls:composer" => "Composer",
|
||||
"ls:encoder" => "Encoder",
|
||||
"ls:lyrics" => "lyrics",
|
||||
"ls:orchestra" => "orchestra",
|
||||
"ls:conductor" => "conductor",
|
||||
"ls:lyricist" => "lyricist",
|
||||
"ls:originallyricist" => "original_lyricist",
|
||||
"ls:isrcnumber" => "isrc_number",
|
||||
"dc:language" => "Language",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('metadata')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement(
|
||||
'select',
|
||||
'match',
|
||||
array(
|
||||
'required' => true,
|
||||
'multiOptions' => array(
|
||||
"0" => "partial",
|
||||
"1" => "=",
|
||||
"2" => "<",
|
||||
"3" => "<=",
|
||||
"4" => ">",
|
||||
"5" => ">=",
|
||||
"6" => "!=",
|
||||
),
|
||||
)
|
||||
);
|
||||
$this->getElement('match')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
|
||||
$this->addElement('text', 'search', array(
|
||||
'required' => true,
|
||||
));
|
||||
$this->getElement('search')->removeDecorator('Label')->removeDecorator('HtmlTag');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||
));
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('sb_date_start');
|
||||
$startDate->class = 'input_text';
|
||||
$startDate->setRequired(true)
|
||||
->setLabel('Date Start:')
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startDate->setAttrib('alt', 'date');
|
||||
$this->addElement($startDate);
|
||||
|
||||
// Add start time element
|
||||
$startTime = new Zend_Form_Element_Text('sb_time_start');
|
||||
$startTime->class = 'input_text';
|
||||
$startTime->setRequired(true)
|
||||
->setValue('00:00')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$startTime->setAttrib('alt', 'time');
|
||||
$this->addElement($startTime);
|
||||
|
||||
// Add end date element
|
||||
$endDate = new Zend_Form_Element_Text('sb_date_end');
|
||||
$endDate->class = 'input_text';
|
||||
$endDate->setRequired(true)
|
||||
->setLabel('Date End:')
|
||||
->setValue(date("Y-m-d"))
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('YYYY-MM-DD'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endDate->setAttrib('alt', 'date');
|
||||
$this->addElement($endDate);
|
||||
|
||||
// Add end time element
|
||||
$endTime = new Zend_Form_Element_Text('sb_time_end');
|
||||
$endTime->class = 'input_text';
|
||||
$endTime->setRequired(true)
|
||||
->setValue('01:00')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))))
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$endTime->setAttrib('alt', 'time');
|
||||
$this->addElement($endTime);
|
||||
|
||||
|
||||
// add a select to choose a show.
|
||||
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
||||
$showSelect->setLabel("Filter By Show:");
|
||||
$showSelect->setMultiOptions($this->getShowNames());
|
||||
$showSelect->setValue(null);
|
||||
$showSelect->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($showSelect);
|
||||
|
||||
if ($user->getType() === 'H') {
|
||||
$myShows = new Zend_Form_Element_Checkbox('sb_my_shows');
|
||||
$myShows->setLabel('All My Shows')
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($myShows);
|
||||
}
|
||||
}
|
||||
|
||||
private function getShowNames() {
|
||||
|
||||
$showNames = array("0" => "-------------------------");
|
||||
|
||||
$shows = CcShowQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->orderByDbName()
|
||||
->find();
|
||||
|
||||
foreach ($shows as $show) {
|
||||
|
||||
$showNames[$show->getDbId()] = $show->getDbName();
|
||||
}
|
||||
|
||||
return $showNames;
|
||||
}
|
||||
|
||||
}
|
|
@ -89,7 +89,7 @@ class Application_Model_Playlist {
|
|||
public function setName($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);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ class Application_Model_Playlist {
|
|||
public function setDescription($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);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Application_Model_Playlist {
|
|||
public function setCreator($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);
|
||||
}
|
||||
|
||||
|
@ -218,13 +218,18 @@ class Application_Model_Playlist {
|
|||
{
|
||||
$file = CcFilesQuery::create()->findPK($p_item, $this->con);
|
||||
|
||||
$entry = $this->plItem;
|
||||
$entry["id"] = $file->getDbId();
|
||||
$entry["pos"] = $pos;
|
||||
$entry["cliplength"] = $file->getDbLength();
|
||||
$entry["cueout"] = $file->getDbLength();
|
||||
if (isset($file) && $file->getDbFileExists()) {
|
||||
$entry = $this->plItem;
|
||||
$entry["id"] = $file->getDbId();
|
||||
$entry["pos"] = $pos;
|
||||
$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 +305,7 @@ class Application_Model_Playlist {
|
|||
$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->con->commit();
|
||||
|
@ -383,7 +388,7 @@ class Application_Model_Playlist {
|
|||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
|
@ -415,7 +420,7 @@ class Application_Model_Playlist {
|
|||
$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->con->commit();
|
||||
|
@ -462,47 +467,52 @@ class Application_Model_Playlist {
|
|||
$fadeIn = $fadeIn?'00:00:'.$fadeIn:$fadeIn;
|
||||
$fadeOut = $fadeOut?'00:00:'.$fadeOut:$fadeOut;
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$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 {
|
||||
$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) {
|
||||
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) {
|
||||
|
@ -512,7 +522,7 @@ class Application_Model_Playlist {
|
|||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition(0)
|
||||
->findOne();
|
||||
->findOne($this->con);
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), $fadein, null);
|
||||
}
|
||||
|
@ -521,7 +531,7 @@ class Application_Model_Playlist {
|
|||
$row = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id)
|
||||
->filterByDbPosition($this->getSize()-1)
|
||||
->findOne();
|
||||
->findOne($this->con);
|
||||
|
||||
$this->changeFadeInfo($row->getDbId(), null, $fadeout);
|
||||
}
|
||||
|
@ -540,126 +550,135 @@ class Application_Model_Playlist {
|
|||
*/
|
||||
public function changeClipLength($id, $cueIn, $cueOut)
|
||||
{
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$errArray= array();
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"]="Cue in and cue out are null.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$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.";
|
||||
try {
|
||||
if (is_null($cueIn) && is_null($cueOut)) {
|
||||
$errArray["error"] = "Cue in and cue out are null.";
|
||||
return $errArray;
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$errArray["error"] = "Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
$row = CcPlaylistcontentsQuery::create()
|
||||
->joinWith(CcFilesPeer::OM_CLASS)
|
||||
->filterByPrimaryKey($id)
|
||||
->findOne($this->con);
|
||||
|
||||
if (is_null($row)) {
|
||||
throw new Exception("Playlist item does not exist.");
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$cueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$oldCueIn = $row->getDBCuein();
|
||||
$oldCueOut = $row->getDbCueout();
|
||||
$fadeIn = $row->getDbFadein();
|
||||
$fadeOut = $row->getDbFadeout();
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
$file = $row->getCcFiles($this->con);
|
||||
$origLength = $file->getDbLength();
|
||||
|
||||
}
|
||||
else if(!is_null($cueIn)) {
|
||||
if (!is_null($cueIn) && !is_null($cueOut)){
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueIn}' > INTERVAL '{$oldCueOut}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)) {
|
||||
$errArray["error"] = "Can't set cue in to be larger than cue out.";
|
||||
return $errArray;
|
||||
if ($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
}
|
||||
|
||||
$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}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$row->setDbCuein($cueIn);
|
||||
$row->setDBCliplength($cliplength);
|
||||
}
|
||||
else if(!is_null($cueOut)) {
|
||||
|
||||
if($cueOut === ""){
|
||||
$cueOut = $origLength;
|
||||
$sql = "SELECT INTERVAL '{$fadeIn}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeIn = $cliplength;
|
||||
$row->setDbFadein($fadeIn);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' < INTERVAL '{$oldCueIn}'";
|
||||
$r = $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 '{$fadeOut}' > INTERVAL '{$cliplength}'";
|
||||
$r = $this->con->query($sql);
|
||||
if ($r->fetchColumn(0)){
|
||||
$fadeOut = $cliplength;
|
||||
$row->setDbFadein($fadeOut);
|
||||
}
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' > INTERVAL '{$origLength}'";
|
||||
$r = $con->query($sql);
|
||||
if($r->fetchColumn(0)){
|
||||
$errArray["error"] ="Can't set cue out to be greater than file length.";
|
||||
return $errArray;
|
||||
}
|
||||
$row->save($this->con);
|
||||
$this->pl->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
|
||||
$this->pl->save($this->con);
|
||||
|
||||
$sql = "SELECT INTERVAL '{$cueOut}' - INTERVAL '{$oldCueIn}'";
|
||||
$r = $con->query($sql);
|
||||
$cliplength = $r->fetchColumn(0);
|
||||
|
||||
$row->setDbCueout($cueOut);
|
||||
$row->setDBCliplength($cliplength);
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$cliplength = $row->getDbCliplength();
|
||||
|
||||
$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);
|
||||
return array("cliplength"=> $cliplength, "cueIn"=> $cueIn, "cueOut"=> $cueOut, "length"=> $this->getLength(),
|
||||
"fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
|
||||
}
|
||||
|
||||
public function getAllPLMetaData()
|
||||
|
@ -768,4 +787,4 @@ class Application_Model_Playlist {
|
|||
} // class Playlist
|
||||
|
||||
class PlaylistNotFoundException extends Exception {}
|
||||
class OutDatedException extends Exception {}
|
||||
class PlaylistOutDatedException extends Exception {}
|
||||
|
|
|
@ -429,7 +429,7 @@ class Application_Model_Preference
|
|||
}
|
||||
|
||||
public static function GetInstallMethod(){
|
||||
$easy_install = file_exists('/usr/bin/airtime-easy-install');
|
||||
$easy_install = file_exists('/usr/bin/airtime-easy-setup');
|
||||
$debian_install = file_exists('/var/lib/dpkg/info/airtime.config');
|
||||
if($debian_install){
|
||||
if($easy_install){
|
||||
|
|
|
@ -303,7 +303,7 @@ class Application_Model_Schedule {
|
|||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime)
|
||||
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime, $p_shows)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
|
@ -313,7 +313,7 @@ class Application_Model_Schedule {
|
|||
showt.background_color AS show_background_colour, showt.id AS show_id,
|
||||
|
||||
si.starts AS si_starts, si.ends AS si_ends, si.time_filled AS si_time_filled,
|
||||
si.record AS si_record, si.rebroadcast AS si_rebroadcast, si.id AS si_id,
|
||||
si.record AS si_record, si.rebroadcast AS si_rebroadcast, si.id AS si_id, si.last_scheduled AS si_last_scheduled,
|
||||
|
||||
sched.starts AS sched_starts, sched.ends AS sched_ends, sched.id AS sched_id,
|
||||
|
||||
|
@ -328,9 +328,13 @@ class Application_Model_Schedule {
|
|||
|
||||
WHERE si.modified_instance = false AND
|
||||
|
||||
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'
|
||||
si.starts >= '{$p_startDateTime}' AND si.starts < '{$p_endDateTime}'";
|
||||
|
||||
ORDER BY si.starts, sched.starts;";
|
||||
if (count($p_shows) > 0) {
|
||||
$sql .= " AND show_id IN (".implode(",", $p_shows).")";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY si.starts, sched.starts;";
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
|
|
|
@ -31,11 +31,16 @@ class Application_Model_Scheduler {
|
|||
if ($type === "audioclip") {
|
||||
$file = CcFilesQuery::create()->findPK($id, $this->con);
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $id;
|
||||
$data["cliplength"] = $file->getDbLength();
|
||||
if (is_null($file) || !$file->getDbFileExists()) {
|
||||
throw new Exception("A selected File does not exist!");
|
||||
}
|
||||
else {
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $id;
|
||||
$data["cliplength"] = $file->getDbLength();
|
||||
|
||||
$files[] = $data;
|
||||
$files[] = $data;
|
||||
}
|
||||
}
|
||||
else if ($type === "playlist") {
|
||||
|
||||
|
@ -44,17 +49,25 @@ class Application_Model_Scheduler {
|
|||
->filterByDbPlaylistId($id)
|
||||
->find($this->con);
|
||||
|
||||
if (is_null($contents)) {
|
||||
throw new Exception("A selected Playlist does not exist!");
|
||||
}
|
||||
|
||||
foreach ($contents as $plItem) {
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $plItem->getDbFileId();
|
||||
$data["cliplength"] = $plItem->getDbCliplength();
|
||||
$data["cuein"] = $plItem->getDbCuein();
|
||||
$data["cueout"] = $plItem->getDbCueout();
|
||||
$data["fadein"] = $plItem->getDbFadein();
|
||||
$data["fadeout"] = $plItem->getDbFadeout();
|
||||
$file = $plItem->getCcFiles($this->con);
|
||||
if (isset($file) && $file->getDbFileExists()) {
|
||||
|
||||
$files[] = $data;
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $plItem->getDbFileId();
|
||||
$data["cliplength"] = $plItem->getDbCliplength();
|
||||
$data["cuein"] = $plItem->getDbCuein();
|
||||
$data["cueout"] = $plItem->getDbCueout();
|
||||
$data["fadein"] = $plItem->getDbFadein();
|
||||
$data["fadeout"] = $plItem->getDbFadeout();
|
||||
|
||||
$files[] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,6 +111,8 @@ class Application_Model_Scheduler {
|
|||
|
||||
try {
|
||||
|
||||
$affectedShowInstances = array();
|
||||
|
||||
//dont want to recalculate times for moved items.
|
||||
$excludeIds = array();
|
||||
foreach ($schedFiles as $file) {
|
||||
|
@ -108,34 +123,42 @@ class Application_Model_Scheduler {
|
|||
|
||||
foreach ($scheduleItems as $schedule) {
|
||||
$id = intval($schedule["id"]);
|
||||
$ts = intval($schedule["timestamp"]);
|
||||
|
||||
Logging::log("scheduling after scheduled item: ".$id);
|
||||
Logging::log("in show: ".intval($schedule["instance"]));
|
||||
|
||||
if ($id !== 0) {
|
||||
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
||||
$instance = $schedItem->getDbInstanceId();
|
||||
|
||||
//user has an old copy of the time line opened.
|
||||
if ($instance !== intval($schedule["instance"])) {
|
||||
Logging::log("items have been since updated");
|
||||
return;
|
||||
$instance = $schedItem->getCcShowInstances($this->con);
|
||||
if (intval($schedule["instance"]) !== $instance->getDbId()) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
|
||||
$nextStartDT = $schedItem->getDbEnds(null);
|
||||
}
|
||||
//selected empty row to add after
|
||||
else {
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||
$nextStartDT = $showInstance->getDbStarts(null);
|
||||
$instance = intval($schedule["instance"]);
|
||||
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||
$nextStartDT = $instance->getDbStarts(null);
|
||||
}
|
||||
|
||||
$currTs = intval($instance->getDbLastScheduled("U")) ? : 0;
|
||||
//user has an old copy of the time line opened.
|
||||
if ($ts !== $currTs) {
|
||||
Logging::log("currTs {$currTs}, ts {$ts}");
|
||||
$show = $instance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
|
||||
if (!in_array($instance->getDbId(), $affectedShowInstances)) {
|
||||
$affectedShowInstances[] = $instance->getDbId();
|
||||
}
|
||||
|
||||
Logging::log("finding items >= {$nextStartDT->format("Y-m-d H:i:s.u")}");
|
||||
if ($adjustSched === true) {
|
||||
$followingSchedItems = CcScheduleQuery::create()
|
||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||
->filterByDbInstanceId($instance)
|
||||
->filterByDbInstanceId($instance->getDbId())
|
||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
@ -171,7 +194,7 @@ class Application_Model_Scheduler {
|
|||
$sched->setDbFadeIn($file['fadein']);
|
||||
$sched->setDbFadeOut($file['fadeout']);
|
||||
$sched->setDbClipLength($file['cliplength']);
|
||||
$sched->setDbInstanceId($instance);
|
||||
$sched->setDbInstanceId($instance->getDbId());
|
||||
$sched->save($this->con);
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
|
@ -195,6 +218,10 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
//update the last scheduled timestamp.
|
||||
CcShowInstancesQuery::create()
|
||||
->filterByPrimaryKeys($affectedShowInstances)
|
||||
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
|
@ -236,36 +263,53 @@ class Application_Model_Scheduler {
|
|||
* @param array $selectedItem
|
||||
* @param array $afterItem
|
||||
*/
|
||||
public function moveItem($selectedItem, $afterItem, $adjustSched = true) {
|
||||
public function moveItem($selectedItems, $afterItems, $adjustSched = true) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$origSelIns = intval($selectedItem[0]["instance"]);
|
||||
$origAfterIns = intval($afterItem[0]["instance"]);
|
||||
$origSelTs = intval($selectedItems[0]["timestamp"]);
|
||||
$origAfterTs = intval($afterItems[0]["timestamp"]);
|
||||
|
||||
Logging::log("Moving item {$selectedItem[0]["id"]}");
|
||||
Logging::log("After {$afterItem[0]["id"]}");
|
||||
Logging::log("Moving item {$selectedItems[0]["id"]}");
|
||||
Logging::log("After {$afterItems[0]["id"]}");
|
||||
|
||||
$selected = CcScheduleQuery::create()->findPk($selectedItem[0]["id"]);
|
||||
$after = CcScheduleQuery::create()->findPk($afterItem[0]["id"]);
|
||||
|
||||
/*
|
||||
if (isset($after) && $origSelIns !== $selected->getDBInstanceId()
|
||||
|| $origAfterIns !== $after->getDBInstanceId()) {
|
||||
|
||||
Logging::log("items have been since updated");
|
||||
return;
|
||||
$selected = CcScheduleQuery::create()->findPk($selectedItems[0]["id"], $this->con);
|
||||
if (is_null($selected)) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
*/
|
||||
$selectedInstance = $selected->getCcShowInstances($this->con);
|
||||
|
||||
$this->removeGaps($origSelIns, $selected->getDbId());
|
||||
|
||||
//moved to another show, remove gaps from original show.
|
||||
if ($adjustSched === true && $origSelIns !== $origAfterIns) {
|
||||
if (intval($afterItems[0]["id"]) === 0) {
|
||||
|
||||
$afterInstance = CcShowInstancesQuery::create()->findPK($afterItems[0]["instance"], $this->con);
|
||||
}
|
||||
else {
|
||||
$after = CcScheduleQuery::create()->findPk($afterItems[0]["id"], $this->con);
|
||||
if (is_null($after)) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
$afterInstance = $after->getCcShowInstances($this->con);
|
||||
}
|
||||
|
||||
if (is_null($selectedInstance) || is_null($afterInstance)) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
|
||||
$currTs = intval($selectedInstance->getDbLastScheduled("U")) ? : 0;
|
||||
if ($origSelTs !== $currTs) {
|
||||
$show = $selectedInstance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
|
||||
$currTs = intval($afterInstance->getDbLastScheduled("U")) ? : 0;
|
||||
if ($origAfterTs !== $currTs) {
|
||||
$show = $afterInstance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
|
||||
$this->removeGaps($selectedInstance->getDbId(), $selected->getDbId());
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $selected->getDbFileId();
|
||||
|
@ -276,7 +320,7 @@ class Application_Model_Scheduler {
|
|||
$data["fadeout"] = $selected->getDbFadeOut();
|
||||
$data["sched_id"] = $selected->getDbId();
|
||||
|
||||
$this->insertAfter($afterItem, array($data), $adjustSched);
|
||||
$this->insertAfter($afterItems, array($data), $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
|
@ -288,14 +332,35 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
public function removeItems($scheduledIds, $adjustSched = true) {
|
||||
public function removeItems($scheduledItems, $adjustSched = true) {
|
||||
|
||||
$showInstances = array();
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$removedItems = CcScheduleQuery::create()->findPks($scheduledIds);
|
||||
$scheduledIds = array();
|
||||
foreach ($scheduledItems as $item) {
|
||||
$scheduledIds[$item["id"]] = intval($item["timestamp"]);
|
||||
}
|
||||
|
||||
$removedItems = CcScheduleQuery::create()->findPks(array_keys($scheduledIds));
|
||||
|
||||
//check to make sure all items selected are up to date
|
||||
foreach ($removedItems as $removedItem) {
|
||||
$ts = $scheduledIds[$removedItem->getDbId()];
|
||||
$instance = $removedItem->getCcShowInstances($this->con);
|
||||
if (is_null($instance)) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
$currTs = intval($instance->getDbLastScheduled("U")) ? : 0;
|
||||
|
||||
if ($ts !== $currTs) {
|
||||
$show = $instance->getCcShow($this->con);
|
||||
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
|
||||
}
|
||||
}
|
||||
|
||||
$removedItems->delete($this->con);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
|
@ -313,6 +378,11 @@ class Application_Model_Scheduler {
|
|||
}
|
||||
}
|
||||
|
||||
//update the last scheduled timestamp.
|
||||
CcShowInstancesQuery::create()
|
||||
->filterByPrimaryKeys($showInstances)
|
||||
->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
|
||||
|
||||
$this->con->commit();
|
||||
|
||||
Application_Model_RabbitMq::PushSchedule();
|
||||
|
@ -328,11 +398,15 @@ class Application_Model_Scheduler {
|
|||
* @param array $exclude
|
||||
* ids of sched items to remove from the calulation.
|
||||
*/
|
||||
public function removeGaps($showInstance, $exclude=null) {
|
||||
private function removeGaps($showInstance, $exclude=null) {
|
||||
|
||||
Logging::log("removing gaps from show instance #".$showInstance);
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
|
||||
if (is_null($instance)) {
|
||||
throw new OutDatedScheduleException("The schedule you're viewing is out of date!");
|
||||
}
|
||||
|
||||
$itemStartDT = $instance->getDbStarts(null);
|
||||
|
||||
$schedule = CcScheduleQuery::create()
|
||||
|
@ -355,4 +429,6 @@ class Application_Model_Scheduler {
|
|||
$itemStartDT = $itemEndDT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OutDatedScheduleException extends Exception {}
|
|
@ -6,6 +6,7 @@ class Application_Model_ShowBuilder {
|
|||
private $startDT;
|
||||
private $endDT;
|
||||
private $user;
|
||||
private $opts;
|
||||
|
||||
private $contentDT;
|
||||
|
||||
|
@ -21,19 +22,21 @@ class Application_Model_ShowBuilder {
|
|||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
"album" => ""
|
||||
"album" => "",
|
||||
"timestamp" => null
|
||||
);
|
||||
|
||||
/*
|
||||
* @param DateTime $p_startsDT
|
||||
* @param DateTime $p_endsDT
|
||||
*/
|
||||
public function __construct($p_startDT, $p_endDT) {
|
||||
public function __construct($p_startDT, $p_endDT, $p_opts) {
|
||||
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
$this->opts = $p_opts;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -98,9 +101,22 @@ class Application_Model_ShowBuilder {
|
|||
return $row;
|
||||
}
|
||||
|
||||
private function getRowTimestamp($p_item, &$row) {
|
||||
|
||||
if (is_null($p_item["si_last_scheduled"])) {
|
||||
$ts = 0;
|
||||
}
|
||||
else {
|
||||
$dt = new DateTime($p_item["si_last_scheduled"], new DateTimeZone("UTC"));
|
||||
$ts = intval($dt->format("U"));
|
||||
}
|
||||
$row["timestamp"] = $ts;
|
||||
}
|
||||
|
||||
private function makeHeaderRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$this->getRowTimestamp($p_item, &$row);
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
|
@ -124,6 +140,7 @@ class Application_Model_ShowBuilder {
|
|||
$epoch_now = time();
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$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) {
|
||||
|
@ -165,7 +182,23 @@ class Application_Model_ShowBuilder {
|
|||
$current_id = -1;
|
||||
$display_items = array();
|
||||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"));
|
||||
$shows = array();
|
||||
if ($this->opts["myShows"] === 1) {
|
||||
|
||||
$host_shows = CcShowHostsQuery::create()
|
||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||
->filterByDbHost($this->user->getId())
|
||||
->find();
|
||||
|
||||
foreach ($host_shows as $host_show) {
|
||||
$shows[] = $host_show->getDbShow();
|
||||
}
|
||||
}
|
||||
else if ($this->opts["showFilter"] !== 0) {
|
||||
$shows[] = $this->opts["showFilter"];
|
||||
}
|
||||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"), $shows);
|
||||
|
||||
for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) {
|
||||
|
||||
|
|
|
@ -556,7 +556,7 @@ class Application_Model_StoredFile {
|
|||
*
|
||||
* @return string $runtime
|
||||
*/
|
||||
private static function formatDuration($dt){
|
||||
private static function formatDuration($dt) {
|
||||
|
||||
$hours = $dt->format("H");
|
||||
$min = $dt->format("i");
|
||||
|
@ -569,7 +569,7 @@ class Application_Model_StoredFile {
|
|||
$hours = $p_interval->format("%h");
|
||||
$mins = $p_interval->format("%i");
|
||||
|
||||
if( $hours == 0) {
|
||||
if ( $hours == 0) {
|
||||
$runtime = $p_interval->format("%i:%S");
|
||||
}
|
||||
else {
|
||||
|
@ -579,8 +579,7 @@ class Application_Model_StoredFile {
|
|||
return $runtime;
|
||||
}
|
||||
|
||||
public static function searchFilesForPlaylistBuilder($datatables)
|
||||
{
|
||||
public static function searchFilesForPlaylistBuilder($datatables) {
|
||||
global $CC_CONFIG;
|
||||
|
||||
$displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype", "track_number");
|
||||
|
@ -610,9 +609,6 @@ class Application_Model_StoredFile {
|
|||
} 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.", ";
|
||||
|
@ -624,11 +620,11 @@ class Application_Model_StoredFile {
|
|||
UNION
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
|
||||
|
||||
foreach ($results['aaData'] as &$row) {
|
||||
|
||||
|
||||
foreach($results['aaData'] as &$row){
|
||||
|
||||
$row['id'] = intval($row['id']);
|
||||
|
||||
//$length = new DateTime($row['length']);
|
||||
|
@ -649,7 +645,7 @@ class Application_Model_StoredFile {
|
|||
//TODO url like this to work on both playlist/showbuilder screens.
|
||||
//datatable stuff really needs to be pulled out and generalized within the project
|
||||
//access to zend view methods to access url helpers is needed.
|
||||
if($type == "au") {
|
||||
if ($type == "au") {
|
||||
$row['image'] = '<img src="/css/images/icon_audioclip.png">';
|
||||
}
|
||||
else {
|
||||
|
@ -738,7 +734,7 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
//display sql executed in airtime log for testing
|
||||
//Logging::log($sql);
|
||||
Logging::log($sql);
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
|
||||
|
@ -852,18 +848,19 @@ class Application_Model_StoredFile {
|
|||
* enough space to move the $audio_file into and report back to the user if not.
|
||||
**/
|
||||
public static function checkForEnoughDiskSpaceToCopy($destination_folder, $audio_file){
|
||||
//check to see if we have enough space in the /organize directory to copy the file
|
||||
$freeSpace = disk_free_space($destination_folder);
|
||||
$fileSize = filesize($audio_file);
|
||||
|
||||
if ( $freeSpace < $fileSize){
|
||||
$freeSpace = ceil($freeSpace/1024/1024);
|
||||
$fileSize = ceil($fileSize/1024/1024);
|
||||
$result = array("code" => 107, "message" => "The file was not uploaded, there is ".$freeSpace."MB of disk space left and the file you are uploading has a size of ".$fileSize."MB.");
|
||||
}
|
||||
return $result;
|
||||
//check to see if we have enough space in the /organize directory to copy the file
|
||||
$freeSpace = disk_free_space($destination_folder);
|
||||
$fileSize = filesize($audio_file);
|
||||
|
||||
if ( $freeSpace < $fileSize){
|
||||
$freeSpace = ceil($freeSpace/1024/1024);
|
||||
$fileSize = ceil($fileSize/1024/1024);
|
||||
$result = array("code" => 107, "message" => "The file was not uploaded, there is ".$freeSpace."MB of disk space left and the file you are uploading has a size of ".$fileSize."MB.");
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public static function copyFileToStor($p_targetDir, $fileName, $tempname){
|
||||
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $tempname;
|
||||
Logging::log('copyFileToStor: moving file '.$audio_file);
|
||||
|
@ -878,36 +875,34 @@ class Application_Model_StoredFile {
|
|||
$result = array( "code" => 106, "message" => "An identical audioclip named '$duplicateName' already exists on the server.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($result)){//The file has no duplicate, so procceed to copy.
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$stor = $storDir->getDirectory();
|
||||
|
||||
//check to see if there is enough space in $stor to continue.
|
||||
$result = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||
if (!isset($result)){//if result not set then there's enough disk space to copy the file over
|
||||
$stor .= "/organize";
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
||||
if ($r === false) {
|
||||
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
||||
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||
unlink($audio_file);//remove the file from the organize after failed rename
|
||||
$result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space.");
|
||||
|
||||
}
|
||||
|
||||
if (!isset($result)){//The file has no duplicate, so procceed to copy.
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$stor = $storDir->getDirectory();
|
||||
|
||||
//check to see if there is enough space in $stor to continue.
|
||||
$result = Application_Model_StoredFile::checkForEnoughDiskSpaceToCopy($stor, $audio_file);
|
||||
if (!isset($result)){//if result not set then there's enough disk space to copy the file over
|
||||
$stor .= "/organize";
|
||||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
||||
if ($r === false) {
|
||||
#something went wrong likely there wasn't enough space in the audio_stor to move the file too.
|
||||
#warn the user that the file wasn't uploaded and they should check if there is enough disk space.
|
||||
unlink($audio_file);//remove the file from the organize after failed rename
|
||||
$result = array("code" => 108, "message" => "The file was not uploaded, this error will occur if the computer hard drive does not have enough disk space.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
//$r = @copy($audio_file, $audio_stor);
|
||||
//$r = @unlink($audio_file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function getFileCount()
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
@ -1038,3 +1033,4 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
class DeleteScheduledFileException extends Exception {}
|
||||
class FileDoesNotExistException extends Exception {}
|
||||
|
|
|
@ -76,4 +76,35 @@ class CcShowInstances extends BaseCcShowInstances {
|
|||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [last_scheduled] column value.
|
||||
*
|
||||
*
|
||||
* @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 getDbLastScheduled($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->last_scheduled === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->last_scheduled, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, 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);
|
||||
}
|
||||
}
|
||||
} // CcShowInstances
|
||||
|
|
|
@ -46,7 +46,8 @@ class CcShowInstancesTableMap extends TableMap {
|
|||
$this->addColumn('REBROADCAST', 'DbRebroadcast', 'TINYINT', false, null, 0);
|
||||
$this->addForeignKey('INSTANCE_ID', 'DbOriginalShow', 'INTEGER', 'cc_show_instances', 'ID', false, null, null);
|
||||
$this->addForeignKey('FILE_ID', 'DbRecordedFile', 'INTEGER', 'cc_files', 'ID', false, null, null);
|
||||
$this->addColumn('TIME_FILLED', 'DbTimeFilled', 'TIME', false, null, null);
|
||||
$this->addColumn('TIME_FILLED', 'DbTimeFilled', 'VARCHAR', false, null, '00:00:00');
|
||||
$this->addColumn('LAST_SCHEDULED', 'DbLastScheduled', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('MODIFIED_INSTANCE', 'DbModifiedInstance', 'BOOLEAN', true, null, false);
|
||||
// validators
|
||||
} // initialize()
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/**
|
||||
* Base class that represents a row from the 'cc_playlistcontents' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
|
@ -137,7 +137,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [id] column value.
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbId()
|
||||
|
@ -147,7 +147,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [playlist_id] column value.
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbPlaylistId()
|
||||
|
@ -157,7 +157,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [file_id] column value.
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbFileId()
|
||||
|
@ -167,7 +167,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [position] column value.
|
||||
*
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbPosition()
|
||||
|
@ -177,7 +177,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [cliplength] column value.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
|
@ -210,7 +210,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [cuein] column value.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
|
@ -243,7 +243,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [cueout] column value.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
|
@ -276,7 +276,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [fadein] column value.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
|
@ -289,6 +289,8 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->fadein);
|
||||
} catch (Exception $x) {
|
||||
|
@ -307,7 +309,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [fadeout] column value.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
|
@ -340,7 +342,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
*/
|
||||
|
@ -360,7 +362,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Set the value of [playlist_id] column.
|
||||
*
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
*/
|
||||
|
@ -384,7 +386,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Set the value of [file_id] column.
|
||||
*
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
*/
|
||||
|
@ -408,7 +410,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Set the value of [position] column.
|
||||
*
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
*/
|
||||
|
@ -428,7 +430,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Sets the value of [cliplength] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
|
@ -464,7 +466,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
|
||||
)
|
||||
{
|
||||
|
@ -478,7 +480,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Sets the value of [cuein] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
|
@ -514,7 +516,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
|
||||
)
|
||||
{
|
||||
|
@ -528,7 +530,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Sets the value of [cueout] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
|
@ -564,7 +566,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
|
||||
)
|
||||
{
|
||||
|
@ -578,7 +580,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Sets the value of [fadein] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
|
@ -614,7 +616,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$currNorm = ($this->fadein !== null && $tmpDt = new DateTime($this->fadein)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
|
||||
)
|
||||
{
|
||||
|
@ -628,7 +630,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* Sets the value of [fadeout] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcPlaylistcontents The current object (for fluent API support)
|
||||
|
@ -664,7 +666,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$currNorm = ($this->fadeout !== null && $tmpDt = new DateTime($this->fadeout)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
|| ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
|
||||
)
|
||||
{
|
||||
|
@ -836,7 +838,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
if ($con === null) {
|
||||
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
}
|
||||
|
||||
|
||||
$con->beginTransaction();
|
||||
try {
|
||||
$ret = $this->preDelete($con);
|
||||
|
@ -878,7 +880,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
if ($con === null) {
|
||||
$con = Propel::getConnection(CcPlaylistcontentsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
}
|
||||
|
||||
|
||||
$con->beginTransaction();
|
||||
$isInsert = $this->isNew();
|
||||
try {
|
||||
|
@ -1131,7 +1133,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
* type constants.
|
||||
*
|
||||
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
|
||||
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
|
||||
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
|
||||
* Defaults to BasePeer::TYPE_PHPNAME.
|
||||
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
|
||||
* @param boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
|
||||
|
@ -1526,7 +1528,7 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
|
||||
|
||||
/**
|
||||
* Update the aggregate column in the related CcPlaylist object
|
||||
*
|
||||
|
|
|
@ -76,10 +76,17 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* The value for the time_filled field.
|
||||
* Note: this column has a database default value of: '00:00:00'
|
||||
* @var string
|
||||
*/
|
||||
protected $time_filled;
|
||||
|
||||
/**
|
||||
* The value for the last_scheduled field.
|
||||
* @var string
|
||||
*/
|
||||
protected $last_scheduled;
|
||||
|
||||
/**
|
||||
* The value for the modified_instance field.
|
||||
* Note: this column has a database default value of: false
|
||||
|
@ -136,6 +143,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
{
|
||||
$this->record = 0;
|
||||
$this->rebroadcast = 0;
|
||||
$this->time_filled = '00:00:00';
|
||||
$this->modified_instance = false;
|
||||
}
|
||||
|
||||
|
@ -276,7 +284,17 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [time_filled] column value.
|
||||
* Get the [time_filled] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbTimeFilled()
|
||||
{
|
||||
return $this->time_filled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [last_scheduled] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
|
@ -284,18 +302,18 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
* @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 getDbTimeFilled($format = '%X')
|
||||
public function getDbLastScheduled($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->time_filled === null) {
|
||||
if ($this->last_scheduled === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->time_filled);
|
||||
$dt = new DateTime($this->last_scheduled);
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->time_filled, true), $x);
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
|
@ -549,13 +567,33 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
} // setDbRecordedFile()
|
||||
|
||||
/**
|
||||
* Sets the value of [time_filled] column to a normalized version of the date/time value specified.
|
||||
* Set the value of [time_filled] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcShowInstances The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbTimeFilled($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->time_filled !== $v || $this->isNew()) {
|
||||
$this->time_filled = $v;
|
||||
$this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbTimeFilled()
|
||||
|
||||
/**
|
||||
* Sets the value of [last_scheduled] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
|
||||
* be treated as NULL for temporal objects.
|
||||
* @return CcShowInstances The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbTimeFilled($v)
|
||||
public function setDbLastScheduled($v)
|
||||
{
|
||||
// we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
|
||||
// -- which is unexpected, to say the least.
|
||||
|
@ -580,22 +618,22 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
}
|
||||
}
|
||||
|
||||
if ( $this->time_filled !== null || $dt !== null ) {
|
||||
if ( $this->last_scheduled !== null || $dt !== null ) {
|
||||
// (nested ifs are a little easier to read in this case)
|
||||
|
||||
$currNorm = ($this->time_filled !== null && $tmpDt = new DateTime($this->time_filled)) ? $tmpDt->format('H:i:s') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
|
||||
$currNorm = ($this->last_scheduled !== null && $tmpDt = new DateTime($this->last_scheduled)) ? $tmpDt->format('Y-m-d\\TH:i:sO') : null;
|
||||
$newNorm = ($dt !== null) ? $dt->format('Y-m-d\\TH:i:sO') : null;
|
||||
|
||||
if ( ($currNorm !== $newNorm) // normalized values don't match
|
||||
)
|
||||
{
|
||||
$this->time_filled = ($dt ? $dt->format('H:i:s') : null);
|
||||
$this->modifiedColumns[] = CcShowInstancesPeer::TIME_FILLED;
|
||||
$this->last_scheduled = ($dt ? $dt->format('Y-m-d\\TH:i:sO') : null);
|
||||
$this->modifiedColumns[] = CcShowInstancesPeer::LAST_SCHEDULED;
|
||||
}
|
||||
} // if either are not null
|
||||
|
||||
return $this;
|
||||
} // setDbTimeFilled()
|
||||
} // setDbLastScheduled()
|
||||
|
||||
/**
|
||||
* Set the value of [modified_instance] column.
|
||||
|
@ -635,6 +673,10 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->time_filled !== '00:00:00') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->modified_instance !== false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -670,7 +712,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->instance_id = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
|
||||
$this->file_id = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
|
||||
$this->time_filled = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||
$this->modified_instance = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
|
||||
$this->last_scheduled = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||
$this->modified_instance = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -679,7 +722,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 11; // 11 = CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcShowInstances object", $e);
|
||||
|
@ -1104,6 +1147,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
return $this->getDbTimeFilled();
|
||||
break;
|
||||
case 9:
|
||||
return $this->getDbLastScheduled();
|
||||
break;
|
||||
case 10:
|
||||
return $this->getDbModifiedInstance();
|
||||
break;
|
||||
default:
|
||||
|
@ -1139,7 +1185,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$keys[6] => $this->getDbOriginalShow(),
|
||||
$keys[7] => $this->getDbRecordedFile(),
|
||||
$keys[8] => $this->getDbTimeFilled(),
|
||||
$keys[9] => $this->getDbModifiedInstance(),
|
||||
$keys[9] => $this->getDbLastScheduled(),
|
||||
$keys[10] => $this->getDbModifiedInstance(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcShow) {
|
||||
|
@ -1210,6 +1257,9 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->setDbTimeFilled($value);
|
||||
break;
|
||||
case 9:
|
||||
$this->setDbLastScheduled($value);
|
||||
break;
|
||||
case 10:
|
||||
$this->setDbModifiedInstance($value);
|
||||
break;
|
||||
} // switch()
|
||||
|
@ -1245,7 +1295,8 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
if (array_key_exists($keys[6], $arr)) $this->setDbOriginalShow($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setDbRecordedFile($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setDbTimeFilled($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbModifiedInstance($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbLastScheduled($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[10], $arr)) $this->setDbModifiedInstance($arr[$keys[10]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1266,6 +1317,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
if ($this->isColumnModified(CcShowInstancesPeer::INSTANCE_ID)) $criteria->add(CcShowInstancesPeer::INSTANCE_ID, $this->instance_id);
|
||||
if ($this->isColumnModified(CcShowInstancesPeer::FILE_ID)) $criteria->add(CcShowInstancesPeer::FILE_ID, $this->file_id);
|
||||
if ($this->isColumnModified(CcShowInstancesPeer::TIME_FILLED)) $criteria->add(CcShowInstancesPeer::TIME_FILLED, $this->time_filled);
|
||||
if ($this->isColumnModified(CcShowInstancesPeer::LAST_SCHEDULED)) $criteria->add(CcShowInstancesPeer::LAST_SCHEDULED, $this->last_scheduled);
|
||||
if ($this->isColumnModified(CcShowInstancesPeer::MODIFIED_INSTANCE)) $criteria->add(CcShowInstancesPeer::MODIFIED_INSTANCE, $this->modified_instance);
|
||||
|
||||
return $criteria;
|
||||
|
@ -1336,6 +1388,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$copyObj->setDbOriginalShow($this->instance_id);
|
||||
$copyObj->setDbRecordedFile($this->file_id);
|
||||
$copyObj->setDbTimeFilled($this->time_filled);
|
||||
$copyObj->setDbLastScheduled($this->last_scheduled);
|
||||
$copyObj->setDbModifiedInstance($this->modified_instance);
|
||||
|
||||
if ($deepCopy) {
|
||||
|
@ -1854,6 +1907,7 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
|
|||
$this->instance_id = null;
|
||||
$this->file_id = null;
|
||||
$this->time_filled = null;
|
||||
$this->last_scheduled = null;
|
||||
$this->modified_instance = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcShowInstancesPeer {
|
|||
const TM_CLASS = 'CcShowInstancesTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 11;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -58,6 +58,9 @@ abstract class BaseCcShowInstancesPeer {
|
|||
/** the column name for the TIME_FILLED field */
|
||||
const TIME_FILLED = 'cc_show_instances.TIME_FILLED';
|
||||
|
||||
/** the column name for the LAST_SCHEDULED field */
|
||||
const LAST_SCHEDULED = 'cc_show_instances.LAST_SCHEDULED';
|
||||
|
||||
/** the column name for the MODIFIED_INSTANCE field */
|
||||
const MODIFIED_INSTANCE = 'cc_show_instances.MODIFIED_INSTANCE';
|
||||
|
||||
|
@ -77,12 +80,12 @@ abstract class BaseCcShowInstancesPeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbModifiedInstance', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbModifiedInstance', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, self::MODIFIED_INSTANCE, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'MODIFIED_INSTANCE', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'modified_instance', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbShowId', 'DbRecord', 'DbRebroadcast', 'DbOriginalShow', 'DbRecordedFile', 'DbTimeFilled', 'DbLastScheduled', 'DbModifiedInstance', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbShowId', 'dbRecord', 'dbRebroadcast', 'dbOriginalShow', 'dbRecordedFile', 'dbTimeFilled', 'dbLastScheduled', 'dbModifiedInstance', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::SHOW_ID, self::RECORD, self::REBROADCAST, self::INSTANCE_ID, self::FILE_ID, self::TIME_FILLED, self::LAST_SCHEDULED, self::MODIFIED_INSTANCE, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'SHOW_ID', 'RECORD', 'REBROADCAST', 'INSTANCE_ID', 'FILE_ID', 'TIME_FILLED', 'LAST_SCHEDULED', 'MODIFIED_INSTANCE', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'show_id', 'record', 'rebroadcast', 'instance_id', 'file_id', 'time_filled', 'last_scheduled', 'modified_instance', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -92,12 +95,12 @@ abstract class BaseCcShowInstancesPeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbModifiedInstance' => 9, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbModifiedInstance' => 9, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, self::MODIFIED_INSTANCE => 9, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, 'MODIFIED_INSTANCE' => 9, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, 'modified_instance' => 9, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbShowId' => 3, 'DbRecord' => 4, 'DbRebroadcast' => 5, 'DbOriginalShow' => 6, 'DbRecordedFile' => 7, 'DbTimeFilled' => 8, 'DbLastScheduled' => 9, 'DbModifiedInstance' => 10, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbShowId' => 3, 'dbRecord' => 4, 'dbRebroadcast' => 5, 'dbOriginalShow' => 6, 'dbRecordedFile' => 7, 'dbTimeFilled' => 8, 'dbLastScheduled' => 9, 'dbModifiedInstance' => 10, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::SHOW_ID => 3, self::RECORD => 4, self::REBROADCAST => 5, self::INSTANCE_ID => 6, self::FILE_ID => 7, self::TIME_FILLED => 8, self::LAST_SCHEDULED => 9, self::MODIFIED_INSTANCE => 10, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'SHOW_ID' => 3, 'RECORD' => 4, 'REBROADCAST' => 5, 'INSTANCE_ID' => 6, 'FILE_ID' => 7, 'TIME_FILLED' => 8, 'LAST_SCHEDULED' => 9, 'MODIFIED_INSTANCE' => 10, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'show_id' => 3, 'record' => 4, 'rebroadcast' => 5, 'instance_id' => 6, 'file_id' => 7, 'time_filled' => 8, 'last_scheduled' => 9, 'modified_instance' => 10, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -178,6 +181,7 @@ abstract class BaseCcShowInstancesPeer {
|
|||
$criteria->addSelectColumn(CcShowInstancesPeer::INSTANCE_ID);
|
||||
$criteria->addSelectColumn(CcShowInstancesPeer::FILE_ID);
|
||||
$criteria->addSelectColumn(CcShowInstancesPeer::TIME_FILLED);
|
||||
$criteria->addSelectColumn(CcShowInstancesPeer::LAST_SCHEDULED);
|
||||
$criteria->addSelectColumn(CcShowInstancesPeer::MODIFIED_INSTANCE);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
|
@ -189,6 +193,7 @@ abstract class BaseCcShowInstancesPeer {
|
|||
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
|
||||
$criteria->addSelectColumn($alias . '.FILE_ID');
|
||||
$criteria->addSelectColumn($alias . '.TIME_FILLED');
|
||||
$criteria->addSelectColumn($alias . '.LAST_SCHEDULED');
|
||||
$criteria->addSelectColumn($alias . '.MODIFIED_INSTANCE');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* @method CcShowInstancesQuery orderByDbOriginalShow($order = Criteria::ASC) Order by the instance_id column
|
||||
* @method CcShowInstancesQuery orderByDbRecordedFile($order = Criteria::ASC) Order by the file_id column
|
||||
* @method CcShowInstancesQuery orderByDbTimeFilled($order = Criteria::ASC) Order by the time_filled column
|
||||
* @method CcShowInstancesQuery orderByDbLastScheduled($order = Criteria::ASC) Order by the last_scheduled column
|
||||
* @method CcShowInstancesQuery orderByDbModifiedInstance($order = Criteria::ASC) Order by the modified_instance column
|
||||
*
|
||||
* @method CcShowInstancesQuery groupByDbId() Group by the id column
|
||||
|
@ -26,6 +27,7 @@
|
|||
* @method CcShowInstancesQuery groupByDbOriginalShow() Group by the instance_id column
|
||||
* @method CcShowInstancesQuery groupByDbRecordedFile() Group by the file_id column
|
||||
* @method CcShowInstancesQuery groupByDbTimeFilled() Group by the time_filled column
|
||||
* @method CcShowInstancesQuery groupByDbLastScheduled() Group by the last_scheduled column
|
||||
* @method CcShowInstancesQuery groupByDbModifiedInstance() Group by the modified_instance column
|
||||
*
|
||||
* @method CcShowInstancesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
|
@ -64,6 +66,7 @@
|
|||
* @method CcShowInstances findOneByDbOriginalShow(int $instance_id) Return the first CcShowInstances filtered by the instance_id column
|
||||
* @method CcShowInstances findOneByDbRecordedFile(int $file_id) Return the first CcShowInstances filtered by the file_id column
|
||||
* @method CcShowInstances findOneByDbTimeFilled(string $time_filled) Return the first CcShowInstances filtered by the time_filled column
|
||||
* @method CcShowInstances findOneByDbLastScheduled(string $last_scheduled) Return the first CcShowInstances filtered by the last_scheduled column
|
||||
* @method CcShowInstances findOneByDbModifiedInstance(boolean $modified_instance) Return the first CcShowInstances filtered by the modified_instance column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcShowInstances objects filtered by the id column
|
||||
|
@ -75,6 +78,7 @@
|
|||
* @method array findByDbOriginalShow(int $instance_id) Return CcShowInstances objects filtered by the instance_id column
|
||||
* @method array findByDbRecordedFile(int $file_id) Return CcShowInstances objects filtered by the file_id column
|
||||
* @method array findByDbTimeFilled(string $time_filled) Return CcShowInstances objects filtered by the time_filled column
|
||||
* @method array findByDbLastScheduled(string $last_scheduled) Return CcShowInstances objects filtered by the last_scheduled column
|
||||
* @method array findByDbModifiedInstance(boolean $modified_instance) Return CcShowInstances objects filtered by the modified_instance column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
|
@ -422,22 +426,44 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
|
|||
/**
|
||||
* Filter the query on the time_filled column
|
||||
*
|
||||
* @param string|array $dbTimeFilled The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $dbTimeFilled The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcShowInstancesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbTimeFilled($dbTimeFilled = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbTimeFilled)) {
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbTimeFilled)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbTimeFilled)) {
|
||||
$dbTimeFilled = str_replace('*', '%', $dbTimeFilled);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the last_scheduled column
|
||||
*
|
||||
* @param string|array $dbLastScheduled 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 CcShowInstancesQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbLastScheduled($dbLastScheduled = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbLastScheduled)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbTimeFilled['min'])) {
|
||||
$this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['min'], Criteria::GREATER_EQUAL);
|
||||
if (isset($dbLastScheduled['min'])) {
|
||||
$this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbTimeFilled['max'])) {
|
||||
$this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled['max'], Criteria::LESS_EQUAL);
|
||||
if (isset($dbLastScheduled['max'])) {
|
||||
$this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
|
@ -447,7 +473,7 @@ abstract class BaseCcShowInstancesQuery extends ModelCriteria
|
|||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcShowInstancesPeer::TIME_FILLED, $dbTimeFilled, $comparison);
|
||||
return $this->addUsingAlias(CcShowInstancesPeer::LAST_SCHEDULED, $dbLastScheduled, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<div class="sb-timerange">
|
||||
<?php echo $this->element->getElement('sb_date_start') ?>
|
||||
<?php echo $this->element->getElement('sb_time_start') ?>
|
||||
<?php echo $this->element->getElement('sb_date_end') ?>
|
||||
<?php echo $this->element->getElement('sb_time_end') ?>
|
||||
<input type="button" id="sb_submit" class="ui-button ui-state-default" value="GO"></input>
|
||||
</div>
|
||||
<div class="sb-advanced-options">
|
||||
<label><?php echo $this->element->getElement('sb_show_filter')->getLabel() ?></label>
|
||||
<?php echo $this->element->getElement('sb_show_filter') ?>
|
||||
|
||||
<?php if ($this->element->getElement('sb_my_shows')):?>
|
||||
<label><?php echo $this->element->getElement('sb_my_shows')->getLabel(); ?></label>
|
||||
<?php echo $this->element->getElement('sb_my_shows'); ?>
|
||||
<?php endif;?>
|
||||
</div>
|
|
@ -3,7 +3,5 @@
|
|||
</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>
|
||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,2 @@
|
|||
<input type="text" id="show_builder_datepicker_start" class="input_text" value="<?php echo $this->start_date?>"></input>
|
||||
<input type="text" id="show_builder_timepicker_start" class="input_text" value="<?php echo $this->start_time?>"></input>
|
||||
<input type="text" id="show_builder_datepicker_end" class="input_text" value="<?php echo $this->end_date?>"></input>
|
||||
<input type="text" id="show_builder_timepicker_end" class="input_text" value="<?php echo $this->end_time?>"></input>
|
||||
<input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input>
|
||||
<?php echo $this->sb_form; ?>
|
||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
|
|
|
@ -156,7 +156,8 @@
|
|||
<column name="rebroadcast" phpName="DbRebroadcast" type="TINYINT" required="false" defaultValue="0"/>
|
||||
<column name="instance_id" phpName="DbOriginalShow" type="INTEGER" required="false"/>
|
||||
<column name="file_id" phpName="DbRecordedFile" type="INTEGER" required="false"/>
|
||||
<column name="time_filled" phpName="DbTimeFilled" type="TIME" />
|
||||
<column name="time_filled" phpName="DbTimeFilled" type="VARCHAR" sqlType="interval" defaultValue="00:00:00" />
|
||||
<column name="last_scheduled" phpName="DbLastScheduled" type="TIMESTAMP" required="false"/>
|
||||
<!-- The purpose of the modified_instance column is to mark a show instance that was
|
||||
deleted when it was part of repeating show. This is useful because the way shows work,
|
||||
instances can be regenerated if we edit the show, which is unwanted behaviour. This column serves
|
||||
|
|
|
@ -202,7 +202,8 @@ CREATE TABLE "cc_show_instances"
|
|||
"rebroadcast" INT2 default 0,
|
||||
"instance_id" INTEGER,
|
||||
"file_id" INTEGER,
|
||||
"time_filled" TIME,
|
||||
"time_filled" interval default '00:00:00',
|
||||
"last_scheduled" TIMESTAMP,
|
||||
"modified_instance" BOOLEAN default 'f' NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
@CHARSET "UTF-8";
|
||||
|
||||
#show_builder > input.input_text {
|
||||
#show_builder input.input_text {
|
||||
width:100px;
|
||||
}
|
||||
}
|
||||
|
||||
#show_builder span.ui-icon-triangle-1-e {
|
||||
float: left;
|
||||
position: relative;
|
||||
left: -20px;
|
||||
top: 15px;
|
||||
}
|
||||
|
|
|
@ -19,20 +19,15 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.fnDrawCallback = function() {
|
||||
|
||||
$('#library_display tr[id ^= "au"]').draggable({
|
||||
helper: 'clone',
|
||||
/* customize the helper on dragging to look like a pl item
|
||||
*
|
||||
helper: function(ev) {
|
||||
var data, li;
|
||||
|
||||
data = $(ev.currentTarget).data("aData");
|
||||
|
||||
li = $("<li></li>");
|
||||
li.append(data.track_title);
|
||||
|
||||
return li;
|
||||
},
|
||||
*/
|
||||
helper: function(){
|
||||
var selected = $('#library_display input:checked').parents('tr[id^="au"]');
|
||||
if (selected.length === 0) {
|
||||
selected = $(this);
|
||||
}
|
||||
var container = $('<div/>').attr('id', 'draggingContainer');
|
||||
container.append(selected.clone());
|
||||
return container;
|
||||
},
|
||||
cursor: 'pointer',
|
||||
connectToSortable: '#spl_sortable'
|
||||
});
|
||||
|
|
|
@ -19,7 +19,15 @@ var AIRTIME = (function(AIRTIME){
|
|||
mod.fnDrawCallback = function() {
|
||||
|
||||
$('#library_display tr:not(:first)').draggable({
|
||||
helper: 'clone',
|
||||
helper: function(){
|
||||
var selected = $('#library_display input:checked').parents('tr');
|
||||
if (selected.length === 0) {
|
||||
selected = $(this);
|
||||
}
|
||||
var container = $('<div/>').attr('id', 'draggingContainer');
|
||||
container.append(selected.clone());
|
||||
return container;
|
||||
},
|
||||
cursor: 'pointer',
|
||||
connectToSortable: '#show_builder_table'
|
||||
});
|
||||
|
@ -31,18 +39,13 @@ var AIRTIME = (function(AIRTIME){
|
|||
fnResetCol,
|
||||
fnAddSelectedItems,
|
||||
|
||||
fnTest = function() {
|
||||
alert("hi");
|
||||
};
|
||||
|
||||
fnResetCol = function () {
|
||||
ColReorder.fnReset( oLibTable );
|
||||
return false;
|
||||
};
|
||||
|
||||
fnAddSelectedItems = function() {
|
||||
var oSchedTable = $("#show_builder_table").dataTable(),
|
||||
oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
var oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
oSchedTT = TableTools.fnGetInstance('show_builder_table'),
|
||||
aData = oLibTT.fnGetSelectedData(),
|
||||
item,
|
||||
|
@ -64,16 +67,12 @@ var AIRTIME = (function(AIRTIME){
|
|||
for (item in aData) {
|
||||
temp = aData[item];
|
||||
if (temp !== null && temp.hasOwnProperty('id')) {
|
||||
aSchedIds.push({"id": temp.id, "instance": temp.instance});
|
||||
aSchedIds.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
||||
}
|
||||
}
|
||||
|
||||
$.post("/showbuilder/schedule-add",
|
||||
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
|
||||
function(json){
|
||||
oLibTT.fnSelectNone();
|
||||
oSchedTable.fnDraw();
|
||||
});
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
|
||||
};
|
||||
//[0] = button text
|
||||
//[1] = id
|
||||
|
|
|
@ -211,107 +211,139 @@ function addQtipToSCIcons(){
|
|||
});
|
||||
}
|
||||
|
||||
function fnCreatedRow( 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();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
$(document).ready(function() {
|
||||
var oTable;
|
||||
|
||||
$('.tabs').tabs();
|
||||
|
||||
oTable = $('#library_display').dataTable( {
|
||||
"bProcessing": true,
|
||||
"bServerSide": true,
|
||||
|
||||
"bStateSave": true,
|
||||
|
||||
"fnStateSaveParams": function (oSettings, oData) {
|
||||
oData.oSearch.sSearch = "";
|
||||
},
|
||||
"fnStateSave": function (oSettings, oData) {
|
||||
|
||||
$.ajax({
|
||||
url: "/preference/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: "/preference/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;
|
||||
|
||||
//datatables needs boolean type to work properly.
|
||||
for (i = 0, length = oData.abVisCols.length; i < length; i++) {
|
||||
a[i] = (a[i] === "true") ? true : false;
|
||||
}
|
||||
},
|
||||
|
||||
"sAjaxSource": "/Library/contents",
|
||||
"fnServerData": function ( sSource, aoData, testCallback ) {
|
||||
"fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
aoData.push( { name: "format", value: "json"} );
|
||||
$.ajax( {
|
||||
"dataType": 'json',
|
||||
"type": "GET",
|
||||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": testCallback
|
||||
"success": fnCallback
|
||||
} );
|
||||
},
|
||||
"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,
|
||||
"fnHeaderCallback": function(nHead) {
|
||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||
},
|
||||
|
||||
"aoColumns": [
|
||||
/* 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"}
|
||||
],
|
||||
/* 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_number", "bSearchable": false, "bVisible": false, "mDataProp": "track_number", "sClass": "library_track"}
|
||||
],
|
||||
"aaSorting": [[2,'asc']],
|
||||
"sPaginationType": "full_numbers",
|
||||
"bJQueryUI": true,
|
||||
|
@ -319,8 +351,7 @@ function createDataTable(data) {
|
|||
"oLanguage": {
|
||||
"sSearch": ""
|
||||
},
|
||||
"iDisplayLength": getNumEntriesPreference(data),
|
||||
|
||||
|
||||
// R = ColReorder, C = ColVis, T = TableTools
|
||||
"sDom": 'Rlfr<"H"T<"library_toolbar"C>>t<"F"ip>',
|
||||
|
||||
|
@ -353,8 +384,7 @@ function createDataTable(data) {
|
|||
"buttonText": "Show/Hide Columns",
|
||||
"sAlign": "right",
|
||||
"aiExclude": [0, 1],
|
||||
"sSize": "css",
|
||||
"bShowAll": true
|
||||
"sSize": "css"
|
||||
},
|
||||
|
||||
"oColReorder": {
|
||||
|
@ -377,13 +407,6 @@ function createDataTable(data) {
|
|||
oTT.fnSelectNone();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.tabs').tabs();
|
||||
|
||||
$.ajax({url: "/Api/library-init/format/json", dataType:"json", success:createDataTable,
|
||||
error:function(jqXHR, textStatus, errorThrown){}});
|
||||
|
||||
checkImportStatus();
|
||||
setInterval( checkImportStatus, 5000 );
|
||||
|
|
|
@ -19,6 +19,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
return regExpr.test(fade);
|
||||
}
|
||||
|
||||
function playlistError(json) {
|
||||
alert(json.error);
|
||||
openPlaylist(json);
|
||||
}
|
||||
|
||||
function stopAudioPreview() {
|
||||
// stop any preview playing
|
||||
|
@ -51,130 +55,151 @@ var AIRTIME = (function(AIRTIME){
|
|||
function changeCueIn(event) {
|
||||
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);
|
||||
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)){
|
||||
if (!isTimeValid(cueIn)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
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) {
|
||||
showError(span, json.response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find(".cue-edit").toggle();
|
||||
highlightActive(li);
|
||||
highlightActive(li.find('.spl_cue'));
|
||||
});
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
return;
|
||||
}
|
||||
if (json.cue_error !== undefined) {
|
||||
showError(span, json.cue_error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find(".cue-edit").toggle();
|
||||
highlightActive(li);
|
||||
highlightActive(li.find('.spl_cue'));
|
||||
});
|
||||
}
|
||||
|
||||
function changeCueOut(event) {
|
||||
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);
|
||||
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)){
|
||||
if (!isTimeValid(cueOut)){
|
||||
showError(span, "please put in a time '00:00:00 (.000000)'");
|
||||
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) {
|
||||
showError(span, json.response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find(".cue-edit").toggle();
|
||||
highlightActive(li);
|
||||
highlightActive(li.find('.spl_cue'));
|
||||
});
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
return;
|
||||
}
|
||||
if (json.cue_error !== undefined) {
|
||||
showError(span, json.cue_error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find(".cue-edit").toggle();
|
||||
highlightActive(li);
|
||||
highlightActive(li.find('.spl_cue'));
|
||||
});
|
||||
}
|
||||
|
||||
function changeFadeIn(event) {
|
||||
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);
|
||||
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)){
|
||||
if (!isFadeValid(fadeIn)){
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
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) {
|
||||
showError(span, json.response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find('.crossfade').toggle();
|
||||
highlightActive(li.find('.spl_fade_control'));
|
||||
});
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
return;
|
||||
}
|
||||
if (json.fade_error !== undefined) {
|
||||
showError(span, json.fade_error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find('.crossfade').toggle();
|
||||
highlightActive(li.find('.spl_fade_control'));
|
||||
});
|
||||
}
|
||||
|
||||
function changeFadeOut(event) {
|
||||
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);
|
||||
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)){
|
||||
if (!isFadeValid(fadeOut)){
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeOut: fadeOut, id: id}, function(json){
|
||||
if(json.response !== undefined && json.response.error) {
|
||||
showError(span, json.response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find('.crossfade').toggle();
|
||||
highlightActive(li.find('.spl_fade_control'));
|
||||
});
|
||||
$.post(url,
|
||||
{format: "json", fadeOut: fadeOut, id: id, modified: lastMod},
|
||||
function(json){
|
||||
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
return;
|
||||
}
|
||||
if (json.fade_error !== undefined) {
|
||||
showError(span, json.fade_error);
|
||||
return;
|
||||
}
|
||||
|
||||
setPlaylistContent(json);
|
||||
|
||||
li = $('#side_playlist li[unqid='+unqid+']');
|
||||
li.find('.crossfade').toggle();
|
||||
highlightActive(li.find('.spl_fade_control'));
|
||||
});
|
||||
}
|
||||
|
||||
function submitOnEnter(event) {
|
||||
|
@ -221,27 +246,33 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
function editName() {
|
||||
var nameElement = $(this);
|
||||
var playlistName = nameElement.text();
|
||||
var nameElement = $(this),
|
||||
playlistName = nameElement.text(),
|
||||
lastMod = getModified();
|
||||
|
||||
$("#playlist_name_input")
|
||||
.removeClass('element_hidden')
|
||||
.val(playlistName)
|
||||
.keydown(function(event){
|
||||
if(event.keyCode === 13) {
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
var input = $(this);
|
||||
var url;
|
||||
url = '/Playlist/set-playlist-name';
|
||||
var input = $(this),
|
||||
url = '/Playlist/set-playlist-name';
|
||||
|
||||
$.post(url, {format: "json", name: input.val()}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
input.addClass('element_hidden');
|
||||
nameElement.text(json.playlistName);
|
||||
redrawLib();
|
||||
});
|
||||
$.post(url,
|
||||
{format: "json", name: input.val(), modified: lastMod},
|
||||
function(json){
|
||||
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setModified(json.modified);
|
||||
input.addClass('element_hidden');
|
||||
nameElement.text(json.playlistName);
|
||||
redrawLib();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.focus();
|
||||
|
@ -269,7 +300,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
$('#spl_sortable')
|
||||
.empty()
|
||||
.append(json.html);
|
||||
|
||||
|
||||
setModified(json.modified);
|
||||
|
||||
redrawLib();
|
||||
}
|
||||
|
||||
|
@ -281,6 +314,10 @@ var AIRTIME = (function(AIRTIME){
|
|||
return parseInt($("#pl_lastMod").val(), 10);
|
||||
}
|
||||
|
||||
function setModified(modified) {
|
||||
$("#pl_lastMod").val(modified);
|
||||
}
|
||||
|
||||
function openPlaylist(json) {
|
||||
|
||||
$("#side_playlist")
|
||||
|
@ -335,9 +372,11 @@ var AIRTIME = (function(AIRTIME){
|
|||
function setUpPlaylist(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")) {
|
||||
$(this).removeClass("ui-state-active");
|
||||
|
@ -348,19 +387,23 @@ var AIRTIME = (function(AIRTIME){
|
|||
|
||||
var url = '/Playlist/get-playlist-fades';
|
||||
|
||||
$.get(url, {format: "json"}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
playlist.find("#spl_fade_in_main").find("span")
|
||||
.empty()
|
||||
.append(json.fadeIn);
|
||||
playlist.find("#spl_fade_out_main").find("span")
|
||||
.empty()
|
||||
.append(json.fadeOut);
|
||||
|
||||
playlist.find("#crossfade_main").show();
|
||||
});
|
||||
$.get(url,
|
||||
{format: "json", modified: lastMod},
|
||||
function(json){
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
playlist.find("#spl_fade_in_main").find("span")
|
||||
.empty()
|
||||
.append(json.fadeIn);
|
||||
playlist.find("#spl_fade_out_main").find("span")
|
||||
.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(){
|
||||
var descriptionElement = $(this).parent();
|
||||
|
||||
if(descriptionElement.hasClass("closed")) {
|
||||
if (descriptionElement.hasClass("closed")) {
|
||||
cachedDescription = playlist.find("#fieldset-metadate_change textarea").val();
|
||||
descriptionElement.removeClass("closed");
|
||||
}
|
||||
else {
|
||||
|
@ -380,77 +424,71 @@ var AIRTIME = (function(AIRTIME){
|
|||
playlist.find("#description_save").on("click", function(){
|
||||
var textarea = playlist.find("#fieldset-metadate_change textarea"),
|
||||
description = textarea.val(),
|
||||
url;
|
||||
url,
|
||||
lastMod = getModified();;
|
||||
|
||||
url = '/Playlist/set-playlist-description';
|
||||
|
||||
$.post(url, {format: "json", description: description}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
else{
|
||||
textarea.val(json.playlistDescription);
|
||||
}
|
||||
|
||||
playlist.find("#fieldset-metadate_change").addClass("closed");
|
||||
redrawLib();
|
||||
});
|
||||
$.post(url,
|
||||
{format: "json", description: description, modified: lastMod},
|
||||
function(json){
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
}
|
||||
else{
|
||||
setModified(json.modified);
|
||||
textarea.val(json.description);
|
||||
playlist.find("#fieldset-metadate_change").addClass("closed");
|
||||
redrawLib();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
playlist.find("#description_cancel").on("click", function(){
|
||||
var textarea = playlist.find("#fieldset-metadate_change textarea"),
|
||||
url;
|
||||
var textarea = playlist.find("#fieldset-metadate_change textarea");
|
||||
|
||||
url = '/Playlist/set-playlist-description';
|
||||
|
||||
$.post(url, {format: "json"}, function(json){
|
||||
if(json.playlist_error == true){
|
||||
alertPlaylistErrorAndReload();
|
||||
}
|
||||
else{
|
||||
textarea.val(json.playlistDescription);
|
||||
}
|
||||
|
||||
playlist.find("#fieldset-metadate_change").addClass("closed");
|
||||
});
|
||||
textarea.val(cachedDescription);
|
||||
playlist.find("#fieldset-metadate_change").addClass("closed");
|
||||
});
|
||||
|
||||
playlist.find("#spl_fade_in_main span:first").on("blur", function(event){
|
||||
event.stopPropagation();
|
||||
|
||||
var url, fadeIn, span;
|
||||
span = $(this);
|
||||
url = "/Playlist/set-playlist-fades";
|
||||
fadeIn = $.trim(span.text());
|
||||
|
||||
if(!isFadeValid(fadeIn)){
|
||||
var url = "/Playlist/set-playlist-fades",
|
||||
span = $(this),
|
||||
fadeIn = $.trim(span.text()),
|
||||
lastMod = getModified();
|
||||
|
||||
if (!isFadeValid(fadeIn)){
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeIn: fadeIn}, function(json){
|
||||
|
||||
hideError(span);
|
||||
});
|
||||
$.post(url,
|
||||
{format: "json", fadeIn: fadeIn, modified: lastMod},
|
||||
function(json){
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
playlist.find("#spl_fade_out_main span:last").on("blur", function(event){
|
||||
event.stopPropagation();
|
||||
|
||||
var url, fadeOut, span;
|
||||
|
||||
span = $(this);
|
||||
url = "/Playlist/set-playlist-fades";
|
||||
fadeOut = $.trim(span.text());
|
||||
var url = "/Playlist/set-playlist-fades",
|
||||
span = $(this),
|
||||
fadeOut = $.trim(span.text()),
|
||||
lastMod = getModified();
|
||||
|
||||
if(!isFadeValid(fadeOut)){
|
||||
showError(span, "please put in a time in seconds '00 (.000000)'");
|
||||
return;
|
||||
}
|
||||
|
||||
$.post(url, {format: "json", fadeOut: fadeOut}, function(json){
|
||||
hideError(span);
|
||||
});
|
||||
$.post(url,
|
||||
{format: "json", fadeOut: fadeOut, modified: lastMod},
|
||||
function(json){
|
||||
hideError(span);
|
||||
});
|
||||
});
|
||||
|
||||
playlist.find("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
|
||||
|
@ -462,17 +500,19 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
|
||||
sortableConf = (function(){
|
||||
var origRow,
|
||||
var origTrs,
|
||||
html,
|
||||
fnReceive,
|
||||
fnUpdate;
|
||||
|
||||
fnReceive = function(event, ui) {
|
||||
origRow = ui.item;
|
||||
origTrs = ui.helper.find('tr[id^="au"]');
|
||||
html = ui.helper.html();
|
||||
};
|
||||
|
||||
fnUpdate = function(event, ui) {
|
||||
var prev,
|
||||
aItem = [],
|
||||
aItems = [],
|
||||
iAfter,
|
||||
sAddType;
|
||||
|
||||
|
@ -487,21 +527,29 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
//item was dragged in from library datatable
|
||||
if (origRow !== undefined) {
|
||||
aItem.push(origRow.data("aData").id);
|
||||
origRow = undefined;
|
||||
AIRTIME.playlist.fnAddItems(aItem, iAfter, sAddType);
|
||||
if (origTrs !== undefined) {
|
||||
|
||||
playlist.find("tr.ui-draggable")
|
||||
.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.
|
||||
else {
|
||||
aItem.push(parseInt(ui.item.attr("id").split("_").pop(), 10));
|
||||
AIRTIME.playlist.fnMoveItems(aItem, iAfter);
|
||||
aItems.push(parseInt(ui.item.attr("id").split("_").pop(), 10));
|
||||
AIRTIME.playlist.fnMoveItems(aItems, iAfter);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
items: 'li',
|
||||
placeholder: "placeholder lib-placeholder ui-state-highlight",
|
||||
placeholder: "placeholder ui-state-highlight",
|
||||
forcePlaceholderSize: true,
|
||||
handle: 'div.list-item-container',
|
||||
start: function(event, ui) {
|
||||
|
@ -518,30 +566,28 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
mod.fnNew = function() {
|
||||
var url;
|
||||
var url = '/Playlist/new';
|
||||
|
||||
stopAudioPreview();
|
||||
url = '/Playlist/new';
|
||||
|
||||
$.post(url, {format: "json"}, function(json){
|
||||
openPlaylist(json);
|
||||
redrawLib();
|
||||
});
|
||||
|
||||
$.post(url,
|
||||
{format: "json"},
|
||||
function(json){
|
||||
openPlaylist(json);
|
||||
redrawLib();
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnEdit = function(id) {
|
||||
var url;
|
||||
var url = '/Playlist/edit';;
|
||||
|
||||
stopAudioPreview();
|
||||
|
||||
url = '/Playlist/edit';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", id: id},
|
||||
function(json){
|
||||
openPlaylist(json);
|
||||
//redrawLib();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnDelete = function(plid) {
|
||||
|
@ -557,33 +603,51 @@ var AIRTIME = (function(AIRTIME){
|
|||
function(json){
|
||||
openPlaylist(json);
|
||||
redrawLib();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnAddItems = function(aItems, iAfter, sAddType) {
|
||||
var lastMod = getModified();
|
||||
|
||||
$.post("/playlist/add-items",
|
||||
{format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType},
|
||||
{format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType, "modified": lastMod},
|
||||
function(json){
|
||||
setPlaylistContent(json);
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnMoveItems = function(aIds, iAfter) {
|
||||
var lastMod = getModified();
|
||||
|
||||
$.post("/playlist/move-items",
|
||||
{format: "json", "ids": aIds, "afterItem": iAfter},
|
||||
{format: "json", "ids": aIds, "afterItem": iAfter, "modified": lastMod},
|
||||
function(json){
|
||||
setPlaylistContent(json);
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnDeleteItems = function(aItems) {
|
||||
var lastMod = getModified();
|
||||
|
||||
$.post("/playlist/delete-items",
|
||||
{format: "json", "ids": aItems},
|
||||
{format: "json", "ids": aItems, "modified": lastMod},
|
||||
function(json){
|
||||
setPlaylistContent(json);
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,59 @@
|
|||
var AIRTIME = (function(AIRTIME){
|
||||
var mod,
|
||||
oSchedTable;
|
||||
|
||||
if (AIRTIME.showbuilder === undefined) {
|
||||
AIRTIME.showbuilder = {};
|
||||
}
|
||||
mod = AIRTIME.showbuilder;
|
||||
|
||||
function checkError(json) {
|
||||
if (json.error !== undefined) {
|
||||
alert(json.error);
|
||||
}
|
||||
}
|
||||
|
||||
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
||||
var oLibTT = TableTools.fnGetInstance('library_display');
|
||||
|
||||
$.post("/showbuilder/schedule-add",
|
||||
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
|
||||
function(json){
|
||||
checkError(json);
|
||||
oSchedTable.fnDraw();
|
||||
oLibTT.fnSelectNone();
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnMove = function(aSelect, aAfter) {
|
||||
|
||||
$.post("/showbuilder/schedule-move",
|
||||
{"format": "json", "selectedItem": aSelect, "afterItem": aAfter},
|
||||
function(json){
|
||||
checkError(json);
|
||||
oSchedTable.fnDraw();
|
||||
});
|
||||
};
|
||||
|
||||
mod.fnRemove = function(aItems) {
|
||||
|
||||
$.post( "/showbuilder/schedule-remove",
|
||||
{"items": aItems, "format": "json"},
|
||||
function(json) {
|
||||
checkError(json);
|
||||
oSchedTable.fnDraw();
|
||||
});
|
||||
};
|
||||
|
||||
mod.init = function(oTable) {
|
||||
oSchedTable = oTable;
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var tableDiv = $('#show_builder_table'),
|
||||
oTable,
|
||||
|
@ -37,7 +93,7 @@ $(document).ready(function() {
|
|||
*
|
||||
* @return Number iTime
|
||||
*/
|
||||
function fnGetUIPickerUnixTimestamp(sDatePickerId, sTimePickerId) {
|
||||
function fnGetTimestamp(sDatePickerId, sTimePickerId) {
|
||||
var date,
|
||||
time,
|
||||
iTime,
|
||||
|
@ -48,8 +104,6 @@ $(document).ready(function() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
//string.split(separator, limit)
|
||||
|
||||
date = $(sDatePickerId).val();
|
||||
time = $(sTimePickerId).val();
|
||||
|
||||
|
@ -64,7 +118,7 @@ $(document).ready(function() {
|
|||
iServerOffset = serverTimezoneOffset;
|
||||
iClientOffset = oDate.getTimezoneOffset() * 60;//function returns minutes
|
||||
|
||||
//adjust for the fact the the Date object is
|
||||
//adjust for the fact the the Date object is in clent time.
|
||||
iTime = iTime + iServerOffset + iClientOffset;
|
||||
|
||||
return iTime;
|
||||
|
@ -80,8 +134,8 @@ $(document).ready(function() {
|
|||
iRange,
|
||||
DEFAULT_RANGE = 60*60*24;
|
||||
|
||||
iStart = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_start", "#show_builder_timepicker_start");
|
||||
iEnd = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_end", "#show_builder_timepicker_end");
|
||||
iStart = fnGetTimestamp("#sb_date_start", "#sb_time_start");
|
||||
iEnd = fnGetTimestamp("#sb_date_end", "#sb_time_end");
|
||||
|
||||
iRange = iEnd - iStart;
|
||||
|
||||
|
@ -106,6 +160,10 @@ $(document).ready(function() {
|
|||
if (fnServerData.hasOwnProperty("end")) {
|
||||
aoData.push( { name: "end", value: fnServerData.end} );
|
||||
}
|
||||
if (fnServerData.hasOwnProperty("ops")) {
|
||||
aoData.push( { name: "myShows", value: fnServerData.ops.myShows} );
|
||||
aoData.push( { name: "showFilter", value: fnServerData.ops.showFilter} );
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
"dataType": "json",
|
||||
|
@ -147,7 +205,7 @@ $(document).ready(function() {
|
|||
if (aData.header === true) {
|
||||
cl = 'sb-header';
|
||||
|
||||
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span>';
|
||||
sSeparatorHTML = '<span>'+aData.title+'</span><span>'+aData.starts+'</span><span>'+aData.ends+'</span><span class="ui-icon ui-icon-triangle-1-e"></span>';
|
||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
|
||||
}
|
||||
else if (aData.footer === true) {
|
||||
|
@ -172,7 +230,7 @@ $(document).ready(function() {
|
|||
|
||||
node = nRow.children[0];
|
||||
if (aData.checkbox === true) {
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input>';
|
||||
node.innerHTML = '<input type="checkbox" name="'+aData.id+'"></input><span class="ui-icon ui-icon-triangle-1-e"></span>';
|
||||
}
|
||||
else {
|
||||
node.innerHTML = '';
|
||||
|
@ -194,31 +252,27 @@ $(document).ready(function() {
|
|||
aData = oTT.fnGetSelectedData(),
|
||||
item,
|
||||
temp,
|
||||
ids = [];
|
||||
aItems = [];
|
||||
|
||||
for (item in aData) {
|
||||
temp = aData[item];
|
||||
if (temp !== null && temp.hasOwnProperty('id')) {
|
||||
ids.push(temp.id);
|
||||
aItems.push({"id": temp.id, "instance": temp.instance, "timestamp": temp.timestamp});
|
||||
}
|
||||
}
|
||||
|
||||
$.post( "/showbuilder/schedule-remove",
|
||||
{"ids": ids, "format": "json"},
|
||||
function(data) {
|
||||
oTable.fnDraw();
|
||||
});
|
||||
AIRTIME.showbuilder.fnRemove(aItems);
|
||||
};
|
||||
|
||||
oTable = tableDiv.dataTable( {
|
||||
"aoColumns": [
|
||||
/* checkbox */ {"mDataProp": "checkbox", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
|
||||
/* starts */{"mDataProp": "starts", "sTitle": "Airtime"},
|
||||
/* ends */{"mDataProp": "ends", "sTitle": "Off Air"},
|
||||
/* runtime */{"mDataProp": "runtime", "sTitle": "Runtime"},
|
||||
/* title */{"mDataProp": "title", "sTitle": "Title"},
|
||||
/* creator */{"mDataProp": "creator", "sTitle": "Creator"},
|
||||
/* album */{"mDataProp": "album", "sTitle": "Album"}
|
||||
/* checkbox */ {"mDataProp": "checkbox", "sTitle": "<input type='checkbox' name='sb_cb_all'>", "sWidth": "15px"},
|
||||
/* starts */{"mDataProp": "starts", "sTitle": "Airtime"},
|
||||
/* ends */{"mDataProp": "ends", "sTitle": "Off Air"},
|
||||
/* runtime */{"mDataProp": "runtime", "sTitle": "Runtime"},
|
||||
/* title */{"mDataProp": "title", "sTitle": "Title"},
|
||||
/* creator */{"mDataProp": "creator", "sTitle": "Creator"},
|
||||
/* album */{"mDataProp": "album", "sTitle": "Album"}
|
||||
],
|
||||
|
||||
"bJQueryUI": true,
|
||||
|
@ -256,7 +310,7 @@ $(document).ready(function() {
|
|||
//don't select separating rows, or shows without privileges.
|
||||
if ($(node).hasClass("sb-header")
|
||||
|| $(node).hasClass("sb-footer")
|
||||
|| $(node).hasClass("sb-not-allowed")){
|
||||
|| $(node).hasClass("sb-not-allowed")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -308,80 +362,95 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$( "#show_builder_datepicker_start" ).datepicker(oBaseDatePickerSettings);
|
||||
$("#sb_date_start").datepicker(oBaseDatePickerSettings);
|
||||
$("#sb_time_start").timepicker(oBaseTimePickerSettings);
|
||||
$("#sb_date_end").datepicker(oBaseDatePickerSettings);
|
||||
$("#sb_time_end").timepicker(oBaseTimePickerSettings);
|
||||
|
||||
$( "#show_builder_timepicker_start" ).timepicker(oBaseTimePickerSettings);
|
||||
|
||||
$( "#show_builder_datepicker_end" ).datepicker(oBaseDatePickerSettings);
|
||||
|
||||
$( "#show_builder_timepicker_end" ).timepicker(oBaseTimePickerSettings);
|
||||
|
||||
$( "#show_builder_timerange_button" ).click(function(ev){
|
||||
var oSettings,
|
||||
oRange;
|
||||
$("#sb_submit").click(function(ev){
|
||||
var fn,
|
||||
oRange,
|
||||
op;
|
||||
|
||||
oRange = fnGetScheduleRange();
|
||||
|
||||
oSettings = oTable.fnSettings();
|
||||
oSettings.fnServerData.start = oRange.start;
|
||||
oSettings.fnServerData.end = oRange.end;
|
||||
fn = oTable.fnSettings().fnServerData;
|
||||
fn.start = oRange.start;
|
||||
fn.end = oRange.end;
|
||||
|
||||
op = $("div.sb-advanced-options");
|
||||
if (op.is(":visible")) {
|
||||
|
||||
if (fn.ops === undefined) {
|
||||
fn.ops = {};
|
||||
}
|
||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
||||
}
|
||||
|
||||
oTable.fnDraw();
|
||||
});
|
||||
|
||||
var sortableConf = (function(){
|
||||
var origRow,
|
||||
oItemData,
|
||||
var origTrs,
|
||||
aItemData = [],
|
||||
oPrevData,
|
||||
fnAdd,
|
||||
fnMove,
|
||||
fnReceive,
|
||||
fnUpdate;
|
||||
fnUpdate,
|
||||
i,
|
||||
html;
|
||||
|
||||
fnAdd = function() {
|
||||
var aMediaIds = [],
|
||||
aSchedIds = [];
|
||||
aSchedIds = [],
|
||||
oLibTT = TableTools.fnGetInstance('library_display');
|
||||
|
||||
aSchedIds.push({"id": oPrevData.id, "instance": oPrevData.instance});
|
||||
aMediaIds.push({"id": oItemData.id, "type": oItemData.ftype});
|
||||
|
||||
$.post("/showbuilder/schedule-add",
|
||||
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
|
||||
function(json){
|
||||
oTable.fnDraw();
|
||||
});
|
||||
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});
|
||||
|
||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||
};
|
||||
|
||||
fnMove = function() {
|
||||
var aSelect = [],
|
||||
aAfter = [];
|
||||
|
||||
aSelect.push({"id": oItemData.id, "instance": oItemData.instance});
|
||||
aAfter.push({"id": oPrevData.id, "instance": oPrevData.instance});
|
||||
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});
|
||||
|
||||
$.post("/showbuilder/schedule-move",
|
||||
{"format": "json", "selectedItem": aSelect, "afterItem": aAfter},
|
||||
function(json){
|
||||
oTable.fnDraw();
|
||||
});
|
||||
AIRTIME.showbuilder.fnMove(aSelect, aAfter);
|
||||
};
|
||||
|
||||
fnReceive = function(event, ui) {
|
||||
origRow = ui.item;
|
||||
origTrs = ui.helper.find("tr");
|
||||
html = ui.helper.html();
|
||||
};
|
||||
|
||||
fnUpdate = function(event, ui) {
|
||||
aItemData = [];
|
||||
oPrevData = ui.item.prev().data("aData");
|
||||
|
||||
//item was dragged in
|
||||
if (origRow !== undefined) {
|
||||
oItemData = origRow.data("aData");
|
||||
origRow = undefined;
|
||||
if (origTrs !== 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();
|
||||
}
|
||||
//item was reordered.
|
||||
else {
|
||||
oItemData = ui.item.data("aData");
|
||||
aItemData.push(ui.item.data("aData"));
|
||||
fnMove();
|
||||
}
|
||||
};
|
||||
|
@ -404,4 +473,7 @@ $(document).ready(function() {
|
|||
.append('<div class="ColVis TableTools"><button class="ui-button ui-state-default"><span>Delete</span></button></div>')
|
||||
.click(fnRemoveSelectedItems);
|
||||
|
||||
//set things like a reference to the table.
|
||||
AIRTIME.showbuilder.init(oTable);
|
||||
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* File: ColReorder.js
|
||||
* Version: 1.0.4
|
||||
* Version: 1.0.5
|
||||
* CVS: $Id$
|
||||
* Description: Controls for column visiblity in DataTables
|
||||
* 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) */
|
||||
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 */
|
||||
|
@ -464,12 +468,9 @@ ColReorder.prototype = {
|
|||
}
|
||||
|
||||
/* State saving */
|
||||
this.s.dt.aoStateSave.push( {
|
||||
"fn": function (oS, sVal) {
|
||||
return that._fnStateSave.call( that, sVal );
|
||||
},
|
||||
"sName": "ColReorder_State"
|
||||
} );
|
||||
this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) {
|
||||
that._fnStateSave.call( that, oData );
|
||||
}, "ColReorder_State" );
|
||||
|
||||
/* An initial column order has been specified */
|
||||
var aiOrder = null;
|
||||
|
@ -556,72 +557,41 @@ ColReorder.prototype = {
|
|||
|
||||
|
||||
/**
|
||||
* This function effectively replaces the state saving function in DataTables (this is needed
|
||||
* because otherwise DataTables would state save the columns in their reordered state, not the
|
||||
* original which is needed on first draw). This is sensitive to any changes in the DataTables
|
||||
* state saving method!
|
||||
* Because we change the indexes of columns in the table, relative to their starting point
|
||||
* we need to reorder the state columns to what they are at the starting point so we can
|
||||
* then rearrange them again on state load!
|
||||
* @method _fnStateSave
|
||||
* @param string sCurrentVal
|
||||
* @param object oState DataTables state
|
||||
* @returns string JSON encoded cookie string for DataTables
|
||||
* @private
|
||||
*/
|
||||
"_fnStateSave": function ( sCurrentVal )
|
||||
"_fnStateSave": function ( oState )
|
||||
{
|
||||
var i, iLen, sTmp;
|
||||
var sValue = sCurrentVal.split('"aaSorting"')[0];
|
||||
var a = [];
|
||||
var i, iLen, aCopy, iOrigColumn;
|
||||
var oSettings = this.s.dt;
|
||||
|
||||
|
||||
/* Sorting */
|
||||
sValue += '"aaSorting":[ ';
|
||||
for ( i=0 ; i<oSettings.aaSorting.length ; i++ )
|
||||
for ( i=0 ; i<oState.aaSorting.length ; i++ )
|
||||
{
|
||||
sValue += '['+oSettings.aoColumns[ oSettings.aaSorting[i][0] ]._ColReorder_iOrigCol+
|
||||
',"'+oSettings.aaSorting[i][1]+'"],';
|
||||
oState.aaSorting[i][0] = oSettings.aoColumns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol;
|
||||
}
|
||||
sValue = sValue.substring(0, sValue.length-1);
|
||||
sValue += "],";
|
||||
|
||||
/* Column filter */
|
||||
|
||||
aSearchCopy = $.extend( true, [], oState.aoSearchCols );
|
||||
oState.ColReorder = [];
|
||||
|
||||
for ( i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
a[ oSettings.aoColumns[i]._ColReorder_iOrigCol ] = {
|
||||
"sSearch": encodeURIComponent(oSettings.aoPreSearchCols[i].sSearch),
|
||||
"bRegex": !oSettings.aoPreSearchCols[i].bRegex
|
||||
};
|
||||
}
|
||||
iOrigColumn = oSettings.aoColumns[i]._ColReorder_iOrigCol;
|
||||
|
||||
/* Column filter */
|
||||
oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i];
|
||||
|
||||
/* Visibility */
|
||||
oState.abVisCols[ iOrigColumn ] = oSettings.aoColumns[i].bVisible;
|
||||
|
||||
sValue += '"aaSearchCols":[ ';
|
||||
for ( i=0 ; i<a.length ; i++ )
|
||||
{
|
||||
sValue += '["'+a[i].sSearch+'",'+a[i].bRegex+'],';
|
||||
/* Column reordering */
|
||||
oState.ColReorder.push( iOrigColumn );
|
||||
}
|
||||
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
|
||||
* @default As code
|
||||
*/
|
||||
ColReorder.VERSION = "1.0.4";
|
||||
ColReorder.VERSION = "1.0.5";
|
||||
ColReorder.prototype.VERSION = ColReorder.VERSION;
|
||||
|
||||
|
||||
|
@ -960,7 +930,7 @@ ColReorder.prototype.VERSION = ColReorder.VERSION;
|
|||
*/
|
||||
if ( typeof $.fn.dataTable == "function" &&
|
||||
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
|
||||
$.fn.dataTableExt.fnVersionCheck('1.8.0') )
|
||||
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
|
||||
{
|
||||
$.fn.dataTableExt.aoFeatures.push( {
|
||||
"fnInit": function( oDTSettings ) {
|
||||
|
@ -981,7 +951,7 @@ if ( typeof $.fn.dataTable == "function" &&
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* File: ColVis.js
|
||||
* Version: 1.0.7.dev
|
||||
* Version: 1.0.7
|
||||
* CVS: $Id$
|
||||
* Description: Controls for column visiblity in DataTables
|
||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
||||
|
@ -873,7 +873,7 @@ ColVis.prototype = {
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
* Alter the colspan on any fnOpen rows
|
||||
*/
|
||||
"_fnAdjustOpenRows": function ()
|
||||
{
|
||||
|
@ -958,7 +958,7 @@ ColVis.prototype.CLASS = "ColVis";
|
|||
* @type String
|
||||
* @default See code
|
||||
*/
|
||||
ColVis.VERSION = "1.0.7.dev";
|
||||
ColVis.VERSION = "1.0.7";
|
||||
ColVis.prototype.VERSION = ColVis.VERSION;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue