From 794cc7e1cf5ba5311bac27bb5d33d8ee6539fb47 Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Sun, 18 Sep 2011 13:22:35 +0700 Subject: [PATCH 01/52] MDL-27919 Fixes 'undefined' message and similar problems when selecting a recent file, server file or when renaming a file being uploaded with the same name as a previous one. --- repository/filepicker.js | 6 ++++-- repository/repository_ajax.php | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/repository/filepicker.js b/repository/filepicker.js index a5cfc3d5477..cf18f7fa1dd 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -222,14 +222,16 @@ M.core_filepicker.init = function(Y, options) { } this.cancel(); scope.hide(); - data.client_id = client_id; var formcallback_scope = null; if (scope.options.magicscope) { formcallback_scope = scope.options.magicscope; } else { formcallback_scope = scope; } - scope.options.formcallback.apply(formcallback_scope, [data]); + var fileinfo = {'client_id':client_id, + 'url':data.newfile.url, + 'file':data.newfile.filename}; + scope.options.formcallback.apply(formcallback_scope, [fileinfo]); } var handleCancel = function() { // Delete tmp file diff --git a/repository/repository_ajax.php b/repository/repository_ajax.php index a954ee6c593..6dc62474e50 100644 --- a/repository/repository_ajax.php +++ b/repository/repository_ajax.php @@ -195,7 +195,7 @@ switch ($action) { // use external link $link = $repo->get_link($source); $info = array(); - $info['filename'] = $saveas_filename; + $info['file'] = $saveas_filename; $info['type'] = 'link'; $info['url'] = $link; echo json_encode($info); @@ -206,6 +206,9 @@ switch ($action) { // (local, user, coursefiles, recent) if ($repo->has_moodle_files()) { $fileinfo = $repo->copy_to_area($source, $itemid, $saveas_path, $saveas_filename); + if (!isset($fileinfo['event'])) { + $fileinfo['file'] = $fileinfo['title']; + } echo json_encode($fileinfo); die; } @@ -261,7 +264,8 @@ switch ($action) { $newfilepath = required_param('newfilepath', PARAM_PATH); $newfilename = required_param('newfilename', PARAM_FILE); - echo json_encode(repository::overwrite_existing_draftfile($itemid, $filepath, $filename, $newfilepath, $newfilename)); + $info = repository::overwrite_existing_draftfile($itemid, $filepath, $filename, $newfilepath, $newfilename); + echo json_encode($info); break; case 'deletetmpfile': From 913b3cb30c15b3cb2eb485a80f3edd35033b0c9c Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Sun, 18 Sep 2011 13:57:09 +0700 Subject: [PATCH 02/52] MDL-27919 also adding a callback to the filepicker when a file is overwritten but a file with the same name. This is not necessary in most cases but is instant and some code may expect a call to the function whether the url and / or file name has changed or not so it can update itself when the file changes. --- repository/filepicker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repository/filepicker.js b/repository/filepicker.js index cf18f7fa1dd..ff8a65c8bc2 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -211,6 +211,11 @@ M.core_filepicker.init = function(Y, options) { if (scope.options.editor_target && scope.options.env == 'editor') { scope.options.editor_target.value = data.existingfile.url; scope.options.editor_target.onchange(); + } else { + var fileinfo = {'client_id':client_id, + 'url':data.existingfile.url, + 'file':data.existingfile.filename}; + scope.options.formcallback.apply(scope, [fileinfo]); } } }, true); From 1ae299f5f3bb79d4e45726baec0afce746cd03a1 Mon Sep 17 00:00:00 2001 From: Jamie Pratt Date: Wed, 21 Sep 2011 13:15:23 +0700 Subject: [PATCH 03/52] MDL-27919 Fixed a regression where I was seeing that after choosing "Overwrite" in a filemanager form component when subsequently trying to add another file the file picker would then immediately close upon opening. --- repository/filepicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/filepicker.js b/repository/filepicker.js index ff8a65c8bc2..82f60b7c1b5 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -211,7 +211,7 @@ M.core_filepicker.init = function(Y, options) { if (scope.options.editor_target && scope.options.env == 'editor') { scope.options.editor_target.value = data.existingfile.url; scope.options.editor_target.onchange(); - } else { + } else if (scope.options.env === 'filepicker') { var fileinfo = {'client_id':client_id, 'url':data.existingfile.url, 'file':data.existingfile.filename}; From 3b3b8c6b0b065aefca802087e9da71c8c5f7d2bb Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Mon, 24 Oct 2011 12:31:16 +0100 Subject: [PATCH 04/52] MDL-29898: Fix documentation for CLI DB only installer --- admin/cli/install_database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/cli/install_database.php b/admin/cli/install_database.php index 44412eca4bb..593fdc2aad9 100644 --- a/admin/cli/install_database.php +++ b/admin/cli/install_database.php @@ -46,8 +46,8 @@ Options: --adminuser=USERNAME Username for the moodle admin account. Default is admin. --adminpass=PASSWORD Password for the moodle admin account. --agree-license Indicates agreement with software license. ---fullname Name of the site ---shortname Name of the site +--fullname=STRING Name of the site +--shortname=STRING Name of the site -h, --help Print out this help Example: From da69510f2a8134280b8b395139dc0a84aebe72b4 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 26 Oct 2011 10:55:31 +1300 Subject: [PATCH 05/52] MDL-28559 - hide send for marking button from people that are enrolled but don't have capability to submit files - displays the same way as teachers/admins - keeps ability to display previously submitted files if they exist --- .../type/upload/assignment.class.php | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index a7115700cc4..c1d4ffda57e 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -44,6 +44,7 @@ class assignment_upload extends assignment_base { global $USER, $OUTPUT; require_capability('mod/assignment:view', $this->context); + $cansubmit = has_capability('mod/assignment:submit', $this->context); add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id); @@ -67,35 +68,34 @@ class assignment_upload extends assignment_base { } else { $filecount = 0; } + if ($cansubmit or !empty($filecount)) { //if a user has submitted files using a previous role we should still show the files + $this->view_feedback(); - $this->view_feedback(); - - if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) { - echo $OUTPUT->heading(get_string('submission', 'assignment'), 3); - } else { - echo $OUTPUT->heading(get_string('submissiondraft', 'assignment'), 3); - } - - if ($filecount and $submission) { - echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter', 'userfiles'); - } else { - if (!$this->isopen() or $this->is_finalized($submission)) { - echo $OUTPUT->box(get_string('nofiles', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); + if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) { + echo $OUTPUT->heading(get_string('submission', 'assignment'), 3); } else { - echo $OUTPUT->box(get_string('nofilesyet', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); + echo $OUTPUT->heading(get_string('submissiondraft', 'assignment'), 3); + } + + if ($filecount and $submission) { + echo $OUTPUT->box($this->print_user_files($USER->id, true), 'generalbox boxaligncenter', 'userfiles'); + } else { + if (!$this->isopen() or $this->is_finalized($submission)) { + echo $OUTPUT->box(get_string('nofiles', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); + } else { + echo $OUTPUT->box(get_string('nofilesyet', 'assignment'), 'generalbox boxaligncenter nofiles', 'userfiles'); + } } - } - if (has_capability('mod/assignment:submit', $this->context)) { $this->view_upload_form(); - } - if ($this->notes_allowed()) { - echo $OUTPUT->heading(get_string('notes', 'assignment'), 3); - $this->view_notes(); - } + if ($this->notes_allowed()) { + echo $OUTPUT->heading(get_string('notes', 'assignment'), 3); + $this->view_notes(); + } - $this->view_final_submission(); + $this->view_final_submission(); + } } $this->view_footer(); } From 4ac9f47051f9d1055132fd5b0676342733577866 Mon Sep 17 00:00:00 2001 From: Henning Bostelmann Date: Sat, 22 Oct 2011 12:19:18 +0100 Subject: [PATCH 06/52] MDL-29810 Assignment grading: don't include teachers in list of students --- mod/assignment/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index c4a390c7973..727b64e9ed0 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -959,7 +959,7 @@ class assignment_base { /// Get all ppl that can submit assignments $currentgroup = groups_get_activity_group($cm); - $users = get_enrolled_users($context, 'mod/assignment:view', $currentgroup, 'u.id'); + $users = get_enrolled_users($context, 'mod/assignment:submit', $currentgroup, 'u.id'); if ($users) { $users = array_keys($users); // if groupmembersonly used, remove users who are not in any group From 9c5bc7a58037799817495ab4f1dc558da548b3ce Mon Sep 17 00:00:00 2001 From: Andreas Grabs Date: Fri, 28 Oct 2011 00:30:42 +0200 Subject: [PATCH 07/52] MDL-29804 - Clean up Feedback modules coding style --- mod/feedback/README.txt | 3 +- mod/feedback/analysis.php | 75 +- mod/feedback/analysis_course.php | 107 +- mod/feedback/analysis_to_excel.php | 256 ++--- mod/feedback/backup/moodle1/lib.php | 1 - .../backup_feedback_activity_task.class.php | 3 +- .../moodle2/backup_feedback_settingslib.php | 1 - .../moodle2/backup_feedback_stepslib.php | 3 - .../restore_feedback_activity_task.class.php | 1 - .../moodle2/restore_feedback_stepslib.php | 1 - mod/feedback/choose_group_form.php | 87 +- mod/feedback/complete.php | 1016 +++++++++-------- mod/feedback/complete_guest.php | 861 +++++++------- mod/feedback/db/access.php | 15 + mod/feedback/db/install.php | 16 +- mod/feedback/db/install.xml | 2 +- mod/feedback/db/log.php | 1 - mod/feedback/db/messages.php | 1 - mod/feedback/db/upgrade.php | 136 ++- mod/feedback/delete_completed.php | 179 +-- mod/feedback/delete_completed_form.php | 39 +- mod/feedback/delete_item.php | 133 ++- mod/feedback/delete_item_form.php | 39 +- mod/feedback/delete_template.php | 68 +- mod/feedback/delete_template_form.php | 40 +- mod/feedback/edit.php | 411 ++++--- mod/feedback/edit_form.php | 128 ++- mod/feedback/edit_item.php | 41 +- mod/feedback/export.php | 306 ++--- mod/feedback/import.php | 527 ++++----- mod/feedback/import_form.php | 52 +- mod/feedback/index.php | 33 +- mod/feedback/item/captcha/captcha_form.php | 24 +- mod/feedback/item/captcha/lib.php | 150 ++- mod/feedback/item/captcha/print_captcha.php | 46 +- mod/feedback/item/feedback_item_class.php | 154 ++- .../item/feedback_item_form_class.php | 62 +- mod/feedback/item/info/info_form.php | 27 +- mod/feedback/item/info/lib.php | 235 ++-- mod/feedback/item/label/label_form.php | 29 +- mod/feedback/item/label/lib.php | 160 ++- mod/feedback/item/multichoice/lib.php | 526 +++++---- .../item/multichoice/multichoice_form.php | 70 +- mod/feedback/item/multichoicerated/lib.php | 401 ++++--- .../multichoicerated_form.php | 74 +- mod/feedback/item/numeric/lib.php | 468 +++++--- mod/feedback/item/numeric/numeric_form.php | 45 +- mod/feedback/item/textarea/lib.php | 247 ++-- mod/feedback/item/textarea/textarea_form.php | 30 +- mod/feedback/item/textfield/lib.php | 240 ++-- .../item/textfield/textfield_form.php | 30 +- mod/feedback/lang/en/feedback.php | 11 +- mod/feedback/lib.php | 847 ++++++++------ mod/feedback/mapcourse.php | 38 +- mod/feedback/mod_form.php | 143 ++- mod/feedback/print.php | 65 +- mod/feedback/settings.php | 21 +- mod/feedback/show_entries.php | 161 ++- mod/feedback/show_entries_anonym.php | 109 +- mod/feedback/show_nonrespondents.php | 513 +++++---- mod/feedback/styles.css | 2 +- mod/feedback/tabs.php | 143 ++- mod/feedback/unmapcourse.php | 14 + mod/feedback/use_templ.php | 61 +- mod/feedback/use_templ_form.php | 31 +- mod/feedback/version.php | 38 +- mod/feedback/view.php | 165 ++- 67 files changed, 5875 insertions(+), 4087 deletions(-) diff --git a/mod/feedback/README.txt b/mod/feedback/README.txt index 9a0c603be7e..c88bf751dcc 100644 --- a/mod/feedback/README.txt +++ b/mod/feedback/README.txt @@ -135,7 +135,8 @@ Now it only runs on Moodle 1.8 or later - roles are full implemented - now radiobuttons and checkboxes can be aligned horizontally or vertically - now you can insert pagebreakes -- a feedback what is switch to the next page is saved temporary. the user can cancel the completion and later continue at the last filled page. +- a feedback what is switch to the next page is saved temporary. + the user can cancel the completion and later continue at the last filled page. - now you can ex-/import feedbacks into/from a xml-file - course-reseting is supported diff --git a/mod/feedback/analysis.php b/mod/feedback/analysis.php index 78f46d52b39..da86ecf7f4a 100644 --- a/mod/feedback/analysis.php +++ b/mod/feedback/analysis.php @@ -1,4 +1,18 @@ . /** * shows an analysed view of feedback @@ -11,7 +25,6 @@ require_once("../../config.php"); require_once("lib.php"); -// $SESSION->feedback->current_tab = 'analysis'; $current_tab = 'analysis'; $id = required_param('id', PARAM_INT); //the POST dominated the GET @@ -39,23 +52,23 @@ if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { print_error('badcontext'); } -if($course->id == SITEID) { +if ($course->id == SITEID) { require_login($course->id, true); -}else{ +} else { require_login($course->id, true, $cm); } //check whether the given courseid exists -if($courseid AND $courseid != SITEID) { - if($course2 = $DB->get_record('course', array('id'=>$courseid))){ +if ($courseid AND $courseid != SITEID) { + if ($course2 = $DB->get_record('course', array('id'=>$courseid))) { require_course_login($course2); //this overwrites the object $course :-( $course = $DB->get_record("course", array("id"=>$cm->course)); // the workaround - }else { + } else { print_error('invalidcourseid'); } } -if( !( ((intval($feedback->publish_stats) == 1) AND +if ( !( ((intval($feedback->publish_stats) == 1) AND has_capability('mod/feedback:viewanalysepage', $context)) OR has_capability('mod/feedback:viewreports', $context))) { print_error('error'); @@ -65,30 +78,29 @@ if( !( ((intval($feedback->publish_stats) == 1) AND $strfeedbacks = get_string("modulenameplural", "feedback"); $strfeedback = get_string("modulename", "feedback"); -$PAGE->navbar->add(get_string('analysis','feedback')); +$PAGE->navbar->add(get_string('analysis', 'feedback')); $PAGE->set_heading(format_string($course->fullname)); $PAGE->set_title(format_string($feedback->name)); echo $OUTPUT->header(); /// print the tabs -include('tabs.php'); +require('tabs.php'); //print analysed items echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide'); //get the groupid -$groupselect = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/feedback/analysis.php?id=' . $cm->id.'&do_show=analysis', true); +$myurl = $CFG->wwwroot.'/mod/feedback/analysis.php?id='.$cm->id.'&do_show=analysis'; +$groupselect = groups_print_activity_menu($cm, $myurl, true); $mygroupid = groups_get_activity_group($cm); -if( has_capability('mod/feedback:viewreports', $context) ) { +if ( has_capability('mod/feedback:viewreports', $context) ) { echo isset($groupselect) ? $groupselect : ''; echo '
'; //button "export to excel" - //echo '
'; - // echo '