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()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$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->statusMsg = "";
|
||||
|
||||
|
||||
$form = new Application_Form_SupportSettings();
|
||||
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 ($values["Publicise"] != 1) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
@ -133,7 +138,9 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->privacyChecked = $privacyChecked;
|
||||
$this->view->section_title = _('Support Feedback');
|
||||
$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()
|
||||
|
|
|
@ -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>
|
||||
<?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">
|
||||
<?php echo $this->statusMsg ?>
|
||||
<?php echo $this->form ?>
|
||||
</div>
|
||||
<div class="button-bar bottom" id="submit-element">
|
||||
<?php echo $this->form->getElement('submit') ?>
|
||||
</div>
|
||||
<br />
|
||||
<button name="support_save" id="support_save" type="button" class="btn right-floated"><? echo _("Save") ?></button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -11,8 +11,23 @@ function showErrorSections() {
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
setUpEventListeners();
|
||||
});
|
||||
|
||||
function setUpEventListeners() {
|
||||
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(){
|
||||
var pub = $("#Publicise");
|
||||
if( !$(this).is(':checked') ){
|
||||
|
@ -81,4 +96,4 @@ $(document).ready(function() {
|
|||
logoEl.find(".errors").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue