From 931b5026668250b546d2c6c9d48b351bccc56f8a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sat, 6 Dec 2008 00:23:17 +0000 Subject: [PATCH] Update SurveyJSON POD for the new method. Add legal and header POD for ResponseJSON. --- .../Asset/Wobject/Survey/ResponseJSON.pm | 58 ++++++++++++++++++- lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm | 4 +- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm index 860d7f2be..42044a9c7 100644 --- a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm +++ b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm @@ -1,9 +1,59 @@ package WebGUI::Asset::Wobject::Survey::ResponseJSON; +=head1 LEGAL + +------------------------------------------------------------------- +WebGUI is Copyright 2001-2008 Plain Black Corporation. +------------------------------------------------------------------- +Please read the legal notices (docs/legal.txt) and the license +(docs/license.txt) that came with this distribution before using +this software. +------------------------------------------------------------------- +http://www.plainblack.com info@plainblack.com +------------------------------------------------------------------- + +=head1 NAME + +Package WebGUI::Asset::Wobject::Survey::ResponseJSON + +=head1 DESCRIPTION + +Helper class for WebGUI::Asset::Wobject::Survey. It manages data +from the user, sets the order of questions and answers in the survey, +based on forks, and gotos, and also handles expiring the survey +due to time limits. + +This package is not intended to be used by any other Asset in WebGUI. + +=cut + + use strict; use JSON; use Data::Dumper; +=head2 new ( $json, $log, $survey ) + +Object constructor. + +=head3 $json + +Pass in some JSON to be serialized into a data structure. Useful JSON would +contain a hash with "startTime", "surveyOrder", "responses", "lastReponse" +and "questionsAnswered" keys, with appropriate values. + +=head3 $log + +The session logger, from $session->log. The class needs nothing else from the +session object. + +=head3 $survey + +A WebGUI::Asset::Wobject::Survey::SurveyJSON object that represents the current +survey. + +=cut + sub new { my $class = shift; my $json = shift; @@ -28,9 +78,11 @@ sub new { =head2 createSurveyOrder ( SurveyJSON, [address,address] ) -This creates the order for the survey which will change after every fork. -The survey order is to precreate random questions and answers, which also leaves a record or what the user was presented with. -Forks are passed in to show where to branch the new order. +This creates the order for the survey which will change after every fork. The survey +order is to precreate random questions and answers, which also leaves a record or what +the user was presented with. Forks are passed in to show where to branch the new order. + +If questions and/or answers were set to be randomized, it is handled in here. =cut diff --git a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm index 697fcd54e..ad126a066 100644 --- a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm +++ b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm @@ -38,8 +38,8 @@ Object constructor. =head3 $json -Pass in some JSON to be serialized into a data structure. At the very least, you -must pass in the "null" JSON string, '{}'. +Pass in some JSON to be serialized into a data structure. Useful JSON would +be a hash with "survey" and "sections" keys with appropriate values. =head3 $log