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

This commit is contained in:
Martin Konecny 2012-04-16 18:38:55 -04:00
commit 2c4df4853a
8 changed files with 54 additions and 38 deletions

View File

@ -50,10 +50,9 @@ class DashboardController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::GetCurrentShow();
$show_id = isset($show['id'])?$show['id']:0;
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if($user->canSchedule($show_id) && ($source_connected || $sourcename == 'scheduled_play')){
$change_status_to = "on";

View File

@ -213,6 +213,12 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
$live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"];
Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url);
Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url);
// extra info that goes into cc_stream_setting
Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]);
Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]);
@ -232,9 +238,9 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
}
$live_stream_subform->updateConnectionURLs();
}
$live_stream_subform->updateVariables();
$this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings).";
$this->view->num_stream = $num_of_stream;

View File

@ -89,12 +89,12 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Schedule::createNewFormSections($this->view);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
$user = Application_Model_User::GetCurrentUser();
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
$this->view->preloadShowForm = true;
}
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
}
@ -227,7 +227,7 @@ class ScheduleController extends Zend_Controller_Action
$showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart());
$showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd());
if ($epochNow < $showStartLocalDT->getTimestamp()) {
if ($epochNow < $showEndLocalDT->getTimestamp()) {
if ( ($isAdminOrPM || $isDJ)
&& !$instance->isRecorded()
@ -586,7 +586,13 @@ class ScheduleController extends Zend_Controller_Action
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
if ($show->isStartDateTimeInPast()){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
// for a non-repeating show, we should never allow user to change the start time.
// for the repeating show, we should allow because the form works as repeating template form
if(!$showInstance->getShow()->isRepeating()){
$formWhen->disableStartDateAndTime();
}else{
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
}
}
//need to get the days of the week in the php timezone (for the front end).
@ -684,7 +690,7 @@ class ScheduleController extends Zend_Controller_Action
$user = Application_Model_User::GetCurrentUser();
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))){
Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
@ -765,7 +771,9 @@ class ScheduleController extends Zend_Controller_Action
//array key does not exist. We need to repopulate this entry from the db.
//The start date will be returned in UTC time, so lets convert it to local time.
$dt = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartDate());
$startTime = Application_Common_DateHelper::ConvertToLocalDateTime($show->getStartTime());
$data['add_show_start_date'] = $dt->format("Y-m-d");
$data['add_show_start_time'] = $startTime->format("H:i");
$validateStartDate = false;
}

View File

@ -131,5 +131,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$element->setAttrib('disabled','disabled');
}
}
public function disableStartDateAndTime(){
$elements = array($this->getElement('add_show_start_date'), $this->getElement('add_show_start_time'));
foreach ($elements as $element)
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('disabled','disabled');
}
}
}
}

View File

@ -78,26 +78,9 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_mount);
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
$master_dj_connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url;
$live_dj_connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url;
if($m_port=="" || $m_mount==""){
$master_dj_connection_url = "N/A";
}
if($l_port=="" || $l_mount==""){
$live_dj_connection_url = "N/A";
}
$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,))
));
}
public function updateConnectionURLs(){
public function updateVariables(){
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
@ -116,8 +99,10 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$live_dj_connection_url = "N/A";
}
$overrideDescription = "If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. For more detail, please read the <a target=\"_blank\" href=\"http://manuals.sourcefabric.org/\">Airtime manual</a>.";
$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,))
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,'overrideDescription' => $overrideDescription))
));
}

View File

@ -18,7 +18,7 @@ class Logging {
}
public static function toString($p_msg){
if (is_array($p_msg)){
if (is_array($p_msg) || is_object($p_msg)){
return print_r($p_msg, true);
} else {
return $p_msg;

View File

@ -569,8 +569,10 @@ class Application_Model_ShowInstance {
$time = $this->_showInstance->getDbTimeFilled();
if ($time != "00:00:00") {
$milliseconds = substr(round(substr($time, 8), 2), 1);
$time = substr($time, 0, 8) . $milliseconds;
$time_arr = explode(".", $time);
$time_arr[1] = "." . $time_arr[1];
$milliseconds = number_format(round($time_arr[1], 2), 2);
$time = $time_arr[0] . substr($milliseconds, 1);
} else {
$time = "00:00:00.00";
}

View File

@ -77,11 +77,11 @@
</dt>
<dd id="master_dj_connection_url-element">
<span id="stream_url"><?php echo $this->master_dj_connection_url ?></span> <a href=# id="connection_url_override" style="font-size: 12px;">override</a>&nbsp;&nbsp;
<span class='info-tooltip'>
<span>
This is the URL used by remote sources to connect to Airtime. If Airtime is behind a router or firewall, you may need to configure port forwarding. For details, please read the <a target="_blank" href="http://manuals.sourcefabric.org/">Airtime manual</a>.
</span>
</span><br>
<span class='info-tooltip'>
<span>
<?php echo $this->overrideDescription ?>
</span>
</span><br>
<div id="master_dj_connection_url_tb" style="display:none"><input type="text"><a href=# id="ok" style="font-size: 12px;">OK</a> <a href=# id="reset" style="font-size: 12px;">RESET</a></div>
</dd>
<dt id="dj_harbor_input_port-label">
@ -117,7 +117,12 @@
</label>
</dt>
<dd id="live_dj_connection_url-element">
<span id="stream_url"><?php echo $this->live_dj_connection_url ?></span> <a href=# id="connection_url_override" style="font-size: 12px;">override</a>
<span id="stream_url"><?php echo $this->live_dj_connection_url ?></span> <a href=# id="connection_url_override" style="font-size: 12px;">override</a>&nbsp;&nbsp;
<span class='info-tooltip'>
<span>
<?php echo $this->overrideDescription?>
</span>
</span><br>
<div id="live_dj_connection_url_tb" style="display:none"><input type="text"><a href=# id="ok" style="font-size: 12px;">OK</a> <a href=# id="reset" style="font-size: 12px;">RESET</a></div>
</dd>
</dl>