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

View file

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

View file

@ -10,8 +10,13 @@ class Application_Form_RegisterAirtime extends Zend_Form
$country_list = Application_Model_Preference::GetCountryList(); $country_list = Application_Model_Preference::GetCountryList();
$privacyChecked = false;
if(Application_Model_Preference::GetPrivacyPolicyCheck() == 1){
$privacyChecked = true;
}
$this->setDecorators(array( $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))) 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) public function isValid ($data)
{ {
$isValid = parent::isValid($data); $isValid = parent::isValid($data);
if(isset($data["Privacy"])){
$checkPrivacy = $this->getElement('Privacy'); $checkPrivacy = $this->getElement('Privacy');
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){ if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
$checkPrivacy->addError("You have to agree to privacy policy."); $checkPrivacy->addError("You have to agree to privacy policy.");
$isValid = false; $isValid = false;
} }
}
return $isValid; return $isValid;
} }
} }

View file

@ -367,5 +367,13 @@ class Application_Model_Preference
public static function GetImportTimestamp(){ public static function GetImportTimestamp(){
return Application_Model_Preference::GetValue("import_timestamp"); 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>
<div> <div>
<br> <br>
<?php if(!$this->privacyChecked){?>
<label class="optional" for="Privacy"> <label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?> <?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?> <?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label> </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> </div>
</form> </form>
</div> </div>

View file

@ -159,6 +159,7 @@
</div> </div>
<div> <div>
<br> <br>
<?php if(!$this->element->getView()->privacyChecked){?>
<label class="optional" for="Privacy"> <label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?> <?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?> <?php echo $this->element->getElement('Privacy')->getLabel() ?>
@ -170,5 +171,8 @@
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?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> </div>
</fieldset> </fieldset>

View file

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