Skip to content

Commit

Permalink
Fixed issue #05383: Keyboard-less operation doesn't work for all inpu…
Browse files Browse the repository at this point in the history
…t fields

Dev Enabled keyboard for all text inputs and textareas
Dev Added keyup trigger to keyboard to fire conditions and other onkeyup functions

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@10677 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Tony Partner committed Aug 10, 2011
1 parent 6e98679 commit c4abf65
Show file tree
Hide file tree
Showing 2 changed files with 995 additions and 923 deletions.
80 changes: 70 additions & 10 deletions qanda.php
Expand Up @@ -2511,9 +2511,19 @@ function do_list_radio($ia)
// ---------------------------------------------------------------
function do_listwithcomment($ia)
{
global $maxoptionsize, $dbprefix, $dropdownthreshold, $lwcdropdowns;
global $maxoptionsize, $dbprefix, $dropdownthreshold, $lwcdropdowns, $thissurvey;
global $clang;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

if ($ia[8] == 'Y')
{
$checkconditionFunction = "checkconditions";
Expand Down Expand Up @@ -2599,7 +2609,7 @@ function do_listwithcomment($ia)
<p class="comment">
<label for="answer'.$ia[1].'comment">'.$hint_comment.':</label>
<textarea class="textarea" name="'.$ia[1].'comment" id="answer'.$ia[1].'comment" rows="'.floor($tarows).'" cols="30" >';
<textarea class="textarea '.$kpclass.'" name="'.$ia[1].'comment" id="answer'.$ia[1].'comment" rows="'.floor($tarows).'" cols="30" >';
// --> END NEW FEATURE - SAVE
if (isset($_SESSION[$fname2]) && $_SESSION[$fname2])
{
Expand Down Expand Up @@ -2918,6 +2928,16 @@ function do_multiplechoice($ia)
{
global $dbprefix, $clang, $connect, $thissurvey;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

// Find out if any questions have attributes which reference this questions
// based on value of attribute. This could be array_filter and array_filter_exclude

Expand Down Expand Up @@ -3236,7 +3256,7 @@ function excludeAllOthers$ia[1](value, doconditioncheck)
$answer .= " $checkconditionFunction(document.getElementById(\"answer$myfname\").value, document.getElementById(\"answer$myfname\").name, document.getElementById(\"answer$myfname\").type);";
$answer .= "' />
<label for=\"answer$myfname\" class=\"answertext\">".$othertext."</label>
<input class=\"text\" type=\"text\" name=\"$myfname\" id=\"answer$myfname\"";
<input class=\"text ".$kpclass."\" type=\"text\" name=\"$myfname\" id=\"answer$myfname\"";
if (isset($_SESSION[$myfname]))
{
$answer .= ' value="'.htmlspecialchars($_SESSION[$myfname],ENT_QUOTES).'"';
Expand Down Expand Up @@ -3387,6 +3407,16 @@ function do_multiplechoice_withcomments($ia)
{
global $dbprefix, $clang, $thissurvey;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

$attribute_ref=false;
$qaquery = "SELECT qid,attribute FROM ".db_table_name('question_attributes')." WHERE value LIKE '".strtolower($ia[2])."'";
$qaresult = db_execute_assoc($qaquery); //Checked
Expand Down Expand Up @@ -3541,7 +3571,7 @@ function do_multiplechoice_withcomments($ia)
$answer_main .= "' />\n";
$fn++;
$answer_main .= "</span>\n<span class=\"comment\">\n\t<label for='answer$myfname2' class=\"answer-comment\">\n"
."<input class='text' type='text' size='40' id='answer$myfname2' name='$myfname2' title='".$clang->gT("Make a comment on your choice here:")."' value='";
."<input class='text ".$kpclass."' type='text' size='40' id='answer$myfname2' name='$myfname2' title='".$clang->gT("Make a comment on your choice here:")."' value='";
if (isset($_SESSION[$myfname2])) {$answer_main .= htmlspecialchars($_SESSION[$myfname2],ENT_QUOTES);}
// --> START NEW FEATURE - SAVE
$answer_main .= "' onclick='cancelBubbleThis(event);' onkeyup='if (jQuery.trim($(\"#answer{$myfname2}\").val())!=\"\") { document.getElementById(\"answer{$myfname}\").checked=true;$checkconditionFunction(document.getElementById(\"answer{$myfname}\").value,\"$myfname\",\"checkbox\");}' onkeyup='".$callmaxanswscriptcheckbox2."(document.getElementById(\"answer{$myfname}\"))' />\n\t</label>\n</span>\n"
Expand All @@ -3559,7 +3589,7 @@ function do_multiplechoice_withcomments($ia)
$myfname2 = $myfname.'comment';
$anscount = $anscount + 2;
$answer_main .= "\t<li class=\"other\">\n<span class=\"option\">\n"
. "\t<label for=\"answer$myfname\" class=\"answertext\">\n".$othertext."\n<input class=\"text other\" $numbersonly type=\"text\" name=\"$myfname\" id=\"answer$myfname\" title=\"".$clang->gT('Other').'" size="10"';
. "\t<label for=\"answer$myfname\" class=\"answertext\">\n".$othertext."\n<input class=\"text other ".$kpclass."\" $numbersonly type=\"text\" name=\"$myfname\" id=\"answer$myfname\" title=\"".$clang->gT('Other').'" size="10"';
if (isset($_SESSION[$myfname]) && $_SESSION[$myfname])
{
$answer_main .= ' value="'.htmlspecialchars($_SESSION[$myfname],ENT_QUOTES).'"';
Expand Down Expand Up @@ -4858,7 +4888,17 @@ function getLatLongFromIp($ip){
// ---------------------------------------------------------------
function do_longfreetext($ia)
{
global $clang, $js_header_includes;
global $clang, $js_header_includes, $thissurvey;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

if ($ia[8] == 'Y')
{
Expand Down Expand Up @@ -4914,7 +4954,7 @@ function textLimit(field, maxlen) {


// --> START NEW FEATURE - SAVE
$answer .= '<textarea class="textarea" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" '
$answer .= '<textarea class="textarea '.$kpclass.'" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" '
.'rows="'.$drows.'" cols="'.$tiwidth.'" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">';
// --> END NEW FEATURE - SAVE

Expand All @@ -4938,7 +4978,17 @@ function textLimit(field, maxlen) {
// ---------------------------------------------------------------
function do_hugefreetext($ia)
{
global $clang;
global $clang, $thissurvey;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

if ($ia[8] == 'Y')
{
Expand Down Expand Up @@ -4994,7 +5044,7 @@ function textLimit(field, maxlen) {
// --> START ENHANCEMENT - TEXT INPUT WIDTH

// --> START NEW FEATURE - SAVE
$answer .= '<textarea class="textarea" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" '
$answer .= '<textarea class="textarea '.$kpclass.'" name="'.$ia[1].'" id="answer'.$ia[1].'" alt="'.$clang->gT('Answer').'" '
.'rows="'.$drows.'" cols="'.$tiwidth.'" onkeyup="textLimit(\'answer'.$ia[1].'\', '.$maxsize.'); '.$checkconditionFunction.'(this.value, this.name, this.type)">';
// --> END NEW FEATURE - SAVE

Expand Down Expand Up @@ -6133,6 +6183,16 @@ function do_array_multitext($ia)
global $notanswered;
global $minrepeatheadings;

if ($thissurvey['nokeyboard']=='Y')
{
vIncludeKeypad();
$kpclass = "text-keypad";
}
else
{
$kpclass = "";
}

if ($ia[8] == 'Y')
{
$checkconditionFunction = "checkconditions";
Expand Down Expand Up @@ -6411,7 +6471,7 @@ function do_array_multitext($ia)
$answer .= "\t<td class=\"answer_cell_00$ld\">\n"
. "\t\t\t\t<label for=\"answer{$myfname2}\">\n"
. "\t\t\t\t<input type=\"hidden\" name=\"java{$myfname2}\" id=\"java{$myfname2}\" />\n"
. "\t\t\t\t<input type=\"text\" name=\"$myfname2\" id=\"answer{$myfname2}\" title=\""
. "\t\t\t\t<input type=\"text\" name=\"$myfname2\" id=\"answer{$myfname2}\" class=\"".$kpclass."\" title=\""
. FlattenText($labelans[$thiskey]).'" '
. 'size="'.$inputwidth.'" '
. ' value="'.str_replace ('"', "'", str_replace('\\', '', $myfname2value))."\" />\n";
Expand Down

0 comments on commit c4abf65

Please sign in to comment.