Skip to content

Commit

Permalink
Fixed issue #08764: Token search criteria take only 2 criteria
Browse files Browse the repository at this point in the history
Fixed issue #08790: missing translation in token filter
Dev: TODO : use filter plugin system from jqgrid ?
Dev: TODO : use another js file for filter (in participant and token and surveylist)
  • Loading branch information
Shnoulle committed Mar 2, 2014
1 parent 80cae17 commit a284404
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
4 changes: 3 additions & 1 deletion application/views/admin/token/browse.php
Expand Up @@ -110,7 +110,9 @@
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"); ?>";
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 andTxt="<?php $clang->eT("AND") ?>";
var orTxt="<?php $clang->eT("OR") ?>";
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 = [
{ "name":"tid", "index":"tid", "width":30, "align":"center", "sorttype":"int", "sortable": true, "editable":false, "hidden":false},
Expand Down
51 changes: 25 additions & 26 deletions scripts/admin/tokens.js
@@ -1,6 +1,6 @@
// $Id: tokens.js 8633 2010-04-25 12:57:33Z c_schmitz
var idexternal=parseInt(3);

//var idexternal=parseInt(3);
var conditionid=1;
function checkbounces() {
$("#dialog-modal").dialog('open');
$('#dialog-modal').html('<p><img style="margin-top:42px" src="'+imageurl+'ajax-loader.gif" /></p>');
Expand All @@ -9,25 +9,26 @@ function checkbounces() {

function addcondition()
{
id=2;
html = "<tr name='joincondition_"+idexternal+"' id='joincondition_"+idexternal+"'><td><select name='join_"+idexternal+"' id='join_"+idexternal+"'>\n\
<option value='and'>AND</option><option value='or'>OR</option></td></tr>";
html2 = "<tr><td><select name='field_"+idexternal+"' \n\ id='field_"+idexternal+"'>";
// Seems unused
conditionid++;
html = "<tr name='joincondition_"+conditionid+"' id='joincondition_"+conditionid+"'><td><select name='join_"+conditionid+"' id='join_"+conditionid+"'>\n\
<option value='and'>"+andTxt+"</option><option value='or'>"+orTxt+"</option></td></tr>";
html2 = "<tr><td><select name='field_"+conditionid+"' \n\ id='field_"+conditionid+"'>";
for(col in colInformation){
if(colInformation[col]['search'])
html2 += "<option value='"+col+"'>"+colInformation[col]['description']+"</option>";
}
html2 += "</select></td><td>\n\
<select name='condition_"+idexternal+"' id='condition_"+idexternal+"'><option value='equal'>"+searchtypes[0]+"</option><option value='contains'>"+searchtypes[1]+"</option>\n\
<select name='condition_"+conditionid+"' id='condition_"+conditionid+"'><option value='equal'>"+searchtypes[0]+"</option><option value='contains'>"+searchtypes[1]+"</option>\n\
<option value='notequal'>"+searchtypes[2]+"</option><option value='notcontains'>"+searchtypes[3]+"</option><option value='greaterthan'>"+searchtypes[4]+"</option>\n\
<option value='lessthan'>"+searchtypes[5]+"</option></select></td>\n\<td><input type='text' id='conditiontext_"+idexternal+"' style='margin-left:10px;' /></td>\n\
<td><img src="+minusbutton+" onClick= $(this).parent().parent().remove();$('#joincondition_"+idexternal+"').remove() id='removebutton'"+idexternal+">\n\
<option value='lessthan'>"+searchtypes[5]+"</option></select></td>\n\<td><input type='text' id='conditiontext_"+conditionid+"' style='margin-left:10px;' /></td>\n\
<td><img src="+minusbutton+" onClick= $(this).parent().parent().remove();$('#joincondition_"+conditionid+"').remove() id='removebutton'"+conditionid+">\n\
<img src="+addbutton+" class='addcondition-button' style='margin-bottom:4px'></td></tr>";
//$('#searchtable > tbody > tr').eq(id).after(html);
$('#searchtable > tbody > tr').eq(idexternal).after(html);
idexternal++;
$('#searchtable > tbody > tr').eq(idexternal).after(html2);
idexternal++;
$('#searchtable > tbody > tr').eq(conditionid).after(html);
conditionid++;
$('#searchtable > tbody > tr').eq(conditionid).after(html2);
//idexternal++;
}


Expand Down Expand Up @@ -92,28 +93,29 @@ $(document).ready(function() {
};
};
// Code for AJAX download
var id=1;
$(document).on("click",".addcondition-button",function(){
id=2;
html = "<tr name='joincondition_"+id+"' id='joincondition_"+id+"'><td><select name='join_"+id+"' id='join_"+id+"'><option value='and'>AND</option><option value='or'>OR</option></td><td></td></tr><tr><td><select name='field_"+id+"' id='field_"+id+"'>\n";
conditionid++;
html = "<tr name='joincondition_"+conditionid+"' id='joincondition_"+conditionid+"'><td><select name='join_"+conditionid+"' id='join_"+conditionid+"'><option value='and'>"+andTxt+"</option><option value='or'>"+orTxt+"</option></td><td></td></tr><tr><td><select name='field_"+conditionid+"' id='field_"+conditionid+"'>\n";
for(col in colInformation){
if(colInformation[col]['search'])
html += "<option value='"+col+"'>"+colInformation[col]['description']+"</option>";
}
html += "</select>\n\</td>\n\<td>\n\
<select name='condition_"+id+"' id='condition_"+id+"'>\n\
<select name='condition_"+conditionid+"' id='condition_"+conditionid+"'>\n\
<option value='equal'>"+searchtypes[0]+"</option>\n\
<option value='contains'>"+searchtypes[1]+"</option>\n\
<option value='notequal'>"+searchtypes[2]+"</option>\n\
<option value='notcontains'>"+searchtypes[3]+"</option>\n\
<option value='greaterthan'>"+searchtypes[4]+"</option>\n\
<option value='lessthan'>"+searchtypes[5]+"</option>\n\
</select></td>\n\<td><input type='text' id='conditiontext_"+id+"' style='margin-left:10px;' /></td>\n\
<td><img src="+minusbutton+" onClick= $(this).parent().parent().remove();$('#joincondition_"+id+"').remove() id='removebutton'"+id+">\n\
</select></td>\n\<td><input type='text' id='conditiontext_"+conditionid+"' style='margin-left:10px;' /></td>\n\
<td><img src="+minusbutton+" onClick= $(this).parent().parent().remove();$('#joincondition_"+conditionid+"').remove() id='removebutton'"+conditionid+">\n\
<img src="+addbutton+" class='addcondition-button' style='margin-bottom:4px'></td></tr><tr></tr>";
$('#searchtable tr:last').after(html);
});
var searchconditions = {};
if(typeof searchconditions === "undefined") {
searchconditions = {};
}
var field;
$('#searchbutton').click(function(){

Expand Down Expand Up @@ -281,12 +283,9 @@ $(document).ready(function() {
buttons: dialog_buttons
});
} else {
if(id == 1) {
searchconditions = searchconditions + $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
//jQuery("#displaytokens").jqGrid('setGridParam',{url:jsonSearchUrl+'/'+searchconditions}).trigger("reloadGrid");
} else {
searchconditions = $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
for( i=2 ; i<=idexternal; i++) {
searchconditions = searchconditions + $('#field_1').val()+"||"+$('#condition_1').val()+"||"+$('#conditiontext_1').val();
if(conditionid > 1) {
for( i=2 ; i<=conditionid; i++) {
if($('#field_'+i).val()) {
searchconditions = searchconditions + "||"+ $('#join_'+(i)).val()+"||"+$('#field_'+i).val()+"||"+$('#condition_'+i).val()+"||"+$('#conditiontext_'+i).val();
}
Expand Down

0 comments on commit a284404

Please sign in to comment.