Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
ravindrakhokharia committed Mar 25, 2014
2 parents a1e06e2 + bf7fb09 commit 6bfa0bf
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
11 changes: 7 additions & 4 deletions application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -1100,10 +1100,13 @@ function attributeMapCSV()
}
else
{
$templateData['error_msg'] = sprintf($clang->gT("This is not a .csv file."), Yii::app()->getConfig('tempdir'));
$errorinupload = array('error' => $this->upload->display_errors());
Yii::app()->session['summary'] = array('errorinupload' => $errorinupload);
$this->_renderWrappedTemplate('participants', array('participantsPanel', 'uploadSummary'),array('aAttributes' => ParticipantAttributeName::model()->getAllAttributes()));
$templateData['errorinupload']['error'] = $clang->gT("This is not a .csv file.");
$templateData['aAttributes'] = ParticipantAttributeName::model()->getAllAttributes();
$templateData['aGlobalErrors'] = array();
// $errorinupload = array('error' => $this->upload->display_errors());
// Yii::app()->session['summary'] = array('errorinupload' => $errorinupload);
$this->_renderWrappedTemplate('participants', array('participantsPanel', 'uploadSummary'),$templateData);
exit;
}


Expand Down
8 changes: 6 additions & 2 deletions application/controllers/admin/surveyadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,11 @@ public function copy()
if ($action == 'importsurvey' && !$aData['bFailed'])
{
$aImportResults=importSurveyFile($sFullFilepath,(isset($_POST['translinksfields'])));
if (is_null($aImportResults)) $importerror = true;
if (is_null($aImportResults) || isset($aImportResults['error']))
{
$aData['sErrorMessage']=$aImportResults['error'];
$aData['bFailed'] = true;
}
}
elseif ($action == 'copysurvey' && !$aData['bFailed'])
{
Expand All @@ -940,7 +944,7 @@ public function copy()
}
else
{
$importerror = true;
$aData['bFailed'] = true;
}
if ($action == 'importsurvey' && isset($sFullFilepath))
{
Expand Down
8 changes: 4 additions & 4 deletions application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2972,7 +2972,7 @@ function CSVImportSurvey($sFullFilePath,$iDesiredSurveyId=NULL,$bTranslateLinks=
// Set a warning if question title was updated
if(isset($sNewTitle))
{
$importresults['importwarnings'][] = sprintf("Question code %s was updated to %s.",$sOldTitle,$sNewTitle);
$importresults['importwarnings'][] = sprintf($clang->gT("Question code %s was updated to %s."),$sOldTitle,$sNewTitle);
$aQuestionCodeReplacements[$sOldTitle]=$sNewTitle;
unset($sNewTitle);
unset($sOldTitle);
Expand Down Expand Up @@ -3511,9 +3511,9 @@ function XMLImportSurvey($sFullFilePath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
{
$sXMLdata = file_get_contents($sFullFilePath);
}
$xml = simplexml_load_string($sXMLdata,'SimpleXMLElement',LIBXML_NONET);
$xml = @simplexml_load_string($sXMLdata,'SimpleXMLElement',LIBXML_NONET);

if ($xml->LimeSurveyDocType!='Survey')
if (!$xml || $xml->LimeSurveyDocType!='Survey')
{
$results['error'] = $clang->gT("This is not a valid LimeSurvey survey structure XML file.");
return $results;
Expand Down Expand Up @@ -3798,7 +3798,7 @@ function XMLImportSurvey($sFullFilePath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
// Set a warning if question title was updated
if(isset($sNewTitle))
{
$results['importwarnings'][] = sprintf("Question code %s was updated to %s.",$sOldTitle,$sNewTitle);
$results['importwarnings'][] = sprintf($clang->gT("Question code %s was updated to %s."),$sOldTitle,$sNewTitle);
$aQuestionCodeReplacements[$sOldTitle]=$sNewTitle;
unset($sNewTitle);
unset($sOldTitle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
var sAddCaption = "<?php $clang->eT("Add participant", 'js') ?>";
var sAddButtonCaption = "<?php $clang->eT("Add", 'js') ?>";
var sDeleteButtonCaption = "<?php $clang->eT("Delete", 'js') ?>";
var sDeleteDialogCaption = "<?php $clang->eT("Delete one or more participants...", 'js') ?>";
var sCancel = "<?php $clang->eT("Cancel", 'js') ?>";
var sSubmit = "<?php $clang->eT("Save", 'js') ?>";
var fullSearchTitle = "<?php $clang->eT("Full search"); ?>";
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/participants/importCSV_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
<p>
<?php $clang->eT("File should be a standard CSV (comma delimited) file with optional double quotes around values (default for OpenOffice and Excel). The first line must contain the field names. The fields can be in any order."); ?>
</p>
<span style="font-weight:bold;">Mandatory fields:</span> firstname, lastname, email <br/>
<span style="font-weight:bold;">Optional fields:</span> blacklist,language
<span style="font-weight:bold;"><?php $clang->eT("Mandatory fields:") ?></span> firstname, lastname, email <br/>
<span style="font-weight:bold;"><?php $clang->eT("Optional fields:") ?></span> blacklist,language
</div>
6 changes: 3 additions & 3 deletions application/views/admin/participants/uploadSummary_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@
$uploadSummary .= "</ul></div></li>";
}
}
$uploadSummary .= "</div></div>";
}
else
{
echo $errorinupload['error'];
$uploadSummary .= "<div class='warningheader'>" . $errorinupload['error'] . "</div>";
$uploadSummary .= "<div class='warningheader'>" . $clang->gT('Error') . "</div>";
$uploadSummary .= $errorinupload['error'];
}
foreach($aGlobalErrors as $sGlobalError)
echo "<script> \$notifycontainer.notify('create', 'error-notify', { message:'{$sGlobalError}'});</script>";
$uploadSummary .= "</div></div>";
echo $uploadSummary;
1 change: 1 addition & 0 deletions scripts/admin/participantdisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ $(document).ready(function() {
}, //default settings for add
{msg:deleteMsg,
bCancel: sCancel,
caption: sDeleteDialogCaption,
bSubmit: sDeleteButtonCaption,
width : 900,
afterShowForm: function($form) {
Expand Down

0 comments on commit 6bfa0bf

Please sign in to comment.