Merge branch 'w01_MDL-43528_m27_magic' of https://github.com/skodak/moodle
authorSam Hemelryk <sam@moodle.com>
Mon, 6 Jan 2014 01:19:11 +0000 (14:19 +1300)
committerSam Hemelryk <sam@moodle.com>
Mon, 6 Jan 2014 01:19:11 +0000 (14:19 +1300)
159 files changed:
badges/action.php
badges/index.php
badges/upgrade.txt
course/dndupload.js
course/dnduploadlib.php
grade/tests/edittreelib_test.php
lang/en/badges.php
lib/badgeslib.php
lib/classes/event/assessable_uploaded.php
lib/classes/event/blog_association_created.php
lib/classes/event/blog_entries_viewed.php
lib/classes/event/comment_created.php
lib/classes/event/comment_deleted.php
lib/classes/event/content_viewed.php
lib/classes/event/course_category_deleted.php
lib/classes/event/course_content_deleted.php
lib/classes/event/course_created.php
lib/classes/event/course_deleted.php
lib/classes/event/course_module_created.php
lib/classes/event/course_module_deleted.php
lib/classes/event/course_module_updated.php
lib/classes/event/course_reset_ended.php
lib/classes/event/course_reset_started.php
lib/classes/event/course_restored.php
lib/classes/event/course_section_updated.php
lib/classes/event/course_updated.php
lib/classes/event/group_member_added.php
lib/classes/event/note_created.php
lib/classes/event/note_deleted.php
lib/classes/event/note_updated.php
lib/classes/event/notes_viewed.php
lib/classes/event/role_assigned.php
lib/classes/event/role_deleted.php
lib/classes/event/role_unassigned.php
lib/classes/event/user_deleted.php
lib/classes/event/user_enrolment_created.php
lib/classes/event/user_enrolment_deleted.php
lib/classes/event/user_enrolment_updated.php
lib/classes/event/user_list_viewed.php
lib/classes/event/user_loggedin.php
lib/classes/event/user_loggedinas.php
lib/classes/event/user_loggedout.php
lib/classes/event/user_profile_viewed.php
lib/classes/event/webservice_function_called.php
lib/classes/event/webservice_login_failed.php
lib/classes/event/webservice_service_created.php
lib/classes/event/webservice_token_created.php
lib/editor/tinymce/plugins/managefiles/lib.php
lib/outputrequirementslib.php
lib/rsslib.php
lib/thirdpartylibs.xml
lib/weblib.php
lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js
lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js
lib/yui/build/moodle-core-blocks/moodle-core-blocks.js
lib/yui/src/blocks/js/blockregion.js
lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable-debug.js [moved from mod/scorm/yui/src/treeview/js/gallery-sm-treeview-sortable-debug.js with 89% similarity]
lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable-min.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-debug.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-min.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview/assets/gallery-sm-treeview-core.css [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/moodle-mod_scorm-treeview-core.css with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/folder.png [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/folder.png with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/folder@2x.png [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/folder@2x.png with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/gallery-sm-treeview-skin.css [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/moodle-mod_scorm-treeview-skin.css with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/gallery-sm-treeview.css [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/moodle-mod_scorm-treeview.css with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/item.png [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/item.png with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/assets/skins/sam/item@2x.png [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/assets/skins/sam/item@2x.png with 100% similarity]
lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview-debug.js [moved from mod/scorm/yui/src/treeview/js/gallery-sm-treeview-debug.js with 95% similarity]
lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview-min.js [new file with mode: 0644]
lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview.js [moved from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-debug.js with 94% similarity]
lib/yuilib/readme_moodle.txt
mod/assign/classes/event/assessable_submitted.php
mod/assign/classes/event/marker_updated.php
mod/assign/classes/event/submission_status_updated.php
mod/assign/classes/event/workflow_state_updated.php
mod/assign/lib.php
mod/assign/locallib.php
mod/assign/submission/file/classes/event/assessable_uploaded.php
mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php
mod/assign/tests/locallib_test.php
mod/assign/version.php
mod/assignment/type/online/classes/event/assessable_uploaded.php
mod/assignment/type/upload/classes/event/assessable_submitted.php
mod/assignment/type/upload/classes/event/assessable_uploaded.php
mod/chat/classes/event/sessions_viewed.php
mod/choice/classes/event/answer_submitted.php
mod/choice/classes/event/answer_updated.php
mod/choice/classes/event/report_viewed.php
mod/feedback/classes/event/course_module_viewed.php
mod/feedback/classes/event/response_deleted.php
mod/feedback/classes/event/response_submitted.php
mod/forum/classes/event/assessable_uploaded.php
mod/forum/post.php
mod/lesson/classes/event/course_module_instance_list_viewed.php [new file with mode: 0644]
mod/lesson/classes/event/course_module_viewed.php [new file with mode: 0644]
mod/lesson/classes/event/essay_attempt_viewed.php [new file with mode: 0644]
mod/lesson/classes/event/highscore_added.php [new file with mode: 0644]
mod/lesson/classes/event/highscores_viewed.php [new file with mode: 0644]
mod/lesson/classes/event/lesson_ended.php [new file with mode: 0644]
mod/lesson/classes/event/lesson_started.php [new file with mode: 0644]
mod/lesson/classes/file_info.php [new file with mode: 0644]
mod/lesson/essay.php
mod/lesson/highscores.php
mod/lesson/index.php
mod/lesson/lang/en/lesson.php
mod/lesson/lib.php
mod/lesson/locallib.php
mod/lesson/tests/events_test.php [new file with mode: 0644]
mod/lesson/view.php
mod/lti/classes/event/unknown_service_api_called.php
mod/quiz/classes/event/attempt_abandoned.php
mod/quiz/classes/event/attempt_becameoverdue.php
mod/quiz/classes/event/attempt_submitted.php
mod/scorm/module.js
mod/scorm/thirdpartylibs.xml [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-min.js [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable.js [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/moodle-mod_scorm-treeview-core.css [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder.png [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder@2x.png [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item.png [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item@2x.png [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview.css [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-debug.js [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-min.js [deleted file]
mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview.js [deleted file]
mod/scorm/yui/src/treeview/assets/moodle-mod_scorm-treeview-core.css [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/folder.png [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/folder@2x.png [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/item.png [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/item@2x.png [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css [deleted file]
mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview.css [deleted file]
mod/scorm/yui/src/treeview/build.json [deleted file]
mod/scorm/yui/src/treeview/js/treeview-sortable.js [deleted file]
mod/scorm/yui/src/treeview/js/treeview.js [deleted file]
mod/scorm/yui/src/treeview/meta/sm-treeview.json [deleted file]
mod/scorm/yui/src/treeview/readme_moodle.txt [deleted file]
mod/wiki/classes/event/comment_created.php
mod/wiki/classes/event/comment_deleted.php
mod/wiki/classes/event/page_deleted.php
mod/wiki/classes/event/page_diff_viewed.php
mod/wiki/classes/event/page_locks_deleted.php
mod/wiki/classes/event/page_map_viewed.php
mod/wiki/classes/event/page_updated.php
mod/wiki/classes/event/page_version_deleted.php
mod/wiki/classes/event/page_version_restored.php
mod/wiki/classes/event/page_version_viewed.php
mod/workshop/classes/event/assessable_uploaded.php
report/log/classes/event/content_viewed.php
report/loglive/classes/event/content_viewed.php
report/outline/classes/event/content_viewed.php
report/participation/classes/event/content_viewed.php
report/stats/classes/event/content_viewed.php
theme/yui_combo.php
theme/yui_image.php

index 929d9a0..31843a2 100644 (file)
@@ -29,7 +29,6 @@ require_once($CFG->libdir . '/badgeslib.php');
 
 $badgeid = required_param('id', PARAM_INT);
 $copy = optional_param('copy', 0, PARAM_BOOL);
-$delete    = optional_param('delete', 0, PARAM_BOOL);
 $activate = optional_param('activate', 0, PARAM_BOOL);
 $deactivate = optional_param('lock', 0, PARAM_BOOL);
 $confirm   = optional_param('confirm', 0, PARAM_BOOL);
@@ -61,38 +60,6 @@ if ($return !== 0) {
 }
 $returnurl->remove_params('awards');
 
-if ($delete) {
-    require_capability('moodle/badges:deletebadge', $context);
-
-    $PAGE->url->param('delete', 1);
-    if ($confirm) {
-        require_sesskey();
-        $badge->delete();
-        redirect(new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid)));
-    }
-
-    $strheading = get_string('delbadge', 'badges');
-    $PAGE->navbar->add($strheading);
-    $PAGE->set_title($strheading);
-    $PAGE->set_heading($badge->name);
-    echo $OUTPUT->header();
-    echo $OUTPUT->heading($strheading);
-
-    $urlparams = array(
-        'id' => $badge->id,
-        'delete' => 1,
-        'confirm' => 1,
-        'sesskey' => sesskey()
-    );
-    $continue = new moodle_url('/badges/action.php', $urlparams);
-    $cancel = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
-
-    $message = get_string('delconfirm', 'badges', $badge->name);
-    echo $OUTPUT->confirm($message, $continue, $cancel);
-    echo $OUTPUT->footer();
-    die;
-}
-
 if ($copy) {
     require_sesskey();
     require_capability('moodle/badges:createbadge', $context);
index 6c73990..ecc0d4f 100644 (file)
@@ -30,12 +30,12 @@ require_once($CFG->libdir . '/badgeslib.php');
 $type       = required_param('type', PARAM_INT);
 $courseid   = optional_param('id', 0, PARAM_INT);
 $page       = optional_param('page', 0, PARAM_INT);
-$activate   = optional_param('activate', 0, PARAM_INT);
 $deactivate = optional_param('lock', 0, PARAM_INT);
 $sortby     = optional_param('sort', 'name', PARAM_ALPHA);
 $sorthow    = optional_param('dir', 'ASC', PARAM_ALPHA);
 $confirm    = optional_param('confirm', false, PARAM_BOOL);
 $delete     = optional_param('delete', 0, PARAM_INT);
+$archive    = optional_param('archive', 0, PARAM_INT);
 $msg        = optional_param('msg', '', PARAM_TEXT);
 
 if (!in_array($sortby, array('name', 'status'))) {
@@ -107,20 +107,34 @@ $PAGE->requires->js('/badges/backpack.js');
 $PAGE->requires->js_init_call('check_site_access', null, false);
 $output = $PAGE->get_renderer('core', 'badges');
 
-if ($delete && has_capability('moodle/badges:deletebadge', $PAGE->context)) {
-    $badge = new badge($delete);
+if (($delete || $archive) && has_capability('moodle/badges:deletebadge', $PAGE->context)) {
+    $badgeid = ($archive != 0) ? $archive : $delete;
+    $badge = new badge($badgeid);
     if (!$confirm) {
         echo $output->header();
-        echo $output->confirm(
-                    get_string('delconfirm', 'badges', $badge->name),
-                    new moodle_url($PAGE->url, array('delete' => $badge->id, 'confirm' => 1)),
-                    $returnurl
-                );
+        // Archive this badge?
+        echo $output->heading(get_string('archivebadge', 'badges', $badge->name));
+        $archivebutton = $output->single_button(
+                            new moodle_url($PAGE->url, array('archive' => $badge->id, 'confirm' => 1)),
+                            get_string('archiveconfirm', 'badges'));
+        echo $output->box(get_string('archivehelp', 'badges') . $archivebutton, 'generalbox');
+
+        // Delete this badge?
+        echo $output->heading(get_string('delbadge', 'badges', $badge->name));
+        $deletebutton = $output->single_button(
+                            new moodle_url($PAGE->url, array('delete' => $badge->id, 'confirm' => 1)),
+                            get_string('delconfirm', 'badges'));
+        echo $output->box(get_string('deletehelp', 'badges') . $deletebutton, 'generalbox');
+
+        // Go back.
+        echo $output->action_link($returnurl, get_string('cancel'));
+
         echo $output->footer();
         die();
     } else {
         require_sesskey();
-        $badge->delete();
+        $archiveonly = ($archive != 0) ? true : false;
+        $badge->delete($archiveonly);
         redirect($returnurl);
     }
 }
index 1a48ffd..bab46ee 100644 (file)
@@ -7,6 +7,9 @@ information provided here is intended especially for developers.
   in all criteria classes. This method returns an array consisting of SQL JOIN statement, WHERE conditions,
   and any parameters that might be required. The results are used in lib/badgeslib.php in review_all_criteria()
   to reduce to the minimum the number of users to review and award badges.
-
 * New optional parameter $filtered in review() allows to indicate that some expensive checks can be skipped
   if the list of users has been initially filtered based on met criteria.
+* New optional parameter $archive in delete() in badge class in badgeslib.php
+  allows to indicate that a badge should be archived instead of fully deleted.
+  If this parameter is set to FALSE, a badge will all its information, criteria,
+  and awards will be removed from the database.
index d279d39..00b19d4 100644 (file)
@@ -736,38 +736,13 @@ M.course_dndupload = {
                     var result = JSON.parse(xhr.responseText);
                     if (result) {
                         if (result.error == 0) {
-                            // All OK - update the dummy element
-                            if (result.content) {
-                                // A label
-                                resel.indentdiv.innerHTML = '<div class="activityinstance" ></div>' + result.content + result.commands;
-                            } else {
-                                // Not a label
-                                resel.icon.src = result.icon;
-                                resel.a.href = result.link;
-                                resel.namespan.innerHTML = result.name;
-
-                                if (!parseInt(result.visible, 10)) {
-                                    resel.a.className = 'dimmed';
-                                }
-
-                                if (result.groupingname) {
-                                    resel.groupingspan.innerHTML = '(' + result.groupingname + ')';
-                                } else {
-                                    resel.div.removeChild(resel.groupingspan);
-                                }
-
-                                resel.div.removeChild(resel.progressouter);
-                                resel.indentdiv.innerHTML += result.commands;
-                                if (result.onclick) {
-                                    resel.a.onclick = result.onclick;
-                                }
-                                if (self.Y.UA.gecko > 0) {
-                                    // Fix a Firefox bug which makes sites with a '~' in their wwwroot
-                                    // log the user out when clicking on the link (before refreshing the page).
-                                    resel.div.innerHTML = unescape(resel.div.innerHTML);
-                                }
+                            // All OK - replace the dummy element.
+                            resel.li.outerHTML = result.fullcontent;
+                            if (self.Y.UA.gecko > 0) {
+                                // Fix a Firefox bug which makes sites with a '~' in their wwwroot
+                                // log the user out when clicking on the link (before refreshing the page).
+                                resel.li.outerHTML = unescape(resel.li.outerHTML);
                             }
-                            resel.li.id = result.elementid;
                             self.add_editing(result.elementid);
                         } else {
                             // Error - remove the dummy element
@@ -986,39 +961,14 @@ M.course_dndupload = {
                     var result = JSON.parse(xhr.responseText);
                     if (result) {
                         if (result.error == 0) {
-                            // All OK - update the dummy element
-                            if (result.content) {
-                                // A label
-                                resel.indentdiv.innerHTML = '<div class="activityinstance" ></div>' + result.content + result.commands;
-                            } else {
-                                // Not a label
-                                resel.icon.src = result.icon;
-                                resel.a.href = result.link;
-                                resel.namespan.innerHTML = result.name;
-
-                                if (!parseInt(result.visible, 10)) {
-                                    resel.a.className = 'dimmed';
-                                }
-
-                                if (result.groupingname) {
-                                    resel.groupingspan.innerHTML = '(' + result.groupingname + ')';
-                                } else {
-                                    resel.div.removeChild(resel.groupingspan);
-                                }
-
-                                resel.div.removeChild(resel.progressouter);
-                                resel.div.innerHTML += result.commands;
-                                if (result.onclick) {
-                                    resel.a.onclick = result.onclick;
-                                }
-                                if (self.Y.UA.gecko > 0) {
-                                    // Fix a Firefox bug which makes sites with a '~' in their wwwroot
-                                    // log the user out when clicking on the link (before refreshing the page).
-                                    resel.div.innerHTML = unescape(resel.div.innerHTML);
-                                }
+                            // All OK - replace the dummy element.
+                            resel.li.outerHTML = result.fullcontent;
+                            if (self.Y.UA.gecko > 0) {
+                                // Fix a Firefox bug which makes sites with a '~' in their wwwroot
+                                // log the user out when clicking on the link (before refreshing the page).
+                                resel.li.outerHTML = unescape(resel.li.outerHTML);
                             }
-                            resel.li.id = result.elementid;
-                            self.add_editing(result.elementid, sectionnumber);
+                            self.add_editing(result.elementid);
                         } else {
                             // Error - remove the dummy element
                             resel.parent.removeChild(resel.li);
index 3fa6bb2..84aea52 100644 (file)
@@ -722,29 +722,18 @@ class dndupload_ajax_processor {
      */
     protected function send_response($mod) {
         global $OUTPUT, $PAGE;
-        $courserenderer = $PAGE->get_renderer('core', 'course');
 
         $resp = new stdClass();
         $resp->error = self::ERROR_OK;
-        $resp->icon = $mod->get_icon_url()->out();
-        $resp->name = $mod->name;
-        if ($mod->has_view()) {
-            $resp->link = $mod->get_url()->out();
-        } else {
-            $resp->link = null;
-        }
-        $resp->content = $mod->get_content();
-        $resp->elementid = 'module-'.$mod->id;
-        $actions = course_get_cm_edit_actions($mod, 0, $mod->sectionnum);
-        $resp->commands = ' '. $courserenderer->course_section_cm_edit_actions($actions, $mod);
-        $resp->onclick = $mod->get_on_click();
-        $resp->visible = $mod->visible;
-
-        // If using groupings, then display grouping name.
-        if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
-            $groupings = groups_get_all_groupings($this->course->id);
-            $resp->groupingname = format_string($groupings[$mod->groupingid]->name);
-        }
+        $resp->elementid = 'module-' . $mod->id;
+
+        $courserenderer = $PAGE->get_renderer('core', 'course');
+        $completioninfo = new completion_info($this->course);
+        $info = get_fast_modinfo($this->course);
+        $sr = null;
+        $modulehtml = $courserenderer->course_section_cm($this->course, $completioninfo,
+                $mod, null, array());
+        $resp->fullcontent = $courserenderer->course_section_cm_list_item($this->course, $completioninfo, $mod, $sr);
 
         echo $OUTPUT->header();
         echo json_encode($resp);
index 07c59e7..f3d768c 100644 (file)
@@ -99,9 +99,14 @@ class core_grade_edittreelib_testcase extends advanced_testcase {
         $this->assertEquals($scale->id, $gradeitem->scaleid);
         $this->assertEquals($scalestring, $cell->text, "Grade text matches scale");
 
-        // Now change it to no grade.
+        // Now change it to no grade with gradebook feedback enabled.
+        $adminconfig = $assign->get_admin_config();
+        $gradebookplugin = $adminconfig->feedback_plugin_for_gradebook;
+        $gradebookplugin .= '_enabled';
+
         $instance = $assign->get_instance();
         $instance->grade = 0;
+        $instance->$gradebookplugin = 1;
         $instance->instance = $instance->id;
         $assign->update_instance($instance);
 
@@ -111,6 +116,19 @@ class core_grade_edittreelib_testcase extends advanced_testcase {
         $this->assertEquals(GRADE_TYPE_TEXT, $gradeitem->gradetype);
         $this->assertEquals(null, $gradeitem->scaleid);
         $this->assertEquals(' - ', $cell->text, 'Grade text matches empty value of " - "');
+
+        // Now change it to no grade with gradebook feedback disabled.
+        $instance = $assign->get_instance();
+        $instance->grade = 0;
+        $instance->$gradebookplugin = 0;
+        $instance->instance = $instance->id;
+        $assign->update_instance($instance);
+
+        $gradeitem = grade_item::fetch($gradeitemparams);
+        $cell = $column->get_item_cell($gradeitem, array());
+
+        $this->assertEquals(GRADE_TYPE_NONE, $gradeitem->gradetype);
+        $this->assertEquals(null, $gradeitem->scaleid);
     }
 }
 
index 14cd22b..099d8e7 100644 (file)
@@ -55,6 +55,10 @@ $string['anymethodactivity'] = 'Any of the selected activities is complete';
 $string['anymethodcourseset'] = 'Any of the selected courses is complete';
 $string['anymethodmanual'] = 'Any of the selected roles awards the badge';
 $string['anymethodprofile'] = 'Any of the selected profile fields has been completed';
+$string['archivebadge'] = 'Would you like to delete badge \'{$a}\', but keep existing issued badges?';
+$string['archiveconfirm'] = 'Delete and keep existing issued badges';
+$string['archivehelp'] = '<p>This option means that the badge will be marked as "retired" and will no longer appear in the list of badges. Users will no longer be able to earn this badge, however existing badge recipients will still be able to display this badge on their profile page and push it to their external backpacks.</p>
+<p>If you would like your users to retain access to the earned badges it is important to select this option instead of fully deleting badges.</p>';
 $string['attachment'] = 'Attach badge to message';
 $string['attachment_help'] = 'If checked, an issued badge file will be attached to the recepient\'s email for download. Email attachments must be enabled in site settings to use this option.';
 $string['award'] = 'Award badge';
@@ -196,8 +200,10 @@ $string['defaultissuercontact'] = 'Default badge issuer contact details';
 $string['defaultissuercontact_desc'] = 'An email address associated with the badge issuer.';
 $string['defaultissuername'] = 'Default badge issuer name';
 $string['defaultissuername_desc'] = 'Name of the issuing agent or authority.';
-$string['delbadge'] = 'Delete badge';
-$string['delconfirm'] = 'Are you sure that you want to delete badge \'{$a}\'?';
+$string['delbadge'] = 'Would you like to delete badge \'{$a}\' and remove all existing issued badges?';
+$string['delconfirm'] = 'Delete and remove existing issued badges';
+$string['deletehelp'] = '<p>Fully deleting a badge means that all its information and criteria records will be permanently removed. Users who have earned this badge will no longer be able to access it and display it on their profile pages.</p>
+<p>Note: Users who have earned this badge and have already pushed it to their external backpack, will still have this badge in their external backpack. However, they will not be able to access criteria and evidence pages linking back to this web site.</p>';
 $string['delcritconfirm'] = 'Are you sure that you want to delete this criterion?';
 $string['delparamconfirm'] = 'Are you sure that you want to delete this parameter?';
 $string['description'] = 'Description';
index 8d1bf9e..f233078 100644 (file)
@@ -603,13 +603,42 @@ class badge {
     }
 
     /**
-     * Marks the badge as archived.
-     * For reporting and historical purposed we cannot completely delete badges.
-     * We will just change their status to BADGE_STATUS_ARCHIVED.
+     * Fully deletes the badge or marks it as archived.
+     *
+     * @param $archive bool Achive a badge without actual deleting of any data.
      */
-    public function delete() {
-        $this->status = BADGE_STATUS_ARCHIVED;
-        $this->save();
+    public function delete($archive = true) {
+        global $DB;
+
+        if ($archive) {
+            $this->status = BADGE_STATUS_ARCHIVED;
+            $this->save();
+            return;
+        }
+
+        $fs = get_file_storage();
+
+        // Remove all issued badge image files and badge awards.
+        // Cannot bulk remove area files here because they are issued in user context.
+        $awards = $this->get_awards();
+        foreach ($awards as $award) {
+            $usercontext = context_user::instance($award->userid);
+            $fs->delete_area_files($usercontext->id, 'badges', 'userbadge', $this->id);
+        }
+        $DB->delete_records('badge_issued', array('badgeid' => $this->id));
+
+        // Remove all badge criteria.
+        $criteria = $this->get_criteria();
+        foreach ($criteria as $criterion) {
+            $criterion->delete();
+        }
+
+        // Delete badge images.
+        $badgecontext = $this->get_context();
+        $fs->delete_area_files($badgecontext->id, 'badges', 'badgeimage', $this->id);
+
+        // Finally, remove badge itself.
+        $DB->delete_records('badge', array('id' => $this->id));
     }
 }
 
index 4e4ed8d..46aa825 100644 (file)
@@ -36,6 +36,13 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Both events could be triggered in a row, first the uploaded, then the submitted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content string.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5670f52..0e7da1c 100644 (file)
@@ -29,6 +29,15 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a new blog entry is associated with a context.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string associatetype type of blog association, course/coursemodule.
+ *      @type int blogid id of blog.
+ *      @type int associateid id of associate.
+ *      @type string subject blog subject.
+ * }
+ *
  * @package    core
  * @copyright  2013 onwards Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index bf4dbaf..d0119fa 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when blog entries are viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int courseid id of associated course.
+ * }
+ *
  * @package    core
  * @copyright  2013 onwards Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index abee52e..cebf7c5 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * This class has to be extended by any event which is triggred while creating new comment.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int itemid id of item for which comment is added.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index f6a2004..69c43c6 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * This class has to be extended by any event which is triggred while deleting comment.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int itemid id of item for which comment is deleted.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 7492bd1..17f0328 100644 (file)
@@ -39,6 +39,12 @@ defined('MOODLE_INTERNAL') || die();
  *  $event->trigger();
  * where \report_participation\event\content_viewed extends \core\event\content_viewed
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index ff7ecf3..a856ef1 100644 (file)
@@ -19,7 +19,13 @@ namespace core\event;
 defined('MOODLE_INTERNAL') || die();
 
 /**
- * category deleted event.
+ * Category deleted event.
+ *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string name category name.
+ * }
  *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
index 92fc9a6..d5b6624 100644 (file)
@@ -21,6 +21,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course content_deleted event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array options list of options which were skipped while deleting course content.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index deeacb4..57eb640 100644 (file)
@@ -21,6 +21,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course created event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string shortname shortname of course.
+ *      @type string fullname fullname of course.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 0f704a7..0580e7c 100644 (file)
@@ -21,6 +21,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course deleted event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string shortname shortname of course.
+ *      @type string fullname fullname of course.
+ *      @type string idnumber id number of course.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 9ed6fc8..2c481a8 100644 (file)
 /**
  * Event to be triggered when a new course module is created.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string modulename name of module created.
+ *      @type string name title of module.
+ *      @type string instanceid id of module instance.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
index 67a4b02..d00a43a 100644 (file)
@@ -30,6 +30,13 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a course module is deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string modulename name of module deleted.
+ *      @type string instanceid id of module instance.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
index ced4210..99e61f8 100644 (file)
@@ -30,6 +30,14 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a course module is updated.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string modulename name of module updated.
+ *      @type string name title of module.
+ *      @type string instanceid id of module instance.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
index 56e1009..5c8f280 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core course reset ended event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array reset_options all reset options settings including courseid.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 8a34a75..f28d6de 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core course reset started event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array reset_options all reset options settings including courseid.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 2f8fa4f..8e7af36 100644 (file)
@@ -21,6 +21,16 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course restored event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string type restore type, activity, course or section.
+ *      @type int target where restored (new/existing/current/adding/deleting)
+ *      @type int mode execution mode
+ *      @type string opertaion restore
+ *      @type boolean samesite true is restored to same site.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5a7d9e0..60760e5 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course section updated.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int sectionnum section number.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index c037d20..47ab3af 100644 (file)
@@ -21,6 +21,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Course updated event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string shortname shortname of course.
+ *      @type string fullname fullname of course.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index df1c2d1..6855e15 100644 (file)
@@ -28,6 +28,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core_group member added event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string component name of component
+ *      @type int itemid id of item.
+ * }
+ *
  * @package    core_group
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 838ba8c..e3ce2ab 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a note is created.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string publishstate publish state.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 45249fe..52f9182 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a note is deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string publishstate publish state
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index df3ac78..fb94617 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a note is updated.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string publishstate publish state.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 3680fc4..a298106 100644 (file)
@@ -31,6 +31,12 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a note is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content hard-coded to notes.
+ * }
+ *
  * @package    core
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5213900..f22fd16 100644 (file)
@@ -21,6 +21,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Role assigned event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int id role assigned id.
+ *      @type string component name of component.
+ *      @type int itemid id of item.
+ * }
+ *
  * @package    core
  * @copyright  2013 Petr Skoda {@link http://skodak.org}
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index d11dab8..ae150c8 100644 (file)
@@ -21,6 +21,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Role assigned event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string shortname shortname of role.
+ *      @type string description role description.
+ *      @type string archetype role type.
+ * }
+ *
  * @package    core_event
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 2e5a986..f3d0850 100644 (file)
@@ -21,6 +21,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Role unassigned event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int id role assigned id.
+ *      @type string component name of component.
+ *      @type int itemid id of item.
+ * }
+ *
  * @package    core
  * @copyright  2013 Petr Skoda {@link http://skodak.org}
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index e04ee16..fdc68c8 100644 (file)
@@ -28,6 +28,16 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event when user profile is deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string username name of user.
+ *      @type string email user email.
+ *      @type string idnumber user idnumber.
+ *      @type string picture user picture.
+ *      @type int mnethostid mnet host id.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 064ccf5..c5e0d0e 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event when user is enrolled in a course.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string enrol name of enrolment instance.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 8992347..4376a2b 100644 (file)
 /**
  * User enrolment deleted event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string enrol name of enrolment instance.
+ *      @type array userenrolment user_enrolment record.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 8e53236..69e71de 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event when user enrolment is updated.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string enrol name of enrolment instance.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 45aa787..fce1f0d 100644 (file)
 /**
  * Defines the user list viewed event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int courseid id of course.
+ *      @type string courseshortname short name of course.
+ *      @type string coursefullname full name of course.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 9628e31..0bb4e17 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * User login event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string username name of user.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 50012d8..136307d 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * User loggedinas event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string originalusername original username.
+ *      @type string loggedinasusername username of logged in as user.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 8f2c6aa..d17f0bf 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event when user logout.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string sessionid session id.
+ * }
+ *
  * @package    core
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index af9f228..eefc9bf 100644 (file)
 /**
  * Defines the user profile viewed event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int courseid id of course.
+ *      @type string courseshortname short name of course.
+ *      @type string coursefullname fullname of course.
+ * }
+ *
  * @package    core
  * @copyright  2013 Mark Nelson <markn@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 9914385..1334784 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core webservice function_called event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string function name of the function.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 395e91b..9ababb0 100644 (file)
@@ -28,6 +28,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core web service login_failed event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string method authentication method.
+ *      @type string reason failure reason.
+ *      @type string tokenid id of token.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 436a236..22fd29c 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core webservice service created event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string sessionid session id.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5f18336..d5799e0 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * core webservice token_created event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type bool auto automatically created.
+ * }
+ *
  * @package    core
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 7de1edb..4d54a14 100644 (file)
@@ -40,6 +40,15 @@ class tinymce_managefiles extends editor_tinymce_plugin {
             array $options = null) {
         global $USER;
 
+        if (!isloggedin() or isguestuser()) {
+            // Must be a real user to manage any files.
+            return;
+        }
+        if (!isset($options['maxfiles']) or $options['maxfiles'] == 0) {
+            // No files allowed - easy, do not load anything.
+            return;
+        }
+
         // Add parameters for filemanager
         $params['managefiles'] = array('usercontext' => context_user::instance($USER->id)->id);
         foreach (array('itemid', 'context', 'areamaxbytes', 'maxbytes', 'subdirs', 'return_types') as $key) {
index fa07895..f1470f9 100644 (file)
@@ -226,6 +226,20 @@ class page_requirements_manager {
             )
         ));
 
+        $this->YUI_config->add_group('gallery', array(
+            'name' => 'gallery',
+            'base' => $CFG->httpswwwroot . '/lib/yuilib/gallery/',
+            'combine' => $this->yui3loader->combine,
+            'comboBase' => $CFG->httpswwwroot . '/theme/yui_combo.php' . $sep,
+            'ext' => false,
+            'root' => 'gallery/' . $jsrev . '/',
+            'patterns' => array(
+                'gallery-' => array(
+                    'group' => 'gallery',
+                )
+            )
+        ));
+
         // Set some more loader options applying to groups too.
         if ($CFG->debugdeveloper) {
             // When debugging is enabled, we want to load the non-minified (RAW) versions of YUI library modules rather
@@ -983,27 +997,19 @@ class page_requirements_manager {
      * @param array|string $modules One or more modules
      * @param string $function The function to call once modules have been loaded
      * @param array $arguments An array of arguments to pass to the function
-     * @param string $galleryversion The gallery version to use
+     * @param string $galleryversion Deprecated: The gallery version to use
      * @param bool $ondomready
      */
     public function yui_module($modules, $function, array $arguments = null, $galleryversion = null, $ondomready = false) {
-        global $CFG;
-
-        if (!$galleryversion) {
-            $galleryversion = '2010.04.08-12-35';
-        }
-
         if (!is_array($modules)) {
             $modules = array($modules);
         }
-        if (empty($CFG->useexternalyui)) {
-            // We need to set the M.yui.galleryversion to the correct version
-            $jscode = 'M.yui.galleryversion='.json_encode($galleryversion).';';
-        } else {
-            // Set Y's config.gallery to the version
-            $jscode = 'Y.config.gallery='.json_encode($galleryversion).';';
+
+        if ($galleryversion != null) {
+            debugging('The galleryversion parameter to yui_module has been deprecated since Moodle 2.3.');
         }
-        $jscode .= 'Y.use('.join(',', array_map('json_encode', convert_to_array($modules))).',function() {'.js_writer::function_call($function, $arguments).'});';
+
+        $jscode = 'Y.use('.join(',', array_map('json_encode', convert_to_array($modules))).',function() {'.js_writer::function_call($function, $arguments).'});';
         if ($ondomready) {
             $jscode = "Y.on('domready', function() { $jscode });";
         }
index 17157bb..b634aba 100644 (file)
@@ -355,21 +355,15 @@ function rss_add_items($items) {
 }
 
 /**
- * This function return all the common footers for every rss feed in the site
+ * This function return all the common footers for every rss feed in the site.
  *
- * @param string $title       Not used at all
- * @param string $link        Not used at all
- * @param string $description Not used at all
- * @todo  MDL-31050 Fix/Remove this function
  * @return string
  */
-function rss_standard_footer($title = NULL, $link = NULL, $description = NULL) {
+function rss_standard_footer() {
     $status = true;
     $result = '';
 
-    //Close the chanel
     $result .= rss_end_tag('channel', 1, true);
-    ////Close the rss tag
     $result .= '</rss>';
 
     return $result;
index b24bfc5..ed5ce6a 100644 (file)
     <version>3.13.0</version>
     <licenseversion></licenseversion>
   </library>
+  <library>
+    <location>yuilib/gallery</location>
+    <name>YUI Gallery</name>
+    <license>BSD</license>
+    <version>gallery-2013.10.02-20-26</version>
+    <licenseversion></licenseversion>
+  </library>
   <library>
     <location>jquery</location>
     <name>jQuery</name>
index 955526e..680d091 100644 (file)
@@ -2550,6 +2550,7 @@ function redirect($url, $message='', $delay=-1) {
     if ($PAGE) {
         $PAGE->set_context(null);
         $PAGE->set_pagelayout('redirect');  // No header and footer needed.
+        $PAGE->set_title(get_string('pageshouldredirect', 'moodle'));
     }
 
     if ($url instanceof moodle_url) {
index a765037..fb3e3e5 100644 (file)
Binary files a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js and b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js differ
index 4da7627..9699956 100644 (file)
Binary files a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js and b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js differ
index 2b3315f..a1c7810 100644 (file)
Binary files a/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js and b/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js differ
index 4e13157..3e2c6fe 100644 (file)
@@ -27,7 +27,7 @@ BLOCKREGION.prototype = {
         Y.log('Block region `'+this.get('region')+'` initialising', 'info');
         if (!node) {
             Y.log('block region known about but no HTML structure found for it. Guessing structure.', 'warn');
-            this.create_and_add_node();
+            node = this.create_and_add_node();
         }
         var body = Y.one('body'),
             hasblocks = node.all('.'+CSS.BLOCK).size() > 0,
@@ -43,6 +43,7 @@ BLOCKREGION.prototype = {
      * Creates a generic block region node and adds it to the DOM at the best guess location.
      * Any calling of this method is an unfortunate circumstance.
      * @method create_and_add_node
+     * @return Node The newly created Node
      */
     create_and_add_node : function() {
         var c = Y.Node.create,
@@ -85,6 +86,8 @@ BLOCKREGION.prototype = {
             Y.one('body').append(node);
         }
         this.set('node', node);
+
+        return node;
     },
 
     /**
@@ -55,12 +55,9 @@ Sortable.prototype._afterSort = function (e) {
     if (node.isRoot()) {
         this.render();
     } else {
-        this.renderNode(node, {
-            force         : true,
-            renderChildren: true
-        });
+        this.renderNode(node, {renderChildren: true});
     }
 };
 
 
-}, '@VERSION@', {"requires": ["gallery-sm-treeview", "tree-sortable"]});
+}, 'gallery-2013.06.20-02-07', {"requires": ["gallery-sm-treeview", "tree-sortable"]});
diff --git a/lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable-min.js b/lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable-min.js
new file mode 100644 (file)
index 0000000..b72a22f
--- /dev/null
@@ -0,0 +1 @@
+YUI.add("gallery-sm-treeview-sortable",function(e,t){var n=e.TreeView.Sortable=function(){};e.mix(n.prototype,e.Tree.Sortable.prototype),n.prototype._attachTreeViewEvents=function(){e.TreeView.prototype._attachTreeViewEvents.call(this),this._treeViewEvents.push(this.after("sort",this._afterSort))},n.prototype._afterSort=function(e){var t=e.node;if(!this.rendered||!t.state.renderedChildren)return;t.isRoot()?this.render():this.renderNode(t,{renderChildren:!0})}},"gallery-2013.06.20-02-07",{requires:["gallery-sm-treeview","tree-sortable"]});
diff --git a/lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable.js b/lib/yuilib/gallery/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable.js
new file mode 100644 (file)
index 0000000..efda7c8
--- /dev/null
@@ -0,0 +1,63 @@
+YUI.add('gallery-sm-treeview-sortable', function (Y, NAME) {
+
+/**
+Provides `Y.TreeView.Sortable`, a `Y.TreeView` extension that mixes in
+`Y.Tree.Sortable` and provides related TreeView-specific functionality.
+
+@module gallery-sm-treeview
+@submodule gallery-sm-treeview-sortable
+**/
+
+/**
+Extension for `Y.TreeView` that mixes in `Y.Tree.Sortable` and provides related
+TreeView-specific functionality (such as re-rendering a node after it's sorted).
+
+@class TreeView.Sortable
+@constructor
+@extensionfor TreeView
+@extends Tree.Sortable
+**/
+
+var Sortable = Y.TreeView.Sortable = function () {};
+
+Y.mix(Sortable.prototype, Y.Tree.Sortable.prototype);
+
+// -- Protected Methods ----------------------------------------------------
+
+// Overrides Y.TreeView#_attachTreeViewEvents().
+Sortable.prototype._attachTreeViewEvents = function () {
+    Y.TreeView.prototype._attachTreeViewEvents.call(this);
+
+    this._treeViewEvents.push(
+        this.after('sort', this._afterSort)
+    );
+};
+
+// -- Event Handlers -------------------------------------------------------
+
+/**
+Re-renders a node if necessary after a `sort` event.
+
+@method _afterSort
+@param {EventFacade} e
+@protected
+**/
+Sortable.prototype._afterSort = function (e) {
+    var node = e.node;
+
+    // If this tree hasn't been rendered yet or the sorted node's children
+    // haven't been rendered yet, there's nothing to do.
+    if (!this.rendered || !node.state.renderedChildren) {
+        return;
+    }
+
+    // Re-render the sorted node and its children.
+    if (node.isRoot()) {
+        this.render();
+    } else {
+        this.renderNode(node, {renderChildren: true});
+    }
+};
+
+
+}, 'gallery-2013.06.20-02-07', {"requires": ["gallery-sm-treeview", "tree-sortable"]});
diff --git a/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-debug.js b/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-debug.js
new file mode 100644 (file)
index 0000000..a9fa76b
--- /dev/null
@@ -0,0 +1,30 @@
+YUI.add('gallery-sm-treeview-templates', function (Y, NAME) {
+
+var Micro = Y.Template.Micro;
+
+Y.namespace('TreeView').Templates = {
+    children: Micro.compile(
+        '<ul class="<%= data.classNames.children %>" ' +
+
+            '<% if (data.node.isRoot()) { %>' +
+                'role="tree" tabindex="0"' +
+            '<% } else { %>' +
+                'role="group"' +
+            '<% } %>' +
+
+        '></ul>'
+    ),
+
+    node: Micro.compile(
+        '<li id="<%= data.node.id %>" class="<%= data.nodeClassNames.join(" ") %>" role="treeitem" aria-labelled-by="<%= data.node.id %>-label">' +
+            '<div class="<%= data.classNames.row %>" data-node-id="<%= data.node.id %>">' +
+                '<span class="<%= data.classNames.indicator %>"><s></s></span>' +
+                '<span class="<%= data.classNames.icon %>"></span>' +
+                '<span id="<%= data.node.id %>-label" class="<%= data.classNames.label %>"><%== data.node.label %></span>' +
+            '</div>' +
+        '</li>'
+    )
+};
+
+
+}, 'gallery-2013.03.27-22-06', {"requires": ["template-micro"]});
diff --git a/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-min.js b/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates-min.js
new file mode 100644 (file)
index 0000000..90353fa
--- /dev/null
@@ -0,0 +1 @@
+YUI.add("gallery-sm-treeview-templates",function(e,t){var n=e.Template.Micro;e.namespace("TreeView").Templates={children:n.compile('<ul class="<%= data.classNames.children %>" <% if (data.node.isRoot()) { %>role="tree" tabindex="0"<% } else { %>role="group"<% } %>></ul>'),node:n.compile('<li id="<%= data.node.id %>" class="<%= data.nodeClassNames.join(" ") %>" role="treeitem" aria-labelled-by="<%= data.node.id %>-label"><div class="<%= data.classNames.row %>" data-node-id="<%= data.node.id %>"><span class="<%= data.classNames.indicator %>"><s></s></span><span class="<%= data.classNames.icon %>"></span><span id="<%= data.node.id %>-label" class="<%= data.classNames.label %>"><%== data.node.label %></span></div></li>')}},"gallery-2013.03.27-22-06",{requires:["template-micro"]});
diff --git a/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates.js b/lib/yuilib/gallery/gallery-sm-treeview-templates/gallery-sm-treeview-templates.js
new file mode 100644 (file)
index 0000000..a9fa76b
--- /dev/null
@@ -0,0 +1,30 @@
+YUI.add('gallery-sm-treeview-templates', function (Y, NAME) {
+
+var Micro = Y.Template.Micro;
+
+Y.namespace('TreeView').Templates = {
+    children: Micro.compile(
+        '<ul class="<%= data.classNames.children %>" ' +
+
+            '<% if (data.node.isRoot()) { %>' +
+                'role="tree" tabindex="0"' +
+            '<% } else { %>' +
+                'role="group"' +
+            '<% } %>' +
+
+        '></ul>'
+    ),
+
+    node: Micro.compile(
+        '<li id="<%= data.node.id %>" class="<%= data.nodeClassNames.join(" ") %>" role="treeitem" aria-labelled-by="<%= data.node.id %>-label">' +
+            '<div class="<%= data.classNames.row %>" data-node-id="<%= data.node.id %>">' +
+                '<span class="<%= data.classNames.indicator %>"><s></s></span>' +
+                '<span class="<%= data.classNames.icon %>"></span>' +
+                '<span id="<%= data.node.id %>-label" class="<%= data.classNames.label %>"><%== data.node.label %></span>' +
+            '</div>' +
+        '</li>'
+    )
+};
+
+
+}, 'gallery-2013.03.27-22-06', {"requires": ["template-micro"]});
@@ -208,14 +208,9 @@ TreeView = Y.Base.create('treeView', Y.View, [
     @method renderChildren
     @param {Tree.Node} treeNode Tree node whose children should be rendered.
     @param {Object} [options] Options.
-
         @param {Node} [options.container] `Y.Node` instance of a container into
             which the children should be rendered. If the container already
             contains rendered children, they will be re-rendered in place.
-
-        @param {Boolean} [options.force=false] If `true`, children will be
-            re-rendered from scratch even if they've already been rendered.
-
     @return {Node} `Y.Node` instance containing the rendered children.
     **/
     renderChildren: function (treeNode, options) {
@@ -225,11 +220,6 @@ TreeView = Y.Base.create('treeView', Y.View, [
             childrenNode = container && container.one('>.' + this.classNames.children),
             lazyRender   = this._lazyRender;
 
-        if (childrenNode && options.force) {
-            childrenNode.remove(true);
-            childrenNode = null;
-        }
-
         if (!childrenNode) {
             childrenNode = Y.Node.create(this.templates.children({
                 classNames: this.classNames,
@@ -271,17 +261,10 @@ TreeView = Y.Base.create('treeView', Y.View, [
     @method renderNode
     @param {Tree.Node} treeNode Tree node to render.
     @param {Object} [options] Options.
-
         @param {Node} [options.container] `Y.Node` instance of a container to
             which the rendered tree node should be appended.
-
-        @param {Boolean} [options.force=false] If `true`, this node (and its
-            children if `renderChildren` is `true`) will be re-rendered from
-            scratch, even if it's already been rendered.
-
         @param {Boolean} [options.renderChildren=false] Whether or not to render
             this node's children.
-
     @return {Node} `Y.Node` instance of the rendered tree node.
     **/
     renderNode: function (treeNode, options) {
@@ -290,9 +273,7 @@ TreeView = Y.Base.create('treeView', Y.View, [
         var classNames     = this.classNames,
             hasChildren    = treeNode.hasChildren(),
             htmlNode       = treeNode._htmlNode,
-            oldHtmlNode    = options.force && htmlNode,
             nodeClassNames = {},
-
             className;
 
         // Build the hash of CSS classes for this node.
@@ -300,7 +281,7 @@ TreeView = Y.Base.create('treeView', Y.View, [
         nodeClassNames[classNames.canHaveChildren] = !!treeNode.canHaveChildren;
         nodeClassNames[classNames.hasChildren]     = hasChildren;
 
-        if (htmlNode && !options.force) {
+        if (htmlNode) {
             // This node has already been rendered, so we just need to update
             // the DOM instead of re-rendering it from scratch.
             htmlNode.one('.' + classNames.label).setHTML(treeNode.label);
@@ -311,8 +292,7 @@ TreeView = Y.Base.create('treeView', Y.View, [
                 }
             }
         } else {
-            // This node hasn't been rendered yet or is being forcibly
-            // re-rendered.
+            // This node hasn't been rendered yet, so render it from scratch.
             var enabledClassNames = [];
 
             for (className in nodeClassNames) {
@@ -350,13 +330,8 @@ TreeView = Y.Base.create('treeView', Y.View, [
 
         treeNode.state.rendered = true;
 
-        if (options.force) {
-            oldHtmlNode.replace(htmlNode);
-            oldHtmlNode.destroy();
-        } else {
-            if (options.container && htmlNode.get('parentNode') !== options.container) {
-                options.container.append(htmlNode);
-            }
+        if (options.container) {
+            options.container.append(htmlNode);
         }
 
         return htmlNode;
@@ -725,7 +700,7 @@ TreeView = Y.Base.create('treeView', Y.View, [
 Y.TreeView = Y.mix(TreeView, Y.TreeView);
 
 
-}, '@VERSION@', {
+}, 'gallery-2013.06.20-02-07', {
     "requires": [
         "base-build",
         "classnamemanager",
diff --git a/lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview-min.js b/lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview-min.js
new file mode 100644 (file)
index 0000000..0a2e306
--- /dev/null
@@ -0,0 +1,2 @@
+YUI.add("gallery-sm-treeview",function(e,t){var n=e.Template.Micro;e.namespace("TreeView").Templates={children:n.compile('<ul class="<%= data.classNames.children %>" <% if (data.node.isRoot()) { %>role="tree" tabindex="0"<% } else { %>role="group"<% } %>></ul>'),node:n.compile('<li id="<%= data.node.id %>" class="<%= data.nodeClassNames.join(" ") %>" role="treeitem" aria-labelled-by="<%= data.node.id %>-label"><div class="<%= data.classNames.row %>" data-node-id="<%= data.node.id %>"><span class="<%= data.classNames.indicator %>"><s></s></span><span class="<%= data.classNames.icon %>"></span><span id="<%= data.node.id %>-label" class="<%= data.classNames.label %>"><%== data.node.label %></span></div></li>')};var r=e.ClassNameManager.getClassName,i=e.Base.create("treeView",e.View,[e.Tree,e.Tree.Labelable,e.Tree.Openable,e.Tree.Selectable],{classNames:{canHaveChildren:r("treeview-can-have-children"),children:r("treeview-children"),hasChildren:r("treeview-has-children"),icon:r("treeview-icon"),indicator:r("treeview-indicator"),label:r("treeview-label"),node:r("treeview-node"),noTouch:r("treeview-notouch"),open:r("treeview-open"),row:r("treeview-row"),selected:r("treeview-selected"),touch:r("treeview-touch"),treeview:r("treeview")},rendered:!1,templates:e.TreeView.Templates,_isYUITreeView:!0,initializer:function(t){t&&t.templates&&(this.templates=e.merge(this.templates,t.templates)),this._renderQueue={},this._attachTreeViewEvents()},destructor:function(){clearTimeout(this._renderTimeout),this._detachTreeViewEvents(),this._renderQueue=null},destroyNode:function(t,n){return t._htmlNode=null,e.Tree.prototype.destroyNode.call(this,t,n)},getHTMLNode:function(e){return e._htmlNode||(e._htmlNode=this.get("container").one("#"+e.id)),e._htmlNode},render:function(){var t=this.get("container"),n="ontouchstart"in e.config.win;return t.addClass(this.classNames.treeview),t.addClass(this.classNames[n?"touch":"noTouch"]),this._childrenNode=this.renderChildren(this.rootNode,{container:t}),t.inDoc()||e.one("body").append(t),this.rendered=!0,this},renderChildren:function(t,n){n||(n={});var r=n.container,i=r&&r.one(">."+this.classNames.children),s=this._lazyRender;i||(i=e.Node.create(this.templates.children({classNames:this.classNames,node:t,treeview:this})));if(t.hasChildren()){i.set("aria-expanded",t.isOpen());for(var o=0,u=t.children.length;o<u;o++){var a=t.children[o];this.renderNode(a,{container:i,renderChildren:!s||a.isOpen()})}}return t.state.renderedChildren=!0,r&&r.append(i),i},renderNode:function(t,n){n||(n={});var r=this.classNames,i=t.hasChildren(),s=t._htmlNode,o={},u;o[r.node]=!0,o[r.canHaveChildren]=!!t.canHaveChildren,o[r.hasChildren]=i;if(s){s.one("."+r.label).setHTML(t.label);for(u in o)o.hasOwnProperty(u)&&s.toggleClass(u,o[u])}else{var a=[];for(u in o)o.hasOwnProperty(u)&&o[u]&&a.push(u);s=t._htmlNode=e.Node.create(this.templates.node({classNames:r,nodeClassNames:a,node:t,treeview:this}))}this._syncNodeOpenState(t,s),this._syncNodeSelectedState(t,s);if(i)n.renderChildren&&this.renderChildren(t,{container:s});else{var f=s.one(">."+r.children);f&&f.remove(!0)}return t.state.rendered=!0,n.container&&n.container.append(s),s},_attachTreeViewEvents:function(){this._treeViewEvents||(this._treeViewEvents=[]);var e=this.classNames,t=this.get("container");this._treeViewEvents.push(this.after({add:this._afterAdd,clear:this._afterClear,close:this._afterClose,multiSelectChange:this._afterTreeViewMultiSelectChange,open:this._afterOpen,remove:this._afterRemove,select:this._afterSelect,unselect:this._afterUnselect}),t.on("mousedown",this._onMouseDown,this),t.delegate("click",this._onIndicatorClick,"."+e.indicator,this),t.delegate("click",this._onRowClick,"."+e.row,this),t.delegate("dblclick",this._onRowDoubleClick,"."+e.canHaveChildren+" > ."+e.row,this))},_detachTreeViewEvents:function(){(new e.EventHandle(this._treeViewEvents)).detach()},_processRenderQueue:function(){if(!this.rendered)return;var e=this._renderQueue,t;for(var n in e)e.hasOwnProperty(n)&&(t=this.getNodeById(n),t&&this.renderNode(t,e[n]));this._renderQueue={}},_queueRender:function(t,n){if(!this.rendered)return;var r=this._renderQueue,i=this;return clearTimeout(this._renderTimeout),r[t.id]=e.merge(r[t.id],n),this._renderTimeout=setTimeout(function(){i._processRenderQueue()},15),this},_setLazyRender:function(e){return this._lazyRender=e},_syncNodeOpenState:function(e,t){t||(t=this.getHTMLNode(e));if(!t)return;e.isOpen()?t.addClass(this.classNames.open).set("aria-expanded",!0):t.removeClass(this.classNames.open).set("aria-expanded",!1)},_syncNodeSelectedState:function(e,t){t||(t=this.getHTMLNode(e));if(!t)return;var n=this.get("multiSelect");e.isSelected()?(t.addClass(this.classNames.selected),n?t.set("aria-selected",!0):t.set("tabIndex",0)):(t.removeClass(this.classNames.selected).removeAttribute("tabIndex"),n&&t.set("aria-selected",!1))},_afterAdd:function(e){if(!this.rendered)return;var t=e.parent,n=t.isRoot(),r=e.node,i,s;n?i=this._childrenNode:(s=this.getHTMLNode(t),i=s&&s.one(">."+this.classNames.children)),i?(i.insert(this.renderNode(r,{renderChildren:!this._lazyRender||r.isOpen()}),e.index),n||this._queueRender(t)):n||this._queueRender(t,{renderChildren:!0})},_afterClear:function(){if(!this.rendered)return;clearTimeout(this._renderTimeout),this._renderQueue={},delete this._childrenNode,this.rendered=!1,this.get("container").empty(),this.render()},_afterClose:function(e){this.rendered&&this._syncNodeOpenState(e.node)},_afterOpen:function(e){if(!this.rendered)return;var t=e.node,n=this.getHTMLNode(t);t.state.renderedChildren||this.renderChildren(t,{container:n}),this._syncNodeOpenState(t,n)},_afterRemove:function(e){if(!this.rendered)return;var t=e.node,n=e.parent;this._renderQueue[t.id]&&delete this._renderQueue[t.id];var r=this.getHTMLNode(t);r&&(r.empty().remove(!0),t._htmlNode=null),t.state.destroyed||t.traverse(function(e){e._htmlNode=null,e.state.rendered=!1,e.state.renderedChildren=!1}),n&&!n.hasChildren()&&this.renderNode(n)},_afterSelect
+:function(e){this.rendered&&this._syncNodeSelectedState(e.node)},_afterTreeViewMultiSelectChange:function(e){if(!this.rendered)return;var t=this.get("container"),n=t.one("> ."+this.classNames.children),r=t.all("."+this.classNames.node);e.newVal?(n.set("aria-multiselectable",!0),r.set("aria-selected",!1)):(n.removeAttribute("aria-multiselectable"),r.removeAttribute("aria-selected"))},_afterUnselect:function(e){this.rendered&&this._syncNodeSelectedState(e.node)},_onIndicatorClick:function(e){var t=e.currentTarget.ancestor("."+this.classNames.row);e.stopImmediatePropagation(),this.getNodeById(t.getData("node-id")).toggleOpen()},_onMouseDown:function(e){e.preventDefault()},_onRowClick:function(e){if(e.button>1)return;var t=this.getNodeById(e.currentTarget.getData("node-id"));this.get("multiSelect")?t[t.isSelected()?"unselect":"select"]():t.select()},_onRowDoubleClick:function(e){if(e.button>1)return;this.getNodeById(e.currentTarget.getData("node-id")).toggleOpen()}},{ATTRS:{lazyRender:{lazyAdd:!1,setter:"_setLazyRender",value:!0}}});e.TreeView=e.mix(i,e.TreeView)},"gallery-2013.06.20-02-07",{requires:["base-build","classnamemanager","template-micro","tree","tree-labelable","tree-openable","tree-selectable","view"],skinnable:!0});
similarity index 94%
rename from mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-debug.js
rename to lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview.js
index 796207c..d65f31f 100644 (file)
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-debug.js and b/lib/yuilib/gallery/gallery-sm-treeview/gallery-sm-treeview.js differ
index 25dd241..7c7a058 100644 (file)
@@ -12,5 +12,14 @@ Description of import of various YUI libraries into Moodle:
 * update lib/thrirdpartylibs.xml
 * verify our simpleyui rollup contents in /theme/yui_combo.php
 
+3/ YUI3 Gallery version gallery-2013.10.02-20-26:
+* selective copy of the "build" directory for the checked out tag of yui3-gallery.
+  Unit test code coverage files (*-coverage.js) are removed but no other changes are made.
+* update lib/thirdpartylibs.xml
+* Note: versions in the gallery modules may differ from the tagged version but will be the
+  latest at the time the module was tagged.
+Currently supported gallery modules:
+* gallery-sm-treeview*
+
 Code downloaded from:
 http://yuilibrary.com
index 7c67ad9..5e7d6e8 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_assign assessable submitted event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type bool submission_editable is submission editable.
+ * }
+ *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 2596e9b..616005d 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_assign marker updated event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int markerid userid id of marker.
+ * }
+ *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 731be58..32be18b 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_assign submission status updated event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string newstatus status of submission.
+ * }
+ *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 00c7812..6ccdf0d 100644 (file)
@@ -29,6 +29,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_assign workflow state updated event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string newstatus status of submission.
+ * }
+ *
  * @package    mod_assign
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 67b2ffd..136c45a 100644 (file)
@@ -912,6 +912,19 @@ function assign_grade_item_update($assign, $grades=null) {
 
     $params = array('itemname'=>$assign->name, 'idnumber'=>$assign->cmidnumber);
 
+    // Check if feedback plugin for gradebook is enabled, if yes then
+    // gradetype = GRADE_TYPE_TEXT else GRADE_TYPE_NONE.
+    $gradefeedbackenabled = false;
+
+    if (isset($assign->gradefeedbackenabled)) {
+        $gradefeedbackenabled = $assign->gradefeedbackenabled;
+    } else if ($assign->grade == 0) { // Grade feedback is needed only when grade == 0.
+        $mod = get_coursemodule_from_instance('assign', $assign->id, $assign->courseid);
+        $cm = context_module::instance($mod->id);
+        $assignment = new assign($cm, null, null);
+        $gradefeedbackenabled = $assignment->is_gradebook_feedback_enabled();
+    }
+
     if ($assign->grade > 0) {
         $params['gradetype'] = GRADE_TYPE_VALUE;
         $params['grademax']  = $assign->grade;
@@ -921,9 +934,12 @@ function assign_grade_item_update($assign, $grades=null) {
         $params['gradetype'] = GRADE_TYPE_SCALE;
         $params['scaleid']   = -$assign->grade;
 
-    } else {
-        // Allow text comments only.
+    } else if ($gradefeedbackenabled) {
+        // $assign->grade == 0 and feedback enabled.
         $params['gradetype'] = GRADE_TYPE_TEXT;
+    } else {
+        // $assign->grade == 0 and no feedback enabled.
+        $params['gradetype'] = GRADE_TYPE_NONE;
     }
 
     if ($grades  === 'reset') {
index c3667df..3218e16 100644 (file)
@@ -788,6 +788,10 @@ class assign {
         require_once($CFG->dirroot.'/mod/assign/lib.php');
         $assign = clone $this->get_instance();
         $assign->cmidnumber = $coursemoduleid;
+
+        // Set assign gradebook feedback plugin status (enabled and visible).
+        $assign->gradefeedbackenabled = $this->is_gradebook_feedback_enabled();
+
         $param = null;
         if ($reset) {
             $param = 'reset';
@@ -3999,7 +4003,8 @@ class assign {
         }
         $assign = clone $this->get_instance();
         $assign->cmidnumber = $this->get_course_module()->idnumber;
-
+        // Set assign gradebook feedback plugin status (enabled and visible).
+        $assign->gradefeedbackenabled = $this->is_gradebook_feedback_enabled();
         return assign_grade_item_update($assign, $gradebookgrade);
     }
 
@@ -5958,6 +5963,8 @@ class assign {
                     // Update Gradebook.
                     $assign = clone $this->get_instance();
                     $assign->cmidnumber = $this->get_course_module()->idnumber;
+                    // Set assign gradebook feedback plugin status.
+                    $assign->gradefeedbackenabled = $this->is_gradebook_feedback_enabled();
                     assign_update_grades($assign, $userid);
                 }
 
@@ -6779,6 +6786,28 @@ class assign {
         }
         return !in_array($userid, $this->susers);
     }
+
+    /**
+     * Returns true if gradebook feedback plugin is enabled
+     *
+     * @return bool true if gradebook feedback plugin is enabled and visible else false.
+     */
+    public function is_gradebook_feedback_enabled() {
+        // Get default grade book feedback plugin.
+        $adminconfig = $this->get_admin_config();
+        $gradebookplugin = $adminconfig->feedback_plugin_for_gradebook;
+        $gradebookplugin = str_replace('assignfeedback_', '', $gradebookplugin);
+
+        // Check if default gradebook feedback is visible and enabled.
+        $gradebookfeedbackplugin = $this->get_feedback_plugin_by_type($gradebookplugin);
+
+        if ($gradebookfeedbackplugin->is_visible() && $gradebookfeedbackplugin->is_enabled()) {
+            return true;
+        }
+
+        // Gradebook feedback plugin is either not visible/enabled.
+        return false;
+    }
 }
 
 /**
index 0f2ccc7..b32eb00 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * assignsubmission_file assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hash.
+ *      @type string content empty string.
+ * }
+ *
  * @package    assignsubmission_file
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 179319e..214ba1f 100644 (file)
@@ -29,6 +29,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * assignsubmission_onlinetext assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content string.
+ *      @type string format content format.
+ * }
+ *
  * @package    assignsubmission_onlinetext
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -99,5 +107,4 @@ class assessable_uploaded extends \core\event\assessable_uploaded {
         parent::init();
         $this->data['objecttable'] = 'assign_submission';
     }
-
 }
index 766f851..7cc7495 100644 (file)
@@ -1582,5 +1582,27 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
         $plugin = $assign->get_feedback_plugin_by_type('comments');
         $this->assertEquals(1, $plugin->is_enabled('enabled'));
     }
+
+    /**
+     * Testing if gradebook feedback plugin is enabled.
+     */
+    public function test_is_gradebook_feedback_enabled() {
+        $adminconfig = get_config('assign');
+        $gradebookplugin = $adminconfig->feedback_plugin_for_gradebook;
+
+        // Create assignment with gradebook feedback enabled and grade = 0.
+        $assign = $this->create_instance(array($gradebookplugin . '_enabled' => 1, 'grades' => 0));
+
+        // Get gradebook feedback plugin.
+        $gradebookplugintype = str_replace('assignfeedback_', '', $gradebookplugin);
+        $plugin = $assign->get_feedback_plugin_by_type($gradebookplugintype);
+        $this->assertEquals(1, $plugin->is_enabled('enabled'));
+        $this->assertEquals(1, $assign->is_gradebook_feedback_enabled());
+
+        // Create assignment with gradebook feedback disabled and grade = 0.
+        $assign = $this->create_instance(array($gradebookplugin . '_enabled' => 0, 'grades' => 0));
+        $plugin = $assign->get_feedback_plugin_by_type($gradebookplugintype);
+        $this->assertEquals(0, $plugin->is_enabled('enabled'));
+    }
 }
 
index 1e8f15b..47ed041 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 $module->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
-$module->version  = 2013110501;    // The current module version (Date: YYYYMMDDXX).
+$module->version  = 2013110502;    // The current module version (Date: YYYYMMDDXX).
 $module->requires = 2013110500;    // Requires this Moodle version.
 $module->cron     = 60;
 
index d1659b0..1a9c8a3 100644 (file)
@@ -29,6 +29,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * assignment_online assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content submission text.
+ *      @type string triggeredfrom name of the function from which it is triggred.
+ * }
+ *
  * @package    assignment_online
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5a0f2c5..5318d4a 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * assignment_submitted assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int assignmentid assignment id.
+ *      @type bool submission_editable is submission editable.
+ * }
+ *
  * @package    assignment_submitted
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -117,5 +124,8 @@ class assessable_submitted extends \core\event\assessable_submitted {
         if (!isset($this->other['submission_editable'])) {
             throw new \coding_exception('Other must contain the key submission_editable.');
         }
+        if (!isset($this->other['assignmentid'])) {
+            throw new \coding_exception('Other must contain the key assignmentid.');
+        }
     }
 }
index 697456b..1d3a776 100644 (file)
@@ -29,6 +29,14 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * assignment_upload assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content empty string.
+ *      @type int assignmentid assignment id.
+ * }
+ *
  * @package    assignment_upload
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index e18562b..766ac9a 100644 (file)
@@ -28,6 +28,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_chat sessions viewed event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int start start of period.
+ *      @type int end end of period.
+ * }
+ *
  * @package    mod_chat
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 2b3e673..999a969 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_choice answer submitted event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int choiceid id of choice.
+ *      @type int optionid id of option
+ * }
+ *
  * @package    mod_choice
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index be548b7..eb0a276 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_choice answer updated event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int choiceid id of choice.
+ *      @type int optionid id of option
+ * }
+ *
  * @package    mod_choice
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 88299ea..acf1394 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event for when a choice activity report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ * }
+ *
  * @package mod_choice
  * @copyright 2013 Adrian Greeve
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 637a3ed..bbe47c0 100644 (file)
@@ -28,6 +28,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event for when a feedback activity is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int anonymous if feedback is anonymous.
+ *      @type int cmid course module id.
+ * }
+ *
  * @package    mod_feedback
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 49bee25..be00b5e 100644 (file)
@@ -30,6 +30,14 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a feedback response is deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int anonymous if feedback is anonymous.
+ *      @type int cmid course module id.
+ *      @type int instanceid id of instance.
+ * }
+ *
  * @package    mod_feedback
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
index 74abca9..600fd27 100644 (file)
@@ -30,6 +30,14 @@ defined('MOODLE_INTERNAL') || die();
  *
  * Class for event to be triggered when a feedback response is submitted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int anonymous if feedback is anonymous.
+ *      @type int cmid course module id.
+ *      @type int instanceid id of instance.
+ * }
+ *
  * @package    mod_feedback
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
index db25779..5cbfd3c 100644 (file)
@@ -29,6 +29,15 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_forum assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content post discussion message.
+ *      @type int discussionid id of discussion.
+ *      @type string triggeredfrom name of the function from where event is triggred.
+ * }
+ *
  * @package    mod_forum
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index e3d3dec..f1e9988 100644 (file)
@@ -790,7 +790,7 @@ if ($fromform = $mform_post->get_data()) {
             }
 
             if ($subscribemessage = forum_post_subscription($discussion, $forum)) {
-                $timemessage = 4;
+                $timemessage = 6;
             }
 
             // Update completion status
diff --git a/mod/lesson/classes/event/course_module_instance_list_viewed.php b/mod/lesson/classes/event/course_module_instance_list_viewed.php
new file mode 100644 (file)
index 0000000..50a89dd
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event for when all lesson instances for a course are viewed.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class course_module_instance_list_viewed extends \core\event\course_module_instance_list_viewed {
+    // No code required here as the parent class handles it all.
+}
diff --git a/mod/lesson/classes/event/course_module_viewed.php b/mod/lesson/classes/event/course_module_viewed.php
new file mode 100644 (file)
index 0000000..3625533
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Course module viewed event.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class course_module_viewed extends \core\event\course_module_viewed {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson';
+        $this->data['crud'] = 'r';
+        $this->data['level'] = self::LEVEL_PARTICIPATING;
+    }
+}
diff --git a/mod/lesson/classes/event/essay_attempt_viewed.php b/mod/lesson/classes/event/essay_attempt_viewed.php
new file mode 100644 (file)
index 0000000..7e066c7
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event to be triggered when the an essay attempt is viewed
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class essay_attempt_viewed extends \core\event\base {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson_attempts';
+        $this->data['crud'] = 'r';
+        $this->data['level'] = self::LEVEL_TEACHING;
+    }
+
+    /**
+     * Returns localised general event name.
+     *
+     * @return string
+     */
+    public static function get_name() {
+        return get_string('eventessayattemptviewed', 'mod_lesson');
+    }
+
+    /**
+     * Get URL related to the action.
+     *
+     * @return \moodle_url
+     */
+    public function get_url() {
+        return new \moodle_url('/mod/lesson/essay.php', array('id' => $this->context->instanceid,
+            'mode' => 'grade', 'attemptid' =>  $this->objectid));
+    }
+
+    /**
+     * Returns non-localised event description with id's for admin use only.
+     *
+     * @return string
+     */
+    public function get_description() {
+        return 'The essay grade for the user with the id ' . $this->relateduserid . ' for the attempt with the id ' .
+            $this->objectid . ' was viewed by the user with the id ' . $this->userid;
+    }
+
+    /**
+     * Replace add_to_log() statement.
+     *
+     * @return array of parameters to be passed to legacy add_to_log() function.
+     */
+    protected function get_legacy_logdata() {
+        return array($this->courseid, 'lesson', 'view grade', 'essay.php?id=' . $this->context->instanceid . '&mode=grade&attemptid='
+            . $this->objectid, get_string('manualgrading', 'lesson'), $this->context->instanceid);
+    }
+}
diff --git a/mod/lesson/classes/event/highscore_added.php b/mod/lesson/classes/event/highscore_added.php
new file mode 100644 (file)
index 0000000..b2204db
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event to be triggered when a highscore is added.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class highscore_added extends \core\event\base {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson_high_scores';
+        $this->data['crud'] = 'c';
+        $this->data['level'] = self::LEVEL_PARTICIPATING;
+    }
+
+    /**
+     * Returns localised general event name.
+     *
+     * @return string
+     */
+    public static function get_name() {
+        return get_string('eventhighscoreadded', 'mod_lesson');
+    }
+
+    /**
+     * Get URL related to the action.
+     *
+     * @return \moodle_url
+     */
+    public function get_url() {
+        return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->context->instanceid));
+    }
+
+    /**
+     * Returns non-localised event description with id's for admin use only.
+     *
+     * @return string
+     */
+    public function get_description() {
+        $highscore = $this->get_record_snapshot('lesson_high_scores', $this->objectid);
+
+        return 'A new highscore was added to the lesson with the id ' . $highscore->lessonid .
+            ' for user with the id ' . $this->userid;
+    }
+
+    /**
+     * Replace add_to_log() statement.
+     *
+     * @return array of parameters to be passed to legacy add_to_log() function.
+     */
+    protected function get_legacy_logdata() {
+        $highscore = $this->get_record_snapshot('lesson_high_scores', $this->objectid);
+
+        return array($this->courseid, 'lesson', 'update highscores', 'highscores.php?id=' . $this->context->instanceid,
+            $highscore->nickname, $this->context->instanceid);
+    }
+}
diff --git a/mod/lesson/classes/event/highscores_viewed.php b/mod/lesson/classes/event/highscores_viewed.php
new file mode 100644 (file)
index 0000000..549e451
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event to be triggered when the highscores are viewed.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class highscores_viewed extends \core\event\base {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson';
+        $this->data['crud'] = 'r';
+        $this->data['level'] = self::LEVEL_PARTICIPATING;
+    }
+
+    /**
+     * Returns localised general event name.
+     *
+     * @return string
+     */
+    public static function get_name() {
+        return get_string('eventhighscoresviewed', 'mod_lesson');
+    }
+
+    /**
+     * Get URL related to the action.
+     *
+     * @return \moodle_url
+     */
+    public function get_url() {
+        return new \moodle_url('/mod/lesson/highscores.php', array('id' => $this->context->instanceid));
+    }
+
+    /**
+     * Returns non-localised event description with id's for admin use only.
+     *
+     * @return string
+     */
+    public function get_description() {
+        return 'The highscores for lesson ' . $this->objectid . ' were viewed by ' . $this->userid;
+    }
+
+    /**
+     * Replace add_to_log() statement.
+     *
+     * @return array of parameters to be passed to legacy add_to_log() function.
+     */
+    protected function get_legacy_logdata() {
+        $lesson = $this->get_record_snapshot('lesson', $this->objectid);
+
+        return array($this->courseid, 'lesson', 'view highscores', 'highscores.php?id=' . $this->context->instanceid,
+            $lesson->name, $this->context->instanceid);
+    }
+}
diff --git a/mod/lesson/classes/event/lesson_ended.php b/mod/lesson/classes/event/lesson_ended.php
new file mode 100644 (file)
index 0000000..76963d2
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event to be triggered when a lesson is ended.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class lesson_ended extends \core\event\base {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson';
+        $this->data['crud'] = 'r';
+        $this->data['level'] = self::LEVEL_PARTICIPATING;
+    }
+
+    /**
+     * Returns localised general event name.
+     *
+     * @return string
+     */
+    public static function get_name() {
+        return get_string('eventlessonended', 'mod_lesson');
+    }
+
+    /**
+     * Get URL related to the action.
+     *
+     * @return \moodle_url
+     */
+    public function get_url() {
+        return new \moodle_url('/mod/lesson/view.php', array('id' => $this->context->instanceid));
+    }
+
+    /**
+     * Returns non-localised event description with id's for admin use only.
+     *
+     * @return string
+     */
+    public function get_description() {
+        return 'The lesson ' . $this->objectid . ' was ended by the user ' . $this->userid;
+    }
+
+    /**
+     * Replace add_to_log() statement.
+     *
+     * @return array of parameters to be passed to legacy add_to_log() function.
+     */
+    protected function get_legacy_logdata() {
+        return array($this->courseid, 'lesson', 'end', 'view.php?id=' . $this->context->instanceid, $this->objectid,
+            $this->context->instanceid);
+    }
+}
diff --git a/mod/lesson/classes/event/lesson_started.php b/mod/lesson/classes/event/lesson_started.php
new file mode 100644 (file)
index 0000000..de37727
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Event to be triggered when a lesson is started.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
+ */
+
+namespace mod_lesson\event;
+
+defined('MOODLE_INTERNAL') || die();
+
+class lesson_started extends \core\event\base {
+
+    /**
+     * Set basic properties for the event.
+     */
+    protected function init() {
+        $this->data['objecttable'] = 'lesson';
+        $this->data['crud'] = 'r';
+        $this->data['level'] = self::LEVEL_PARTICIPATING;
+    }
+
+    /**
+     * Returns localised general event name.
+     *
+     * @return string
+     */
+    public static function get_name() {
+        return get_string('eventlessonstarted', 'mod_lesson');
+    }
+
+    /**
+     * Get URL related to the action.
+     *
+     * @return \moodle_url
+     */
+    public function get_url() {
+        return new \moodle_url('/mod/lesson/view.php', array('id' => $this->context->instanceid));
+    }
+
+    /**
+     * Returns non-localised event description with id's for admin use only.
+     *
+     * @return string
+     */
+    public function get_description() {
+        return 'The lesson ' . $this->objectid . ' was started by the user ' . $this->userid;
+    }
+
+    /**
+     * Replace add_to_log() statement.
+     *
+     * @return array of parameters to be passed to legacy add_to_log() function.
+     */
+    protected function get_legacy_logdata() {
+        return array($this->courseid, 'lesson', 'start', 'view.php?id=' . $this->context->instanceid,
+            $this->objectid, $this->context->instanceid);
+    }
+}
diff --git a/mod/lesson/classes/file_info.php b/mod/lesson/classes/file_info.php
new file mode 100644 (file)
index 0000000..eb5d139
--- /dev/null
@@ -0,0 +1,194 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * File browsing support.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Frédéric Massart
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * File browsing support class.
+ *
+ * @package    mod_lesson
+ * @copyright  2013 Frédéric Massart
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class mod_lesson_file_info extends file_info {
+
+    /** @var stdClass Course object */
+    protected $course;
+    /** @var stdClass Course module object */
+    protected $cm;
+    /** @var array Available file areas */
+    protected $areas;
+    /** @var string File area to browse */
+    protected $filearea;
+
+    /**
+     * Constructor
+     *
+     * @param file_browser $browser file_browser instance
+     * @param stdClass $course course object
+     * @param stdClass $cm course module object
+     * @param stdClass $context module context
+     * @param array $areas available file areas
+     * @param string $filearea file area to browse
+     */
+    public function __construct($browser, $course, $cm, $context, $areas, $filearea) {
+        parent::__construct($browser, $context);
+        $this->course   = $course;
+        $this->cm       = $cm;
+        $this->areas    = $areas;
+        $this->filearea = $filearea;
+    }
+
+    /**
+     * Returns list of standard virtual file/directory identification.
+     * The difference from stored_file parameters is that null values
+     * are allowed in all fields
+     * @return array with keys contextid, filearea, itemid, filepath and filename
+     */
+    public function get_params() {
+        return array('contextid' => $this->context->id,
+                     'component' => 'mod_lesson',
+                     'filearea'  => $this->filearea,
+                     'itemid'    => null,
+                     'filepath'  => null,
+                     'filename'  => null);
+    }
+
+    /**
+     * Returns localised visible name.
+     * @return string
+     */
+    public function get_visible_name() {
+        return $this->areas[$this->filearea];
+    }
+
+    /**
+     * Can I add new files or directories?
+     * @return bool
+     */
+    public function is_writable() {
+        return false;
+    }
+
+    /**
+     * Is directory?
+     * @return bool
+     */
+    public function is_directory() {
+        return true;
+    }
+
+    /**
+     * Returns list of children.
+     * @return array of file_info instances
+     */
+    public function get_children() {
+        return $this->get_filtered_children('*', false, true);
+    }
+
+    /**
+     * Help function to return files matching extensions or their count
+     *
+     * @param string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg')
+     * @param bool|int $countonly if false returns the children, if an int returns just the
+     *    count of children but stops counting when $countonly number of children is reached
+     * @param bool $returnemptyfolders if true returns items that don't have matching files inside
+     * @return array|int array of file_info instances or the count
+     */
+    private function get_filtered_children($extensions = '*', $countonly = false, $returnemptyfolders = false) {
+        global $DB;
+
+        $params = array(
+            'contextid' => $this->context->id,
+            'component' => 'mod_lesson',
+            'filearea' => $this->filearea
+        );
+        $sql = 'SELECT DISTINCT itemid
+                  FROM {files}
+                 WHERE contextid = :contextid
+                   AND component = :component
+                   AND filearea = :filearea';
+
+        if (!$returnemptyfolders) {
+            $sql .= ' AND filename <> :emptyfilename';
+            $params['emptyfilename'] = '.';
+        }
+
+        list($sql2, $params2) = $this->build_search_files_sql($extensions);
+        $sql .= ' ' . $sql2;
+        $params = array_merge($params, $params2);
+
+        if ($countonly !== false) {
+            $sql .= ' ORDER BY itemid DESC';
+        }
+
+        $rs = $DB->get_recordset_sql($sql, $params);
+        $children = array();
+        foreach ($rs as $record) {
+            if (($child = $this->browser->get_file_info($this->context, 'mod_lesson', $this->filearea, $record->itemid))
+                    && ($returnemptyfolders || $child->count_non_empty_children($extensions))) {
+                $children[] = $child;
+            }
+            if ($countonly !== false && count($children) >= $countonly) {
+                break;
+            }
+        }
+        $rs->close();
+        if ($countonly !== false) {
+            return count($children);
+        }
+        return $children;
+    }
+
+    /**
+     * Returns list of children which are either files matching the specified extensions
+     * or folders that contain at least one such file.
+     *
+     * @param string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg')
+     * @return array of file_info instances
+     */
+    public function get_non_empty_children($extensions = '*') {
+        return $this->get_filtered_children($extensions, false);
+    }
+
+    /**
+     * Returns the number of children which are either files matching the specified extensions
+     * or folders containing at least one such file.
+     *
+     * @param string|array $extensions, for example '*' or array('.gif','.jpg')
+     * @param int $limit stop counting after at least $limit non-empty children are found
+     * @return int
+     */
+    public function count_non_empty_children($extensions = '*', $limit = 1) {
+        return $this->get_filtered_children($extensions, $limit);
+    }
+
+    /**
+     * Returns parent file_info instance
+     * @return file_info or null for root
+     */
+    public function get_parent() {
+        return $this->browser->get_file_info($this->context);
+    }
+}
index c824a63..123a166 100644 (file)
@@ -243,8 +243,6 @@ switch ($mode) {
                 $essayinfo->sent = 1;
                 $attempt->useranswer = serialize($essayinfo);
                 $DB->update_record('lesson_attempts', $attempt);
-                // Log it
-                add_to_log($course->id, 'lesson', 'update email essay grade', "essay.php?id=$cm->id", format_string($pages[$attempt->pageid]->title,true).': '.fullname($users[$attempt->userid]), $cm->id);
             }
         }
         $lesson->add_message(get_string('emailsuccess', 'lesson'), 'notifysuccess');
@@ -299,8 +297,6 @@ switch ($mode) {
         }
         break;
 }
-// Log it
-add_to_log($course->id, 'lesson', 'view grade', "essay.php?id=$cm->id", get_string('manualgrading', 'lesson'), $cm->id);
 
 $lessonoutput = $PAGE->get_renderer('mod_lesson');
 echo $lessonoutput->header($lesson, $cm, 'essay', false, null, get_string('manualgrading', 'lesson'));
@@ -384,6 +380,16 @@ switch ($mode) {
         echo html_writer::table($table);
         break;
     case 'grade':
+        // Trigger the essay grade viewed event.
+        $event = \mod_lesson\event\essay_attempt_viewed::create(array(
+            'objectid' => $attempt->id,
+            'relateduserid' => $attempt->userid,
+            'context' => $context,
+            'courseid' => $course->id,
+        ));
+        $event->add_record_snapshot('lesson_attempts', $attempt);
+        $event->trigger();
+
         // Grading form
         // Expects the following to be set: $attemptid, $answer, $user, $page, $attempt
         $essayinfo = unserialize($attempt->useranswer);
index c75dbbf..0493cd7 100644 (file)
@@ -143,10 +143,15 @@ switch ($mode) {
             $newhighscore->gradeid = $newgrade->id;
             $newhighscore->nickname = $name;
 
-            $DB->insert_record('lesson_high_scores', $newhighscore);
+            $newhighscore->id = $DB->insert_record('lesson_high_scores', $newhighscore);
 
-            // Log it
-            add_to_log($course->id, 'lesson', 'update highscores', "highscores.php?id=$cm->id", $name, $cm->id);
+            // Trigger highscore updated event.
+            $event = \mod_lesson\event\highscore_added::create(array(
+                'objectid' => $newhighscore->id,
+                'context' => $context,
+                'courseid' => $course->id,
+            ));
+            $event->trigger();
 
             $lesson->add_message(get_string('postsuccess', 'lesson'), 'notifysuccess');
             redirect("$CFG->wwwroot/mod/lesson/highscores.php?id=$cm->id&amp;link=1");
@@ -156,8 +161,13 @@ switch ($mode) {
         break;
 }
 
-// Log it
-add_to_log($course->id, 'lesson', 'view highscores', "highscores.php?id=$cm->id", $lesson->name, $cm->id);
+// Trigger highscore viewed event.
+$event = \mod_lesson\event\highscores_viewed::create(array(
+    'objectid' => $lesson->properties()->id,
+    'context' => $context,
+    'courseid' => $course->id
+));
+$event->trigger();
 
 $lessonoutput = $PAGE->get_renderer('mod_lesson');
 echo $lessonoutput->header($lesson, $cm, 'highscores', false, null, get_string('viewhighscores', 'lesson'));
index 1f95c53..ad13f61 100644 (file)
@@ -39,8 +39,12 @@ if (!$course = $DB->get_record("course", array("id" => $id))) {
 require_login($course);
 $PAGE->set_pagelayout('incourse');
 
-add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
-
+// Trigger instances list viewed event.
+$params = array(
+    'context' => context_course::instance($course->id)
+);
+$event = \mod_lesson\event\course_module_instance_list_viewed::create($params);
+$event->trigger();
 
 /// Get all required strings
 
index 6dc34e7..a0ff52d 100644 (file)
@@ -169,6 +169,11 @@ $string['essayemailmessage2'] = '<p>Essay prompt:<blockquote>{$a->question}</blo
 $string['essayemailsubject'] = 'Your grade for {$a} question';
 $string['essays'] = 'Essays';
 $string['essayscore'] = 'Essay score';
+$string['eventessayattemptviewed'] = 'Essay attempt viewed';
+$string['eventhighscoreadded'] = 'Highscore added';
+$string['eventhighscoresviewed'] = 'Highscores viewed';
+$string['eventlessonended'] = 'Lesson ended';
+$string['eventlessonstarted'] = 'Lesson started';
 $string['fileformat'] = 'File format';
 $string['finish'] = 'Finish';
 $string['firstanswershould'] = 'First answer should jump to the "Correct" page';
index ec40082..7972481 100644 (file)
@@ -906,14 +906,12 @@ function lesson_pluginfile($course, $cm, $context, $filearea, $args, $forcedownl
  *
  * @package  mod_lesson
  * @category files
- * @todo MDL-31048 localize
  * @return array a list of available file areas
  */
 function lesson_get_file_areas() {
     $areas = array();
-    $areas['page_contents'] = 'Page contents'; //TODO: localize!!!!
-    $areas['mediafile'] = 'Media file'; //TODO: localize!!!!
-
+    $areas['page_contents'] = get_string('pagecontents', 'mod_lesson');
+    $areas['mediafile'] = get_string('mediafile', 'mod_lesson');
     return $areas;
 }
 
@@ -935,20 +933,43 @@ function lesson_get_file_areas() {
  * @return file_info_stored
  */
 function lesson_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
-    global $CFG;
-    if (has_capability('moodle/course:managefiles', $context)) {
-        // no peaking here for students!!
+    global $CFG, $DB;
+
+    if (!has_capability('moodle/course:managefiles', $context)) {
+        // No peaking here for students!
         return null;
     }
 
+    // Mediafile area does not have sub directories, so let's select the default itemid to prevent
+    // the user from selecting a directory to access the mediafile content.
+    if ($filearea == 'mediafile' && is_null($itemid)) {
+        $itemid = 0;
+    }
+
+    if (is_null($itemid)) {
+        return new mod_lesson_file_info($browser, $course, $cm, $context, $areas, $filearea);
+    }
+
     $fs = get_file_storage();
     $filepath = is_null($filepath) ? '/' : $filepath;
     $filename = is_null($filename) ? '.' : $filename;
-    $urlbase = $CFG->wwwroot.'/pluginfile.php';
     if (!$storedfile = $fs->get_file($context->id, 'mod_lesson', $filearea, $itemid, $filepath, $filename)) {
         return null;
     }
-    return new file_info_stored($browser, $context, $storedfile, $urlbase, $filearea, $itemid, true, true, false);
+
+    $itemname = $filearea;
+    if ($filearea == 'page_contents') {
+        $itemname = $DB->get_field('lesson_pages', 'title', array('lessonid' => $cm->instance, 'id' => $itemid));
+        $itemname = format_string($itemname, true, array('context' => $context));
+    } else {
+        $areas = lesson_get_file_areas();
+        if (isset($areas[$filearea])) {
+            $itemname = $areas[$filearea];
+        }
+    }
+
+    $urlbase = $CFG->wwwroot . '/pluginfile.php';
+    return new file_info_stored($browser, $context, $storedfile, $urlbase, $itemname, $itemid, true, true, false);
 }
 
 
index 7011be6..35c1382 100644 (file)
@@ -1191,6 +1191,18 @@ class lesson extends lesson_base {
      */
     public function start_timer() {
         global $USER, $DB;
+
+        $cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
+            false, MUST_EXIST);
+
+        // Trigger lesson started event.
+        $event = \mod_lesson\event\lesson_started::create(array(
+            'objectid' => $this->properties()->id,
+            'context' => context_module::instance($cm->id),
+            'courseid' => $this->properties()->course
+        ));
+        $event->trigger();
+
         $USER->startlesson[$this->properties->id] = true;
         $startlesson = new stdClass;
         $startlesson->lessonid = $this->properties->id;
@@ -1243,6 +1255,18 @@ class lesson extends lesson_base {
     public function stop_timer() {
         global $USER, $DB;
         unset($USER->startlesson[$this->properties->id]);
+
+        $cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
+            false, MUST_EXIST);
+
+        // Trigger lesson ended event.
+        $event = \mod_lesson\event\lesson_ended::create(array(
+            'objectid' => $this->properties()->id,
+            'context' => context_module::instance($cm->id),
+            'courseid' => $this->properties()->course
+        ));
+        $event->trigger();
+
         return $this->update_timer(false, false);
     }
 
diff --git a/mod/lesson/tests/events_test.php b/mod/lesson/tests/events_test.php
new file mode 100644 (file)
index 0000000..55ff921
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Events tests.
+ *
+ * @package    mod_lesson
+ * @category   test
+ * @copyright  2013 Mark Nelson <markn@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $CFG;
+
+require_once($CFG->dirroot.'/mod/lesson/locallib.php');
+
+class mod_lesson_events_testcase extends advanced_testcase {
+
+    /** @var stdClass the course used for testing */
+    private $course;
+
+    /** @var lesson the lesson used for testing */
+    private $lesson;
+
+    /**
+     * Test set up.
+     *
+     * This is executed before running any test in this file.
+     */
+    public function setUp() {
+        $this->resetAfterTest();
+
+        $this->setAdminUser();
+        $this->course = $this->getDataGenerator()->create_course();
+        $lesson = $this->getDataGenerator()->create_module('lesson', array('course' => $this->course->id));
+
+        // Convert to a lesson object.
+        $this->lesson = new lesson($lesson);
+    }
+
+    /**
+     * Test the essay attempt viewed event.
+     *
+     * There is no external API for viewing an essay attempt, so the unit test will simply
+     * create and trigger the event and ensure the legacy log data is returned as expected.
+     */
+    public function test_essay_attempt_viewed() {
+        // Create a essays list viewed event
+        $event = \mod_lesson\event\essay_attempt_viewed::create(array(
+            'objectid' => $this->lesson->id,
+            'relateduserid' => 3,
+            'context' => context_module::instance($this->lesson->properties()->cmid),
+            'courseid' => $this->course->id
+        ));
+
+        // Trigger and capture the event.
+        $sink = $this->redirectEvents();
+        $event->trigger();
+        $events = $sink->get_events();
+        $event = reset($events);
+
+        // Check that the event data is valid.
+        $this->assertInstanceOf('\mod_lesson\event\essay_attempt_viewed', $event);
+        $this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
+        $expected = array($this->course->id, 'lesson', 'view grade', 'essay.php?id=' . $this->lesson->properties()->cmid .
+            '&mode=grade&attemptid=1', get_string('manualgrading', 'lesson'), $this->lesson->properties()->cmid);
+        $this->assertEventLegacyLogData($expected, $event);
+    }
+
+    /**
+     * Test the highscore added event.
+     *
+     * There is no external API for adding a highscore, so the unit test will simply create
+     * and trigger the event and ensure the legacy log data is returned as expected.
+     */
+    public function test_highscore_added() {
+        global $DB;
+
+        // Create a highscore.
+        $newhighscore = new stdClass;
+        $newhighscore->lessonid = $this->lesson->id;
+        $newhighscore->userid = 3;
+        $newhighscore->gradeid = 70;
+        $newhighscore->nickname = 'noob';
+
+        $newhighscore->id = $DB->insert_record('lesson_high_scores', $newhighscore);
+
+        // Create a highscore added event.
+        $event = \mod_lesson\event\highscore_added::create(array(
+            'objectid' => $newhighscore->id,
+            'context' => context_module::instance($this->lesson->properties()->cmid),
+            'courseid' => $this->course->id
+        ));
+
+        // Trigger and capture the event.
+        $sink = $this->redirectEvents();
+        $event->trigger();
+        $events = $sink->get_events();
+        $event = reset($events);
+
+        // Check that the event data is valid.
+        $this->assertInstanceOf('\mod_lesson\event\highscore_added', $event);
+        $this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
+        $expected = array($this->course->id, 'lesson', 'update highscores', 'highscores.php?id=' . $this->lesson->properties()->cmid,
+            'noob', $this->lesson->properties()->cmid);
+        $this->assertEventLegacyLogData($expected, $event);
+    }
+
+    /**
+     * Test the highscores viewed event.
+     *
+     * There is no external API for viewing highscores, so the unit test will simply create
+     * and trigger the event and ensure the legacy log data is returned as expected.
+     */
+    public function test_highscores_viewed() {
+        // Create a highscore viewed event.
+        $event = \mod_lesson\event\highscores_viewed::create(array(
+            'objectid' => $this->lesson->id,
+            'context' => context_module::instance($this->lesson->properties()->cmid),
+            'courseid' => $this->course->id
+        ));
+
+        // Trigger and capture the event.
+        $sink = $this->redirectEvents();
+        $event->trigger();
+        $events = $sink->get_events();
+        $event = reset($events);
+
+        // Check that the event data is valid.
+        $this->assertInstanceOf('\mod_lesson\event\highscores_viewed', $event);
+        $this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
+        $expected = array($this->course->id, 'lesson', 'view highscores', 'highscores.php?id=' . $this->lesson->properties()->cmid,
+            $this->lesson->properties()->name, $this->lesson->properties()->cmid);
+        $this->assertEventLegacyLogData($expected, $event);
+    }
+
+    /**
+     * Test the lesson started event.
+     */
+    public function test_lesson_started() {
+        // Trigger and capture the event.
+        $sink = $this->redirectEvents();
+        $this->lesson->start_timer();
+        $events = $sink->get_events();
+        $event = reset($events);
+
+        // Check that the event data is valid.
+        $this->assertInstanceOf('\mod_lesson\event\lesson_started', $event);
+        $this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
+        $expected = array($this->course->id, 'lesson', 'start', 'view.php?id=' . $this->lesson->properties()->cmid,
+            $this->lesson->properties()->id, $this->lesson->properties()->cmid);
+        $this->assertEventLegacyLogData($expected, $event);
+    }
+
+    /**
+     * Test the lesson ended event.
+     */
+    public function test_lesson_ended() {
+        global $DB, $USER;
+
+        // Add a lesson timer so that stop_timer() does not complain.
+        $lessontimer = new stdClass();
+        $lessontimer->lessonid = $this->lesson->properties()->id;
+        $lessontimer->userid = $USER->id;
+        $lessontimer->startime = time();
+        $lessontimer->lessontime = time();
+        $DB->insert_record('lesson_timer', $lessontimer);
+
+        // Trigger and capture the event.
+        $sink = $this->redirectEvents();
+        $this->lesson->stop_timer();
+        $events = $sink->get_events();
+        $event = reset($events);
+
+        // Check that the event data is valid.
+        $this->assertInstanceOf('\mod_lesson\event\lesson_ended', $event);
+        $this->assertEquals(context_module::instance($this->lesson->properties()->cmid), $event->get_context());
+        $expected = array($this->course->id, 'lesson', 'end', 'view.php?id=' . $this->lesson->properties()->cmid,
+            $this->lesson->properties()->id, $this->lesson->properties()->cmid);
+        $this->assertEventLegacyLogData($expected, $event);
+    }
+}
index e73435f..383e9f9 100644 (file)
@@ -179,8 +179,6 @@ if (empty($pageid)) {
         }
     }
 
-    add_to_log($course->id, 'lesson', 'start', 'view.php?id='. $cm->id, $lesson->id, $cm->id);
-
     // if no pageid given see if the lesson has been started
     $retries = $DB->count_records('lesson_grades', array("lessonid" => $lesson->id, "userid" => $USER->id));
     if ($retries > 0) {
@@ -287,7 +285,13 @@ if ($pageid != LESSON_EOL) {
         $page = $lesson->load_page($newpageid);
     }
 
-    add_to_log($PAGE->course->id, 'lesson', 'view', 'view.php?id='. $PAGE->cm->id, $page->id, $PAGE->cm->id);
+    // Trigger module viewed event.
+    $event = \mod_lesson\event\course_module_viewed::create(array(
+        'objectid' => $lesson->id,
+        'context' => $context,
+        'courseid' => $course->id
+    ));
+    $event->trigger();
 
     // This is where several messages (usually warnings) are displayed
     // all of this is displayed above the actual page
@@ -417,9 +421,6 @@ if ($pageid != LESSON_EOL) {
     // Used to check to see if the student ran out of time
     $outoftime = optional_param('outoftime', '', PARAM_ALPHA);
 
-    // Update the clock / get time information for this user
-    add_to_log($course->id, "lesson", "end", "view.php?id=".$PAGE->cm->id, "$lesson->id", $PAGE->cm->id);
-
     // We are using level 3 header because the page title is a sub-heading of lesson title (MDL-30911).
     $lessoncontent .= $OUTPUT->heading(get_string("congratulations", "lesson"), 3);
     $lessoncontent .= $OUTPUT->box_start('generalbox boxaligncenter');
@@ -428,6 +429,7 @@ if ($pageid != LESSON_EOL) {
         $ntries--;  // need to look at the old attempts :)
     }
     if (!$canmanage) {
+        // Update the clock / get time information for this user.
         $lesson->stop_timer();
         $gradeinfo = lesson_grade($lesson, $ntries);
 
index dad8f78..9e6dff7 100644 (file)
@@ -28,6 +28,16 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event for when something happens with an unknown lti service API call.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string body raw body.
+ *      @type string messageid id of message.
+ *      @type string messagetype type of message.
+ *      @type string consumerkey key of consumer.
+ *      @type string sharedsecret shared secret key.
+ * }
+ *
  * @package    mod_lti
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 5b6f439..eacdd70 100644 (file)
@@ -27,6 +27,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event for when a quiz attempt is abandoned.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int submitterid id of submitter.
+ * }
+ *
  * @package    mod_quiz
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index e6ca398..ad8a087 100644 (file)
@@ -30,6 +30,12 @@ defined('MOODLE_INTERNAL') || die();
  * Please note that the name of this event is not following the event naming convention.
  * Its name should not be used as a reference for other events to be created.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int submitterid id of submitter.
+ * }
+ *
  * @package    mod_quiz
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 83d54f5..476ca3c 100644 (file)
@@ -27,6 +27,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * Event for when a quiz attempt is submitted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int submitterid id of submitter.
+ * }
+ *
  * @package    mod_quiz
  * @copyright  2013 Adrian Greeve <adrian@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index f0d6515..7f9c991 100644 (file)
@@ -48,7 +48,7 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
     var scorm_bloody_labelclick = false;
     var scorm_nav_panel;
 
-    Y.use('button', 'dd-plugin', 'panel', 'resize', 'moodle-mod_scorm-treeview', function(Y) {
+    Y.use('button', 'dd-plugin', 'panel', 'resize', 'gallery-sm-treeview', function(Y) {
 
         Y.TreeView.prototype.getNodeByAttribute = function(attribute, value) {
             var node = null,
diff --git a/mod/scorm/thirdpartylibs.xml b/mod/scorm/thirdpartylibs.xml
deleted file mode 100644 (file)
index 0631f0d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<libraries>
-  <library>
-    <location>yui/src/treeview</location>
-    <name>Gallery SmugMug TreeView</name>
-    <license>BSD</license>
-    <version>2013.08.06-16-12</version>
-    <licenseversion></licenseversion>
-  </library>
-</libraries>
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-min.js b/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-min.js
deleted file mode 100644 (file)
index fb86e78..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable-min.js and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable.js b/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable.js
deleted file mode 100644 (file)
index 796207c..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview-sortable/moodle-mod_scorm-treeview-sortable.js and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/moodle-mod_scorm-treeview-core.css b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/moodle-mod_scorm-treeview-core.css
deleted file mode 100644 (file)
index f7c7ae1..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/moodle-mod_scorm-treeview-core.css and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder.png b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder.png
deleted file mode 100644 (file)
index 76d9d12..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder.png and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder@2x.png b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder@2x.png
deleted file mode 100644 (file)
index c18674e..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/folder@2x.png and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item.png b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item.png
deleted file mode 100644 (file)
index 33bcada..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item.png and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item@2x.png b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item@2x.png
deleted file mode 100644 (file)
index 768e579..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/item@2x.png and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css
deleted file mode 100644 (file)
index 5c4395d..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview.css b/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview.css
deleted file mode 100644 (file)
index 76dab7f..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/assets/skins/sam/moodle-mod_scorm-treeview.css and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-debug.js b/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-debug.js
deleted file mode 100644 (file)
index 0f1f26f..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-debug.js and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-min.js b/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-min.js
deleted file mode 100644 (file)
index de1fff8..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview-min.js and /dev/null differ
diff --git a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview.js b/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview.js
deleted file mode 100644 (file)
index 0f1f26f..0000000
Binary files a/mod/scorm/yui/build/moodle-mod_scorm-treeview/moodle-mod_scorm-treeview.js and /dev/null differ
diff --git a/mod/scorm/yui/src/treeview/assets/moodle-mod_scorm-treeview-core.css b/mod/scorm/yui/src/treeview/assets/moodle-mod_scorm-treeview-core.css
deleted file mode 100644 (file)
index f7c7ae1..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-.yui3-treeview,
-.yui3-treeview * {
-    -moz-box-sizing: border-box;
-    -webkit-box-sizing: border-box;
-    box-sizing: border-box;
-    -moz-user-select: none;
-    -ms-user-select: none;
-    -webkit-user-select: none;
-    user-select: none;
-}
-
-.yui3-treeview-children {
-    margin: 0;
-    padding: 0;
-    list-style: none;
-}
-
-/* This ensures that the root node is always "open". */
-.yui3-treeview-children .yui3-treeview-children { display: none; }
-
-.yui3-treeview-indicator {
-    bottom: 0;
-    left: 0;
-    position: absolute;
-    visibility: hidden;
-    top: 0;
-    width: 20px;
-}
-
-.yui3-treeview-indicator s {
-    border: 5px solid transparent;
-    border-left-color: #afafaf;
-    display: inline-block;
-    *display: none; /* Hide from IE 6-7 */
-    height: 5px;
-    left: 6px;
-    position: relative;
-    top: -1px;
-    vertical-align: middle;
-    width: 5px;
-}
-
-.yui3-treeview-label { white-space: pre; }
-.yui3-treeview-node .yui3-treeview-children { margin-left: 16px; }
-
-.yui3-treeview-row {
-    cursor: pointer;
-    overflow: hidden;
-    padding: 0 4px 0 20px;
-    position: relative;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-}
-
-/* -- Node states ----------------------------------------------------------- */
-.yui3-treeview-can-have-children > .yui3-treeview-row > .yui3-treeview-indicator { visibility: visible; }
-
-.yui3-treeview-open > .yui3-treeview-row > .yui3-treeview-indicator s {
-    border-left-color: transparent;
-    border-top-color: #afafaf;
-    left: 4px;
-    top: 2px;
-}
-
-.yui3-treeview-open > .yui3-treeview-children { display: block; }
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/folder.png b/mod/scorm/yui/src/treeview/assets/skins/sam/folder.png
deleted file mode 100644 (file)
index 76d9d12..0000000
Binary files a/mod/scorm/yui/src/treeview/assets/skins/sam/folder.png and /dev/null differ
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/folder@2x.png b/mod/scorm/yui/src/treeview/assets/skins/sam/folder@2x.png
deleted file mode 100644 (file)
index c18674e..0000000
Binary files a/mod/scorm/yui/src/treeview/assets/skins/sam/folder@2x.png and /dev/null differ
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/item.png b/mod/scorm/yui/src/treeview/assets/skins/sam/item.png
deleted file mode 100644 (file)
index 33bcada..0000000
Binary files a/mod/scorm/yui/src/treeview/assets/skins/sam/item.png and /dev/null differ
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/item@2x.png b/mod/scorm/yui/src/treeview/assets/skins/sam/item@2x.png
deleted file mode 100644 (file)
index 768e579..0000000
Binary files a/mod/scorm/yui/src/treeview/assets/skins/sam/item@2x.png and /dev/null differ
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css b/mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview-skin.css
deleted file mode 100644 (file)
index 5c4395d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*!
-Icons by Yusuke Kamiyamane <http://p.yusukekamiyamane.com/>.
-Licensed under a Creative Commons Attribution 3.0 License.
-*/
-
-.yui3-skin-sam .yui3-treeview-row > .yui3-treeview-indicator:after { content: ''; }
-
-.yui3-skin-sam .yui3-treeview-label,
-.yui3-skin-sam .yui3-treeview-row {
-    line-height: 1.6;
-}
-
-/* Page icon for all nodes by default. */
-.yui3-skin-sam .yui3-treeview-icon {
-    background: left center no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABUUlEQVQ4jY2Sv2rDMBDGT3JKl/oB2kdI3sJ7lwx9hvYZQkkIDXQuhWYOeCvdS6DP4D3dstsUZArWH/dOsRQnlk0F8onT3U/fJ2tU1zXQuFssbjFcw/D4MsZ8G63hY7WyiZHbwY2bzXy+rnBT0jQGNMLdAVmWwWa7vcclw7lzfUeA1sxQk5SgEVBhrJQChTmCCCHgfblcT2ezh6ZldwLAJkZojt+LKDqKbiB5nsNrmkIyHr+9pOkj7jydK+DUzC0GOpAkSaySOI7hM8uKjgVFClqAEISUuNoOQCvlLbTHOYQOodoQ4GCBc/olvZDoAOBdC5j0CgYgEUbVA7B3YO+BEj2QCPMqaEFKr4Da+iDWAtaGLZAC/FVDENbUhi04BQMQygct/JalXbs76IOwVu0J4KcoLr3M5kHRy2NNtFCEMJztWg8ohdhfTSbP8I+BkL1b/wF76M1c9BEbZwAAAABJRU5ErkJggg==);
-    float: left;
-    height: 1.6em; /* should match the line-height of the row and label */
-    min-height: 16px; /* to prevent the icon from being clipped */
-    width: 16px;
-}
-
-.yui3-skin-sam .yui3-treeview-label { padding-left: 6px; }
-.yui3-skin-sam .yui3-treeview-node { outline: none; }
-.yui3-skin-sam .yui3-treeview-node .yui3-treeview-children { margin-left: 20px; }
-
-.yui3-skin-sam .yui3-treeview-row {
-    background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
-    background-image: -ms-linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
-    background-image: -o-linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
-    background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
-    background-image: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
-    border: 1px solid transparent;
-    border-radius: 2px;
-    _border: none;
-}
-
-/* -- Node states ----------------------------------------------------------- */
-
-/* Light blue background for hovered nodes, except on touch devices. */
-.yui3-skin-sam .yui3-treeview-notouch .yui3-treeview-row:hover {
-    background-color: #F0F6FE;
-    border-color: #B6D4FC;
-}
-
-/* Use a folder icon for nodes that can have children. */
-.yui3-skin-sam .yui3-treeview-can-have-children > .yui3-treeview-row > .yui3-treeview-icon {
-    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABD0lEQVQ4T63TsUrDUBTG8Y+TUhfnIhQR6tC8i4uC+BBFKVGETiLUoUPQRfENXARRfApfwCVLRSlFsMTSapsmOd6vuLRJoLEOvyU3/8PhwhVVxTLE2m4g007DNpwMNv8RAHvGUSrF1v1Z/TwNz9iK2WPjsXXo3jUPZvDbVW3Xbbdf0Ov1E25P9122HCDj8QTD4fcM3++jXF6HiKDb7SR4nge2ZgCsKIqRxvc/USqtoVLZTKhWbbCdbhCGMbIMBl+pRqPgd4NYrfloUWy5QSEMFX/B9h82iLUwf3mLYrv8AJ1EqyIWisWVXNhMW3y8vtVOLm7qzctc2LAVfX5o6dO1Yxzn5LAV8yQD493o5MQm+AEX3F8P8w0R8QAAAABJRU5ErkJggg==);
-}
-
-/* Gray background for selected, unfocused nodes. */
-.yui3-skin-sam .yui3-treeview-selected > .yui3-treeview-row {
-    background-color: #E6E6E6;
-    border-color: #D9D9D9;
-}
-
-/* Blue background for selected, focused nodes and selected, hovered nodes,
-   as well as selected unfocused nodes when multiselect is enabled. */
-.yui3-skin-sam .yui3-treeview-selected:focus > .yui3-treeview-row,
-.yui3-skin-sam .yui3-treeview-children[aria-multiselectable="true"] .yui3-treeview-selected > .yui3-treeview-row,
-.yui3-skin-sam .yui3-treeview-selected > .yui3-treeview-row:hover {
-    background-color: #C9E0FC;
-    border-color: #7DA2CE;
-}
-
-/* -- High DPI styles ------------------------------------------------------- */
-@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
-    .yui3-skin-sam .yui3-treeview-icon {
-        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACJElEQVRYw8WXvW4TQRSFz11vQUEeAAo3afIEFH4HyqSgoQ2PgKxY+VEoKCOh2F0okBAFVbpIvEaKpEjvwgVWbI937qHYmWWzXsPOzgpGsvbu2HP38znHV3JKEv9zpXWbB8fHrwG8iOz9g+Q9SZAEVfH9/LwZAMmXV6PR2FoLAlCyePl7luv8ELyWxhi8v7g4dLf3wQqQhFoLY0xeA1BVWBKqmsP4qwcrQU2nU3w7ORnvj0aHAATAXSiAiAhEBACQkECSAKqbV7f092HM53MYAF9OT8dvjo7euXfumgO4xgIALSBmsxmMq6/Ozi7fDodbIbYrAOQKkMEQxhh8mkyKvVf9/uXn6+shgA+NAFQVIoJEJP9WgRCDwQDWWmRZBmst0jTF15sbG5YBZ0FbCOn10EsSkMTznR30d3d/NgZQVWd/bkFbCF9JqWczBZwFRQhjIUSKYDdWYCOEERDBChQf9ipEQiQiwRYUIWQHEOJ6hlngJyEZDSGhCmh1EkZCOAviQ9gWol0IKz/DGIjgEKq1tQq0hUhEoNYGhrCSgRiIcAXKc6Dm4aEQ4RlwchVzoAOIcAvcweIhERBt5oAIAJaCGAMRZ0EHEMEWZFn2JIRdQBQ9mwAsFou0GsIoiFLPRgDLx8eer7uAkErPvwKslssn+7EQUtPzjwBmtdqg9VPRB7O8R79X+nvGUi1JUttzK8B6vX54trf3ER0uEXloDLC4vZ3gH61free2Cmjs7ecAAAAASUVORK5CYII=);
-        background-size: contain;
-    }
-
-    .yui3-skin-sam .yui3-treeview-has-children > .yui3-treeview-row > .yui3-treeview-icon {
-        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAECklEQVRYw+1XTUtUURh+752Z68fMaBpGRQRBULZwEZo/IdpICRFBfyCIFvkBoZuCwNIW+QtatAlaiC36DdJCK0ht0ybSwCRnwhxn7j2d57znPfeO4VXDclEH7pyPe877Pu/zfpw7nlKKDrL5dMDN8/uG7ei3jsu5M/q5tMPmV/pZJEO4IrLEZ/fBiLPH2luuPh25eT9t08WBh541c2E/GeiE5VMPbj8ul79TNpulKIrYtz57F3PEWaGQp8sjkwPMhJoXBpIArunfE3uF8OLerYlKpUKe51G1WqVcLkdhGFImkzHKAQTrANfc3ExXRp8M6mOfNIDn9QCIBqfH7oxXqzV9MNQHMyQZAuHGcyqy45iujY0fVKvVjALsh3KM0QRQkpWmpibqH50c0tMJjgEo8bzreD87+3ZP1jc2NlJb2yHTVyqbWjGsB0hljIDoMFQGMM/Rq7rsy1rTTr58NDy2V/rh94WFReroOEJB0EhgD8rQgy2EOghTKjTs+L7SIEMySBwAy/L6+rqmc8PiUY520IexzEE3xvAxWnf3eZqZeU35fIv2ccG6R+RDeJQYVzVbkcFVz4CmhOkh40MoFQXwW60mFvhaecYC44MrK6vU09NDc3NvaG3t246sLS0RnTp6uP3j8tcbWugzjgENGb6Df9hHsRWYex5AVG1gMkg0Abm8/IW6urp27bre3gtD/XfHR5Mu8IV6sVqYwBi95DjWsYa98uDd6uqqSz9xnZzdKgdBq/X61gX1DHDEco81sRpugBDMJTU56HjM7vHdvjQ5bCcHomMAi+yCuHhwDrMLMId1wg7GWJeGfckzaXIAKGaA4fjif1gFi5hy5YqMWAeG0dcrjxwDNs9T5TAA5dcxgEVWkLXpxpHPJVUZnEIj9ogCiZnNTS63OMcBur0cE+BbGPA4uiPru8imHxcWUSSByWWXXP3HHOBQDeUuSJcTuWLkGwYUGIijGwck7+U2wyMCpVBJBsh+WAlAu5FjGFBxFviSBQAiAckRHCYqm2eDiZwwyYzY+siU3DQ5NgvqYwAVLrLMcEDGlPO7yNEPf0MZAyJrfc6MpU+TYy6oOAbIZkHkqBUKkx8VUv9BsdCfbEI5M+KnyjGx4ABw2mRKpTLhwyKuXHIXeBSD810g2c4GI7k0S6bmdnIqlareoMyLrDKRTw35fMGkztY6L00KimRDcg/eBUGDK9dSrLaTUywWSettYAYsANztYIC/enzTJ2s4wOF9MlvYOpW4uNadxWlySqWStkIAvJsiOtcXtLa22nylBI3yaRbV5XHs98hlR/zZpn7Zt1VOEOQAIKD30wZ6q9fZN0TF46f/6j+S8ucPan56HAD03UgB3GA/ULw/rBo0VOwTev/8f8P/AH4C4GNS2u2jtnoAAAAASUVORK5CYII=);
-    }
-}
diff --git a/mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview.css b/mod/scorm/yui/src/treeview/assets/skins/sam/moodle-mod_scorm-treeview.css
deleted file mode 100644 (file)
index 76dab7f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-.yui3-treeview,.yui3-treeview *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;user-select:none}.yui3-treeview-children{margin:0;padding:0;list-style:none}.yui3-treeview-children .yui3-treeview-children{display:none}.yui3-treeview-indicator{bottom:0;left:0;position:absolute;visibility:hidden;top:0;width:20px}.yui3-treeview-indicator s{border:5px solid transparent;border-left-color:#afafaf;display:inline-block;*display:none;height:5px;left:6px;position:relative;top:-1px;vertical-align:middle;width:5px}.yui3-treeview-label{white-space:pre}.yui3-treeview-node .yui3-treeview-children{margin-left:16px}.yui3-treeview-row{cursor:pointer;overflow:hidden;padding:0 4px 0 20px;position:relative;text-overflow:ellipsis;white-space:nowrap}.yui3-treeview-can-have-children>.yui3-treeview-row>.yui3-treeview-indicator{visibility:visible}.yui3-treeview-open>.yui3-treeview-row>.yui3-treeview-indicator s{border-left-color:transparent;border-top-color:#afafaf;left:4px;top:2px}.yui3-treeview-open>.yui3-treeview-children{display:block}/*!
-Icons by Yusuke Kamiyamane <http://p.yusukekamiyamane.com/>.
-Licensed under a Creative Commons Attribution 3.0 License.
-*/.yui3-skin-sam .yui3-treeview-row>.yui3-treeview-indicator:after{content:''}.yui3-skin-sam .yui3-treeview-label,.yui3-skin-sam .yui3-treeview-row{line-height:1.6}.yui3-skin-sam .yui3-treeview-icon{background:left center no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABUUlEQVQ4jY2Sv2rDMBDGT3JKl/oB2kdI3sJ7lwx9hvYZQkkIDXQuhWYOeCvdS6DP4D3dstsUZArWH/dOsRQnlk0F8onT3U/fJ2tU1zXQuFssbjFcw/D4MsZ8G63hY7WyiZHbwY2bzXy+rnBT0jQGNMLdAVmWwWa7vcclw7lzfUeA1sxQk5SgEVBhrJQChTmCCCHgfblcT2ezh6ZldwLAJkZojt+LKDqKbiB5nsNrmkIyHr+9pOkj7jydK+DUzC0GOpAkSaySOI7hM8uKjgVFClqAEISUuNoOQCvlLbTHOYQOodoQ4GCBc/olvZDoAOBdC5j0CgYgEUbVA7B3YO+BEj2QCPMqaEFKr4Da+iDWAtaGLZAC/FVDENbUhi04BQMQygct/JalXbs76IOwVu0J4KcoLr3M5kHRy2NNtFCEMJztWg8ohdhfTSbP8I+BkL1b/wF76M1c9BEbZwAAAABJRU5ErkJggg==);float:left;height:1.6em;min-height:16px;width:16px}.yui3-skin-sam .yui3-treeview-label{padding-left:6px}.yui3-skin-sam .yui3-treeview-node{outline:0}.yui3-skin-sam .yui3-treeview-node .yui3-treeview-children{margin-left:20px}.yui3-skin-sam .yui3-treeview-row{background-image:-moz-linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0));background-image:-ms-linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0));background-image:-o-linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0));background-image:-webkit-linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0));background-image:linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0));border:1px solid transparent;border-radius:2px;_border:0}.yui3-skin-sam .yui3-treeview-notouch .yui3-treeview-row:hover{background-color:#f0f6fe;border-color:#b6d4fc}.yui3-skin-sam .yui3-treeview-can-have-children>.yui3-treeview-row>.yui3-treeview-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABD0lEQVQ4T63TsUrDUBTG8Y+TUhfnIhQR6tC8i4uC+BBFKVGETiLUoUPQRfENXARRfApfwCVLRSlFsMTSapsmOd6vuLRJoLEOvyU3/8PhwhVVxTLE2m4g007DNpwMNv8RAHvGUSrF1v1Z/TwNz9iK2WPjsXXo3jUPZvDbVW3Xbbdf0Ov1E25P9122HCDj8QTD4fcM3++jXF6HiKDb7SR4nge2ZgCsKIqRxvc/USqtoVLZTKhWbbCdbhCGMbIMBl+pRqPgd4NYrfloUWy5QSEMFX/B9h82iLUwf3mLYrv8AJ1EqyIWisWVXNhMW3y8vtVOLm7qzctc2LAVfX5o6dO1Yxzn5LAV8yQD493o5MQm+AEX3F8P8w0R8QAAAABJRU5ErkJggg==)}.yui3-skin-sam .yui3-treeview-selected>.yui3-treeview-row{background-color:#e6e6e6;border-color:#d9d9d9}.yui3-skin-sam .yui3-treeview-selected:focus>.yui3-treeview-row,.yui3-skin-sam .yui3-treeview-children[aria-multiselectable="true"] .yui3-treeview-selected>.yui3-treeview-row,.yui3-skin-sam .yui3-treeview-selected>.yui3-treeview-row:hover{background-color:#c9e0fc;border-color:#7da2ce}@media(-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){.yui3-skin-sam .yui3-treeview-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACJElEQVRYw8WXvW4TQRSFz11vQUEeAAo3afIEFH4HyqSgoQ2PgKxY+VEoKCOh2F0okBAFVbpIvEaKpEjvwgVWbI937qHYmWWzXsPOzgpGsvbu2HP38znHV3JKEv9zpXWbB8fHrwG8iOz9g+Q9SZAEVfH9/LwZAMmXV6PR2FoLAlCyePl7luv8ELyWxhi8v7g4dLf3wQqQhFoLY0xeA1BVWBKqmsP4qwcrQU2nU3w7ORnvj0aHAATAXSiAiAhEBACQkECSAKqbV7f092HM53MYAF9OT8dvjo7euXfumgO4xgIALSBmsxmMq6/Ozi7fDodbIbYrAOQKkMEQxhh8mkyKvVf9/uXn6+shgA+NAFQVIoJEJP9WgRCDwQDWWmRZBmst0jTF15sbG5YBZ0FbCOn10EsSkMTznR30d3d/NgZQVWd/bkFbCF9JqWczBZwFRQhjIUSKYDdWYCOEERDBChQf9ipEQiQiwRYUIWQHEOJ6hlngJyEZDSGhCmh1EkZCOAviQ9gWol0IKz/DGIjgEKq1tQq0hUhEoNYGhrCSgRiIcAXKc6Dm4aEQ4RlwchVzoAOIcAvcweIhERBt5oAIAJaCGAMRZ0EHEMEWZFn2JIRdQBQ9mwAsFou0GsIoiFLPRgDLx8eer7uAkErPvwKslssn+7EQUtPzjwBmtdqg9VPRB7O8R79X+nvGUi1JUttzK8B6vX54trf3ER0uEXloDLC4vZ3gH61free2Cmjs7ecAAAAASUVORK5CYII=);background-size:contain}.yui3-skin-sam .yui3-treeview-has-children>.yui3-treeview-row>.yui3-treeview-icon{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAECklEQVRYw+1XTUtUURh+752Z68fMaBpGRQRBULZwEZo/IdpICRFBfyCIFvkBoZuCwNIW+QtatAlaiC36DdJCK0ht0ybSwCRnwhxn7j2d57znPfeO4VXDclEH7pyPe877Pu/zfpw7nlKKDrL5dMDN8/uG7ei3jsu5M/q5tMPmV/pZJEO4IrLEZ/fBiLPH2luuPh25eT9t08WBh541c2E/GeiE5VMPbj8ul79TNpulKIrYtz57F3PEWaGQp8sjkwPMhJoXBpIArunfE3uF8OLerYlKpUKe51G1WqVcLkdhGFImkzHKAQTrANfc3ExXRp8M6mOfNIDn9QCIBqfH7oxXqzV9MNQHMyQZAuHGcyqy45iujY0fVKvVjALsh3KM0QRQkpWmpibqH50c0tMJjgEo8bzreD87+3ZP1jc2NlJb2yHTVyqbWjGsB0hljIDoMFQGMM/Rq7rsy1rTTr58NDy2V/rh94WFReroOEJB0EhgD8rQgy2EOghTKjTs+L7SIEMySBwAy/L6+rqmc8PiUY520IexzEE3xvAxWnf3eZqZeU35fIv2ccG6R+RDeJQYVzVbkcFVz4CmhOkh40MoFQXwW60mFvhaecYC44MrK6vU09NDc3NvaG3t246sLS0RnTp6uP3j8tcbWugzjgENGb6Df9hHsRWYex5AVG1gMkg0Abm8/IW6urp27bre3gtD/XfHR5Mu8IV6sVqYwBi95DjWsYa98uDd6uqqSz9xnZzdKgdBq/X61gX1DHDEco81sRpugBDMJTU56HjM7vHdvjQ5bCcHomMAi+yCuHhwDrMLMId1wg7GWJeGfckzaXIAKGaA4fjif1gFi5hy5YqMWAeG0dcrjxwDNs9T5TAA5dcxgEVWkLXpxpHPJVUZnEIj9ogCiZnNTS63OMcBur0cE+BbGPA4uiPru8imHxcWUSSByWWXXP3HHOBQDeUuSJcTuWLkGwYUGIijGwck7+U2wyMCpVBJBsh+WAlAu5FjGFBxFviSBQAiAckRHCYqm2eDiZwwyYzY+siU3DQ5NgvqYwAVLrLMcEDGlPO7yNEPf0MZAyJrfc6MpU+TYy6oOAbIZkHkqBUKkx8VUv9BsdCfbEI5M+KnyjGx4ABw2mRKpTLhwyKuXHIXeBSD810g2c4GI7k0S6bmdnIqlareoMyLrDKRTw35fMGkztY6L00KimRDcg/eBUGDK9dSrLaTUywWSettYAYsANztYIC/enzTJ2s4wOF9MlvYOpW4uNadxWlySqWStkIAvJsiOtcXtLa22nylBI3yaRbV5XHs98hlR/zZpn7Zt1VOEOQAIKD30wZ6q9fZN0TF46f/6j+S8ucPan56HAD03UgB3GA/ULw/rBo0VOwTev/8f8P/AH4C4GNS2u2jtnoAAAAASUVORK5CYII=)}}#yui3-css-stamp.skin-sam-gallery-sm-treeview{display:none}
diff --git a/mod/scorm/yui/src/treeview/build.json b/mod/scorm/yui/src/treeview/build.json
deleted file mode 100644 (file)
index e9aa5b9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-    "name": "moodle-mod_scorm-treeview",
-
-    "builds": {
-        "moodle-mod_scorm-treeview": {
-            "prependfiles": [
-                "gallery-sm-treeview-debug.js"
-            ],
-            "jsfiles": [
-                "treeview.js"
-            ]
-        },
-
-        "moodle-mod_scorm-treeview-sortable": {
-            "prependfiles": [
-                "gallery-sm-treeview-debug.js"
-            ],
-            "jsfiles": [
-                "treeview-sortable.js"
-            ]
-        }
-    }
-}
diff --git a/mod/scorm/yui/src/treeview/js/treeview-sortable.js b/mod/scorm/yui/src/treeview/js/treeview-sortable.js
deleted file mode 100644 (file)
index e644841..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Y.use('gallery-sm-treeview-sortable');
diff --git a/mod/scorm/yui/src/treeview/js/treeview.js b/mod/scorm/yui/src/treeview/js/treeview.js
deleted file mode 100644 (file)
index 7b2ca1c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Y.use('gallery-sm-treeview');
diff --git a/mod/scorm/yui/src/treeview/meta/sm-treeview.json b/mod/scorm/yui/src/treeview/meta/sm-treeview.json
deleted file mode 100644 (file)
index ac33dbe..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-    "moodle-mod_scorm-treeview": {
-        "requires": [
-            "base-build",
-            "classnamemanager",
-            "template-micro",
-            "tree",
-            "tree-labelable",
-            "tree-openable",
-            "tree-selectable",
-            "view",
-            "moodle-mod_scorm-treeview-skin"
-        ]
-    },
-
-    "moodle-mod_scorm-treeview-sortable": {
-        "requires": [
-            "moodle-mod_scorm-treeview",
-            "tree-sortable"
-        ]
-    }
-}
diff --git a/mod/scorm/yui/src/treeview/readme_moodle.txt b/mod/scorm/yui/src/treeview/readme_moodle.txt
deleted file mode 100644 (file)
index 372be72..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-Description of gallery-sm-treeview integration in Moodle
-=========================================================================================
-
-Copyright: SmugMug Inc.
-License: BSD
-Repository: https://github.com/smugmug/yui-gallery.git
-
-Moodle maintainer: Andrew Nicols (dobedobedoh)
-
-=========================================================================================
-Upgrade procedure:
-* git clone https://github.com/smugmug/yui-gallery.git
-* from that repository copy:
-** build/gallery-sm-treeview/gallery-sm-treeview-debug.js to js/gallery-sm-treeview-debug.js
-** build/gallery-sm-treeview-sortable/gallery-sm-treeview-sortable-debug.js to js/gallery-sm-treeview-sortable-debug.js
-** build/gallery-sm-treeview/assets/gallery-sm-treeview-core.css to assets/moodle-mod_scorm-treeview-core.css
-** build/gallery-sm-treeview/assets/skins/sam/*.png to assets/skins/sam
-** build/gallery-sm-treeview/assets/skins/sam/gallery-sm-treeview.css to assets/skins/sam/moodle-mod_scorm-treeview.css
-** build/gallery-sm-treeview-skin/assets/skins/sam/gallery-sm-treeview-skin.css to assets/skins/sam/moodle-mod_scorm-treeview-skin.css
-* run shifter on this directory as required
-* update ../../../thirdpartylibs.xml
index bbc4a58..904039a 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki comment created event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int itemid id of item for which comment is created.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 1e3c757..48ab637 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki comment deleted event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int itemid id of item for which comment is deleted.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 44432e0..b129f37 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki page deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int subwikiid id subwiki.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 487ae03..a1d69a8 100644 (file)
@@ -28,6 +28,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki diff viewed event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int comparewith version number to compare with.
+ *      @type int compare version number to compare.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index b7cead2..5aee13b 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki page locks deleted (override locks)
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int section section id.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 251b7c2..8b94fd4 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki map viewed event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int option map option viewed.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 2c9737f..e39aa34 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki page updated.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string newcontent updated content.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index dc0b6ce..622d8e1 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki page version deleted.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int pageid id wiki page.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 435e009..601c635 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki version restored event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int pageid id wiki page.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 8239c43..c641933 100644 (file)
@@ -28,6 +28,12 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_wiki version viewed event.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type int versionid id page version.
+ * }
+ *
  * @package    mod_wiki
  * @copyright  2013 Rajesh Taneja <rajesh@moodle.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index a1c3f53..bef08cd 100644 (file)
@@ -29,6 +29,13 @@ defined('MOODLE_INTERNAL') || die();
 /**
  * mod_workshop assessable uploaded event class.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type array pathnamehashes uploaded files path name hashes.
+ *      @type string content string.
+ * }
+ *
  * @package    mod_workshop
  * @copyright  2013 Frédéric Massart
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index a5a0510..b6d677e 100644 (file)
@@ -26,6 +26,13 @@ namespace report_log\event;
 /**
  * Event triggered, when some content in log report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ *      @type string url (optional) url of report page.
+ * }
+ *
  * @package    report_log
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 1038322..8dea5b2 100644 (file)
@@ -26,6 +26,13 @@ namespace report_loglive\event;
 /**
  * Event triggered, when some content in loglive report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ *      @type string url (optional) url of report page.
+ * }
+ *
  * @package    report_loglive
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 97f1b0d..8ae1618 100644 (file)
@@ -26,6 +26,13 @@ namespace report_outline\event;
 /**
  * Event for when some content in outline report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ *      @type string url (optional) url of report page.
+ * }
+ *
  * @package    report_outline
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 1702628..5918f57 100644 (file)
@@ -26,6 +26,13 @@ namespace report_participation\event;
 /**
  * Event triggered, when some content in participation report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ *      @type string url (optional) url of report page.
+ * }
+ *
  * @package    report_participation
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index e29544c..836cde8 100644 (file)
@@ -26,6 +26,13 @@ namespace report_stats\event;
 /**
  * Event triggered, when some content in stats report is viewed.
  *
+ * @property-read array $other {
+ *      Extra information about event.
+ *
+ *      @type string content viewed content identifier.
+ *      @type string url (optional) url of report page.
+ * }
+ *
  * @package    report_stats
  * @copyright  2013 Ankit Agarwal
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
index 92913bd..c19a9f1 100644 (file)
@@ -288,7 +288,17 @@ while (count($parts)) {
         $contentfile = "$CFG->libdir/yuilib/$part";
 
     } else if ($version == 'gallery') {
-        $contentfile = "$CFG->libdir/yui/$part";
+        if (count($bits) <= 2) {
+            // This is an invalid module load attempt.
+            $content .= "\n// Incorrect moodle module inclusion. Not enough component information in {$part}.\n";
+            continue;
+        }
+        $revision = (int)array_shift($bits);
+        if ($revision === -1) {
+            // Revision -1 says please don't cache the JS
+            $cache = false;
+        }
+        $contentfile = "$CFG->libdir/yuilib/gallery/" . join('/', $bits);
 
     } else if ($version == 'yuiuseall') {
         // Create global Y that is available in global scope,
@@ -341,8 +351,12 @@ while (count($parts)) {
             $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', $relroot.'/theme/yui_image.php'.$sep.$CFG->yui2version.'/$1.$2', $filecontent);
 
         } else if ($version == 'gallery') {
-            // search for all images in gallery module CSS and serve them through the yui_image.php script
-            $filecontent = preg_replace('/([a-z0-9_-]+)\.(png|gif)/', $relroot.'/theme/yui_image.php'.$sep.$version.'/'.$bits[0].'/'.$bits[1].'/$1.$2', $filecontent);
+            // Replace any references to the CDN with a relative link.
+            $filecontent = preg_replace('#(' . preg_quote('http://yui.yahooapis.com/') . '(gallery-[^/]*/))#', '../../../../', $filecontent);
+
+            // Replace all relative image links with the a link to yui_image.php.
+            $filecontent = preg_replace('#(' . preg_quote('../../../../') . ')(gallery-[^/]*/assets/skins/sam/[a-z0-9_-]+)\.(png|gif)#',
+                    $relroot . '/theme/yui_image.php' . $sep . '/gallery/' . $revision . '/$2.$3', $filecontent);
 
         } else {
             // First we need to remove relative paths to images. These are used by YUI modules to make use of global assets.
index 2bb712c..ee89461 100644 (file)
@@ -60,9 +60,9 @@ if ($version == 'moodle' && count($parts) >= 3) {
     if (!file_exists($imagepath) or !is_file($imagepath)) {
         $imagepath = $dir . '/yui/' . $module . '/assets/skins/sam/' . $image;
     }
-} else if ($version == 'gallery' && count($parts)==3) {
-    list($module, $version, $image) = $parts;
-    $imagepath = "$CFG->dirroot/lib/yui/gallery/$module/$version/assets/skins/sam/$image";
+} else if ($version == 'gallery' && count($parts) >= 3) {
+    list($revision, $module, , , , $image) = $parts;
+    $imagepath = "$CFG->dirroot/lib/yuilib/gallery/$module/assets/skins/sam/$image";
 } else if (count($parts) == 1 && ($version == $CFG->yui3version || $version == $CFG->yui2version)) {
     list($image) = $parts;
     if ($version == $CFG->yui3version) {