diff --git a/.upgradenotes/MDL-81742-2024061108544588.yml b/.upgradenotes/MDL-81742-2024061108544588.yml new file mode 100644 index 00000000000..7fcb68c7afa --- /dev/null +++ b/.upgradenotes/MDL-81742-2024061108544588.yml @@ -0,0 +1,7 @@ +issueNumber: MDL-81742 +notes: + mod_feedback: + - message: >- + The method `mod_feedback\output\renderer::create_template_form()` has + been deprecated. It is not used anymore. + type: deprecated diff --git a/lib/classes/output/icon_system_fontawesome.php b/lib/classes/output/icon_system_fontawesome.php index e5d169047cf..767949bd803 100644 --- a/lib/classes/output/icon_system_fontawesome.php +++ b/lib/classes/output/icon_system_fontawesome.php @@ -246,6 +246,9 @@ class icon_system_fontawesome extends icon_system_font { 'core:i/link' => 'fa-link', 'core:i/externallink' => 'fa-external-link', 'core:i/files' => 'fa-file', + 'core:i/file_plus' => 'fa-file-circle-plus', + 'core:i/file_export' => 'fa-file-export', + 'core:i/file_import' => 'fa-file-import', 'core:i/filter' => 'fa-filter', 'core:i/flagged' => 'fa-flag', 'core:i/folder' => 'fa-folder', diff --git a/mod/feedback/classes/output/edit_action_bar.php b/mod/feedback/classes/output/edit_action_bar.php index c2467358c4b..a3a9bbc4472 100644 --- a/mod/feedback/classes/output/edit_action_bar.php +++ b/mod/feedback/classes/output/edit_action_bar.php @@ -17,9 +17,9 @@ namespace mod_feedback\output; use moodle_url; -use action_link; -use single_select; -use url_select; +use action_menu; +use action_menu_link; +use pix_icon; /** * Class actionbar - Display the action bar @@ -53,48 +53,83 @@ class edit_action_bar extends base_action_bar { * @return array */ public function get_items(): array { - global $DB; + if (!has_capability('mod/feedback:edititems', $this->context)) { + return []; + } + return [ + 'addselect' => $this->get_add_question_menu(), + 'actionsselect' => $this->get_edit_actions_menu(), + ]; + } - $url = new moodle_url('/mod/feedback/view.php', ['id' => $this->cmid]); - $items['left'][]['actionlink'] = new action_link($url, get_string('back'), null, ['class' => 'btn btn-secondary']); - - if (has_capability('mod/feedback:edititems', $this->context)) { - $editurl = new moodle_url('/mod/feedback/edit.php', $this->urlparams); - $templateurl = new moodle_url('/mod/feedback/manage_templates.php', $this->urlparams); - $importurl = new moodle_url('/mod/feedback/import.php', $this->urlparams); - - $options = [ - $editurl->out(false) => get_string('add_item', 'feedback'), - $templateurl->out(false) => get_string('using_templates', 'feedback'), - $importurl->out(false) => get_string('import_questions', 'feedback') - ]; - - $selected = $this->currenturl; - // Template pages can have sub pages, so match these. - if ($this->currenturl->compare(new moodle_url('/mod/feedback/use_templ.php'), URL_MATCH_BASE)) { - $selected = $templateurl; - } - - $items['left'][]['urlselect'] = new url_select($options, $selected->out(false), null); - - $viewquestions = $editurl->compare($this->currenturl); - if ($viewquestions) { - $select = new single_select(new moodle_url('/mod/feedback/edit_item.php', - ['cmid' => $this->cmid, 'position' => $this->lastposition, 'sesskey' => sesskey()]), - 'typ', feedback_load_feedback_items_options()); - $items['left'][]['singleselect'] = $select; - - if ($DB->record_exists('feedback_item', ['feedback' => $this->feedback->id])) { - $items['export'] = new action_link( - new moodle_url('/mod/feedback/export.php', $this->urlparams + ['action' => 'exportfile']), - get_string('export_questions', 'feedback'), - null, - ['class' => 'btn btn-secondary'], - ); - } - } + /** + * Return the add question menu + * + * @return action_menu + */ + private function get_add_question_menu(): action_menu { + $addselect = new action_menu(); + $addselect->set_menu_trigger(get_string('add_item', 'mod_feedback'), 'btn btn-primary'); + $addselect->set_menu_left(); + $addselectparams = ['cmid' => $this->cmid, 'position' => $this->lastposition, 'sesskey' => sesskey()]; + foreach (feedback_load_feedback_items_options() as $key => $value) { + $addselect->add(new action_menu_link( + new moodle_url('/mod/feedback/edit_item.php', $addselectparams + ['typ' => $key]), + null, + $value, + false, + )); } - return $items; + return $addselect; + } + + /** + * Return the edit actions menu + * + * @return action_menu + */ + private function get_edit_actions_menu(): action_menu { + global $DB, $PAGE; + + $actionsselect = new action_menu(); + $actionsselect->set_menu_trigger(get_string('actions'), 'btn btn-outline-primary'); + + // Export. + if ($DB->record_exists('feedback_item', ['feedback' => $this->feedback->id])) { + $exporturl = new moodle_url('/mod/feedback/export.php', $this->urlparams + ['action' => 'exportfile']); + $actionsselect->add(new action_menu_link( + $exporturl, + new pix_icon('i/file_export', get_string('export_questions', 'feedback')), + get_string('export_questions', 'feedback'), + false, + )); + } + + // Import. + $importurl = new moodle_url('/mod/feedback/import.php', $this->urlparams); + $actionsselect->add(new action_menu_link( + $importurl, + new pix_icon('i/file_import', get_string('import_questions', 'feedback')), + get_string('import_questions', 'feedback'), + false, + )); + + // Save as template. + $cancreatetemplates = has_any_capability([ + 'mod/feedback:createprivatetemplate', + 'mod/feedback:createpublictemplate'], \context_module::instance($this->cmid)); + if ($cancreatetemplates) { + $PAGE->requires->js_call_amd('mod_feedback/createtemplate', 'init'); + $actionsselect->add(new action_menu_link( + new moodle_url('#'), + new pix_icon('i/file_plus', get_string('save_as_new_template', 'feedback')), + get_string('save_as_new_template', 'feedback'), + false, + ['data-action' => 'createtemplate', 'data-dataid' => $this->cmid], + )); + } + + return $actionsselect; } } diff --git a/mod/feedback/classes/output/renderer.php b/mod/feedback/classes/output/renderer.php index 5808cfaa511..fd18c83af75 100644 --- a/mod/feedback/classes/output/renderer.php +++ b/mod/feedback/classes/output/renderer.php @@ -43,8 +43,13 @@ class renderer extends plugin_renderer_base { * * @param int $id * @return bool|string + * @deprecated since 4.5 + * @todo MDL-82164 This will be deleted in Moodle 6.0. */ + #[\core\attribute\deprecated(replacement: null, since: '4.5')] public function create_template_form(int $id) { + \core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]); + return $this->render_from_template('mod_feedback/create_template', ['id' => $id]); } } diff --git a/mod/feedback/edit.php b/mod/feedback/edit.php index cfee4484bdf..784f60e5999 100644 --- a/mod/feedback/edit.php +++ b/mod/feedback/edit.php @@ -63,13 +63,9 @@ if ($deleteitem) { redirect($url); } -// Process the create template form. -$cancreatetemplates = has_capability('mod/feedback:createprivatetemplate', $context) || - has_capability('mod/feedback:createpublictemplate', $context); - //Get the feedbackitems $lastposition = 0; -$feedbackitems = $DB->get_records('feedback_item', array('feedback'=>$feedback->id), 'position'); +$feedbackitems = $DB->get_records('feedback_item', ['feedback' => $feedback->id], 'position'); if (is_array($feedbackitems)) { $feedbackitems = array_values($feedbackitems); if (count($feedbackitems) > 0) { @@ -93,16 +89,21 @@ $PAGE->add_body_class('limitedwidth'); //Adding the javascript module for the items dragdrop. if (count($feedbackitems) > 1) { - $PAGE->requires->strings_for_js(array( - 'pluginname', - 'move_item', - 'position', - ), 'feedback'); - $PAGE->requires->yui_module('moodle-mod_feedback-dragdrop', 'M.mod_feedback.init_dragdrop', - array(array('cmid' => $cm->id))); + $PAGE->requires->strings_for_js([ + 'pluginname', + 'move_item', + 'position', + ], 'feedback'); + $PAGE->requires->yui_module( + 'moodle-mod_feedback-dragdrop', + 'M.mod_feedback.init_dragdrop', + [['cmid' => $cm->id]] + ); } echo $OUTPUT->header(); +echo $OUTPUT->heading(get_string('edit_items', 'mod_feedback'), 3); + /** @var \mod_feedback\output\renderer $renderer */ $renderer = $PAGE->get_renderer('mod_feedback'); echo $renderer->main_action_bar($actionbar); @@ -112,8 +113,4 @@ echo '
'; // The container for the dragging area. $form->display(); echo '
'; -if ($cancreatetemplates) { - echo $renderer->create_template_form($id); -} - echo $OUTPUT->footer(); diff --git a/mod/feedback/import.php b/mod/feedback/import.php index ff22f90cf4f..158e200b40e 100644 --- a/mod/feedback/import.php +++ b/mod/feedback/import.php @@ -31,7 +31,7 @@ $id = required_param('id', PARAM_INT); $choosefile = optional_param('choosefile', false, PARAM_PATH); $action = optional_param('action', false, PARAM_ALPHA); -$url = new moodle_url('/mod/feedback/import.php', array('id'=>$id)); +$url = new moodle_url('/mod/feedback/import.php', ['id' => $id]); if ($choosefile !== false) { $url->param('choosefile', $choosefile); } @@ -45,11 +45,11 @@ if (! $cm = get_coursemodule_from_id('feedback', $id)) { throw new \moodle_exception('invalidcoursemodule'); } -if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { +if (! $course = $DB->get_record("course", ["id" => $cm->course])) { throw new \moodle_exception('coursemisconf'); } -if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { +if (! $feedback = $DB->get_record("feedback", ["id" => $cm->instance])) { throw new \moodle_exception('invalidcoursemodule'); } @@ -58,14 +58,15 @@ $context = context_module::instance($cm->id); require_login($course, true, $cm); require_capability('mod/feedback:edititems', $context); -$actionbar = new \mod_feedback\output\edit_action_bar($cm->id, $url); $mform = new feedback_import_form(); -$newformdata = array('id'=>$id, - 'deleteolditems'=>'1', - 'action'=>'choosefile', - 'confirmadd'=>'1', - 'do_show'=>'templates'); +$newformdata = [ + 'id' => $id, + 'deleteolditems' => '1', + 'action' => 'choosefile', + 'confirmadd' => '1', + 'do_show' => 'templates', +]; $mform->set_data($newformdata); $formdata = $mform->get_data(); @@ -100,18 +101,17 @@ $PAGE->activityheader->set_attrs([ "hidecompletion" => true, "description" => '' ]); +$PAGE->add_body_class('limitedwidth'); + echo $OUTPUT->header(); /** @var \mod_feedback\output\renderer $renderer */ $renderer = $PAGE->get_renderer('mod_feedback'); -echo $renderer->main_action_bar($actionbar); /// Print the main part of the page /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// -if (!$PAGE->has_secondary_navigation()) { - echo $OUTPUT->heading(get_string('import_questions', 'feedback'), 3); -} +echo $OUTPUT->heading(get_string('import_questions', 'feedback'), 3); if (isset($importerror->msg) AND is_array($importerror->msg)) { echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter'); @@ -151,7 +151,7 @@ function feedback_import_loaded_data(&$data, $feedbackid) { $error = new stdClass(); $error->stat = true; - $error->msg = array(); + $error->msg = []; if (!is_array($data)) { $error->msg[] = get_string('data_is_not_an_array', 'feedback'); @@ -164,13 +164,13 @@ function feedback_import_loaded_data(&$data, $feedbackid) { $position = 0; } else { //items will be add to the end of the existing items - $position = $DB->count_records('feedback_item', array('feedback'=>$feedbackid)); + $position = $DB->count_records('feedback_item', ['feedback' => $feedbackid]); } - //depend items we are storing temporary in an mapping list array(new id => dependitem) - //we also store a mapping of all items array(oldid => newid) - $dependitemsmap = array(); - $itembackup = array(); + // Depend items we are storing temporary in an mapping list [new id => dependitem]. + // We also store a mapping of all items [oldid => newid]. + $dependitemsmap = []; + $itembackup = []; foreach ($data as $item) { $position++; //check the typ @@ -270,7 +270,7 @@ function feedback_import_loaded_data(&$data, $feedbackid) { } //remapping the dependency foreach ($dependitemsmap as $key => $dependitem) { - $newitem = $DB->get_record('feedback_item', array('id'=>$key)); + $newitem = $DB->get_record('feedback_item', ['id' => $key]); $newitem->dependitem = $itembackup[$newitem->dependitem]; $DB->update_record('feedback_item', $newitem); } diff --git a/mod/feedback/import_form.php b/mod/feedback/import_form.php index 1cc02995536..d4612182cf8 100644 --- a/mod/feedback/import_form.php +++ b/mod/feedback/import_form.php @@ -53,7 +53,7 @@ class feedback_import_form extends moodleform { $mform->addElement('radio', 'deleteolditems', '', $strnodeleteolditmes); // buttons - $this->add_action_buttons(false, get_string('save')); + $this->add_action_buttons(true, get_string('import')); } } diff --git a/mod/feedback/templates/main_action_menu.mustache b/mod/feedback/templates/main_action_menu.mustache index d51f9713f27..2a1032560c9 100644 --- a/mod/feedback/templates/main_action_menu.mustache +++ b/mod/feedback/templates/main_action_menu.mustache @@ -169,15 +169,20 @@ {{/singleselect}} {{/left}} + {{#addselect}} + + {{/addselect}} {{#usetemplate }} {{/usetemplate}} - {{#export}} + {{#actionsselect}} - {{/export}} + {{/actionsselect}} diff --git a/mod/feedback/tests/behat/behat_mod_feedback.php b/mod/feedback/tests/behat/behat_mod_feedback.php index 17f1302e762..b1118274a80 100644 --- a/mod/feedback/tests/behat/behat_mod_feedback.php +++ b/mod/feedback/tests/behat/behat_mod_feedback.php @@ -50,7 +50,8 @@ class behat_mod_feedback extends behat_base { public function i_add_question_to_the_feedback_with($questiontype, TableNode $questiondata) { $questiontype = $this->escape($questiontype); - $this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, 'typ')); + $this->execute('behat_general::i_click_on', [get_string('add_item', 'mod_feedback'), 'link']); + $this->execute('behat_general::i_click_on', [$questiontype, 'link']); // Wait again, for page to reloaded. $this->execute('behat_general::i_wait_to_be_redirected'); @@ -81,7 +82,8 @@ class behat_mod_feedback extends behat_base { public function i_add_a_page_break_to_the_feedback() { $questiontype = $this->escape(get_string('add_pagebreak', 'feedback')); - $this->execute('behat_forms::i_select_from_the_singleselect', array($questiontype, 'typ')); + $this->execute('behat_general::i_click_on', [get_string('add_item', 'mod_feedback'), 'link']); + $this->execute('behat_general::i_click_on', [$questiontype, 'link']); // Wait again, for page to reloaded. $this->execute('behat_general::i_wait_to_be_redirected'); diff --git a/mod/feedback/tests/behat/export_import.feature b/mod/feedback/tests/behat/export_import.feature index d417a4393b5..39bfde3e3b0 100644 --- a/mod/feedback/tests/behat/export_import.feature +++ b/mod/feedback/tests/behat/export_import.feature @@ -40,7 +40,7 @@ Feature: Exporting and importing feedbacks | Label | multichoice1 | | Multiple choice type | Multiple choice - single answer | | Multiple choice values | option a\noption b\noption c | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 2 | | Label | multichoice2 | @@ -68,7 +68,6 @@ Feature: Exporting and importing feedbacks | Label | shorttext | | Maximum characters accepted | 200 | Then following "Export questions" should export feedback identical to "mod/feedback/tests/fixtures/testexport.xml" - And I log out @javascript @_file_upload Scenario: Import feedback deleting old items @@ -78,10 +77,10 @@ Feature: Exporting and importing feedbacks | Question | Existing question | | Label | numeric | | Range to | 100 | - And I select "Import questions" from the "jump" singleselect + And I press "Actions" + And I choose "Import" in the open action menu And I upload "mod/feedback/tests/fixtures/testexport.xml" file to "File" filemanager - And I press "Save" - And I select "Add question" from the "jump" singleselect + And I press "Import" Then I should not see "Existing question" And I should see "this is an information question" And I should see "label text" @@ -101,11 +100,11 @@ Feature: Exporting and importing feedbacks | Question | Existing question | | Label | numeric | | Range to | 100 | - And I select "Import questions" from the "jump" singleselect + And I press "Actions" + And I choose "Import" in the open action menu And I set the field "Append new items" to "1" And I upload "mod/feedback/tests/fixtures/testexport.xml" file to "File" filemanager - And I press "Save" - And I select "Add question" from the "jump" singleselect + And I press "Import" Then I should see "Existing question" And "Existing question" "text" should appear before "this is an information question" "text" And I should see "this is an information question" diff --git a/mod/feedback/tests/behat/multichoice.feature b/mod/feedback/tests/behat/multichoice.feature index efb30b675d9..d71d3fb3860 100644 --- a/mod/feedback/tests/behat/multichoice.feature +++ b/mod/feedback/tests/behat/multichoice.feature @@ -33,7 +33,7 @@ Feature: Testing multichoice questions in feedback | Multiple choice values | option a\noption b\noption c | And I add a "Text and media area" question to the feedback with: | Contents | this is the first page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 2 | | Label | multichoice2 | @@ -42,7 +42,7 @@ Feature: Testing multichoice questions in feedback | Required | 1 | And I add a "Text and media area" question to the feedback with: | Contents | this is the second page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 3 | | Label | multichoice3 | @@ -161,7 +161,6 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option a" "table_row" And I should not see "%" in the "option b" "table_row" And I should not see "%" in the "option c" "table_row" - And I log out @javascript Scenario: Non-rated multiple-answers multiple choice questions in feedback @@ -173,7 +172,7 @@ Feature: Testing multichoice questions in feedback | Multiple choice values | option a\noption b\noption c | And I add a "Text and media area" question to the feedback with: | Contents | this is the first page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 2 | | Label | multichoice2 | @@ -182,7 +181,7 @@ Feature: Testing multichoice questions in feedback | Required | 1 | And I add a "Text and media area" question to the feedback with: | Contents | this is the second page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 3 | | Label | multichoice3 | @@ -301,7 +300,6 @@ Feature: Testing multichoice questions in feedback And I should see "1 (100.00 %)" in the "option a" "table_row" And I should see "1 (100.00 %)" in the "option b" "table_row" And I should not see "%" in the "option c" "table_row" - And I log out @javascript Scenario: Non-rated single-answer dropdown multiple choice questions in feedback @@ -312,7 +310,7 @@ Feature: Testing multichoice questions in feedback | Multiple choice values | option a\noption b\noption c | And I add a "Text and media area" question to the feedback with: | Contents | this is the first page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 2 | | Label | multichoice2 | @@ -321,7 +319,7 @@ Feature: Testing multichoice questions in feedback | Required | 1 | And I add a "Text and media area" question to the feedback with: | Contents | this is the second page of the feedback | - And I select "Add a page break" from the "typ" singleselect + And I add a page break to the feedback And I add a "Multiple choice" question to the feedback with: | Question | this is a multiple choice 3 | | Label | multichoice3 | diff --git a/mod/feedback/tests/behat/templates.feature b/mod/feedback/tests/behat/templates.feature index e8633d9b30c..f6d0cb87918 100644 --- a/mod/feedback/tests/behat/templates.feature +++ b/mod/feedback/tests/behat/templates.feature @@ -38,25 +38,25 @@ Feature: Saving, using and deleting feedback templates Scenario: Teacher can save template and re-use it in the same course only # Go to feedback templates and make sure none exist yet When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher - And I navigate to "Questions" in current page administration - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration Then I should see "No templates available yet" And "Use a template" "field" should not exist And "Public" "field" should not exist - And I select "Add question" from the "jump" singleselect # Save as a course template - And I press "Save as new template" + And I navigate to "Feedback" in current page administration + And I click on "Edit questions" "link" in the "[role=main]" "css_element" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I should see "Save as new template" in the ".modal-title" "css_element" And I should see "Name" in the ".modal-body" "css_element" And I set the field "Name" to "My first template" And I click on "Save" "button" in the ".modal-dialog" "css_element" And I should see "Template saved" - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I should see "My first template" # Create a feedback from this template in the same course And I am on the "Another feedback in course 1" "feedback activity" page - And I navigate to "Questions" in current page administration - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I follow "My first template" And I should see "this is a multiple choice 1" And I press "Use this template" @@ -64,22 +64,22 @@ Feature: Saving, using and deleting feedback templates And I should see "this is a multiple choice 1" # Make sure this template is not available in another course And I am on the "Learning experience course 2" "feedback activity" page - And I navigate to "Questions" in current page administration - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I should see "No templates available yet" - And I log out @javascript Scenario: Teacher can append template to existing questions or remove them # Save feedback as a course template When I am on the "Learning experience course 1" "feedback activity" page logged in as teacher And I navigate to "Questions" in current page administration - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I should see "Save as new template" in the ".modal-title" "css_element" And I should see "Name" in the ".modal-body" "css_element" And I set the field "Name" to "My first template" And I click on "Save" "button" in the ".modal-dialog" "css_element" - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu # Add questions to another feedback And I am on the "Another feedback in course 1" "feedback activity" page And I navigate to "Questions" in current page administration @@ -89,14 +89,14 @@ Feature: Saving, using and deleting feedback templates | Multiple choice type | Multiple choice - single answer | | Multiple choice values | Maths\bScience\nEnglish\nOther | # Import template appending items - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I follow "My first template" And I press "Use this template" And I set the field "Append new items" to "1" And I click on "Save" "button" in the ".modal-dialog" "css_element" Then "What is your favourite subject" "text" should appear before "this is a multiple choice 1" "text" # Import template replacing items - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I follow "My first template" And I press "Use this template" And I set the field "Delete old items" to "1" @@ -109,81 +109,78 @@ Feature: Saving, using and deleting feedback templates Scenario: Manager can save template as public and it will be available in any course When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I navigate to "Questions" in current page administration - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I set the field "Name" to "My first template" And I set the field "Public" to "1" And I click on "Save" "button" in the ".modal-dialog" "css_element" And I log out And I am on the "Learning experience course 2" "feedback activity" page logged in as teacher - And I navigate to "Questions" in current page administration - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I follow "My first template" And I should see "this is a multiple choice 1" And I press "Use this template" And I set the field "Delete old items" to "1" And I click on "Save" "button" in the ".modal-dialog" "css_element" Then I should see "this is a multiple choice 1" - And I log out @javascript Scenario: Teacher can delete course templates but can not delete public templates # Save feedback as both public and course template When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I navigate to "Questions" in current page administration - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I set the field "Name" to "My public template" And I set the field "Public" to "1" And I click on "Save" "button" in the ".modal-dialog" "css_element" - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I set the field "Name" to "My course template" And I click on "Save" "button" in the ".modal-dialog" "css_element" And I log out # Login as teacher and try to delete templates And I am on the "Another feedback in course 1" "feedback activity" page logged in as teacher - And I navigate to "Questions" in current page administration - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration And I follow "My public template" Then I should not see "Delete" And I click on "Back" "link" in the ".tertiary-navigation" "css_element" And "My course template" "text" should exist in the ".coursetemplates" "css_element" - And I follow "My course template" - And I click on "Delete" "link" + And I click on "Delete template" "link" in the "My course template" "table_row" And I click on "Yes" "button" And I should see "Template deleted" And "My course template" "text" should not exist in the ".coursetemplates" "css_element" And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element" - And I log out @javascript Scenario: Manager can delete both course and public templates # Save feedback as both public and course template When I am on the "Learning experience course 1" "feedback activity" page logged in as manager And I navigate to "Questions" in current page administration - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I set the field "Name" to "My public template" And I set the field "Public" to "1" And I click on "Save" "button" in the ".modal-dialog" "css_element" - And I press "Save as new template" + And I press "Actions" + And I choose "Save as new template" in the open action menu And I set the field "Name" to "My course template" And I click on "Save" "button" in the ".modal-dialog" "css_element" # Delete course template - And I select "Use a template" from the "jump" singleselect + And I navigate to "Templates" in current page administration Then "My public template" "text" should exist in the ".publictemplates" "css_element" And "My course template" "text" should exist in the ".coursetemplates" "css_element" - And I follow "My course template" - And I click on "Delete" "link" + And I click on "Delete template" "link" in the "My course template" "table_row" And I should see "Are you sure you want to delete this template?" And I press "Yes" And I should see "Template deleted" And "My course template" "text" should not exist in the ".coursetemplates" "css_element" And "No templates available yet" "text" should exist in the ".coursetemplates" "css_element" And "My public template" "text" should exist in the ".publictemplates" "css_element" - And I follow "My public template" - And I click on "Delete" "link" + And I click on "Delete template" "link" in the "My public template" "table_row" And I should see "Are you sure you want to delete this template?" And I press "Yes" And I should see "Template deleted" And "My public template" "text" should not exist in the ".publictemplates" "css_element" And "No templates available yet" "text" should exist in the ".publictemplates" "css_element" And I should see "No templates available yet" - And I log out diff --git a/pix/i/file_export.svg b/pix/i/file_export.svg new file mode 100644 index 00000000000..3887343688a --- /dev/null +++ b/pix/i/file_export.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pix/i/file_import.svg b/pix/i/file_import.svg new file mode 100644 index 00000000000..30a11995d2d --- /dev/null +++ b/pix/i/file_import.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pix/i/file_plus.svg b/pix/i/file_plus.svg new file mode 100644 index 00000000000..6b073bef0d3 --- /dev/null +++ b/pix/i/file_plus.svg @@ -0,0 +1 @@ + \ No newline at end of file