Merge branch 'saas-media-refactor' of github.com:sourcefabric/Airtime into saas-media-refactor
This commit is contained in:
commit
0144fd2a84
|
@ -38,6 +38,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
if ($form->isValid($values))
|
if ($form->isValid($values))
|
||||||
{
|
{
|
||||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||||
|
Application_Model_Preference::SetStationDescription($values["stationDescription"]);
|
||||||
Application_Model_Preference::SetDefaultCrossfadeDuration($values["stationDefaultCrossfadeDuration"]);
|
Application_Model_Preference::SetDefaultCrossfadeDuration($values["stationDefaultCrossfadeDuration"]);
|
||||||
Application_Model_Preference::SetDefaultFadeIn($values["stationDefaultFadeIn"]);
|
Application_Model_Preference::SetDefaultFadeIn($values["stationDefaultFadeIn"]);
|
||||||
Application_Model_Preference::SetDefaultFadeOut($values["stationDefaultFadeOut"]);
|
Application_Model_Preference::SetDefaultFadeOut($values["stationDefaultFadeOut"]);
|
||||||
|
@ -49,7 +50,11 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
|
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
|
||||||
$logoUploadElement->receive();
|
$logoUploadElement->receive();
|
||||||
$imagePath = $logoUploadElement->getFileName();
|
$imagePath = $logoUploadElement->getFileName();
|
||||||
Application_Model_Preference::SetStationLogo($imagePath);
|
|
||||||
|
// Only update the image logo if the new logo is non-empty
|
||||||
|
if (!empty($imagePath) && $imagePath != "") {
|
||||||
|
Application_Model_Preference::SetStationLogo($imagePath);
|
||||||
|
}
|
||||||
|
|
||||||
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
|
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
|
||||||
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
|
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
->addValidator('Count', false, 1)
|
->addValidator('Count', false, 1)
|
||||||
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
->addValidator('Extension', false, 'jpg,jpeg,png,gif')
|
||||||
->addFilter('ImageSize');
|
->addFilter('ImageSize');
|
||||||
|
|
||||||
$this->addElement($upload);
|
$this->addElement($upload);
|
||||||
|
|
||||||
// Add image preview
|
// Add image preview
|
||||||
|
@ -93,6 +93,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
|
||||||
'class' => 'big'
|
'class' => 'big'
|
||||||
))));
|
))));
|
||||||
$preview->setAttrib('disabled','disabled');
|
$preview->setAttrib('disabled','disabled');
|
||||||
|
|
||||||
|
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||||
|
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||||
|
$csrf_element->setValue($csrf_namespace->authtoken)
|
||||||
|
->setRequired('true')
|
||||||
|
->removeDecorator('HtmlTag')
|
||||||
|
->removeDecorator('Label');
|
||||||
|
$this->addElement($csrf_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable()
|
public function disable()
|
||||||
|
|
|
@ -49,6 +49,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
||||||
$stationLogoUpload->setAttrib('accept', 'image/*');
|
$stationLogoUpload->setAttrib('accept', 'image/*');
|
||||||
$this->addElement($stationLogoUpload);
|
$this->addElement($stationLogoUpload);
|
||||||
|
|
||||||
|
$stationLogoRemove = new Zend_Form_Element_Button('stationLogoRemove');
|
||||||
|
$stationLogoRemove->setLabel(_('Remove'));
|
||||||
|
$stationLogoRemove->setAttrib('class', 'btn');
|
||||||
|
$stationLogoRemove->setAttrib('id', 'logo-remove-btn');
|
||||||
|
$stationLogoRemove->setAttrib('onclick', 'removeLogo();');
|
||||||
|
$this->addElement($stationLogoRemove);
|
||||||
|
|
||||||
//Default station crossfade duration
|
//Default station crossfade duration
|
||||||
$this->addElement('text', 'stationDefaultCrossfadeDuration', array(
|
$this->addElement('text', 'stationDefaultCrossfadeDuration', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
|
|
||||||
<?php echo $this->element->getElement('stationLogo')->render() ?>
|
<?php echo $this->element->getElement('stationLogo')->render() ?>
|
||||||
|
|
||||||
<button id="logo-remove-btn" value="Remove" class="btn">Remove</button>
|
<?php echo $this->element->getElement('stationLogoRemove')->render() ?>
|
||||||
|
|
||||||
|
<!-- <button id="logo-remove-btn" value="Remove" class="btn">Remove</button>-->
|
||||||
|
|
||||||
<div id="Logo-img-container">
|
<div id="Logo-img-container">
|
||||||
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();" id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" />
|
<img onError="this.onerror = '';this.style.visibility='hidden';$('#logo-remove-btn').hide();$('[id^=stationLogoRemove]').each(function(i,v){v.style.width=v.style.height=v.style.margin=v.style.padding='0px';});" id="logo-img" onload='resizeImg(this, 450, 450);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo $this->element->getElement('locale')->render() ?>
|
<?php echo $this->element->getElement('locale')->render() ?>
|
||||||
|
|
|
@ -2197,12 +2197,17 @@ dd.radio-inline-list, .preferences dd.radio-inline-list, .stream-config dd.radio
|
||||||
height: 120px;
|
height: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preferences #stationLogoRemove-label {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.preferences #logo-remove-btn {
|
.preferences #logo-remove-btn {
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preferences #Logo-img-container {
|
.preferences #Logo-img-container {
|
||||||
float: left;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#show_time_info {
|
#show_time_info {
|
||||||
|
|
|
@ -115,6 +115,11 @@ function setSoundCloudCheckBoxListener() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeLogo() {
|
||||||
|
$.post(baseUrl+'Preference/remove-logo', function(json){});
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('.collapsible-header').live('click',function() {
|
$('.collapsible-header').live('click',function() {
|
||||||
|
@ -123,10 +128,6 @@ $(document).ready(function() {
|
||||||
return false;
|
return false;
|
||||||
}).next().hide();
|
}).next().hide();
|
||||||
|
|
||||||
$('#logo-remove-btn').click(function() {
|
|
||||||
$.post(baseUrl+'Preference/remove-logo', function(json){});
|
|
||||||
});
|
|
||||||
|
|
||||||
/* No longer using AJAX for this form. Zend + our code makes it needlessly hard to deal with. -- Albert
|
/* No longer using AJAX for this form. Zend + our code makes it needlessly hard to deal with. -- Albert
|
||||||
$('#pref_save').live('click', function() {
|
$('#pref_save').live('click', function() {
|
||||||
var data = $('#pref_form').serialize();
|
var data = $('#pref_form').serialize();
|
||||||
|
|
|
@ -668,7 +668,7 @@ function setAddShowEvents(form) {
|
||||||
var showId = $("#add_show_id").attr("value");
|
var showId = $("#add_show_id").attr("value");
|
||||||
|
|
||||||
if (showId && $("#add_show_logo_current").attr("src") !== "") {
|
if (showId && $("#add_show_logo_current").attr("src") !== "") {
|
||||||
var action = '/rest/show-image?id=' + showId;
|
var action = '/rest/show-image?csrf_token=' + $('#csrf').val() + '&id=' + showId;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: action,
|
url: action,
|
||||||
|
@ -748,7 +748,7 @@ function setAddShowEvents(form) {
|
||||||
data: {format: "json", data: data, hosts: hosts, days: days},
|
data: {format: "json", data: data, hosts: hosts, days: days},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json.showId && image) { // Successfully added the show, and it contains an image to upload
|
if (json.showId && image) { // Successfully added the show, and it contains an image to upload
|
||||||
var imageAction = '/rest/show-image?id=' + json.showId;
|
var imageAction = '/rest/show-image?csrf_token=' + $('#csrf').val() + '&id=' + json.showId;
|
||||||
|
|
||||||
// perform a second xhttprequest in order to send the show image
|
// perform a second xhttprequest in order to send the show image
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
Loading…
Reference in New Issue