From 8c3c7d5ac37936674bfc7faee221cc718b4c7e03 Mon Sep 17 00:00:00 2001 From: markusfluer Date: Fri, 22 Dec 2017 13:01:57 +0100 Subject: [PATCH] Fixed issue: Tour ends automatically when not able to render --- application/config/version.php | 2 +- application/controllers/admin/questions.php | 4 +- .../helpers/update/updatedb_helper.php | 650 +++++++++++++++++- .../survey/Question/editQuestion_view.php | 2 +- .../packages/adminpanel/build/lsadminpanel.js | 3 - .../adminpanel/build/lsadminpanel.js.map | 2 +- .../adminpanel/build/lsadminpanel.min.js | 2 +- assets/packages/adminpanel/src/main.js | 3 - .../packages/lstutorial/build/lstutorial.js | 16 +- .../lstutorial/build/lstutorial.js.map | 2 +- .../lstutorial/build/lstutorial.min.js | 2 +- .../packages/lstutorial/lib/bootstrap-tour.js | 14 +- .../src/tours/global-tour-object.js | 2 + assets/scripts/admin/answers.js | 46 +- assets/scripts/admin/subquestions.js | 49 +- installer/create-database.php | 33 +- 16 files changed, 749 insertions(+), 83 deletions(-) diff --git a/application/config/version.php b/application/config/version.php index 8db7f7a7449..434fe68cf95 100644 --- a/application/config/version.php +++ b/application/config/version.php @@ -13,7 +13,7 @@ $config['versionnumber'] = '3.0.0'; //The current version of this branch -$config['dbversionnumber'] = 336; +$config['dbversionnumber'] = 337; $config['buildnumber'] = ''; $config['updatable'] = true; $config['assetsversionnumber'] = '30000'; diff --git a/application/controllers/admin/questions.php b/application/controllers/admin/questions.php index a051765b446..33e83423732 100644 --- a/application/controllers/admin/questions.php +++ b/application/controllers/admin/questions.php @@ -962,7 +962,7 @@ public function getSubquestionRow($surveyid, $gid, $qid, $codes, $language, $fir 'language' => $language, 'title' => $code, 'question' => '', - 'relevance' => '', + 'relevance' => '1', 'oldCode' => $oldCode, ); } else { @@ -982,7 +982,7 @@ public function getSubquestionRow($surveyid, $gid, $qid, $codes, $language, $fir 'language' => $language, 'title' => $code, 'question' => '', - 'relevance' => '', + 'relevance' => '1', 'oldCode' => $oldCode, ); } diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index 05f0b06f55e..d97e781629f 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -817,6 +817,13 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false) $oTransaction->commit(); } + if ($iOldDBVersion < 337) { + $oTransaction = $oDB->beginTransaction(); + resetTutorials337($oDB); + $oDB->createCommand()->update('{{settings_global}}', array('stg_value'=>337), "stg_name='DBVersion'"); + $oTransaction->commit(); + } + } catch (Exception $e) { Yii::app()->setConfig('Updating', false); $oTransaction->rollback(); @@ -859,6 +866,633 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false) Yii::app()->setConfig('Updating', false); return true; } +/** + * @param $oDB + * + * @return void + */ +function resetTutorials337($oDB){ + $oDB->createCommand()->truncateTable('{{tutorials}}'); + $oDB->createCommand()->insert('{{tutorials}}', array( + 'tid' => 1, + 'name' => 'firstStartTour', + 'title' => 'First start tour', + 'icon' => 'fa-rocket', + 'description' => 'The first start tour to get your first feeling into LimeSurvey', + 'active' => 1, + 'settings' => json_encode(array( + 'keyboard' => false, + 'orphan' => true, + 'template' => "

", + 'onShown' => "(function(tour){ console.ls.log($('#notif-container').children()); $('#notif-container').children().remove(); })", + 'onEnd' => "(function(tour){window.location.reload();})", + 'endOnOrphan' => true, + )), + 'permission' => 'survey', + 'permission_grade' => 'create' + )); + $oDB->createCommand()->truncateTable('{{tutorial_entries}}'); + $oDB->createCommand()->truncateTable('{{tutorial_entry_relation}}'); + $contentArrays = array( + array( + 'teid' => 1, + 'ordering' => 1, + 'title' => 'Welcome to LimeSurvey!', + 'content' => "This tour will help you to easily get a basic understanding of LimeSurvey."."
" + ."We would like to help you with a quick tour of the most essential functions and features.", + 'settings' => json_encode(array ( + 'element' => '#lime-logo', + 'path' => ['/admin/index'], + 'placement' => 'bottom', + 'redirect' => true, + 'onShow' => "(function(tour){ $('#welcomeModal').modal('hide'); })" + )) + ), + array( + 'teid' => 2, + 'ordering' => 2, + 'title' => 'The basic functions', + 'content' => "The three top boxes are the most basic functions of LimeSurvey."."
" + ."From left to right it should be 'Create survey', 'List surveys' and 'Global settings'. Best we start by creating a survey." + .'

'."Click on the 'Create survey' box - or 'Next' in this tutorial".'

', + 'settings' => json_encode(array( + 'element' => '.selector__create_survey', + 'path' => ['/admin/index'], + 'reflex' => true, + 'onShow' => "(function(tour){ $('#welcomeModal').modal('hide'); })", + 'onNext' => "(function(tour){ + tour.setCurrentStep(2); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 3, + 'ordering' => 3, + 'title' => 'The survey title', + 'content' => "This is the title of your survey."."
" + ."Your participants will see this title in the browser's title bar and on the welcome screen." + ."

"."You have to put in at least a title for the survey to be saved.".'

', + 'settings' => json_encode(array( + 'path' => ['/admin/survey/sa/newsurvey'], + 'element' => '#surveyls_title', + 'redirect' => true, + 'prev' => '-1', + )) + ), + array( + 'teid' => 4, + 'ordering' => 4, + 'title' => 'The survey description', + 'content' => "In this field you may type a short description of your survey."."
" + ."The text inserted here will be displayed on the welcome screen, which is the first thing that your respondents will see when they access your survey..".' ' + ."Describe your survey, but do not ask any question yet.", + 'settings' => json_encode(array( + 'element' => '#cke_description', + 'path' => ['/admin/survey/sa/newsurvey'], + 'placement' => 'top', + 'redirect' => false, + )) + ), + array( + 'teid' => 5, + 'ordering' => 5, + 'title' => 'Create a sample question and question group', + 'content' => "We will be creating a question group and a question in this tutorial. There is need to automatically create it.", + 'settings' => json_encode(array( + 'element' => '.bootstrap-switch-id-createsample', + 'path' => ['/admin/survey/sa/newsurvey'], + 'redirect' => false, + )) + ), + array( + 'teid' => 6, + 'ordering' => 6, + 'title' => 'The welcome message', + 'content' => "This message is shown directly below the survey description on the welcome page. You may leave this blank for now but it is a good way to introduce your participants to the survey.", + 'settings' => json_encode(array( + 'element' => '#cke_welcome', + 'placement' => 'top', + 'path' => ['/admin/survey/sa/newsurvey'], + 'redirect' => false, + )) + ), + array( + 'teid' => 7, + 'ordering' => 7, + 'title' => 'The end message', + 'content' => "This message is shown at the end of your survey to every participant. It's a great way to say thank you or give some links or hints where to go next.", + 'settings' => json_encode(array( + 'element' => '#cke_endtext', + 'path' => ['/admin/survey/sa/newsurvey'], + 'placement' => 'top', + 'redirect' => false, + )) + ), + array( + 'teid' => 8, + 'ordering' => 8, + 'title' => 'Now save your survey', + 'content' => "You may play around with more settings, but let's save and start adding questions to your survey now. Just click on 'Save'.", + 'settings' => json_encode(array( + 'element' => '#save-form-button', + 'path' => ['/admin/survey/sa/newsurvey'], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + tour.setCurrentStep(8); + $('#save-form-button').trigger('click'); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 9, + 'ordering' => 9, + 'title' => 'The sidebar', + 'content' => 'This is the sidebar.'.'
' + .'All important settings can be reached in this sidebar.'.'
' + .'The most important settings of your survey can be reached from this sidebar: the survey settings menu and the survey structure menu.'.' ' + .gT('You may resize it to fit your screen to easily navigate through the available options.' + .' If the size of the sidebar is too small, the options get collapsed and the quick-menu is displayed.' + .' If you wish to work from the quick-menu, either click on the arrow button or drag it to the left.'), + 'settings' => json_encode(array( + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'element' => '#sidebar', + 'placement' => 'top', + 'redirect' => false, + 'prev' => '-1', + 'onShow' => "(function(tour){ + $('#adminpanel__sidebar--selectorSettingsButton').trigger('click'); + })", + )) + ), + array( + 'teid' => 10, + 'ordering' => 10, + 'title' => 'The settings tab with the survey menu', + 'content' => 'If you click on this tab, the survey settings menu will be displayed.'.' ' + .'The most important settings of your survey are accessible from this menu.'. '
' + .'If you want to know more about them, check our manual.', + 'settings' => json_encode(array( + 'element' => '#adminpanel__sidebar--selectorSettingsButton', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'redirect' => false, + )) + ), + array( + 'teid' => 11, + 'ordering' => 11, + 'title' => 'The top bar', + 'content' => 'This is the top bar.'.'
' + .'This bar will change as you move through the functionalities.'.' ' + .'The current bar corresponds to the "overview" tab. It contains the most important LimeSurvey functionalities such as preview and activate survey.', + 'settings' => json_encode(array( + 'element' => '#surveybarid', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'redirect' => false, + )) + ), + array( + 'teid' => 12, + 'ordering' => 12, + 'title' => 'The survey structure', + 'content' => 'This is the structure view of your survey. Here you can see all your question groups and questions.', + 'settings' => json_encode(array( + 'element' => '#adminpanel__sidebar--selectorStructureButton', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'redirect' => false, + 'onShow' => "(function(tour){ + $('#adminpanel__sidebar--selectorStructureButton').trigger('click'); + })", + )) + ), + array( + 'teid' => 13, + 'ordering' => 13, + 'title' => "Let's add a question group", + 'content' => "What good would your survey be without questions?".'
' + .'In LimeSurvey a survey is organized in question groups and questions. To begin creating questions, we first need a question group.' + .'

'."Click on the 'Add question group' button".'

', + 'settings' => json_encode(array( + 'element' => '#adminpanel__sidebar--selectorCreateQuestionGroup', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'right', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + document.location.href = $('#adminpanel__sidebar--selectorCreateQuestionGroup').attr('href'); + tour.setCurrentStep(13); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 14, + 'ordering' => 14, + 'title' => 'Enter a title for your first question group', + 'content' => 'The title of the question group is visible to your survey participants (this setting can be changed later and it cannot be empty). ' + .'Question groups are important because they allow the survey administrators to logically group the questions. ' + .'By default, each question group (including its questions) is shown on its own page (this setting can be changed later).', + 'settings' => json_encode(array( + 'element' => '#group_name_en', + 'path' => ['/admin/questiongroups/sa/add', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 15, + 'ordering' => 15, + 'title' => 'A description for your question group', + 'content' => 'This description is also visible to your participants.'.'
' + .'You do not need to add a description to your question group, but sometimes it makes sense to add a little extra information for your participants.', + 'settings' => json_encode(array( + 'element' => 'label[for=description_en]', + 'path' => ['/admin/questiongroups/sa/add', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'top', + 'redirect' => false, + )) + ), + array( + 'teid' => 16, + 'ordering' => 16, + 'title' => 'Advanced settings', + 'content' => "For now it's best to leave these additional settings as they are. If you want to know more about randomization and relevance settings, have a look at our manual.", + 'settings' => json_encode(array( + 'element' => '#randomization_group', + 'path' => ['/admin/questiongroups/sa/add', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'left', + 'redirect' => false, + )) + ), + array( + 'teid' => 17, + 'ordering' => 17, + 'title' => 'Save and add a new question', + 'content' => "Now when you are finished click on 'Save and add question'.".'
' + .'This will directly add a question to the current question group.' + .'

'."Now click on 'Save and add question'.".'

', + 'settings' => json_encode(array( + 'element' => '#save-and-new-question-button', + 'path' => ['/admin/questiongroups/sa/add', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + $('#save-and-new-question-button').trigger('click'); + tour.setCurrentStep(17); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 18, + 'ordering' => 18, + 'title' => 'The title of your question', + 'content' => + "This code is normally not shown to your participants, still it is necessary and has to be unique for the survey.".'
' + ."This code is also the name of the variable that will be exported to SPSS or Excel." + .'

'."Please type in a code that consists only of letters and numbers, and doesn't start with a number.".'

', + 'settings' => json_encode(array( + 'element' => '#title', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'top', + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 19, + 'ordering' => 19, + 'title' => 'The actual question text', + 'content' => 'The content of this box is the actual question text shown to your participants.'.' ' + .'It may be empty, but that is not recommended. You may use all the power of our WYSIWYG editor to make your question shine.', + 'settings' => json_encode(array( + 'element' => '#cke_question_en', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'top', + 'redirect' => false, + )) + ), + array( + 'teid' => 20, + 'ordering' => 20, + 'title' => 'An additional help text for your question', + 'content' => 'You can add some additional help text to your question. ' + .'If you decide not to offer any additional question hints, then no help text will be displayed to your respondents.', + 'settings' => json_encode(array( + 'element' => '#cke_help_en', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'top', + 'redirect' => false, + )) + ), + array( + 'teid' => 21, + 'ordering' => 21, + 'title' => 'Set your question type.', + 'content' => "LimeSurvey offers you a lot of different question types.".'
' + ."As you can see, the preselected question type is the 'Long free text' one. We will use in this example the 'Array' question type.".'
' + ."This type of question allows you to add multiple subquestions and a set of answers." + .'

'."Please select the 'Array'-type.".'

', + 'settings' => json_encode(array( + 'element' => '#question_type_button', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'left', + 'redirect' => false, + )) + ), + array( + 'teid' => 22, + 'ordering' => 22, + 'title' => 'Now save the created question', + 'content' => 'Next, we will create subquestions and answer options.'.'
' + .'Please remember that in order to have a valid code, it must contain only letters and numbers, ' + .'also please check that it starts with a letter.', + 'settings' => json_encode(array( + 'element' => '#save-button', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'left', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + $('#question_type').val('F'); + $('#save-button').trigger('click'); + tour.setCurrentStep(22); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 23, + 'ordering' => 23, + 'title' => 'The question bar', + 'content' => 'This is the question bar.'.'
' + .'The most important question-related options are displayed here.'.'
' + .'The availability of options is related to the type of question you previously chose.', + 'settings' => json_encode(array( + 'element' => '#questionbarid', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'backdrop' => false, + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 24, + 'ordering' => 24, + 'title' => 'Add some subquestions to your question', + 'content' => "The array question is a type that creates a matrix for the participant.".'
' + ."To fully use it, you have to add subquestions as well as answer options.".'
' + ."Let's start with subquestions." + .'

'."Click on the 'Edit subquestions' button.".'

', + 'settings' => json_encode(array( + 'element' => '#adminpanel__topbar--selectorAddSubquestions', + 'placement' => 'bottom', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + document.location.href = $('#adminpanel__topbar--selectorAddSubquestions').attr('href'); + tour.setCurrentStep(24); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 25, + 'ordering' => 25, + 'title' => 'Edit subquestions', + 'content' => "You should add some subquestions for your question here.".'
' + ."Every row is one subquestion. We recommend the usage of logical or numerical codes for subquestions.".' ' + ."Your participants cannot see the subquestion code, only the subquestion text itself." + ."

"."Pro tip: The subquestion may even contain HTML code.".'

', + 'settings' => json_encode(array( + 'element' => '#rowcontainer', + 'path' => ['admin/questions/sa/subquestions/surveyid/[0-9]{4,25}/gid/[0-9]{1,25}/qid/[0-9]{4,25}'], + 'placement' => 'bottom', + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 26, + 'ordering' => 26, + 'title' => 'Add subquestion row', + 'content' => sprintf('Click on the plus sign %s to add another subquestion to your question.', '') + ."

".'Please add at least two subquestions'."

", + 'settings' => json_encode(array( + 'element' => '#rowcontainer>tr:first-of-type .btnaddanswer', + 'path' => ['admin/questions/sa/subquestions/surveyid/[0-9]{4,25}/gid/[0-9]{1,25}/qid/[0-9]{4,25}'], + 'placement' => 'left', + 'redirect' => false, + )) + ), + array( + 'teid' => 27, + 'ordering' => 27, + 'title' => 'Now save the subquestions', + 'content' => "You may save empty subquestions, but that would be pointless." + ."

"."Save and close now and let's edit the answer options.".'

', + 'settings' => json_encode(array( + 'element' => '#save-and-close-button', + 'path' => ['admin/questions/sa/subquestions/surveyid/[0-9]{4,25}/gid/[0-9]{1,25}/qid/[0-9]{4,25}'], + 'placement' => 'left', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + $('#save-and-close-button').trigger('click'); + tour.setCurrentStep(27); + return new Promise(function(res,rej){}); + })" + )) + ), + array( + 'teid' => 28, + 'ordering' => 28, + 'title' => 'Add some answer options to your question', + 'content' => "Now that we've got some subquestions, we have to add answer options as well.".'
' + ."The answer options will be shown for each subquestion." + .'

'."Click on the 'Edit answer options' button.".'

', + 'settings' => json_encode(array( + 'element' => '#adminpanel__topbar--selectorAddAnswerOptions', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'prev' => '-1', + 'onNext' => "(function(tour){ + document.location.href = $('#adminpanel__topbar--selectorAddAnswerOptions').attr('href'); + tour.setCurrentStep(28); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 29, + 'ordering' => 29, + 'title' => 'Edit answer options', + 'content' => "As you can see, editing answer options is quite similar to editing subquestions.".'
' + .'Remember the plus button ?'.'
' + .'

'."Please add at least two answer options to proceed.".'

', + 'settings' => json_encode(array( + 'element' => '#rowcontainer', + 'path' => ['admin/questions/sa/answeroptions/surveyid/[0-9]{4,25}/gid/[0-9]{1,25}/qid/[0-9]{4,25}'], + 'placement' => 'bottom', + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 30, + 'ordering' => 30, + 'title' => 'Now save the answer options', + 'content' => "Click on 'Save and close' or 'Next' to proceed.", + 'settings' => json_encode(array( + 'element' => '#save-and-close-button', + 'path' => ['admin/questions/sa/answeroptions/surveyid/[0-9]{4,25}/gid/[0-9]{1,25}/qid/[0-9]{4,25}'], + 'placement' => 'left', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + $('#save-and-close-button').trigger('click'); + tour.setCurrentStep(30); + return new Promise(function(res,rej){}); + })" + )) + ), + array( + 'teid' => 31, + 'ordering' => 31, + 'title' => 'Preview survey', + 'content' => "Let's have a look at your first survey.".'
' + ."Just click on this button and a new window will open, where you can test run your survey.".'
' + ."Please be aware that your answers will not be saved, because the survey isn't active yet." + .'

'."Click on 'Preview survey' and return to this window when you are done testing.".'

', + 'settings' => json_encode(array( + 'element' => '.selector__topbar--previewSurvey', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'redirect' => false, + 'prev' => '-1', + )) + ), + array( + 'teid' => 32, + 'ordering' => 32, + 'title' => 'Easy navigation with the "breadcrumbs"', + 'content' => 'You can see the "breadcrumbs" In the top bar of the admin interface.'.'
' + ."They represent an easy way to get back to any previous setting, and provide a general overview of where you are." + .'

'."Click on the name of your survey to get back to the survey settings overview.".'

', + 'settings' => json_encode(array( + 'element' => '#breadcrumb__survey--overview', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}', 'gid' => '[0-9]{1,25}', 'qid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'onNext' => "(function(tour){ + tour.setCurrentStep(32); + document.location.href = $('#breadcrumb__survey--overview').attr('href'); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 33, + 'ordering' => 33, + 'title' => 'Finally, activate your survey', + 'content' => "Now, activate your survey.".'
' + ."You can create as many surveys as you like." + .'

'."Click on 'Activate this survey'".'

', + 'settings' => json_encode(array( + 'element' => '#ls-activate-survey', + 'path' => ['/admin/survey/sa/view', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'prev' => '-1', + 'onNext' => "(function(tour){ + document.location.href = $('#ls-activate-survey').attr('href'); + tour.setCurrentStep(33); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 34, + 'ordering' => 34, + 'title' => 'Activation settings', + 'content' => 'These settings cannot be changed once the survey is online.'.'
' + ."For this simple survey the default settings are ok, but read the disclaimer carefully when you activate your own surveys.".'
' + ."For more information consult our manual, or our forums." + .'

'.'Now click on "Save & activate survey"'.'

', + 'settings' => json_encode(array( + 'element' => '#activateSurvey__basicSettings--proceed', + 'path' => ['/admin/survey/sa/activate', ['surveyid' => '[0-9]{4,25}']], + 'placement' => '', + 'reflex' => true, + 'redirect' => false, + 'prev' => '-1', + 'onNext' => "(function(tour){ + $('#activateSurvey__basicSettings--proceed').trigger('click'); + tour.setCurrentStep(34); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 35, + 'ordering' => 35, + 'title' => ('Activate survey participants table'), + 'content' => "Here you can select to start your survey in closed access mode."."
" + ."For our simple survey it is better to start in open access mode."."
" + ."The closed access mode needs a participant list, which you may create by clicking on the menu entry 'Participants'."."
" + ."For more information please consult our manual or our forum." + .'

'."Click on 'No, thanks'".'

', + 'settings' => json_encode(array( + 'element' => '#activateTokenTable__selector--no', + 'path' => ['/admin/survey/sa/activate', ['surveyid' => '[0-9]{4,25}']], + 'placement' => 'bottom', + 'reflex' => true, + 'redirect' => false, + 'prev' => '-1', + 'onNext' => "(function(tour){ + $('#activateTokenTable__selector--no').trigger('click'); + tour.setCurrentStep(35); + return new Promise(function(res,rej){}); + })", + )) + ), + array( + 'teid' => 36, + 'ordering' => 36, + 'title' => 'Share this link', + 'content' => "Just share this link with some of your friends and of course, test it yourself." + .'

'."Thank you for taking the tour!".'

', + 'settings' => json_encode(array( + 'element' => '#adminpanel__surveysummary--mainLanguageLink', + 'path' => ['/'.'(index.php)?'], + 'placement' => 'top', + 'redirect' => false, + 'prev' => '-1', + 'onHide' => '(function(){window.location.reload()})' + )) + ), + ); + + foreach($contentArrays as $contentArray) { + $oDB->createCommand()->insert('{{tutorial_entries}}', $contentArray); + $oDB->createCommand()->insert('{{tutorial_entry_relation}}', array('tid' => 1, 'teid' => $contentArray['teid'])); + } + +} /** * @param $oDB @@ -917,7 +1551,7 @@ function upgrade333($oDB){ 'settings' => json_encode(array ( 'element' => '#lime-logo', 'orphan' => true, - 'path' => '/admin/index', + 'path' => ['/admin/index'], 'placement' => 'bottom', 'redirect' => false, 'onShow' => "(function(tour){ $('#welcomeModal').modal('hide'); })" @@ -932,7 +1566,7 @@ function upgrade333($oDB){ .'

'."Click on the 'Create survey' box - or 'Next' in this tutorial".'

', 'settings' => json_encode(array( 'element' => '.selector__create_survey', - 'path' => '/admin/index', + 'path' => ['/admin/index'], 'reflex' => true, 'redirect' => true, 'onShow' => "(function(tour){ $('#welcomeModal').modal('hide'); $('.selector__create_survey').on('click', function(){tour.next();});})" @@ -946,7 +1580,7 @@ function upgrade333($oDB){ ."Your participants will see this title in the browser's title bar and on the welcome screen." ."

"."You have to put in at least a title for the survey to be saved.".'

', 'settings' => json_encode(array( - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'element' => '#surveyls_title', 'redirect' => true, )) @@ -960,7 +1594,7 @@ function upgrade333($oDB){ ."Describe your survey, but do not ask any question yet.", 'settings' => json_encode(array( 'element' => '#cke_description', - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'placement' => 'top', 'redirect' => false, )) @@ -972,7 +1606,7 @@ function upgrade333($oDB){ 'content' => "We will be creating a question group and a question in this tutorial. There is need to automatically create it.", 'settings' => json_encode(array( 'element' => '.bootstrap-switch-id-createsample', - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'redirect' => false, )) ), @@ -984,7 +1618,7 @@ function upgrade333($oDB){ 'settings' => json_encode(array( 'element' => '#cke_welcome', 'placement' => 'top', - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'redirect' => false, )) ), @@ -995,7 +1629,7 @@ function upgrade333($oDB){ 'content' => "This message is shown at the end of your survey to every participant. It's a great way to say thank you or give some links or hints where to go next.", 'settings' => json_encode(array( 'element' => '#cke_endtext', - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'placement' => 'top', 'redirect' => false, )) @@ -1007,7 +1641,7 @@ function upgrade333($oDB){ 'content' => "You may play around with more settings, but let's save and start adding questions to your survey now. Just click on 'Save'.", 'settings' => json_encode(array( 'element' => '#save-form-button', - 'path' => '/admin/survey/sa/newsurvey', + 'path' => ['/admin/survey/sa/newsurvey'], 'placement' => 'bottom', 'reflex' => true, 'redirect' => false, diff --git a/application/views/admin/survey/Question/editQuestion_view.php b/application/views/admin/survey/Question/editQuestion_view.php index a741db3268d..5c7cdf1de9b 100644 --- a/application/views/admin/survey/Question/editQuestion_view.php +++ b/application/views/admin/survey/Question/editQuestion_view.php @@ -306,7 +306,7 @@ ?> -