Skip to content

Commit

Permalink
dev: a little cleanup for the welcome page, group- and questionmode n…
Browse files Browse the repository at this point in the history
…ow use the same code

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9097 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
mennodekker committed Sep 1, 2010
1 parent a497e6f commit 55dbc67
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 51 deletions.
23 changes: 1 addition & 22 deletions group.php
Expand Up @@ -275,28 +275,7 @@
if (!isset($_SESSION['step']) || !$_SESSION['step'])
{
$totalquestions = buildsurveysession();
sendcacheheaders();
doHeader();
echo templatereplace(file_get_contents("$thistpl/startpage.pstpl"));
echo "\n<form method='post' action='{$publicurl}/index.php' id='limesurvey' name='limesurvey' autocomplete='off'>\n";
echo "\n\n<!-- START THE SURVEY -->\n";
echo templatereplace(file_get_contents("$thistpl/welcome.pstpl"))."\n";
if ($thissurvey['private'] == "Y")
{
echo templatereplace(file_get_contents("$thistpl/privacy.pstpl"))."\n";
}
$navigator = surveymover();
echo templatereplace(file_get_contents("$thistpl/navigator.pstpl"));

if ($thissurvey['active'] != "Y")
{
echo "<center><font color='red' size='2'>".$clang->gT("This survey is not currently active. You will not be able to save your responses.")."</font></center>\n";
}
echo "\n<input type='hidden' name='sid' value='$surveyid' id='sid' />\n";
echo "\n<input type='hidden' name='token' value='$token' id='token' />\n";
echo "\n</form>\n";
echo templatereplace(file_get_contents("$thistpl/endpage.pstpl"));
doFooter();
display_first_page();
exit;
}

Expand Down
31 changes: 31 additions & 0 deletions index.php
Expand Up @@ -3211,4 +3211,35 @@ function GetReferringUrl()
}
}

/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page() {
global $clang, $thistpl, $token, $surveyid, $thissurvey, $navigator,$publicurl;
sendcacheheaders();
doHeader();

echo templatereplace(file_get_contents("$thistpl/startpage.pstpl"));
echo "\n<form method='post' action='{$publicurl}/index.php' id='limesurvey' name='limesurvey' autocomplete='off'>\n";

echo "\n\n<!-- START THE SURVEY -->\n";

echo templatereplace(file_get_contents("$thistpl/welcome.pstpl"))."\n";
if ($thissurvey['private'] == "Y")
{
echo templatereplace(file_get_contents("$thistpl/privacy.pstpl"))."\n";
}
$navigator = surveymover();
echo templatereplace(file_get_contents("$thistpl/navigator.pstpl"));
if ($thissurvey['active'] != "Y")
{
echo "<center><font color='red' size='2'>".$clang->gT("This survey is not currently active. You will not be able to save your responses.")."</font></center>\n";
}
echo "\n<input type='hidden' name='sid' value='$surveyid' id='sid' />\n";
echo "\n<input type='hidden' name='token' value='$token' id='token' />\n";
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n"; //This is to ensure consistency with mandatory checks, and new group test
echo "\n</form>\n";
echo templatereplace(file_get_contents("$thistpl/endpage.pstpl"));
doFooter();
}
// Closing PHP tag intentionally left out - yes, it is okay
29 changes: 0 additions & 29 deletions question.php
Expand Up @@ -640,33 +640,4 @@ function checkIfNewGroup($ia)
}
return array($newgroup, $gid, $groupname, $groupdescription, $gl);
}

function display_first_page() {
global $clang, $thistpl, $token, $surveyid, $thissurvey, $navigator,$publicurl;
sendcacheheaders();
doHeader();

echo templatereplace(file_get_contents("$thistpl/startpage.pstpl"));
echo "\n<form method='post' action='{$publicurl}/index.php' id='limesurvey' name='limesurvey' autocomplete='off'>\n";

echo "\n\n<!-- START THE SURVEY -->\n";

echo templatereplace(file_get_contents("$thistpl/welcome.pstpl"))."\n";
if ($thissurvey['private'] == "Y")
{
echo templatereplace(file_get_contents("$thistpl/privacy.pstpl"))."\n";
}
$navigator = surveymover();
echo templatereplace(file_get_contents("$thistpl/navigator.pstpl"));
if ($thissurvey['active'] != "Y")
{
echo "<center><font color='red' size='2'>".$clang->gT("This survey is not currently active. You will not be able to save your responses.")."</font></center>\n";
}
echo "\n<input type='hidden' name='sid' value='$surveyid' id='sid' />\n";
echo "\n<input type='hidden' name='token' value='$token' id='token' />\n";
echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n"; //This is to ensure consistency with mandatory checks, and new group test
echo "\n</form>\n";
echo templatereplace(file_get_contents("$thistpl/endpage.pstpl"));
doFooter();
}
?>

0 comments on commit 55dbc67

Please sign in to comment.