Skip to content

Commit

Permalink
Fixed translation exceptions ! Previous notation is obsolete.
Browse files Browse the repository at this point in the history
Use gettext to display the messages.
Added a listsurveys actions (experimental)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@1848 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Nikos Korfiatis committed Jul 31, 2006
1 parent 67342c3 commit 8b7d30a
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 7 deletions.
1 change: 1 addition & 0 deletions admin/admin.php
Expand Up @@ -163,6 +163,7 @@
exit;
}

if (isset($listsurveys)) {echo $listsurveys; }
if (isset($surveysummary)) {echo $surveysummary;}
if (isset($cssummary)) {echo $cssummary;}
if (isset($usersummary)) {echo $usersummary;}
Expand Down
1 change: 1 addition & 0 deletions admin/checkfields.php
Expand Up @@ -110,6 +110,7 @@
$allfields[]=array("{$dbprefix}surveys", "sid", "sid int(11) NOT NULL auto_increment");
$allfields[]=array("{$dbprefix}surveys", "short_title", "short_title varchar(200) NOT NULL default ''");
$allfields[]=array("{$dbprefix}surveys", "description", "description text");
$allfields[]=array("{$dbprefix}surveys", "datecreated", "datecreated date");
$allfields[]=array("{$dbprefix}surveys", "admin", "admin varchar(50) default NULL");
$allfields[]=array("{$dbprefix}surveys", "active", "active char(1) NOT NULL default 'N'");
$allfields[]=array("{$dbprefix}surveys", "welcome", "welcome text");
Expand Down
4 changes: 2 additions & 2 deletions admin/database.php
Expand Up @@ -652,7 +652,7 @@ function db_quote($str)
. "language, datestamp, ipaddr, refurl, usecookie, notification, allowregister, attribute1, attribute2, "
. "email_invite_subj, email_invite, email_remind_subj, email_remind, "
. "email_register_subj, email_register, email_confirm_subj, email_confirm, "
. "allowsave, autoredirect, allowprev)\n"
. "allowsave, autoredirect, allowprev,datecreated)\n"
. "VALUES ($surveyid, '{$_POST['short_title']}', '{$_POST['description']}',\n"
. "'{$_POST['admin']}', 'N', '".str_replace("\n", "<br />", $_POST['welcome'])."',\n"
. "'{$_POST['useexpiry']}',{$_POST['expires']}, '{$_POST['adminemail']}', '{$_POST['private']}',\n"
Expand All @@ -664,7 +664,7 @@ function db_quote($str)
. "'{$_POST['email_remind']}', '{$_POST['email_register_subj']}',\n"
. "'{$_POST['email_register']}', '{$_POST['email_confirm_subj']}',\n"
. "'{$_POST['email_confirm']}', \n"
. "'{$_POST['allowsave']}', '{$_POST['autoredirect']}', '{$_POST['allowprev']}')";
. "'{$_POST['allowsave']}', '{$_POST['autoredirect']}', '{$_POST['allowprev']}','".date("Y-m-d")."')";
$isresult = $connect->Execute($isquery);
if ($isresult)
{
Expand Down
57 changes: 57 additions & 0 deletions admin/html.php
Expand Up @@ -37,6 +37,63 @@
//Ensure script is not run directly, avoid path disclosure
if (!isset($dbprefix)) {die ("Cannot run this script directly");}

if ($action == "listsurveys")
{

$query = "SELECT * FROM {$dbprefix}surveys";
$result = mysql_query($query) or die(mysql_error());

if(mysql_num_rows($result)>0) {
$listsurveys= "<br><table align='center' bgcolor='#DDDDDD' style='border: 1px solid #555555' "
. "cellpadding='1' cellspacing='0' width='600'>
<tr bgcolor='#BBBBBB'>
<td height=\"22\"><strong>Survey</strong></td>
<td><strong>Date Created</strong></td>
<td><strong>Visibility</strong></td>
<td><strong>Status</strong></td>
<td colspan=\"3\"><strong>Action</strong></td>
</tr>" ;

while($rows = mysql_fetch_array($result))
{
if($rows['private']=="Y")
{
$visibility="Private" ;
}
else $visibility ="Public" ;
if($rows['active']=="Y")
{
$status= "Active" ;
}
else $status ="Non Active" ;

$datecreated=$rows['datecreated'] ;

$listsurveys.="<tr>
<td><a href='".$scriptname."?sid=".$rows['sid']."'>".$rows['short_title']."</a></td>".
"<td>".$datecreated."</td>".
"<td>".$visibility."</td>" .
"<td>".$status."</td>".
"<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>" ;
}
$listsurveys.="<tr bgcolor='#BBBBBB'>
<td><a href='".$scriptname."?action=newsurvey'><img border=0 src='".$imagefiles."/add.png' onmouseout=\"hideTooltip()\" " .
"onmouseover=\"showTooltip(event,'"._("Create Survey")."');return false\">" .
"</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan=\"4\">&nbsp;</td>
</tr>
</table></br>" ;
}
else $listsurveys="<strong> No Surveys in this Installation </strong>" ;
}



if ($action == "checksettings" || $action == "changelang")
{
//GET NUMBER OF SURVEYS
Expand Down
10 changes: 7 additions & 3 deletions common.php
Expand Up @@ -243,7 +243,11 @@ function showadminmenu()
."' alt='"._("Check Database")."' align='left' onClick=\"window.open('checkfields.php', '_top')\""
."onmouseout=\"hideTooltip()\""
."onmouseover=\"showTooltip(event,'"._("Check Database")."');return false\">\n";

$adminmenu .= "\t\t\t\t\t<input type='image' src='$imagefiles//dataentry.png' name='ListSurveys' title='"
."' alt='"._("Check Database")."' align='left' onClick=\"window.open('$scriptname?action=listsurveys', '_top')\""
."onmouseout=\"hideTooltip()\""
."onmouseover=\"showTooltip(event,'"._("List Surveys")."');return false\">\n";

if ($surveyid)
{
$adminmenu .="\t\t\t\t\t<input type='image' src='$imagefiles/delete.png' name='DeleteSurvey' alt='". _("Delete Entire Survey")." ($surveyid)' title='' align='left' "
Expand Down Expand Up @@ -1458,15 +1462,15 @@ function templatereplace($line)
{
if (!isset($_SESSION['step']) || !$_SESSION['step']) //First page, show LOAD
{
$saveall = "<input type='submit' name='loadall' value='"._LOAD_SAVED."' class='saveall'>";
$saveall = "<input type='submit' name='loadall' value='"._("Load Unfinished Survey")."' class='saveall'>";
}
elseif (isset($_SESSION['scid']) && (isset($_POST['move']) && $_POST['move'] == " "._LAST." ")) //Already saved and on Submit Page, don't show Save So Far button
{
$saveall="";
}
else
{
$saveall="<input type='submit' name='saveall' value='"._SAVE_AND_RETURN."' class='saveall' onclick=\"javascript:document.phpsurveyor.move.value = this.value;\">"; // Show Save So Far button
$saveall="<input type='submit' name='saveall' value='"._("Save Survey and Return")."' class='saveall' onclick=\"javascript:document.phpsurveyor.move.value = this.value;\">"; // Show Save So Far button
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions question.php
Expand Up @@ -48,13 +48,13 @@
// If on SUBMIT page and select SAVE SO FAR it will return to SUBMIT page
if (isset($_POST['saveprompt']) && $_POST['saveprompt'] == "Y" && $_SESSION['step'] > $_SESSION['totalsteps'])
{
$_POST['move'] = " "._LAST." ";
$_POST['move'] = " "._("Last Step")." ";
}
// <-- END NEW FEATURE - SAVE

//CHECK IF ALL MANDATORY QUESTIONS HAVE BEEN ANSWERED ############################################
//First, see if we are moving backwards or doing a Save so far, and its OK not to check:
if ($allowmandbackwards==1 && ((isset($_POST['move']) && $_POST['move'] == " << "._PREV." ") || (isset($_POST['saveall']) && $_POST['saveall'] == _SAVE_AND_RETURN)))
if ($allowmandbackwards==1 && ((isset($_POST['move']) && $_POST['move'] == " << "._("Previous")." ") || (isset($_POST['saveall']) && $_POST['saveall'] == _SAVE_AND_RETURN)))
{
$backok="Y";
}
Expand Down

0 comments on commit 8b7d30a

Please sign in to comment.