Skip to content

Commit

Permalink
Dev: renamed data security to survey policy
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Mar 9, 2018
1 parent 3ca6da4 commit 8877379
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 55 deletions.
10 changes: 5 additions & 5 deletions application/controllers/admin/database.php
Expand Up @@ -66,7 +66,7 @@ class database extends Survey_Common_Action
'showqnumcode' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'shownoanswer' => ['type'=> 'yesno', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'showwelcome' => ['type'=> 'yesno', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'showdatasecuritynotice' => ['type'=> '', 'default' => 0, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'showsurveypolicynotice' => ['type'=> '', 'default' => 0, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'allowprev' => ['type'=> 'yesno', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'questionindex' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'nokeyboard' => ['type'=> 'yesno', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
Expand Down Expand Up @@ -848,15 +848,15 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
if ($datasec !== null) {
// Fix bug with FCKEditor saving strange BR types
$datasec = $this->oFixCKeditor->fixCKeditor($datasec);
$data['surveyls_datasecurity_notice'] = $datasec;
$data['surveyls_policy_notice'] = $datasec;
}
if ($datasecerror !== null) {
// Fix bug with FCKEditor saving strange BR types
$datasecerror = $this->oFixCKeditor->fixCKeditor($datasecerror);
$data['surveyls_datasecurity_error'] = $datasecerror;
$data['surveyls_policy_error'] = $datasecerror;
}
if ($dataseclabel !== null) {
$data['surveyls_datasecurity_notice_label'] = $dataseclabel;
$data['surveyls_policy_notice_label'] = $dataseclabel;
}
if ($sURL !== null) {
$data['surveyls_url'] = html_entity_decode($sURL, ENT_QUOTES, "UTF-8");
Expand Down Expand Up @@ -949,7 +949,7 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
$oSurvey->showqnumcode = $this->_filterEmptyFields($oSurvey, 'showqnumcode');
$oSurvey->shownoanswer = $this->_filterEmptyFields($oSurvey, 'shownoanswer');
$oSurvey->showwelcome = $this->_filterEmptyFields($oSurvey, 'showwelcome');
$oSurvey->showdatasecuritynotice = $this->_filterEmptyFields($oSurvey, 'showdatasecuritynotice');
$oSurvey->showsurveypolicynotice = $this->_filterEmptyFields($oSurvey, 'showsurveypolicynotice');
$oSurvey->allowprev = $this->_filterEmptyFields($oSurvey, 'allowprev');
$oSurvey->questionindex = (int) $this->_filterEmptyFields($oSurvey, 'questionindex');
$oSurvey->nokeyboard = $this->_filterEmptyFields($oSurvey, 'nokeyboard');
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -946,11 +946,11 @@ private function displayFirstPageIfNeeded()
if ($this->sSurveyMode == 'survey' || $bDisplayFirstPage) {
//Failsave to have a general standard value
if (empty($this->aSurveyInfo['datasecurity_notice_label'])) {
$this->aSurveyInfo['datasecurity_notice_label'] = gT("Please accept the data security policy");
$this->aSurveyInfo['datasecurity_notice_label'] = gT("To continue please first accept our survey policy.");
}

if (empty($this->aSurveyInfo['datasecurity_error'])) {
$this->aSurveyInfo['datasecurity_error'] = gT("You have to accept the data security policy!");
$this->aSurveyInfo['datasecurity_error'] = gT("You will have to accept our survey policy!");
}

$this->aSurveyInfo['description'] = $this->processString($this->aSurveyInfo['description']);
Expand All @@ -969,7 +969,7 @@ private function displayFirstPageIfNeeded()
}

private function checkForDataSecurityAccepted(){
if($this->param['thisstep'] === '0' && Survey::model()->findByPk($this->aSurveyInfo['sid'])->showdatasecuritynotice>0) {
if($this->param['thisstep'] === '0' && Survey::model()->findByPk($this->aSurveyInfo['sid'])->showsurveypolicynotice>0) {
$data_security_accepted = App()->request->getPost('datasecurity_accepted', false);
// if($data_security_accepted !== 'on' && ($this->aSurveyInfo['active'] == 'Y')){
if($data_security_accepted !== 'on'){
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/survey_helper.php
Expand Up @@ -46,7 +46,7 @@ function getSurveyDefaultSettings()
'expires' => '',
'showqnumcode' => 'X',
'showwelcome' => 'Y',
'showdatasecuritynotice' => 0,
'showsurveypolicynotice' => 0,
'emailresponseto' => '',
'assessments' => 'N',
'navigationdelay' => 0);
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/common_helper.php
Expand Up @@ -871,9 +871,9 @@ function getSurveyInfo($surveyid, $languagecode = '')
$thissurvey['name'] = $thissurvey['surveyls_title'];
$thissurvey['description'] = $thissurvey['surveyls_description'];
$thissurvey['welcome'] = $thissurvey['surveyls_welcometext'];
$thissurvey['datasecurity_notice_label'] = $thissurvey['surveyls_datasecurity_notice_label'];
$thissurvey['datasecurity_error'] = $thissurvey['surveyls_datasecurity_error'];
$thissurvey['datasecurity_notice'] = $thissurvey['surveyls_datasecurity_notice'];
$thissurvey['datasecurity_notice_label'] = $thissurvey['surveyls_policy_notice_label'];
$thissurvey['datasecurity_error'] = $thissurvey['surveyls_policy_error'];
$thissurvey['datasecurity_notice'] = $thissurvey['surveyls_policy_notice'];
$thissurvey['templatedir'] = $thissurvey['template'];
$thissurvey['adminname'] = $thissurvey['admin'];
$thissurvey['tablename'] = $oSurvey->responsesTableName;
Expand Down
18 changes: 9 additions & 9 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -9345,26 +9345,26 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
$errClass = ($LEM->em->HasErrors() ? 'danger' : '');
$out .= "<tr class='LEMgroup $errClass'><td>" . $LEM->gT("End URL:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_datasecurity_notice'] != '')
if ($aSurveyInfo['surveyls_policy_notice'] != '')
{
$LEM->ProcessString($aSurveyInfo['surveyls_datasecurity_notice'],0);
$LEM->ProcessString($aSurveyInfo['surveyls_policy_notice'],0);
$sPrint= viewHelper::purified(viewHelper::filterScript($LEM->GetLastPrettyPrintExpression()));
$errClass = ($LEM->em->HasErrors() ? 'danger' : '');
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Data security:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Survey policy notice:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_datasecurity_error'] != '')
if ($aSurveyInfo['surveyls_policy_error'] != '')
{
$LEM->ProcessString($aSurveyInfo['surveyls_datasecurity_error'],0);
$LEM->ProcessString($aSurveyInfo['surveyls_policy_error'],0);
$sPrint= viewHelper::purified(viewHelper::filterScript($LEM->GetLastPrettyPrintExpression()));
$errClass = ($LEM->em->HasErrors() ? 'danger' : '');
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Data security:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Survey policy error:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_datasecurity_notice_label'] != '')
if ($aSurveyInfo['surveyls_policy_notice_label'] != '')
{
$LEM->ProcessString($aSurveyInfo['surveyls_datasecurity_notice_label'],0);
$LEM->ProcessString($aSurveyInfo['surveyls_policy_notice_label'],0);
$sPrint= viewHelper::purified(viewHelper::filterScript($LEM->GetLastPrettyPrintExpression()));
$errClass = ($LEM->em->HasErrors() ? 'danger' : '');
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Data security label:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
$out .= "<tr class='LEMgroup $errClass'><td >" . $LEM->gT("Survey policy label:") . "</td><td colspan=\"3\">" . $sPrint . "</td></tr>";
}
}

Expand Down
8 changes: 4 additions & 4 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -2200,10 +2200,10 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
*/
if ($iOldDBVersion < 348) {
$oTransaction = $oDB->beginTransaction();
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_datasecurity_notice', 'text');
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_datasecurity_error', 'text');
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_datasecurity_notice_label', 'string(192)');
$oDB->createCommand()->addColumn('{{surveys}}', 'showdatasecuritynotice', 'int DEFAULT 0');
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_policy_notice', 'text');
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_policy_error', 'text');
$oDB->createCommand()->addColumn('{{surveys_languagesettings}}', 'surveyls_policy_notice_label', 'string(192)');
$oDB->createCommand()->addColumn('{{surveys}}', 'showsurveypolicynotice', 'int DEFAULT 0');

$oDB->createCommand()->update('{{settings_global}}', ['stg_value'=>348], "stg_name='DBVersion'");
$oTransaction->commit();
Expand Down
8 changes: 5 additions & 3 deletions application/models/Survey.php
Expand Up @@ -139,7 +139,7 @@
* @property bool $isShowQnumCode Show question number and/or code
* @property bool $isShowWelcome Show welcome screen
* @property bool $isShowProgress how progress bar
* @property bool $showdatasecuritynotice Show the security notice
* @property bool $showsurveypolicynotice Show the security notice
* @property bool $isNoKeyboard Show on-screen keyboard
* @property bool $isAllowEditAfterCompletion Allow multiple responses or update responses with one token
* @property SurveyLanguageSetting $defaultlanguage
Expand All @@ -159,6 +159,8 @@ class Survey extends LSActiveRecord


public $searched_value;

public $showsurveypolicynotice = 0;


private $sSurveyUrl;
Expand Down Expand Up @@ -363,7 +365,7 @@ public function rules()
array('showxquestions', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('shownoanswer', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('showwelcome', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('showdatasecuritynotice', 'in', 'range'=>array('0', '1', '2'), 'allowEmpty'=>true),
array('showsurveypolicynotice', 'in', 'range'=>array('0', '1', '2'), 'allowEmpty'=>true),
array('showprogress', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('questionindex', 'numerical', 'min' => 0, 'max' => 2, 'allowEmpty'=>false),
array('nokeyboard', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
Expand Down Expand Up @@ -1856,7 +1858,7 @@ public static function replacePolicyLink($dataSecurityNoticeLabel, $surveyId) {
$STARTPOLICYLINK = "";
$ENDPOLICYLINK = "";

if(self::model()->findByPk($surveyId)->showdatasecuritynotice == 2){
if(self::model()->findByPk($surveyId)->showsurveypolicynotice == 2){
$STARTPOLICYLINK = "<a href='#data-security-modal-".$surveyId."' data-toggle='modal'>";
$ENDPOLICYLINK = "</a>";
}
Expand Down
8 changes: 4 additions & 4 deletions application/models/SurveyLanguageSetting.php
Expand Up @@ -23,7 +23,7 @@
* @property string $surveyls_description Survey description in this language
* @property string $surveyls_welcometext Survey welcome-text in this language
* @property string $surveyls_endtext Survey end-text in this language
* @property string $surveyls_datasecurity_notice The survey data-security notice
* @property string $surveyls_policy_notice The survey data-security notice
* @property string $surveyls_url Survey end-url for this language
* @property string $surveyls_urldescription Survey end-url description for this language
* @property string $surveyls_email_invite_subj Survey inivitation e-mail subject for this language
Expand Down Expand Up @@ -117,9 +117,9 @@ public function rules()
array('surveyls_description', 'LSYii_Validators'),
array('surveyls_welcometext', 'LSYii_Validators'),
array('surveyls_endtext', 'LSYii_Validators'),
array('surveyls_datasecurity_notice', 'LSYii_Validators'),
array('surveyls_datasecurity_error', 'LSYii_Validators'),
array('surveyls_datasecurity_notice_label', 'LSYii_Validators'),
array('surveyls_policy_notice', 'LSYii_Validators'),
array('surveyls_policy_error', 'LSYii_Validators'),
array('surveyls_policy_notice_label', 'LSYii_Validators'),
array('surveyls_url', 'LSYii_Validators', 'isUrl'=>true),
array('surveyls_urldescription', 'LSYii_Validators'),

Expand Down
12 changes: 6 additions & 6 deletions application/views/admin/survey/editLocalSettings_view.php
Expand Up @@ -140,19 +140,19 @@
<!-- Data security checkbox label -->
<div class="form-group">
<label class="control-label"><?php eT("Data security checkbox label:"); ?>
<i class="fa fa-question-circle" id="dataseclabel_popover_<?=$aSurveyLanguageSettings['surveyls_language']?>" data-toggle="popover" title="<?=gT('Howto link to data policy statement')?>" data-content="<?php
eT("If you want to specify a link to the data security policy please use the placeholders {STARTPOLICYLINK} and {ENDPOLICYLINK} to define the link that opens the popup. If there is no placeholder given, there will be an appendix.")
<i class="fa fa-question-circle" id="dataseclabel_popover_<?=$aSurveyLanguageSettings['surveyls_language']?>" data-toggle="popover" title="<?=gT('Howto link to survey policy statement modal')?>" data-content="<?php
eT("If you want to specify a link to the survey policy please use the placeholders {STARTPOLICYLINK} and {ENDPOLICYLINK} to define the link that opens the popup. If there is no placeholder given, there will be an appendix.")
?>"></i> </label>
<div class="">
<?php echo CHtml::textField("dataseclabel_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_datasecurity_notice_label'],array('class'=>'form-control','size'=>"80",'id'=>"dataseclabel_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
<?php echo CHtml::textField("dataseclabel_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_policy_notice_label'],array('class'=>'form-control','size'=>"80",'id'=>"dataseclabel_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
</div>
</div>
<!-- Data security message -->
<div class="form-group">
<div class="form-group">s
<label class=" control-label" for='datasec_<?php echo $aSurveyLanguageSettings['surveyls_language']; ?>'><?php eT("Data security message:"); ?></label>
<div class="">
<div class="htmleditor input-group">
<?php echo CHtml::textArea("datasec_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_datasecurity_notice'],array('class'=>'form-control','cols'=>'80','rows'=>'20','id'=>"datasec_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
<?php echo CHtml::textArea("datasec_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_policy_notice'],array('class'=>'form-control','cols'=>'80','rows'=>'20','id'=>"datasec_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
<?php echo getEditor("survey-datasec","datasec_".$aSurveyLanguageSettings['surveyls_language'], "[".gT("Data security:", "js")."](".$aSurveyLanguageSettings['surveyls_language'].")",$surveyid,'','',$action); ?>
</div>
</div>
Expand All @@ -164,7 +164,7 @@
<label class=" control-label" for='datasecerror_<?php echo $aSurveyLanguageSettings['surveyls_language']; ?>'><?php eT("Data security error message:"); ?></label>
<div class="">
<div class="htmleditor input-group">
<?php echo CHtml::textArea("datasecerror_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_datasecurity_error'],array('class'=>'form-control','cols'=>'80','rows'=>'15','id'=>"datasecerror_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
<?php echo CHtml::textArea("datasecerror_{$aSurveyLanguageSettings['surveyls_language']}",$aSurveyLanguageSettings['surveyls_policy_error'],array('class'=>'form-control','cols'=>'80','rows'=>'15','id'=>"datasecerror_{$aSurveyLanguageSettings['surveyls_language']}")); ?>
<?php echo getEditor("survey-datasec-error","datasecerror_".$aSurveyLanguageSettings['surveyls_language'], "[".gT("Data security error:", "js")."](".$aSurveyLanguageSettings['surveyls_language'].")",$surveyid,'','',$action); ?>
</div>
</div>
Expand Down

0 comments on commit 8877379

Please sign in to comment.