Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
c6dafd5df9
|
@ -7,6 +7,8 @@ class NowplayingController extends Zend_Controller_Action
|
|||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('get-data-grid-data', 'json')
|
||||
->addActionContext('register', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -24,9 +26,45 @@ class NowplayingController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id);
|
||||
|
||||
if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
if ($request->isPost()) {
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$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);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}else{
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
|
||||
}
|
||||
}else{
|
||||
if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js','text/javascript');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +91,59 @@ class NowplayingController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js','text/javascript');
|
||||
}
|
||||
|
||||
/*public function registerAction(){
|
||||
//$request = $this->getRequest();
|
||||
//$baseUrl = $request->getBaseUrl();
|
||||
|
||||
//$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
/*if ($request->isPost()) {
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$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);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
}else
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form->render($this->view);
|
||||
//}
|
||||
}*/
|
||||
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
$now = date("Y-m-d H:i:s");
|
||||
Application_Model_Preference::SetRemindMeDate($now);
|
||||
die();
|
||||
}
|
||||
|
||||
public function donotshowpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
{
|
||||
/* Initialize action controller here */
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('register', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
$ajaxContext/*->addActionContext('register', 'json')
|
||||
->addActionContext('remindme', 'json')*/
|
||||
->addActionContext('server-browse', 'json')
|
||||
->addActionContext('change-stor-directory', 'json')
|
||||
->addActionContext('reload-watch-directory', 'json')
|
||||
|
@ -50,6 +50,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetSupportFeedback($values["preferences_support"]["SupportFeedback"]);
|
||||
Application_Model_Preference::SetPublicise($values["preferences_support"]["Publicise"]);
|
||||
|
||||
$form->getSubForm('preferences_support')->Logo->receive();
|
||||
$imagePath = $form->getSubForm('preferences_support')->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["preferences_support"]["Country"]);
|
||||
|
@ -67,60 +68,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function registerAction(){
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/preferences.js','text/javascript');
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
if ($request->isPost()) {
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$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);
|
||||
}
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
$this->_redirect('Nowplaying');
|
||||
}else{
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
|
||||
$this->view->dialog = $form->render($this->view);
|
||||
}
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
$now = date("Y-m-d H:i:s");
|
||||
Application_Model_Preference::SetRemindMeDate($now);
|
||||
die();
|
||||
}
|
||||
|
||||
public function donotshowpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
die();
|
||||
}
|
||||
|
||||
public function directoryConfigAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
|
|
@ -5,7 +5,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
|
||||
public function init()
|
||||
{
|
||||
$this->setAction('/Preference/register');
|
||||
$this->setAction('/Nowplaying');
|
||||
$this->setMethod('post');
|
||||
|
||||
$country_list = Application_Model_Preference::GetCountryList();
|
||||
|
@ -95,14 +95,14 @@ class Application_Form_RegisterAirtime extends Zend_Form
|
|||
$upload = new Zend_Form_Element_File('Logo');
|
||||
$upload->setLabel('Station Logo:')
|
||||
->setRequired(false)
|
||||
->setDecorators(array('File'));
|
||||
/*->addValidator('Count', false, 1)
|
||||
->setDecorators(array('File'))
|
||||
->addValidator('Count', false, 1)
|
||||
->addValidator('Extension', false, 'jpg,png,gif')
|
||||
->addValidator('ImageSize', false, array(
|
||||
'minwidth' => 200,
|
||||
'minheight' => 200,
|
||||
'maxwidth' => 600,
|
||||
'maxheight' => 600));*/
|
||||
'maxheight' => 600));
|
||||
$this->addElement($upload);
|
||||
|
||||
//enable support feedback
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="dialogPopup register-dialog" title="Register Airtime">
|
||||
<div id="register_popup" class="dialogPopup register-dialog" title="Register Airtime" style="display: none;">
|
||||
<form id="register-form" method="<?php echo $this->element->getMethod() ?>" action="<?php echo $this->element->getAction() ?>" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<dl class="zend_form">
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
<span class="toggle-button-active end-button" id="now_view">Now View</span><span class="toggle-button" id="day_view">Day View</span>
|
||||
</div>
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="datatable" id="nowplayingtable"></table>
|
||||
<?php echo $this->dialog?>
|
||||
|
|
|
@ -1,53 +1,44 @@
|
|||
$(document).ready(function(){
|
||||
var dialogGlob;
|
||||
|
||||
function doNotShowPopup(){
|
||||
$.get("/Preference/donotshowpopup");
|
||||
}
|
||||
function doNotShowPopup(){
|
||||
$.get("/Nowplaying/donotshowpopup");
|
||||
}
|
||||
|
||||
$.get("/Preference/register", {format:"json"}, function(json){
|
||||
var dialog = $(json.dialog);
|
||||
dialogGlob = dialog;
|
||||
var dialog = $("#register_popup");
|
||||
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
width: 500,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
position:['center',50],
|
||||
close: doNotShowPopup,
|
||||
buttons: [
|
||||
{
|
||||
id: "remind_me",
|
||||
text: "Remind me in 1 week",
|
||||
click: function() {
|
||||
var url = '/Preference/remindme';
|
||||
$.ajax({
|
||||
url: url,
|
||||
});
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "help_airtime",
|
||||
text: "Yes, help Airtime",
|
||||
click: function() {
|
||||
if($("#Publicise").is(':checked')){
|
||||
if(validateFields()){
|
||||
$("#register-form").submit();
|
||||
}
|
||||
}else{
|
||||
$("#register-form").submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
dialog.dialog({
|
||||
autoOpen: false,
|
||||
width: 500,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
position:['center',50],
|
||||
close: doNotShowPopup,
|
||||
buttons: [
|
||||
{
|
||||
id: "remind_me",
|
||||
text: "Remind me in 1 week",
|
||||
click: function() {
|
||||
var url = '/Nowplaying/remindme';
|
||||
$.ajax({
|
||||
url: url,
|
||||
});
|
||||
$(this).dialog("close");
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "help_airtime",
|
||||
text: "Yes, help Airtime",
|
||||
click: function() {
|
||||
$("#register-form").submit();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
var button = $("#help_airtime");
|
||||
button.attr('disabled', 'disabled').addClass('ui-state-disabled');
|
||||
dialog.dialog('open');
|
||||
|
||||
var button = $("#help_airtime");
|
||||
button.attr('disabled', 'disabled').addClass('ui-state-disabled');
|
||||
dialog.dialog('open');
|
||||
})
|
||||
|
||||
$('.collapsible-header').live('click',function() {
|
||||
$(this).next().toggle('fast');
|
||||
|
@ -72,13 +63,17 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
|
||||
$("#Publicise").live('click', function(){
|
||||
var promote = $("#Publicise");
|
||||
promote.live('click', function(){
|
||||
if($(this).is(':checked')){
|
||||
$("#public-info").show();
|
||||
}else{
|
||||
$("#public-info").hide();
|
||||
}
|
||||
});
|
||||
if( promote.is(":checked")){
|
||||
$("#public-info").show();
|
||||
}
|
||||
|
||||
$("#Privacy").live('click', function(){
|
||||
var support = $("#SupportFeedback");
|
||||
|
@ -90,6 +85,12 @@ $(document).ready(function(){
|
|||
}
|
||||
});
|
||||
|
||||
if($("#SupportFeedback").is(':checked') && $("#Privacy").is(':checked')){
|
||||
button.removeAttr('disabled').removeClass('ui-state-disabled');
|
||||
}else{
|
||||
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
|
||||
}
|
||||
|
||||
$("#link_to_whos_using").live('click', function(){
|
||||
window.open("http://sourcefabric.org/en/products/airtime_whosusing");
|
||||
});
|
||||
|
@ -104,32 +105,6 @@ $(document).ready(function(){
|
|||
});
|
||||
});
|
||||
|
||||
function validateFields(){
|
||||
var stnName = $("#stnName");
|
||||
|
||||
var errors = new Array();
|
||||
|
||||
errors[0] = displayError(stnName);
|
||||
|
||||
for( e in errors ){
|
||||
if(errors[e]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function displayError(ele){
|
||||
var errorMsg = "Value is required and can't be empty";
|
||||
|
||||
ele.parent().find("ul").remove();
|
||||
if($.trim(ele.val()) == ''){
|
||||
ele.parent().append("<ul class='errors'><li>"+errorMsg+"</li></ul>");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function resizeImg(ele){
|
||||
|
||||
var img = $(ele);
|
||||
|
|
Loading…
Reference in New Issue