Gmane
From: Joel Palmius <joel.palmius <at> mh.se>
Subject: Mod_Survey 3.2.1-pre1
Newsgroups: gmane.comp.apache.mod-survey.general
Date: 2004-10-04 10:42:10 GMT (3 years, 48 weeks, 3 days, 4 hours and 39 minutes ago)
There's a new development snapshot online now, the first pre-release of 
what is to become 3.2.1. You will probably not want to use this on a 
production server right now, but it might give you an idea about the new 
toys that will appear in the stable release.

The folllowing is a list of higlights, some of them are explained more in 
detail further down:

* Array-like structures in IMPORT, session and perl snippet API
* New SUBMIT tag (only half-finished)
* Bugfix for the 999 problem, which is hopefully now resolved
* Cleanups in DBI code (now modularized so common operations share API)
* Cleanups/extensions for third-part modules, mainly Cough
* Backwards and forwards connectors

ARRAY-LIKE STRUCTURES: This enables you to either import a complete set of 
data from a database, or generate it on-the-fly. It can then be used as 
the set of (DB)LISTELEMENTs or (DB)CHOICEELEMENTs in a LIST/CHOICE block. 
Consider the following:

<SURVEY TITLE="dbtest">
   <IMPORT DBIDSN="DBI:Pg:dbname=joepal"
     DBITABLE="respondent"
     DBIUSER="joepal">
     <ARRAY NAME="name" FIELD="name" />
     <ARRAY NAME="persid" FIELD="persid" />
   </IMPORT>

   <LIST NAME="age" CAPTION="When were you born?">
     <DBLISTELEMENT CAPTIONARRAY="name" VALUEARRAY="persid" />
   </LIST>
</SURVEY>

.. which imports all cells in the columns "name" and "persid" from a DBI 
database and then uses them for captions and values in a LIST block. The 
arrays can also be dynamically created using the perl snippet API, which 
can come in handy if you, for example, want a long list of years.

BugAnt did most of the above code.

SUBMIT TAG: This will eventually make it possible to write the 
after-submit html message inside the survey file. It will work like a 
CUSTOM. Currently it only parses for submit-time perl snippets.

BACKWARDS AND FORWARDS CONNECTORS: These are perl snippet enhancements for 
making it possible to connect Mod_Survey in a chain with other tools. To 
fetch a variable from the GET string, it is now possible to do:

{&
   my($value) = $argument->ArgByName("avalue");
   $session->setValue("avalue",$value);
&}

<TEXT NAME="test" CAPTION="Fetched from GET" DEFAULT="{£avalue£}" />

.. which enables backwards connector (ie something before mod_survey 
sending data to mod_survey). Calling the survey file with an argument such 
as "test.survey?action=display&avalue=hello" would set "hello" as the 
default value in the text box.

On the other end, it is now possible to set cookie values in the 
submit-time perl snippet api:

<SUBMIT>
   <|
     my($value) = $session->getValue("SUBMITTED_test");
     $self->setCookie("avalue",$value);
   |>
</SUBMIT>

.. which would fetch the submitted variable "test" and put it into a 
cookie named "avalue" (path is hardcoded to /, and expiry to +60m). The 
cookie is possible to read by any server-side script running with the same 
base URL.

I haven't announced the release on the homepage or on freshmeat yet, but 
expect to do so this afternoon. There is a link to the snapshot from the 
download page though, and the code is available through CVS.

The nearest work (for my part) will probably be focused on cleaning up the 
stylesheet set-up in regards to DIV tags and similar.

   // Joel