Index: admin/remotecontrol/lsrc.helper.php
===================================================================
--- admin/remotecontrol/lsrc.helper.php	(revision 8408)
+++ admin/remotecontrol/lsrc.helper.php	(working copy)
@@ -2052,7 +2052,7 @@
 	}
 
 	/**
-	 * function to activate surveys based on new activate.php 5771 2008-10-13 02:28:40Z jcleeland $
+	 * function to activate surveys based on activate.php 8089 2009-12-06 22:03:44Z c_schmitz $
 	 *
 	 * @param unknown_type $surveyid
 	 * @return boolean
@@ -2335,6 +2335,7 @@
 			//Create the survey responses table
 			$createsurvey = "id I NOTNULL AUTO PRIMARY,\n";
 			$createsurvey .= " submitdate T,\n";
+			$createsurvey .= " lastpage I,\n";
 			$createsurvey .= " startlanguage C(20) NOTNULL ,\n";
 			//Check for any additional fields for this survey and create necessary fields (token and datestamp)
 			$pquery = "SELECT private, allowregister, datestamp, ipaddr, refurl FROM {$dbprefix}surveys WHERE sid={$surveyid}";
@@ -2371,7 +2372,7 @@
 			." AND ".db_table_name('questions').".sid={$surveyid} "
 			." AND ".db_table_name('groups').".language='".GetbaseLanguageFromSurveyid($surveyid). "' "
 			." AND ".db_table_name('questions').".language='".GetbaseLanguageFromSurveyid($surveyid). "' "
-			." ORDER BY ".db_table_name('groups').".group_order, title";
+			." ORDER BY group_order, question_order";
 			$aresult = db_execute_assoc($aquery);
 			while ($arow=$aresult->FetchRow()) //With each question, create the appropriate field(s)
 			{
@@ -2449,7 +2450,7 @@
 					}
 					if ((isset($alsoother) && $alsoother=="Y") && ($arow['type']=="M" || $arow['type']=="P"  || $arow['type']=="1")) //Sc: check!
 					{
-						$createsurvey .= " `{$arow['sid']}X{$arow['gid']}X{$arow['qid']}other` C(255),\n";
+						$createsurvey .= " `{$arow['sid']}X{$arow['gid']}X{$arow['qid']}other` X,\n";
 						if ($arow['type']=="P")
 						{
 							$createsurvey .= " `{$arow['sid']}X{$arow['gid']}X{$arow['qid']}othercomment` X,\n";
@@ -2517,7 +2518,7 @@
 					$abresult=db_execute_assoc($abquery) or $this->debugLsrc ("Couldn't get perform answers query$abquery".$connect->ErrorMsg());
 					while ($abrow = $abresult->FetchRow())
 					{
-						$createsurvey .= "  `{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['code']}` C(20),\n";
+						$createsurvey .= "  `{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['code']}` F,\n";
 					}
 				} //End if ($arow['type'] == "K")
 				/*		elseif ($arow['type'] == "J")
@@ -4332,4 +4333,4 @@
 		}
 		return "".$iCountParticipants."Datasets given, ".$iInsertedParticipants." rows inserted. ";
 	}
-}
\ No newline at end of file
+}
