[virtualcommons-svn] commit/foraging: alllee: setting up StringTemplate usage for survey instructio
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-09-30 02:48:41
|
1 new changeset in foraging: http://bitbucket.org/virtualcommons/foraging/changeset/cbc1c7bd57f8/ changeset: cbc1c7bd57f8 user: alllee date: 2011-09-30 04:48:30 summary: setting up StringTemplate usage for survey instructions, seems pretty easy to use. Should probably fold support into csidex eventually. affected #: 3 files (-1 bytes) --- a/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java Thu Sep 29 15:16:16 2011 -0700 +++ b/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java Thu Sep 29 19:48:30 2011 -0700 @@ -8,6 +8,8 @@ import java.util.Map; import java.util.Properties; +import org.stringtemplate.v4.ST; + import edu.asu.commons.conf.ExperimentRoundParameters; import edu.asu.commons.foraging.graphics.Point3D; import edu.asu.commons.foraging.model.ClientData; @@ -671,8 +673,11 @@ public String getSurveyInstructions(Identifier id) { String surveyInstructions = getSurveyInstructions(); - String updatedSurveyInstructions = surveyInstructions.replace("@PLAYER_ID@", id.toString()); - return updatedSurveyInstructions; + ST template = new ST(surveyInstructions, '{', '}'); + template.add("surveyLink", getSurveyLink()); + template.add("participantId", id); + template.add("surveyId", id.getSurveyId()); + return template.render(); } @Override --- a/src/main/resources/configuration/indiana-experiments/fall-2011/pretest/round4.xml Thu Sep 29 15:16:16 2011 -0700 +++ b/src/main/resources/configuration/indiana-experiments/fall-2011/pretest/round4.xml Thu Sep 29 19:48:30 2011 -0700 @@ -62,11 +62,11 @@ some quick questions. At the beginning of the survey you will need to enter: </p><ul> - <li>Your player ID: @PLAYER_ID@ </li> - <li>Your survey ID: @SURVEY_ID@ </li> + <li>Your player ID: {participantId} </li> + <li>Your survey ID: {surveyId} </li></ul><p> - <a href='@SURVEY_LINK@'>Please click here to begin the survey</a>. + Please <a href='{surveyLink}'>click here</a> to begin the survey. </p> ]]></entry> Repository URL: https://bitbucket.org/virtualcommons/foraging/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |