Added remove button for station logo on preferences page
This commit is contained in:
parent
69d588d2f6
commit
5e256df061
5 changed files with 31 additions and 7 deletions
|
@ -146,6 +146,15 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->form = $watched_dirs_pref;
|
||||
}
|
||||
|
||||
public function removeLogoAction()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
// Remove reliance on .phtml files to render requests
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
Application_Model_Preference::SetStationLogo("");
|
||||
}
|
||||
|
||||
public function streamSettingAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
|
|
@ -589,13 +589,12 @@ class Application_Model_Preference
|
|||
|
||||
public static function SetStationLogo($imagePath)
|
||||
{
|
||||
if (!empty($imagePath)) {
|
||||
$image = @file_get_contents($imagePath);
|
||||
$image = base64_encode($image);
|
||||
self::setValue("logoImage", $image);
|
||||
} else {
|
||||
Logging::warn("Attempting to set imagePath to empty string");
|
||||
if (empty($imagePath)) {
|
||||
Logging::info("Removed station logo");
|
||||
}
|
||||
$image = @file_get_contents($imagePath);
|
||||
$image = base64_encode($image);
|
||||
self::setValue("logoImage", $image);
|
||||
}
|
||||
|
||||
public static function GetStationLogo()
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
|
||||
<?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>
|
||||
<button id="logo-remove-btn" value="Remove" class="btn">Remove</button>
|
||||
|
||||
<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 ?>" />
|
||||
</div>
|
||||
|
||||
<?php echo $this->element->getElement('locale')->render() ?>
|
||||
|
||||
|
|
|
@ -2187,6 +2187,14 @@ dd.radio-inline-list, .preferences dd.radio-inline-list, .stream-config dd.radio
|
|||
height: 120px;
|
||||
}
|
||||
|
||||
.preferences #logo-remove-btn {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.preferences #Logo-img-container {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#show_time_info {
|
||||
font-size:12px;
|
||||
height:30px;
|
||||
|
|
|
@ -104,6 +104,10 @@ $(document).ready(function() {
|
|||
return false;
|
||||
}).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
|
||||
$('#pref_save').live('click', function() {
|
||||
var data = $('#pref_form').serialize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue