Merge branch '2.5.x' into saas

Conflicts:
	airtime_mvc/application/forms/GeneralPreferences.php
	airtime_mvc/application/views/scripts/form/preferences_general.phtml
	airtime_mvc/application/views/scripts/form/support-setting.phtml
This commit is contained in:
Albert Santoni 2015-01-13 21:31:57 -05:00
commit d5b969f94f
12 changed files with 140 additions and 301 deletions

View File

@ -18,6 +18,7 @@ require_once "Database.php";
require_once "Timezone.php";
require_once "Auth.php";
require_once __DIR__.'/forms/helpers/ValidationTypes.php';
require_once __DIR__.'/forms/helpers/CustomDecorators.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
require_once __DIR__.'/controllers/plugins/Maintenance.php';
require_once __DIR__.'/modules/rest/controllers/ShowController.php';

View File

@ -5,6 +5,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
public function init()
{
$maxLens = Application_Model_Show::getMaxLengths();
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
$this->setDecorators(array(
@ -13,104 +15,100 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn();
$defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut();
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => _('Station Name'),
'required' => false,
'filters' => array('StringTrim'),
'class' => 'input_text',
'label' => _('Station Name'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetStationName(),
'decorators' => array(
'ViewHelper'
)
));
//Default station fade in
// Station description
$stationDescription = new Zend_Form_Element_Textarea("stationDescription");
$stationDescription->setLabel(_('Station Description'));
$stationDescription->setValue(Application_Model_Preference::GetStationDescription());
$stationDescription->setRequired(false);
$stationDescription->setValidators(array(array('StringLength', false, array(0, $maxLens['description']))));
$stationDescription->setAttrib('rows', 4);
$this->addElement($stationDescription);
//Default station crossfade duration
$this->addElement('text', 'stationDefaultCrossfadeDuration', array(
'class' => 'input_text',
'label' => _('Default Crossfade Duration (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
array(
$rangeValidator,
$notEmptyValidator,
'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}'))
)
),
'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(),
'decorators' => array(
'ViewHelper'
)
'class' => 'input_text',
'label' => _('Default Crossfade Duration (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
$rangeValidator,
$notEmptyValidator,
array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
),
'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(),
));
//Default station fade in
$this->addElement('text', 'stationDefaultFadeIn', array(
'class' => 'input_text',
'label' => _('Default Fade In (s):'),
'required' => true,
'filters' => array('StringTrim'),
'class' => 'input_text',
'label' => _('Default Fade In (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
array(
$rangeValidator,
$notEmptyValidator,
'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}'))
)
$rangeValidator,
$notEmptyValidator,
array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
),
'value' => $defaultFadeIn,
'decorators' => array(
'ViewHelper'
)
));
//Default station fade out
$this->addElement('text', 'stationDefaultFadeOut', array(
'class' => 'input_text',
'label' => _('Default Fade Out (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
array(
$rangeValidator,
$notEmptyValidator,
'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}'))
)
),
'value' => $defaultFadeOut,
'decorators' => array(
'ViewHelper'
)
'class' => 'input_text',
'label' => _('Default Fade Out (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
$rangeValidator,
$notEmptyValidator,
array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)')))
),
'value' => $defaultFadeOut,
));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel(
sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '<br>'));
$third_party_api->setMultiOptions(array(_("Disabled"),
_("Enabled")));
$third_party_api->setLabel(_('Public Airtime API'));
$third_party_api->setDescription(_('Required for embeddable schedule widget.'));
$third_party_api->setMultiOptions(array(
_("Disabled"),
_("Enabled"),
));
$third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$third_party_api->setDescription(_('Enabling this feature will allow Airtime to provide schedule data
to external widgets that can be embedded in your website. Enable this
feature to reveal the embeddable code.'));
$third_party_api->setSeparator(' '); //No <br> between radio buttons
//$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list')));
$third_party_api->addDecorator('HtmlTag', array('tag' => 'dd',
'id'=>"thirdPartyApi-element",
'class' => 'radio-inline-list',
));
$this->addElement($third_party_api);
//
// Add the description element
$this->addElement('textarea', 'widgetCode', array(
'label' => _('HTML Code:'),
'required' => false,
'readonly' => true,
'style' => 'font-family: Consolas, "Liberation Mono", Courier,
monospace;',
'class' => 'input_text_area',
'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"],
'decorators' => array(
'ViewHelper'
)
));
// Add the description element
$this->addElement('textarea', 'widgetCode', array(
'label' => 'Javascript Code:',
'required' => false,
'readonly' => true,
'style' => 'font-family: Consolas, "Liberation Mono", Courier,
monospace;',
'value' => self::getWidgetCode(),
));
$this->getElement('widgetCode')->addDecorator(new Airtime_Decorator_SuperAdmin_Only());
$locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Default Interface Language"));
$locale->setLabel(_("Default Language"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetDefaultLocale());
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
/* Form Element for setting the Timezone */
@ -118,7 +116,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$timezone->setLabel(_("Station Timezone"));
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
$timezone->setValue(Application_Model_Preference::GetDefaultTimezone());
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
/* Form Element for setting which day is the start of the week */
@ -126,7 +123,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$week_start_day->setLabel(_("Week Starts On"));
$week_start_day->setMultiOptions($this->getWeekStartDays());
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
}

View File

@ -10,9 +10,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
$defaultFade = Application_Model_Preference::GetDefaultTransitionFade();
if ($defaultFade == "") {
$defaultFade = '00.000000';
}
// automatic trasition on source disconnection
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
@ -32,8 +29,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel(_("Switch Transition Fade (s)"))
->setFilters(array('StringTrim'))
->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,6})?$/',
'messages' => _('enter a time in seconds 00{.000000}')))
->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,3})?$/',
'messages' => _('enter a time in seconds 0{.000}')))
->setValue($defaultFade)
->setDecorators(array('ViewHelper'));
$this->addElement($transition_fade);

View File

@ -0,0 +1,14 @@
<?php
class Airtime_Decorator_SuperAdmin_Only extends Zend_Form_Decorator_Abstract
{
public function render($content)
{
$currentUser = Application_Model_User::getCurrentUser();
if (!$currentUser->isSuperAdmin()) {
return $content;
} else {
return "";
}
}
}

View File

@ -21,9 +21,9 @@
$companySiteAnchor = "<a href='" . COMPANY_SITE_URL . "'>"
. $company
. "</a>";
echo sprintf(_('%1$s copyright &copy; %2$s All rights reserved.%3$s'
. 'Maintained and distributed under the %4$s by %5$s'),
PRODUCT_NAME, $company, "<br>",
echo sprintf(_('%1$s copyright &copy; %2$s All rights reserved.<br />'
. 'Maintained and distributed under the %3$s by %4$s'),
PRODUCT_NAME, $company,
$licenseSiteAnchor,
$companySiteAnchor);
?>

View File

@ -263,7 +263,7 @@ class Application_Model_Preference
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
return "0.5";
}
return $fade;
@ -279,8 +279,8 @@ class Application_Model_Preference
$fade = self::getValue("default_fade_out");
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
// the default value of the fade is 0.5
return "0.5";
}
return $fade;
@ -291,33 +291,6 @@ class Application_Model_Preference
self::setValue("default_fade", $fade);
}
public static function GetDefaultFade()
{
$fade = self::getValue("default_fade");
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
}
// we need this function to work with 2.0 version on default_fade value in cc_pref
// it has 00:00:00.000000 format where in 2.1 we have 00.000000 format
if (preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{6})/", $fade, $matches) == 1 && count($matches) == 5) {
$out = 0;
$out += intval($matches[1] * 3600);
$out += intval($matches[2] * 60);
$out += intval($matches[3]);
$out .= ".$matches[4]";
$fade = $out;
}
$fade = number_format($fade, 1, '.', '');
//fades need 2 leading zeros for DateTime conversion
$fade = str_pad($fade, 4, "0", STR_PAD_LEFT);
return $fade;
}
public static function SetDefaultTransitionFade($fade)
{
self::setValue("default_transition_fade", $fade);
@ -330,7 +303,7 @@ class Application_Model_Preference
public static function GetDefaultTransitionFade()
{
$transition_fade = self::getValue("default_transition_fade");
return ($transition_fade == "") ? "00.000000" : $transition_fade;
return ($transition_fade == "") ? "0.000" : $transition_fade;
}
public static function SetStreamLabelFormat($type)

View File

@ -1,10 +1,5 @@
<form method="<?php echo $this->element->getMethod() ?>" enctype="multipart/form-data">
<?php echo $this->element->getElement('csrf') ?>
<?php echo $this->element->getSubform('preferences_general') ?>
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span><? echo _("SoundCloud Settings") ?></h3>
<div class="collapsible-content" id="soundcloud-settings">
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div>
<?php //No soundcloud stuff on Airtime Pro -- Albert ?>
</form>

View File

@ -1,156 +1,25 @@
<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="stationDefaultFadeIn-label" class="block-display">
<label class="optional" for="stationDefaultFadeIn"><?php echo $this->element->getElement('stationDefaultFadeIn')->getLabel() ?></label>
</dt>
<dd id="stationDefaultFadeIn-element" class="block-display">
<?php echo $this->element->getElement('stationDefaultFadeIn') ?>
<?php if($this->element->getElement('stationDefaultFadeIn')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stationDefaultFadeIn')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="stationDefaultFadeOut-label" class="block-display">
<label class="optional" for="stationDefaultFadeOut"><?php echo $this->element->getElement('stationDefaultFadeOut')->getLabel() ?></label>
</dt>
<dd id="stationDefaultFadeOut-element" class="block-display">
<?php echo $this->element->getElement('stationDefaultFadeOut') ?>
<?php if($this->element->getElement('stationDefaultFadeOut')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stationDefaultFadeOut')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="stationDefaultCrossfadeDuration-label" class="block-display">
<label class="optional" for="stationDefaultCrossfadeDuration"><?php echo $this->element->getElement('stationDefaultCrossfadeDuration')->getLabel() ?></label>
</dt>
<dd id="stationDefaultCrossfadeDuration-element" class="block-display">
<?php echo $this->element->getElement('stationDefaultCrossfadeDuration') ?>
<?php if($this->element->getElement('stationDefaultCrossfadeDuration')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('stationDefaultCrossfadeDuration')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="thirdPartyApi-label" class="block-display">
<label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?>
<span class="icecast_metadata_help_icon" id="thirdPartyApiInfo"></span>
</label>
</dt>
<dd id="thirdPartyApi-element" class="block-display radio-inline-list">
<?php $i=0;
$value = $this->element->getElement('thirdPartyApi')->getValue();
?>
<?php echo $this->element->getElement('stationName')->render() ?>
<?php foreach ($this->element->getElement('thirdPartyApi')->getMultiOptions() as $radio) : ?>
<label for="thirdPartyApi-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="thirdPartyApi-<?php echo $i ?>" name="thirdPartyApi" <?php if($i == $value){echo 'checked="checked"';}?>>
<?php echo $radio ?>
</input>
</label>
<?php $i = $i + 1; ?>
<?php endforeach; ?>
<?php if($this->element->getElement('thirdPartyApi')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('thirdPartyApi')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<?php echo $this->element->getElement('stationDescription')->render() ?>
<dt id="widgetCode-label" style="display:none;" class="block-display">
<label class="optional" for="widgetCode"><?php echo $this->element->getElement('widgetCode')->getLabel() ?></label>
</dt>
<dd id="widgetCode-element" style="display:none;" class="block-display clearfix">
<?php echo $this->element->getElement('widgetCode') ?>
<?php if($this->element->getElement('widgetCode')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('widgetCode')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="locale-label" class="block-display">
<label class="required" for="locale"><?php echo $this->element->getElement('locale')->getLabel() ?>:
</label>
</dt>
<dd id="locale-element" class="block-display">
<?php echo $this->element->getElement('locale') ?>
<?php if($this->element->getElement('locale')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('locale')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<?php echo $this->element->getElement('locale')->render() ?>
<dt id="timezone-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('timezone')->getLabel() ?>:
<span class="info-text-small"><?php _("(Required)") ?></span>
</label>
</dt>
<dd id="timezone-element" class="block-display">
<?php echo $this->element->getElement('timezone') ?>
<?php if($this->element->getElement('timezone')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('timezone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<?php echo $this->element->getElement('timezone')->render() ?>
<!-- Week Start Day option -->
<dt id="weekStartDay-label" class="block-display">
<label class="required" for="timezone"><?php echo $this->element->getElement('weekStartDay')->getLabel() ?>:
</label>
</dt>
<dd id="weekStartDay-element" class="block-display">
<?php $i=0;
$value = $this->element->getElement('weekStartDay')->getValue();
?>
<select id="weekStartDay" name="weekStartDay">
<?php foreach ($this->element->getElement('weekStartDay')->getMultiOptions() as $option) : ?>
<option value="<?php echo $i ?>" <?php if($i == $value){echo 'selected="selected"';}?> >
<?php echo $option ?>
</option>
<?php $i = $i + 1; ?>
<?php endforeach; ?>
</select>
<?php echo $this->element->getElement('weekStartDay')->render() ?>
<?php echo $this->element->getElement('stationDefaultFadeIn')->render() ?>
<?php echo $this->element->getElement('stationDefaultFadeOut')->render() ?>
<?php echo $this->element->getElement('stationDefaultCrossfadeDuration')->render() ?>
<?php echo $this->element->getElement('thirdPartyApi')->render() ?>
<?php echo $this->element->getElement('widgetCode')->render() ?>
<?php if($this->element->getElement('weekStartDay')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('weekStartDay')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl>
</fieldset>

View File

@ -3,10 +3,10 @@
<fieldset>
<dl class="zend_form">
<dt class="block-display info-text">
<?php echo sprintf(_('Help %1$s improve by letting us know how you are using it. This info '
.'will be collected regularly in order to enhance your user experience.%2$s'
.'Click \'Yes, help %1$s\' and we\'ll make sure the features you use are '
.'constantly improving.'), PRODUCT_NAME, "<br /><br />") ?>
<?php echo sprintf(_("Help improve %s by letting us know how you're using it. This information"
." will be collected regularly in order to enhance your user experience.<br />"
."Click the box below and we'll make sure the features you use are constantly improving."),
PRODUCT_NAME)?>
</dt>
<dd id="SupportFeedback-element" class="block-display">
<label class="optional" for="SupportFeedback">

View File

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

View File

@ -13,7 +13,7 @@ html, body {
}
#login-page {
background: #1f1f1f url(images/login_page_bg.png) no-repeat center 0;`
background: #1f1f1f url(images/login_page_bg.png) no-repeat center 0;
margin: 0;
padding: 0;
height:100%;
@ -1002,7 +1002,28 @@ input[type="checkbox"] {
display:block;
}
dt.block-display, dd.block-display {
#pref_form dt, #pref_form dd,
#pref_form textarea {
display:block;
float:none;
margin-left:0;
padding-left:0;
width: 100%;
}
#pref_form textarea {
width: 98.5%;
}
#pref_form select {
width: 100%;
}
#pref_form p.description {
color: #3b3b3b;
font-size: 12px;
float: left;
}
dt.block-display, dd.block-display {
display:block;
float:none;
margin-left:0;

View File

@ -97,32 +97,6 @@ function setCollapsibleWidgetJsCode() {
$('#thirdPartyApi-element input').click(x);
}
function createWidgetHelpDescription() {
$('#thirdPartyApiInfo').qtip({
content: {
text: "Enabling this feature will allow Airtime to " +
"provide schedule data to external widgets that can be embedded " +
"in your website. Enable this feature to reveal the embeddable " +
"code."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
});
}
function setSoundCloudCheckBoxListener() {
var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
var mainCheckBox= $("#UploadToSoundcloudOption");
@ -169,5 +143,4 @@ $(document).ready(function() {
setConfigureMailServerListener();
setEnableSystemEmailsListener();
setCollapsibleWidgetJsCode();
createWidgetHelpDescription();
});