CC-2425:Tweak phone home

- privacy check box is uncheck by defalut
- 'Yes' button is disabled on popup form by default
- custom error msg is added for privacy checkbox on preference
form
- promote form is hidden by default
This commit is contained in:
James 2011-06-26 23:13:49 -04:00
parent 1243c60442
commit c5ec6b5a53
6 changed files with 52 additions and 14 deletions

View File

@ -25,13 +25,11 @@ class PreferenceController extends Zend_Controller_Action
$this->view->statusMsg = "";
$form = new Application_Form_Preferences();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$values = $form->getValues();
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
@ -60,10 +58,8 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetStationLogo($imagePath);
$this->view->statusMsg = "<div class='success'>Preferences updated.</div>";
}
}
$this->view->supportFeedback = Application_Model_Preference::GetSupportFeedback();
$logo = Application_Model_Preference::GetStationLogo();
if($logo){
$this->view->logoImg = $logo;

View File

@ -140,8 +140,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"\">privacy policy</a>.")
->setDecorators(array('ViewHelper'))
->setValue(1);
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
}

View File

@ -128,6 +128,24 @@ class Application_Form_SupportPreferences extends Zend_Form_SubForm
'ViewHelper'
)
));
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"\">privacy policy</a>.")
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
// overwriting isValid function
public function isValid ($data)
{
parent::isValid($data);
$checkPrivacy = $this->getElement('Privacy');
if($data["SupportFeedback"] == "1" && $data["Privacy"] != "1"){
$checkPrivacy->addError("You have to agree to privacy policy.");
return false;
}
return true;
}
}

View File

@ -15,7 +15,6 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="info-text">By checking this box, I agree to Sourcefabric's <a id="link_to_privacy" href="">privacy policy</a>.</div>
</dd>
<dd id="publicize-element">
<label class="optional" for="Publicise">
@ -30,7 +29,9 @@
</ul>
<?php endif; ?>
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to publicise your station, "Send support feedback" must be enabled</p></div>
<dl id="public-info" style="display:none;">
<dt id="Phone-label" class="block-display">
<label class="optional" for="Phone"><?php echo $this->element->getElement('Phone')->getLabel() ?></label>
</dt>
@ -112,10 +113,11 @@
<dt id="Logo-label" class="block-display">
<label class="optional" for="Description"><?php echo $this->element->getElement('Logo')->getLabel() ?></label>
</dt>
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<dd id="Logo-element" class="block-display clearfix">
<?php if($this->element->getView()->logoImg){?>
<div id="Logo-img-container"><img id="logo-img" onload='resizeImg(this);' src="data:image/png;base64,<?php echo $this->element->getView()->logoImg ?>" /></div>
<?php }?>
<?php echo $this->element->getElement('Logo') ?>
<div class="info-text"><p>Min. size: 200x200 Max. size: 600x600</p></div>
<?php if($this->element->getElement('Logo')->hasErrors()) : ?>
@ -126,7 +128,6 @@
</ul>
<?php endif; ?>
</dd>
</dl>
<h3 class="collapsible-header">
<span class="arrow-icon"></span>Show me what I am sending
@ -139,4 +140,18 @@
</dl>
</fieldset>
</div>
<div>
<br>
<label class="optional" for="Privacy">
<?php echo $this->element->getElement('Privacy') ?>
<?php echo $this->element->getElement('Privacy')->getLabel() ?>
</label>
<?php if($this->element->getElement('Privacy')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('Privacy')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</fieldset>

View File

@ -37,7 +37,9 @@ $(document).ready(function(){
}
]
});
var button = $("#help_airtime");
button.attr('disabled', 'disabled').addClass('ui-state-disabled');
dialog.dialog('open');
})

View File

@ -53,6 +53,14 @@ $(document).ready(function() {
pub.removeAttr("disabled");
}
});
$("#Publicise").live('click', function(){
if($(this).is(':checked')){
$("#public-info").show();
}else{
$("#public-info").hide();
}
});
showErrorSections();