Merge branch '2.2.x' into devel

Conflicts:
	airtime_mvc/application/controllers/PreferenceController.php
	airtime_mvc/application/models/StoredFile.php
	airtime_mvc/public/js/bootstrap/bootstrap.js
This commit is contained in:
denise 2012-11-07 11:21:36 -05:00
commit b817684972
33 changed files with 167 additions and 181 deletions

View File

@ -178,7 +178,7 @@ class LibraryController extends Zend_Controller_Action
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($obj_sess->type === "playlist") { if ($obj_sess->type === "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
} elseif ($obj_sess->type === "block") { } elseif ($obj_sess->type === "block" && $obj->isStatic()) {
$menu["pl_add"] = array("name"=> "Add to Smart Block", "icon" => "add-playlist", "icon" => "copy"); $menu["pl_add"] = array("name"=> "Add to Smart Block", "icon" => "add-playlist", "icon" => "copy");
} }
} }

View File

@ -513,7 +513,7 @@ class PlaylistController extends Zend_Controller_Action
} catch (BlockNotFoundException $e) { } catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true); $this->playlistNotFound('block', true);
} catch (Exception $e) { } catch (Exception $e) {
//Logging::info($e); Logging::info($e);
$this->playlistUnknownError($e); $this->playlistUnknownError($e);
} }
} }

View File

@ -21,7 +21,6 @@ class PreferenceController extends Zend_Controller_Action
public function indexAction() public function indexAction()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$request = $this->getRequest(); $request = $this->getRequest();
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
@ -48,16 +47,14 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetTimezone($values["timezone"]); Application_Model_Preference::SetTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]); Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
if (!$isSaas) { Application_Model_Preference::SetEnableSystemEmail($values["preferences_email_server"]["enableSystemEmail"]);
Application_Model_Preference::SetEnableSystemEmail($values["enableSystemEmail"]); Application_Model_Preference::SetSystemEmail($values["preferences_email_server"]["systemEmail"]);
Application_Model_Preference::SetSystemEmail($values["systemEmail"]); Application_Model_Preference::SetMailServerConfigured($values["preferences_email_server"]["configureMailServer"]);
Application_Model_Preference::SetMailServerConfigured($values["configureMailServer"]); Application_Model_Preference::SetMailServer($values["preferences_email_server"]["mailServer"]);
Application_Model_Preference::SetMailServer($values["mailServer"]); Application_Model_Preference::SetMailServerEmailAddress($values["preferences_email_server"]["email"]);
Application_Model_Preference::SetMailServerEmailAddress($values["email"]); Application_Model_Preference::SetMailServerPassword($values["preferences_email_server"]["ms_password"]);
Application_Model_Preference::SetMailServerPassword($values["ms_password"]); Application_Model_Preference::SetMailServerPort($values["preferences_email_server"]["port"]);
Application_Model_Preference::SetMailServerPort($values["port"]); Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]);
Application_Model_Preference::SetMailServerRequiresAuth($values["msRequiresAuth"]);
}
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["UseSoundCloud"]); Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["UseSoundCloud"]);
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
@ -91,13 +88,12 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->statusMsg = ""; $this->view->statusMsg = "";
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$form = new Application_Form_SupportSettings(); $form = new Application_Form_SupportSettings();
if ($request->isPost()) { if ($request->isPost()) {
$values = $request->getPost(); $values = $request->getPost();
if ($form->isValid($values)) { if ($form->isValid($values)) {
if (!$isSass && $values["Publicise"] != 1) { if ($values["Publicise"] != 1) {
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]); Application_Model_Preference::SetPublicise($values["Publicise"]);
if (isset($values["Privacy"])) { if (isset($values["Privacy"])) {
@ -108,10 +104,8 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetPhone($values["Phone"]); Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]); Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
if (!$isSass) {
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]); Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]); Application_Model_Preference::SetPublicise($values["Publicise"]);
}
$form->Logo->receive(); $form->Logo->receive();
$imagePath = $form->Logo->getFileName(); $imagePath = $form->Logo->getFileName();
@ -120,7 +114,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetStationCity($values["City"]); Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]); Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath); Application_Model_Preference::SetStationLogo($imagePath);
if (!$isSass && isset($values["Privacy"])) { if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]); Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
} }
} }
@ -168,7 +162,6 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
// get current settings // get current settings
$temp = Application_Model_StreamSetting::getStreamSetting(); $temp = Application_Model_StreamSetting::getStreamSetting();
@ -248,10 +241,8 @@ class PreferenceController extends Zend_Controller_Action
$error = false; $error = false;
if ($form->isValid($values)) { if ($form->isValid($values)) {
if (!$isSaas) {
$values['output_sound_device'] = $form->getValue('output_sound_device'); $values['output_sound_device'] = $form->getValue('output_sound_device');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); $values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
}
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['streamFormat'] = $form->getValue('streamFormat'); $values['streamFormat'] = $form->getValue('streamFormat');
@ -266,7 +257,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]); Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
if (!$isSaas) {
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) { if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"]; $master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
if (empty($values["master_harbor_input_port"]) || empty($values["master_harbor_input_mount_point"])) { if (empty($values["master_harbor_input_port"]) || empty($values["master_harbor_input_mount_point"])) {
@ -294,7 +284,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]); Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]); Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]); Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
}
// store stream update timestamp // store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp(); Application_Model_Preference::SetStreamUpdateTimestamp();

View File

@ -527,8 +527,6 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$this->view->action = "edit-show"; $this->view->action = "edit-show";
@ -633,7 +631,6 @@ class ScheduleController extends Zend_Controller_Action
$formLive->populate($show->getLiveStreamInfo()); $formLive->populate($show->getLiveStreamInfo());
if (!$isSaas) {
$formRecord = new Application_Form_AddShowRR(); $formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates(); $formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates(); $formRebroadcast = new Application_Form_AddShowRebroadcastDates();
@ -677,7 +674,6 @@ class ScheduleController extends Zend_Controller_Action
$formAbsoluteRebroadcast->disable(); $formAbsoluteRebroadcast->disable();
$formRebroadcast->disable(); $formRebroadcast->disable();
} }
}
if (!$isAdminOrPM) { if (!$isAdminOrPM) {
$formWhat->disable(); $formWhat->disable();

View File

@ -4,15 +4,12 @@ require_once 'customvalidators/PasswordNotEmpty.php';
class Application_Form_EmailServerPreferences extends Zend_Form_SubForm class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
{ {
private $isSaas;
public function init() public function init()
{ {
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$this->isSaas = $isSaas;
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml', "isSaas" => $isSaas)) array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml'))
)); ));
// Enable system emails // Enable system emails

View File

@ -2,15 +2,12 @@
class Application_Form_GeneralPreferences extends Zend_Form_SubForm class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{ {
private $isSaas;
public function init() public function init()
{ {
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$this->isSaas = $isSaas;
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml', "isSaas" => $isSaas)) array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
)); ));
$defaultFade = Application_Model_Preference::GetDefaultFade(); $defaultFade = Application_Model_Preference::GetDefaultFade();

View File

@ -9,7 +9,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true"; $isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade(); $defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
if ($defaultFade == "") { if ($defaultFade == "") {
$defaultFade = '00.000000'; $defaultFade = '00.000000';
@ -82,7 +81,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$this->addElement($live_dj_connection_url); $this->addElement($live_dj_connection_url);
//liquidsoap harbor.input port //liquidsoap harbor.input port
if (!$isSaas) {
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort(); $m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port'); $master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
$master_dj_port->setLabel("Master Source Port") $master_dj_port->setLabel("Master Source Port")
@ -119,7 +117,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered')))) array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_mount); $this->addElement($live_dj_mount);
}
// demo only code // demo only code
if (!$isStreamConfigable) { if (!$isStreamConfigable) {
$elements = $this->getElements(); $elements = $this->getElements();
@ -135,21 +132,18 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
{ {
global $CC_CONFIG; global $CC_CONFIG;
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1; $isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL(); $master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL(); $live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo)) array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isDemo' => $isDemo))
)); ));
} }
public function isValid($data) public function isValid($data)
{ {
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$isValid = parent::isValid($data); $isValid = parent::isValid($data);
if (!$isSaas) {
$master_harbor_input_port = $data['master_harbor_input_port']; $master_harbor_input_port = $data['master_harbor_input_port'];
$dj_harbor_input_port = $data['dj_harbor_input_port']; $dj_harbor_input_port = $data['dj_harbor_input_port'];
@ -193,7 +187,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$isValid = false; $isValid = false;
} }
} }
}
return $isValid; return $isValid;
} }

View File

@ -2,7 +2,6 @@
class Application_Form_Preferences extends Zend_Form class Application_Form_Preferences extends Zend_Form
{ {
private $isSaas;
public function init() public function init()
{ {
@ -10,20 +9,16 @@ class Application_Form_Preferences extends Zend_Form
$this->setMethod('post'); $this->setMethod('post');
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$this->isSaas = $isSaas;
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences.phtml', "isSaas" => $this->isSaas)) array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
)); ));
$general_pref = new Application_Form_GeneralPreferences(); $general_pref = new Application_Form_GeneralPreferences();
$this->addSubForm($general_pref, 'preferences_general'); $this->addSubForm($general_pref, 'preferences_general');
if (!$isSaas) {
$email_pref = new Application_Form_EmailServerPreferences(); $email_pref = new Application_Form_EmailServerPreferences();
$this->addSubForm($email_pref, 'preferences_email_server'); $this->addSubForm($email_pref, 'preferences_email_server');
}
$soundcloud_pref = new Application_Form_SoundcloudPreferences(); $soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); $this->addSubForm($soundcloud_pref, 'preferences_soundcloud');

View File

@ -4,16 +4,13 @@ require_once 'customfilters/ImageSize.php';
class Application_Form_SupportSettings extends Zend_Form class Application_Form_SupportSettings extends Zend_Form
{ {
private $isSass;
public function init() public function init()
{ {
$country_list = Application_Model_Preference::GetCountryList(); $country_list = Application_Model_Preference::GetCountryList();
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$this->isSass = $isSass;
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)), array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false))) array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
); );
@ -109,7 +106,6 @@ class Application_Form_SupportSettings extends Zend_Form
$upload->setAttrib('accept', 'image/*'); $upload->setAttrib('accept', 'image/*');
$this->addElement($upload); $this->addElement($upload);
if (!$isSass) {
//enable support feedback //enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array( $this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback', 'label' => 'Send support feedback',
@ -150,7 +146,6 @@ class Application_Form_SupportSettings extends Zend_Form
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.") $checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy); $this->addElement($checkboxPrivacy);
}
// submit button // submit button
$submit = new Zend_Form_Element_Submit("submit"); $submit = new Zend_Form_Element_Submit("submit");
@ -165,7 +160,6 @@ class Application_Form_SupportSettings extends Zend_Form
public function isValid ($data) public function isValid ($data)
{ {
$isValid = parent::isValid($data); $isValid = parent::isValid($data);
if (!$this->isSass) {
if ($data['Publicise'] != 1) { if ($data['Publicise'] != 1) {
$isValid = true; $isValid = true;
} }
@ -176,7 +170,6 @@ class Application_Form_SupportSettings extends Zend_Form
$isValid = false; $isValid = false;
} }
} }
}
return $isValid; return $isValid;
} }

View File

@ -210,10 +210,23 @@ FROM cc_blockcontents AS pc
LEFT JOIN cc_files AS f ON pc.file_id=f.id LEFT JOIN cc_files AS f ON pc.file_id=f.id
LEFT JOIN cc_block AS bl ON pc.block_id = bl.id LEFT JOIN cc_block AS bl ON pc.block_id = bl.id
WHERE pc.block_id = :block_id WHERE pc.block_id = :block_id
ORDER BY pc.position
SQL; SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, array(':block_id'=>$this->id)); if ($filterFiles) {
$sql .= <<<SQL
AND f.file_exists = :file_exists
SQL;
}
$sql .= <<<SQL
ORDER BY pc.position
SQL;
$params = array(':block_id'=>$this->id);
if ($filterFiles) {
$params[':file_exists'] = $filterFiles;
}
$rows = Application_Common_Database::prepareAndExecute($sql, $params);
$offset = 0; $offset = 0;
foreach ($rows as &$row) { foreach ($rows as &$row) {
@ -310,6 +323,7 @@ SQL;
$hour = "00"; $hour = "00";
$mins = "00"; $mins = "00";
if ($modifier == "minutes") { if ($modifier == "minutes") {
$mins = $value;
if ($value >59) { if ($value >59) {
$hour = intval($value/60); $hour = intval($value/60);
$mins = $value%60; $mins = $value%60;
@ -1173,7 +1187,7 @@ SQL;
$sizeOfInsert = count($insertList); $sizeOfInsert = count($insertList);
// if block is not full and reapeat_track is check, fill up more // if block is not full and reapeat_track is check, fill up more
while (!$isBlockFull && $repeat == 1) { while (!$isBlockFull && $repeat == 1 && $sizeOfInsert > 0) {
$randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert)); $randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert));
$insertList[] = $insertList[$randomEleKey]; $insertList[] = $insertList[$randomEleKey];
$totalTime += $insertList[$randomEleKey]['length']; $totalTime += $insertList[$randomEleKey]['length'];

View File

@ -176,6 +176,14 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
FROM cc_playlistcontents AS pc FROM cc_playlistcontents AS pc
JOIN cc_files AS f ON pc.file_id=f.id JOIN cc_files AS f ON pc.file_id=f.id
WHERE pc.playlist_id = :playlist_id1 WHERE pc.playlist_id = :playlist_id1
SQL;
if ($filterFiles) {
$sql .= <<<SQL
AND f.file_exists = :file_exists
SQL;
}
$sql .= <<<SQL
AND TYPE = 0) AND TYPE = 0)
UNION ALL UNION ALL
(SELECT pc.id AS id, (SELECT pc.id AS id,
@ -220,7 +228,13 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
ORDER BY temp.position; ORDER BY temp.position;
SQL; SQL;
$rows = Application_Common_Database::prepareAndExecute($sql, array(':playlist_id1'=>$this->id, ':playlist_id2'=>$this->id, ':playlist_id3'=>$this->id)); $params = array(
':playlist_id1'=>$this->id, ':playlist_id2'=>$this->id, ':playlist_id3'=>$this->id);
if ($filterFiles) {
$params[':file_exists'] = $filterFiles;
}
$rows = Application_Common_Database::prepareAndExecute($sql, $params);
$offset = 0; $offset = 0;
foreach ($rows as &$row) { foreach ($rows as &$row) {

View File

@ -883,8 +883,6 @@ SQL;
public static function createNewFormSections($p_view) public static function createNewFormSections($p_view)
{ {
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
@ -916,7 +914,6 @@ SQL;
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d"))); $formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
if (!$isSaas) {
$formRecord = new Application_Form_AddShowRR(); $formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates(); $formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates(); $formRebroadcast = new Application_Form_AddShowRebroadcastDates();
@ -928,7 +925,6 @@ SQL;
$p_view->rr = $formRecord; $p_view->rr = $formRecord;
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast; $p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$p_view->rebroadcast = $formRebroadcast; $p_view->rebroadcast = $formRebroadcast;
}
$p_view->addNewShow = true; $p_view->addNewShow = true;
} }
@ -939,8 +935,6 @@ SQL;
* 2.1 deadline looming, this is OK for now. -Martin */ * 2.1 deadline looming, this is OK for now. -Martin */
public static function updateShowInstance($data, $controller) public static function updateShowInstance($data, $controller)
{ {
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats(); $formRepeats = new Application_Form_AddShowRepeats();
@ -955,7 +949,6 @@ SQL;
$formStyle->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper');
$formLive->removeDecorator('DtDdWrapper'); $formLive->removeDecorator('DtDdWrapper');
if (!$isSaas) {
$formRecord = new Application_Form_AddShowRR(); $formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates(); $formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates(); $formRebroadcast = new Application_Form_AddShowRebroadcastDates();
@ -963,7 +956,6 @@ SQL;
$formRecord->removeDecorator('DtDdWrapper'); $formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper'); $formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper'); $formRebroadcast->removeDecorator('DtDdWrapper');
}
$when = $formWhen->isValid($data); $when = $formWhen->isValid($data);
if ($when && $formWhen->checkReliantFields($data, true, null, true)) { if ($when && $formWhen->checkReliantFields($data, true, null, true)) {
@ -997,7 +989,6 @@ SQL;
$controller->view->who = $formWho; $controller->view->who = $formWho;
$controller->view->style = $formStyle; $controller->view->style = $formStyle;
$controller->view->live = $formLive; $controller->view->live = $formLive;
if (!$isSaas) {
$controller->view->rr = $formRecord; $controller->view->rr = $formRecord;
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast; $controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$controller->view->rebroadcast = $formRebroadcast; $controller->view->rebroadcast = $formRebroadcast;
@ -1005,7 +996,6 @@ SQL;
//$formRecord->disable(); //$formRecord->disable();
//$formAbsoluteRebroadcast->disable(); //$formAbsoluteRebroadcast->disable();
//$formRebroadcast->disable(); //$formRebroadcast->disable();
}
return false; return false;
} }
@ -1026,7 +1016,6 @@ SQL;
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isSaas = (Application_Model_Preference::GetPlanLevel() != 'disabled');
$record = false; $record = false;
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
@ -1072,7 +1061,6 @@ SQL;
$data["add_show_duration"] = $hValue.":".$mValue; $data["add_show_duration"] = $hValue.":".$mValue;
if (!$isSaas) {
$formRecord = new Application_Form_AddShowRR(); $formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates(); $formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates(); $formRebroadcast = new Application_Form_AddShowRebroadcastDates();
@ -1083,14 +1071,12 @@ SQL;
$record = $formRecord->isValid($data); $record = $formRecord->isValid($data);
}
if ($data["add_show_repeats"]) { if ($data["add_show_repeats"]) {
$repeats = $formRepeats->isValid($data); $repeats = $formRepeats->isValid($data);
if ($repeats) { if ($repeats) {
$repeats = $formRepeats->checkReliantFields($data); $repeats = $formRepeats->checkReliantFields($data);
} }
if (!$isSaas) {
$formAbsoluteRebroadcast->reset(); $formAbsoluteRebroadcast->reset();
//make it valid, results don't matter anyways. //make it valid, results don't matter anyways.
$rebroadAb = 1; $rebroadAb = 1;
@ -1103,10 +1089,8 @@ SQL;
} else { } else {
$rebroad = 1; $rebroad = 1;
} }
}
} else { } else {
$repeats = 1; $repeats = 1;
if (!$isSaas) {
$formRebroadcast->reset(); $formRebroadcast->reset();
//make it valid, results don't matter anyways. //make it valid, results don't matter anyways.
$rebroad = 1; $rebroad = 1;
@ -1119,13 +1103,11 @@ SQL;
} else { } else {
$rebroadAb = 1; $rebroadAb = 1;
} }
}
} }
$who = $formWho->isValid($data); $who = $formWho->isValid($data);
$style = $formStyle->isValid($data); $style = $formStyle->isValid($data);
if ($what && $when && $repeats && $who && $style && $live) { if ($what && $when && $repeats && $who && $style && $live) {
if (!$isSaas) {
if ($record && $rebroadAb && $rebroad) { if ($record && $rebroadAb && $rebroad) {
if ($isAdminOrPM) { if ($isAdminOrPM) {
Application_Model_Show::create($data); Application_Model_Show::create($data);
@ -1152,17 +1134,6 @@ SQL;
return false; return false;
} }
} else {
if ($isAdminOrPM) {
Application_Model_Show::create($data);
}
//send back a new form for the user.
Application_Model_Schedule::createNewFormSections($controller->view);
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
return true;
}
} else { } else {
$controller->view->what = $formWhat; $controller->view->what = $formWhat;
$controller->view->when = $formWhen; $controller->view->when = $formWhen;
@ -1171,11 +1142,9 @@ SQL;
$controller->view->style = $formStyle; $controller->view->style = $formStyle;
$controller->view->live = $formLive; $controller->view->live = $formLive;
if (!$isSaas) {
$controller->view->rr = $formRecord; $controller->view->rr = $formRecord;
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast; $controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$controller->view->rebroadcast = $formRebroadcast; $controller->view->rebroadcast = $formRebroadcast;
}
//$controller->view->addNewShow = !$editShow; //$controller->view->addNewShow = !$editShow;
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml'); //$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
return false; return false;

View File

@ -193,7 +193,8 @@ class Application_Model_Scheduler
} }
} else { } else {
$dynamicFiles = $bl->getListOfFilesUnderLimit(); $dynamicFiles = $bl->getListOfFilesUnderLimit();
foreach ($dynamicFiles as $fileId=>$f) { foreach ($dynamicFiles as $f) {
$fileId = $f['id'];
$file = CcFilesQuery::create()->findPk($fileId); $file = CcFilesQuery::create()->findPk($fileId);
if (isset($file) && $file->visible()) { if (isset($file) && $file->visible()) {
$data["id"] = $file->getDbId(); $data["id"] = $file->getDbId();
@ -250,7 +251,8 @@ class Application_Model_Scheduler
} }
} else { } else {
$dynamicFiles = $bl->getListOfFilesUnderLimit(); $dynamicFiles = $bl->getListOfFilesUnderLimit();
foreach ($dynamicFiles as $fileId=>$f) { foreach ($dynamicFiles as $f) {
$fileId = $f['id'];
$file = CcFilesQuery::create()->findPk($fileId); $file = CcFilesQuery::create()->findPk($fileId);
if (isset($file) && $file->visible()) { if (isset($file) && $file->visible()) {
$data["id"] = $file->getDbId(); $data["id"] = $file->getDbId();
@ -445,7 +447,6 @@ class Application_Model_Scheduler
} else { } else {
$sched = new CcSchedule(); $sched = new CcSchedule();
} }
Logging::info($file);
$sched->setDbStarts($nextStartDT) $sched->setDbStarts($nextStartDT)
->setDbEnds($endTimeDT) ->setDbEnds($endTimeDT)
->setDbCueIn($file['cuein']) ->setDbCueIn($file['cuein'])

View File

@ -359,9 +359,27 @@ SQL;
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
} }
// set file_exists falg to false
// set hidden falg to true
$this->_file->setDbHidden(true); $this->_file->setDbHidden(true);
$this->_file->save(); $this->_file->save();
// need to explicitly update any playlist's and block's length
// that contains the file getting deleted
$fileId = $this->_file->getDbId();
$plRows = CcPlaylistcontentsQuery::create()->filterByDbFileId()->find();
foreach ($plRows as $row) {
$pl = CcPlaylistQuery::create()->filterByDbId($row->getDbPlaylistId($fileId))->findOne();
$pl->setDbLength($pl->computeDbLength(Propel::getConnection(CcPlaylistPeer::DATABASE_NAME)));
$pl->save();
}
$blRows = CcBlockcontentsQuery::create()->filterByDbFileId($fileId)->find();
foreach ($blRows as $row) {
$bl = CcBlockQuery::create()->filterByDbId($row->getDbBlockId())->findOne();
$bl->setDbLength($bl->computeDbLength(Propel::getConnection(CcBlockPeer::DATABASE_NAME)));
$bl->save();
}
} }
/** /**

View File

@ -86,8 +86,14 @@ class CcBlock extends BaseCcBlock {
*/ */
public function computeDbLength(PropelPDO $con) public function computeDbLength(PropelPDO $con)
{ {
$stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_blockcontents" WHERE cc_blockcontents.BLOCK_ID = :p1'); $sql = <<<SQL
$stmt->bindValue(':p1', $this->getDbId()); SELECT SUM(cliplength) FROM cc_blockcontents as bc
JOIN cc_files as f ON bc.file_id = f.id
WHERE BLOCK_ID = :b1
AND f.file_exists = true
SQL;
$stmt = $con->prepare($sql);
$stmt->bindValue(':b1', $this->getDbId());
$stmt->execute(); $stmt->execute();
$length = $stmt->fetchColumn(); $length = $stmt->fetchColumn();

View File

@ -87,7 +87,13 @@ class CcPlaylist extends BaseCcPlaylist {
*/ */
public function computeDbLength(PropelPDO $con) public function computeDbLength(PropelPDO $con)
{ {
$stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_playlistcontents" WHERE cc_playlistcontents.PLAYLIST_ID = :p1'); $sql = <<<SQL
SELECT SUM(cliplength) FROM cc_playlistcontents as pc
JOIN cc_files as f ON pc.file_id = f.id
WHERE PLAYLIST_ID = :p1
AND f.file_exists = true
SQL;
$stmt = $con->prepare($sql);
$stmt->bindValue(':p1', $this->getDbId()); $stmt->bindValue(':p1', $this->getDbId());
$stmt->execute(); $stmt->execute();
$length = $stmt->fetchColumn(); $length = $stmt->fetchColumn();

View File

@ -1,12 +0,0 @@
<?php
class Airtime_View_Helper_IsSaas extends Zend_View_Helper_Abstract{
public function isSaas(){
$plan = Application_Model_Preference::GetPlanLevel();
if($plan == 'disabled'){
return false;
}else{
return true;
}
}
}

View File

@ -2,16 +2,14 @@
<?php echo $this->element->getSubform('preferences_general') ?> <?php echo $this->element->getSubform('preferences_general') ?>
<?php if (!$this->isSaas) { ?> <h3 class="collapsible-header" id="email-server-heading"><span class="arrow-icon"></span>Email / Mail Server Settings</h3>
<h3 class="collapsible-header" id="email-server-heading"><span class="arrow-icon"></span>Email / Mail Server Settings</h3> <div class="collapsible-content" id="email-server-settings">
<div class="collapsible-content" id="email-server-settings" style="display: none;"> <?php echo $this->element->getSubform('preferences_email_server') ?>
<?php echo $this->element->getSubform('preferences_email_server') ?> </div>
</div>
<?php } ?>
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span>SoundCloud Settings</h3> <h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span>SoundCloud Settings</h3>
<div class="collapsible-content" id="soundcloud-settings" style="display: none;"> <div class="collapsible-content" id="soundcloud-settings">
<?php echo $this->element->getSubform('preferences_soundcloud') ?> <?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div> </div>

View File

@ -1,7 +1,6 @@
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form"> <dl class="zend_form">
<!-- Enable System Email option --> <!-- Enable System Email option -->
<?php if( !$this->isSaas ){?>
<dd id="enableSystemEmail-element" class="block-display"> <dd id="enableSystemEmail-element" class="block-display">
<label class="required" for="timezone"> <label class="required" for="timezone">
@ -103,6 +102,5 @@
</dd> </dd>
<?php } ?>
</dl> </dl>
</fieldset> </fieldset>

View File

@ -76,7 +76,6 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<?php if( !$this->isSaas ){?>
<dt id="master_harbor_input_port-label"> <dt id="master_harbor_input_port-label">
<label class="optional" for="master_harbor_input_port"><?php echo $this->element->getElement('master_harbor_input_port')->getLabel() ?> : <label class="optional" for="master_harbor_input_port"><?php echo $this->element->getElement('master_harbor_input_port')->getLabel() ?> :
</label> </label>
@ -105,14 +104,13 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<?php } ?>
<dt id="master_dj_connection_url-label"> <dt id="master_dj_connection_url-label">
<label class="optional" for="master_dj_connection_url" style="white-space: nowrap">Master Source Connection URL: <label class="optional" for="master_dj_connection_url" style="white-space: nowrap">Master Source Connection URL:
</label> </label>
</dt> </dt>
<dd id="master_dj_connection_url-element"> <dd id="master_dj_connection_url-element">
<span id="stream_url"><?php echo $this->element->getElement('master_dj_connection_url')->setValue($this->master_dj_connection_url) ?></span> <span id="stream_url"><?php echo $this->element->getElement('master_dj_connection_url')->setValue($this->master_dj_connection_url) ?></span>
<?php if( !$this->isSaas && !$this->isDemo){?> <?php if(!$this->isDemo){?>
<a href=# id="connection_url_override" style="font-size: 12px;">Override</a>&nbsp;&nbsp; <a href=# id="connection_url_override" style="font-size: 12px;">Override</a>&nbsp;&nbsp;
<span class="override_help_icon"> <span class="override_help_icon">
</span><br> </span><br>
@ -121,7 +119,6 @@
<a href=# id="ok" style="font-size: 12px;">OK</a> <a href=# id="reset" style="font-size: 12px;">RESET</a> <a href=# id="ok" style="font-size: 12px;">OK</a> <a href=# id="reset" style="font-size: 12px;">RESET</a>
</div> </div>
</dd> </dd>
<?php if( !$this->isSaas ){?>
<dt id="dj_harbor_input_port-label"> <dt id="dj_harbor_input_port-label">
<label class="optional" for="dj_harbor_input_port"><?php echo $this->element->getElement('dj_harbor_input_port')->getLabel() ?> : <label class="optional" for="dj_harbor_input_port"><?php echo $this->element->getElement('dj_harbor_input_port')->getLabel() ?> :
</label> </label>
@ -150,14 +147,13 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<?php } ?>
<dt id="live_dj_connection_url-label"> <dt id="live_dj_connection_url-label">
<label class="optional" for="live_dj_connection_url" style="white-space: nowrap">Show Source Connection URL: <label class="optional" for="live_dj_connection_url" style="white-space: nowrap">Show Source Connection URL:
</label> </label>
</dt> </dt>
<dd id="live_dj_connection_url-element"> <dd id="live_dj_connection_url-element">
<span id="stream_url"><?php echo $this->element->getElement('live_dj_connection_url')->setValue($this->live_dj_connection_url) ?></span> <span id="stream_url"><?php echo $this->element->getElement('live_dj_connection_url')->setValue($this->live_dj_connection_url) ?></span>
<?php if( !$this->isSaas && !$this->isDemo ){?> <?php if( !$this->isDemo ){?>
<a href=# id="connection_url_override" style="font-size: 12px;">Override</a>&nbsp;&nbsp; <a href=# id="connection_url_override" style="font-size: 12px;">Override</a>&nbsp;&nbsp;
<span class="override_help_icon"> <span class="override_help_icon">
</span><br> </span><br>

View File

@ -29,16 +29,22 @@
</dd> </dd>
<dd id='sp_criteria-element' class='criteria-element'> <dd id='sp_criteria-element' class='criteria-element'>
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?> <?php for ($i = 0; $i < $this->criteriasLength; $i++) {
// modRowMap holds the number of modifier rows for each criteria element
// i.e. if we have 'Album contains 1' and 'Album contains 2' the modRowMap
// for Album is 2
?>
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) { <?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
// determine if logic label should be 'and' or 'or'
if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = 'or'; if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = 'or';
else $logicLabel = 'and'; else $logicLabel = 'and';
$disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false; $disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false;
// determine if the next row is disabled and only display the logic label if it isn't // determine if the next row is disabled and only display the logic label if it isn't
if ($j == $this->modRowMap[$i]-1 && $i < 25) { if ($j == $this->modRowMap[$i]-1 && $i < 25) {
$n = $i+1; $n = $i+1;
$nextIndex = $n."_0"; $nextIndex = $n."_0";
} elseif ($j+1 < $this->modRowMap[$i]-1) { } elseif ($j+1 <= $this->modRowMap[$i]-1) {
$n = $j+1; $n = $j+1;
$nextIndex = $i."_".$n; $nextIndex = $i."_".$n;

View File

@ -1,5 +1,4 @@
<fieldset class="padded"> <fieldset class="padded">
<?php if( !$this->isSaas ){?>
<dl class="zend_form"> <dl class="zend_form">
<dd id="SupportFeedback-element" style="width:90%;"> <dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text"> <div class="info-text">
@ -38,8 +37,7 @@
</dd> </dd>
</dl> </dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;">(In order to promote your station, "Send support feedback" must be enabled).<br /><br /></div> <div class="info-text" style="clear: both;padding: 4px 0 4px 15px;">(In order to promote your station, "Send support feedback" must be enabled).<br /><br /></div>
<?php }?> <dl id="public-info" style="display:<?php echo "none"?>;">
<dl id="public-info" style="display:<?php echo !$this->isSaas?"none":"block"?>;">
<dt id="stationName-label" class="block-display"> <dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?> <label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small">(Required)</span>: <span class="info-text-small">(Required)</span>:
@ -154,7 +152,6 @@
<?php endif; ?> <?php endif; ?>
</dd> </dd>
</dl> </dl>
<?php if( !$this->isSaas ){?>
<div id="show_what_sending" style="display: block;"> <div id="show_what_sending" style="display: block;">
<fieldset class="display_field toggle closed"> <fieldset class="display_field toggle closed">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend> <legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
@ -182,5 +179,4 @@
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Sourcefabric Privacy Policy</a> <a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Sourcefabric Privacy Policy</a>
<?php }?> <?php }?>
</div> </div>
<?php } ?>
</fieldset> </fieldset>

View File

@ -1,9 +1,3 @@
<?php
$isSaas = true;
if(Application_Model_Preference::GetPlanLevel() == "disabled"){
$isSaas = false;
}
?>
<ul id="nav"> <ul id="nav">
<?php foreach ($this->container as $page) : ?> <?php foreach ($this->container as $page) : ?>
<?php if($this->navigation()->accept($page)) : ?> <?php if($this->navigation()->accept($page)) : ?>
@ -13,10 +7,7 @@
<span class="down"><?php echo $page->getLabel(); ?></span> <span class="down"><?php echo $page->getLabel(); ?></span>
</a> </a>
<ul class="sub"> <ul class="sub">
<?php foreach ($page->getPages() as $sub) : <?php foreach ($page->getPages() as $sub) : ?>
if($isSaas && $sub->getId() == "manage_folder"){
continue;
} ?>
<li> <li>
<a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo $sub->getLabel(); ?></a> <a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo $sub->getLabel(); ?></a>
</li> </li>

View File

@ -20,14 +20,12 @@
<div id="live-stream-override" class="collapsible-content"> <div id="live-stream-override" class="collapsible-content">
<?php echo $this->live; ?> <?php echo $this->live; ?>
</div> </div>
<?php if(!$this->isSaas()){?>
<h3 class="collapsible-header"><span class="arrow-icon"></span>Record & Rebroadcast</h3> <h3 class="collapsible-header"><span class="arrow-icon"></span>Record & Rebroadcast</h3>
<div id="schedule-record-rebroadcast" class="collapsible-content"> <div id="schedule-record-rebroadcast" class="collapsible-content">
<?php echo $this->rr; ?> <?php echo $this->rr; ?>
<?php echo $this->absoluteRebroadcast; ?> <?php echo $this->absoluteRebroadcast; ?>
<?php echo $this->rebroadcast; ?> <?php echo $this->rebroadcast; ?>
</div> </div>
<?php }?>
<h3 class="collapsible-header"><span class="arrow-icon"></span>Who</h3> <h3 class="collapsible-header"><span class="arrow-icon"></span>Who</h3>
<div id="schedule-show-who" class="collapsible-content"> <div id="schedule-show-who" class="collapsible-content">
<?php echo $this->who; ?> <?php echo $this->who; ?>

View File

@ -9,11 +9,11 @@
<li id='lib-new-ws'><a href="#">New Webstream</a></li> <li id='lib-new-ws'><a href="#">New Webstream</a></li>
</ul> </ul>
</div> </div>
<?php if (isset($this->obj)) : ?>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button class="btn btn-inverse" type="submit" id="webstream_save" name="submit">Save</button> <button class="btn btn-inverse" type="submit" id="webstream_save" name="submit">Save</button>
</div> </div>
<?php if (isset($this->obj)) : ?>
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button id="ws_delete" class="btn" <?php if ($this->action == "new"): ?>style="display:none;"<?php endif; ?>aria-disabled="false">Delete</button> <button id="ws_delete" class="btn" <?php if ($this->action == "new"): ?>style="display:none;"<?php endif; ?>aria-disabled="false">Delete</button>
</div> </div>

View File

@ -8,10 +8,16 @@ var AIRTIME = (function(AIRTIME) {
mod = AIRTIME.library; mod = AIRTIME.library;
mod.checkAddButton = function() { mod.checkAddButton = function() {
var selected = mod.getChosenItemsLength(), sortable = $('#spl_sortable'), check = false;
// make sure audioclips are selected and a playlist is currently open. var selected = mod.getChosenItemsLength(),
if (selected !== 0 && sortable.length !== 0) { sortable = $('#spl_sortable:visible'),
check = false,
blockType = $('input[name=sp_type]:checked', '#smart-block-form').val();
// make sure audioclips are selected and a playlist or static block is currently open.
// static blocks have value of 0
// dynamic blocks have value of 1
if (selected !== 0 && (sortable.length !== 0 || blockType === "0")) {
check = true; check = true;
} }
@ -96,6 +102,10 @@ var AIRTIME = (function(AIRTIME) {
return container; return container;
}, },
cursor : 'pointer', cursor : 'pointer',
cursorAt: {
top: 30,
left: 100
},
connectToSortable : '#spl_sortable' connectToSortable : '#spl_sortable'
}); });
}; };

View File

@ -201,7 +201,8 @@ function setSmartBlockEvents() {
/********** CHANGE PLAYLIST TYPE **********/ /********** CHANGE PLAYLIST TYPE **********/
form.find('dd[id="sp_type-element"]').live("change", function(){ form.find('dd[id="sp_type-element"]').live("change", function(){
setupUI(); setupUI();
AIRTIME.library.checkAddButton();
}); });
/********** CRITERIA CHANGE **********/ /********** CRITERIA CHANGE **********/

View File

@ -715,7 +715,7 @@
* =================================== */ * =================================== */
$(document) $(document)
//menu options don't work on tablet so trying this hack for now: // menu options don't work on tablet so trying this hack for now:
// https://github.com/twitter/bootstrap/issues/4550 // https://github.com/twitter/bootstrap/issues/4550
//.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) //.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api', clearMenus) .on('click.dropdown.data-api', clearMenus)

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import abc import abc
import re
import media.monitor.pure as mmp import media.monitor.pure as mmp
import media.monitor.owners as owners import media.monitor.owners as owners
from media.monitor.pure import LazyProperty from media.monitor.pure import LazyProperty
@ -101,6 +102,12 @@ class BaseEvent(Loggable):
self.path = os.path.normpath(raw_event.pathname) self.path = os.path.normpath(raw_event.pathname)
else: self.path = raw_event else: self.path = raw_event
self.owner = owners.get_owner(self.path) self.owner = owners.get_owner(self.path)
owner_re = re.search('stor/imported/(?P<owner>\d+)/', self.path)
if owner_re:
self.logger.info("matched path: %s" % self.path)
self.owner = owner_re.group('owner')
else:
self.logger.info("did not match path: %s" % self.path)
self._pack_hook = lambda: None # no op self._pack_hook = lambda: None # no op
# into another event # into another event

View File

@ -5,26 +5,22 @@ log = get_logger()
owners = {} owners = {}
def reset_owners(): def reset_owners():
""" """ Wipes out all file => owner associations """
Wipes out all file => owner associations
"""
global owners global owners
owners = {} owners = {}
def get_owner(f): def get_owner(f):
""" """ Get the owner id of the file 'f' """
Get the owner id of the file 'f' o = owners[f] if f in owners else -1
""" log.info("Received owner for %s. Owner: %s" % (f, o))
return owners[f] if f in owners else -1 return o
def add_file_owner(f,owner): def add_file_owner(f,owner):
""" """ Associate file f with owner. If owner is -1 then do we will not record
Associate file f with owner. If owner is -1 then do we will not record it it because -1 means there is no owner. Returns True if f is being stored
because -1 means there is no owner. Returns True if f is being stored after after the function. False otherwise. """
the function. False otherwise.
"""
if owner == -1: return False if owner == -1: return False
if f in owners: if f in owners:
if owner != owners[f]: # check for fishiness if owner != owners[f]: # check for fishiness
@ -35,16 +31,12 @@ def add_file_owner(f,owner):
return True return True
def has_owner(f): def has_owner(f):
""" """ True if f is owned by somebody. False otherwise. """
True if f is owned by somebody. False otherwise.
"""
return f in owners return f in owners
def remove_file_owner(f): def remove_file_owner(f):
""" """ Try and delete any association made with file f. Returns true if
Try and delete any association made with file f. Returns true if the the the the association was actually deleted. False otherwise. """
association was actually deleted. False otherwise.
"""
if f in owners: if f in owners:
del owners[f] del owners[f]
return True return True

View File

@ -52,8 +52,6 @@ class RequestSync(Loggable):
self.logger.info("ApiController.php probably crashed, we \ self.logger.info("ApiController.php probably crashed, we \
diagnose this from the fact that it did not return \ diagnose this from the fact that it did not return \
valid json") valid json")
self.logger.info("Trying again after %f seconds" %
self.request_wait)
except Exception as e: self.unexpected_exception(e) except Exception as e: self.unexpected_exception(e)
else: self.logger.info("Request was successful") else: self.logger.info("Request was successful")
self.watcher.flag_done() # poor man's condition variable self.watcher.flag_done() # poor man's condition variable

View File

@ -71,8 +71,10 @@ def get_file_type(file_path):
def calculate_replay_gain(file_path): def calculate_replay_gain(file_path):
""" """
This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value in dB. This function accepts files of type mp3/ogg/flac and returns a calculated
If the value cannot be calculated for some reason, then we default to 0 (Unity Gain). ReplayGain value in dB.
If the value cannot be calculated for some reason, then we default to 0
(Unity Gain).
http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification
""" """
@ -92,20 +94,37 @@ def calculate_replay_gain(file_path):
if file_type: if file_type:
if file_type == 'mp3': if file_type == 'mp3':
if run_process("which mp3gain > /dev/null") == 0: if run_process("which mp3gain > /dev/null") == 0:
out = get_process_output('nice -n %s mp3gain -q "%s" 2> /dev/null' % (nice_level, temp_file_path)) command = 'nice -n %s mp3gain -q "%s" 2> /dev/null' \
search = re.search(r'Recommended "Track" dB change: (.*)', out) % (nice_level, temp_file_path)
out = get_process_output(command)
search = re.search(r'Recommended "Track" dB change: (.*)', \
out)
else: else:
logger.warn("mp3gain not found") logger.warn("mp3gain not found")
elif file_type == 'vorbis': elif file_type == 'vorbis':
if run_process("which vorbisgain > /dev/null && which ogginfo > /dev/null") == 0: command = "which vorbisgain > /dev/null && which ogginfo > \
run_process('nice -n %s vorbisgain -q -f "%s" 2>/dev/null >/dev/null' % (nice_level,temp_file_path)) /dev/null"
if run_process(command) == 0:
command = 'nice -n %s vorbisgain -q -f "%s" 2>/dev/null \
>/dev/null' % (nice_level,temp_file_path)
run_process(command)
out = get_process_output('ogginfo "%s"' % temp_file_path) out = get_process_output('ogginfo "%s"' % temp_file_path)
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out) search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
else: else:
logger.warn("vorbisgain/ogginfo not found") logger.warn("vorbisgain/ogginfo not found")
elif file_type == 'flac': elif file_type == 'flac':
if run_process("which metaflac > /dev/null") == 0: if run_process("which metaflac > /dev/null") == 0:
out = get_process_output('nice -n %s metaflac --show-tag=REPLAYGAIN_TRACK_GAIN "%s"' % (nice_level, temp_file_path))
command = 'nice -n %s metaflac --add-replay-gain "%s"' \
% (nice_level, temp_file_path)
run_process(command)
command = 'nice -n %s metaflac \
--show-tag=REPLAYGAIN_TRACK_GAIN "%s"' \
% (nice_level, temp_file_path)
out = get_process_output(command)
search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out) search = re.search(r'REPLAYGAIN_TRACK_GAIN=(.*) dB', out)
else: logger.warn("metaflac not found") else: logger.warn("metaflac not found")

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import unittest import unittest
import media.monitor.owners as owners from media.monitor import owners
class TestMMP(unittest.TestCase): class TestMMP(unittest.TestCase):
def setUp(self): def setUp(self):