Merge branch '1.9.1' into devel

This commit is contained in:
martin 2011-08-19 17:07:59 -04:00
commit 4ca480ba5e
8 changed files with 101 additions and 12 deletions

View file

@ -30,6 +30,7 @@ class PreferenceController extends Zend_Controller_Action
if ($form->isValid($request->getPost())) {
$values = $form->getValues();
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);

View file

@ -14,6 +14,18 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$defaultFade = '00:00:00.000000';
}
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => 'Station Name',
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetValue("station_name"),
'decorators' => array(
'ViewHelper'
)
));
//Default station fade
$this->addElement('text', 'stationDefaultFade', array(
'class' => 'input_text',

View file

@ -1,5 +1,19 @@
<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() ?>:
</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="stationDefaultFade-label" class="block-display">
<label class="optional" for="stationDefaultFade"><?php echo $this->element->getElement('stationDefaultFade')->getLabel() ?></label>
</dt>

View file

@ -355,6 +355,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 @@
#
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# 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('../airtime_mvc/application/models' . PATH_SEPARATOR . get_include_path());
require_once(__DIR__.'/../airtime_mvc/library/propel/runtime/lib/Propel.php');
Propel::init(__DIR__.'/../airtime_mvc/application/configs/airtime-conf.php');
$airtimeIni = GetAirtimeConf();
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
require_once(dirname(__FILE__).'/../airtime_mvc/application/configs/conf.php');
require_once(dirname(__FILE__).'/../airtime_mvc/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;
}