Skip to content

Commit

Permalink
Fixed issue: On survey copy fields are translinked even when chosen n…
Browse files Browse the repository at this point in the history
…ot to

Dev Use Switch widget in Copy/import dialog
  • Loading branch information
c-schmitz committed May 30, 2016
1 parent 239e6ef commit a633960
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 17 deletions.
14 changes: 7 additions & 7 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -1174,23 +1174,23 @@ public function copy()

$sNewSurveyName = Yii::app()->request->getPost('copysurveyname');

if (Yii::app()->request->getPost('copysurveyexcludequotas') == "on")
if (Yii::app()->request->getPost('copysurveyexcludequotas') == "1")
{
$aExcludes['quotas'] = true;
}
if (Yii::app()->request->getPost('copysurveyexcludepermissions') == "on")
if (Yii::app()->request->getPost('copysurveyexcludepermissions') == "1")
{
$aExcludes['permissions'] = true;
}
if (Yii::app()->request->getPost('copysurveyexcludeanswers') == "on")
if (Yii::app()->request->getPost('copysurveyexcludeanswers') == "1")
{
$aExcludes['answers'] = true;
}
if (Yii::app()->request->getPost('copysurveyresetconditions') == "on")
if (Yii::app()->request->getPost('copysurveyresetconditions') == "1")
{
$aExcludes['conditions'] = true;
}
if (Yii::app()->request->getPost('copysurveyresetstartenddate') == "on")
if (Yii::app()->request->getPost('copysurveyresetstartenddate') == "1")
{
$aExcludes['dates'] = true;
}
Expand Down Expand Up @@ -1221,7 +1221,7 @@ public function copy()

if ($action == 'importsurvey' && !$aData['bFailed'])
{
$aImportResults=importSurveyFile($sFullFilepath,(isset($_POST['translinksfields'])));
$aImportResults=importSurveyFile($sFullFilepath,($_POST['translinksfields']=='1'));
if (is_null($aImportResults) || !empty($aImportResults['error']))
{
$aData['sErrorMessage']=isset($aImportResults['error']) ? $aImportResults['error'] : gT("Unknown error.");
Expand All @@ -1230,7 +1230,7 @@ public function copy()
}
elseif ($action == 'copysurvey' && !$aData['bFailed'])
{
$aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName, sanitize_int(App()->request->getParam('copysurveyid')) ,(isset($_POST['translinksfields'])));
$aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName, sanitize_int(App()->request->getParam('copysurveyid')), ($_POST['copysurveytranslinksfields']=='1'));
if (isset($aExcludes['conditions']))
{
Question::model()->updateAll(array('relevance'=>'1'),'sid='.$aImportResults['newsid']);
Expand Down
52 changes: 44 additions & 8 deletions application/views/admin/survey/subview/tabCopy_view.php
Expand Up @@ -38,7 +38,7 @@
<!-- New survey id -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyid'><?php echo eT("New survey id:"); ?> </label>
<div class="col-sm-5">
<div class="col-sm-1">
<input type='text' id='copysurveyid' size='82' maxlength='6' name='copysurveyid' value='' class="form-control" />
</div>
<div class="col-sm-2">
Expand All @@ -50,49 +50,85 @@

<!-- Convert resource links -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveytranslinksfields'><?php echo eT("Convert resource links and INSERTANS fields?"); ?> </label>
<label class="col-sm-3 control-label" for='copysurveytranslinksfields'><?php echo eT("Convert resource links and expression fields?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveytranslinksfields' name="copysurveytranslinksfields" type="checkbox" checked='checked'/>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveytranslinksfields',
'value'=> "1",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

<!-- Exclude quotas -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyexcludequotas'><?php echo eT("Exclude quotas?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveyexcludequotas' name="copysurveyexcludequotas" type="checkbox" />
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveyexcludequotas',
'value'=> "0",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

<!-- Exclude survey permissions -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyexcludepermissions'><?php echo eT("Exclude survey permissions?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveyexcludepermissions' name="copysurveyexcludepermissions" type="checkbox" />
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveyexcludepermissions',
'value'=> "0",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

<!-- Exclude answers -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyexcludeanswers'><?php echo eT("Exclude answers?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveyexcludeanswers' name="copysurveyexcludeanswers" type="checkbox" />
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveyexcludeanswers',
'value'=> "0",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

<!-- Reset conditions/relevance -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyresetconditions'><?php echo eT("Reset conditions/relevance?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveyresetconditions' name="copysurveyresetconditions" type="checkbox" />
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveyresetconditions',
'value'=> "0",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

<!-- Reset start/end date/time -->
<div class="form-group">
<label class="col-sm-3 control-label" for='copysurveyresetstartenddate'><?php echo eT("Reset start/end date/time?"); ?> </label>
<div class="col-sm-5">
<input id='copysurveyresetstartenddate' name="copysurveyresetstartenddate" type="checkbox" />
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'copysurveyresetstartenddate',
'value'=> "0",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

Expand Down
10 changes: 8 additions & 2 deletions application/views/admin/survey/subview/tabImport_view.php
Expand Up @@ -18,9 +18,15 @@

<!-- Convert resource links and INSERTANS fields? -->
<div class='form-group'>
<label class='control-label col-sm-3' for='translinksfields'><?php eT("Convert resource links and INSERTANS fields?"); ?> </label>
<label class='control-label col-sm-3' for='translinksfields'><?php eT("Convert resource links and expression fields?"); ?> </label>
<div class='col-sm-4'>
<input id='translinksfields' name="translinksfields" type="checkbox" checked='checked'/>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'translinksfields',
'value'=> "1",
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
));
?>
</div>
</div>

Expand Down

0 comments on commit a633960

Please sign in to comment.