Skip to content

Commit

Permalink
Modified to read and use language files
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@367 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Jun 16, 2003
1 parent 1b3f1ef commit e82779b
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 86 deletions.
25 changes: 17 additions & 8 deletions index.php
Expand Up @@ -90,11 +90,20 @@
$surveyurl = $row['url'];
$surveyurldescrip = $row['urldescrip'];
$surveyformat = $row['format'];
$surveylanguage = $row['language'];
}

//SET THE TEMPLATE DIRECTORY
if (!$templatedir) {$thistpl=$tpldir."/default";} else {$thistpl=$tpldir."/$templatedir";}
if (!is_dir($thistpl)) {$thistpl=$tpldir."/default";}

//REQUIRE THE LANGUAGE FILE
$langdir="$publicdir/lang";
$langfilename="$langdir/$surveylanguage.lang.php";

if (!is_file($langfilename)) {$langfilename="$langdir/$defaultlang.lang.php";}
require($langfilename);

//CLEAR SESSION IF REQUESTED
if ($_GET['move'] == "clearall")
{
Expand All @@ -115,9 +124,9 @@
echo "\t<br />\n";
echo "\t<table align='center' cellpadding='30'><tr><td align='center' bgcolor='white'>\n";
echo "\t\t<font face='arial' size='2'>\n";
echo "\t\t<b><font color='red'>Answers Cleared.</b></font><br /><br />";
echo "<a href='$PHP_SELF?sid=$sid'>Restart This Survey</a><br />\n";
echo "\t\t<a href='javascript: window.close()'>Close Window</a>\n";
echo "\t\t<b><font color='red'>"._ANSCLEAR."</b></font><br /><br />";
echo "<a href='$PHP_SELF?sid=$sid'>"._RESTART."</a><br />\n";
echo "\t\t<a href='javascript: window.close()'>"._CLOSEWIN."</a>\n";
echo "\t\t</font>\n";
echo "\t</td></tr>\n";
echo "\t</table>\n\t<br />\n";
Expand Down Expand Up @@ -171,12 +180,12 @@ function templatereplace($line)
if ($templatedir) {$templateurl="$publicurl/templates/$templatedir/";}
else {$templateurl="$publicurl/templates/default/";}

$clearall = "\t\t\t\t\t<div class='clearall'><a href='{$_SERVER['PHP_SELF']}?sid=$sid&move=clearall' onClick='return confirm(\"Are you sure you want to clear all your responses?\")'>[Exit and Clear Survey]</a></div>\n";
$clearall = "\t\t\t\t\t<div class='clearall'><a href='{$_SERVER['PHP_SELF']}?sid=$sid&move=clearall' onClick='return confirm(\""._CONFIRMCLEAR."\")'>["._EXITCLEAR."]</a></div>\n";


if (ereg("^<body", $line))
{
if (!ereg("^checkconditions()", $line) && ($_SESSION['step'] || $_SESSION['step'] > 0) && ($_POST['move'] != " last " || ($_POST['move'] == " last " && $notanswered)) && ($_POST['move'] != " submit " || ($_POST['move']== " submit " && $notanswered)))
if (!ereg("^checkconditions()", $line) && ($_SESSION['step'] || $_SESSION['step'] > 0) && ($_POST['move'] != " last " || ($_POST['move'] == " "._LAST." " && $notanswered)) && ($_POST['move'] != " "._SUBMIT." " || ($_POST['move']== " "._SUBMIT." " && $notanswered)))
{
$line=str_replace("<body", "<body onload=\"checkconditions()\"", $line);
}
Expand All @@ -197,7 +206,7 @@ function templatereplace($line)
else
{$line=str_replace("{QUESTIONHELP}", $help, $line);}
$line=str_replace("{NAVIGATOR}", $navigator, $line);
$submitbutton="<input class='submit' type='submit' value=' submit ' name='move'>";
$submitbutton="<input class='submit' type='submit' value=' "._SUBMIT." ' name='move'>";
$line=str_replace("{SUBMITBUTTON}", $submitbutton, $line);
$line=str_replace("{COMPLETED}", $completed, $line);
if (!$surveyurldescrip) {$linkreplace="<a href='$surveyurl'>$surveyurl</a>";}
Expand All @@ -218,8 +227,8 @@ function makegraph($thisstep, $total)
$graph = "<table class='graph' width='100' align='center' cellpadding='2'><tr><td>\n";
$graph .= "<table width='180' align='center' cellpadding='0' cellspacing='0' border='0' class='innergraph'>\n";
$graph .= "<tr><td align='right' width='40'>0%</td>\n";
$size=($thisstep-1)/$total*100;
$graph .= "<td width='100' align='left'><img src='$shchart' height='12' width='$size' align='left' alt='$size% complete'></td>\n";
$size=intval(($thisstep-1)/$total*100);
$graph .= "<td width='100' align='left'><img src='$shchart' height='12' width='$size' align='left' alt='$size% "._COMPLETE."'></td>\n";
$graph .= "<td align='left' width='40'>100%</td></tr>\n";
$graph .= "</table>\n";
$graph .= "</td></tr>\n</table>\n";
Expand Down
66 changes: 33 additions & 33 deletions qanda.php
Expand Up @@ -95,8 +95,8 @@
$answer .= "\t\t\t<table class='question'>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td>\n";
$answer .= "\t\t\t\t\t\t<font size='1'>Format: YYYY-MM-DD<br />\n";
$answer .= "\t\t\t\t\t\t(eg: 2003-12-25 for Christmas day)\n";
$answer .= "\t\t\t\t\t\t<font size='1'>"._DATEFORMAT."<br />\n";
$answer .= "\t\t\t\t\t\t"._DATEFORMATEG."\n";
$answer .= "\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t</table>\n";
Expand All @@ -118,8 +118,8 @@
elseif ($ansrow['default'] == "Y") {$answer .= " selected"; $defexists = "Y";}
$answer .= ">{$ansrow['answer']}</option>\n";
}
if (!$_SESSION[$ia[1]] && !$defexists && $ia[6] != "Y") {$answer .= "\t\t\t\t\t\t<option value=' ' selected>Please choose..</option>\n";}
if ($_SESSION[$ia[1]] && !$defexists && $ia[6] != "Y") {$answer .= "\t\t\t\t\t\t<option value=' '>No answer</option>\n";}
if (!$_SESSION[$ia[1]] && !$defexists && $ia[6] != "Y") {$answer .= "\t\t\t\t\t\t<option value=' ' selected>"._PLEASECHOOSE."..</option>\n";}
if ($_SESSION[$ia[1]] && !$defexists && $ia[6] != "Y") {$answer .= "\t\t\t\t\t\t<option value=' '>"._NOANSWER."</option>\n";}
$answer .= "\t\t\t\t\t</select>\n";
}
elseif ($dropdowns == "R")
Expand All @@ -140,12 +140,12 @@
if (((!$_SESSION[$ia[1]] && !$defexists) || ($_SESSION[$ia[1]] == ' ' && !$defexists)) && $ia[6] != "Y")
{
$answer .= "\t\t\t\t\t\t <input class='radio' type='radio' name='$ia[1]' value=' ' checked onClick='checkconditions(this.value, this.name, this.type)' />";
$answer .= "No answer\n";
$answer .= _NOANSWER."\n";
}
elseif ($_SESSION[$ia[1]] && !$defexists && $ia[6] != "Y")
{
$answer .= "\t\t\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value=' ' onClick='checkconditions(this.value, this.name, this.type)' />";
$answer .= "No answer\n";
$answer .= _NOANSWER."\n";
}
$answer .= "\t\t\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t\t\t</tr>\n";
Expand All @@ -162,8 +162,8 @@
{
$answer .= "\t\t\t<table class='question'>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td><u>Choose one of the following:</u></td>\n";
$answer .= "\t\t\t\t\t<td><u>Please enter your comment here:</td>\n";
$answer .= "\t\t\t\t\t<td><u>"._CHOOSEONE.":</u></td>\n";
$answer .= "\t\t\t\t\t<td><u>"._ENTERCOMMENT.":</td>\n";
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td valign='top'>\n";
Expand All @@ -181,12 +181,12 @@
if ((!$_SESSION[$ia[1]] && !$defexists) ||($_SESSION[$ia[1]] == ' ' && !$defexists))
{
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value=' ' checked onChange='checkconditions(this.value, this.name, this.type)' />";
$answer .= "No answer\n";
$answer .= _NOANSWER."\n";
}
elseif ($_SESSION[$ia[1]] && !$defexists)
{
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value=' ' onChange='checkconditions(this.value, this.name, this.type)' />";
$answer .= "No answer\n";
$answer .= _NOANSWER."\n";
}
}
$answer .= "\t\t\t\t\t</td>\n";
Expand Down Expand Up @@ -228,11 +228,11 @@
{
if ((!$_SESSION[$ia[1]] && !$defexists) ||($_SESSION[$ia[1]] == ' ' && !$defexists))
{
$answer .= "\t\t\t\t\t\t<option value=' ' selected>No answer</option>\n";
$answer .= "\t\t\t\t\t\t<option value=' ' selected>"._NOANSWER."</option>\n";
}
elseif ($_SESSION[$ia[1]] && !$defexists)
{
$answer .= "\t\t\t\t\t\t<option value=' '>No answer</option>\n";
$answer .= "\t\t\t\t\t\t<option value=' '>"._NOANSWER."</option>\n";
}
}
$answer .= "\t\t\t\t\t</select>\n";
Expand Down Expand Up @@ -380,7 +380,7 @@
$chosen[]=array($thiscode, $thistext);
}
$ranklist .= "' />\n";
$ranklist .= "\t\t\t\t\t\t<img src='Cut.gif' title='Remove this item' ";
$ranklist .= "\t\t\t\t\t\t<img src='Cut.gif' title='"._REMOVEITEM."' ";
if ($i != $existing)
{
$ranklist .= "style='display:none'";
Expand Down Expand Up @@ -420,34 +420,34 @@
$answer .= "\t\t\t<table border='0' cellspacing='5' class='rank'>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td colspan='2' class='rank'><font size='1'>\n";
$answer .= "\t\t\t\t\t\tClick on an item in the choices list, starting with your highest<br />";
$answer .= "\t\t\t\t\t\tranking item, moving through to your lowest ranking item.";
$answer .= "\t\t\t\t\t\t"._RANK_1."<br />";
$answer .= "\t\t\t\t\t\t"._RANK_2;
$answer .= "\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td align='left' valign='top' class='rank'>\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;Your Choices:</b><br />\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;"._YOURCHOICES.":</b><br />\n";
$answer .= "&nbsp;".$choicelist;
$answer .= "\t\t\t\t\t&nbsp;</td>\n";
if ($maxselectlength > 60)
{
$answer .= "\t\t\t\t</tr>\n\t\t\t\t<tr>\n";
$ranklist = str_replace("<input class='text'", "<input size='60' class='text'", $ranklist);
$answer .= "\t\t\t\t\t<td align='left' bgcolor='silver' class='rank'>\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;Your Ranking:</b><br />\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;"._YOURRANKING.":</b><br />\n";
}
else
{
$answer .= "\t\t\t\t\t<td align='left' bgcolor='silver' width='200' class='rank'>\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your Ranking:</b><br />\n";
$answer .= "\t\t\t\t\t\t<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"._YOURRANKING.":</b><br />\n";
}
$answer .= $ranklist;
$answer .= "\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td colspan='2' class='rank'><font size='1'>\n";
$answer .= "\t\t\t\t\t\tClick on the scissors next to each ranked item<br />";
$answer .= "\t\t\t\t\t\tto remove the last entry in your ranked list.";
$answer .= "\t\t\t\t\t\t"._RANK_3."<br />";
$answer .= "\t\t\t\t\t\t"._RANK_4."";
$answer .= "\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t</tr>\n";
$answer .= "\t\t\t</table>\n";
Expand Down Expand Up @@ -593,7 +593,7 @@
case "N": //NUMERICAL QUESTION TYPE
$answer .= keycontroljs();
$answer .= "\t\t\t<input class='text' type='text' size='10' name='$ia[1]' value=\"{$_SESSION[$ia[1]]}\" onKeyPress=\"return goodchars(event,'0123456789.')\"/><br />\n";
$answer .= "\t\t\t<font size='1'><i>Only numbers can be entered in this field</i></font>\n";
$answer .= "\t\t\t<font size='1'><i>"._NUMERICAL."</i></font>\n";
$inputnames[]=$ia[1];
break;
case "S": //SHORT FREE TEXT
Expand All @@ -612,10 +612,10 @@
$answer .= "\t\t\t\t\t<td>\n";
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value='Y'";
if ($_SESSION[$ia[1]] == "Y") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />Yes<br />\n";
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />"._YES."<br />\n";
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value='N'";
if ($_SESSION[$ia[1]] == "N") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />No<br />\n";
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />"._NO."<br />\n";
if ($ia[6] != "Y")
{
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value=''";
Expand All @@ -634,15 +634,15 @@
$answer .= "\t\t\t\t\t<td>\n";
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value='F'";
if ($_SESSION[$ia[1]] == "F") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />Female<br />\n";
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />"._FEMALE."<br />\n";
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value='M'";
if ($_SESSION[$ia[1]] == "M") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />Male<br />\n";
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />"._MALE."<br />\n";
if ($ia[6] != "Y")
{
$answer .= "\t\t\t\t\t\t<input class='radio' type='radio' name='$ia[1]' value=''";
if ($_SESSION[$ia[1]] == "") {$answer .= " checked";}
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />No Answer\n";
$answer .= " onClick='checkconditions(this.value, this.name, this.type)' />"._NOANSWER."\n";
}
$answer .= "\t\t\t\t\t</td>\n";
$answer .= "\t\t\t\t</tr>\n";
Expand Down Expand Up @@ -752,9 +752,9 @@
$answer .= "\t\t\t<table class='question'>\n";
$answer .= "\t\t\t\t<tr>\n";
$answer .= "\t\t\t\t\t<td></td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>Yes</td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>Uncertain</td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>No</td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._YES."</td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._UNCERTAIN."</td>\n";
$answer .= "\t\t\t\t\t<td align='center' class='array1'>"._NO."</td>\n";
$answer .= "\t\t\t\t</tr>\n";
while ($ansrow = mysql_fetch_array($ansresult))
{
Expand Down Expand Up @@ -848,13 +848,13 @@
{
if (in_array($ia[1], $notanswered))
{
$qtitle = "</b><font color='red' size='1'>This question is mandatory.";
$qtitle = "</b><font color='red' size='1'>"._MANDATORY.".";
if ($ia[4] == "A" || $ia[4] == "B" || $ia[4] == "C")
{ $qtitle .= "<br />\nPlease answer all parts."; }
{ $qtitle .= "<br />\n"._MANDATORY_PARTS."."; }
if ($ia[4] == "M" || $ia[4] == "P")
{ $qtitle .= "<br />\nPlease check at least one item.";}
{ $qtitle .= "<br />\n"._MANDATORY_CHECK.".";}
if ($ia[4] == "R")
{ $qtitle .= "<br />\nPlease rank every item."; }
{ $qtitle .= "<br />\n"._MANDATORY_RANK."."; }
$qtitle .= "</font><b><br />\n";
$qtitle .= $ia[3];
}
Expand Down

0 comments on commit e82779b

Please sign in to comment.