Replaced all decode/encode_json method calls with to/from_json method
calls now that we've licked the Survey encoding bug (wrong mysql db field type)
This commit is contained in:
parent
c4eb4e3b57
commit
a1033aeaa2
3 changed files with 9 additions and 12 deletions
|
|
@ -249,9 +249,6 @@ Saves the survey collateral to the DB
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub survey { return shift->{survey}; }
|
sub survey { return shift->{survey}; }
|
||||||
sub littleBuddy { return shift->{survey}; }
|
|
||||||
sub allyourbases { return shift->{survey}; }
|
|
||||||
sub helpmehelpme { return shift->{survey}; }
|
|
||||||
|
|
||||||
sub saveSurveyJSON {
|
sub saveSurveyJSON {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
@ -288,7 +285,7 @@ sub www_submitObjectEdit {
|
||||||
return $self->session->privilege->insufficient()
|
return $self->session->privilege->insufficient()
|
||||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||||
|
|
||||||
# my $ref = @{decode_json($self->session->form->process("data"))};
|
# my $ref = @{from_json($self->session->form->process("data"))};
|
||||||
my $responses = $self->session->form->paramsHashRef();
|
my $responses = $self->session->form->paramsHashRef();
|
||||||
|
|
||||||
my @address = split /-/, $responses->{id};
|
my @address = split /-/, $responses->{id};
|
||||||
|
|
@ -426,7 +423,7 @@ sub www_dragDrop {
|
||||||
return $self->session->privilege->insufficient()
|
return $self->session->privilege->insufficient()
|
||||||
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
unless ( $self->session->user->isInGroup( $self->get('groupToEditSurvey') ) );
|
||||||
|
|
||||||
my $p = decode_json( $self->session->form->process("data") );
|
my $p = from_json( $self->session->form->process("data") );
|
||||||
|
|
||||||
my @tid = split /-/, $p->{target}->{id};
|
my @tid = split /-/, $p->{target}->{id};
|
||||||
my @bid = split /-/, $p->{before}->{id};
|
my @bid = split /-/, $p->{before}->{id};
|
||||||
|
|
@ -583,7 +580,7 @@ sub www_loadSurvey {
|
||||||
,gotoTargets => \@gotoTargets,
|
,gotoTargets => \@gotoTargets,
|
||||||
};
|
};
|
||||||
$self->session->http->setMimeType('application/json');
|
$self->session->http->setMimeType('application/json');
|
||||||
return encode_json($return);
|
return to_json($return);
|
||||||
} ## end sub www_loadSurvey
|
} ## end sub www_loadSurvey
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -945,7 +942,7 @@ sub surveyEnd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# $self->session->http->setRedirect($url);
|
# $self->session->http->setRedirect($url);
|
||||||
return encode_json( { "type", "forward", "url", $url } );
|
return to_json( { "type", "forward", "url", $url } );
|
||||||
} ## end sub surveyEnd
|
} ## end sub surveyEnd
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -1009,7 +1006,7 @@ sub prepareShowSurveyTemplate {
|
||||||
my $out = $self->processTemplate( $section, $self->get("surveyQuestionsId") );
|
my $out = $self->processTemplate( $section, $self->get("surveyQuestionsId") );
|
||||||
|
|
||||||
$self->session->http->setMimeType('application/json');
|
$self->session->http->setMimeType('application/json');
|
||||||
return encode_json( { "type", "displayquestions", "section", $section, "questions", $questions, "html", $out } );
|
return to_json( { "type", "displayquestions", "section", $section, "questions", $questions, "html", $out } );
|
||||||
} ## end sub prepareShowSurveyTemplate
|
} ## end sub prepareShowSurveyTemplate
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ sub new {
|
||||||
my $json = shift;
|
my $json = shift;
|
||||||
my $log = shift;
|
my $log = shift;
|
||||||
my $survey = shift;
|
my $survey = shift;
|
||||||
my $temp = decode_json($json) if defined $json;
|
my $temp = from_json($json) if defined $json;
|
||||||
my $self = defined $temp ? $temp : {};
|
my $self = defined $temp ? $temp : {};
|
||||||
$self->{survey} = $survey;
|
$self->{survey} = $survey;
|
||||||
$self->{log} = $log;
|
$self->{log} = $log;
|
||||||
|
|
@ -153,7 +153,7 @@ sub freeze {
|
||||||
my %temp = %{$self};
|
my %temp = %{$self};
|
||||||
delete $temp{log};
|
delete $temp{log};
|
||||||
delete $temp{survey};
|
delete $temp{survey};
|
||||||
return encode_json( \%temp );
|
return to_json( \%temp );
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ sub new {
|
||||||
|
|
||||||
# Load json object if given..
|
# Load json object if given..
|
||||||
if ($json) {
|
if ($json) {
|
||||||
my $decoded_json = decode_json($json);
|
my $decoded_json = from_json($json);
|
||||||
$self->{sections} = $decoded_json->{sections} if defined $decoded_json->{sections};
|
$self->{sections} = $decoded_json->{sections} if defined $decoded_json->{sections};
|
||||||
$self->{survey} = $decoded_json->{survey} if defined $decoded_json->{survey};
|
$self->{survey} = $decoded_json->{survey} if defined $decoded_json->{survey};
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ components of this object.
|
||||||
|
|
||||||
sub freeze {
|
sub freeze {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return encode_json(
|
return to_json(
|
||||||
{ sections => $self->{sections},
|
{ sections => $self->{sections},
|
||||||
survey => $self->{survey},
|
survey => $self->{survey},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue