-
Notifications
You must be signed in to change notification settings - Fork 15
/
corechanges.patch
204 lines (182 loc) · 7.36 KB
/
corechanges.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
diff --git a/course/editsection.php b/course/editsection.php
index e9a065b..50b461e 100644
--- a/course/editsection.php
+++ b/course/editsection.php
@@ -47,6 +47,11 @@ $mform->set_data($section); // set current value
/// If data submitted, then process and store.
if ($mform->is_cancelled()){
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
redirect($CFG->wwwroot.'/course/view.php?id='.$course->id);
} else if ($data = $mform->get_data()) {
@@ -61,6 +66,11 @@ if ($mform->is_cancelled()){
$DB->update_record('course_sections', $section);
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
$PAGE->navigation->clear_cache();
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
redirect("view.php?id=$course->id");
}
diff --git a/course/editsection_form.php b/course/editsection_form.php
index ab26049..3fc4c81 100644
--- a/course/editsection_form.php
+++ b/course/editsection_form.php
@@ -14,6 +14,11 @@ class editsection_form extends moodleform {
$mform = $this->_form;
$course = $this->_customdata['course'];
+// ou-specific begins #169
+ $mform->addElement('hidden', 'returnurl');
+ $mform->setDefault('returnurl', optional_param('returnurl', '', PARAM_URL));
+
+// ou-specific ends #169
$mform->addElement('checkbox', 'usedefaultname', get_string('sectionusedefaultname'));
$mform->setDefault('usedefaultname', true);
diff --git a/course/mod.php b/course/mod.php
index 062760f..c773266 100644
--- a/course/mod.php
+++ b/course/mod.php
@@ -72,14 +72,32 @@ if (!empty($add)) {
$type = optional_param('type', '', PARAM_ALPHA);
$returntomod = optional_param('return', 0, PARAM_BOOL);
+// ou-specific begins #169
+/*
redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id§ion=$section&return=$returntomod");
+*/
+ $returnurl = optional_param('returnurl', '', PARAM_URL);
+ if ($returnurl) {
+ $returnurl = '&returnurl=' . urlencode($returnurl);
+ }
+ redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id§ion=$section&return=$returntomod$returnurl");
+// ou-specific ends #169
} else if (!empty($update)) {
if (!$cm = get_coursemodule_from_id('', $update, 0, true)) {
print_error('invalidcoursemodule');
}
$returntomod = optional_param('return', 0, PARAM_BOOL);
+// ou-specific begins #169
+/*
redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod");
+*/
+ $returnurl = optional_param('returnurl', '', PARAM_URL);
+ if ($returnurl) {
+ $returnurl = '&returnurl=' . urlencode($returnurl);
+ }
+ redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod$returnurl");
+// ou-specific ends #169
} else if (!empty($delete)) {
if (!$cm = get_coursemodule_from_id('', $delete, 0, true)) {
@@ -95,11 +113,17 @@ if (!empty($add)) {
require_capability('moodle/course:manageactivities', $context);
$return = "$CFG->wwwroot/course/view.php?id=$cm->course#section-$cm->sectionnum";
+// ou-specific begins #169
+ $return = optional_param('returnurl', $return, PARAM_URL);
+// ou-specific ends #169
if (!$confirm or !confirm_sesskey()) {
$fullmodulename = get_string('modulename', $cm->modname);
$optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey());
+// ou-specific begins #169
+ $optionsyes['returnurl'] = $return;
+// ou-specific ends #169
$optionsno = array('id'=>$cm->course);
$strdeletecheck = get_string('deletecheck', '', $fullmodulename);
@@ -201,6 +225,12 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
rebuild_course_cache($section->course);
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
+
if (SITEID == $section->course) {
redirect($CFG->wwwroot);
} else {
@@ -227,6 +257,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
rebuild_course_cache($cm->course);
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
@@ -246,6 +281,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
rebuild_course_cache($cm->course);
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
@@ -274,6 +314,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
rebuild_course_cache($cm->course);
}
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
@@ -294,6 +339,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
rebuild_course_cache($cm->course);
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
diff --git a/course/modedit.php b/course/modedit.php
index 4b5c615..3f0bbe0 100644
--- a/course/modedit.php
+++ b/course/modedit.php
@@ -223,6 +223,11 @@ if ($mform->is_cancelled()) {
if ($return && !empty($cm->id)) {
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
} else {
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
redirect("$CFG->wwwroot/course/view.php?id=$course->id#section-".$cw->section);
}
} else if ($fromform = $mform->get_data()) {
@@ -568,6 +573,11 @@ if ($mform->is_cancelled()) {
if (isset($fromform->submitbutton)) {
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
} else {
+// ou-specific begins #169
+ if ($returnurl = optional_param('returnurl', '', PARAM_URL)) {
+ redirect($returnurl);
+ }
+// ou-specific ends #169
redirect("$CFG->wwwroot/course/view.php?id=$course->id");
}
exit;
diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php
index 0482168..ea21242 100644
--- a/course/moodleform_mod.php
+++ b/course/moodleform_mod.php
@@ -337,6 +337,11 @@ abstract class moodleform_mod extends moodleform {
global $COURSE, $CFG, $DB;
$mform =& $this->_form;
+// ou-specific begins #169
+ $mform->addElement('hidden', 'returnurl');
+ $mform->setDefault('returnurl', optional_param('returnurl', '', PARAM_URL));
+
+// ou-specific ends #169
$this->_outcomesused = false;
if ($this->_features->outcomes) {
if ($outcomes = grade_outcome::fetch_all_available($COURSE->id)) {