Merge branch 'devel' into CC-3174

This commit is contained in:
Naomi Aro 2012-01-16 09:58:02 +01:00
commit df33a457b1
31 changed files with 391 additions and 275 deletions

View file

@ -574,13 +574,13 @@ class ApiController extends Zend_Controller_Action
}
else {
// path already exist
if($file->getFileExistFlag()){
if($file->getFileExistsFlag()){
// file marked as exists
$this->view->error = "File already exists in Airtime.";
return;
}else{
// file marked as not exists
$file->setFileExistFlag(true);
$file->setFileExistsFlag(true);
}
}
}
@ -831,46 +831,70 @@ class ApiController extends Zend_Controller_Action
}
$params = $request->getParams();
$temp_list = $params['mount_list'];
$mount_list = explode(',',$temp_list);
$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
$dirs = Application_Model_MusicDir::getWatchedDirs(null, null);
$watched_dirs = Application_Model_MusicDir::getWatchedDirs(null,null);
// dirs to be added to watch list again
$addedDirs = array();
// dirs to be deleted from watch list
$removedDirs = array();
$tempDirs = Application_Model_MusicDir::getWatchedDirs(true,null);
foreach( $tempDirs as $d)
{
$removedDirs[$d->getDirectory()] = $d;
}
foreach( $dirs as $dir){
// set Exsits as false as default
foreach($mount_list as $mount_path){
if($mount_path == '/'){
continue;
}
// if dir contaions mount_path
if(strstr($dir->getDirectory(),$mount_path)){
if($dir->getExistsFlag() == false){
$addedDirs[] = $dir;
}else{
unset($removedDirs[$dir->getDirector()]);
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);
break;
}
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
else if(substr($dirPath, 0, strlen($ad)) === $ad && $dir->getExistsFlag() == false){
Application_Model_MusicDir::addWatchedDir($dirPath, false);
break;
}
// is new mount point within the watched dir?
// pyinotify doesn't notify anyhing in this case, so we add this mount point as
// watched dir
else if(substr($ad, 0, strlen($dirPath)) === $dirPath){
// bypass nested loop check
Application_Model_MusicDir::addWatchedDir($ad, false, true);
break;
}
}
}
}
foreach($addedDirs as $ad){
Application_Model_MusicDir::addWatchedDir($ad->getDirectory(), false);
}
foreach($removedDirs as $rd){
Application_Model_MusicDir::removeWatchedDir($rd->getDirectory(), false);
}
foreach( $removed_list as $rd){
foreach( $watched_dirs as $dir ){
$dirPath = $dir->getDirectory();
$rd .= '/';
// if dir contains any dir in removed_list( if watched dir resides on new mounted path )
if(substr($dirPath, 0, strlen($rd)) === $rd && $dir->getExistsFlag() == true){
Application_Model_MusicDir::removeWatchedDir($dirPath, false);
break;
}
// 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
// compare agaisnt all files in cc_files table
else if(substr($rd, 0, strlen($dirPath)) === $dirPath ){
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
// get all the files that is under $dirPath
$files = Application_Model_StoredFile::listAllFiles($dir->getId(), true);
foreach($files as $f){
// if the file is from this mount
if(substr( $f->getFilePath(),0,strlen($rd) ) === $rd){
$f->delete();
}
}
if($watchDir){
Application_Model_MusicDir::removeWatchedDir($rd, false);
}
break;
}
}
}
}
// handles case where watched dir is missing

View file

@ -231,7 +231,6 @@ class LibraryController extends Zend_Controller_Action
public function contentsAction()
{
$post = $this->getRequest()->getPost();
Logging::log(print_r($post, true));
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post);
//format clip lengh to 1 decimal

View file

@ -194,7 +194,7 @@ class PreferenceController extends Zend_Controller_Action
}
}
if($form->isValid($post_data)){
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){// && $form->isValid($post_data['output_sound_device'])){
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$values['output_sound_device'] = $form->getValue('output_sound_device');
}

View file

@ -41,11 +41,11 @@ class ScheduleController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
@ -55,10 +55,10 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
Application_Model_Schedule::createNewFormSections($this->view);
@ -67,6 +67,8 @@ class ScheduleController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id);
$this->view->isAdmin = $user->isAdmin();
$this->view->isProgramManager = $user->isUserType('P');
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
}
public function eventFeedAction()
@ -233,9 +235,15 @@ class ScheduleController extends Zend_Controller_Action
if ($showStartDateHelper->getTimestamp() <= $epochNow &&
$epochNow < $showEndDateHelper->getTimestamp() &&
$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
if ($show->isRecorded()) {
$menu[] = array('action' => array('type' => 'fn',
'callback' => "window['confirmCancelRecordedShow']($id)"),
'title' => 'Cancel Current Show');
} else {
$menu[] = array('action' => array('type' => 'fn',
'callback' => "window['confirmCancelShow']($id)"),
'title' => 'Cancel Current Show');
}
}
if ($epochNow < $showStartDateHelper->getTimestamp()) {
@ -339,15 +347,15 @@ class ScheduleController extends Zend_Controller_Action
return false;
}
$playlists = $show->searchPlaylistsForShow($post);
foreach( $playlists['aaData'] as &$data){
// calling two functions to format time to 1 decimal place
$sec = Application_Model_Playlist::playlistTimeToSeconds($data[4]);
$data[4] = Application_Model_Playlist::secondsToPlaylistTime($sec);
}
$playlists = $show->searchPlaylistsForShow($post);
foreach( $playlists['aaData'] as &$data){
// calling two functions to format time to 1 decimal place
$sec = Application_Model_Playlist::playlistTimeToSeconds($data['length']);
$data['length'] = Application_Model_Playlist::secondsToPlaylistTime($sec);
}
//for datatables
die(json_encode($playlists));
//for datatables
die(json_encode($playlists));
}
public function removeGroupAction()