Merge branch '2.5.x-albertenhancements' into saas

Conflicts:
	airtime_mvc/application/controllers/PreferenceController.php
	airtime_mvc/application/forms/Preferences.php
	airtime_mvc/application/views/scripts/form/preferences.phtml
	airtime_mvc/application/views/scripts/form/support-setting.phtml
This commit is contained in:
Albert Santoni 2015-01-15 16:32:29 -05:00
commit 7c28b66ce9
20 changed files with 54 additions and 63 deletions

2
README
View File

@ -43,7 +43,7 @@ For installation from git on Debian wheezy, run:
Quick links to our resources
----------------------------
User manuals: http://www.sourcefabric.org/en/airtime/manuals/
User manual: http://sourcefabric.booktype.pro/airtime-25-for-broadcasters/
Forums and mailing lists: http://forum.sourcefabric.org
Bug tracker: http://dev.sourcefabric.org
Source code: http://github.com/sourcefabric/Airtime

View File

@ -11,7 +11,7 @@ define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
define('WHOS_USING_URL' , 'http://sourcefabric.org/en/airtime/whosusing');
define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://www.sourcefabric.org/en/airtime/manuals/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-25-for-broadcasters/');
define('LICENSE_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');

View File

@ -128,7 +128,7 @@ $pages = array(
),
array(
'label' => _('User Manual'),
'uri' => "http://www.sourcefabric.org/en/airtime/manuals/",
'uri' => "http://sourcefabric.booktype.pro/airtime-25-for-broadcasters/",
'target' => "_blank"
),
array(

View File

@ -32,15 +32,11 @@ class PreferenceController extends Zend_Controller_Action
$form = new Application_Form_Preferences();
$values = array();
if ($request->isPost()) {
$params = $request->getPost();
$postData = explode('&', $params['data']);
foreach($postData as $k=>$v) {
$v = explode('=', $v);
$values[$v[0]] = urldecode($v[1]);
}
if ($form->isValid($values)) {
if ($request->isPost()) {
$values = $request->getPost();
if ($form->isValid($values))
{
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetDefaultCrossfadeDuration($values["stationDefaultCrossfadeDuration"]);
Application_Model_Preference::SetDefaultFadeIn($values["stationDefaultFadeIn"]);
@ -50,6 +46,11 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetDefaultTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
$logoUploadElement->receive();
$imagePath = $logoUploadElement->getFileName();
Application_Model_Preference::SetStationLogo($imagePath);
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]);
@ -61,12 +62,14 @@ class PreferenceController extends Zend_Controller_Action
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
$this->view->form = $form;
$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml')));
//$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml')));
} else {
$this->view->form = $form;
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml')));
//$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml')));
}
}
$this->view->logoImg = Application_Model_Preference::GetStationLogo();
$this->view->form = $form;
}
@ -90,13 +93,9 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
$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);
if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
@ -104,10 +103,6 @@ class PreferenceController extends Zend_Controller_Action
$this->view->statusMsg = "<div class='success'>"._("Support setting updated.")."</div>";
}
$logo = Application_Model_Preference::GetStationLogo();
if ($logo) {
$this->view->logoImg = $logo;
}
$privacyChecked = false;
if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) {
$privacyChecked = true;

View File

@ -1,11 +1,14 @@
<?php
require_once 'customfilters/ImageSize.php';
class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{
public function init()
{
$maxLens = Application_Model_Show::getMaxLengths();
$this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9);
@ -34,6 +37,18 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$stationDescription->setAttrib('rows', 4);
$this->addElement($stationDescription);
// Station Logo
$stationLogoUpload = new Zend_Form_Element_File('stationLogo');
$stationLogoUpload->setLabel(_('Station Logo:'))
->setDescription(_("Note: Anything larger than 600x600 will be resized."))
->setRequired(false)
->addValidator('Count', false, 1)
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
->setMaxFileSize(1000000)
->addFilter('ImageSize');
$stationLogoUpload->setAttrib('accept', 'image/*');
$this->addElement($stationLogoUpload);
//Default station crossfade duration
$this->addElement('text', 'stationDefaultCrossfadeDuration', array(
'class' => 'input_text',

View File

@ -6,8 +6,6 @@ class Application_Form_Preferences extends Zend_Form
{
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->setMethod('post');
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
));
@ -26,5 +24,12 @@ class Application_Form_Preferences extends Zend_Form
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(_('Save'));
//$submit->removeDecorator('Label');
$submit->setAttribs(array('class'=>'btn right-floated'));
$submit->removeDecorator('DtDdWrapper');
$this->addElement($submit);
}
}

View File

@ -1,7 +1,5 @@
<?php
require_once 'customfilters/ImageSize.php';
class Application_Form_SupportSettings extends Zend_Form
{
public function init()
@ -95,17 +93,6 @@ class Application_Form_SupportSettings extends Zend_Form
->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,jpeg,png,gif')
->addFilter('ImageSize');
$upload->setAttrib('accept', 'image/*');
$this->addElement($upload);
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => _('Send support feedback'),

View File

@ -1,5 +1,9 @@
<form method="<?php echo $this->element->getMethod() ?>" enctype="multipart/form-data">
<?php echo $this->element->getElement('csrf') ?>
<?php echo $this->element->getSubform('preferences_general') ?>
<?php //No soundcloud stuff on Airtime Pro -- Albert ?>
<?php echo $this->element->submit->render() ?>
</form>

View File

@ -5,6 +5,10 @@
<?php echo $this->element->getElement('stationDescription')->render() ?>
<?php echo $this->element->getElement('stationLogo')->render() ?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php echo $this->element->getElement('locale')->render() ?>
<?php echo $this->element->getElement('timezone')->render() ?>

View File

@ -97,25 +97,5 @@
</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>
<dd id="Logo-element" class="block-display clearfix">
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<?php echo $this->element->getElement('Logo') ?>
<div class="info-text">
<p><?php echo _("Note: Anything larger than 600x600 will be resized.")?></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>
</fieldset>

View File

@ -1,16 +1,15 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences">
<h2 style="float:left"><?php echo _("Preferences") ?></h2>
<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
<form method="post" id="pref_form" enctype="application/x-www-form-urlencoded">
<button name="pref_save" id="pref_save" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
<form method="post" id="pref_form" enctype="multipart/form-data">
<?php echo $this->form->getElement('submit')->render() ?>
<div style="clear:both"></div>
<?php
echo $this->statusMsg;
echo $this->form;
?>
<br />
<button name="pref_save" id="pref_save" type="button" class="btn right-floated"><?php echo _("Save") ?></button>
</form>
</div>

View File

@ -2121,6 +2121,7 @@ span.errors.sp-errors{
}
.preferences {
width: 500px;
margin-bottom: 40px;
}
.manage-folders {
width: 610px;

View File

@ -120,7 +120,8 @@ $(document).ready(function() {
$(this).toggleClass("closed");
return false;
}).next().hide();
/* No longer using AJAX for this form. Zend + our code makes it needlessly hard to deal with. -- Albert
$('#pref_save').live('click', function() {
var data = $('#pref_form').serialize();
var url = baseUrl+'Preference/index';
@ -133,7 +134,7 @@ $(document).ready(function() {
setConfigureMailServerListener();
setEnableSystemEmailsListener();
});
});
});*/
showErrorSections();