Really dont use this copy
This commit is contained in:
parent
c4f939f306
commit
e81accaa15
3 changed files with 36 additions and 14 deletions
|
|
@ -18,7 +18,7 @@ sub new{
|
|||
}
|
||||
|
||||
$self->{text} = $self->{text} || '';
|
||||
$self->{title} = $self->{title} || '';
|
||||
$self->{title} = $self->{title} || 'New Section';
|
||||
$self->{parent} = $parent;
|
||||
$self->{questionsPerPage} = $self->{questionsPerPage} || 5;
|
||||
$self->{questionsOnSectionPage} = $self->{questionsOnSectionPage} || 1;
|
||||
|
|
@ -106,8 +106,9 @@ sub getQuestion{
|
|||
|
||||
sub freeze{
|
||||
my $self = shift;
|
||||
$self->{parent} = undef;
|
||||
|
||||
my %temp = %{$self};
|
||||
$temp{parent} = undef;
|
||||
$temp{questions} = [];
|
||||
foreach(@{$self->{questions}}){
|
||||
push(@{$temp{questions}}, $_->freeze());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package WebGUI::Asset::Wobject::Survey::SurveyJSON;
|
|||
use strict;
|
||||
use Data::Structure::Util qw/unbless/;
|
||||
use WebGUI::Asset::Wobject::Survey::SectionJSON;
|
||||
use Data::Dumper;
|
||||
|
||||
sub new{
|
||||
my $class = shift;
|
||||
|
|
@ -19,12 +20,23 @@ sub new{
|
|||
bless($self,$class);
|
||||
return $self;
|
||||
}
|
||||
sub log{
|
||||
my ($self,$message) = @_;
|
||||
if(defined $self->{log}){
|
||||
$self->{log}->error($message);
|
||||
}
|
||||
}
|
||||
#address is the array of objects currently selected in the edit screen
|
||||
#data is the array of hash items for displaying
|
||||
sub getDragDropList{
|
||||
my ($self,$address,$data) = @_;
|
||||
my $self = shift;
|
||||
my $address = shift;
|
||||
my $data = shift;
|
||||
$self->{log} = shift;
|
||||
for(my $i=0; $i<=$#{$self->{sections}}; $i++){
|
||||
$self->log("Survey passing ".Dumper $data);#,$address,$i, $$address[0]");
|
||||
$self->{sections}->[$i]->getDragDropList($data, $address, $i == $address->[0]);
|
||||
$self->log("Survey passing ".Dumper $data);#,$address,$i, $$address[0]");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +82,10 @@ sub freeze{
|
|||
my $self = shift;
|
||||
my %temp = %{$self};
|
||||
$temp{sections} = [];
|
||||
$temp{log} = undef;
|
||||
$temp{PPPPPPPOOOOOOOOOOOOOOOOPPPPPPPPPPPP} = 1;
|
||||
delete $temp{log};
|
||||
foreach (@{$self->{sections}}){
|
||||
push(@{$temp{sections}},$_->freeze($self->{log}));
|
||||
# push(@{$temp{sections}},$_->freeze());
|
||||
}
|
||||
return \%temp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue