CC-4728: Support Feedback save action does not use ajax
-done
This commit is contained in:
parent
ab55bb73bb
commit
89e0458500
|
@ -81,7 +81,7 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
public function supportSettingAction()
|
public function supportSettingAction()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
@ -89,10 +89,15 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->statusMsg = "";
|
$this->view->statusMsg = "";
|
||||||
|
|
||||||
|
|
||||||
$form = new Application_Form_SupportSettings();
|
$form = new Application_Form_SupportSettings();
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$values = $request->getPost();
|
$postData = $request->getPost();
|
||||||
|
$values = array();
|
||||||
|
//put postData in array format isValid() expects it to be in
|
||||||
|
foreach ($postData["data"] as $field) {
|
||||||
|
$values[$field["name"]] = $field["value"];
|
||||||
|
}
|
||||||
|
|
||||||
if ($form->isValid($values)) {
|
if ($form->isValid($values)) {
|
||||||
if ($values["Publicise"] != 1) {
|
if ($values["Publicise"] != 1) {
|
||||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||||
|
@ -133,7 +138,9 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$this->view->privacyChecked = $privacyChecked;
|
$this->view->privacyChecked = $privacyChecked;
|
||||||
$this->view->section_title = _('Support Feedback');
|
$this->view->section_title = _('Support Feedback');
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
//$form->render($this->view);
|
if ($request->isPost()) {
|
||||||
|
die(json_encode(array("html"=>$this->view->render('preference/support-setting.phtml'))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function directoryConfigAction()
|
public function directoryConfigAction()
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<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" id="support-feedback-view">
|
||||||
<h2><?php echo $this->section_title?></h2>
|
<h2><?php echo $this->section_title?></h2>
|
||||||
<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
|
<?php $baseUrl = Application_Common_OsPath::getBaseDir(); ?>
|
||||||
<form method="post" action=<?php echo $baseUrl . "/Preference/support-setting"?> enctype="multipart/form-data">
|
<form method="post" id="support-feedback-form" action="enctype="multipart/form-data">
|
||||||
<div id="support-settings">
|
<div id="support-settings">
|
||||||
<?php echo $this->statusMsg ?>
|
<?php echo $this->statusMsg ?>
|
||||||
<?php echo $this->form ?>
|
<?php echo $this->form ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-bar bottom" id="submit-element">
|
<br />
|
||||||
<?php echo $this->form->getElement('submit') ?>
|
<button name="support_save" id="support_save" type="button" class="btn right-floated"><? echo _("Save") ?></button>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,8 +11,23 @@ function showErrorSections() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
setUpEventListeners();
|
||||||
|
});
|
||||||
|
|
||||||
|
function setUpEventListeners() {
|
||||||
var form = $("form");
|
var form = $("form");
|
||||||
|
|
||||||
|
$("#support_save").click( function() {
|
||||||
|
var data = $("#support-feedback-form").serializeArray();
|
||||||
|
var url = baseUrl+'/Preference/support-setting';
|
||||||
|
|
||||||
|
$.post(url, {format:"json", data: data}, function(data){
|
||||||
|
var json = $.parseJSON(data);
|
||||||
|
$("#support-feedback-view").parent().empty().append(json.html);
|
||||||
|
setUpEventListeners();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$("#SupportFeedback").click( function(){
|
$("#SupportFeedback").click( function(){
|
||||||
var pub = $("#Publicise");
|
var pub = $("#Publicise");
|
||||||
if( !$(this).is(':checked') ){
|
if( !$(this).is(':checked') ){
|
||||||
|
@ -81,4 +96,4 @@ $(document).ready(function() {
|
||||||
logoEl.find(".errors").remove();
|
logoEl.find(".errors").remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
Loading…
Reference in New Issue