Skip to content

Commit

Permalink
Fixed issue #8190: Trying to view one or all participants from a cert…
Browse files Browse the repository at this point in the history
…ain token table in CPDB gives back HTTP 500 Error
  • Loading branch information
c-schmitz committed Oct 9, 2013
1 parent 8ac8aac commit d4759a5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
7 changes: 4 additions & 3 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -217,8 +217,8 @@ function displayParticipants()
$lang = Yii::app()->session['adminlang'];
// loads the survey names to be shown in add to survey
// if user is superadmin, all survey names
$urlSearch=Yii::app()->request->getQuery('searchurl');
$urlSearch=!empty($urlSearch) ? "getParticipantsResults_json/search/$urlSearch" : "getParticipants_json";
$sSearchCondition=Yii::app()->request->getPost('searchcondition','');
$urlSearch=!empty($sSearchCondition) ? "getParticipantsResults_json" : "getParticipants_json";

//Get list of surveys.
//Should be all surveys owned by user (or all surveys for super admin)
Expand Down Expand Up @@ -248,7 +248,8 @@ function displayParticipants()
'attributeValues' => ParticipantAttributeNames::model()->getAllAttributesValues(),
'surveynames' => $aSurveyNames,
'tokensurveynames' => $tSurveyNames,
'urlsearch' => $urlSearch
'urlsearch' => $urlSearch,
'sSearchCondition' => $sSearchCondition
);

$this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . 'jquery/jqGrid/js/i18n/grid.locale-en.js');
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/tokens.php
Expand Up @@ -497,7 +497,7 @@ function getTokens_json($iSurveyId, $search = null)
if(hasSurveyPermission($iSurveyId, 'tokens', 'update'))
$action .= viewHelper::getImageLink('edit_16.png', null, $clang->gT("Edit token entry"), null, 'imagelink token_edit');
if(!empty($token['participant_id']) && $token['participant_id'] != "" && hasGlobalPermission('USER_RIGHT_PARTICIPANT_PANEL')) {
$action .= viewHelper::getImageLink('cpdb_16.png', "admin/participants/sa/displayParticipants/searchurl/participant_id||equal||" . $token['participant_id'], $clang->gT("View this person in the central participants database"), '_top');
$action .= viewHelper::getImageLink('cpdb_16.png', null, $clang->gT("View this person in the central participants database"), null, 'imagelink cpdb',array('onclick'=>"sendPost('".$this->getController()->createUrl('admin/participants/sa/displayParticipants')."','',['searchcondition'],['participant_id||equal||{$token['participant_id']}']);"));
} else {
$action .= '<div style="width: 20px; height: 16px; float: left;"></div>';
}
Expand Down
Expand Up @@ -170,6 +170,7 @@
var postUrl = "<?php echo Yii::app()->getController()->createUrl("admin/participants/sa/setSession"); ?>";
var ajaxUrl = "<?php echo Yii::app()->getConfig('adminimageurl') . "/ajax-loader.gif" ?>";
var redUrl = "<?php echo Yii::app()->getController()->createUrl("admin/participants/sa/displayParticipants"); ?>";
var searchconditions = "<?php echo $sSearchCondition; ?>";
var colNames = '["participant_id","can_edit","<?php $clang->eT("First name") ?>","<?php $clang->eT("Last name") ?>","<?php $clang->eT("Email") ?>","<?php $clang->eT("Blacklisted") ?>","<?php $clang->eT("Surveys") ?>","<?php $clang->eT("Language") ?>","<?php $clang->eT("Owner name") ?>"<?php echo $columnNames; ?>]';
var colModels = '[{ "name":"participant_id", "index":"participant_id", "width":100, "align":"center", "sorttype":"int", "sortable": true, "editable":false, "hidden":true},';
colModels += '{ "name":"can_edit", "index":"can_edit", "width":10, "align":"center", "sorttype":"int", "sortable": true, "editable":false, "hidden":true},';
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/browse.php
Expand Up @@ -88,7 +88,7 @@
<?php } ?>
var sBounceProcessing = "<?php $clang->eT("Start bounce processing") ?>";
var sBounceProcessingURL = "<?php echo Yii::app()->getController()->createUrl("admin/tokens/sa/bounceprocessing/surveyid/{$surveyid}"); ?>";
var participantlinkUrl="<?php echo Yii::app()->getController()->createUrl("admin/participants/sa/displayParticipants/searchurl/surveyid||equal||{$surveyid}"); ?>";
var participantlinkUrl="<?php echo Yii::app()->getController()->createUrl("admin/participants/sa/displayParticipants"); ?>";
var searchtypes = ["<?php $clang->eT("Equals") ?>","<?php $clang->eT("Contains") ?>","<?php $clang->eT("Not equal") ?>","<?php $clang->eT("Not contains") ?>","<?php $clang->eT("Greater than") ?>","<?php $clang->eT("Less than") ?>"]
var colNames = ["ID","<?php $clang->eT("Action") ?>","<?php $clang->eT("First name") ?>","<?php $clang->eT("Last name") ?>","<?php $clang->eT("Email address") ?>","<?php $clang->eT("Email status") ?>","<?php $clang->eT("Token") ?>","<?php $clang->eT("Language") ?>","<?php $clang->eT("Invitation sent?") ?>","<?php $clang->eT("Reminder sent?") ?>","<?php $clang->eT("Reminder count") ?>","<?php $clang->eT("Completed?") ?>","<?php $clang->eT("Uses left") ?>","<?php $clang->eT("Valid from") ?>","<?php $clang->eT("Valid until") ?>"<?php if (count($columnNames)) echo ','.$columnNames; ?>];
var colModels = [
Expand Down
7 changes: 6 additions & 1 deletion scripts/admin/displayParticipant.js
Expand Up @@ -99,7 +99,11 @@ $(document).ready(function() {
$('#searchtable tr:last').after(html);
});

var searchconditions = {};

if(typeof searchconditions === "undefined") {
searchconditions = {};
}

var field;
$('#searchbutton').click(function(){
});
Expand All @@ -115,6 +119,7 @@ $(document).ready(function() {
editurl: editUrl,
datatype: "json",
mtype: "post",
postData: {searchcondition:searchconditions},
colNames : jQuery.parseJSON(colNames),
colModel: jQuery.parseJSON(colModels),
height: "100%",
Expand Down
4 changes: 1 addition & 3 deletions scripts/admin/tokens.js
Expand Up @@ -377,9 +377,7 @@ $(document).ready(function() {
caption:"",
title:viewParticipantsLink,
buttonicon:'ui-participant-link',
onClickButton:function(){
window.open(participantlinkUrl, "_top");
}
onClickButton:function(){sendPost(participantlinkUrl,'',['searchcondition'],["surveyid||equal||" + survey_id]);}
});
$("#displaytokens").navButtonAdd('#pager', {
caption:"",
Expand Down

0 comments on commit d4759a5

Please sign in to comment.