Skip to content

Commit

Permalink
Fixed issue #6499: Unported CI code in import_helper.php
Browse files Browse the repository at this point in the history
Dev Renamed survey archive extension to .lha
  • Loading branch information
c-schmitz committed Aug 20, 2012
1 parent 0dbc8ab commit 3fdc243
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion application/controllers/Statistics_userController.php
Expand Up @@ -35,7 +35,7 @@ public function _remap($method, $params = array())
return call_user_func_array(array($this, "action"), $params);
}

function actionAction($surveyid,$postlang)
function actionAction($iSurveyID,$language)
{
$surveyid=(int)$surveyid;
//$postlang = returnglobal('lang');
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/export.php
Expand Up @@ -1229,7 +1229,7 @@ private function _exportarchive($iSurveyID, $bSendToBrowser=TRUE)
{
if ( $bSendToBrowser )
{
$fn = "survey_archive_{$iSurveyID}.zip";
$fn = "survey_archive_{$iSurveyID}.lsa";

//Send the file for download!
$this->_addHeaders($fn, "application/force-download", 0);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -884,7 +884,7 @@ public function copy()
}
}

if (!$aData['bFailed'] && (strtolower($sExtension) != 'csv' && strtolower($sExtension) != 'lss' && strtolower($sExtension) != 'xls' && strtolower($sExtension) != 'zip'))
if (!$aData['bFailed'] && (strtolower($sExtension) != 'csv' && strtolower($sExtension) != 'lss' && strtolower($sExtension) != 'xls' && strtolower($sExtension) != 'lsa'))
{
$aData['sErrorMessage'] = $clang->gT("Import failed. You specified an invalid file type.");
$aData['bFailed'] = true;
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/survey/index.php
Expand Up @@ -202,7 +202,7 @@ function action()
$link .= "/lang-".sanitize_languagecode($param['lang']);
}
$link .= "' $langtag class='surveytitle'>".$rows['surveyls_title']."</a>\n";
if ($rows['publicstatistics'] == 'Y') $link .= "<a href='".$this->getController()->createUrl("/statistics_user/action/surveyid/".$rows['sid'])."'>(".$clang->gT('View statistics').")</a>";
if ($rows['publicstatistics'] == 'Y') $link .= "<a href='".$this->getController()->createUrl("/statistics_user/action/surveyid/".$rows['sid'])."/language/".$sDisplayLanguage."'>(".$clang->gT('View statistics').")</a>";
$link .= "</li>\n";
$list[]=$link;
}
Expand Down
16 changes: 7 additions & 9 deletions application/helpers/admin/import_helper.php
Expand Up @@ -3333,7 +3333,7 @@ function importSurveyFile($sFullFilepath, $bTranslateLinksFields, $sNewSurveyNam
{
return ExcelImportSurvey($sFullFilepath);
}
elseif (isset($sExtension) && strtolower($sExtension) == 'zip') // Import a survey archive
elseif (isset($sExtension) && strtolower($sExtension) == 'lsa') // Import a survey archive
{
Yii::import("application.libraries.admin.pclzip.pclzip", true);
$pclzip = new PclZip(array('p_zipname' => $sFullFilepath));
Expand Down Expand Up @@ -4040,15 +4040,13 @@ function XMLImportTokens($sFullFilepath,$iSurveyID,$sCreateMissingAttributeField
$aTokenFieldNames=Yii::app()->db->getSchema()->getTable("{{tokens_$iSurveyID}}",true);
$aTokenFieldNames=array_keys($aTokenFieldNames->columns);
$aFieldsToCreate=array_diff($aXLMFieldNames, $aTokenFieldNames);
Yii::app()->loadHelper('update/updatedb');

foreach ($aFieldsToCreate as $sField)
{
if (strpos($sField,'attribute')!==false)
{
$CI->dbforge->add_column('tokens_'.$iSurveyID,array(
$sField => array(
'type' => 'VARCHAR',
'constraint' => '255')
));
addColumn('{{tokens_'.$iSurveyID.'}}',$sField, 'string');
}
}
}
Expand Down Expand Up @@ -4140,10 +4138,10 @@ function XMLImportResponses($sFullFilepath,$iSurveyID,$aFieldReMap=array())

function XMLImportTimings($sFullFilepath,$iSurveyID,$aFieldReMap=array())
{
$CI =& get_instance();

$CI->load->helper('database');
Yii::app()->loadHelper('database');
$clang = Yii::app()->lang;

$xml = simplexml_load_file($sFullFilepath);

if ($xml->LimeSurveyDocType!='Timings')
Expand Down Expand Up @@ -4179,7 +4177,7 @@ function XMLImportTimings($sFullFilepath,$iSurveyID,$aFieldReMap=array())
$insertdata[$key]=(string)$value;
}

$result = $CI->timings_dynamic_model->insertRecords($iSurveyID,$insertdata) or safeDie($clang->gT("Error").": Failed to insert data<br />");
$result = Survey_timings::model($iSurveyID)->insertRecords($insertdata) or safeDie($clang->gT("Error").": Failed to insert data<br />");

$results['responses']++;
}
Expand Down
1 change: 1 addition & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -2788,6 +2788,7 @@ private function _recursivelyFindAntecdentArrayFilters($qroot, $aflist, $afelist

private function setVariableAndTokenMappingsForExpressionManager($surveyid,$forceRefresh=false,$anonymized=false,$allOnOnePage=false)
{
$_SESSION['LEMforceRefresh']=true;

This comment has been minimized.

Copy link
@TMSWhite

TMSWhite Aug 20, 2012

Contributor

Why was this line added? It eliminates most/all of EM's caching and will likely slow down 2.0 considerably.

This comment has been minimized.

Copy link
@c-schmitz

c-schmitz Aug 20, 2012

Author Contributor

Sorry, debug purposes only - will remove it again.

if (isset($_SESSION['LEMforceRefresh'])) {
unset($_SESSION['LEMforceRefresh']);
$forceRefresh=true;
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/survey/subview/tabImport_view.php
@@ -1,7 +1,7 @@
<div id='import'>
<form enctype='multipart/form-data' class='form30' id='importsurvey' name='importsurvey' action='<?php echo $this->createUrl('admin/survey/copy'); ?>' method='post' onsubmit='return validatefilename(this,"<?php $clang->eT('Please select a file to import!', 'js'); ?> ");'>
<ul>
<li><label for='the_file'><?php $clang->eT("Select survey structure file (*.lss, *.csv, *.xls) or survey archive (*.zip):"); ?> </label>
<li><label for='the_file'><?php $clang->eT("Select survey structure file (*.lss, *.csv, *.xls) or survey archive (*.lsa):"); ?> </label>
<input id='the_file' name="the_file" type="file" /></li>
<li>&nbsp;</li>
<li><label for='translinksfields'><?php $clang->eT("Convert resource links and INSERTANS fields?"); ?> </label>
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/survey/surveybar_view.php
Expand Up @@ -147,12 +147,12 @@
<?php if($respstatsread && $surveyexport) {
if ($activated){?>
<li><a href='<?php echo $this->createUrl("admin/export/survey/action/exportarchive/surveyid/$surveyid");?>' >
<img src='<?php echo $sImageURL;?>export_30.png' alt='' /> <?php $clang->eT("Survey archive (.zip)");?></a></li>
<img src='<?php echo $sImageURL;?>export_30.png' alt='' /> <?php $clang->eT("Survey archive (.lsa)");?></a></li>
<?php }
else
{?>
<li><a href="#" onclick="alert('<?php $clang->eT("You can only archive active surveys.", "js");?>');" >
<img src='<?php echo $sImageURL;?>export_disabled_30.png' alt='' /> <?php $clang->eT("Survey archive (.zip)");?></a></li><?php
<img src='<?php echo $sImageURL;?>export_disabled_30.png' alt='' /> <?php $clang->eT("Survey archive (.lsa)");?></a></li><?php
}
}?>
<?php if($surveyexport) { ?>
Expand Down

0 comments on commit 3fdc243

Please sign in to comment.