Skip to content

Commit

Permalink
New Feature: New question attributes for multiple numerical questions…
Browse files Browse the repository at this point in the history
… - max_num_value_sgqa, min_num_value_sgqa and num_value_equels_sgqa - use previous question/answer as values using SGQA identifier

New Feature: Data entry improvement - when adding question attributes, screen returns to form

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey181@6577 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Mar 23, 2009
1 parent cb4f8ea commit 1a75c12
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
10 changes: 5 additions & 5 deletions admin/questionhandling.php
Expand Up @@ -479,7 +479,7 @@
$qattributes=questionAttributes();

$editquestion .= "\t<tr id='QTattributes'>
<td align='right'><strong>".$clang->gT("Question Attributes:")."</strong></td>
<td align='right'><strong><a name='qtattributes'>".$clang->gT("Question Attributes:")."</a></strong></td>
<td align='left'><select id='QTlist' name='attribute_name' >
</select>
<input type='text' id='QTtext' name='attribute_value' maxlength='20' /></td></tr>\n";
Expand All @@ -504,9 +504,9 @@
$editquestion .= "\t\t\t<table id='QTattributes' width='40%' >
<tr>
<td colspan='2' align='center'>
<form action='$scriptname' method='post'><table class='attributetable'>
<form action='$scriptname#qtattributes' method='post'><table class='attributetable'>
<tr>
<th colspan='4'>".$clang->gT("Question Attributes:")."</th>
<th colspan='4'><a name='qtattributes'>".$clang->gT("Question Attributes:")."</a></th>
</tr>
<tr><th colspan='4' height='5'></th></tr>
<tr>
Expand All @@ -525,7 +525,7 @@
{
$editquestion .= "\t\t\t<table class='attributetable' width='90%' border='0' cellspacing='0'>"
."<tr><td width='85%'>"
."<form action='$scriptname' method='post'>"
."<form action='$scriptname#qtattributes' method='post'>"
."<table width='100%'><tr><td width='65%'><span title='".$attributetranslations[$qa['attribute']]['help']."'>"
.$attributetranslations[$qa['attribute']]['caption']."</span></td>
<td align='center' width='25%'><input type='text' name='attribute_value' value='"
Expand All @@ -538,7 +538,7 @@
<input type='hidden' name='qid' value='$qid' />\n
<input type='hidden' name='qaid' value='".$qa['qaid']."' />\n"
."\t\t\t</td></tr></table></form></td><td>
<form action='$scriptname' method='post'><table width='100%'><tr><td width='5%'>
<form action='$scriptname#qtattributes' method='post'><table width='100%'><tr><td width='5%'>
<input type='submit' value='"
.$clang->gT("Delete")."' />"
. "\t<input type='hidden' name='action' value='delattribute' />\n"
Expand Down
14 changes: 14 additions & 0 deletions common.php
Expand Up @@ -3388,6 +3388,20 @@ function questionAttributes($returnByName=false)
"help"=>$clang->gT('Show statistics of a certain question to the user'),
"caption"=>$clang->gT('Show in public statistics'));

$qattributes["max_num_value_sgqa"]=array(
"types"=>"K",
"help"=>$clang->gT('SGQA identifier to use total of previous question as maximum for this question'),
"caption"=>$clang->gT('Max value from SQGA'));

$qattributes["min_num_value_sgqa"]=array(
"types"=>"K",
"help"=>$clang->gT('SGQA identifier to use total of previous question as minimum for this question'),
"caption"=>$clang->gT('Min value from SQGA'));

$qattributes["num_value_equals_sgqa"]=array(
"types"=>"K",
"help"=>$clang->gT('SGQA identifier to use total of previous question as total for this question'),
"caption"=>$clang->gT('Value equals SQGA'));

/* -- > Commented out since not yet used
$qattributes[]=array("name"=>"default_value",
Expand Down
23 changes: 21 additions & 2 deletions qanda.php
Expand Up @@ -2929,34 +2929,55 @@ function do_multiplenumeric($ia)
$maxsize = 255;
}

//EQUALS VALUE
if ($equalvalue=arraySearchByKey('equals_num_value', $qidattributes, 'attribute', 1))
{
$equals_num_value=$equalvalue['value'];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(3)';
$calculateValue[]=3;
}
elseif ($equalvalue=arraySearchByKey('num_value_equals_sgqa', $qidattributes, 'attribute', 1))
{
$equals_num_value=$_SESSION[$equalvalue['value']];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(3)';
$calculateValue[]=3;
}
else
{
$equals_num_value[]=0;
}

//MIN VALUE
if ($minvalue=arraySearchByKey('min_num_value', $qidattributes, 'attribute', 1))
{
$min_num_value=$minvalue['value'];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(2)';
$calculateValue[]=2;
}
elseif ($minvalue=arraySearchByKey('min_num_value_sgqa', $qidattributes, 'attribute', 1))
{
$min_num_value=$_SESSION[$minvalue['value']];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(2)';
$calculateValue[]=2;
}
else
{
$min_num_value=0;
}

//MAX VALUE
if ($maxvalue=arraySearchByKey('max_num_value', $qidattributes, 'attribute', 1))
{
$max_num_value = $maxvalue['value'];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(1)';
$calculateValue[]=1;
}
elseif ($maxvalue=arraySearchByKey('max_num_value_sgqa', $qidattributes, 'attribute', 1))
{
$max_num_value = $_SESSION[$maxvalue['value']];
$numbersonlyonblur[]='calculateValue'.$ia[1].'(1)';
$calculateValue[]=1;
}
else
{
$max_num_value = 0;
Expand Down Expand Up @@ -3048,7 +3069,6 @@ function do_multiplenumeric($ia)
{
$slider_layout = false;
}

if ($hidetip=arraySearchByKey('hide_tip', $qidattributes, 'attribute', 1))
{
$hidetip=$hidetip['value'];
Expand All @@ -3061,7 +3081,6 @@ function do_multiplenumeric($ia)
{
$hidetip=0;
}

if (arraySearchByKey('random_order', $qidattributes, 'attribute', 1))
{
$ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid=$ia[0] AND language='".$_SESSION['s_lang']."' ORDER BY ".db_random();
Expand Down

0 comments on commit 1a75c12

Please sign in to comment.