A Plugon for LimeSurvey to recompute expression in survey
A Plugin for LimeSurvey to recompute expression in survey and fix relevance
Installation
============
Via GIT
-------
- Go to your LimeSurvey Directory (version up to 2.05)
- Clone in plugins/recomputeExpression directory `git clone https://github.com/Shnoulle/LS-recomputeExpression.git plugins/recomputeExpression`
Via ZIP dowload
-* Get the file and uncompress it
-* Move the file included to plugins/recomputeExpression directory
Purpose
=======
After updating a Equation question type : response are not updated with the new equation. Using this plugin allow to recompute all response with the new equation. There are an option too to recompute relevance status of all question.
After editing a response via the admin access the Equation question type and the relevance status are broken. This plugin allow to fix the Equation and the relevance Status.
* @copyright 2013 Practice Lab <https://www.practicelab.com/>
* @license GPL v3
* @version 1.0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
$(function(){
if(typeofrecomputeVar!='undefined'){
addUpdateResponse();
}
});
functionaddUpdateResponse()
{
vardocUrl=document.URL;
varjsonUrl=recomputeVar.jsonurl;
varaUrl=docUrl.split('/');
varsurveyid=aUrl[aUrl.indexOf("surveyid")+1];
varcontrollers=aUrl[aUrl.indexOf("admin")+1];
if($('table.detailbrowsetable').length>0)// Browse one response
{
// Find the response id
varresponseId=aUrl[aUrl.indexOf("id")+1];
// OR var responseId= aUrl.pop();
$('.menubar').eq(1).find('.menubar-main').find(".menubar-left:last").append("<a class='updateanswer' data-responseid='"+responseId+"'>Update This Answer</a>");
$('.updateanswer').click(function(){
$("#updatedsrid").remove();
$.ajax({
url:jsonUrl,
dataType:'json',
data:{sid:surveyid,srid:responseId},
success:function(data){
var$dialog=$('<div id="updatedsrid"></div>')
.html("<p>"+data.message+"</p>")
.dialog({
title:data.status,
dialogClass:'updatedsrid',
buttons:{
"Ok":function(){$(this).dialog("close");},
"Reload":function(){window.location.reload();}
},
modal:true,
close:function(){
$(this).remove();
}
});
},
error:function(){
var$dialog=$('<div id="updatedsrid"></div>')
.html("<p>An error was occured</p>")
.dialog({
title:"Error",
dialogClass:'updatedsrid',
buttons:{
"Ok":function(){$(this).dialog("close");},
},
modal:true,
close:function(){
$(this).remove();
}
});
},
});
});
}
if(controllers=='responses'){
$('.menubar').eq(0).find('.menubar-main').find(".menubar-left:last").append("<a class='updateanswers'>Update all submitted answers</a>");