Replaces to_json and from_json with encode_json/decode_json to properly
handle non-ascii user input (e.g. MS Word apostrophe)
This commit is contained in:
parent
2584482fcf
commit
c4540a96ee
3 changed files with 9 additions and 9 deletions
|
|
@ -277,7 +277,7 @@ sub www_submitObjectEdit {
|
|||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
# my $ref = @{from_json($self->session->form->process("data"))};
|
||||
# my $ref = @{decode_json($self->session->form->process("data"))};
|
||||
my $responses = $self->session->form->paramsHashRef();
|
||||
|
||||
my @address = split /-/, $responses->{id};
|
||||
|
|
@ -415,7 +415,7 @@ sub www_dragDrop {
|
|||
return $self->session->privilege->insufficient()
|
||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||
|
||||
my $p = from_json( $self->session->form->process("data") );
|
||||
my $p = decode_json( $self->session->form->process("data") );
|
||||
|
||||
my @tid = split /-/, $p->{target}->{id};
|
||||
my @bid = split /-/, $p->{before}->{id};
|
||||
|
|
@ -572,7 +572,7 @@ sub www_loadSurvey {
|
|||
,gotoTargets => \@gotoTargets,
|
||||
};
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return to_json($return);
|
||||
return encode_json($return);
|
||||
} ## end sub www_loadSurvey
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -924,7 +924,7 @@ sub surveyEnd {
|
|||
}
|
||||
|
||||
# $self->session->http->setRedirect($url);
|
||||
return to_json( { "type", "forward", "url", $url } );
|
||||
return encode_json( { "type", "forward", "url", $url } );
|
||||
} ## end sub surveyEnd
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -988,7 +988,7 @@ sub prepareShowSurveyTemplate {
|
|||
my $out = $self->processTemplate( $section, $self->get("surveyQuestionsId") );
|
||||
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return to_json( { "type", "displayquestions", "section", $section, "questions", $questions, "html", $out } );
|
||||
return encode_json( { "type", "displayquestions", "section", $section, "questions", $questions, "html", $out } );
|
||||
} ## end sub prepareShowSurveyTemplate
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ sub new {
|
|||
my $json = shift;
|
||||
my $log = shift;
|
||||
my $survey = shift;
|
||||
my $temp = from_json($json) if defined $json;
|
||||
my $temp = decode_json($json) if defined $json;
|
||||
my $self = defined $temp ? $temp : {};
|
||||
$self->{survey} = $survey;
|
||||
$self->{log} = $log;
|
||||
|
|
@ -153,7 +153,7 @@ sub freeze {
|
|||
my %temp = %{$self};
|
||||
delete $temp{log};
|
||||
delete $temp{survey};
|
||||
return to_json( \%temp );
|
||||
return encode_json( \%temp );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ sub new {
|
|||
my $log = shift;
|
||||
my $self = {};
|
||||
$self->{log} = $log;
|
||||
my $temp = from_json($json) if defined $json;
|
||||
my $temp = decode_json($json) if defined $json;
|
||||
$self->{sections} = defined $temp->{sections} ? $temp->{sections} : [];
|
||||
$self->{survey} = defined $temp->{survey} ? $temp->{survey} : {};
|
||||
bless( $self, $class );
|
||||
|
|
@ -77,7 +77,7 @@ sub freeze {
|
|||
my %temp;
|
||||
$temp{sections} = $self->{sections};
|
||||
$temp{survey} = $self->{survey};
|
||||
return to_json( \%temp );
|
||||
return encode_json( \%temp );
|
||||
}
|
||||
|
||||
=head2 newObject ( $address )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue