Moving edit screens to be template based for i18n (almost done with editor.
This commit is contained in:
parent
e81accaa15
commit
38c7ee33c4
8 changed files with 142 additions and 153 deletions
|
|
@ -5,8 +5,8 @@ use Data::Structure::Util qw/unbless/;
|
|||
|
||||
sub new{
|
||||
my $class = shift;
|
||||
my $parent = shift;
|
||||
my $self = shift || {};
|
||||
my $parent = shift;
|
||||
$self->{answers} = $self->{answers} || [];
|
||||
$self->{text};
|
||||
$self->{index};
|
||||
|
|
@ -24,6 +24,7 @@ sub new{
|
|||
$self->{value};
|
||||
$self->{terminal};
|
||||
$self->{terminalUrl};
|
||||
$self->{type} = 'answer';
|
||||
bless($self,$class);
|
||||
return $self;
|
||||
}
|
||||
|
|
@ -50,6 +51,6 @@ sub freeze{
|
|||
#data is the array of hash items for displaying
|
||||
sub getDragDropList{
|
||||
my ($self,$data,$address,$selected) = @_;
|
||||
push(@$data, { "type","answer","text",$self->{"text"}, "recorded", $self->{'recordedAnswer'} });
|
||||
push(@$data, { "type",$self->{type},"text",$self->{"text"}, "recorded", $self->{'recordedAnswer'} });
|
||||
}
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ sub new{
|
|||
$self->{textInButton};
|
||||
$self->{terminal};
|
||||
$self->{terminalUrl};
|
||||
$self->{type} = 'question';
|
||||
bless($self,$class);
|
||||
return $self;
|
||||
}
|
||||
|
|
@ -45,7 +46,7 @@ sub update{
|
|||
}
|
||||
#is a new answer
|
||||
}elsif($$ref{ids}->[2] eq 'NEW'){
|
||||
push(@{$self->{answers}}, WebGUI::Assest::Wobject::Survey::AnswerJSON->new( $self,@{$self->{object}}) );
|
||||
push(@{$self->{answers}}, WebGUI::Assest::Wobject::Survey::AnswerJSON->new( @{$self->{object}}) );
|
||||
#is updating a answer
|
||||
}else{
|
||||
$self->{answers}->[$$ref{ids}->[2]]->update($ref);
|
||||
|
|
@ -90,7 +91,7 @@ sub freeze{
|
|||
#data is the array of hash items for displaying
|
||||
sub getDragDropList{
|
||||
my ($self,$data,$address,$selected) = @_;
|
||||
push(@$data, { "type","question","text",$self->{text} });
|
||||
push(@$data, { "type",$self->{type},"text",$self->{text} });
|
||||
if($selected){
|
||||
for (@{$self->{answers}}){
|
||||
$_->getDragDropList($data, $address);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ sub new{
|
|||
$self->{terminalUrl};
|
||||
$self->{goto};
|
||||
$self->{timeLimit};
|
||||
$self->{type} = 'section';
|
||||
|
||||
bless($self,$class);
|
||||
return $self;
|
||||
|
|
@ -91,7 +92,7 @@ sub deleteQuestion{
|
|||
#data is the array of hash items for displaying
|
||||
sub getDragDropList{
|
||||
my ($self,$data,$address,$selected) = @_;
|
||||
push(@$data,{ "type","section","text",$self->{"title"} });
|
||||
push(@$data,{ "type",$self->{type},"text",$self->{"title"} });
|
||||
if($selected){
|
||||
for(my $i=0; $i<=$#{$self->{questions}}; $i++){
|
||||
$self->{questions}->[$i]->getDragDropList($data, $address, $i == $address->[1]);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ sub update{
|
|||
if(ref $$ref{ids} eq 'ARRAY' and $$ref{ids}->[0] ne 'NEW'){
|
||||
$self->{sections}->[$$ref{ids}->[0]]->update($ref);
|
||||
}else{
|
||||
push(@{$self->{sections}}, WebGUI::Asset::Wobject::Survey::SectionJSON->new($self,$ref->{object}));
|
||||
push(@{$self->{sections}}, WebGUI::Asset::Wobject::Survey::SectionJSON->new($ref->{object}));
|
||||
}
|
||||
}
|
||||
#determine what to add and add it.
|
||||
|
|
@ -77,16 +77,15 @@ sub createTemp{
|
|||
return WebGUI::Asset::Wobject::Survey::SectionJSON->new($self);
|
||||
}
|
||||
}
|
||||
|
||||
sub freeze{
|
||||
my $self = shift;
|
||||
my ($self) = @_;
|
||||
my %temp = %{$self};
|
||||
$temp{sections} = [];
|
||||
$temp{PPPPPPPOOOOOOOOOOOOOOOOPPPPPPPPPPPP} = 1;
|
||||
delete $temp{log};
|
||||
foreach (@{$self->{sections}}){
|
||||
# push(@{$temp{sections}},$_->freeze());
|
||||
push(@{$temp{sections}},$_->freeze());
|
||||
}
|
||||
$self->{log}->error(Dumper %temp);
|
||||
return \%temp;
|
||||
}
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue