diff --git a/lib/WebGUI/Asset/Wobject/Survey.pm b/lib/WebGUI/Asset/Wobject/Survey.pm
index 773609dd8..4f4befd74 100644
--- a/lib/WebGUI/Asset/Wobject/Survey.pm
+++ b/lib/WebGUI/Asset/Wobject/Survey.pm
@@ -1065,7 +1065,7 @@ sub www_loadQuestions {
my @questions;
eval { @questions = $self->responseJSON->nextQuestions(); };
-
+
my $section = $self->responseJSON->nextResponseSection();
#return $self->prepareShowSurveyTemplate($section,$questions);
@@ -1073,6 +1073,7 @@ sub www_loadQuestions {
$section->{wasRestarted} = $wasRestarted;
my $text = $self->prepareShowSurveyTemplate( $section, \@questions );
+
return $text;
}
@@ -1697,4 +1698,31 @@ sub loadTempReportTable {
return 1;
}
+#-------------------------------------------------------------------
+
+=head2 www_editDefaultQuestions
+
+Allows a user to edit the *site wide* default multiple choice questions displayed when adding questions to a survey.
+
+=cut
+
+sub www_editDefaultQuestions{
+ my $self = shift;
+ my $warning = shift;
+ my $session = $self->session;
+ my ($output);
+ my $bundleId = $session->form->process("bundleId");
+
+ if($bundleId eq 'new'){
+
+
+
+ }
+
+ if($warning){$output .= "$warning";}
+# $output .= $tabForm->print;
+
+
+}
+
1;
diff --git a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm
index ab56e6091..bd810df4e 100644
--- a/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm
+++ b/lib/WebGUI/Asset/Wobject/Survey/ResponseJSON.pm
@@ -469,6 +469,9 @@ sub recordResponses {
my $section = $self->nextResponseSection();
my @questions = $self->nextQuestions();
+ #GOTO jumps in the Survey. Order of precedence is Answer, Question, then Section.
+ my ($goto, $gotoExpression);
+
# Handle terminal Section..
my $terminalUrl;
my $sTerminal = 0;
@@ -476,6 +479,15 @@ sub recordResponses {
$sTerminal = 1;
$terminalUrl = $section->{terminalUrl};
}
+ # ..and also gotos..
+ elsif ( $section->{goto} =~ /\w/ ) {
+ $goto = $section->{goto};
+ }
+ # .. and also gotoExpressions..
+ elsif ( $section->{gotoExpression} =~ /\w/ ) {
+ $gotoExpression = $section->{gotoExpression};
+ }
+
# Handle empty Section..
if ( !@questions ) {
@@ -487,7 +499,6 @@ sub recordResponses {
# Process Questions in Section..
my $terminal = 0;
my $allRequiredQsAnswered = 1;
- my ($goto, $gotoExpression);
for my $question (@questions) {
my $aAnswered = 0;
@@ -496,6 +507,14 @@ sub recordResponses {
$terminal = 1;
$terminalUrl = $question->{terminalUrl};
}
+ # ..and also gotos..
+ elsif ( $question->{goto} =~ /\w/ ) {
+ $goto = $question->{goto};
+ }
+ # .. and also gotoExpressions..
+ elsif ( $question->{gotoExpression} =~ /\w/ ) {
+ $gotoExpression = $question->{gotoExpression};
+ }
# Record Question comment
$self->responses->{ $question->{id} }->{comment} = $responses->{ $question->{id} . 'comment' };
@@ -896,7 +915,6 @@ sub nextQuestions {
my $section = $self->nextResponseSection();
my $sectionIndex = $self->nextResponseSectionIndex;
my $questionsPerPage = $self->survey->section( [ $self->nextResponseSectionIndex ] )->{questionsPerPage};
-
# Get all of the existing question responses (so that we can do Section and Question [[var]] replacements
my $recordedResponses = $self->recordedResponses();
@@ -907,6 +925,7 @@ sub nextQuestions {
my @questions;
for my $i (1 .. $questionsPerPage ) {
my $address = $self->surveyOrder->[ $self->lastResponse + $i ];
+ last if(! defined $address);
my ($sIndex, $qIndex) = (sIndex($address), qIndex($address));
# Skip if this is a Section without a Question
@@ -1009,6 +1028,7 @@ equal to the number of sections in the survey order.
sub surveyEnd {
my $self = shift;
+
return 1 if ( $self->lastResponse >= $#{ $self->surveyOrder } );
return 0;
}
diff --git a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
index 97140d484..d440466f4 100644
--- a/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
+++ b/lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
@@ -852,6 +852,7 @@ sub newSection {
terminal => 0,
terminalUrl => q{},
goto => q{},
+ gotoExpression => q{},
timeLimit => 0,
type => 'section',
questions => [],
@@ -881,6 +882,8 @@ sub newQuestion {
textInButton => 0,
type => 'question',
answers => [],
+ goto => q{},
+ gotoExpression => q{},
};
}
diff --git a/root_import_survey_default-question-edit.wgpkg b/root_import_survey_default-question-edit.wgpkg
new file mode 100644
index 000000000..9d8572c9f
Binary files /dev/null and b/root_import_survey_default-question-edit.wgpkg differ
diff --git a/root_import_survey_default-section-edit.wgpkg b/root_import_survey_default-section-edit.wgpkg
new file mode 100644
index 000000000..0fb21ed35
Binary files /dev/null and b/root_import_survey_default-section-edit.wgpkg differ
diff --git a/www/extras/wobject/Survey/administersurvey.js b/www/extras/wobject/Survey/administersurvey.js
index ea165c431..bf837e1fa 100644
--- a/www/extras/wobject/Survey/administersurvey.js
+++ b/www/extras/wobject/Survey/administersurvey.js
@@ -318,9 +318,11 @@ if (typeof Survey === "undefined") {
var qs = params.questions;
var s = params.section;
sliders = [];
+ console.log("Can are farking at least get here?");
//What to show and where
document.getElementById('survey').innerHTML = params.html;
+ console.log("How about farking here");
//var te = document.createElement('span');
//te.innerHTML = "";
//document.getElementById('survey').appendChild(te);
@@ -333,7 +335,7 @@ if (typeof Survey === "undefined") {
if (lastSection !== s.id || s.everyPageText === '1') {
document.getElementById('headertext').style.display = 'block';
}
-
+ console.log(s.questionsOnSectionPage + " wtf");
if (lastSection !== s.id && s.questionsOnSectionPage !== '1') {
var span = document.createElement("div");
span.innerHTML = "";
@@ -500,4 +502,4 @@ if (typeof Survey === "undefined") {
YAHOO.util.Event.onDOMReady(function(){
// Survey.Comm.setUrl('/' + document.getElementById('assetPath').value);
Survey.Comm.callServer('', 'loadQuestions');
-});
\ No newline at end of file
+});