CC-1724:phone-home-statistics

Rebase from devel into this branch
This commit is contained in:
james 2011-06-15 12:06:50 -04:00
parent 11b601308e
commit cf654f1a45
18 changed files with 656 additions and 193 deletions

View File

@ -49,7 +49,10 @@ class LoginController extends Zend_Controller_Action
//the default storage is a session with namespace Zend_Auth
$authStorage = $auth->getStorage();
$authStorage->write($userInfo);
$this->refer_sess = new Zend_Session_Namespace("referrer");
$this->refer_sess->referrer = 'login';
$this->_redirect('Nowplaying');
}
else

View File

@ -18,6 +18,14 @@ class NowplayingController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.min.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js','text/javascript');
//popup if previous page was login
$refer_sses = new Zend_Session_Namespace('referrer');
if($refer_sses->referrer == 'login'){
//unset session
Zend_Session::namespaceUnset('referrer');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
}
}
public function getDataGridDataAction()

View File

@ -8,6 +8,7 @@ class PreferenceController extends Zend_Controller_Action
/* Initialize action controller here */
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('register', 'json')
->addActionContext('remindme', 'json')
->initContext();
}
@ -19,9 +20,6 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
$this->view->statusMsg = "";
$this->view->registered = Application_Model_Preference::GetRegistered();
$this->view->supportFeedback = Application_Model_Preference::GetSupportFeedback();
$form = new Application_Form_Preferences();
if ($request->isPost()) {
@ -47,10 +45,46 @@ class PreferenceController extends Zend_Controller_Action
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"]);
$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>";
}else{
$errors = $form->getErrors();
$firstElementWithError = '';
foreach($errors as $section => $error){
foreach($error as $name => $er){
if(count($er) > 0){
$firstElementWithError = $name;
break;
}
}
if($section == "preferences_general"){
$this->view->errorGeneral = true;
}elseif($section == "preferences_soundcloud"){
$this->view->errorSoundCloud = true;
}elseif($section == "preferences_support"){
$this->view->errorSupport = true;
}
}
}
}
$this->view->supportFeedback = Application_Model_Preference::GetSupportFeedback();
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;
}
$this->view->form = $form;
}
@ -61,8 +95,20 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
$form = new Application_Form_RegisterAirtime();
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;
}
$this->view->dialog = $form->render($this->view);
}
public function remindmeAction(){
$now = date("Y-m-d H:i:s");
Application_Model_Preference::SetRemindMeDate($now);
die();
}
}

View File

@ -5,43 +5,14 @@ class Application_Form_RegisterAirtime extends Zend_Form_SubForm
public function init()
{
$country_list = Application_Model_Preference::GetCountryList();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml'))
));
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml')),
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
);
// checkbox for publicise
$this->addElement('checkbox', 'Publicise', array(
'label' => 'Publicise my station on Sourcefabric.org',
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
'ViewHelper'
)
));
// Station Name
$this->addElement('text', 'StationName', array(
'label' => 'Station Name:',
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationName(),
'decorators' => array(
'ViewHelper'
)
));
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
'label' => 'Station Web Site:',
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
'decorators' => array(
'ViewHelper'
)
));
// Phone number
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
'label' => 'Phone:',
@ -64,15 +35,92 @@ class Application_Form_RegisterAirtime extends Zend_Form_SubForm
'ViewHelper'
)
));
// text area for sending detail
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
'label' => 'Station Web Site:',
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
'decorators' => array(
'ViewHelper'
)
));
// county list dropdown
$this->addElement('select', 'Country', array(
'label' => 'Country:',
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
'decorators' => array(
'ViewHelper'
)
));
// Station city
$this->addElement('text', 'City', array(
'label' => 'City:',
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
'decorators' => array(
'ViewHelper'
)
));
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
$description->setLabel('Station Description:')
->setRequired(false)
->setValue(Application_Model_Preference::GetStationDescription())
->setDecorators(array('ViewHelper'))
->setAttrib('ROWS','2')
->setAttrib('COLS','58');
$this->addElement($description);
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
$upload->setLabel('Station Logo:')
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
->addValidator('Extension', false, 'jpg,png,gif')
->addValidator('ImageSize', false, array(
'minwidth' => 180,
'minheight' => 180,
'maxwidth' => 1000,
'maxheight' => 1000));
$this->addElement($upload);
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback',
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
'ViewHelper'
)
));
// checkbox for publicise
$this->addElement('checkbox', 'Publicise', array(
'label' => 'Publicise my station on Sourcefabric.org',
'required' => false,
'value' => Application_Model_Preference::GetPublicise(),
'decorators' => array(
'ViewHelper'
)
));
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array(
'class' => 'textarea',
'class' => 'sending_textarea',
'required' => false,
'filters' => array('StringTrim'),
'cols' => 48,
'rows' => 20,
'readonly' => true,
'rows' => 24,
'value' => Application_Model_Preference::GetSystemInfo(),
'decorators' => array(
'ViewHelper'

View File

@ -5,9 +5,12 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
public function init()
{
$country_list = Application_Model_Preference::GetCountryList();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_support.phtml'))
));
array('ViewScript', array('viewScript' => 'form/preferences_support.phtml')),
array('File', array('viewScript' => 'form/preferences_support.phtml', 'placement' => false)))
);
// Phone number
$this->addElement('text', 'Phone', array(
@ -44,29 +47,84 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
)
));
// county list dropdown
$this->addElement('select', 'Country', array(
'label' => 'Country:',
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
'decorators' => array(
'ViewHelper'
)
));
// Station city
$this->addElement('text', 'City', array(
'label' => 'City:',
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
'decorators' => array(
'ViewHelper'
)
));
// Station Description
$this->addElement('textarea', 'Description', array(
'label' => 'Station Description:',
'required' => false,
'class' => 'input_text_area',
'value' => Application_Model_Preference::GetStationDescription(),
'decorators' => array(
'ViewHelper'
)
));
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
$upload->setLabel('Station Logo:')
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
->addValidator('Extension', false, 'jpg,png,gif')
->addValidator('ImageSize', false, array(
'minwidth' => 180,
'minheight' => 180,
'maxwidth' => 1000,
'maxheight' => 1000));
$this->addElement($upload);
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Support feedback enabled',
'label' => 'Send support feedback',
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
'ViewHelper'
)
));
// checkbox for publicise
$this->addElement('checkbox', 'Publicise', array(
'label' => 'Publicise my station on Sourcefabric.org',
'required' => false,
'value' => Application_Model_Preference::GetPublicise(),
'decorators' => array(
'ViewHelper'
)
));
//add register button if not registered
if( !Application_Model_Preference::GetRegistered() ){
$this->addElement('submit', 'Register', array(
'class' => 'ui-button ui-state-default',
'ignore' => true,
'label' => 'Register',
'decorators' => array(
'ViewHelper'
)
));
}
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array(
'class' => 'sending_textarea',
'required' => false,
'filters' => array('StringTrim'),
'readonly' => true,
'value' => Application_Model_Preference::GetSystemInfo(),
'decorators' => array(
'ViewHelper'
)
));
}
}

View File

@ -119,6 +119,12 @@ class Playlist {
$sql = 'DELETE FROM '.$CC_CONFIG["playListTable"];
$CC_DBC->query($sql);
}
public static function getPlaylistCount(){
global $CC_CONFIG, $CC_DBC;
$sql = 'SELECT count(*) as cnt FROM '.$CC_CONFIG["playListTable"];
return $CC_DBC->GetOne($sql);
}
/**
* Delete the file from all playlists.

View File

@ -221,6 +221,14 @@ class Application_Model_Preference
return Application_Model_Preference::GetValue("support_feedback");
}
public static function SetPublicise($publicise){
Application_Model_Preference::SetValue("publicise", $publicise);
}
public static function GetPublicise(){
return Application_Model_Preference::GetValue("publicise");
}
public static function SetRegistered($registered){
Application_Model_Preference::SetValue("registered", $registered);
}
@ -229,14 +237,101 @@ class Application_Model_Preference
return Application_Model_Preference::GetValue("registered");
}
public static function GetSystemInfo(){
$output;
exec('airtime-check-system', $output);
$out = implode("\n", preg_replace('/\s+/', ' ', $output));
// Sever API
$out .= php_sapi_name();
public static function SetStationCountry($country){
Application_Model_Preference::SetValue("country", $country);
}
public static function GetStationCountry(){
return Application_Model_Preference::GetValue("country");
}
public static function SetStationCity($city){
Application_Model_Preference::SetValue("city", $city);
}
public static function GetStationCity(){
return Application_Model_Preference::GetValue("city");
}
public static function SetStationDescription($description){
Application_Model_Preference::SetValue("description", $description);
}
public static function GetStationDescription(){
return Application_Model_Preference::GetValue("description");
}
public static function SetStationLogo($imagePath){
if(!empty($imagePath)){
$image = file_get_contents($imagePath);
$image = base64_encode($image);
Application_Model_Preference::SetValue("logoImage", $image);
}
}
public static function GetStationLogo(){
return Application_Model_Preference::GetValue("logoImage");
}
public static function GetUniqueId(){
return Application_Model_Preference::GetValue("uniqueId");
}
public static function GetCountryList(){
global $CC_DBC;
$sql = "SELECT * FROM cc_country";
$res = $CC_DBC->GetAll($sql);
$out = array();
foreach($res as $r){
$out[$r["iso_code"]] = $r["name"];
}
return $out;
}
public static function GetSystemInfo(){
exec('/usr/bin/airtime-check-system', $output);
$output = preg_replace('/\s+/', ' ', $output);
$systemInfoArray = array();
foreach( $output as $key => &$out){
$info = explode('=', $out);
if(isset($info[1])){
$key = str_replace(' ', '_', $info[0]);
$key = strtoupper($key);
$systemInfoArray[$key] = $info[1];
}
}
$outputArray = array();
$outputArray['STATION_NAME'] = Application_Model_Preference::GetStationName();
$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['Version'] = $systemInfoArray['AIRTIME_VERSION'];
$outputArray['WEB_SERVER'] = php_sapi_name();
//$outputArray['OS Info'] = $systemInfoArray['OS'];
$outputArray['NUM_OF_USERS'] = User::getUserCount();
$outputArray['NUM_OF_SONGS'] = StoredFile::getFileCount();
$outputArray['NUM_OF_PLAYLISTS'] = Playlist::getPlaylistCount();
$outputArray['NUM_OF_SCHEDULED_PLAYLIST'] = Schedule::getSchduledPlaylistCount();
$outputArray['UNIQUE_ID'] = Application_Model_Preference::GetUniqueId();
$outputArray = array_merge($outputArray, $systemInfoArray);
$outputString = "\n";
foreach($outputArray as $key => $out){
$outputString .= $key.' : '.$out."\n";
}
return $outputString;
}
public static function SetRemindMeDate($now){
$weekAfter = mktime(0, 0, 0, date("m") , date("d")+7, date("Y"));
Application_Model_Preference::SetValue('remindme', $weekAfter);
}
}

View File

@ -527,6 +527,12 @@ class Schedule {
$retVal = $CC_DBC->query($sql);
return $retVal;
}
public static function getSchduledPlaylistCount(){
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG['scheduleTable'];
return $CC_DBC->GetOne($sql);
}
/**

View File

@ -88,6 +88,13 @@ class StoredFile {
}
}
public static function getFileCount()
{
global $CC_CONFIG, $CC_DBC;
$sql = "SELECT count(*) as cnt FROM ".$CC_CONFIG["filesTable"]." WHERE state='ready'";
return $CC_DBC->GetOne($sql);
}
/**
* Set multiple metadata values using database columns as indexes.
*

View File

@ -188,6 +188,33 @@ class User {
return $CC_DBC->GetAll($sql);
}
public static function getUserCount($type=NULL){
global $CC_DBC;
$sql;
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
if(!isset($type)){
$sql = $sql_gen;
}
else{
if(is_array($type)) {
for($i=0; $i<count($type); $i++) {
$type[$i] = "type = '{$type[$i]}'";
}
$sql_type = join(" OR ", $type);
}
else {
$sql_type = "type = {$type}";
}
$sql = $sql_gen ." WHERE (". $sql_type.") ";
}
return $CC_DBC->GetOne($sql);
}
public static function getHosts($search=NULL) {
return User::getUsers(array('H'), $search);

View File

@ -1,13 +1,13 @@
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="application/x-www-form-urlencoded">
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
<?php echo $this->element->getSubform('preferences_general') ?>
<h3 class="collapsible-header"><span class="arrow-icon"></span>SoundCloud Settings</h3>
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span>SoundCloud Settings</h3>
<div class="collapsible-content" id="soundcloud-settings" style="display: none;">
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div>
<h3 class="collapsible-header"><span class="arrow-icon"></span>Support Settings</h3>
<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>

View File

@ -1,13 +1,35 @@
<fieldset class="padded">
<dl class="zend_form">
<?php if($this->element->getView()->registered){?>
<div>Registered</div>
<?php }else{?>
<div>Please register your Airtime system by clicking Register button at the bottom.</div>
<?php }?>
<?php if($this->element->getView()->supportFeedback === '0'){?>
<div>Be more awesome by selecting "Support feedback" below. You will be helping Airtim improve!</div>
<div class="info-text"><p>Be more awesome by selecting "Support feedback" below. You will be helping Airtim improve!</p></div>
<?php }?>
<dd id="SupportFeedback-element">
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dd id="publicize-element">
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to publicise your station, "Send support feedback" must be enabled</p></div>
<dt id="Phone-label" class="block-display">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
</dt>
@ -47,21 +69,73 @@
</ul>
<?php endif; ?>
</dd>
<dd id="SupportFeedback-element" class="block-display" style=" margin:6px 0 10px 0">
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<dt id="Country-label" class="block-display">
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
</dt>
<dd id="Country-element" class="block-display clearfix">
<?php echo $this->element->getElement('Country') ?>
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</dd>
<div class="button-bar bottom" id="Register-element">
<?php echo $this->element->getElement('Register') ?>
</div>
<dt id="City-label" class="block-display">
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
</dt>
<dd id="City-element" class="block-display clearfix">
<?php echo $this->element->getElement('City') ?>
<?php if($this->element->getElement('City')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Description-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
</dt>
<dd id="Description-element" class="block-display clearfix">
<?php echo $this->element->getElement('Description') ?>
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Logo-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
</dt>
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<dd id="Logo-element" class="block-display clearfix">
<?php echo $this->element->getElement('Logo') ?>
<div class="info-text"><p>Min. size: 180x180 Max. size: 600x600</p></div>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<h3 class="collapsible-header">
<span class="arrow-icon"></span>Show me what I am sending
</h3>
<div class="collapsible-content" id="show_what_sending" style="display: none;">
<fieldset class="display_field">
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
</dl>
</fieldset>
</div>
</fieldset>

View File

@ -5,54 +5,41 @@
advertise your station on sourcefabric.org</p>
</div>
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="application/x-www-form-urlencoded">
<form method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="application/x-www-form-urlencoded">
<dl class="zend_form">
<dd id="publicize-element">
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<fieldset>
<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 clearfix">
<?php echo $this->element->getElement('StationName') ?>
<?php if($this->element->getElement('StationName')->hasErrors()) : ?>
<dl class="zend_form">
<?php if($this->element->getView()->supportFeedback === '0'){?>
<div class="info-text"><p>Be more awesome by selecting "Support feedback" below. You will be helping Airtim improve!</p></div>
<?php }?>
<dd id="SupportFeedback-element">
<label class="optional" for="SupportFeedback">
<?php echo $this->element->getElement('SupportFeedback') ?>
<strong><?php echo $this->element->getElement('SupportFeedback')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('SupportFeedback')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('StationName')->getMessages() as $error): ?>
<?php foreach($this->element->getElement('SupportFeedback')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</dd>
<dt id="StationWebSite-label" class="block-display">
<label class="required" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
</dt>
<dd id="StationWebSite-element" class="block-display clearfix">
<?php echo $this->element->getElement('StationWebSite') ?>
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
<dd id="publicize-element">
<label class="optional" for="Publicise">
<?php echo $this->element->getElement('Publicise') ?>
<strong><?php echo $this->element->getElement('Publicise')->getLabel() ?></strong>
</label>
<?php if($this->element->getElement('Publicise')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
<?php foreach($this->element->getElement('Publicise')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<?php endif; ?>
</dd>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to publicise your station, "Send support feedback" must be enabled</p></div>
<dt id="Phone-label" class="block-display">
<label class="required" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
</dt>
<dd id="Phone-element" class="block-display">
<?php echo $this->element->getElement('Phone') ?>
@ -65,7 +52,7 @@
<?php endif; ?>
</dd>
<dt id="Email-label" class="block-display">
<label class="required" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
<label class="optional" for="Email"><?php echo $this->element->getElement('Email')->getLabel() ?></label>
</dt>
<dd id="Email-element" class="block-display">
<?php echo $this->element->getElement('Email') ?>
@ -77,27 +64,87 @@
</ul>
<?php endif; ?>
</dd>
</dl>
</fieldset>
<dt id="StationWebSite-label" class="block-display">
<label class="optional" for="StationWebSite"><?php echo $this->element->getElement('StationWebSite')->getLabel() ?></label>
</dt>
<dd id="StationWebSite-element" class="block-display clearfix">
<?php echo $this->element->getElement('StationWebSite') ?>
<?php if($this->element->getElement('StationWebSite')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('StationWebSite')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Country-label" class="block-display">
<label class="optional" for="Country"><?php echo $this->element->getElement('Country')->getLabel() ?></label>
</dt>
<dd id="Country-element" class="block-display clearfix">
<?php echo $this->element->getElement('Country') ?>
<?php if($this->element->getElement('Country')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Country')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="City-label" class="block-display">
<label class="optional" for="City"><?php echo $this->element->getElement('City')->getLabel() ?></label>
</dt>
<dd id="City-element" class="block-display clearfix">
<?php echo $this->element->getElement('City') ?>
<?php if($this->element->getElement('City')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('City')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Description-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Description')->getLabel() ?></label>
</dt>
<dd id="Description-element" class="block-display clearfix">
<?php echo $this->element->getElement('Description') ?>
<?php if($this->element->getElement('Description')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Description')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="Logo-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
</dt>
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<dd id="Logo-element" class="block-display clearfix">
<?php echo $this->element->getElement('Logo') ?>
<div class="info-text"><p>Min. size: 180x180 Max. size: 600x600</p></div>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Logo')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
<h3 class="collapsible-header">
<span class="arrow-icon"></span>Show me what I am sending
</h3>
<div class="collapsible-content" id="show_what_sending" style="display: none;">
<fieldset class="display_field">
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
</dl>
</fieldset>
</div>
</form>
<h3 class="collapsible-header">
<span class="arrow-icon"></span>Show me what I am sending
</h3>
<div class="collapsible-content" id="show_what_sending" style="display: block;">
<fieldset class="display_field">
<dl>
<?php echo $this->element->getElement('SendInfo') ?>
<dt>Airtime version:</dt>
<dd>1.9.0</dd>
<dt>Unique ID:</dt>
<dd>AT19236520FR00673</dd>
<dt>Station name:</dt>
<dd>BBC Radio 1</dd>
</dl>
</fieldset>
</div>
</div>

View File

@ -296,4 +296,8 @@
<unique-column name="login"/>
</unique>
</table>
<table name="cc_country" phpName="CcCountry">
<column name="isocode" phpName="DbIsoCode" primaryKey="true" type="CHAR" size="3" required="true"/>
<column name="name" phpName="DbName" type="VARCHAR" size="255" required="true"/>
</table>
</database>

View File

@ -1639,6 +1639,10 @@ dd.radio-inline-list, .preferences dd.radio-inline-list {
height: 120px;
}
.preferences dd#Description-element.block-display .input_text_area {
height: 60px;
}
#show_time_info {
font-size:12px;
height:30px;
@ -1723,4 +1727,9 @@ label span {
clear: left;
font-weight:bold;
width:40%;
}
.sending_textarea {
width: 100%;
resize: none;
}

View File

@ -1,51 +1,61 @@
$(document).ready(function() {
var form = $("form");
form.find("h3").click(function(){
var h3 = $(this);
h3.next().toggle();
if(h3.hasClass("close")) {
h3.removeClass("close");
}
else {
h3.addClass("close");
}
});
$('#Register').click(function(event){
event.preventDefault();
$.get("/Preference/register", {format:"json"}, function(json){
var dialog = $(json.dialog);
dialog.dialog({
autoOpen: false,
title: 'Register Airtime',
width: 400,
height: 500,
modal: true,
buttons: {"Ok": function() {
dialog.remove();
}}
});
dialog.dialog('open');
var form = $("form");
form.find("h3").click(function(){
var h3 = $(this);
h3.next().toggle();
if(h3.hasClass("close")) {
h3.removeClass("close");
}
else {
h3.addClass("close");
}
});
})
})
$('.collapsible-header').live('click',function() {
$(this).next().toggle('fast');
$(this).toggleClass("close");
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");
}
});
showErrorSections();
});
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" );
}
}

View File

@ -125,5 +125,7 @@ AirtimeInstall::CreateSymlinksToUtils();
AirtimeInstall::CreateZendPhpLogFile();
AirtimeInstall::SetUniqueId();
/* FINISHED AIRTIME PHP INSTALLER */

View File

@ -262,6 +262,19 @@ class AirtimeInstall
}
return true;
}
public static function SetUniqueId(){
global $CC_DBC;
$uniqueId = md5(uniqid("", true));
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('uniqueId', '$uniqueId')";
$result = $CC_DBC->query($sql);
if (PEAR::isError($result)) {
return false;
}
return true;
}
public static function GetAirtimeVersion()
{