SAAS-69: Support Settings: Change/hide some sections for SaaS

- Some sections are hidden when saas is enabeld
as described in the ticket.
This commit is contained in:
James 2011-11-15 16:10:40 -05:00
parent 00f37296e8
commit a723430462
6 changed files with 78 additions and 60 deletions

View File

@ -1,6 +1,5 @@
<?php
require_once __DIR__."/configs/navigation.php";
require_once __DIR__."/configs/ACL.php";
require_once 'propel/runtime/lib/Propel.php';
@ -24,6 +23,8 @@ if (PEAR::isError($CC_DBC)) {
}
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
require_once __DIR__."/configs/navigation.php";
//DateTime in PHP 5.3.0+ need a default timezone set.
date_default_timezone_set(Application_Model_Preference::GetTimezone());

View File

@ -67,7 +67,8 @@ $pages = array(
'action' => 'stream-setting'
),
array(
'label' => 'Support Settings',
'label' =>
Application_Model_Preference::GetPlanLevel() == 'disabled'?'Support Settings':'Station Information Settings',
'module' => 'default',
'controller' => 'Preference',
'action' => 'support-setting'

View File

@ -63,12 +63,14 @@ class PreferenceController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/support-setting.js','text/javascript');
$this->view->statusMsg = "";
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$form = new Application_Form_SupportSettings();
if ($request->isPost()) {
$values = $request->getPost();
if ($form->isValid($values)) {
if ($values["Publicise"] != 1){
if (!$isSass && $values["Publicise"] != 1){
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
if(isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
@ -78,8 +80,10 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetPhone($values["Phone"]);
Application_Model_Preference::SetEmail($values["Email"]);
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
if(!$isSass){
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
Application_Model_Preference::SetPublicise($values["Publicise"]);
}
$form->Logo->receive();
$imagePath = $form->Logo->getFileName();
@ -88,7 +92,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetStationCity($values["City"]);
Application_Model_Preference::SetStationDescription($values["Description"]);
Application_Model_Preference::SetStationLogo($imagePath);
if(isset($values["Privacy"])){
if(!$isSass && isset($values["Privacy"])){
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
}
}
@ -104,6 +108,7 @@ class PreferenceController extends Zend_Controller_Action
$privacyChecked = true;
}
$this->view->privacyChecked = $privacyChecked;
$this->view->section_title = Application_Model_Preference::GetPlanLevel() == 'disabled'?'Support Settings':'Station Information Settings';
$this->view->form = $form;
//$form->render($this->view);
}

View File

@ -4,13 +4,16 @@ require_once 'customfilters/ImageSize.php';
class Application_Form_SupportSettings extends Zend_Form
{
private $isSass;
public function init()
{
$country_list = Application_Model_Preference::GetCountryList();
$isSass = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$this->isSass = $isSass;
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
array('ViewScript', array('viewScript' => 'form/support-setting.phtml', "isSaas" => $isSass)),
array('File', array('viewScript' => 'form/support-setting.phtml', 'placement' => false)))
);
@ -106,46 +109,48 @@ class Application_Form_SupportSettings extends Zend_Form
$upload->setAttrib('accept', 'image/jpeg,image/gif,image/png,image/jpg');
$this->addElement($upload);
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback',
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
'ViewHelper'
)
));
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
if(Application_Model_Preference::GetSupportFeedback() == '0'){
$checkboxPublicise->setAttrib("disabled", "disabled");
if(!$isSass){
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback',
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
'ViewHelper'
)
));
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
if(Application_Model_Preference::GetSupportFeedback() == '0'){
$checkboxPublicise->setAttrib("disabled", "disabled");
}
$this->addElement($checkboxPublicise);
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array(
'class' => 'sending_textarea',
'required' => false,
'filters' => array('StringTrim'),
'readonly' => true,
'cols' => 61,
'rows' => 5,
'value' => Application_Model_Preference::GetSystemInfo(),
'decorators' => array(
'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=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
$this->addElement($checkboxPublicise);
// text area for sending detail
$this->addElement('textarea', 'SendInfo', array(
'class' => 'sending_textarea',
'required' => false,
'filters' => array('StringTrim'),
'readonly' => true,
'cols' => 61,
'rows' => 5,
'value' => Application_Model_Preference::GetSystemInfo(),
'decorators' => array(
'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=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
// submit button
$submit = new Zend_Form_Element_Submit("submit");
@ -160,14 +165,16 @@ class Application_Form_SupportSettings extends Zend_Form
public function isValid ($data)
{
$isValid = parent::isValid($data);
if($data['Publicise'] != 1){
$isValid = true;
}
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;
if(!$this->isSass){
if($data['Publicise'] != 1){
$isValid = true;
}
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

@ -1,4 +1,5 @@
<fieldset class="padded">
<?php if( !$this->isSaas ){?>
<dl class="zend_form">
<dd id="SupportFeedback-element" style="width:90%;">
<div class="info-text">Help Airtime improve by letting us know you are using it. This info
@ -32,8 +33,9 @@
<?php endif; ?>
</dd>
</dl>
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
<dl id="public-info" style="display:none;">
<div class="info-text" style="clear: both;padding: 4px 0 4px 15px;"><p> Note: In order to promote your station, "Send support feedback" must be enabled</p></div>
<?php }?>
<dl id="public-info" style="display:<?php echo !$this->isSaas?"none":"block"?>;">
<dt id="stationName-label" class="block-display">
<label class="required" for="stationName"><?php echo $this->element->getElement('stationName')->getLabel() ?>
<span class="info-text-small">(Required)</span>:
@ -148,7 +150,7 @@
<?php endif; ?>
</dd>
</dl>
<?php if( !$this->isSaas ){?>
<div id="show_what_sending" style="display: block;">
<fieldset class="display_field toggle closed">
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Show me what I am sending </legend>
@ -157,6 +159,7 @@
</dl>
</fieldset>
</div>
<div>
<br>
<?php if(!$this->element->getView()->privacyChecked){?>
@ -175,4 +178,5 @@
<a id="link_to_terms_and_condition" href="http://www.sourcefabric.org/en/about/policy/" onclick="window.open(this.href); return false;">Terms and Conditions</a>
<?php }?>
</div>
<?php } ?>
</fieldset>

View File

@ -1,5 +1,5 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong preferences">
<h2>Support Settings</h2>
<h2><?php echo $this->section_title?></h2>
<form method="post" action="/Preference/support-setting" enctype="multipart/form-data">
<div id="support-settings">
<?php echo $this->statusMsg ?>