Merge branch 'saas' into cc-5709-airtime-analyzer-cloud-storage-saas

Conflicts:
	CREDITS
	airtime_mvc/application/modules/rest/controllers/MediaController.php
	airtime_mvc/application/views/scripts/form/support-setting.phtml
This commit is contained in:
drigato 2015-01-23 16:36:31 -05:00
commit ac8fadfc80
36 changed files with 121 additions and 146 deletions

View File

@ -2,9 +2,6 @@
CREDITS CREDITS
======= =======
<<<<<<< HEAD
Version 2.5.3
=======
Version 2.5.2 Version 2.5.2
Albert Santoni (albert.santoni@sourcefabric.org) Albert Santoni (albert.santoni@sourcefabric.org)
@ -17,9 +14,7 @@ Community Contributors:
Robbt E Robbt E
Version 2.5.1 Version 2.5.1
>>>>>>> 2.5.x
Albert Santoni (albert.santoni@sourcefabric.org) Albert Santoni (albert.santoni@sourcefabric.org)
Role: Developer Team Lead Role: Developer Team Lead

View File

@ -14,7 +14,9 @@ class ApiController extends Zend_Controller_Action
"item-history-feed", "item-history-feed",
"shows", "shows",
"show-tracks", "show-tracks",
"show-schedules" "show-schedules",
"station-logo",
"show-logo"
); );
$params = $this->getRequest()->getParams(); $params = $this->getRequest()->getParams();

View File

@ -32,15 +32,11 @@ class PreferenceController extends Zend_Controller_Action
$form = new Application_Form_Preferences(); $form = new Application_Form_Preferences();
$values = array(); $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::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetDefaultCrossfadeDuration($values["stationDefaultCrossfadeDuration"]); Application_Model_Preference::SetDefaultCrossfadeDuration($values["stationDefaultCrossfadeDuration"]);
Application_Model_Preference::SetDefaultFadeIn($values["stationDefaultFadeIn"]); 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::SetDefaultTimezone($values["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]); 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::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]); Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]); 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->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
$this->view->form = $form; $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 { } else {
$this->view->form = $form; $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; $this->view->form = $form;
} }
@ -90,13 +93,9 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetEmail($values["Email"]); Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]); Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
$form->Logo->receive();
$imagePath = $form->Logo->getFileName();
Application_Model_Preference::SetStationCountry($values["Country"]); Application_Model_Preference::SetStationCountry($values["Country"]);
Application_Model_Preference::SetStationCity($values["City"]); Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]); Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
if (isset($values["Privacy"])) { if (isset($values["Privacy"])) {
Application_Model_Preference::SetPrivacyPolicyCheck($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>"; $this->view->statusMsg = "<div class='success'>"._("Support setting updated.")."</div>";
} }
$logo = Application_Model_Preference::GetStationLogo();
if ($logo) {
$this->view->logoImg = $logo;
}
$privacyChecked = false; $privacyChecked = false;
if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) { if (Application_Model_Preference::GetPrivacyPolicyCheck() == 1) {
$privacyChecked = true; $privacyChecked = true;

View File

@ -1,11 +1,14 @@
<?php <?php
require_once 'customfilters/ImageSize.php';
class Application_Form_GeneralPreferences extends Zend_Form_SubForm class Application_Form_GeneralPreferences extends Zend_Form_SubForm
{ {
public function init() public function init()
{ {
$maxLens = Application_Model_Show::getMaxLengths(); $maxLens = Application_Model_Show::getMaxLengths();
$this->setEnctype(Zend_Form::ENCTYPE_MULTIPART);
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9); $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); $stationDescription->setAttrib('rows', 4);
$this->addElement($stationDescription); $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 //Default station crossfade duration
$this->addElement('text', 'stationDefaultCrossfadeDuration', array( $this->addElement('text', 'stationDefaultCrossfadeDuration', array(
'class' => 'input_text', 'class' => 'input_text',
@ -94,19 +109,15 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
'class' => 'radio-inline-list', 'class' => 'radio-inline-list',
)); ));
$this->addElement($third_party_api); $this->addElement($third_party_api);
//
// Add the description element // Add the description element
$this->addElement('textarea', 'widgetCode', array( $this->addElement('textarea', 'widgetCode', array(
'label' => _('HTML Code:'), 'label' => 'Javascript Code:',
'required' => false, 'required' => false,
'readonly' => true, 'readonly' => true,
'style' => 'font-family: Consolas, "Liberation Mono", Courier, 'style' => 'font-family: Consolas, "Liberation Mono", Courier,
monospace;', monospace;',
'class' => 'input_text_area', 'value' => self::getWidgetCode(),
'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"],
'decorators' => array(
'ViewHelper'
)
)); ));
$locale = new Zend_Form_Element_Select("locale"); $locale = new Zend_Form_Element_Select("locale");

View File

@ -6,8 +6,6 @@ class Application_Form_Preferences extends Zend_Form
{ {
$baseUrl = Application_Common_OsPath::getBaseDir(); $baseUrl = Application_Common_OsPath::getBaseDir();
$this->setMethod('post');
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences.phtml')) array('ViewScript', array('viewScript' => 'form/preferences.phtml'))
)); ));
@ -26,5 +24,12 @@ class Application_Form_Preferences extends Zend_Form
$soundcloud_pref = new Application_Form_SoundcloudPreferences(); $soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud'); $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 <?php
require_once 'customfilters/ImageSize.php';
class Application_Form_SupportSettings extends Zend_Form class Application_Form_SupportSettings extends Zend_Form
{ {
public function init() public function init()
@ -95,17 +93,6 @@ class Application_Form_SupportSettings extends Zend_Form
->setAttrib('COLS','58'); ->setAttrib('COLS','58');
$this->addElement($description); $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 //enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array( $this->addElement('checkbox', 'SupportFeedback', array(
'label' => _('Send support feedback'), 'label' => _('Send support feedback'),

View File

@ -1,2 +1,15 @@
<?php <?php
/** Hide a Zend_Form_Element unless you're logged in as a SuperAdmin. */
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

@ -27,8 +27,8 @@ class Rest_MediaController extends Zend_Rest_Controller
{ {
$this->view->layout()->disableLayout(); $this->view->layout()->disableLayout();
// Remove reliance on .phtml files to render requests // Remove reliance on .phtml files to render requests
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
} }
public function indexAction() public function indexAction()
@ -381,7 +381,7 @@ class Rest_MediaController extends Zend_Rest_Controller
return $service_user->getCurrentUser()->getDbId(); return $service_user->getCurrentUser()->getDbId();
} else { } else {
$defaultOwner = CcSubjsQuery::create() $defaultOwner = CcSubjsQuery::create()
->filterByDbType('A') ->filterByDbType(array('A', 'S'), Criteria::IN)
->orderByDbId() ->orderByDbId()
->findOne(); ->findOne();
if (!$defaultOwner) { if (!$defaultOwner) {
@ -397,23 +397,21 @@ class Rest_MediaController extends Zend_Rest_Controller
} }
/** /**
* *
* Strips out fields from incoming request data that should never be modified * Strips out fields from incoming request data that should never be modified
* from outside of Airtime * from outside of Airtime
* @param array $data *
* @param array $data
*/ */
private static function removeBlacklistedFieldsFromRequestData($data) private static function removeBlacklistedFieldsFromRequestData($data) {
{
foreach (self::$blackList as $key) { foreach (self::$blackList as $key) {
unset($data[$key]); unset($data[$key]);
} }
return $data; return $data;
} }
private function removeEmptySubFolders($path) {
private function removeEmptySubFolders($path)
{
exec("find $path -empty -type d -delete"); exec("find $path -empty -type d -delete");
} }

View File

@ -1,10 +1,9 @@
<form method="<?php echo $this->element->getMethod() ?>" enctype="multipart/form-data"> <form method="<?php echo $this->element->getMethod() ?>" enctype="multipart/form-data">
<?php echo $this->element->getElement('csrf') ?> <?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> <?php echo $this->element->getSubform('preferences_general') ?>
<div class="collapsible-content" id="soundcloud-settings"> <?php //No soundcloud stuff on Airtime Pro -- Albert ?>
<?php echo $this->element->getSubform('preferences_soundcloud') ?>
</div> <?php echo $this->element->submit->render() ?>
</form> </form>

View File

@ -5,6 +5,10 @@
<?php echo $this->element->getElement('stationDescription')->render() ?> <?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('locale')->render() ?>
<?php echo $this->element->getElement('timezone')->render() ?> <?php echo $this->element->getElement('timezone')->render() ?>
@ -19,5 +23,7 @@
<?php echo $this->element->getElement('thirdPartyApi')->render() ?> <?php echo $this->element->getElement('thirdPartyApi')->render() ?>
<?php echo $this->element->getElement('widgetCode')->render() ?>
</dl> </dl>
</fieldset> </fieldset>

View File

@ -143,25 +143,5 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </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> </dl>
</fieldset> </fieldset>

View File

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

View File

@ -897,13 +897,23 @@ input[type="checkbox"] {
} }
/*---//////////////////// LOGIN & PASSWORD RESET ////////////////////---*/ /*---//////////////////// LOGIN & PASSWORD RESET ////////////////////---*/
#csrf-label, #csrf-element { /* Remove any visible csrf form token footprint */
/* Remove any visible csrf form token footprint */ #csrf-label {
height: 0; height: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#csrf-element {
height: 8px;
padding: 0;
margin: 0;
}
#csrf-label .errors li, #csrf-element .errors li {
margin: 0;
}
.login_box { .login_box {
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
text-align:center; text-align:center;
@ -2122,6 +2132,7 @@ span.errors.sp-errors{
} }
.preferences { .preferences {
width: 500px; width: 500px;
margin-bottom: 40px;
} }
.manage-folders { .manage-folders {
width: 610px; width: 610px;

View File

@ -97,32 +97,6 @@ function setCollapsibleWidgetJsCode() {
$('#thirdPartyApi-element input').click(x); $('#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() { function setSoundCloudCheckBoxListener() {
var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption"); var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
var mainCheckBox= $("#UploadToSoundcloudOption"); var mainCheckBox= $("#UploadToSoundcloudOption");
@ -146,7 +120,8 @@ $(document).ready(function() {
$(this).toggleClass("closed"); $(this).toggleClass("closed");
return false; return false;
}).next().hide(); }).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() { $('#pref_save').live('click', function() {
var data = $('#pref_form').serialize(); var data = $('#pref_form').serialize();
var url = baseUrl+'Preference/index'; var url = baseUrl+'Preference/index';
@ -159,7 +134,7 @@ $(document).ready(function() {
setConfigureMailServerListener(); setConfigureMailServerListener();
setEnableSystemEmailsListener(); setEnableSystemEmailsListener();
}); });
}); });*/
showErrorSections(); showErrorSections();
@ -169,5 +144,4 @@ $(document).ready(function() {
setConfigureMailServerListener(); setConfigureMailServerListener();
setEnableSystemEmailsListener(); setEnableSystemEmailsListener();
setCollapsibleWidgetJsCode(); setCollapsibleWidgetJsCode();
createWidgetHelpDescription();
}); });

View File

@ -340,4 +340,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -32,4 +32,4 @@
<value></value> <value></value>
</row> </row>
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<value>1</value> <value>1</value>
</row> </row>
</table> </table>
</dataset> </dataset>

View File

@ -106,4 +106,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -96,4 +96,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -96,4 +96,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -86,4 +86,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -250,4 +250,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -96,4 +96,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -96,4 +96,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -272,4 +272,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -262,4 +262,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -96,4 +96,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -159,4 +159,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<value>1</value> <value>1</value>
</row> </row>
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -136,4 +136,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -106,4 +106,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>

View File

@ -86,4 +86,4 @@
<table name="cc_show_hosts"> <table name="cc_show_hosts">
</table> </table>
</dataset> </dataset>