Merge commit 'airtime-1.9.1'

This commit is contained in:
James 2011-08-22 11:59:24 -04:00
commit 4b16d4928d
23 changed files with 318 additions and 140 deletions

View file

@ -1,3 +1,14 @@
1.9.1 - August 17th, 2011
*Fixes
-airtime-user shell script failing to start
-Progress bar for tracks appearing when no content scheduled
-Fix upgrades from Airtime 1.8.2 failing
-Fix various install issues with virtualenv
-Prevent users from doing a manual install of Airtime if they already have the
Debian package version installed
*Changes
-Support Settings moved to a seperate page accessible by Admin user only.
1.9.0 - August 9, 2011
The cool stuff:

View file

@ -1,2 +1,2 @@
PRODUCT_ID=Airtime
PRODUCT_RELEASE=1.9.0
PRODUCT_RELEASE=1.9.1

View file

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

View file

@ -58,6 +58,12 @@ $pages = array(
'module' => 'default',
'controller' => 'Preference',
'action' => 'directory-config'
),
array(
'label' => 'Support Settings',
'module' => 'default',
'controller' => 'Preference',
'action' => 'support-setting'
)
)
),

View file

@ -7,9 +7,7 @@ class PreferenceController extends Zend_Controller_Action
{
/* Initialize action controller here */
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext/*->addActionContext('register', 'json')
->addActionContext('remindme', 'json')*/
->addActionContext('server-browse', 'json')
$ajaxContext->addActionContext('server-browse', 'json')
->addActionContext('change-stor-directory', 'json')
->addActionContext('reload-watch-directory', 'json')
->addActionContext('remove-watch-directory', 'json')
@ -45,27 +43,48 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetSoundCloudLicense($values["preferences_soundcloud"]["SoundCloudLicense"]);
Application_Model_Preference::SetPhone($values["preferences_support"]["Phone"]);
Application_Model_Preference::SetEmail($values["preferences_support"]["Email"]);
Application_Model_Preference::SetStationWebSite($values["preferences_support"]["StationWebSite"]);
Application_Model_Preference::SetSupportFeedback($values["preferences_support"]["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["preferences_support"]["Publicise"]);
$form->getSubForm('preferences_support')->Logo->receive();
$imagePath = $form->getSubForm('preferences_support')->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["preferences_support"]["Country"]);
Application_Model_Preference::SetStationCity($values["preferences_support"]["City"]);
Application_Model_Preference::SetStationDescription($values["preferences_support"]["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
}
}
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;
}
$this->view->form = $form;
}
public function supportSettingAction()
{
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js','text/javascript');
$this->view->statusMsg = "";
$form = new Application_Form_SupportSettings();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$values = $form->getValues();
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
$form->Logo->receive();
$imagePath = $form->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["Country"]);
Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
$this->view->statusMsg = "<div class='success'>Support setting updated.</div>";
}
}
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;
}
$this->view->form = $form;
}

View file

@ -9,24 +9,23 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
));
$defaultFade = Application_Model_Preference::GetDefaultFade();
if($defaultFade == ""){
$defaultFade = '00:00:00.000000';
}
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => 'Station Name',
'required' => true,
'required' => false,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty'),
'value' => Application_Model_Preference::GetValue("station_name"),
'decorators' => array(
'ViewHelper'
)
));
$defaultFade = Application_Model_Preference::GetDefaultFade();
if($defaultFade == ""){
$defaultFade = '00:00:00.000000';
}
//Default station fade
$this->addElement('text', 'stationDefaultFade', array(
'class' => 'input_text',

View file

@ -18,8 +18,8 @@ class Application_Form_Preferences extends Zend_Form
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
$support_pref = new Application_Form_SupportPreferences();
$this->addSubForm($support_pref, 'preferences_support');
/*$support_pref = new Application_Form_SupportPreferences();
$this->addSubForm($support_pref, 'preferences_support');*/
$this->addElement('submit', 'submit', array(
'class' => 'ui-button ui-state-default right-floated',

View file

@ -1,6 +1,6 @@
<?php
class Application_Form_SupportPreferences extends Zend_Form_SubForm
class Application_Form_SupportSettings extends Zend_Form
{
public function init()
@ -8,10 +8,23 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
$country_list = Application_Model_Preference::GetCountryList();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_support.phtml')),
array('File', array('viewScript' => 'form/preferences_support.phtml', 'placement' => false)))
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
);
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => 'Station Name',
'required' => true,
'filters' => array('StringTrim'),
'validator' => array('NotEmpty'),
'value' => Application_Model_Preference::GetValue("station_name"),
'decorators' => array(
'ViewHelper'
)
));
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
@ -134,18 +147,26 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
$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'));
$this->addElement($checkboxPrivacy);
// submit button
$submit = new Zend_Form_Element_Submit("submit");
$submit->class = 'ui-button ui-state-default right-floated';
$submit->setIgnore(true)
->setLabel("Submit")
->setDecorators(array('ViewHelper'));
$this->addElement($submit);
}
// overwriting isValid function
public function isValid ($data)
{
parent::isValid($data);
$isValid = parent::isValid($data);
$checkPrivacy = $this->getElement('Privacy');
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
$checkPrivacy->addError("You have to agree to privacy policy.");
return false;
$isValid = false;
}
return true;
return $isValid;
}
}

View file

@ -23,10 +23,14 @@ class Application_Model_Dashboard
}
} else {
if (count($row) == 0){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
if ($showInstance->isRecorded()){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
} else {
return null;
}
} else {
//return the one that started later.
if ($row[0]["starts"] >= $showInstance->getShowStart()){
@ -69,11 +73,15 @@ class Application_Model_Dashboard
} else {
if (count($row) == 0){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd(),
"media_item_played"=>false,
"record"=>$showInstance->isRecorded());
if ($showInstance->isRecorded()){
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd(),
"media_item_played"=>false,
"record"=>true);
} else {
return null;
}
} else {
return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"],
"starts"=>$row[0]["starts"],
@ -103,10 +111,14 @@ class Application_Model_Dashboard
}
} else {
if (count($row) == 0){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
if ($showInstance->isRecorded()){
//last item is a show instance
return array("name"=>$showInstance->getName(),
"starts"=>$showInstance->getShowStart(),
"ends"=>$showInstance->getShowEnd());
} else {
return null;
}
} else {
//return the one that starts sooner.

View file

@ -9,11 +9,6 @@
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div>
<h3 class="collapsible-header" id="support-heading"><span class="arrow-icon"></span>Support Settings</h3>
<div class="collapsible-content" id="support-settings" style="display: none;">
<?php echo $this->element->getSubform('preferences_support') ?>
</div>
<div class="button-bar bottom" id="submit-element">
<?php echo $this->element->getElement('submit') ?>
</div>

View file

@ -1,9 +1,7 @@
<fieldset class="padded">
<dl class="zend_form">
<dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small">(Required)</span> :
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>:
</label>
</dt>
<dd id="stationName-element" class="block-display">

View file

@ -30,10 +30,25 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
<dl id="public-info" style="display:none;">
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
<dl id="public-info" style="display:none;">
<dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small">(Required)</span>:
</label>
</dt>
<dd id="stationName-element" class="block-display">
<?php echo $this->element->getElement('stationName') ?>
<?php if($this->element->getElement('stationName')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stationName')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Phone-label" class="block-display">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
<span class="info-text-small">(for verification purposes only, will not be published)</span>
@ -144,7 +159,7 @@
</div>
<div>
<br>
<label class="optional" for="Privacy">
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>

View file

@ -0,0 +1,12 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences">
<h2>Support Settings</h2>
<form method="post" action="/Preference/support-setting" enctype="multipart/form-data">
<div id="support-settings">
<?php echo $this->statusMsg ?>
<?php echo $this->form ?>
</div>
<div class="button-bar bottom" id="submit-element">
<?php echo $this->form->getElement('submit') ?>
</div>
</form>
</div>

View file

@ -4,39 +4,9 @@ function showErrorSections() {
$("#soundcloud-settings").show();
$(window).scrollTop($("soundcloud-settings .errors").position().top);
}
if($("#support-settings .errors").length > 0) {
$("#support-settings").show();
$(window).scrollTop($("#support-settings .errors").position().top);
}
}
function resizeImg(ele){
var img = $(ele);
var width = ele.width;
var height = ele.height;
// resize img proportionaly
if( width > height && width > 450){
var ratio = 450/width;
img.css("width", "450px");
var newHeight = height * ratio;
img.css("height", newHeight );
}else if( width < height && height > 450){
var ratio = 450/height;
img.css("height", "450px");
var newWidth = width * ratio;
img.css("width", newWidth );
}else if( width == height && width > 450){
img.css("height", "450px");
img.css("width", "450px" );
}
}
$(document).ready(function() {
var form = $("form");
$('.collapsible-header').live('click',function() {
$(this).next().toggle('fast');
@ -44,36 +14,5 @@ $(document).ready(function() {
return false;
}).next().hide();
$("#SupportFeedback").click( function(){
var pub = $("#Publicise");
if( !$(this).is(':checked') ){
pub.removeAttr("checked");
pub.attr("disabled", true);
}else{
pub.removeAttr("disabled");
}
});
var promote = $("#Publicise");
if(!$("#SupportFeedback").is(':checked')){
promote.removeAttr("checked");
promote.attr("disabled", true);
}
promote.live('click', function(){
if($(this).is(':checked')){
$("#public-info").show();
}else{
$("#public-info").hide();
}
});
if( promote.is(":checked")){
$("#public-info").show();
}
showErrorSections();
$('.toggle legend').click(function() {
$('.toggle').toggleClass('closed');
return false;
});
});

View file

@ -0,0 +1,73 @@
function showErrorSections() {
if($("soundcloud-settings .errors").length > 0) {
$("#soundcloud-settings").show();
$(window).scrollTop($("soundcloud-settings .errors").position().top);
}
if($("#support-settings .errors").length > 0) {
$("#support-settings").show();
$(window).scrollTop($("#support-settings .errors").position().top);
}
}
function resizeImg(ele){
var img = $(ele);
var width = ele.width;
var height = ele.height;
// resize img proportionaly
if( width > height && width > 450){
var ratio = 450/width;
img.css("width", "450px");
var newHeight = height * ratio;
img.css("height", newHeight );
}else if( width < height && height > 450){
var ratio = 450/height;
img.css("height", "450px");
var newWidth = width * ratio;
img.css("width", newWidth );
}else if( width == height && width > 450){
img.css("height", "450px");
img.css("width", "450px" );
}
}
$(document).ready(function() {
var form = $("form");
$("#SupportFeedback").click( function(){
var pub = $("#Publicise");
if( !$(this).is(':checked') ){
pub.removeAttr("checked");
pub.attr("disabled", true);
}else{
pub.removeAttr("disabled");
}
});
var promote = $("#Publicise");
if(!$("#SupportFeedback").is(':checked')){
promote.removeAttr("checked");
promote.attr("disabled", true);
}
promote.live('click', function(){
if($(this).is(':checked')){
$("#public-info").show();
}else{
$("#public-info").hide();
}
});
if( promote.is(":checked")){
$("#public-info").show();
}
showErrorSections();
$('.toggle legend').click(function() {
$('.toggle').toggleClass('closed');
return false;
});
});

View file

@ -28,6 +28,13 @@ class Version20110711161043 extends AbstractMigration
$cc_files->addNamedForeignKeyConstraint('cc_music_dirs_folder_fkey', $cc_music_dirs, array('directory'), array('id'), array('onDelete' => 'CASCADE'));
// before 3) we have to delete all entries in cc_schedule with file_id that are not in cc_file table
$this->_addSql("DELETE FROM cc_schedule WHERE cc_schedule.id IN(
SELECT cc_schedule.id
FROM cc_schedule
LEFT JOIN cc_files
ON cc_schedule.file_id = cc_files.id
WHERE cc_files.id IS NULL)");
/* 3) create a foreign key relationship from cc_schedule to cc_files */
$cc_schedule = $schema->getTable('cc_schedule');
$cc_schedule->addNamedForeignKeyConstraint('cc_files_folder_fkey', $cc_files, array('file_id'), array('id'), array('onDelete' => 'CASCADE'));

View file

@ -1,5 +1,11 @@
#!/bin/bash
DEB=$(dpkg -s airtime 2> /dev/null | grep Status)
if [[ "$DEB" = "Status: install ok installed" ]]; then
echo -e "\nDebian package of Airtime detected. Please use the debian package to upgrade.\n"
exit 1
fi
echo -e "\n******************************** Install Begin *********************************"
# Absolute path to this script
@ -8,6 +14,7 @@ SCRIPT=`readlink -f $0`
SCRIPTPATH=`dirname $SCRIPT`
VIRTUAL_ENV_DIR="/usr/lib/airtime/airtime_virtualenv"
VIRTUAL_ENV_SHARE="/usr/share/python-virtualenv/"
if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
echo -e "\n*** Creating Virtualenv for Airtime ***"
EXTRAOPTION=$(virtualenv --help | grep extra-search-dir)
@ -15,9 +22,11 @@ if [ ! -d "$VIRTUAL_ENV_DIR" ]; then
if [ "$?" -eq "0" ]; then
sudo virtualenv --extra-search-dir=${SCRIPTPATH}/3rd_party --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
else
# copy distibute-0.6.10.tar.gz to /usr/share/python-virtualenv/
# copy distribute-0.6.10.tar.gz to /usr/share/python-virtualenv/
# this is due to the bug in virtualenv 1.4.9
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
if [ -d "$VIRTUAL_ENV_SHARE" ]; then
cp ${SCRIPTPATH}/3rd_party/distribute-0.6.10.tar.gz /usr/share/python-virtualenv/
fi
sudo virtualenv --no-site-package -p /usr/bin/python2.6 /usr/lib/airtime/airtime_virtualenv
fi

View file

@ -341,6 +341,10 @@ class AirtimeInstall
echo "* Installing airtime-check-system".PHP_EOL;
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-check-system";
exec("ln -s $dir /usr/bin/airtime-check-system");
echo "* Installing airtime-user".PHP_EOL;
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user";
exec("ln -s $dir /usr/bin/airtime-user");
}
public static function RemoveSymlinks()

View file

@ -20,6 +20,14 @@ const CONF_DIR_BINARIES = "/usr/lib/airtime";
class AirtimeInstall{
const CONF_DIR_LOG = "/var/log/airtime";
const CONF_DIR_BINARIES = "/usr/lib/airtime";
public static function CreateSymlinksToUtils()
{
echo "* Installing airtime-user".PHP_EOL;
$dir = AirtimeInstall::CONF_DIR_BINARIES."/utils/airtime-user";
exec("ln -s $dir /usr/bin/airtime-user");
}
public static function CreateZendPhpLogFile(){
global $CC_CONFIG;

View file

@ -21,7 +21,7 @@ from urlparse import urlparse
import base64
from configobj import ConfigObj
AIRTIME_VERSION = "1.9.0-devel"
AIRTIME_VERSION = "1.9.1"
def api_client_factory(config):
logger = logging.getLogger()

View file

@ -21,7 +21,7 @@
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script cleans audio files in Airtime.
# This script for a correct system environment for Airtime.
#
# Absolute path to this script
SCRIPT=`readlink -f $0`

34
utils/airtime-user Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Airtime project.
# http://airtime.sourcefabric.org/
#
# Airtime is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Airtime is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Airtime; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# This script creates users in Airtime.
#
# Absolute path to this script
SCRIPT=`readlink -f $0`
# Absolute directory this script is in
SCRIPTPATH=`dirname $SCRIPT`
invokePwd=$PWD
cd $SCRIPTPATH
php -q airtime-user.php "$@" || exit 1

34
utils/airtime-user.php Executable file → Normal file
View file

@ -1,12 +1,14 @@
#!/usr/bin/php
<?php
set_include_path('../application/models' . PATH_SEPARATOR . get_include_path());
require_once(__DIR__.'/../library/propel/runtime/lib/Propel.php');
Propel::init(__DIR__.'/../application/configs/airtime-conf.php');
$airtimeIni = GetAirtimeConf();
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
require_once(dirname(__FILE__).'/../application/configs/conf.php');
require_once(dirname(__FILE__).'/../application/models/Users.php');
set_include_path("$airtime_base_dir/application/models" . PATH_SEPARATOR . get_include_path());
require_once("$airtime_base_dir/library/propel/runtime/lib/Propel.php");
Propel::init("$airtime_base_dir/application/configs/airtime-conf.php");
require_once("$airtime_base_dir/application/configs/conf.php");
require_once("$airtime_base_dir/application/models/Users.php");
require_once('DB.php');
require_once('Console/Getopt.php');
@ -99,10 +101,12 @@ if ($action == "addupdate") {
$user->setLastName($line);
do{
echo "Enter user type [(A)dmin|(H)ost|(G)uest]: ";
echo "Enter user type [(A)dmin|(P)rogram Manager|(D)J|(G)uest]: ";
$line = trim(fgets(fopen("php://stdin","r")));
} while($line != "A" && $line != "H" && $line != "G");
$user->setType($line);
} while($line != "A" && $line != "P" && $line != "D" && $line != "G");
$types = array("A"=>"A", "P"=>"P", "D"=>"H", "G"=>"G",);
$user->setType($types[$line]);
$user->save();
} elseif ($action == "delete") {
@ -115,3 +119,15 @@ if ($action == "addupdate") {
$user->delete();
}
}
function GetAirtimeConf()
{
$ini = parse_ini_file("/etc/airtime/airtime.conf", true);
if ($ini === false){
echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL;
exit;
}
return $ini;
}