CC-2718: Changes to the support page

- stroing and retreving new value "privact" to DB
- Displaying "Terms and Condition" link when user agrees it
This commit is contained in:
James 2011-08-23 15:11:21 -04:00
parent 6c2f94dec7
commit 3e3391dfba
8 changed files with 86 additions and 44 deletions

View file

@ -29,8 +29,11 @@ class NowplayingController extends Zend_Controller_Action
$form = new Application_Form_RegisterAirtime();
$values = $request->getPost();
if ($values["Publicise"] != 1){
if ($values["Publicise"] != 1 && $form->isValid($values)){
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if(isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
// unset session
Zend_Session::namespaceUnset('referrer');
}
@ -49,10 +52,12 @@ class NowplayingController extends Zend_Controller_Action
Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if(isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
// unset session
Zend_Session::namespaceUnset('referrer');
}else{
var_dump($form->getMessages());
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;

View file

@ -60,9 +60,14 @@ class PreferenceController extends Zend_Controller_Action
$form = new Application_Form_SupportSettings();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$values = $form->getValues();
$values = $request->getPost();
if ($form->isValid($values)) {
if ($values["Publicise"] != 1){
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if(isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
}else{
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]);
@ -77,7 +82,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
}
$this->view->statusMsg = "<div class='success'>Support setting updated.</div>";
}
}
@ -85,7 +90,13 @@ class PreferenceController extends Zend_Controller_Action
if($logo){
$this->view->logoImg = $logo;
}
$privacyChecked = false;
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
$privacyChecked = true;
}
$this->view->privacyChecked = $privacyChecked;
$this->view->form = $form;
//$form->render($this->view);
}
public function directoryConfigAction()

View file

@ -10,8 +10,13 @@ class Application_Form_RegisterAirtime extends Zend_Form
$country_list = Application_Model_Preference::GetCountryList();
$privacyChecked = false;
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
$privacyChecked = true;
}
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml')),
array('ViewScript', array('viewScript' => 'form/register-dialog.phtml', 'privacyChecked'=>$privacyChecked)),
array('File', array('viewScript' => 'form/register-dialog.phtml', 'placement' => false)))
);

View file

@ -161,11 +161,13 @@ class Application_Form_SupportSettings extends Zend_Form
public function isValid ($data)
{
$isValid = parent::isValid($data);
if(isset($data["Privacy"])){
$checkPrivacy = $this->getElement('Privacy');
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
$checkPrivacy->addError("You have to agree to privacy policy.");
$isValid = false;
}
}
return $isValid;
}
}

View file

@ -367,5 +367,13 @@ class Application_Model_Preference
public static function GetImportTimestamp(){
return Application_Model_Preference::GetValue("import_timestamp");
}
public static function SetPrivacyPolicyCheck($flag){
Application_Model_Preference::SetValue("privacy_policy", $flag);
}
public static function GetPrivacyPolicyCheck(){
return Application_Model_Preference::GetValue("privacy_policy");
}
}

View file

@ -166,10 +166,14 @@
</div>
<div>
<br>
<?php if(!$this->privacyChecked){?>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>
<?php }else{?>
<a id="link_to_privacy" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<?php }?>
</div>
</form>
</div>

View file

@ -159,6 +159,7 @@
</div>
<div>
<br>
<?php if(!$this->element->getView()->privacyChecked){?>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
@ -170,5 +171,8 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php }else{?>
<a id="link_to_privacy" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<?php }?>
</div>
</fieldset>

View file

@ -52,7 +52,10 @@ $(document).ready(function() {
if(!$("#SupportFeedback").is(':checked')){
promote.removeAttr("checked");
promote.attr("disabled", true);
}else{
promote.removeAttr("disabled");
}
promote.live('click', function(){
if($(this).is(':checked')){
$("#public-info").show();