Merge branch 'MOODLE_30_STABLE' into install_30_STABLE

This commit is contained in:
AMOS bot
2015-11-20 00:04:20 +08:00
124 changed files with 749 additions and 246 deletions
+3
View File
@@ -54,5 +54,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -52,5 +52,8 @@ function xmldb_tool_log_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -42,5 +42,8 @@ function xmldb_logstore_database_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -120,5 +120,8 @@ function xmldb_logstore_standard_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -56,5 +56,8 @@ function xmldb_tool_monitor_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -74,5 +74,8 @@ function xmldb_auth_cas_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -64,5 +64,8 @@ function xmldb_auth_ldap_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -56,5 +56,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -56,5 +56,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -79,5 +79,8 @@ function xmldb_block_badges_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -79,5 +79,8 @@ function xmldb_block_calendar_month_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -79,5 +79,8 @@ function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -69,5 +69,8 @@ function xmldb_block_community_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -76,5 +76,8 @@ function xmldb_block_completionstatus_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -80,5 +80,8 @@ function xmldb_block_course_summary_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -56,5 +56,8 @@ function xmldb_block_html_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -81,5 +81,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -104,5 +104,8 @@ function xmldb_block_quiz_results_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -90,5 +90,8 @@ function xmldb_block_recent_activity_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -50,5 +50,8 @@ function xmldb_block_rss_client_upgrade($oldversion) {
upgrade_block_savepoint(true, 2015071700, 'rss_client');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -92,5 +92,8 @@ function xmldb_block_section_links_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -80,5 +80,8 @@ function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -81,5 +81,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -53,5 +53,8 @@ function xmldb_enrol_database_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -54,5 +54,8 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -63,6 +63,9 @@ function xmldb_enrol_guest_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -56,5 +56,8 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -72,6 +72,9 @@ function xmldb_enrol_manual_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2015091500, 'enrol', 'manual');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -55,5 +55,8 @@ function xmldb_enrol_mnet_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -70,5 +70,8 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -71,6 +71,9 @@ function xmldb_enrol_self_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -109,5 +109,8 @@ MathJax.Hub.Config({
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -78,5 +78,8 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -74,5 +74,8 @@ function xmldb_filter_tex_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -62,5 +62,8 @@ function xmldb_gradingform_rubric_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1
View File
@@ -36,6 +36,7 @@ if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
require_login(null, false);
$PAGE->set_course($course);
$context = context_course::instance($course->id);
$systemcontext = context_system::instance();
+3
View File
@@ -42,5 +42,8 @@ function xmldb_gradereport_user_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1 -1
View File
@@ -131,7 +131,7 @@ XPATH
[./descendant::*[self::h2][normalize-space(.) = %locator%] or %locator% = 'frontpage']
XPATH
, 'table' => <<<XPATH
.//table[(./@id = %locator% or contains(.//caption, %locator%) or contains(concat(' ', normalize-space(@class), ' '), %locator% ))]
.//table[(./@id = %locator% or contains(.//caption, %locator%) or contains(.//th, %locator%) or contains(concat(' ', normalize-space(@class), ' '), %locator% ))]
XPATH
, 'table_row' => <<<XPATH
.//tr[contains(normalize-space(.), %locator%) and not(.//tr[contains(normalize-space(.), %locator%)])]
+3
View File
@@ -4606,5 +4606,8 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2015100800.01);
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -102,5 +102,8 @@ function xmldb_editor_atto_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -39,5 +39,8 @@ function xmldb_atto_equation_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2015083100, 'atto', 'equation');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -1181,4 +1181,16 @@ EditorPluginDialogue.prototype = {
Y.Base.mix(Y.M.editor_atto.EditorPlugin, [EditorPluginDialogue]);
}, '@VERSION@', {"requires": ["node", "base", "escape", "event", "event-outside", "handlebars", "event-custom", "timers"]});
}, '@VERSION@', {
"requires": [
"node",
"base",
"escape",
"event",
"event-outside",
"handlebars",
"event-custom",
"timers",
"moodle-editor_atto-menu"
]
});
File diff suppressed because one or more lines are too long
@@ -1177,4 +1177,16 @@ EditorPluginDialogue.prototype = {
Y.Base.mix(Y.M.editor_atto.EditorPlugin, [EditorPluginDialogue]);
}, '@VERSION@', {"requires": ["node", "base", "escape", "event", "event-outside", "handlebars", "event-custom", "timers"]});
}, '@VERSION@', {
"requires": [
"node",
"base",
"escape",
"event",
"event-outside",
"handlebars",
"event-custom",
"timers",
"moodle-editor_atto-menu"
]
});
@@ -27,7 +27,8 @@
"event-outside",
"handlebars",
"event-custom",
"timers"
"timers",
"moodle-editor_atto-menu"
]
},
"moodle-editor_atto-menu": {
+3
View File
@@ -184,5 +184,8 @@ fontselect,fontsizeselect,wrap,code,search,replace,wrap,nonbreaking,charmap,tabl
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -56,5 +56,8 @@ function xmldb_tinymce_spellchecker_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1 -1
View File
@@ -452,7 +452,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
}
}
// Check role permissions
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride','moodle/role:override', 'moodle/role:assign'), $coursecontext)) {
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override'), $coursecontext)) {
$url = new moodle_url('/admin/roles/check.php', array('contextid'=>$coursecontext->id));
$permissionsnode->add(get_string('checkpermissions', 'role'), $url, navigation_node::TYPE_SETTING, null, 'permissions', new pix_icon('i/checkpermissions', ''));
}
+1 -1
View File
@@ -36,7 +36,7 @@ function flowplayer_send_flash_content($filename) {
// Note: Do not use any fancy APIs here, this must work in all supported versions.
// No url params.
if (!empty($_GET) or !empty($_POST) or !empty($_REQUEST)) {
if (!empty($_GET) or !empty($_POST)) {
header("HTTP/1.1 404 Not Found");
die;
}
+24 -13
View File
@@ -131,6 +131,7 @@ class phpunit_util extends testing_util {
}
$resetdb = self::reset_database();
$localename = self::get_locale_name();
$warnings = array();
if ($detectchanges === true) {
@@ -163,14 +164,8 @@ class phpunit_util extends testing_util {
$warnings[] = 'Warning: unexpected change of $COURSE';
}
if ($CFG->ostype === 'WINDOWS') {
if (setlocale(LC_TIME, 0) !== 'English_Australia.1252') {
$warnings[] = 'Warning: unexpected change of locale';
}
} else {
if (setlocale(LC_TIME, 0) !== 'en_AU.UTF-8') {
$warnings[] = 'Warning: unexpected change of locale';
}
if (setlocale(LC_TIME, 0) !== $localename) {
$warnings[] = 'Warning: unexpected change of locale';
}
}
@@ -262,11 +257,7 @@ class phpunit_util extends testing_util {
core_date::phpunit_reset();
// Make sure the time locale is consistent - that is Australian English.
if ($CFG->ostype === 'WINDOWS') {
setlocale(LC_TIME, 'English_Australia.1252');
} else {
setlocale(LC_TIME, 'en_AU.UTF-8');
}
setlocale(LC_TIME, $localename);
// verify db writes just in case something goes wrong in reset
if (self::$lastdbwrites != $DB->perf_get_writes()) {
@@ -362,6 +353,11 @@ class phpunit_util extends testing_util {
public static function testing_ready_problem() {
global $DB;
$localename = self::get_locale_name();
if (setlocale(LC_TIME, $localename) === false) {
return array(PHPUNIT_EXITCODE_CONFIGERROR, "Required locale '$localename' is not installed.");
}
if (!self::is_test_site()) {
// dataroot was verified in bootstrap, so it must be DB
return array(PHPUNIT_EXITCODE_CONFIGERROR, 'Can not use database for testing, try different prefix');
@@ -798,4 +794,19 @@ class phpunit_util extends testing_util {
self::$eventsink->add_event($event);
}
}
/**
* Gets the name of the locale for testing environment (Australian English)
* depending on platform environment.
*
* @return string the locale name.
*/
protected static function get_locale_name() {
global $CFG;
if ($CFG->ostype === 'WINDOWS') {
return 'English_Australia.1252';
} else {
return 'en_AU.UTF-8';
}
}
}
+3
View File
@@ -60,6 +60,9 @@ function xmldb_message_email_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -60,6 +60,9 @@ function xmldb_message_jabber_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -60,6 +60,9 @@ function xmldb_message_popup_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -646,5 +646,8 @@ function xmldb_assign_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -50,5 +50,8 @@ function xmldb_assignfeedback_comments_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -76,5 +76,8 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -26,23 +26,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@@ -66,14 +66,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;
// This file is part of Moodle - http://moodle.org/
@@ -498,7 +498,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);
@@ -680,8 +680,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {
@@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -1595,7 +1595,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -2224,7 +2224,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>');
container.append(commentlist);
commentfilter.on('keyup', this.filter_search_comments, null, this);
commentfilter.on('keyup', this.filter_search_comments, this);
commentlist.delegate('click', this.focus_on_comment, 'a', this);
commentlist.delegate('key', this.focus_on_comment, 'enter,space', 'a', this);
@@ -2243,10 +2243,12 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
filter_search_comments : function() {
var filternode,
commentslist,
filtertext;
filtertext,
dialogueid;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
dialogueid = this.get('id');
filternode = Y.one('#' + dialogueid + SELECTOR.SEARCHFILTER);
commentslist = Y.one('#' + dialogueid + SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');
@@ -2505,7 +2507,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -3272,7 +3274,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@@ -3283,15 +3285,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@@ -3302,7 +3304,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@@ -3361,12 +3363,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : drawingcanvas});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@@ -3446,7 +3448,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@@ -3573,7 +3575,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@@ -3582,7 +3584,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@@ -3590,7 +3592,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@@ -3606,7 +3608,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@@ -3628,11 +3630,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@@ -3665,7 +3667,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@@ -3726,6 +3728,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
* @protected
@@ -3746,7 +3757,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@@ -3817,7 +3828,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@@ -3914,7 +3925,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@@ -3974,7 +3985,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@@ -4038,13 +4050,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@@ -4064,7 +4076,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@@ -4082,7 +4094,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@@ -4099,8 +4111,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@@ -4144,7 +4156,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);
File diff suppressed because one or more lines are too long
@@ -26,23 +26,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@@ -66,14 +66,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;
// This file is part of Moodle - http://moodle.org/
@@ -498,7 +498,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);
@@ -680,8 +680,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {
@@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -1595,7 +1595,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -2224,7 +2224,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>');
container.append(commentlist);
commentfilter.on('keyup', this.filter_search_comments, null, this);
commentfilter.on('keyup', this.filter_search_comments, this);
commentlist.delegate('click', this.focus_on_comment, 'a', this);
commentlist.delegate('key', this.focus_on_comment, 'enter,space', 'a', this);
@@ -2243,10 +2243,12 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
filter_search_comments : function() {
var filternode,
commentslist,
filtertext;
filtertext,
dialogueid;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
dialogueid = this.get('id');
filternode = Y.one('#' + dialogueid + SELECTOR.SEARCHFILTER);
commentslist = Y.one('#' + dialogueid + SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');
@@ -2505,7 +2507,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -3272,7 +3274,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@@ -3283,15 +3285,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@@ -3302,7 +3304,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@@ -3361,12 +3363,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : drawingcanvas});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@@ -3446,7 +3448,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@@ -3573,7 +3575,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@@ -3582,7 +3584,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@@ -3590,7 +3592,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@@ -3606,7 +3608,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@@ -3628,11 +3630,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@@ -3665,7 +3667,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@@ -3726,6 +3728,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
* @protected
@@ -3746,7 +3757,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@@ -3817,7 +3828,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@@ -3914,7 +3925,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@@ -3974,7 +3985,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@@ -4038,13 +4050,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@@ -4064,7 +4076,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@@ -4082,7 +4094,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@@ -4099,8 +4111,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@@ -4144,7 +4156,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);
@@ -170,8 +170,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {
@@ -42,7 +42,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@@ -84,7 +84,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
+1 -1
View File
@@ -159,7 +159,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@@ -52,7 +52,7 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentlist = Y.Node.create('<ul role="menu" class="assignfeedback_editpdf_menu"/>');
container.append(commentlist);
commentfilter.on('keyup', this.filter_search_comments, null, this);
commentfilter.on('keyup', this.filter_search_comments, this);
commentlist.delegate('click', this.focus_on_comment, 'a', this);
commentlist.delegate('key', this.focus_on_comment, 'enter,space', 'a', this);
@@ -71,10 +71,12 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
filter_search_comments : function() {
var filternode,
commentslist,
filtertext;
filtertext,
dialogueid;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
dialogueid = this.get('id');
filternode = Y.one('#' + dialogueid + SELECTOR.SEARCHFILTER);
commentslist = Y.one('#' + dialogueid + SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');
+1 -1
View File
@@ -100,7 +100,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);
+39 -29
View File
@@ -219,7 +219,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@@ -230,15 +230,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@@ -249,7 +249,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@@ -308,12 +308,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : drawingcanvas});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@@ -393,7 +393,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@@ -520,7 +520,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@@ -529,7 +529,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@@ -537,7 +537,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@@ -553,7 +553,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@@ -575,11 +575,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@@ -612,7 +612,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@@ -673,6 +673,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
* @protected
@@ -693,7 +702,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@@ -764,7 +773,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@@ -861,7 +870,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@@ -921,7 +930,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@@ -985,13 +995,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@@ -1011,7 +1021,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@@ -1029,7 +1039,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@@ -1046,8 +1056,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@@ -1091,7 +1101,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);
+22 -22
View File
@@ -24,23 +24,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@@ -64,13 +64,13 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;
+3
View File
@@ -50,5 +50,8 @@ function xmldb_assignfeedback_file_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -49,6 +49,9 @@ function xmldb_assignsubmission_comments_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -47,6 +47,9 @@ function xmldb_assignsubmission_file_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -49,6 +49,9 @@ function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -128,6 +128,9 @@ function xmldb_assignment_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -225,5 +225,8 @@ function xmldb_book_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -51,6 +51,9 @@ function xmldb_chat_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+2 -2
View File
@@ -634,7 +634,7 @@ function chat_update_chat_times($chatid=0) {
$event = new stdClass(); // Update calendar too.
$cond = "modulename='chat' AND instance = :chatid AND timestart <> :chattime";
$params = array('chattime' => $chat->chattime, 'chatid' => $chatid);
$params = array('chattime' => $chat->chattime, 'chatid' => $chat->id);
if ($event->id = $DB->get_field_select('event', 'id', $cond, $params)) {
$event->timestart = $chat->chattime;
@@ -1265,7 +1265,7 @@ function chat_extend_settings_navigation(settings_navigation $settings, navigati
if ($chat->chattime && $chat->schedule) {
$nextsessionnode = $chatnode->add(get_string('nextsession', 'chat').
': '.userdate($chat->chattime).
' ('.usertimezone($USER->timezone));
' ('.usertimezone($USER->timezone).')');
$nextsessionnode->add_class('note');
}
+3
View File
@@ -98,6 +98,9 @@ function xmldb_choice_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -168,5 +168,8 @@ function xmldb_data_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015092200, 'data');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1
View File
@@ -97,6 +97,7 @@ class data_field_checkbox extends data_field_base {
} else {
$str .= html_writer::checkbox('f_'.$this->field->id.'[]', s($checkbox), false, $checkbox);
}
$str .= html_writer::empty_tag('br');
$found = true;
}
if (!$found) {
+3
View File
@@ -67,6 +67,9 @@ function xmldb_feedback_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -125,5 +125,8 @@ function xmldb_folder_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -250,5 +250,8 @@ function xmldb_forum_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015102900, 'forum');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -83,6 +83,9 @@ function xmldb_glossary_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015060200, 'glossary');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -57,5 +57,8 @@ function xmldb_imscp_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -93,6 +93,9 @@ function xmldb_label_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+4
View File
@@ -349,5 +349,9 @@ function xmldb_lesson_upgrade($oldversion) {
// Lesson savepoint reached.
upgrade_mod_savepoint(true, 2015071803, 'lesson');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -194,6 +194,9 @@ function xmldb_lti_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -78,5 +78,8 @@ function xmldb_page_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -904,5 +904,8 @@ function xmldb_quiz_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -62,5 +62,8 @@ function xmldb_quiz_overview_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -142,6 +142,9 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -78,5 +78,8 @@ function xmldb_resource_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -335,6 +335,9 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2015091400, 'scorm');
}
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -53,6 +53,9 @@ function xmldb_survey_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -78,5 +78,8 @@ function xmldb_url_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -90,5 +90,8 @@ function xmldb_wiki_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -166,5 +166,8 @@ function xmldb_workshop_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -62,5 +62,8 @@ function xmldb_workshopform_accumulative_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -62,5 +62,8 @@ function xmldb_workshopform_comments_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -62,5 +62,8 @@ function xmldb_workshopform_numerrors_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -62,5 +62,8 @@ function xmldb_workshopform_rubric_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -0,0 +1,51 @@
@core @core_notes
Feature: Add notes to course participants
In order to share information with other staff
As a teacher
I need to add notes from the course particpants list
Scenario: An teacher can add multiple notes
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Participants"
And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//input[@type='checkbox']" to "1"
And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 2')]//input[@type='checkbox']" to "1"
And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 3')]//input[@type='checkbox']" to "1"
And I set the field "With selected users..." to "Add a new note"
And I press "OK"
# Add a note to student 1, but leave student 2 empty and student 3 with space.
When I set the field with xpath "//tr[contains(normalize-space(.), 'Student 1')]//textarea" to "Student 1 needs to pick up his game"
And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 2')]//textarea" to ""
And I set the field with xpath "//tr[contains(normalize-space(.), 'Student 3')]//textarea" to " "
And I press "Save changes"
And I follow "Student 1"
And I follow "Notes"
# Student 1 has note from Teacher
Then I should see "Teacher" in the "region-main" "region"
And I should see "Student 1 needs to pick up his game"
And I follow "Participants"
And I follow "Student 2"
And I follow "Notes"
And I follow "Course 1"
And I follow "Participants"
And I follow "Notes"
Then I should see "Student 1"
And I should see "Student 1 needs to pick up his game"
# Verify Student 2 does not have a note added.
And I should not see "Student 2"
And I should not see "Student 3"

Some files were not shown because too many files have changed in this diff Show More