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

This commit is contained in:
Martin Konecny 2011-11-16 12:35:44 -05:00
commit 1e79363263
9 changed files with 52 additions and 17 deletions

View File

@ -110,14 +110,14 @@ class ScheduleController extends Zend_Controller_Action
{ {
$deltaDay = $this->_getParam('day'); $deltaDay = $this->_getParam('day');
$deltaMin = $this->_getParam('min'); $deltaMin = $this->_getParam('min');
$showInstanceId = $this->_getParam('showInstanceId'); $showId = $this->_getParam('showId');
$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);
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) { if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
try{ try{
$show = new Application_Model_ShowInstance($showInstanceId); $show = new Application_Model_Show($showId);
}catch(Exception $e){ }catch(Exception $e){
$this->view->show_error = true; $this->view->show_error = true;
return false; return false;
@ -296,12 +296,12 @@ class ScheduleController extends Zend_Controller_Action
public function getCurrentPlaylistAction() public function getCurrentPlaylistAction()
{ {
$range = Application_Model_Schedule::GetPlayOrderRange(); $range = Application_Model_Schedule::GetPlayOrderRange();
/* Convert all UTC times to localtime before sending back to user. */ /* Convert all UTC times to localtime before sending back to user. */
if (isset($range["previous"])){ if (isset($range["previous"])){
$range["previous"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["starts"]); $range["previous"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["starts"]);
$range["previous"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["ends"]); $range["previous"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["ends"]);
} }
if (isset($range["current"])){ if (isset($range["current"])){
@ -312,10 +312,10 @@ class ScheduleController extends Zend_Controller_Action
$range["next"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["starts"]); $range["next"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["starts"]);
$range["next"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]); $range["next"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
} }
Application_Model_Show::ConvertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp")); Application_Model_Show::ConvertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
$this->view->entries = $range; $this->view->entries = $range;
} }

View File

@ -155,7 +155,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
} }
$this->addElement($user); $this->addElement($user);
$liquidsopa_error_msg = "Getting infomation from the server.."; $liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "liquidsoap_error_msg"=>$liquidsopa_error_msg)) array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "liquidsoap_error_msg"=>$liquidsopa_error_msg))

View File

@ -105,6 +105,35 @@ class Application_Model_Show {
return $res; return $res;
} }
public function resizeShow($deltaDay, $deltaMin)
{
global $CC_DBC;
$hours = $deltaMin/60;
if($hours > 0)
$hours = floor($hours);
else
$hours = ceil($hours);
$mins = abs($deltaMin%60);
//current timesamp in UTC.
$current_timestamp = Application_Model_DateHelper::ConvertToUtcDateTime(date("Y-m-d H:i:s"))->format("Y-m-d H:i:s");
//update all cc_show_instances that are in the future.
$sql = "UPDATE cc_show_instances SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
WHERE (show_id = {$this->_showId} AND starts > '$current_timestamp');";
//update cc_show_days so future shows can be created with the new duration.
$sql = $sql . " UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
WHERE show_id = {$this->_showId}";
//do both the queries at once.
$CC_DBC->query($sql);
Application_Model_RabbitMq::PushSchedule();
}
public function cancelShow($day_timestamp) public function cancelShow($day_timestamp)
{ {
global $CC_DBC; global $CC_DBC;

View File

@ -239,6 +239,11 @@ class Application_Model_ShowInstance {
Application_Model_RabbitMq::PushSchedule(); Application_Model_RabbitMq::PushSchedule();
} }
/*
* FUNCTION SHOULD NOT BE CALLED
* - we are removing ability to resize just a single show instance
* -please use the resize method on the Show.php class.
*/
public function resizeShow($deltaDay, $deltaMin) public function resizeShow($deltaDay, $deltaMin)
{ {
global $CC_DBC; global $CC_DBC;

View File

@ -10,7 +10,7 @@
<h2>Page not found!</h2> <h2>Page not found!</h2>
<p>Looks like the page you were looking for doesn't exist!</p> <p>Looks like the page you were looking for doesn't exist!</p>
<div class="button-bar"> <div class="button-bar">
<a class="toggle-button" href="dashboard/help">Help</a> <a class="toggle-button" href="<?php echo $this->baseUrl('dashboard/help'); ?>">Help</a>
</div> </div>
</div> </div>
</body> </body>

View File

@ -5,10 +5,7 @@
<div class="stream-setting-content" <?php echo $this->stream_number != '1'?'style="display: none;':''?> id="<?=$s_name?>-config"> <div class="stream-setting-content" <?php echo $this->stream_number != '1'?'style="display: none;':''?> id="<?=$s_name?>-config">
<fieldset class="padded"> <fieldset class="padded">
<dl class="zend_form clearfix"> <dl class="zend_form clearfix">
<dt id="<?=$s_name?>Liquidsoap-error-msg-label"> <dd id="<?=$s_name?>Liquidsoap-error-msg-element" class="liquidsoap_status">
<label>Liquidsoap Status: </label>
</dt>
<dd id="<?=$s_name?>Liquidsoap-error-msg-element">
<?php echo $this->liquidsoap_error_msg?> <?php echo $this->liquidsoap_error_msg?>
</dd> </dd>
<dt id="<?=$s_name?>Enabled-label"> <dt id="<?=$s_name?>Enabled-label">

View File

@ -1095,6 +1095,10 @@ h2#scheduled_playlist_name span {
width:60%; width:60%;
} }
.simple-formblock .liquidsoap_status{
width: 95%;
}
.simple-formblock dd.block-display { .simple-formblock dd.block-display {
width: 100%; width: 100%;
} }
@ -2425,4 +2429,4 @@ dd .stream-status {
} }
.status-disabled h3 { .status-disabled h3 {
color:#646664; color:#646664;
} }

View File

@ -90,9 +90,9 @@ function checkLiquidsoapStatus(){
} }
var html var html
if(status == "OK"){ if(status == "OK"){
html = '<div class="stream-status status-good"><h3>Streaming server connection is working</h3></div>' html = '<div class="stream-status status-good"><h3>Connected to the streaming server</h3></div>'
}else if(status == "N/A"){ }else if(status == "N/A"){
html = '<div class="stream-status status-error"><h3>Cannot connect to the streaming server</h3><p>This stream is disabled</p></div>' html = '<div class="stream-status status-disabled"><h3>The stream is disabled</h3></div>'
}else{ }else{
html = '<div class="stream-status status-error"><h3>Can not connect to the streaming server</h3><p>'+status+'</p></div>' html = '<div class="stream-status status-error"><h3>Can not connect to the streaming server</h3><p>'+status+'</p></div>'
} }

View File

@ -319,7 +319,7 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
url = '/Schedule/resize-show/format/json'; url = '/Schedule/resize-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, {day: dayDelta, min: minuteDelta, showId: event.showId},
function(json){ function(json){
if(json.show_error == true){ if(json.show_error == true){
alertShowErrorAndReload(); alertShowErrorAndReload();