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

This commit is contained in:
Paul Baranowski 2011-09-06 15:28:57 -04:00
commit 37415f33d4
16 changed files with 302 additions and 136 deletions

View File

@ -106,15 +106,17 @@ class PreferenceController extends Zend_Controller_Action
public function directoryConfigAction()
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
$this->view->form = $watched_dirs_pref;
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
$this->view->form = $watched_dirs_pref;
}
}
public function streamSettingAction()
@ -186,6 +188,7 @@ class PreferenceController extends Zend_Controller_Action
}
}
$this->view->num_stream = $num_of_stream;
$this->view->disable_stream_conf = Application_Model_Preference::GetDisableStreamConf();
$this->view->form = $form;
}

View File

@ -389,6 +389,8 @@ class ScheduleController extends Zend_Controller_Action
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
return;
}
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$showInstanceId = $this->_getParam('id');
@ -397,27 +399,18 @@ class ScheduleController extends Zend_Controller_Action
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = false;
$showInstance = new ShowInstance($showInstanceId);
@ -461,42 +454,55 @@ class ScheduleController extends Zend_Controller_Action
'add_show_end_date' => $displayedEndDate->format("Y-m-d"),
'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
'add_show_rebroadcast' => $show->isRebroadcast()));
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
$rebroadcastsRelative = $show->getRebroadcastsRelative();
$rebroadcastFormValues = array();
$i = 1;
foreach ($rebroadcastsRelative as $rebroadcast){
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formRebroadcast->populate($rebroadcastFormValues);
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
$rebroadcastAbsoluteFormValues = array();
$i = 1;
foreach ($rebroadcastsAbsolute as $rebroadcast){
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
$hosts = array();
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
foreach($showHosts as $showHost){
array_push($hosts, $showHost->getDbHost());
}
$formWho->populate(array('add_show_hosts' => $hosts));
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
'add_show_color' => $show->getColor()));
if(!$isSaas){
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
'add_show_rebroadcast' => $show->isRebroadcast()));
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
$rebroadcastsRelative = $show->getRebroadcastsRelative();
$rebroadcastFormValues = array();
$i = 1;
foreach ($rebroadcastsRelative as $rebroadcast){
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formRebroadcast->populate($rebroadcastFormValues);
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
$rebroadcastAbsoluteFormValues = array();
$i = 1;
foreach ($rebroadcastsAbsolute as $rebroadcast){
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
}
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
$this->view->entries = 5;
@ -533,24 +539,21 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null;
}
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$record = false;
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$what = $formWhat->isValid($data);
$when = $formWhen->isValid($data);
@ -581,70 +584,96 @@ class ScheduleController extends Zend_Controller_Action
$data["add_show_duration"] = $hValue.":".$mValue;
if(!$isSaas){
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
//If show is a new show (not updated), then get
//isRecorded from POST data. Otherwise get it from
//the database since the user is not allowed to
//update this option.
if ($data['add_show_id'] != -1){
$data['add_show_record'] = $show->isRecorded();
$record = $formRecord->isValid($data);
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
} else {
$record = $formRecord->isValid($data);
}
}
if($data["add_show_repeats"]) {
$repeats = $formRepeats->isValid($data);
if($repeats) {
$repeats = $formRepeats->checkReliantFields($data);
}
$formAbsoluteRebroadcast->reset();
//make it valid, results don't matter anyways.
$rebroadAb = 1;
if ($data["add_show_rebroadcast"]) {
$rebroad = $formRebroadcast->isValid($data);
if($rebroad) {
$rebroad = $formRebroadcast->checkReliantFields($data);
if(!$isSaas){
$formAbsoluteRebroadcast->reset();
//make it valid, results don't matter anyways.
$rebroadAb = 1;
if ($data["add_show_rebroadcast"]) {
$rebroad = $formRebroadcast->isValid($data);
if($rebroad) {
$rebroad = $formRebroadcast->checkReliantFields($data);
}
}
else {
$rebroad = 1;
}
}
else {
$rebroad = 1;
}
}
else {
$formRebroadcast->reset();
//make it valid, results don't matter anyways.
$repeats = 1;
$rebroad = 1;
if ($data["add_show_rebroadcast"]) {
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
if($rebroadAb) {
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
if(!$isSaas){
$formRebroadcast->reset();
//make it valid, results don't matter anyways.
$rebroad = 1;
if ($data["add_show_rebroadcast"]) {
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
if($rebroadAb) {
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
}
}
else {
$rebroadAb = 1;
}
}
else {
$rebroadAb = 1;
}
}
$who = $formWho->isValid($data);
$style = $formStyle->isValid($data);
//If show is a new show (not updated), then get
//isRecorded from POST data. Otherwise get it from
//the database since the user is not allowed to
//update this option.
$record = false;
if ($data['add_show_id'] != -1){
$data['add_show_record'] = $show->isRecorded();
$record = $formRecord->isValid($data);
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
} else {
$record = $formRecord->isValid($data);
}
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Show::create($data);
if ($what && $when && $repeats && $who && $style) {
if(!$isSaas){
if($record && $rebroadAb && $rebroad){
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Show::create($data);
}
//send back a new form for the user.
Schedule::createNewFormSections($this->view);
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
}
}else{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
Show::create($data);
}
//send back a new form for the user.
Schedule::createNewFormSections($this->view);
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
}
//send back a new form for the user.
Schedule::createNewFormSections($this->view);
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
}
else {
$this->view->what = $formWhat;
@ -652,9 +681,11 @@ class ScheduleController extends Zend_Controller_Action
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
if(!$isSaas){
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
}
$this->view->addNewShow = true;
//the form still needs to be "update" since

View File

@ -20,6 +20,9 @@ class Application_Form_StreamSetting extends Zend_Form
->setRequired(false)
->setValue(($setting['output_sound_device'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
$output_sound_device->setAttrib("readonly", true);
}
$this->addElement($output_sound_device);
}

View File

@ -36,10 +36,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$this->setIsArray(true);
$this->setElementsBelongTo($prefix."_data");
$disable_all = false;
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
$disable_all = true;
}
$enable = new Zend_Form_Element_Checkbox('enable');
$enable->setLabel('Enabled:')
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
->setDecorators(array('ViewHelper'));
if($disable_all){
$enable->setAttrib("disabled", "disabled");
}
$this->addElement($enable);
$type = new Zend_Form_Element_Select('type');
@ -47,6 +55,9 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
->setMultiOptions($stream_types)
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
->setDecorators(array('ViewHelper'));
if($disable_all){
$type->setAttrib("disabled", "disabled");
}
$this->addElement($type);
$bitrate = new Zend_Form_Element_Select('bitrate');
@ -54,6 +65,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
->setMultiOptions($stream_bitrates)
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
->setDecorators(array('ViewHelper'));
if($disable_all){
$bitrate->setAttrib("disabled", "disabled");
}
$this->addElement($type);
$this->addElement($bitrate);
$output = new Zend_Form_Element_Select('output');
@ -61,54 +76,81 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
->setDecorators(array('ViewHelper'));
if($disable_all){
$output->setAttrib("disabled", "disabled");
}
$this->addElement($output);
$host = new Zend_Form_Element_Text('host');
$host->setLabel("Server")
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$host->setAttrib("disabled", "disabled");
}
$this->addElement($host);
$port = new Zend_Form_Element_Text('port');
$port->setLabel("Port")
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$port->setAttrib("disabled", "disabled");
}
$this->addElement($port);
$pass = new Zend_Form_Element_Text('pass');
$pass->setLabel("Password")
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$pass->setAttrib("disabled", "disabled");
}
$this->addElement($pass);
$genre = new Zend_Form_Element_Text('genre');
$genre->setLabel("Genre")
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$genre->setAttrib("disabled", "disabled");
}
$this->addElement($genre);
$url = new Zend_Form_Element_Text('url');
$url->setLabel("URL")
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$url->setAttrib("disabled", "disabled");
}
$this->addElement($url);
$description = new Zend_Form_Element_Text('description');
$description->setLabel("Name/Description")
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$description->setAttrib("disabled", "disabled");
}
$this->addElement($description);
$mount = new Zend_Form_Element_Text('mount');
$mount->setLabel("Mount Point")
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$mount->setAttrib("disabled", "disabled");
}
$this->addElement($mount);
$user = new Zend_Form_Element_Text('user');
$user->setLabel("Username")
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
->setDecorators(array('ViewHelper'));
if($disable_all){
$user->setAttrib("disabled", "disabled");
}
$this->addElement($user);
$this->setDecorators(array(

View File

@ -426,5 +426,13 @@ class Application_Model_Preference
public static function GetTrialEndingDate(){
return Application_Model_Preference::GetValue("trial_end_date");
}
public static function SetDisableStreamConf($bool){
Application_Model_Preference::SetValue("disable_stream_conf", $bool);
}
public static function GetDisableStreamConf(){
return Application_Model_Preference::GetValue("disable_stream_conf");
}
}

View File

@ -750,33 +750,25 @@ class Schedule {
}
public static function createNewFormSections($p_view){
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$p_view->what = $formWhat;
$p_view->when = $formWhen;
$p_view->repeats = $formRepeats;
$p_view->who = $formWho;
$p_view->style = $formStyle;
$p_view->rr = $formRecord;
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$p_view->rebroadcast = $formRebroadcast;
$p_view->addNewShow = true;
$formWhat->populate(array('add_show_id' => '-1'));
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
@ -786,6 +778,21 @@ class Schedule {
'add_show_duration' => '1h'));
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
if(!$isSaas){
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formRecord->removeDecorator('DtDdWrapper');
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
$formRebroadcast->removeDecorator('DtDdWrapper');
$p_view->rr = $formRecord;
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$p_view->rebroadcast = $formRebroadcast;
}
$p_view->addNewShow = true;
}
}

View File

@ -770,7 +770,7 @@ class Show {
$showId = $ccShow->getDbId();
$isRecorded = ($data['add_show_record']) ? 1 : 0;
$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;
if ($data['add_show_id'] != -1){
$show = new Show($showId);
@ -804,8 +804,7 @@ class Show {
$utcStartDateTime->add(new DateInterval("P".$daysAdd."D"));
}
if (is_null($endDateTime) || $utcStartDateTime->getTimestamp <= $endDateTime->getTimestamp()) {
if (is_null($endDateTime) || $utcStartDateTime->getTimestamp() <= $endDateTime->getTimestamp()) {
$showDay = new CcShowDays();
$showDay->setDbFirstShow($utcStartDateTime->format("Y-m-d"));
$showDay->setDbLastShow($endDate);

View File

@ -0,0 +1,12 @@
<?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

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

View File

@ -18,8 +18,10 @@
echo $this->form->getSubform("s".$i."_subform");
}
?>
<?php if($this->disable_stream_conf != "true"){?>
<div class="button-bar bottom" id="submit-element">
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
</div>
<?php }?>
</form>
</div>

View File

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

View File

@ -5,6 +5,7 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');

View File

@ -9,7 +9,7 @@ function showErrorSections() {
});
}
function rebuildStreamURL(ele){
div = ele.closest("div")
var div = ele.closest("div")
host = div.find("input:[id$=-host]").val()
port = div.find("input:[id$=-port]").val()
mount = div.find("input:[id$=-mount]").val()
@ -27,19 +27,36 @@ function rebuildStreamURL(ele){
}
div.find("#stream_url").html(streamurl)
}
function restrictOggBitrate(ele, on){
var div = ele.closest("div")
if(on){
div.find("select[id$=data-bitrate]").find("option[value='48']").attr('selected','selected');
div.find("select[id$=data-bitrate]").find("option[value='24']").attr("disabled","disabled");
div.find("select[id$=data-bitrate]").find("option[value='32']").attr("disabled","disabled");
}else{
div.find("select[id$=data-bitrate]").find("option[value='24']").attr("disabled","");
div.find("select[id$=data-bitrate]").find("option[value='32']").attr("disabled","");
}
}
function hideForShoutcast(ele){
ele.closest("div").find("#outputMountpoint-label").hide()
ele.closest("div").find("#outputMountpoint-element").hide()
ele.closest("div").find("#outputUser-label").hide()
ele.closest("div").find("#outputUser-element").hide()
var div = ele.closest("div")
div.find("#outputMountpoint-label").hide()
div.find("#outputMountpoint-element").hide()
div.find("#outputUser-label").hide()
div.find("#outputUser-element").hide()
div.find("select[id$=data-type]").find("option[value='mp3']").attr('selected','selected');
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","disabled");
restrictOggBitrate(ele, false)
}
function showForIcecast(ele){
ele.closest("div").find("#outputMountpoint-label").show()
ele.closest("div").find("#outputMountpoint-element").show()
ele.closest("div").find("#outputUser-label").show()
ele.closest("div").find("#outputUser-element").show()
var div = ele.closest("div")
div.find("#outputMountpoint-label").show()
div.find("#outputMountpoint-element").show()
div.find("#outputUser-label").show()
div.find("#outputUser-element").show()
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","");
}
$(document).ready(function() {
@ -62,7 +79,21 @@ $(document).ready(function() {
return false;
}).next().hide();
$("select[id$=-output]").change(function(){
$("select[id$=data-type]").change(function(){
if($(this).val() == 'ogg'){
restrictOggBitrate($(this), true)
}else{
restrictOggBitrate($(this), false)
}
})
$("select[id$=data-type]").each(function(){
if($(this).val() == 'ogg'){
restrictOggBitrate($(this), true)
}
})
$("select[id$=data-output]").change(function(){
if($(this).val() == 'shoutcast'){
hideForShoutcast($(this))
}else{
@ -70,7 +101,7 @@ $(document).ready(function() {
}
})
$("select[id$=-output]").each(function(){
$("select[id$=data-output]").each(function(){
if($(this).val() == 'shoutcast'){
hideForShoutcast($(this))
}

View File

@ -56,6 +56,7 @@ class AirtimeInstall{
INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3');
INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128');
INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
@ -244,6 +245,17 @@ class Airtime200Upgrade{
class ConvertToUtc{
public static function setPhpDefaultTimeZoneToSystemTimezone(){
//we can get the default system timezone on debian/ubuntu by reading "/etc/timezone"
$filename = "/etc/timezone";
$handle = fopen($filename, "r");
$contents = trim(fread($handle, filesize($filename)));
echo "System timezone detected as: $contents".PHP_EOL;
fclose($handle);
date_default_timezone_set($contents);
}
public static function convert_cc_playlist(){
/* cc_playlist has a field that keeps track of when the playlist was last modified. */
$playlists = CcPlaylistQuery::create()->find();
@ -488,6 +500,7 @@ AirtimeInstall::CreateSymlinksToUtils();
/* Airtime 2.0.0 starts interpreting all database times in UTC format. Prior to this, all the times
* were stored using the local time zone. Let's convert to UTC time. */
ConvertToUtc::setPhpDefaultTimeZoneToSystemTimezone();
ConvertToUtc::convert_cc_playlist();
ConvertToUtc::convert_cc_schedule();
ConvertToUtc::convert_cc_show_days();

View File

@ -28,7 +28,4 @@ SCRIPT=`readlink -f $0`
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
invokePwd=$PWD
cd $SCRIPTPATH
php -q airtime-log.php "$@" || exit 1
php -q $SCRIPTPATH/airtime-log.php "$@" || exit 1

View File

@ -41,9 +41,12 @@ function viewSpecificLog($key){
} else printUsage();
}
function dumpAllLogs(){
function dumpAllLogs(){
$dateStr = gmdate("Y-m-d-H-i-s");
$filename = "/tmp/airtime-log-all-$dateStr.tgz";
$dir = getcwd();
$filename = "$dir/airtime-log-all-$dateStr.tgz";
echo "Creating Airtime logs tgz file at $filename";
$command = "tar cfz $filename /var/log/airtime 2>/dev/null";
exec($command);
@ -54,7 +57,10 @@ function dumpSpecificLog($key){
if (isKeyValid($key)){
$dateStr = gmdate("Y-m-d-H-i-s");
$filename = "/tmp/airtime-log-$key-$dateStr.tgz";
$dir = getcwd();
$filename = "$dir/airtime-log-$key-$dateStr.tgz";
echo "Creating Airtime logs tgz file at $filename";
$dir = dirname($log_files[$key]);
$command = "tar cfz $filename $dir 2>/dev/null";