Saving token/username with rest of data

Joel Palmius <[email protected]> Mon, 10 Jul 2006 17:09:56 +0200 (CEST)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
As per a private discussion I had with a user, it is entirely possible to 
save a token from TOKENAUTH along with the data. This can for example be 
used to easily get a list with who has answered a survey (and if saved in 
an SQL database, a simple SQL statement can find out who has *not* 
answered).

With the perl snippet support you can read and use the arguments supplied 
in the GET string of the survey. For example:

<SURVEY TITLE="token">

   <SECURITY>
     <TOKENAUTH ARG="token" RESPFILE="/tmp/tokens" />
     <ANSWER LEVEL="respondent" />
     <DATA LEVEL="open" />
   </SECURITY>

   <TEXT NAME="name" CAPTION="What's your name" />

   <CUSTOM ESCAPED="no" VARIABLES="token">
     <input type="hidden" name="token" value="{\
       print $argument->ArgByName("token") || "n/a";
     \}" />
   </CUSTOM>

</SURVEY>

Here, a variable "token" will be saved along with the answers.

Approach for saving username from a FILEAUTH or DBIAUTH is approximately 
the same, but replace the print statement above with:

   print $session->getValue("username") || "n/a";

Hope this is of help to someone.

   // Joel
Skickat av Joel Palmius <[email protected]>
till survey-discussion