Skip to content

Commit

Permalink
Fixed issue #10846: Checked responses are not read when load "surveys…
Browse files Browse the repository at this point in the history
… file"

Dev: controller wait id, then send id
  • Loading branch information
Shnoulle committed Apr 19, 2016
1 parent e13504f commit fc07feb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 194 deletions.
188 changes: 0 additions & 188 deletions scripts/admin/browse.js
Expand Up @@ -29,191 +29,3 @@ $(document).on("mouseenter",".browsetable tbody td:not([title])",function(){
$(this).attr('title',"");// Don't do this again
}
});
$(document).ready(function(){
$('ul.sf-menu').superfish({
speed:'fast'
});
$("#selectall").click(function(){
$('.cbResponseMarker').attr('checked',$(this).is(':checked'));
});
// Update the responses table if completionstate change
$("#browseresults #completionstate").change(function(){
$("#limit").val('');
$("#browseresults").submit();
});

// Delete individual file
$(".deleteresponse").click(function(){
thisid=removechars($(this).attr('id'));
answer = confirm(strdeleteconfirm);
if (answer==true)
{
$('#deleteanswer').val(thisid);
$('.cbResponseMarker').attr('checked',false);
$('#resulttableform').submit();
}
});
// Delete all marked responses
$("#imgDeleteMarkedResponses").click(function(){
if ($('.cbResponseMarker:checked').size()>0)
{
thisid=removechars($(this).attr('id'));
answer = confirm(strDeleteAllConfirm);
if (answer==true)
{
$('#deleteanswer').val('marked');
$('#resulttableform').submit();
}
}
else
alert(noFilesSelectedForDeletion);
});

// Download individual file bundle
$(".downloadfile").click(function() {
thisid = removechars($(this).attr('id'));
$('#downloadfile').val(thisid);
$('.cbResponseMarker').attr('checked', false);
$('#resulttableform').submit();
});

// Download all marked files
$("#imgDownloadMarkedFiles").click(function() {
if ($('.cbResponseMarker:checked').size() > 0)
{
$('#downloadfile').val('marked');
$('#resulttableform').submit();
}
else
alert(noFilesSelectedForDnld);
});


});



/* $("#responseTable")
.jqGrid({
url: siteURL + "/admin/responses/" + surveyID + "/grid",
editurl: siteURL + "/admin/responses/" + surveyID + "/grid",
datatype: "json",
mtype: "POST",
caption: "Responses",
width: "100%",
height: "100%",
rowNum: 25,
pager: "#responsePager",
editable: true,
colNames: colNames,
colModel: colModel,
sortname: 'id',
sortorder: 'asc',
viewrecords : true,
gridview: true,
multiselect: true,
loadonce: true,
rowList: [25,50,100,250,500,1000,2500,5000],
ondblClickRow: function(id) {
if (lastSel != id) {
$('#responseTable').saveRow(lastSel);
$('#responseTable').editRow(id, true);
lastSel=id;
}
},
onSelectRow: function(id) {
$('#responseTable').saveRow(lastSel);
}
})
.filterToolbar({
'autosearch': true,
'searchOnEnter': false
})
.navGrid("#responsePager", {
'add': false,
'refresh': false,
'edit': false
})
.navButtonAdd("#responsePager", {
'caption': 'Download marked files',
'onClickButton': function (rows) {
var rows = $("#responseTable").getGridParam('selarrrow');
if (rows.length <= 0) {
alert ("Please select some records first!");
return;
}
sendPost(siteURL + "/admin/responses/" + surveyID + "/grid", {
'oper': 'downloadarchives',
'ids': rows
});
}
}) */

/* Deprecated : use admin_core.js function */
///**
//Send a post request to the server to download a file

//@param myaction post action
//@param data parameters for $_POST

//*/
//function sendPost(myaction, checkcode, arrayparam, arrayval)
//{
// var myform = document.createElement('form');
// document.body.appendChild(myform);
// myform.action =myaction;
// myform.method = 'POST';
// for (i=0;i<arrayparam.length;i++)
// {
// addHiddenElement(myform,arrayparam[i],arrayval[i])
// }

// addHiddenElement(myform,'YII_CSRF_TOKEN',LS.data.csrfToken)
// myform.submit();
//}




/**
Dowload a file from a response
@param id ID of the response
@param column Field of the text upload question
@param filename Name of the file
*/
function getFile(id, field, filename)
{
sendPost(siteURL + "/admin/responses/" + surveyID + "/grid",
new Array(
'id',
'fieldname',
'oper',
'filename'
),
new Array(
id,
field,
'downloadfile',
filename
));
}


/**
Get an archive containing all the file from a response
@param id ID of the response
*/
function getArchive(id)
{
sendPost(siteURL + "/admin/responses/" + surveyID + "/grid",
new Array(
'oper',
'id'),
new Array(
'downloadarchive',
id)
);
}

13 changes: 7 additions & 6 deletions scripts/admin/listresponse.js
Expand Up @@ -34,7 +34,7 @@ $(document).on("click","[data-delete]",function(event){
.done(function() {
jQuery("#displayresponses").delRowData(responseid);
});
$( this ).dialog( "close" );
$( this ).dialog( "close" );
};
buttons[sCancel] = function(){ $( this ).dialog( "close" ); };
var dialog=$("<p>"+strdeleteconfirm+"</p>").dialog({
Expand Down Expand Up @@ -177,7 +177,7 @@ $(function() {
});
$.post( jsonBaseUrl+"&sa=setHiddenColumns", { aHiddenFields: hidden.join("|") } );
}
}
}
});
}
}
Expand All @@ -187,20 +187,21 @@ $(function() {
jQuery("#displayresponses").navButtonAdd('#pager',{
caption:sDownLoad, // Remove it ? no it's more clear ;)
title:sDownLoad, // Todo dynamically update download selected , download all
buttonicon:"ui-icon-arrowstop-1-s",
buttonicon:"ui-icon-arrowstop-1-s",
onClickButton: function(){
selectedlist=jQuery("#displayresponses").getGridParam('selarrrow').join(",");// Or send like an array ?
if(selectedlist!="")
{
sendPost(jsonActionUrl,null,["oper","responseid"],["downloadzip",selectedlist]);
sendPost(jsonActionUrl,null,["oper","id"],["downloadzip",selectedlist]);
}
else
{
if(confirm(sConfirmationArchiveMessage))
{
sendPost(jsonActionUrl,null,["oper"],["downloadzip"]);;
//sendPost(sDownloadUrl,null,"responseid",0);
}
}
},
},
position:"last",
});
}
Expand Down

0 comments on commit fc07feb

Please sign in to comment.