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

This commit is contained in:
Naomi Aro 2011-06-23 17:35:01 +02:00
commit 7876552b38
19 changed files with 197 additions and 139 deletions

View file

@ -1,6 +1,6 @@
<?php
define('AIRTIME_VERSION', '1.9.0-devel');
define('AIRTIME_VERSION', '1.9.0-beta1');
define('AIRTIME_COPYRIGHT_DATE', '2010-2011');
define('AIRTIME_REST_VERSION', '1.1');

View file

@ -79,7 +79,7 @@ class LibraryController extends Zend_Controller_Action
$file_id = $this->_getParam('id', null);
$file = StoredFile::Recall($file_id);
$url = $file->getFileUrl().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
$url = $file->getRelativeFileUrl().'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
'title' => 'Download');

View file

@ -543,8 +543,14 @@ class ScheduleController extends Zend_Controller_Action
if($when) {
$when = $formWhen->checkReliantFields($data, $startDateModified);
}
// format add_show_duration value to hh:mm so it can be compatible with
// existing code
//The way the following code works is that is parses the hour and
//minute from a string with the format "1h 20m" or "2h" or "36m".
//So we are detecting whether an hour or minute value exists via strpos
//and then parse appropriately. A better way to do this in the future is
//actually pass the format from javascript in the format hh:mm so we don't
//have to do this extra String parsing.
$hPos = strpos($data["add_show_duration"], 'h');
$mPos = strpos($data["add_show_duration"], 'm');
@ -555,7 +561,8 @@ class ScheduleController extends Zend_Controller_Action
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
}
if($mPos !== false){
$mValue = trim(substr($data["add_show_duration"], $hPos+1, -1 ));
$hPos = $hPos === FALSE ? 0 : $hPos+1;
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
}
$data["add_show_duration"] = $hValue.":".$mValue;

View file

@ -1,7 +1,6 @@
<?php
class Application_Form_PlaylistMetadata extends Zend_Form_SubForm
{
class Application_Form_PlaylistMetadata extends Zend_Form{
public function init()
{

View file

@ -88,10 +88,10 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
->addValidator('Count', false, 1)
->addValidator('Extension', false, 'jpg,png,gif')
->addValidator('ImageSize', false, array(
'minwidth' => 180,
'minheight' => 180,
'maxwidth' => 1000,
'maxheight' => 1000));
'minwidth' => 200,
'minheight' => 200,
'maxwidth' => 600,
'maxheight' => 600));
$this->addElement($upload);
//enable support feedback
@ -121,6 +121,7 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
'required' => false,
'filters' => array('StringTrim'),
'readonly' => true,
'cols' => 61,
'value' => Application_Model_Preference::GetSystemInfo(),
'decorators' => array(
'ViewHelper'

View file

@ -91,7 +91,7 @@ class Playlist {
{
$seconds = $p_seconds;
$milliseconds = intval(($seconds - intval($seconds)) * 1000);
$milliStr = str_pad($milliseconds, 3, '0');
$milliStr = str_pad($milliseconds, 3, '0', STR_PAD_LEFT);
$hours = floor($seconds / 3600);
$seconds -= $hours * 3600;
$minutes = floor($seconds / 60);

View file

@ -311,7 +311,7 @@ class Application_Model_Preference
$outputArray['STATION_WEB_SITE'] = Application_Model_Preference::GetStationWebSite();
$outputArray['STATION_COUNTRY'] = Application_Model_Preference::GetStationCountry();
$outputArray['STATION_CITY'] = Application_Model_Preference::GetStationCity();
$outputArrat['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
$outputArray['STATION_DESCRIPTION'] = Application_Model_Preference::GetStationDescription();
// get web server info
$url = $systemInfoArray["AIRTIME_VERSION_URL"];
@ -328,11 +328,13 @@ class Application_Model_Preference
$outputArray['NUM_OF_PAST_SHOWS'] = ShowInstance::GetShowInstanceCount(date("Y-m-d H:i:s"));
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
$outputArray = array_merge($outputArray, $systemInfoArray);
$outputArray = array_merge($systemInfoArray, $outputArray);
$outputString = "\n";
foreach($outputArray as $key => $out){
$outputString .= $key.' : '.$out."\n";
if(!empty($out)){
$outputString .= $key.' : '.$out."\n";
}
}
if($returnArray){
$outputArray['LOGOIMG'] = Application_Model_Preference::GetStationLogo();

View file

@ -445,6 +445,16 @@ class StoredFile {
return "http://$CC_CONFIG[baseUrl]:$CC_CONFIG[basePort]/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
}
/**
* Sometimes we want a relative URL and not a full URL. See bug
* http://dev.sourcefabric.org/browse/CC-2403
*/
public function getRelativeFileUrl()
{
global $CC_CONFIG;
return "api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
}
public static function Insert($md=null)
{
$file = new CcFiles();

View file

@ -1,4 +1,6 @@
<h3 class="plain">Playlist Metadata</h3>
<form method="post" action="" enctype="application/x-www-form-urlencoded">
<?php echo $this->fieldset; ?>
<fieldset>
<?php echo $this->fieldset; ?>
</fieldset>
</form>

View file

@ -114,10 +114,14 @@ label.wrapp-label input[type="checkbox"] {
#add_show_start_time {
float: left;
width: 100px;
width: 70px;
}
#add_show_end_time, #add_show_end_date_no_repeat, #add_show_start_date {
#add_show_end_time {
width: 70px;
}
#add_show_end_date_no_repeat, #add_show_start_date {
width: 100px;
}

View file

@ -1386,10 +1386,14 @@ div.success{
#show_content_dialog .datatable {
margin-top:8px;
}
.simple-formblock.metadata {
.simple-formblock.metadata, #side_playlist .simple-formblock.metadata {
border:none;
width:100%;
width:auto;
display:block;
padding: 2px;
}
#side_playlist .simple-formblock.metadata .input_text, #side_playlist .simple-formblock.metadata .input_text_area {
width:95%;
}

View file

@ -317,37 +317,41 @@ function setAddShowEvents() {
}
});
});
// when start date/time changes, set end date/time to start date/time+1 hr
$('#add_show_start_date, #add_show_start_time').change(function(){
var startDate = $('#add_show_start_date').val().split('-');
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
var startTime = $('#add_show_start_time').val().split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1])-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
var endTime = $('#add_show_end_time').val().split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1])-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() > endDateTime.getTime()){
endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000));
}
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
$('#add_show_end_date_no_repeat').val(endDateFormat);
$('#add_show_end_time').val(endTimeFormat);
// calculate duration
calculateDuration(endDateTime, startDateTime);
});
// when end date/time changes, check if the changed date is in past of start date/time
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
var startDate = $('#add_show_start_date').val().split('-');
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
var startTime = $('#add_show_start_time').val().split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1])-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
var endTime = $('#add_show_end_time').val().split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1])-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() > endDateTime.getTime()){
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
$('#add_show_end_time').css('background-color', '#F49C9C');
@ -355,11 +359,11 @@ function setAddShowEvents() {
$('#add_show_end_date_no_repeat').css('background-color', '');
$('#add_show_end_time').css('background-color', '');
}
// calculate duration
calculateDuration(endDateTime, startDateTime);
});
function calculateDuration(endDateTime, startDateTime){
var duration;
var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000;
@ -372,13 +376,13 @@ function setAddShowEvents() {
}
$('#add_show_duration').val(duration);
}
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
}
}