author David Monllao Tue, 5 May 2015 02:51:30 +0000 (10:51 +0800) committer David Monllao Tue, 5 May 2015 02:51:30 +0000 (10:51 +0800)
133 files changed:

index ab8911a..5867711 100644 (file)
@@ -27,9 +27,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp 'customusermenuitems', new lang_string('customusermenuitems', 'admin'), new lang_string('configcustomusermenuitems', 'admin'), - 'mygrades,grades|/grade/report/mygrades.php|grades + 'grades,grades|/grade/report/mygrades.php|grades messages,message|/message/index.php|message -mypreferences,moodle|/user/preferences.php|preferences', +preferences,moodle|/user/preferences.php|preferences', PARAM_TEXT, '50', '10' index 06630ea..6e19659 100644 (file) @@ -108,7 +108,7 @@ if (extension_loaded('pcntl')) {$time = microtime(true);
array_walk($unrecognised, function (&$v) {
-    if ($x = preg_filter("#^(-+\w+)=(.+)#", "\$1='\$2'",$v)) {
+    if ($x = preg_filter("#^(-+\w+)=(.+)#", "\$1=\"\$2\"",$v)) {
$v =$x;
} else if (!preg_match("#^-#", $v)) {$v = escapeshellarg($v); @@ -124,7 +124,7 @@ if ($options['profile']) {
echo "Invalid profile passed: " . $profile; exit(1); } -$extraopts[] = '--profile=\'' . $profile . "'"; +$extraopts[] = '--profile="' . $profile . '"'; // By default, profile tags will be used. if (!empty($CFG->behat_config[$profile]['filters']['tags'])) {$tags = $CFG->behat_config[$profile]['filters']['tags'];
index 905e23b..6a15dd4 100644 (file)
@@ -349,7 +349,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I expand "Setup" node
And I follow "Categories and items"
Then I should see "Test Grade Item 1"
@@ -380,7 +380,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I follow "Scales"
Then I should see "Test Scale 1"
And I should see "Disappointing,  Good,  Very good,  Excellent"
@@ -432,7 +432,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I expand "Setup" node
And I follow "Categories and items"
Then I should see "Test Outcome Grade Item 1"
index 9aa451f..20c3c29 100644 (file)
@@ -7,7 +7,7 @@ Feature: Forms manipulation
@javascript
Scenario: Basic forms manipulation
Given I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Edit profile"
When I set the field "First name" to "Field value"
And I set the field "Select a country" to "Japan"
index f6cdb33..41fac8d 100644 (file)
@@ -10,7 +10,7 @@ Feature: Transform steps arguments
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Edit profile"

@javascript
index c0c031a..b298abf 100644 (file)
@@ -215,17 +215,13 @@ class rules extends \table_sql implements \renderable {
return false;
}
$orderby = 'visible DESC, sortorder ASC'; -$options = array();
+        $options = array(0 => get_string('site')); if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) { foreach ($courses as $course) {$options[$course->id] = format_string($course->fullname, true,
array('context' => \context_course::instance($course->id))); } } - // If there are no options to display, then don't display anything. - if (count($options) === 0) {
-            return false;
-        }
$url = new \moodle_url('/admin/tool/monitor/index.php');$select = new \single_select($url, 'courseid',$options, $this->courseid);$select->set_label(get_string('selectacourse', 'tool_monitor'));
index 5dcc916..84f1ea6 100644 (file)
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php'); -$courseid = optional_param('courseid', SITEID, PARAM_INT);
+$courseid = optional_param('courseid', 0, PARAM_INT);$action = optional_param('action', '', PARAM_ALPHA);
$cmid = optional_param('cmid', 0, PARAM_INT);$ruleid = optional_param('ruleid', 0, PARAM_INT);
$subscriptionid = optional_param('subscriptionid', 0, PARAM_INT);$confirm = optional_param('confirm', false, PARAM_BOOL);

-
-// We need to explicitly check that the course id is something legitimate.
+// Validate course id.
if (empty($courseid)) { -$courseid = SITEID;
+    $context = context_system::instance(); +} else { + // They might want to see rules for this course. +$course = get_course($courseid); + require_login($course);
+    $context = context_course::instance($course->id);
+    // Check for caps.
+    require_capability('tool/monitor:subscribe', $context); } -$coursecontext = context_course::instance($courseid); - if (!get_config('tool_monitor', 'enablemonitor')) { // This should never happen as the this page does not appear in navigation when the tool is disabled. throw new coding_exception('Event monitoring is disabled'); } +// Use the user context here so that the header shows user information.$PAGE->set_context(context_user::instance($USER->id)); // Set up the page. @@ -85,7 +90,7 @@ if (!empty($action)) {
} else {
$subscription = \tool_monitor\subscription_manager::get_subscription($subscriptionid);
echo $OUTPUT->header(); - echo$OUTPUT->confirm(get_string('subareyousure', 'tool_monitor', $subscription->get_name($coursecontext)),
+                echo $OUTPUT->confirm(get_string('subareyousure', 'tool_monitor',$subscription->get_name($context)),$confirmurl, $cancelurl); echo$OUTPUT->footer();
exit();
@@ -121,14 +126,11 @@ if (!empty($totalsubs)) { } // Render the potential rules list. -// Check the capability here before displaying any rules to subscribe to. -if (has_capability('tool/monitor:subscribe',$coursecontext)) {
-    echo $OUTPUT->heading(get_string('rulescansubscribe', 'tool_monitor'), 3); - echo$renderer->render($rules); -} +echo$OUTPUT->heading(get_string('rulescansubscribe', 'tool_monitor'), 3);
+echo $renderer->render($rules);

// Check if the user can manage the course rules we are viewing.
-$canmanagerules = has_capability('tool/monitor:managerules',$coursecontext);
+$canmanagerules = has_capability('tool/monitor:managerules',$context);

if (empty($totalrules)) { // No rules present. Show a link to manage rules page if permissions permit. index 4091ef2..cbce856 100644 (file) @@ -79,14 +79,7 @@ function tool_monitor_extend_navigation_user_settings($navigation, $user,$userc

// Don't show the setting if the event monitor isn't turned on. No access to other peoples subscriptions.
if (get_config('tool_monitor', 'enablemonitor') && $USER->id ==$user->id) {
-        // The $course->id will always be the course that corresponds to the current context. -$courseid = $course->id; - // A$course->id of $SITE->id might either be the frontpage or the site. So if we get the site ID back, check the... - // ...courseid parameter passed to the page so we can know if we are looking at the frontpage rules or site level rules. - if ($course->id == $SITE->id && optional_param('courseid',$course->id, PARAM_INT) == 0) {
-            $courseid = 0; - } -$url = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid)); +$url = new moodle_url('/admin/tool/monitor/index.php');
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'),$url,
navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));

index 27029aa..f9d58ff 100644 (file)
@@ -55,7 +55,7 @@ Feature: tool_monitor_subscriptions

Scenario: Subscribe to a rule on course level
Given I log in as "teacher1"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
When I follow "Subscribe to rule \"New rule course level\""
@@ -64,7 +64,7 @@ Feature: tool_monitor_subscriptions

Scenario: Delete a subscription on course level
Given I log in as "teacher1"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I follow "Subscribe to rule \"New rule course level\""
@@ -77,7 +77,7 @@ Feature: tool_monitor_subscriptions

Scenario: Subscribe to a rule on site level
Given I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Acceptance test site"
When I follow "Subscribe to rule \"New rule site level\""
@@ -86,7 +86,7 @@ Feature: tool_monitor_subscriptions

Scenario: Delete a subscription on site level
Given I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Acceptance test site"
And I follow "Subscribe to rule \"New rule site level\""
@@ -100,11 +100,11 @@ Feature: tool_monitor_subscriptions

Scenario: Receiving notification on site level
Given I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Messaging"
And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
And I press "Save changes"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Acceptance test site"
And I follow "Subscribe to rule \"New rule site level\""
@@ -119,11 +119,11 @@ Feature: tool_monitor_subscriptions

Scenario: Receiving notification on course level
Given I log in as "teacher1"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Messaging"
And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
And I press "Save changes"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I follow "Subscribe to rule \"New rule course level\""
@@ -139,7 +139,7 @@ Feature: tool_monitor_subscriptions

Scenario: Navigating via quick link to rules
Given I log in as "admin"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
When I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
Then I should see "You can manage rules from the Event monitoring rules page."
@@ -147,7 +147,7 @@ Feature: tool_monitor_subscriptions
And I should see "You can subscribe to rules from the Event monitoring page."
And I log out
And I log in as "teacher1"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I should see "You can manage rules from the Event monitoring rules page."
@@ -159,7 +159,7 @@ Feature: tool_monitor_subscriptions
And I should not see "You can manage rules from the Event monitoring rules page."
And I log out
And I log in as "teacher2"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I should not see "You can manage rules the from the Event monitoring rules page."
@@ -170,7 +170,7 @@ Feature: tool_monitor_subscriptions
| tool/monitor:managerules | Prohibit |
And I log out
And I log in as "teacher1"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
When I set the field "Select a course" to "Course 1"
Then I should see "You can manage rules from the Event monitoring rules page."
@@ -178,7 +178,7 @@ Feature: tool_monitor_subscriptions
And I should not see "You can manage rules from the Event monitoring rules page."
And I log out
And I log in as "teacher2"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I should not see "You can manage rules from the Event monitoring rules page."
index c818c86..a2cf302 100644 (file)
@@ -23,6 +23,7 @@
*/
namespace tool_templatelibrary;

+use core\output\mustache_template_finder;
use stdClass;
use core_component;
use coding_exception;
@@ -41,51 +42,64 @@ class api {
*
* @param string $component Filter the list to a single component. * @param string$search Search string to optionally filter the list of templates.
+     * @param string $themename The name of the current theme. * @return array[string] Where each template is in the form "component/templatename". */ - public static function list_templates($component = '', $search = '') { + public static function list_templates($component = '', $search = '',$themename = '') {
global $CFG;$templatedirs = array();
$results = array(); - if ($component != '') {
+        if ($component !== '') { // Just look at one component for templates. -$dir = core_component::get_component_directory($component); - if (!$dir) {
-                return $templatedirs; - } +$dirs = mustache_template_finder::get_template_directories_for_component($component,$themename);

-            $templatedirs[$component] = $dir . '/templates'; +$templatedirs[$component] =$dirs;
} else {

-            // Look at all the templates dirs for all installed plugins.
-            $dir =$CFG->libdir . '/templates';
-            if (!empty($dir) && is_dir($dir)) {
-                $templatedirs['core'] =$dir;
+            // Look at all the templates dirs for core.
+            $templatedirs['core'] = mustache_template_finder::get_template_directories_for_component('core',$themename);
+
+            // Look at all the templates dirs for subsystems.
+            $subsystems = core_component::get_core_subsystems(); + foreach ($subsystems as $subsystem =>$dir) {
+                $dir .= '/templates'; + if (is_dir($dir)) {
+                    $dirs = mustache_template_finder::get_template_directories_for_component('core_' .$subsystem, $themename); +$templatedirs['core_' . $subsystem] =$dirs;
+                }
}
+
+            // Look at all the templates dirs for plugins.
$plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $type =>$dir) {
$plugins = core_component::get_plugin_list_with_file($type, 'templates', false);
foreach ($plugins as$plugin => $dir) { if (!empty($dir) && is_dir($dir)) { -$templatedirs[$type . '_' .$plugin] = $dir; +$pluginname = $type . '_' .$plugin;
+                        $dirs = mustache_template_finder::get_template_directories_for_component($pluginname, $themename); +$templatedirs[$pluginname] =$dirs;
}
}
}
}

-        foreach ($templatedirs as$templatecomponent => $dir) { - // List it. -$files = glob($dir . '/*.mustache'); + foreach ($templatedirs as $templatecomponent =>$dirs) {
+            foreach ($dirs as$dir) {
+                // List it.
+                $files = glob($dir . '/*.mustache');

-            foreach ($files as$file) {
-                $templatename = basename($file, '.mustache');
-                if ($search == '' || strpos($templatename, $search) !== false) { -$results[] = $templatecomponent . '/' .$templatename;
+                foreach ($files as$file) {
+                    $templatename = basename($file, '.mustache');
+                    if ($search == '' || strpos($templatename, $search) !== false) { +$results[$templatecomponent . '/' .$templatename] = 1;
+                    }
}
}
}
+        $results = array_keys($results);
+        sort($results); return$results;
}

index 8377e8b..cecf9cb 100644 (file)
@@ -59,8 +59,8 @@ class list_templates_page implements renderable, templatable {
foreach ($components as$component) {
$info = new stdClass();$info->component = $component; - if ($component == 'core') {
-                $info->name = get_string('core_component', 'tool_templatelibrary'); + if (strpos($component, 'core') === 0) {
+                $info->name = get_string('coresubsystem', 'tool_templatelibrary',$component);
} else {
$info->name =$pluginmanager->plugin_name($component); } index 87b8ea0..8cc6736 100644 (file) @@ -24,7 +24,7 @@$string['all'] = 'All components';
$string['component'] = 'Component'; -$string['core_component'] = 'Moodle core';
+$string['coresubsystem'] = 'Subsystem ({$a})';
$string['documentation'] = 'Documentation';$string['example'] = 'Example';
$string['noresults'] = 'No results'; index c6bb7e8..c2222f0 100644 (file) @@ -47,7 +47,7 @@ if (empty($CFG->badges_allowexternalbackpack)) {
$PAGE->set_url(new moodle_url('/badges/mybackpack.php'));$PAGE->set_context($context); -$title = get_string('mybackpack', 'badges');
+$title = get_string('backpackdetails', 'badges');$PAGE->set_title($title);$PAGE->set_heading(fullname($USER));$PAGE->set_pagelayout('mydashboard');
index e7c7361..e523b3e 100644 (file)
@@ -86,7 +86,7 @@ require_capability('moodle/badges:manageownbadges', $context);$PAGE->set_context($context); -$title = get_string('mybadges', 'badges');
+$title = get_string('badges', 'badges');$PAGE->set_title($title);$PAGE->set_heading(fullname($USER));$PAGE->set_pagelayout('mydashboard');
index a6a5f59..de5c447 100644 (file)
@@ -91,7 +91,7 @@ if ($form->is_cancelled()) {$fordb->courseid = ($type == BADGE_TYPE_COURSE) ?$courseid : null;
$fordb->messagesubject = get_string('messagesubject', 'badges');$fordb->message = get_string('messagebody', 'badges',
-            html_writer::link($CFG->wwwroot . '/badges/mybadges.php', get_string('mybadges', 'badges'))); + html_writer::link($CFG->wwwroot . '/badges/mybadges.php', get_string('managebadges', 'badges')));
$fordb->attachment = 1;$fordb->notification = BADGE_MESSAGE_NEVER;
$fordb->status = BADGE_STATUS_INACTIVE; index abfe6cd..67905f7 100644 (file) @@ -31,12 +31,12 @@ Feature: Award badges And I press "Enable access" And I press "Continue" And I click on "Admin User" "link" - And I follow "My profile" in the open menu + And I follow "Profile" in the open menu And I follow "Edit profile" And I expand all fieldsets And I set the field "Phone" to "123456789" And I press "Update profile" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu Then I should see "Profile Badge" And I should not see "There are no badges available." @@ -69,7 +69,7 @@ Feature: Award badges Then I should see "Recipients (2)" And I log out And I log in as "student" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu Then I should see "Site Badge" @javascript @@ -112,7 +112,7 @@ Feature: Award badges Then I should see "Recipients (2)" And I log out And I log in as "student1" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Course 1" And I should see "Course Badge" @@ -157,13 +157,13 @@ Feature: Award badges When I press "Continue" And I log out And I log in as "student1" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Course 1" Then I should not see "badges" And I am on homepage And I follow "Course 1" And I press "Mark as complete: Test assignment name" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Course 1" Then I should see "Course Badge" @@ -214,7 +214,7 @@ Feature: Award badges When I press "Continue" And I log out And I log in as "student1" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Course 1" Then I should not see "badges" And I am on homepage @@ -232,5 +232,5 @@ Feature: Award badges And I am on site homepage And I log out And I log in as "student1" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu Then I should see "Course Badge" index 9306404..d55ae9a 100644 (file) @@ -32,7 +32,7 @@ Feature: The activity results block displays student scores | Description | Offline text | | assignsubmission_file_enabled | 0 | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment" index b40962e..b744851 100644 (file) @@ -32,7 +32,7 @@ Feature: The activity results block displays student scores | Description | Offline text | | assignsubmission_file_enabled | 0 | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment" index 715db54..3939bd6 100644 (file) @@ -54,7 +54,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -97,7 +97,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -144,7 +144,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -191,7 +191,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -245,7 +245,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -298,7 +298,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -351,7 +351,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -402,7 +402,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" index a78ce6c..845e8ab 100644 (file) @@ -54,7 +54,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -97,7 +97,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -142,7 +142,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -187,7 +187,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -237,7 +237,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -286,7 +286,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -335,7 +335,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -382,7 +382,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" index b402741..c20061f 100644 (file) @@ -32,7 +32,7 @@ Feature: The activity results block displays student scores | Description | Offline text | | assignsubmission_file_enabled | 0 | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment" index 8027bcd..f18ccf8 100644 (file) @@ -54,7 +54,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -97,7 +97,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -144,7 +144,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -191,7 +191,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -243,7 +243,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -294,7 +294,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -345,7 +345,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -395,7 +395,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Separate groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" index 787f65f..e02d58d 100644 (file) @@ -54,7 +54,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -97,7 +97,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -142,7 +142,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -187,7 +187,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -239,7 +239,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -286,7 +286,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -333,7 +333,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" @@ -379,7 +379,7 @@ Feature: The activity results block displays student scores | assignsubmission_file_enabled | 0 | | Group mode | Visible groups | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment" index abcdc46..eee5e88 100644 (file) @@ -15,7 +15,7 @@ // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** - * My latest badges block capabilities. + * Latest badges block capabilities. * * @package block_badges * @copyright 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/} index 09f3230..ba4adaf 100644 (file) @@ -23,7 +23,7 @@ * @author Yuliya Bozhko <yuliya.bozhko@totaralms.com> */ -$string['pluginname'] = 'My latest badges';
+$string['pluginname'] = 'Latest badges';$string['numbadgestodisplay'] = 'Number of latest badges to display';
$string['nothingtodisplay'] = 'You have no badges to display';$string['badges:addinstance'] = 'Add a new My latest badges block';
index 41e5c7d..fba8113 100644 (file)
@@ -63,7 +63,7 @@ class block_private_files extends block_base {
if (has_capability('moodle/user:manageownfiles', $this->context)) {$this->content->footer = html_writer::link(
new moodle_url('/user/files.php', array('returnurl' => $PAGE->url->out())), - get_string('myfilesmanage') . '...'); + get_string('privatefilesmanage') . '...'); } } index c3c76f8..6adb60b 100644 (file) @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'My private files';
+$string['pluginname'] = 'Private files';$string['privatefiles'] = 'Private files';
$string['private_files:addinstance'] = 'Add a new private files block'; -$string['private_files:myaddinstance'] = 'Add a new my private files block to Dashboard';
+$string['private_files:myaddinstance'] = 'Add a new private files block to Dashboard'; index 35bab0c..1f5217a 100644 (file) @@ -63,8 +63,10 @@ if ($entryid and !isset($userid)) {$userid = $entry->userid; } -if (isset($userid)) {
+if (isset($userid) && !isset($courseid)) {
$context = context_user::instance($userid);
+} else if (isset($courseid) &&$courseid != SITEID) {
+    $context = context_course::instance($courseid);
} else {
$context = context_system::instance(); } @@ -241,11 +243,32 @@ if ($CFG->enablerssfeeds) {
blog_rss_add_http_header($rsscontext,$rsstitle, $filtertype,$thingid, $tagid); } } -if (isset($userid)) {
+
+$usernode =$PAGE->navigation->find('user'.$userid, null); +if ($usernode && $courseid != SITEID) { +$courseblogsnode = $PAGE->navigation->find('courseblogs', null); + if ($courseblogsnode) {
+        $courseblogsnode->remove(); + } +$blogurl = new moodle_url($PAGE->url); +$blognode = $usernode->add(get_string('blogscourse', 'blog'),$blogurl);
+    $blognode->make_active(); +} + +if ($courseid != SITEID) {
+    $PAGE->set_heading($course->fullname);
+    echo $OUTPUT->header(); + if (!empty($user)) {
+        $headerinfo = array('heading' => fullname($user), 'user' => $user); + echo$OUTPUT->context_header($headerinfo, 2); + } +} else if (isset($userid)) {
$PAGE->set_heading(fullname($user));
+    echo $OUTPUT->header(); +} else if ($courseid == SITEID) {
+    echo $OUTPUT->header(); } -echo$OUTPUT->header();
echo $OUTPUT->heading($blogheaders['heading'], 2);

$bloglisting = new blog_listing($blogheaders['filters']);
index 930fd09..50eaa35 100644 (file)
@@ -420,7 +420,7 @@ function blog_get_options_for_user(stdClass $user=null) { if ($canview) {
// We can view our own blogs .... BIG surprise.
$options['view'] = array( - 'string' => get_string('viewallmyentries', 'blog'), + 'string' => get_string('blogentries', 'blog'), 'link' => new moodle_url('/blog/index.php', array('userid'=>$USER->id))
);
}
@@ -770,8 +770,6 @@ function blog_get_headers($courseid=null,$groupid=null, $userid=null,$tagid=nu
$blogurl->param('userid',$userid);
$blogurl->param('courseid',$courseid);

-        $PAGE->navbar->add($strblogentries, $blogurl); -$PAGE->set_title($course->fullname);$PAGE->set_heading($course->fullname); @@ -1036,11 +1034,11 @@ function core_blog_myprofile_navigation(core_user\output\myprofile\tree$tree, url->param('courseid', $course->id); } if ($iscurrentuser) {
-        $title = get_string('myprofilemyblogs', 'core_blog'); +$title = get_string('blogentries', 'core_blog');
} else {
$title = get_string('myprofileuserblogs', 'core_blog'); }$blognode = new core_user\output\myprofile\node('miscellaneous', 'blogs', $title, null,$url);
$tree->add_node($blognode);
return true;
-}
\ No newline at end of file
+}
index 03a5101..529ae6a 100644 (file)
@@ -34,7 +34,7 @@ Feature: Browse course list and return back from enrolment page
@javascript
Scenario: A user can return to the previous page from enrolment page by clicking navigation links
When I log in as "user2"
-    And I follow "My preferences" in the user menu
+    And I follow "Preferences" in the user menu
And I follow "Edit profile"
And I expand "Courses" node
And I expand "Sample category" node
@@ -134,9 +134,9 @@ switch ($mode) { require_once($CFG->dirroot . '/user/lib.php');
// Make the dashboard active so that it shows up in the navbar correctly.
$gradenode =$PAGE->settingsnav->find('dashboard', null)->make_active();
-            // Get the correct 'My grades' url to point to.
+            // Get the correct 'Grades' url to point to.
$activeurl = user_mygrades_url(); -$navbar = $PAGE->navbar->add(get_string('mygrades', 'grades'),$activeurl, navigation_node::TYPE_SETTING);
+            $navbar =$PAGE->navbar->add(get_string('grades', 'grades'), $activeurl, navigation_node::TYPE_SETTING);$activenode = $navbar->add($course->shortname);
$activenode->make_active(); // Find the course node and collapse it. index 2a80e41..99fc29c 100644 (file) @@ -21,7 +21,7 @@ Feature: I need to export grades as text | assign | C1 | a1 | Test assignment name | Submit your online text | 1 | And I log in as "teacher1" And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name" And I press "Save changes" index 18e92e9..9048755 100644 (file) @@ -21,7 +21,7 @@ Feature: I need to export grades as xml | assign | C1 | a1 | Test assignment name | Submit something! | And I log in as "teacher1" And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I turn editing mode on And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name" And I press "Save changes" index 131d1ee..434c8b8 100644 (file) @@ -2637,7 +2637,6 @@ abstract class grade_helper { * letter => get_string('letters', 'grades'), * export => get_string('export', 'grades'), * import => get_string('import'), - * preferences => get_string('mypreferences', 'grades'), * settings => get_string('settings') * * @return array @@ -2741,7 +2740,7 @@ abstract class grade_helper { if (file_exists($plugindir.'/preferences.php')) {
$url = new moodle_url('/grade/report/'.$plugin.'/preferences.php', array('id'=>$courseid));$gradepreferences[$plugin] = new grade_plugin_info($plugin, $url, - get_string('mypreferences', 'grades') . ': ' .$pluginstr);
+                    get_string('preferences', 'grades') . ': ' . $pluginstr); } } if (count($gradereports) == 0) {
index b15c66a..238fbf6 100644 (file)
@@ -30,7 +30,7 @@ Feature: A teacher checks the grade history report in a course
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Rewarding assignment |
| Description | After writing your behat test go grab a beer! |
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "The greatest assignment ever"
And I give the grade "60.00" to the user "Student 1" for the grade item "Rewarding assignment"
@@ -40,7 +40,7 @@ Feature: A teacher checks the grade history report in a course
And I log out
And I log in as "teacher2"
And I follow "Course 1"
And I turn editing mode on
And I give the grade "70.00" to the user "Student 1" for the grade item "The greatest assignment ever"
And I give the grade "80.00" to the user "Student 1" for the grade item "Rewarding assignment"
index bd30489..59c241c 100644 (file)
@@ -354,7 +354,7 @@ abstract class grade_report {
}

/**
-     * Shows support for being used as a 'My grades' report.
+     * Shows support for being used as a 'Grades' report.
*/
return false;
index ab7c3a5..15954dc 100644 (file)
@@ -169,7 +169,7 @@ if (has_capability('moodle/grade:viewall', $context) &&$courseid != SITEID) {
// Display a standard page.
if ($courseid == SITEID) {$PAGE->set_pagelayout('standard');
-            $header = get_string('mygrades', 'grades') . ' - ' . fullname($report->user);
+            $header = get_string('grades', 'grades') . ' - ' . fullname($report->user);
$PAGE->set_title($header);
$PAGE->set_heading(fullname($report->user));

@@ -196,7 +196,7 @@ if (has_capability('moodle/grade:viewall', $context) &&$courseid != SITEID) {
}
} else {
$PAGE->set_pagelayout('standard'); -$header = get_string('mygrades', 'grades') . ' - ' . fullname($report->user); +$header = get_string('grades', 'grades') . ' - ' . fullname($report->user);$PAGE->set_title($header);$PAGE->set_heading(fullname($report->user)); echo$OUTPUT->header();
index 0c9dc3a..7977698 100644 (file)
}

/**
-     * This report supports being set as the 'my grades' report.
+     * This report supports being set as the 'grades' report.
*/
return true;
index 29d50ab..357cb57 100644 (file)
@@ -46,7 +46,7 @@ Feature: We can use Single view
| Test grade item | C1 | Scale |
And I log in as "teacher1"
And I follow "Course 1"

@javascript
index e6b534b..72b1feb 100644 (file)
@@ -20,7 +20,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on

@javascript
@@ -32,7 +32,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And I press "Save changes"
And I am on site homepage
And I follow "Course 1"
And I click on "Edit  assign Assignment1" "link"
And I should not see "Minimum grade"

@@ -44,7 +44,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And I press "Save changes"
And I am on site homepage
And I follow "Course 1"
Then "Edit calculation for   Course total" "link" should not exist

@javascript
@@ -55,5 +55,5 @@ Feature: Site settings can be used to hide parts of the gradebook UI
And I press "Save changes"
And I am on site homepage
And I follow "Course 1"
And "tr .course input[type='text']" "css_element" should not exist
index 527c388..e87d71b 100644 (file)
@@ -42,7 +42,7 @@ Feature: We can use calculated grade totals
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
@@ -78,7 +78,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "30.42 (30.42 %)" in the "overview-grade" "table"

@javascript
@@ -101,7 +101,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "26.94 (26.94 %)" in the "overview-grade" "table"

@javascript
@@ -122,7 +122,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "48.57 (48.57 %)" in the "overview-grade" "table"

@javascript
@@ -143,7 +143,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "47.22 (47.22 %)" in the "overview-grade" "table"

@javascript
@@ -162,7 +162,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "25.83 (25.83 %)" in the "overview-grade" "table"

@javascript
@@ -185,7 +185,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "0.00 (0.00 %)" in the "overview-grade" "table"

@javascript
@@ -206,7 +206,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "50.00 (50.00 %)" in the "overview-grade" "table"

@javascript
@@ -227,7 +227,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
And I should see "50.00 (50.00 %)" in the "overview-grade" "table"

@javascript
@@ -243,7 +243,6 @@ Feature: We can use calculated grade totals
And the following "grade items" exist:
| itemname              | course | outcome | gradetype | scale      |
| Test outcome item one | C1     | OT1     | Scale     | Test Scale |
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
@@ -259,28 +258,28 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
Then I should see "114.82 (18.27 %)" in the "overview-grade" "table"
And I follow "Course 1"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Test outcome item one":
| Extra credit     | 1   |
And I log out
And I log in as "student1"
Then I should see "114.00 (18.39 %)" in the "overview-grade" "table"
And I follow "Course 1"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
@@ -288,7 +287,7 @@ Feature: We can use calculated grade totals
| Include outcomes in aggregation | 0       |
And I log out
And I log in as "student1"
Then I should see "110.00 (17.74 %)" in the "overview-grade" "table"
And I follow "Course 1"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
@@ -306,7 +305,7 @@ Feature: We can use calculated grade totals
And the following "grade items" exist:
| itemname              | course | outcome | gradetype | scale      |
| Test outcome item one | C1     | OT1     | Scale     | Test Scale |
And I expand "Setup" node
And I follow "Categories and items"
And I set the following settings for grade item "Course 1":
@@ -325,7 +324,7 @@ Feature: We can use calculated grade totals
And I press "Save changes"
And I log out
And I log in as "student1"
Then I should see "4.00 (100.00 %)" in the "overview-grade" "table"
And I follow "Course 1"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
@@ -370,7 +369,7 @@ Feature: We can use calculated grade totals
| Test assignment four | 24.00 % | - | 0–150 | 0.00 % |
And I log out
And I log in as "student1"
And I should see "113.75 (23.45 %)" in the "overview-grade" "table"
And I follow "Course 1"
And the following should exist in the "user-grade" table:
@@ -389,7 +388,7 @@ Feature: We can use calculated grade totals
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I set the following settings for grade item "Sub category 1":
| Aggregation          | Natural |
@@ -559,7 +558,7 @@ Feature: We can use calculated grade totals
| Test assignment four  | 33.71 %           | -               | 0.00                         |
And I log out
And I log in as "student1"
And I should see "45.00 (13.85 %)" in the "overview-grade" "table"
And I follow "Course 1"
And the following should exist in the "user-grade" table:
index 0cc41d0..e914de5 100644 (file)
@@ -30,7 +30,7 @@ Feature: We can understand the gradebook user report
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
index 50dc807..896c567 100644 (file)
@@ -21,7 +21,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
And I am on site homepage
And I follow "Course 1"
And I navigate to "Categories and items" node in "Grade administration > Setup"
And I set the following fields to these values:
@@ -47,7 +47,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 2"
index dc443dc..919b745 100644 (file)
@@ -27,7 +27,7 @@ Feature: We can use a minimum grade different than zero
And I am on site homepage
And I follow "Course 1"
And I navigate to "Categories and items" node in "Grade administration > Setup"
And I set the following fields to these values:
@@ -86,7 +86,7 @@ Feature: We can use a minimum grade different than zero
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I give the grade "-25.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 2"
index 30b7e0d..9fe47be 100644 (file)
@@ -32,7 +32,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
| assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
And I log in as "teacher1"
And I follow "Course 1"
And I set the field "Grade report" to "Categories and items"

@javascript
index 460b93f..12ac7d3 100644 (file)
@@ -16,7 +16,7 @@ Feature: Grade letters can be overridden
| teacher1 | C1     | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I follow "Letters"
And I follow "Edit grade letters"

index e16b84c..d45e489 100644 (file)
@@ -62,7 +62,7 @@ Feature: View gradebook when scales are used
And I set the field "Grade" to "F"
And I press "Save changes"
And I follow "Course 1"
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
@@ -100,7 +100,7 @@ Feature: View gradebook when scales are used
| Course total        | 5.00      |
And I log out
And I log in as "student2"
And I follow "Course 1"
And the following should exist in the "user-grade" table:
| Grade item          | Grade | Range | Percentage | Contribution to course total |
@@ -148,7 +148,7 @@ Feature: View gradebook when scales are used
| Course total<aggregation>.   |           |
And I log out
And I log in as "student2"
And I follow "Course 1"
And the following should exist in the "user-grade" table:
| Grade item                   | Grade          | Range | Percentage    | Contribution to course total |
index fbd7070..b71b035 100644 (file)
@@ -40,7 +40,7 @@ Feature: Control the aggregation of the scales
Scenario Outline: Scales can be exluded from aggregation
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
@@ -61,7 +61,7 @@ Feature: Control the aggregation of the scales
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I follow "User report"
And I set the field "Select all or one user" to "Student 1"
And the following should exist in the "user-grade" table:
@@ -86,7 +86,7 @@ Feature: Control the aggregation of the scales
Scenario: Weights of scales cannot be edited when they are not aggregated
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I set the following settings for grade item "Course 1":
| Aggregation | Natural |
@@ -101,7 +101,7 @@ Feature: Control the aggregation of the scales
And the following config values are set as admin:
And I follow "Course 1"
And I navigate to "Categories and items" node in "Grade administration > Setup"
And I set the field "Override weight of Grade me" to "1"
And the field "Override weight of Grade me" matches value "95.238"
index b11b9e2..e902e63 100644 (file)
@@ -48,7 +48,7 @@ Feature: View gradebook when single item scales are used
And I set the field "Grade" to "A"
And I press "Save changes"
And I follow "Course 1"
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
index 6f3b42a..d26eb32 100644 (file)
@@ -55,7 +55,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 25 |
And I turn editing mode on
And I click on "Edit  assign Test Assignment 1" "link"
Then the field "Grade to pass" matches value "25"
@@ -65,7 +65,7 @@ Feature: We can set the grade to pass value
And I expand all fieldsets
And I set the field "Grade to pass" to "30"
And I press "Save and return to course"
And I click on "Edit  assign Test Assignment 1" "link"
And the field "Grade to pass" matches value "30"

@@ -78,7 +78,7 @@ Feature: We can set the grade to pass value
| Grade to pass | 3 |
And I turn editing mode on
And I click on "Edit  assign Test Assignment 1" "link"
And I follow "Show more..."
@@ -111,7 +111,7 @@ Feature: We can set the grade to pass value
| Submission grade to pass | 40 |
| Assessment grade to pass | 10 |
And I turn editing mode on
And I click on "Edit  workshop Test Workshop 1 (submission)" "link"
And I follow "Show more..."
@@ -148,7 +148,7 @@ Feature: We can set the grade to pass value
And I add a "Quiz" to section "1" and I fill the form with:
| Name | Test Quiz 1 |
| Grade to pass | 9.5 |
And I turn editing mode on
And I click on "Edit  quiz Test Quiz 1" "link"
And I follow "Show more..."
@@ -167,7 +167,7 @@ Feature: We can set the grade to pass value
| Name          | Test Lesson 1 |
| Description   | Test          |
| Grade to pass | 90            |
And I turn editing mode on
And I click on "Edit  lesson Test Lesson 1" "link"
And I follow "Show more..."
@@ -187,7 +187,7 @@ Feature: We can set the grade to pass value
| Description    | Test               |
| Grade to pass  | 90                 |
| Aggregate type | Average of ratings |
And I turn editing mode on
And I click on "Edit  data Test Database 1" "link"
And I follow "Show more..."
@@ -218,7 +218,7 @@ Feature: We can set the grade to pass value
| Description    | Test               |
| Grade to pass  | 90                 |
| Aggregate type | Average of ratings |
And I turn editing mode on
And I click on "Edit  forum Test Forum 1" "link"
And I follow "Show more..."
@@ -238,7 +238,7 @@ Feature: We can set the grade to pass value
| Description    | Test               |
| Grade to pass  | 90                 |
| Aggregate type | Average of ratings |
And I turn editing mode on
And I click on "Edit  glossary Test Glossary 1" "link"
And I follow "Show more..."
index 2a76f52..5662e39 100644 (file)
@@ -51,7 +51,7 @@ Feature: We can enter in grades and view reports from the gradebook
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name 1"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment name 2"
@@ -66,7 +66,7 @@ Feature: We can enter in grades and view reports from the gradebook
And the "Select all or one user" select box should contain "All users (1)"
And I log out
And I log in as "student1"
And I follow "Course 1"
Then the following should exist in the "user-grade" table:
@@ -76,7 +76,7 @@ Feature: We can enter in grades and view reports from the gradebook
And the following should not exist in the "user-grade" table:
| Course total | 90.00 | 0–100 | 90.00 % |
And "Course 1" row "Grade" column of "overview-grade" table should contain "170.00"
And "Course 1" row "Grade" column of "overview-grade" table should not contain "90.00"

@@ -94,7 +94,7 @@ Feature: We can enter in grades and view reports from the gradebook
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Course 1"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage |
index 091c469..c59b42f 100644 (file)
@@ -1084,7 +1084,7 @@ $string['updateavailableinstall'] = 'Install this update';$string['updateavailablenot'] = 'Your Moodle code is up-to-date!';
$string['updateavailablerecommendation'] = 'It is strongly recommended that you update your site to the latest version to obtain all recent security and bug fixes.';$string['updatenotifications'] = 'Update notifications';
-$string['updatenotificationfooter'] = 'Your Moodle site {$a->siteurl} is configured to automatically check for available updates. You are receiving this message as the administrator of the site. You can disable automatic checks for available updates in the Site administration section of the Administration block. You can customise the delivery of this message via your personal Messaging setting in My preferences.';
+$string['updatenotificationfooter'] = 'Your Moodle site {$a->siteurl} is configured to automatically check for available updates. You are receiving this message as the administrator of the site. You can disable automatic checks for available updates in the Site administration section of the Administration block. You can customise the delivery of this message via your preferences page.';
$string['updatenotificationsubject'] = 'Moodle updates are available ({$a->siteurl})';
$string['updateautocheck'] = 'Automatically check for available updates';$string['updateautocheck_desc'] = 'If enabled, your site will automatically check for available updates for both Moodle code and all additional plugins. If there is a new update available, a notification will be sent to site admins.';
index bcb43aa..a0c012d 100644 (file)
@@ -91,7 +91,7 @@ $string['personaconnection_help'] = 'Persona is a system for identifying yoursel For more information about Persona visit <a href="https://login.persona.org/about">https://login.persona.org/about</a>.';$string['backpackimport'] = 'Badge import settings';
-$string['backpackimport_help'] = 'After backpack connection is successfully established, badges from your backpack can be displayed on your "My Badges" page and your profile page. +$string['backpackimport_help'] = 'After the backpack connection is successfully established, badges from your backpack can be displayed on your badges page and your profile page.

In this area, you can select collections of badges from your backpack that you would like to display in your profile.';
$string['badges'] = 'Badges'; @@ -104,7 +104,7 @@ To add a new image, browse and select an image (in JPG or PNG format) then click$string['badgeprivacysetting'] = 'Badge privacy settings';
$string['badgeprivacysetting_help'] = 'Badges you earn can be displayed on your account profile page. This setting allows you to automatically set the visibility of the newly earned badges. -You can still control individual badge privacy settings on your "My badges" page.'; +You can still control individual badge privacy settings on your badges page.';$string['badgeprivacysetting_str'] = 'Automatically show badges I earn on my profile page';
$string['badgesalt'] = 'Salt for hashing the recepient\'s email address';$string['badgesalt_desc'] = 'Using a hash allows backpack services to confirm the badge earner without having to expose their email address. This setting should only use numbers and letters.
@@ -287,8 +287,8 @@ $string['managebadges'] = 'Manage badges';$string['managemybadges'] = 'Manage my badges';
$string['message'] = 'Message body';$string['messagebody'] = '<p>You have been awarded the badge "%badgename%"!</p>
-<p>You can manage and download the badge from {$a}.</p>'; +<p>More information about this badge can be found on the %badgelink% badge information page.</p> +<p>You can manage and download the badge from your {$a} page.</p>';
$string['messagesubject'] = 'Congratulations! You just earned a badge!';$string['method'] = 'This criterion is complete when...';
$string['mingrade'] = 'Minimum grade required'; index 6b603f3..2ae8c27 100644 (file) @@ -12,3 +12,15 @@ lockmethod,core_cache lockmethod_help,core_cache personalrepositories,core_repository siteblog,core_blog +managemybadges,core_badges +mybackpack,core_badges +mybadges,core_badges +myfiles,core +myfilesmanage,core +mygrades,core_grades +mypreferences,core +mypreferences,core_grades +myprofile,core +myprofilemyblogs,core_blog +viewallmyentries,core_blog +userspreferences,core index 52bca84..5a7aea5 100644 (file) @@ -209,7 +209,7 @@$string['exportonlyactive'] = 'Exclude suspended users';
$string['exportonlyactive_help'] = 'Only include students in the export whose enrolment is active and has not been suspended';$string['exportto'] = 'Export to';
$string['externalurl'] = 'External URL'; -$string['externalurl_desc'] = 'Specify an external url to use for the my grade page. My grades must be set to External URL.';
+$string['externalurl_desc'] = 'If an external gradebook is used, the URL should be specified here.';$string['extracreditvalue'] = 'Extra credit value for {$a}';$string['extracreditwarning'] = 'Note: Setting all items for a category to extra credit will effectively remove them from the grade calculation. Since there will be no point total';
$string['feedback'] = 'Feedback'; @@ -460,7 +460,7 @@$string['multfactor'] = 'Multiplicator';
$string['multfactorvalue'] = 'Multiplicator value for {$a}';
$string['multfactor_help'] = 'The multiplicator is the factor by which all grades for this grade item will be multiplied, with a maximum value of the maximum grade. For example, if the multiplicator is 2 and the maximum grade is 100, then all grades less than 50 are multiplied by 2, and all grades 50 and above are changed to 100.';$string['mygrades'] = 'My grades';
-$string['mygrades_desc'] = 'This sets the "My grades" page in the user menu.'; +$string['mygrades_desc'] = 'This setting determines the grades link in the user menu. If an external gradebook is used, \'External URL\' should be selected and the URL specified below.';
$string['mypreferences'] = 'My preferences';$string['myreportpreferences'] = 'My report preferences';
$string['navmethod'] = 'Navigation method'; index 6ac5fe9..3344306 100644 (file) @@ -1217,6 +1217,7 @@$string['mustchangepassword'] = 'The new password must be different than the cur
$string['mycourses'] = 'My courses';$string['myfiles'] = 'My private files';
$string['myfilesmanage'] = 'Manage my private files'; +$string['privatefilesmanage'] = 'Manage private files';
$string['myhome'] = 'Dashboard';$string['mymoodledashboard'] = 'My Moodle dashboard';
$string['myprofile'] = 'My profile'; @@ -1462,6 +1463,7 @@$string['previous'] = 'Previous';
$string['previouslyselectedusers'] = 'Previously selected users not matching \'{$a}\'';
$string['previoussection'] = 'Previous section';$string['primaryadminsetup'] = 'Setup administrator account';
+$string['privatefiles'] = 'Private files';$string['private_files_handler'] = 'Store attachments to an e-mail in the user\'s private files storage space.';
$string['private_files_handler_name'] = 'Email to Private files';$string['profile'] = 'Profile';
@@ -1932,7 +1934,6 @@ $string['usernameoremail'] = 'Enter either username or email address';$string['usernotconfirmed'] = 'Could not confirm {$a}';$string['userpic'] = 'User picture';
$string['users'] = 'Users'; -$string['userspreferences'] = 'User {$a}\'s preferences';$string['userselectorautoselectunique'] = 'If only one user matches the search, select them automatically';
$string['userselectorpreserveselected'] = 'Keep selected users, even if they no longer match the search';$string['userselectorsearchanywhere'] = 'Match the search text anywhere in the displayed fields';
@@ -2040,3 +2041,5 @@ $string['yourself'] = 'yourself';$string['yourteacher'] = 'your {$a}';$string['yourwordforx'] = 'Your word for \'{$a}\'';$string['zippingbackup'] = 'Zipping backup';
+// Deprecated since Moodle 2.9
+$string['userspreferences'] = 'User {$a}\'s preferences';
index 46fbb2f..36079b6 100644 (file)
@@ -182,7 +182,7 @@ $string['shortnametaken'] = 'Short name is already used for another service ({$a
$string['simpleauthlog'] = 'Simple authentication login';$string['step'] = 'Step';
$string['supplyinfo'] = 'More details'; -$string['testauserwithtestclientdescription'] = 'Simulate external access to the service using the web service test client. Before doing so, login as a user with the moodle/webservice:createtoken capability and obtain the security key (token) via My preferences settings. You will use this token in the test client. In the test client, also choose an enabled protocol with the token authentication. <strong>WARNING: The functions that you test WILL BE EXECUTED for this user, so be careful what you choose to test!</strong>';
+$string['testauserwithtestclientdescription'] = 'Simulate external access to the service using the web service test client. Before doing so, log in as a user with the moodle/webservice:createtoken capability and obtain the security key (token) via the user\'s preferences page. You will use this token in the test client. In the test client, also choose an enabled protocol with the token authentication. <strong>WARNING: The functions that you test WILL BE EXECUTED for this user, so be careful what you choose to test!</strong>';$string['testclient'] = 'Web service test client';
$string['testclientdescription'] = '* The web service test client <strong>executes</strong> the functions for <strong>REAL</strong>. Do not test functions that you don\'t know. <br/>* All existing web service functions are not yet implemented into the test client. <br/>* In order to check that a user cannot access some functions, you can test some functions that you didn\'t allow.<br/>* To see clearer error messages set the debugging to <strong>{$a->mode}</strong> into {$a->atag}<br/>* Access the {$a->amfatag}.';
$string['testwithtestclient'] = 'Test the service'; @@ -197,7 +197,7 @@$string['updateusersettings'] = 'Update';
$string['uploadfiles'] = 'Can upload files';$string['uploadfiles_help'] = 'If enabled, any user can upload files with their security keys to their own private files area or a draft file area. Any user file quotas apply.';
$string['userasclients'] = 'Users as clients with token'; -$string['userasclientsdescription'] = 'The following steps help you to set up the Moodle web service for users as clients. These steps also help to set up the recommended token (security keys) authentication method. In this use case, the user will generate his token from the security keys page via My preferences settings.';
+$string['userasclientsdescription'] = 'The following steps help you to set up the Moodle web service for users as clients. These steps also help to set up the recommended token (security keys) authentication method. In this use case, the user will generate their token from the security keys page via their preferences page.';$string['usermissingcaps'] = 'Missing capabilities: {$a}';$string['usernameorid'] = 'Username / User id';
$string['usernameorid_help'] = 'Enter a username or a user id.'; index 78b4f06..7843dfc 100644 (file) @@ -5201,7 +5201,7 @@ class admin_setting_grade_profilereport extends admin_setting_configselect { } /** - * Provides a selection of grade reports to be used for "my grades". + * Provides a selection of grade reports to be used for "grades". * * @copyright 2015 Adrian Greeve <adrian@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -5212,7 +5212,7 @@ class admin_setting_my_grades_report extends admin_setting_configselect { * Calls parent::__construct with specific arguments. */ public function __construct() { - parent::__construct('grade_mygrades_report', new lang_string('mygrades', 'grades'), + parent::__construct('grade_mygrades_report', new lang_string('grades', 'grades'), new lang_string('mygrades_desc', 'grades'), 'overview', null); } index 3c8d7e8..fcf9c37 100644 (file) @@ -237,4 +237,98 @@ abstract class handler { return false; } + /** + * Remove quoted message string from the text (NOT HTML) message. + * + * @param \stdClass$messagedata The Inbound Message record
+     *
+     * @return array message and message format to use.
+     */
+    protected static function remove_quoted_text($messagedata) { +$linecount = self::get_linecount_to_remove($messagedata); + if (!empty($messagedata->plain)) {
+            $text =$messagedata->plain;
+        } else {
+            $text = html_to_text($messagedata->html);
+        }
+        $messageformat = FORMAT_PLAIN; + +$splitted = preg_split("/\n|\r/", $text); + if (empty($splitted)) {
+            return array($text,$messageformat);
+        }
+
+        // Remove extra line. "Xyz wrote on...".
+        $count = 0; +$i = 0;
+        $flag = false; + foreach ($splitted as $i =>$element) {
+            if (stripos($element, ">") === 0) { + // Quoted text found. +$flag = true;
+                // Remove 2 non empty line before this.
+                for ($j =$i - 1; ($j >= 0);$j--) {
+                    $element =$splitted[$j]; + if (!empty($element)) {
+                        unset($splitted[$j]);
+                        $count++; + } + if ($count == $linecount) { + break; + } + } + break; + } + } + if ($flag) {
+            // Quoted text was found.
+            $k =$i - $linecount; // Where to start the chopping process. + + // Remove quoted text. +$splitted = array_slice($splitted, 0,$k);
+
+            // Strip out empty lines towards the end, since a lot of clients add a huge chunk of empty lines.
+            $reverse = array_reverse($splitted);
+            foreach ($reverse as$i => $line) { + if (empty($line)) {
+                    unset($reverse[$i]);
+                } else {
+                    // Non empty line found.
+                    break;
+                }
+            }
+
+            $replaced = implode(PHP_EOL, array_reverse($reverse));
+            $message = trim($replaced);
+        } else {
+            // No quoted text, fallback to original text.
+            if (!empty($messagedata->html)) { +$message = $messagedata->html; +$messageformat = FORMAT_HTML;
+            } else {
+                $message =$messagedata->plain;
+            }
+        }
+        return array($message,$messageformat);
+    }
+
+    /**
+     * Try to guess how many lines to remove from the email to delete "xyz wrote on" text. Hard coded numbers for various email
+     * clients.
+     * Gmail uses two
+     * Evolution uses one
+     * Thunderbird uses one
+     *
+     * @param \stdClass $messagedata The Inbound Message record + * + * @return int number of lines to chop off before the start of quoted text. + */ + protected static function get_linecount_to_remove($messagedata) {
+        $linecount = 1; + if (!empty($messagedata->html) && stripos($messagedata->html, 'gmail_quote') !== false) { + // Gmail uses two lines. +$linecount = 2;
+        }
+        return $linecount; + } } index 8e53119..17b1ca7 100644 (file) @@ -85,38 +85,11 @@ class external extends external_api {$template = $params['template'];$themename = $params['themename']; - // Check if this is a valid component. -$componentdir = core_component::get_component_directory($component); - if (empty($componentdir)) {
-            throw new moodle_exception('filenotfound', 'error');
-        }
-        // Places to look.
-        $candidates = array(); - // Theme dir. -$root = $CFG->dirroot; +$templatename = $component . '/' .$template;

-        $themeconfig = theme_config::load($themename);
-
-        $candidate = "${root}/theme/${themename}/templates/${component}/${template}.mustache"; -$candidates[] = $candidate; - // Theme parents dir. - foreach ($themeconfig->parents as $theme) { -$candidate = "${root}/theme/${theme}/templates/${component}/${template}.mustache";
-            $candidates[] =$candidate;
-        }
-        // Component dir.
-        $candidate = "${componentdir}/templates/${template}.mustache"; -$candidates[] = $candidate; -$templatestr = false;
-        foreach ($candidates as$candidate) {
-            if (file_exists($candidate)) { -$templatestr = file_get_contents($candidate); - break; - } - } - if ($templatestr === false) {
-            throw new moodle_exception('filenotfound', 'error');
-        }
+        // Will throw exceptions if the template does not exist.
+        $filename = mustache_template_finder::get_template_filepath($templatename, $themename); +$templatestr = file_get_contents($filename); return$templatestr;
}
index b4caa18..f90623c 100644 (file)
@@ -28,7 +28,7 @@ namespace core\output;
use coding_exception;

/**
- * Perform some custom name mapping for template file names (strip leading component/).
+ * Perform some custom name mapping for template file names.
*
* @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -36,22 +36,21 @@ use coding_exception;
*/

+    /**
+     * Provide a default no-args constructor (we don't really need anything).
+     */
+    public function __construct() {
+    }
+
/**
* Helper function for getting a Mustache template file name.
-     * Strips the leading component as we are already limited to the correct directories.
+     * Uses the leading component to restrict us specific directories.
*
* @param string $name - * * @return string Template file name */ protected function getFileName($name) {
-        if (strpos($name, '/') === false) { - throw new coding_exception('Templates names must be specified as "componentname/templatename" (' .$name . ' requested) ');
-        }
-        list($component,$templatename) = explode('/', $name, 2); - if (strpos($templatename, '/') !== false) {
-            throw new coding_exception('Templates cannot be placed in sub directories (' . $name . ' requested)'); - } - return parent::getFileName($templatename);
+        // Call the Moodle template finder.
+        return mustache_template_finder::get_template_filepath($name); } } diff --git a/lib/classes/output/mustache_template_finder.php b/lib/classes/output/mustache_template_finder.php new file mode 100644 (file) index 0000000..8939ded --- /dev/null @@ -0,0 +1,120 @@ +<?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/>. + +/** + * List the valid locations to search for a template with a given name. + * + * @package core + * @category output + * @copyright 2015 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core\output; + +use coding_exception; +use moodle_exception; +use core_component; + +/** + * Get information about valid locations for mustache templates. + * + * @copyright 2015 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.9 + */ +class mustache_template_finder { + + /** + * Helper function for getting a list of valid template directories for a specific component. + * + * @param string$component The component to search
+     * @param string $themename The current theme name + * @return string[] List of valid directories for templates for this compoonent. Directories are not checked for existence. + */ + public static function get_template_directories_for_component($component, $themename = '') { + global$CFG, $PAGE; + + // Default the param. + if ($themename == '') {
+            $themename =$PAGE->theme->name;
+        }
+
+        // Clean params for safety.
+        $component = clean_param($component, PARAM_COMPONENT);
+        $themename = clean_param($themename, PARAM_COMPONENT);
+
+        // Validate the component.
+        $dirs = array(); +$compdirectory = core_component::get_component_directory($component); + if (!$compdirectory) {
+            throw new coding_exception("Component was not valid: " . s($component)); + } + + // Find the parent themes. +$parents = array();
+        if ($themename ===$PAGE->theme->name) {
+            $parents =$PAGE->theme->parents;
+        } else {
+            $themeconfig = theme_config::load($themename);
+            $parents =$themeconfig->parents;
+        }
+
+        // First check the theme.
+        $dirs[] =$CFG->dirroot . '/theme/' . $themename . '/templates/' .$component . '/';
+        // Now check the parent themes.
+        // Search each of the parent themes second.
+        foreach ($parents as$parent) {
+            $dirs[] =$CFG->dirroot . '/theme/' . $parent . '/templates/' .$component . '/';
+        }
+
+        $dirs[] =$compdirectory . '/templates/';
+
+        return $dirs; + } + + /** + * Helper function for getting a filename for a template from the template name. + * + * @param string$name - This is the componentname/templatename combined.
+     * @param string $themename - This is the current theme name. + * @return string + */ + public static function get_template_filepath($name, $themename = '') { + global$CFG, $PAGE; + + if (strpos($name, '/') === false) {
+            throw new coding_exception('Templates names must be specified as "componentname/templatename"' .
+                                       ' (' . s($name) . ' requested) '); + } + list($component, $templatename) = explode('/',$name, 2);
+        $component = clean_param($component, PARAM_COMPONENT);
+        if (strpos($templatename, '/') !== false) { + throw new coding_exception('Templates cannot be placed in sub directories (' . s($name) . ' requested)');
+        }
+
+        $dirs = self::get_template_directories_for_component($component, $themename); + + foreach ($dirs as $dir) { +$candidate = $dir .$templatename . '.mustache';
+            if (file_exists($candidate)) { + return$candidate;
+            }
+        }
+
+        throw new moodle_exception('filenotfound', 'error');
+    }
+}
index 6482c67..38687d1 100644 (file)
@@ -256,7 +256,8 @@ class core_string_manager_standard implements core_string_manager {
public function string_deprecated($identifier,$component) {
$deprecated =$this->load_deprecated_strings();
list($plugintype,$pluginname) = core_component::normalize_component($component); - return isset($deprecated[$identifier . ',' .$plugintype . '_' . $pluginname]); +$normcomponent = $pluginname ? ($plugintype . '_' . $pluginname) :$plugintype;
+        return isset($deprecated[$identifier . ',' . $normcomponent]); } /** @@ -383,7 +384,8 @@ class core_string_manager_standard implements core_string_manager { // Display a debugging message if sting exists but was deprecated. if ($this->string_deprecated($identifier,$component)) {
list($plugintype,$pluginname) = core_component::normalize_component($component); - debugging("String [{$identifier},{$plugintype}_{$pluginname}] is deprecated. ".
+                $normcomponent =$pluginname ? ($plugintype . '_' .$pluginname) : $plugintype; + debugging("String [{$identifier},{$normcomponent}] is deprecated. ". 'Either you should no longer be using that string, or the string has been incorrectly deprecated, in which case you should report this as a bug. '. 'Please refer to https://docs.moodle.org/dev/String_deprecation', DEBUG_DEVELOPER); } index bdd749e..d3c7f66 100644 (file) @@ -4337,5 +4337,43 @@ function xmldb_main_upgrade($oldversion) {
}

+    if ($oldversion < 2015050400.00) { +$config = get_config('core', 'customusermenuitems');
+
+        // Change "My preferences" in the user menu to "Preferences".
+        $config = str_replace("mypreferences,moodle|/user/preferences.php|preferences", + "preferences,moodle|/user/preferences.php|preferences",$config);
+
+        $config = str_replace("mygrades,grades|/grade/report/mygrades.php|grades", + "grades,grades|/grade/report/mygrades.php|grades",$config);
+
+        set_config('customusermenuitems', $config); + + upgrade_main_savepoint(true, 2015050400.00); + } + + if ($oldversion < 2015050401.00) {
+        // Make sure we have messages in the user menu because it's no longer in the nav tree.
+        $oldconfig = get_config('core', 'customusermenuitems'); +$messagesconfig = "messages,message|/message/index.php|message";
+        $preferencesconfig = "preferences,moodle|/user/preferences.php|preferences"; + + // See if it exists. + if (strpos($oldconfig, $messagesconfig) === false) { + // See if preferences exists. + if (strpos($oldconfig, "preferences,moodle|/user/preferences.php|preferences") !== false) {
+                // Insert it before preferences.
+                $newconfig = str_replace($preferencesconfig, $messagesconfig . "\n" .$preferencesconfig, $oldconfig); + } else { + // Custom config - we can only insert it at the end. +$newconfig = $oldconfig . "\n" .$messagesconfig;
+            }
+            set_config('customusermenuitems', newconfig); + } + + upgrade_main_savepoint(true, 2015050401.00); + } + return true; } index fc41ab7..8757b29 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto accessibility checker @javascript Scenario: Images with no alt Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Some plain text</p><img src='/broken-image' width='1' height='1'/><p>Some more text</p>" When I click on "Show more buttons" "button" @@ -31,7 +31,7 @@ Feature: Atto accessibility checker @javascript Scenario: Low contrast Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p style='color: #7c7cff; background-color: #ffffff;'>Hard to read</p>" When I click on "Show more buttons" "button" @@ -41,7 +41,7 @@ Feature: Atto accessibility checker @javascript Scenario: No headings Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Sweet roll oat cake jelly-o macaroon donut oat cake. Caramels macaroon cookie sweet roll croissant cheesecake candy jelly-o. Gummies sugar plum sugar plum gingerbread dessert. Tiramisu bonbon jujubes danish marshmallow cookie chocolate cake cupcake tiramisu. Bear claw oat cake chocolate bar croissant. Lollipop cookie topping liquorice croissant. Brownie cookie cupcake lollipop cupcake cupcake. Fruitcake dessert sweet biscuit dragée caramels marzipan brownie. Chupa chups gingerbread apple pie cookie liquorice caramels carrot cake cookie gingerbread. Croissant candy jelly beans. Tiramisu apple pie dessert apple pie macaroon soufflé. Brownie powder carrot cake chocolate. Tart applicake croissant dragée macaroon chocolate donut.</p><p>Jelly beans gingerbread tootsie roll. Sugar plum tiramisu cotton candy toffee pie cotton candy tiramisu. Carrot cake chocolate bar sesame snaps cupcake cake dessert sweet fruitcake wafer. Marshmallow cupcake gingerbread pie sweet candy canes powder gummi bears. Jujubes cake muffin marshmallow candy jelly beans tootsie roll pie. Gummi bears applicake chocolate cake sweet jelly sesame snaps lollipop lollipop carrot cake. Marshmallow cake jelly beans. Jelly beans sesame snaps muffin halvah cookie ice cream candy canes carrot cake. Halvah donut marshmallow tiramisu. Cookie dessert gummi bears. Sugar plum apple pie jelly beans gummi bears tart chupa chups. Liquorice macaroon gummi bears gummies macaroon marshmallow sweet roll cake topping. Lemon drops caramels pie icing danish. Chocolate cake oat cake dessert halvah danish carrot cake apple pie.</p>" When I click on "Show more buttons" "button" @@ -51,7 +51,7 @@ Feature: Atto accessibility checker @javascript Scenario: Merged cells Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<table><caption>Dogs that look good in pants</caption><tr><th>Breed</th><th>Coolness</th></tr><tr><td>Poodle</td><td rowspan='2'>NOT COOL</td></tr><tr><td>Doberman</td></tr></table>" When I click on "Show more buttons" "button" @@ -61,7 +61,7 @@ Feature: Atto accessibility checker @javascript Scenario: Table missing row/column headers Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<table><caption>Dogs that look good in pants</caption><tr><th>Breed</th><td>Coolness</td></tr><tr><td>Poodle</td><td>NOT COOL</td></tr><tr><td>Doberman</td><td>COOL</td></tr></table>" When I click on "Show more buttons" "button" @@ -71,7 +71,7 @@ Feature: Atto accessibility checker @javascript Scenario: Table missing caption Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<table><tr><th>Breed</th><th>Coolness</th></tr><tr><td>Poodle</td><td>NOT COOL</td></tr><tr><td>Doberman</td><td>COOL</td></tr></table>" When I click on "Show more buttons" "button" index 63fe6af..2bb6bb4 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto accessibility helper @javascript Scenario: Images and links Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Some plain text</p><img src='/broken-image' alt='Image 1'/><p><a href='#fsd'>Some link text</a></p>" And I select the text in the "Description" Atto editor @@ -21,7 +21,7 @@ Feature: Atto accessibility helper @javascript Scenario: Styles Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Some plain text</p>" When I click on "Show more buttons" "button" index 59b635e..f3f724a 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto align text @javascript Scenario: Right align some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Fascism</p>" And I click on "Show more buttons" "button" And I select the text in the "Description" Atto editor When I click on "Right align" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" @@ -22,7 +22,7 @@ Feature: Atto align text @javascript Scenario: Left align some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Communism</p>" And I click on "Show more buttons" "button" @@ -30,7 +30,7 @@ Feature: Atto align text When I click on "Right align" "button" And I click on "Left align" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" @@ -40,14 +40,14 @@ Feature: Atto align text @javascript Scenario: Center align some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>United Future</p>" And I click on "Show more buttons" "button" And I select the text in the "Description" Atto editor When I click on "Center" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index ef5128c..a1d6316 100644 (file) @@ -5,13 +5,13 @@ Feature: Atto bold button @javascript Scenario: Bold some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Badger" And I select the text in the "Description" Atto editor When I click on "Bold" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" @@ -21,14 +21,14 @@ Feature: Atto bold button @javascript Scenario: Unbold some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Mouse" And I select the text in the "Description" Atto editor When I click on "Bold" "button" And I click on "Bold" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 38720e4..f7d6481 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto charmap button @javascript Scenario: Insert symbols Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>1980 Mullet</p>" And I select the text in the "Description" Atto editor @@ -13,7 +13,7 @@ Feature: Atto charmap button And I click on "Insert character" "button" And I click on "a - macron" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index d285766..1915c7b 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto clear button @javascript Scenario: Clear formatting Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Pisa" And I select the text in the "Description" Atto editor @@ -14,7 +14,7 @@ Feature: Atto clear button And I select the text in the "Description" Atto editor When I click on "Clear formatting" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index f72b296..5174ded 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto collapse button @javascript Scenario: Toggle toolbar Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" When I click on "Show more buttons" "button" Then "Equation editor" "button" should be visible index 4233ae7..a74efe0 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto equation editor @javascript Scenario: Create an equation Given I log in as "admin" - When I follow "My profile" in the user menu + When I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Equation test</p>" # Set field on the bottom of page, so equation editor dialogue is visible. @@ -18,13 +18,13 @@ Feature: Atto equation editor And I click on "\infty" "button" And I click on "Save equation" "button" And I click on "Update profile" "button" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu Then "\infty" "text" should exist @javascript Scenario: Edit an equation Given I log in as "admin" - When I follow "My profile" in the user menu + When I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>$$\pi$$</p>" # Set field on the bottom of page, so equation editor dialogue is visible. index f1b7fbf..cf46134 100644 (file) @@ -5,7 +5,7 @@ Feature: Atto edit HTML @javascript Scenario: Edit the html source Given I log in as "admin" - When I follow "My profile" in the user menu + When I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p style=\"color: blue;\">Smurf</p>" And I click on "Show more buttons" "button" index d0b1ddf..e3b1138 100644 (file) @@ -5,10 +5,10 @@ Feature: Add images to Atto @javascript Scenario: Insert an image Given I log in as "admin" - And I follow "Manage my private files..." + And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager And I click on "Save changes" "button" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" When I set the field "Description" to "<p>Image test</p>" And I select the text in the "Description" Atto editor @@ -50,7 +50,7 @@ Feature: Add images to Atto @javascript Scenario: Manually inserting an image Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "<p>Image: <img src='/nothing/here'>.</p>" And I select the text in the "Description" Atto editor index d4123a8..39827b2 100644 (file) @@ -5,14 +5,14 @@ Feature: Indent text in Atto @javascript Scenario: Indent Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu When I follow "Edit profile" And I set the field "Description" to "<p>I need some space.</p>" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" And I click on "Indent" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" @@ -22,7 +22,7 @@ Feature: Indent text in Atto @javascript Scenario: Indent and outdent Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu When I follow "Edit profile" And I set the field "Description" to "<p>I need some space.</p>" And I select the text in the "Description" Atto editor @@ -30,7 +30,7 @@ Feature: Indent text in Atto And I click on "Indent" "button" And I click on "Outdent" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index f2c020e..cd063f0 100644 (file) @@ -5,13 +5,13 @@ Feature: Atto italic button @javascript Scenario: Italicise some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Tower of Pisa" And I select the text in the "Description" Atto editor When I click on "Italic" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" @@ -21,14 +21,14 @@ Feature: Atto italic button @javascript Scenario: Toggle italics in some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "GHD - for hair" And I select the text in the "Description" Atto editor When I click on "Italic" "button" And I click on "Italic" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index f42a660..0a0234a 100644 (file) @@ -5,10 +5,10 @@ Feature: Add links to Atto @javascript Scenario: Insert a links Given I log in as "admin" - And I follow "Manage my private files..." + And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager And I click on "Save changes" "button" - When I follow "My profile" in the user menu + When I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Super cool" And I select the text in the "Description" Atto editor @@ -18,7 +18,7 @@ Feature: Add links to Atto And I click on "moodle-logo.png" "link" And I click on "Select this file" "button" And I click on "Update profile" "button" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 29ce9ab..f558f9e 100644 (file) @@ -5,11 +5,11 @@ Feature: Add media to Atto @javascript Scenario: Insert some media Given I log in as "admin" - And I follow "Manage my private files..." + And I follow "Manage private files..." And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager And I click on "Save changes" "button" - When I follow "My profile" in the user menu - And I follow "My blog entries" + When I follow "Profile" in the user menu + And I follow "Blog entries" And I follow "Add a new entry" And I set the field "Blog entry body" to "<p>Media test</p>" And I select the text in the "Blog entry body" Atto editor index de98d57..65393cb 100644 (file) @@ -5,13 +5,13 @@ Feature: Atto ordered list button @javascript Scenario: Make a list from some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Have you heard the news everyone's talking<br/> Life is good 'cause everything's awesome<br/>" And I select the text in the "Description" Atto editor When I click on "Ordered list" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index e97d362..dba4d44 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto strike button @javascript Scenario: Strike some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "MUA" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" When I click on "Strike through" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 1c408dd..3ecd8e7 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto subscript button @javascript Scenario: Subscript some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Submarine" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" When I click on "Subscript" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 8d58f91..350b11d 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto superscript button @javascript Scenario: Subscript some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Helicopter" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" When I click on "Superscript" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 05c2d23..3c6507e 100644 (file) @@ -5,8 +5,8 @@ Feature: Atto tables @javascript Scenario: Create a table Given I log in as "admin" - And I follow "My profile" in the user menu - And I follow "My blog entries" + And I follow "Profile" in the user menu + And I follow "Blog entries" And I follow "Add a new entry" And I set the field "Entry title" to "How to make a table" And I set the field "Blog entry body" to "Table test" @@ -21,8 +21,8 @@ Feature: Atto tables @javascript Scenario: Edit a table Given I log in as "admin" - And I follow "My profile" in the user menu - And I follow "My blog entries" + And I follow "Profile" in the user menu + And I follow "Blog entries" And I follow "Add a new entry" And I set the field "Entry title" to "How to make a table" And I set the field "Blog entry body" to "<table><tr><td>Cell</td></tr></table>" index bb58b70..4f36ea8 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto title @javascript Scenario: Create a heading Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "How The Rock Has Made the WWE World Heavyweight Title More Important Than Ever" And I select the text in the "Description" Atto editor When I click on "Paragraph styles" "button" When I click on "Heading (large)" "link" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 8bf06d9..f4dd991 100644 (file) @@ -5,14 +5,14 @@ Feature: Atto underline button @javascript Scenario: Underline some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Deprecated HTML Tag" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" When I click on "Underline" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index 590461b..8dcf84f 100644 (file) @@ -5,13 +5,13 @@ Feature: Atto unordered list button @javascript Scenario: Make a list from some text Given I log in as "admin" - And I follow "My profile" in the user menu + And I follow "Profile" in the user menu And I follow "Edit profile" And I set the field "Description" to "Things, dogs, clogs, they're awesome<br/> Rocks, clocks, and socks, they're awesome<br/> Figs, and wigs, and twigs, that's awesome<br/> Everything you see or think or say is awesome" And I select the text in the "Description" Atto editor When I click on "Unordered list" "button" And I press "Update profile" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" index c9cbdc7..ec112da 100644 (file) @@ -9,7 +9,7 @@ Feature: Add or remove items from the TinyMCE editor toolbar | fullname | shortname | category | | Course 1 | C1 | 0 | And I log in as "admin" - And I follow "My preferences" in the user menu + And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "TinyMCE HTML editor" And I press "Save changes" index 124a093..5f4a395 100644 (file) @@ -100,9 +100,9 @@ function core_myprofile_navigation(core_user\output\myprofile\treetree, $user, } // Preference page. Only visible by administrators. - if (is_siteadmin()) { + if (!$iscurrentuser && is_siteadmin()) {
$url = new moodle_url('/user/preferences.php', array('userid' =>$user->id));
-        $title =$iscurrentuser ? get_string('mypreferences') : get_string('userspreferences', 'moodle', fullname($user)); +$title = get_string('preferences', 'moodle');
$node = new core_user\output\myprofile\node('administration', 'preferences',$title, null, $url);$tree->add_node($node); } index 54bc395..5644186 100644 (file) @@ -1104,7 +1104,7 @@ class global_navigation extends navigation_node { } }$this->rootnodes['site'] = $this->add_course($SITE);
-        $this->rootnodes['myprofile'] =$this->add(get_string('myprofile'), null, self::TYPE_USER, null, 'myprofile');
+        $this->rootnodes['myprofile'] =$this->add(get_string('profile'), null, self::TYPE_USER, null, 'myprofile');
$this->rootnodes['currentcourse'] =$this->add(get_string('currentcourse'), null, self::TYPE_ROOTNODE, null, 'currentcourse');
$this->rootnodes['mycourses'] =$this->add(get_string('mycourses'), null, self::TYPE_ROOTNODE, null, 'mycourses');
$this->rootnodes['courses'] =$this->add(get_string('courses'), new moodle_url('/course/index.php'), self::TYPE_ROOTNODE, null, 'courses');
}

-            // It is context based so can appear in "My profile" and in course participants information.
+            // It is context based so can appear in the user's profile and in course participants information.
if (!empty($CFG->messaging)) {$messageargs = array('user1' => $USER->id); if ($USER->id != $user->id) { @@ -2245,10 +2245,10 @@ class global_navigation extends navigation_node { } // Add the "My private files" link. - // This link doesn't have a unique display for course context so only display it under "My profile". + // This link doesn't have a unique display for course context so only display it under the user's profile. if ($issitecourse && $iscurrentuser && has_capability('moodle/user:manageownfiles',$usercontext)) {
$url = new moodle_url('/user/files.php'); -$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING); +$usernode->add(get_string('privatefiles'), $url, self::TYPE_SETTING); } // Add a node to view the users notes if permitted. @@ -2261,10 +2261,10 @@ class global_navigation extends navigation_node {$usernode->add(get_string('notes', 'notes'), $url); } - // Show the my grades node. + // Show the grades node. if (($issitecourse && $iscurrentuser) || has_capability('moodle/user:viewdetails',$usercontext)) {
require_once($CFG->dirroot . '/user/lib.php'); - // Set the grades node to link to the "My grades" page. + // Set the grades node to link to the "Grades" page. if ($course->id == SITEID) {
$url = user_mygrades_url($user->id, $course->id); } else { // Otherwise we are in a course and should redirect to the user grade report (Activity report version). @@ -2273,7 +2273,7 @@ class global_navigation extends navigation_node { if ($USER->id != $user->id) {$usernode->add(get_string('grades', 'grades'), $url, self::TYPE_SETTING, null, 'usergrades'); } else { -$usernode->add(get_string('mygrades', 'grades'), $url); +$usernode->add(get_string('grades', 'grades'), $url); } } @@ -2553,18 +2553,16 @@ class global_navigation extends navigation_node { if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser()))) and has_capability('moodle/blog:view', context_system::instance())) {$blogsurls = new moodle_url('/blog/index.php');
-                    if ($course->id ==$SITE->id) {
-                        $blogsurls->param('courseid', 0); - } else if ($currentgroup = groups_get_course_group($course, true)) { + if ($currentgroup = groups_get_course_group($course, true)) {$blogsurls->param('groupid', $currentgroup); } else {$blogsurls->param('courseid', $course->id); } -$participants->add(get_string('blogscourse','blog'), $blogsurls->out()); +$participants->add(get_string('blogscourse', 'blog'), $blogsurls->out(), self::TYPE_SETTING, null, 'courseblogs'); } } if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view',$this->page->context))) {
-                $participants->add(get_string('notes','notes'), new moodle_url('/notes/index.php', array('filtertype'=>'course', 'filterselect'=>$course->id)));
+                $participants->add(get_string('notes', 'notes'), new moodle_url('/notes/index.php', array('filtertype' => 'course', 'filterselect' =>$course->id)), self::TYPE_SETTING, null, 'currentcoursenotes');
}
} else if (count($this->extendforuser) > 0 ||$this->page->course->id == $course->id) {$participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants'); @@ -2611,16 +2609,16 @@ class global_navigation extends navigation_node {$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants'); } -$filterselect = 0;
-
// Blogs
if (!empty($CFG->enableblogs) and ($CFG->bloglevel == BLOG_GLOBAL_LEVEL or ($CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser()))) and has_capability('moodle/blog:view', context_system::instance())) { -$blogsurls = new moodle_url('/blog/index.php', array('courseid' => $filterselect)); +$blogsurls = new moodle_url('/blog/index.php');
$coursenode->add(get_string('blogssite', 'blog'),$blogsurls->out(), self::TYPE_SYSTEM, null, 'siteblog');
}

+        $filterselect = 0; + //Badges if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1)); @@ -4219,14 +4217,14 @@ class settings_navigation extends navigation_node { } // Add the user profile to the dashboard. -$profilenode = $dashboard->add(get_string('myprofile'), new moodle_url('/user/profile.php', +$profilenode = $dashboard->add(get_string('profile'), new moodle_url('/user/profile.php', array('id' =>$user->id)), self::TYPE_SETTING, null, 'myprofile');

if (!empty($CFG->navadduserpostslinks)) { // Add nodes for forum posts and discussions if the user can view either or both // There are no capability checks here as the content of the page is based // purely on the forums the current user has access too. -$forumtab = $dashboard->add(get_string('forumposts', 'forum')); +$forumtab = $profilenode->add(get_string('forumposts', 'forum'));$forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs), null, 'myposts');$forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php',
array_merge($baseargs, array('mode' => 'discussions'))), null, 'mydiscussions'); @@ -4244,7 +4242,7 @@ class settings_navigation extends navigation_node { } if (count($options) > 0) {
-                    $blogs =$dashboard->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER);
+                    $blogs =$profilenode->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER);
foreach ($options as$type => $option) { if ($type == "rss") {
$blogs->add($option['string'], $option['link'], self::TYPE_SETTING, null, null, @@ -4257,7 +4255,7 @@ class settings_navigation extends navigation_node { } // Add the messages link. - // It is context based so can appear in "My profile" and in course participants information. + // It is context based so can appear in the user's profile and in course participants information. if (!empty($CFG->messaging)) {
$messageargs = array('user1' =>$USER->id);
if ($USER->id !=$user->id) {
}

-            // This link doesn't have a unique display for course context so only display it under "My profile".
+            // This link doesn't have a unique display for course context so only display it under the user's profile.
if ($issitecourse &&$iscurrentuser && has_capability('moodle/user:manageownfiles', $usercontext)) {$url = new moodle_url('/user/files.php');
-                $dashboard->add(get_string('myfiles'),$url, self::TYPE_SETTING);
+                $dashboard->add(get_string('privatefiles'),$url, self::TYPE_SETTING);
}

// Add a node to view the users notes if permitted.
if ($coursecontext->instanceid != SITEID) {$url->param('course', $coursecontext->instanceid); } -$dashboard->add(get_string('notes', 'notes'), $url); +$profilenode->add(get_string('notes', 'notes'), $url); } - // Show the my grades node. + // Show the grades node. if (($issitecourse && $iscurrentuser) || has_capability('moodle/user:viewdetails',$usercontext)) {
require_once($CFG->dirroot . '/user/lib.php'); - // Set the grades node to link to the "My grades" page. + // Set the grades node to link to the "Grades" page. if ($course->id == SITEID) {
$url = user_mygrades_url($user->id, $course->id); } else { // Otherwise we are in a course and should redirect to the user grade report (Activity report version).$url = new moodle_url('/course/user.php', array('mode' => 'grade', 'id' => $course->id, 'user' =>$user->id));
}
-                if ($USER->id !=$user->id) {
-                    $dashboard->add(get_string('grades', 'grades'),$url, self::TYPE_SETTING, null, 'mygrades');
-                } else {
-                    $dashboard->add(get_string('mygrades', 'grades'),$url, self::TYPE_SETTING, null, 'mygrades');
-                }
+                $dashboard->add(get_string('grades', 'grades'),$url, self::TYPE_SETTING, null, 'mygrades');
}
$usersetting = navigation_node::create(get_string('preferences', 'moodle'),$prefurl, self::TYPE_CONTAINER, null, $key);$dashboard->add_node($usersetting); @@ -4490,7 +4484,7 @@ class settings_navigation extends navigation_node {$badges = $usersetting->add(get_string('badges'), null, navigation_node::TYPE_CONTAINER, null, 'badges'); if (has_capability('moodle/badges:manageownbadges',$usercontext)) {
$url = new moodle_url('/badges/mybadges.php'); -$badges->add(get_string('managemybadges', 'badges'), $url, self::TYPE_SETTING); +$badges->add(get_string('managebadges', 'badges'), $url, self::TYPE_SETTING); }$badges->add(get_string('preferences', 'badges'), new moodle_url('/badges/preferences.php'),
index fe82755..4efe670 100644 (file)
@@ -503,7 +503,7 @@ class help_icon implements renderable {
* @package core
* @category output
*/
-class pix_icon implements renderable {
+class pix_icon implements renderable, templatable {

/**
* @var string The icon name
@@ -545,6 +545,24 @@ class pix_icon implements renderable {
unset($this->attributes['title']); } } + + /** + * Export this data so it can be used as the context for a mustache template. + * + * @param renderer_base$output Used to do a final render of any components that need to be rendered for export.
+     * @return array
+     */
+    public function export_for_template(renderer_base $output) { +$attributes = $this->attributes; +$attributes['src'] = $output->pix_url($this->pix, $this->component); +$templatecontext = array();
+        foreach ($attributes as$name => $value) { +$templatecontext[] = array('name' => $name, 'value' =>$value);
+        }
+        $data = array('attributes' =>$templatecontext);
+
+        return $data; + } } /** index 5ac7300..2d7cabf 100644 (file) @@ -337,10 +337,7 @@ class standard_renderer_factory extends renderer_factory_base { throw new coding_exception('Request for an unknown renderer class. Searched for: ' . var_export($classnames, true));
}

-        $renderer = new$classname($page,$target);
-        $renderer->set_component($component);
-        $renderer->set_subtype($subtype);
-        return $renderer; + return new$classname($page,$target);
}
}

@@ -404,10 +401,7 @@ class theme_overridden_renderer_factory extends renderer_factory_base {
$newclassname =$prefix . '_' . $classnamedetails['classname'] .$suffix;
}
if (class_exists($newclassname)) { -$renderer = new $newclassname($page, $target); -$renderer->set_component($component); -$renderer->set_subtype($subtype); - return$renderer;
+                        return new $newclassname($page, $target); } } } @@ -418,10 +412,7 @@ class theme_overridden_renderer_factory extends renderer_factory_base { if (class_exists($newclassname)) {
// Use the specialised renderer for given target, default renderer might also decide
// to implement support for more targets.
-                    $renderer = new$newclassname($page,$target);
-                    $renderer->set_component($component);
-                    $renderer->set_subtype($subtype);
-                    return $renderer; + return new$newclassname($page,$target);
}
}
}
@@ -436,10 +427,7 @@ class theme_overridden_renderer_factory extends renderer_factory_base {
$newclassname =$prefix . '_' . $classnamedetails['classname']; } if (class_exists($newclassname)) {
-                        $renderer = new$newclassname($page,$target);
-                        $renderer->set_component($component);
-                        $renderer->set_subtype($subtype);
-                        return $renderer; + return new$newclassname($page,$target);
}
}
}
@@ -450,10 +438,7 @@ class theme_overridden_renderer_factory extends renderer_factory_base {
if ($classnamedetails['validwithoutprefix']) {$newclassname = $classnamedetails['classname']; if (class_exists($newclassname)) {
-                    $renderer = new$newclassname($page,$target);
-                    $renderer->set_component($component);
-                    $renderer->set_subtype($subtype);
-                    return $renderer; + return new$newclassname($page,$target);
}
}
}
index 1df85ac..ab26c4b 100644 (file)
@@ -71,38 +71,6 @@ class renderer_base {
*/
private $mustache; - /** - * @var string$component The component used when requesting this renderer.
-     */
-    private $component; - - /** - * @var string$subtype The subtype used when requesting this renderer.
-     */
-    private $subtype; - - /** - * This is not done in the constructor because that would be a - * compatibility breaking change, and we can just pass this always in the - * renderer factory, immediately after creating the renderer. - * @since 2.9 - * @param string$subtype
-     */
-    public function set_subtype($subtype) { -$this->subtype = $subtype; - } - - /** - * This is not done in the constructor because that would be a - * compatibility breaking change, and we can just pass this always in the - * renderer factory, immediately after creating the renderer. - * @since 2.9 - * @param string$component
-     */
-    public function set_component($component) { -$this->component = $component; - } - /** * Return an instance of the mustache class. * @@ -118,53 +86,10 @@ class renderer_base {$themename = $this->page->theme->name;$themerev = theme_get_revision();
-            $target =$this->target;

-            $cachedir = make_localcache_directory("mustache/$themerev/$themename/$target");
-            $loaderoptions = array(); - - // Where are all the places we should look for templates? - -$suffix = $this->component; - if ($this->subtype !== null) {
-                $suffix .= '_' .$this->subtype;
-            }
-
-            // Start with an empty list.
-            $loader = new Mustache_Loader_CascadingLoader(array()); -$loaderdir = $CFG->dirroot . '/theme/' .$themename . '/templates/' . $suffix; - if (is_dir($loaderdir)) {
-                $loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions)); - } - - // Search each of the parent themes second. - foreach ($this->page->theme->parents as $parent) { -$loaderdir = $CFG->dirroot . '/theme/' .$parent . '/templates/' . $suffix; - if (is_dir($loaderdir)) {
-                    $loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions)); - } - } - - // Look in a components templates dir for a base implementation. - -$compdirectory = core_component::get_component_directory($suffix); - if ($compdirectory) {
-                $loaderdir =$compdirectory . '/templates';
-                if (is_dir($loaderdir)) { -$loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir,$loaderoptions));
-                }
-            }
-
-            // Look in the core templates dir as a final fallback.
-
-            $compdirectory =$CFG->libdir;
-            if ($compdirectory) { -$loaderdir = $compdirectory . '/templates'; - if (is_dir($loaderdir)) {
-                    $loader->addLoader(new \core\output\mustache_filesystem_loader($loaderdir, $loaderoptions)); - } - } +$cachedir = make_localcache_directory("mustache/$themerev/$themename");

+            $loader = new \core\output\mustache_filesystem_loader();$stringhelper = new \core\output\mustache_string_helper();
$jshelper = new \core\output\mustache_javascript_helper($this->page->requires);
$pixhelper = new \core\output\mustache_pix_helper($this);
@@ -2170,13 +2095,8 @@ class core_renderer extends renderer_base {
* @return string HTML fragment
*/
protected function render_pix_icon(pix_icon $icon) { -$attributes = $icon->attributes; -$attributes['src'] = $this->pix_url($icon->pix, $icon->component); -$templatecontext = array();
-        foreach ($attributes as$name => $value) { -$templatecontext[] = array('name' => $name, 'value' =>$value);
-        }
-        return $this->render_from_template('core/pix_icon', array('attributes' =>$templatecontext));
+        $data =$icon->export_for_template($this); + return$this->render_from_template('core/pix_icon', $data); } /** @@ -4120,17 +4040,11 @@ EOD; /** * Wrapper for header elements. * - * @param string$heading Heading to be used for the main header.
* @return string HTML to display the main header.
*/
-    public function full_header($heading = null) { + public function full_header() {$html = html_writer::start_tag('header', array('id' => 'page-header', 'class' => 'clearfix'));
-        // This is to ensure that the logo completely overwrites the header if set.
-        if (isset($heading) &&$heading == '<div class="logo"></div>') {
-            $html .=$heading;
-        } else {
-            $html .=$this->context_header(array('heading' => $heading)); - } +$html .= $this->context_header();$html .= html_writer::start_div('clearfix', array('id' => 'page-navbar'));
$html .= html_writer::tag('nav',$this->navbar(), array('class' => 'breadcrumb-nav'));
$html .= html_writer::div($this->page_heading_button(), 'breadcrumb-button');
diff --git a/lib/tests/fixtures/messageinbound/SAMPLE b/lib/tests/fixtures/messageinbound/SAMPLE
new file mode 100644 (file)
index 0000000..26f36ea
--- /dev/null
@@ -0,0 +1,4 @@
+----CLIENT----
+----EXPECTEDPLAIN----
+----EXPECTEDHTML----
+----FULLSOURCE----
diff --git a/lib/tests/fixtures/messageinbound/evolution.test b/lib/tests/fixtures/messageinbound/evolution.test
new file mode 100644 (file)
index 0000000..7b8e5ca
--- /dev/null
@@ -0,0 +1,131 @@
+----CLIENT----
+OS: Ubuntu 14.04
+Mail Client: Evolution
+Client Version: 31.6.0
+Date: 30/04/2015
+
+----EXPECTEDPLAIN----
+An ion meets his atom friend on the street and says he's lost an
+electron. "Are you sure?" asks the atom. The ion replies, "I'm
+positive."
+
+----EXPECTEDHTML----
+An ion meets his atom friend on the street and says he's lost an
+ electron. "Are you sure?" asks the atom. The ion replies, "I'm positive."
+
+----FULLSOURCE----
+Message-ID: <1430198383.10608.0.camel@jean>
+Subject: Re: [DIVERTED t1@localhost] test: Re: test
+From: ankit <ankit@localhost>
+Date: Tue, 28 Apr 2015 10:49:43 +0530
+References:
+         <77abfbf3eea680a5bd9cd88d2ca74e602b2168c7684d404d5049289f49f30e0f@localhost>
+Content-Type: multipart/alternative; boundary="=-HCcF2t8PQgHyHwzJsOEP"
+X-Mailer: Evolution 3.10.4-0ubuntu2
+Mime-Version: 1.0
+X-Evolution-Identity: 1416821596.2740.0@jean
+X-Evolution-Fcc: folder://local/Sent
+X-Evolution-Transport: 1416821597.2740.10@jean
+X-Evolution-Source-Folder: folder://1416821596.2740.2%40jean/INBOX
+X-Evolution-Source-Message: 298
+X-Evolution-Format: text/html
+X-Evolution-Source:
+
+
+--=-HCcF2t8PQgHyHwzJsOEP
+Content-Type: text/plain; charset="UTF-8"
+Content-Transfer-Encoding: 8bit
+
+An ion meets his atom friend on the street and says he's lost an
+electron. "Are you sure?" asks the atom. The ion replies, "I'm
+positive."
+On Tue, 2015-04-28 at 13:18 +0800, Admin User wrote:
+> test » Forums » Forum » test
+>
+> Re: test
+> by Admin User - Tuesday, 28 April
+> 2015, 1:17 PM
+>
+> Tell me a joke
+>
+>
+> See this post in context
+>
+> ______________________________________________________________________
+>
+> Unsubscribe from this discussion Unsubscribe from all forums Change
+> your forum digest preferences
+>
+>
+> You can reply to this forum post via email.
+>
+
+
+
+--=-HCcF2t8PQgHyHwzJsOEP
+Content-Type: text/html; charset="utf-8"
+Content-Transfer-Encoding: 7bit
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
+<HTML>
+  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
+  <META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
+<BODY>
+An ion meets his atom friend on the street and says he's lost an<BR>
+electron. &quot;Are you sure?&quot; asks the atom. The ion replies, &quot;I'm positive.&quot;<BR>
+On Tue, 2015-04-28 at 13:18 +0800, Admin User wrote:
+<BLOCKQUOTE TYPE=CITE>
+    <A HREF="http://localhost/stable_master_forum/course/view.php?id=2">test</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/index.php?id=2">Forums</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/view.php?f=2">Forum</A> &#187; <A HREF="http://localhost/stable_master_forum/mod/forum/discuss.php?d=1">test</A>
+</BLOCKQUOTE>
+<BLOCKQUOTE TYPE=CITE>
+<TR>
+<TD WIDTH="35" VALIGN="top">
+<A HREF="http://localhost/stable_master_forum/user/view.php?id=2&amp;course=2"><IMG SRC="http://localhost/stable_master_forum/theme/image.php?theme=clean&amp;component=core&amp;image=u%2Ff2&amp;svg=0" WIDTH="35" HEIGHT="35" ALIGN="bottom" ALT="Picture of Admin User"></A>
+</TD>
+<TD>
+Re: test
+by <A HREF="http://localhost/stable_master_forum/user/view.php?id=2&amp;course=2">Admin User</A> - Tuesday, 28 April 2015, 1:17 PM
+</TD>
+</TR>
+<TR>
+<TD VALIGN="top">
+&nbsp;
+</TD>
+<TD>
+Tell me a joke<BR>
+<BR>
+<BR>
+<A HREF="http://localhost/stable_master_forum/mod/forum/discuss.php?d=1#p55">See this post in context</A>
+</TD>
+</TR>
+</TABLE>
+
+<HR ALIGN="center">
+
+</BLOCKQUOTE>
+<BLOCKQUOTE TYPE=CITE>
+    <A HREF="http://localhost/stable_master_forum/mod/forum/subscribe.php?id=2&amp;d=1">Unsubscribe from this discussion</A>&nbsp;<A HREF="http://localhost/stable_master_forum/mod/forum/unsubscribeall.php">Unsubscribe from all forums</A>&nbsp;<A HREF="http://localhost/stable_master_forum/mod/forum/index.php?id=2">Change your forum digest preferences</A>
+</BLOCKQUOTE>
+<BLOCKQUOTE TYPE=CITE>
+    <BR>
+    You can reply to this forum post via email.<BR>
+    <BR>
+</BLOCKQUOTE>
+<BR>
+</BODY>
+</HTML>
+
+
+--=-HCcF2t8PQgHyHwzJsOEP--
+
+
diff --git a/lib/tests/fixtures/messageinbound/ios.test b/lib/tests/fixtures/messageinbound/ios.test
new file mode 100644 (file)
index 0000000..dff0d72
--- /dev/null
@@ -0,0 +1,335 @@
+----CLIENT----
+OS: ios 8.1.1
+Mail Client: ios (iPad Mini Retina)
+Client Version: 8.1.1
+Date: 04/05/2015
+
+----EXPECTEDPLAIN----
+
+Thanks for offering to help with QA testing. I've added you to the testers group in the tracker, so you can now pass or fail QA tests. Hopefully the process is fully explained in http://docs.moodle.org/dev/QA_testing but if there's anything you're not sure about, please post in the testing and QA forum.
+
+
+Thanks for offering to help with QA testing. Please create an account in the Moodle Tracker and let me know your Tracker username then I can add you to the testers group.
+
+
+Thanks for offering to help with QA testing. We recently finished the Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however you are welcome to try things out on our Moodle QA Testing site http://qa.moodle.net/ and post in the Testing and QA forum http://moodle.org/mod/forum/view.php?id=56 about any issues you come across, or any questions you have. If you come across any bugs (obvious problems), please report them in the Moodle tracker.
+
+
+Thanks for helping with QA testing. Your help would be appreciated even more if you could just add a comment when passing a test, such as feedback about the feature e.g. “Teachers are going to love this” or even simply "This test passes - yippee!" to confirm that the test wasn't accidentally passed without being run.
+
+Thanks for helping with QA testing. It has been observed that you assigned this issue to yourself for testing, but no action has been taken on this.  It will be helpful if you can either test this or un-assign yourself, so someone else can take it.
+
+----EXPECTEDHTML----
+
+Thanks for offering to help with QA testing. I've added you to the testers
+group in the tracker, so you can now pass or fail QA tests. Hopefully the
+process is fully explained in http://docs.moodle.org/dev/QA_testing [10]
+but if there's anything you're not sure about, please post in the testing
+and QA forum.
+
+Thanks for offering to help with QA testing. Please create an account in
+the Moodle Tracker and let me know your Tracker username then I can add you
+to the testers group.
+
+Thanks for offering to help with QA testing. We recently finished the
+Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however you
+are welcome to try things out on our Moodle QA Testing site
+http://qa.moodle.net/ [11] and post in the Testing and QA forum
+http://moodle.org/mod/forum/view.php?id=56 [12] about any issues you come
+across, or any questions you have. If you come across any bugs (obvious
+problems), please report them in the Moodle tracker.
+
+Thanks for helping with QA testing. Your help would be appreciated even
+more if you could just add a comment when passing a test, such as feedback
+about the feature e.g. “Teachers are going to love this” or even simply
+"This test passes - yippee!" to confirm that the test wasn't accidentally
+passed without being run.
+
+Thanks for helping with QA testing. It has been observed that you assigned
+this issue to yourself for testing, but no action has been taken on this.
+It will be helpful if you can either test this or un-assign yourself, so
+someone else can take it.
+
+
+----FULLSOURCE----
+Delivered-To: moodlehqtest+aaaaaaaaaaiaaaaaaaaaagaaaaaaaaayvgt8xe92mmlgeicg@example.com
+Received: by 10.50.159.130 with SMTP id xc2csp1451249igb;
+        Sun, 3 May 2015 20:02:36 -0700 (PDT)
+        Sun, 03 May 2015 20:02:36 -0700 (PDT)
+Return-Path: <andrewrn@example.com>
+        by mx.google.com with ESMTPS id gl6si17965581pac.197.2015.05.03.20.02.35
+        for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
+        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+        Sun, 03 May 2015 20:02:36 -0700 (PDT)
+Received-SPF: pass (google.com: domain of andrewrn@example.com designates 2607:f8b0:400e:c03::229 as permitted sender) client-ip=2607:f8b0:400e:c03::229;
+       spf=pass (google.com: domain of andrewrn@example.com designates 2607:f8b0:400e:c03::229 as permitted sender) smtp.mail=andrewrn@example.com;
+        for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>; Sun, 03 May 2015 20:02:35 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=gmail.com; s=20120113;
+        h=from:content-type:content-transfer-encoding:mime-version:subject
+        bh=EZm73X2O6OdzfLc1nsBxWhkpKHmDJNt33U63cRjQHAw=;
+         qNm6cTY+x3kx/ZPQLfpaQD4+QrEHteu8T4pilbjN0ikpu8K1lRMGXRqDjLf49yNJaXpP
+         J4kMoye4i+3LA6ffGGer/5gax/s/gZ2M6nD8OCTuCxIVu51etROhDdo5OfsUK5w97R6P
+         33bMm6wfzd/OjLrNNaFZydGEHK4qQUgwn7GcYi1cAq7g9SLl1lWT6n65IrhMkaqroDnV
+         zrMw==
+X-Received: by 10.70.140.108 with SMTP id rf12mr38069446pdb.140.1430708555833;
+        Sun, 03 May 2015 20:02:35 -0700 (PDT)
+Return-Path: <andrewrn@example.com>
+        by mx.google.com with ESMTPSA id yv6sm2329352pac.29.2015.05.03.20.02.34
+        for <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
+        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
+        Sun, 03 May 2015 20:02:34 -0700 (PDT)
+From: Andrew Robert Nicols <andrewrn@example.com>
+Content-Type: multipart/alternative;
+       boundary=Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
+Content-Transfer-Encoding: 7bit
+Mime-Version: 1.0 (1.0)
+Subject: Re: MDL-48002: Testing of MDL-48002
+Message-Id: <ECE56778-577F-4B37-A28B-7789A19BBF3A@example.com>
+Date: Mon, 4 May 2015 11:02:31 +0800
+References: <15b35e982364f0003cea36e7a0464787ee6127fe5c21a54d229021314547699c@banana.per.in.moodle.com>
+To: "moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com" <moodlehqtest+AAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAYvGT8Xe92mmlGEicg@example.com>
+
+
+--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
+Content-Type: text/plain;
+       charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+
+ =09
+
+Thanks for offering to help with QA testing. I've added you to the testers g=
+roup in the tracker, so you can now pass or fail QA tests. Hopefully the pro=
+cess is fully explained in http://docs.moodle.org/dev/QA_testing but if ther=
+e's anything you're not sure about, please post in the testing and QA forum.=
+
+
+
+Thanks for offering to help with QA testing. Please create an account in the=
+ Moodle Tracker and let me know your Tracker username then I can add you to t=
+he testers group.
+
+
+Thanks for offering to help with QA testing. We recently finished the Moodle=
+ 2.8 QA cycle, so our next QA cycle won't be for a while, however you are we=
+lcome to try things out on our Moodle QA Testing site http://qa.moodle.net/ a=
+nd post in the Testing and QA forum http://moodle.org/mod/forum/view.php?id=3D=
+56 about any issues you come across, or any questions you have. If you come a=
+cross any bugs (obvious problems), please report them in the Moodle tracker.=
+
+
+
+Thanks for helping with QA testing. Your help would be appreciated even more=
+ if you could just add a comment when passing a test, such as feedback about=
+ the feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even s=
+imply "This test passes - yippee!" to confirm that the test wasn't accidenta=
+lly passed without being run.
+
+Thanks for helping with QA testing. It has been observed that you assigned t=
+his issue to yourself for testing, but no action has been taken on this.  It=
+ will be helpful if you can either test this or un-assign yourself, so someo=
+ne else can take it.
+
+
+> On 4 May 2015, at 11:02 am, Admin User <andrew@nicols.co.uk> wrote:
+>=20
+> MDL-48002 =C2=BB Forums =C2=BB MDL-48002 =C2=BB Testing of MDL-48002
+> =09
+> Testing of MDL-48002
+> by Admin User - Monday, 4 May 2015, 10:48 AM
+>  =09
+> We are trying to test that this issue will work as expected.
+>=20
+> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis convallis ph=
+aretra justo dignissim cursus. Sed sagittis, velit vel scelerisque sollicitu=
+din, neque purus pulvinar nisi, quis semper urna dolor nec est. Maecenas ut d=
+ui accumsan, tincidunt sem ac, efficitur lorem. Vivamus consequat viverra er=
+os eget cursus. Morbi porttitor nunc vehicula consequat laoreet. Pellentesqu=
+e ac diam vel libero finibus sodales a fringilla erat. Ut elementum ante ege=
+t convallis dignissim. Proin iaculis mauris nec diam maximus, ac scelerisque=
+ metus tincidunt. Nullam tincidunt turpis ut aliquam volutpat. Vestibulum an=
+te ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; D=
+onec neque quam, sollicitudin bibendum ipsum id, malesuada convallis orci.
+>=20
+> Cras posuere, velit et consectetur euismod, orci ante malesuada libero, eu=
+ tincidunt tortor elit vitae tellus. Nunc vel felis id metus fringilla lobor=
+tis. Sed sit amet ipsum vitae dolor aliquet dapibus eu vel nulla. Sed id dui=
+ nec nisl hendrerit blandit ut et turpis. Donec dictum nunc mauris, quis pla=
+cerat tellus fermentum ac. Phasellus at fermentum quam. Phasellus magna magn=
+a, pharetra pharetra pellentesque a, convallis non leo. Nunc ac semper est. U=
+t interdum condimentum nunc sit amet sollicitudin. Aenean vitae sodales dolo=
+r, vitae porta felis. Aliquam tincidunt posuere lorem sed mollis. Vestibulum=
+ sed quam convallis, commodo ante et, rhoncus metus. Sed arcu diam, venenati=
+s vel urna eu, porta viverra massa. Suspendisse nec consectetur risus, quis h=
+endrerit arcu. Ut purus metus, varius sit amet mauris non, posuere ultricies=
+ velit. Nullam nec luctus lorem.
+>=20
+> Proin quis turpis efficitur, auctor dui nec, vulputate ligula. Sed egestas=
+ facilisis magna nec posuere. Nam nisl nibh, dictum in velit eget, dapibus e=
+uismod lacus. Phasellus mollis eros nibh, eu venenatis libero luctus eu. Eti=
+am ultricies turpis interdum, rutrum leo sed, sollicitudin lectus. Suspendis=
+se potenti. Vestibulum in purus orci. Pellentesque fringilla nunc ac diam tr=
+istique pellentesque. Duis tincidunt mi ipsum, ac consequat augue iaculis a.=
+ Ut ut erat at lacus lobortis facilisis at at ipsum. Aliquam ut nisi posuere=
+, dictum arcu id, placerat nisl. Vivamus in ex et lorem tempor iaculis eleme=
+ntum quis nunc.
+>=20
+> Some more text here.
+>=20
+> Now in the reply we will not remove the content and sent a bit of a reply.=
+
+>=20
+> See this post in context
+> Unsubscribe from this discussion Unsubscribe from all forums Change your f=
+orum digest preferences
+> You can reply to this via email.
+
+--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F
+Content-Type: text/html;
+       charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+
+;"><tbody><tr><td class=3D"left side" valign=3D"top"><span style=3D"-webkit-=
+text-size-adjust: none; background-color: rgba(255, 255, 255, 0);">&nbsp;</s=
+pan></td><td class=3D"content"><p></p><p dir=3D"ltr" style=3D"margin-top: 0p=
+t; margin-bottom: 0pt;"><span style=3D"vertical-align: baseline; -webkit-tex=
+nd-color: rgba(255, 255, 255, 0);"><br></span><p dir=3D"ltr" style=3D"margin=
+-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style: italic; vertical-=
+align: baseline; -webkit-text-size-adjust: none; background-color: rgba(255,=
+ 255, 255, 0);">Thanks for offering to help with QA testing. I've added you t=
+o the testers group in the tracker, so you can now pass or fail QA tests. Ho=
+pefully the process is fully explained in <a href=3D"http://docs.moodle.org/=
+dev/QA_testing" x-apple-data-detectors=3D"true" x-apple-data-detectors-type=3D=
+ting</a> but if there's anything you're not sure about, please post in the t=
+esting and QA forum.</span></p><span style=3D"-webkit-text-size-adjust: none=
+; background-color: rgba(255, 255, 255, 0);"><br><br></span><p dir=3D"ltr" s=
+tyle=3D"margin-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style: ita=
+lic; vertical-align: baseline; -webkit-text-size-adjust: none; background-co=
+lor: rgba(255, 255, 255, 0);">Thanks for offering to help with QA testing. P=
+lease create an account in the Moodle Tracker and let me know your Tracker u=
+sername then I can add you to the testers group.</span></p><span style=3D"-w=
+ebkit-text-size-adjust: none; background-color: rgba(255, 255, 255, 0);"><br=
+><br></span><p dir=3D"ltr" style=3D"margin-top: 0pt; margin-bottom: 0pt;"><s=
+pan style=3D"font-style: italic; vertical-align: baseline; -webkit-text-size=
+-adjust: none; background-color: rgba(255, 255, 255, 0);">Thanks for offerin=
+g to help with QA testing. We recently finished the Moodle 2.8 QA cycle, so o=
+ur next QA cycle won't be for a while, however you are welcome to try things=
+ out on our Moodle QA Testing site <a href=3D"http://qa.moodle.net/" x-apple=
+etectors-result=3D"3">http://qa.moodle.net/</a> and post in the Testing and Q=
+A forum <a href=3D"http://moodle.org/mod/forum/view.php?id=3D56" x-apple-dat=
+ issues you come across, or any questions you have. If you come across any b=
+ugs (obvious problems), please report them in the Moodle tracker.</span></p>=
+<span style=3D"-webkit-text-size-adjust: none; background-color: rgba(255, 2=
+55, 255, 0);"><br><br></span><p dir=3D"ltr" style=3D"margin-top: 0pt; margin=
+-bottom: 0pt;"><span style=3D"font-style: italic; vertical-align: baseline; -=
+webkit-text-size-adjust: none; background-color: rgba(255, 255, 255, 0);">Th=
+anks for helping with QA testing. Your help would be appreciated even more i=
+f you could just add a comment when passing a test, such as feedback about t=
+he feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even si=
+mply "This test passes - yippee!" to confirm that the test wasn't accidental=
+ly passed without being run.</span></p><span style=3D"-webkit-text-size-adju=
+st: none; background-color: rgba(255, 255, 255, 0);"><br></span><p dir=3D"lt=
+r" style=3D"margin-top: 0pt; margin-bottom: 0pt;"><span style=3D"font-style:=
+ italic; vertical-align: baseline; -webkit-text-size-adjust: none; backgroun=
+d-color: rgba(255, 255, 255, 0);">Thanks for helping with QA testing. It has=
+ been observed that you assigned this issue to yourself for testing, but no a=
+ction has been taken on this. &nbsp;It will be helpful if you can either tes=
+t this or un-assign yourself, so someone else can take it.</span></p></td></=
+tr></tbody></table><br>Sent from my iPad</div><div><br>On 4 May 2015, at 11:=
+02 am, Admin User &lt;<a href=3D"mailto:andrew@nicols.co.uk">andrew@nicols.c=
+o.uk</a>&gt; wrote:<br><br></div><blockquote type=3D"cite"><div>
+
+
+<div class=3D"navbar"><a target=3D"_blank" href=3D"http://banana.per.in.mood=
+le.com/mdl48002/course/view.php?id=3D3">MDL-48002</a> =C2=BB <a target=3D"_b=
+lank" href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?i=
+d=3D3">Forums</a> =C2=BB <a target=3D"_blank" href=3D"http://banana.per.in.m=
+oodle.com/mdl48002/mod/forum/view.php?f=3D5">MDL-48002</a> =C2=BB <a target=3D=
+"_blank" href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.=
+th=3D"35" valign=3D"top" class=3D"picture left"><a href=3D"http://banana.per=
+.in.moodle.com/mdl48002/user/view.php?id=3D2&amp;course=3D3"><img src=3D"htt=
+p://banana.per.in.moodle.com/mdl48002/theme/image.php/_s/clean/core/14307067=
+=3D"userpicture defaultuserpic" width=3D"35" height=3D"35"></a></td><td clas=
+s=3D"topic starter"><div class=3D"subject">Testing of MDL-48002</div><div cl=
+ass=3D"author">by <a href=3D"http://banana.per.in.moodle.com/mdl48002/user/v=
+iew.php?id=3D2&amp;course=3D3">Admin User</a> - Monday, 4 May 2015, 10:48 AM=
+</div></td></tr><tr><td class=3D"left side" valign=3D"top">&nbsp;</td><td cl=
+ass=3D"content"><p>We are trying to test that this issue will work as expect=
+ed.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis conv=
+allis pharetra justo dignissim cursus. Sed sagittis, velit vel scelerisque s=
+ollicitudin, neque purus pulvinar nisi, quis semper urna dolor nec est. Maec=
+enas ut dui accumsan, tincidunt sem ac, efficitur lorem. Vivamus consequat v=
+iverra eros eget cursus. Morbi porttitor nunc vehicula consequat laoreet. Pe=
+llentesque ac diam vel libero finibus sodales a fringilla erat. Ut elementum=
+ ante eget convallis dignissim. Proin iaculis mauris nec diam maximus, ac sc=
+elerisque metus tincidunt. Nullam tincidunt turpis ut aliquam volutpat. Vest=
+ibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia=
+ Curae; Donec neque quam, sollicitudin bibendum ipsum id, malesuada convalli=
+s orci.</p><p>Cras posuere, velit et consectetur euismod, orci ante malesuad=
+a libero, eu tincidunt tortor elit vitae tellus. Nunc vel felis id metus fri=
+ngilla lobortis. Sed sit amet ipsum vitae dolor aliquet dapibus eu vel nulla=
+. Sed id dui nec nisl hendrerit blandit ut et turpis. Donec dictum nunc maur=
+is, quis placerat tellus fermentum ac. Phasellus at fermentum quam. Phasellu=
+s magna magna, pharetra pharetra pellentesque a, convallis non leo. Nunc ac s=
+emper est. Ut interdum condimentum nunc sit amet sollicitudin. Aenean vitae s=
+odales dolor, vitae porta felis. Aliquam tincidunt posuere lorem sed mollis.=
+ Vestibulum sed quam convallis, commodo ante et, rhoncus metus. Sed arcu dia=
+m, venenatis vel urna eu, porta viverra massa. Suspendisse nec consectetur r=
+isus, quis hendrerit arcu. Ut purus metus, varius sit amet mauris non, posue=
+re ultricies velit. Nullam nec luctus lorem.</p><p>Proin quis turpis efficit=
+ur, auctor dui nec, vulputate ligula. Sed egestas facilisis magna nec posuer=
+e. Nam nisl nibh, dictum in velit eget, dapibus euismod lacus. Phasellus mol=
+lis eros nibh, eu venenatis libero luctus eu. Etiam ultricies turpis interdu=
+m, rutrum leo sed, sollicitudin lectus. Suspendisse potenti. Vestibulum in p=
+urus orci. Pellentesque fringilla nunc ac diam tristique pellentesque. Duis t=
+incidunt mi ipsum, ac consequat augue iaculis a. Ut ut erat at lacus loborti=
+s facilisis at at ipsum. Aliquam ut nisi posuere, dictum arcu id, placerat n=
+isl. Vivamus in ex et lorem tempor iaculis elementum quis nunc.</p><p>Some m=
+ore text here.</p><p>Now in the reply we will not remove the content and sen=
+t a bit of a reply.</p><div class=3D"commands"><a target=3D"_blank" href=3D"=
+r.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p24">See this post in c=
+ontext</a></div></td></tr></tbody></table>
+
+.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5&amp;d=3D8">Unsubscribe f=
+rom this discussion</a>&nbsp;<a href=3D"http://banana.per.in.moodle.com/mdl4=
+8002/mod/forum/unsubscribeall.php">Unsubscribe from all forums</a>&nbsp;<a h=
+ref=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3">=
+Change your forum digest preferences</a></div><p>You can reply to this via e=
+mail.</p>
+
+</div></blockquote></body></html>=
+
+--Apple-Mail-97963C5D-72E2-413A-89FF-624233E4337F--
\ No newline at end of file
diff --git a/lib/tests/fixtures/messageinbound/outlook.test b/lib/tests/fixtures/messageinbound/outlook.test
new file mode 100644 (file)
index 0000000..da32453
--- /dev/null
@@ -0,0 +1,261 @@
+----CLIENT----
+OS: Win 7
+Mail Client: Outlook 2013
+Client Version: 15.0.4569.1503
+Date: 04/05/2015
+
+----EXPECTEDPLAIN----
+Sending mail via clent and it seems to go all good...
+
+Havent tried this before and its so slow....
+
+Cheers
+Rajesh
+
+----EXPECTEDHTML----
+Sending mail via clent and it seems to go all good...
+
+Havent tried this before and its so slow....
+
+Cheers
+
+----FULLSOURCE----
+Delivered-To: moodlehqtest+aaaaaaaaaaiaaaaaaaaabqaaaaaaaaazd63zvl6kcy04ioh+@example.com
+Received: by 10.50.159.130 with SMTP id xc2csp1452325igb;
+        Sun, 3 May 2015 20:06:33 -0700 (PDT)
+X-Received: by 10.182.42.131 with SMTP id o3mr16558872obl.59.1430708792759;
+        Sun, 03 May 2015 20:06:32 -0700 (PDT)
+Return-Path: <rajesh.taneja@example.com>
+        by mx.google.com with ESMTPS id bb9si7457620obb.49.2015.05.03.20.06.32
+        for <moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com>
+        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+        Sun, 03 May 2015 20:06:32 -0700 (PDT)
+Received-SPF: pass (google.com: domain of rajesh.taneja@example.com designates 2607:f8b0:4003:c06::232 as permitted sender) client-ip=2607:f8b0:4003:c06::232;
+       spf=pass (google.com: domain of rajesh.taneja@example.com designates 2607:f8b0:4003:c06::232 as permitted sender) smtp.mail=rajesh.taneja@example.com;
+        for <moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com>; Sun, 03 May 2015 20:06:32 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+        d=example.com; s=20120113;
+         :content-type;
+        bh=PP8NIhvbaEoIB2TwtsICSY6RhRgAhmJDKfcS/XCrsjk=;
+        b=bEJMEs0yNfdFSzchg5vhQXD6W9MuubLtBBZzLRE6UHCW93ZxgTwFJXjyEq5ZAGiWT6
+         2g5feEHEe6CYYOojIVGy10yh0l1XfK6kn4VgnzFTHO65RtqKggrYjijpsqqFY6moE5QC
+         F1gakGp7mpaT72QVx/Pu+L9rwO1MA4vfG2RstjWZMPD/dzS2HlrYwjsI8ScpO4u/oros
+         xl9/xWQ6brRi0co1ISSHgsaYWYAcgt6uSpGzzyL8OAA5vVWnxBSKVg+zYxY3rIo7Xbd+
+         vfg/Ne1CkkQ4mM4ig4P7vDQBtgN5mm6I4GF5y3uSd2asr4Wjsw183vqSc8OhfvNL2owy
+         m59w==
+MIME-Version: 1.0
+X-Received: by 10.202.230.11 with SMTP id d11mr15578479oih.6.1430708792570;
+ Sun, 03 May 2015 20:06:32 -0700 (PDT)
+Received: by 10.202.0.68 with HTTP; Sun, 3 May 2015 20:06:32 -0700 (PDT)
+Received: by 10.202.0.68 with HTTP; Sun, 3 May 2015 20:06:32 -0700 (PDT)
+References: <a2cf1c399f255d43697f2ca2094f09ec00779b255ae27bb457557dcc0de72d04@banana.per.in.moodle.com>
+       <669f8f3b6ac48139941bed5fcd069b97801de3b6920fe49cf6be18a5e23db0e8@banana.per.in.moodle.com>
+Date: Mon, 4 May 2015 11:06:32 +0800
+Message-ID: <CAEavSoBRiVHuk3hX9G8hbgPhJPb4KTfcjS-Kq2Qh_gdkP6hgEA@mail.example.com>
+Subject: Re: MDL-48002: Re: Testing of MDL-48002
+From: Rajesh Taneja <rajesh.taneja@example.com>
+To: moodlehqtest+AAAAAAAAAAIAAAAAAAAABQAAAAAAAAAZD63zvl6KcY04ioh+@example.com
+Content-Type: multipart/alternative; boundary=001a1140761a5bdf4c051538d992
+
+--001a1140761a5bdf4c051538d992
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: quoted-printable
+
+Sending mail via clent and it seems to go all good...
+
+Havent tried this before and its so slow....
+
+Cheers
+Rajesh
+On 4 May 2015 11:01 am, "Rajesh Taneja" <rajesh.taneja@example.com> wrote:
+
+>  MDL-48002 <http://banana.per.in.moodle.com/mdl48002/course/view.php?id=
+=3D3>
+> =C2=BB Forums
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3> =C2=
+=BB
+> MDL-48002
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/view.php?f=3D5> =C2=
+=BB Testing
+> of MDL-48002
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8>
+> [image: Picture of Rajesh Taneja]
+> <http://banana.per.in.moodle.com/mdl48002/user/view.php?id=3D5&course=3D3=
+>
+> Re: Testing of MDL-48002
+> by Rajesh Taneja
+> <http://banana.per.in.moodle.com/mdl48002/user/view.php?id=3D5&course=3D3=
+> -
+> Monday, 4 May 2015, 11:02 AM
+>
+>
+>
+> Thanks for offering to help with QA testing. I've added you to the tester=
+s
+> group in the tracker, so you can now pass or fail QA tests. Hopefully the
+> process is fully explained in http://docs.moodle.org/dev/QA_testing but
+> if there's anything you're not sure about, please post in the testing and
+> QA forum.
+>
+>
+> Thanks for offering to help with QA testing. Please create an account in
+> the Moodle Tracker and let me know your Tracker username then I can add y=
+ou
+> to the testers group.
+>
+>
+> Thanks for offering to help with QA testing. We recently finished the
+> Moodle 2.8 QA cycle, so our next QA cycle won't be for a while, however y=
+ou
+> are welcome to try things out on our Moodle QA Testing site
+> http://qa.moodle.net/ and post in the Testing and QA forum
+> http://moodle.org/mod/forum/view.php?id=3D56 about any issues you come
+> across, or any questions you have. If you come across any bugs (obvious
+> problems), please report them in the Moodle tracker.
+>
+>
+> Thanks for helping with QA testing. Your help would be appreciated even
+> more if you could just add a comment when passing a test, such as feedbac=
+k
+> about the feature e.g. =E2=80=9CTeachers are going to love this=E2=80=9D =
+or even simply
+> "This test passes - yippee!" to confirm that the test wasn't accidentally
+> passed without being run.
+>
+> Thanks for helping with QA testing. It has been observed that you assigne=
+d
+> this issue to yourself for testing, but no action has been taken on this.
+> It will be helpful if you can either test this or un-assign yourself, so
+> someone else can take it.
+>
+>
+> Show parent
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8&par=
+ent=3D24>
+> See this post in context
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p25=
+>
+> ------------------------------
+> Unsubscribe from this forum
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5>=
+ Unsubscribe
+> from this discussion
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?id=3D5&=
+d=3D8>
+>  Unsubscribe from all forums
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/unsubscribeall.php> C=
+hange
+> your forum digest preferences
+> <http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3>
+>
+> You can reply to this via email.
+>
+
+--001a1140761a5bdf4c051538d992
+Content-Type: text/html; charset=UTF-8
+Content-Transfer-Encoding: quoted-printable
+
+<p dir=3D"ltr">Sending mail via clent and it seems to go all good...</p>
+<p dir=3D"ltr">Havent tried this before and its so slow....</p>
+<p dir=3D"ltr">Cheers<br>
+Rajesh</p>
+<div class=3D"gmail_quote">On 4 May 2015 11:01 am, &quot;Rajesh Taneja&quot=
+; &lt;<a href=3D"mailto:rajesh.taneja@example.com">rajesh.taneja@example.com</a=
+e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<div>
+
+<div><a href=3D"http://banana.per.in.moodle.com/mdl48002/course/view.php?id=
+=3D3" target=3D"_blank">MDL-48002</a> =C2=BB <a href=3D"http://banana.per.i=
+n.moodle.com/mdl48002/mod/forum/index.php?id=3D3" target=3D"_blank">Forums<=
+/a> =C2=BB <a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/vi=
+ew.php?f=3D5" target=3D"_blank">MDL-48002</a> =C2=BB <a href=3D"http://bana=
+na.per.in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8" target=3D"_blank=
+">Testing of MDL-48002</a></div><table border=3D"0" cellpadding=3D"3" cells=
+pacing=3D"0"><tr><td width=3D"35" valign=3D"top"><a href=3D"http://banana.p=
+er.in.moodle.com/mdl48002/user/view.php?id=3D5&amp;course=3D3" target=3D"_b=
+lank"><img src=3D"http://banana.per.in.moodle.com/mdl48002/theme/image.php/=
+_s/clean/core/1430706779/u/f2" alt=3D"Picture of Rajesh Taneja" title=3D"Pi=
+cture of Rajesh Taneja" width=3D"35" height=3D"35"></a></td><td><div>Re: Te=
+sting of MDL-48002</div><div>by <a href=3D"http://banana.per.in.moodle.com/=
+mdl48002/user/view.php?id=3D5&amp;course=3D3" target=3D"_blank">Rajesh Tane=
+ja</a> - Monday, 4 May 2015, 11:02 AM</div></td></tr><tr><td valign=3D"top"=
+>=C2=A0</td><td><p><b style=3D"font-weight:normal"></b></p><p dir=3D"ltr" s=
+tyle=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D"f=
+ont-size:16px;font-family:Arial;color:#000000;background-color:transparent;=
+font-weight:normal;font-style:normal;font-variant:normal;text-decoration:no=
+an></p><br><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-b=
+ottom:0pt"><span style=3D"font-size:16px;font-family:Arial;color:#000000;ba=
+ckground-color:transparent;font-weight:normal;font-style:italic;font-varian=
+t:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"=
+>Thanks for offering to help with QA testing. I&#39;ve added you to the tes=
+ters group in the tracker, so you can now pass or fail QA tests. Hopefully =
+the process is fully explained in <a href=3D"http://docs.moodle.org/dev/QA_=
+testing" target=3D"_blank">http://docs.moodle.org/dev/QA_testing</a> but if=
+ there&#39;s anything you&#39;re not sure about, please post in the testing=
+ and QA forum.</span></p><br><br><p dir=3D"ltr" style=3D"line-height:1.44;m=
+argin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:16px;font-family:=
+Arial;color:#000000;background-color:transparent;font-weight:normal;font-st=
+yle:italic;font-variant:normal;text-decoration:none;vertical-align:baseline=
+;white-space:pre-wrap">Thanks for offering to help with QA testing. Please =
+create an account in the Moodle Tracker and let me know your Tracker userna=
+me then I can add you to the testers group.</span></p><br><br><p dir=3D"ltr=
+" style=3D"line-height:1.44;margin-top:0pt;margin-bottom:0pt"><span style=
+=3D"font-size:16px;font-family:Arial;color:#000000;background-color:transpa=
+rent;font-weight:normal;font-style:italic;font-variant:normal;text-decorati=
+on:none;vertical-align:baseline;white-space:pre-wrap">Thanks for offering t=
+o help with QA testing. We recently finished the Moodle 2.8 QA cycle, so ou=
+r next QA cycle won&#39;t be for a while, however you are welcome to try th=
+ings out on our Moodle QA Testing site <a href=3D"http://qa.moodle.net/" ta=
+rget=3D"_blank">http://qa.moodle.net/</a> and post in the Testing and QA fo=
+rum <a href=3D"http://moodle.org/mod/forum/view.php?id=3D56" target=3D"_bla=
+nk">http://moodle.org/mod/forum/view.php?id=3D56</a> about any issues you c=
+ome across, or any questions you have. If you come across any bugs (obvious=
+ problems), please report them in the Moodle tracker.</span></p><br><br><p =
+dir=3D"ltr" style=3D"line-height:1.44;margin-top:0pt;margin-bottom:0pt"><sp=
+an style=3D"font-size:16px;font-family:Arial;color:#000000;background-color=
+:transparent;font-weight:normal;font-style:italic;font-variant:normal;text-=
+decoration:none;vertical-align:baseline;white-space:pre-wrap">Thanks for he=
+lping with QA testing. Your help would be appreciated even more if you coul=
+d just add a comment when passing a test, such as feedback about the featur=
+e e.g. =E2=80=9CTeachers are going to love this=E2=80=9D or even simply &qu=
+ot;This test passes - yippee!&quot; to confirm that the test wasn&#39;t acc=
+identally passed without being run.</span></p><br><p dir=3D"ltr" style=3D"l=
+ine-height:1.44;margin-top:0pt;margin-bottom:0pt"><span style=3D"font-size:=
+16px;font-family:Arial;color:#000000;background-color:transparent;font-weig=
+ht:normal;font-style:italic;font-variant:normal;text-decoration:none;vertic=
+al-align:baseline;white-space:pre-wrap">Thanks for helping with QA testing.=
+ It has been observed that you assigned this issue to yourself for testing,=
+ but no action has been taken on this.=C2=A0 It will be helpful if you can =
+either test this or un-assign yourself, so someone else can take it.</span>=
+</p><br><br><div><a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/fo=
+rum/discuss.php?d=3D8&amp;parent=3D24" target=3D"_blank">Show parent</a> | =
+<a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/post.php?repl=
+in.moodle.com/mdl48002/mod/forum/discuss.php?d=3D8#p25" target=3D"_blank">S=
+ee this post in context</a></div></td></tr></table>
+
+<hr><div><a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/subs=
+cribe.php?id=3D5" target=3D"_blank">Unsubscribe from this forum</a>=C2=A0<a=
+ href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/subscribe.php?i=
+d=3D5&amp;d=3D8" target=3D"_blank">Unsubscribe from this discussion</a>=C2=
+=A0<a href=3D"http://banana.per.in.moodle.com/mdl48002/mod/forum/unsubscrib=
+eall.php" target=3D"_blank">Unsubscribe from all forums</a>=C2=A0<a href=3D=
+"http://banana.per.in.moodle.com/mdl48002/mod/forum/index.php?id=3D3" targe=
+t=3D"_blank">Change your forum digest preferences</a></div></div><p>You can=
+ reply to this via email.</p>
+
+</blockquote></div>
+
+--001a1140761a5bdf4c051538d992--
\ No newline at end of file
diff --git a/lib/tests/messageinbound_test.php b/lib/tests/messageinbound_test.php
new file mode 100644 (file)
index 0000000..e2fcd97
--- /dev/null
@@ -0,0 +1,167 @@
+<?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/>.
+
+/**
+ * Test classes for \core\message\inbound.
+ *
+ * @package core_message
+ * @category test
+ * @copyright 2015 Andrew Nicols <andrew@nicols.co.uk>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $CFG; + +/** + * Test script for message class. + * + * @package core_message + * @category test + * @copyright 2015 Andrew Nicols <andrew@nicols.co.uk> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class core_messageinbound_testcase extends advanced_testcase { + + /** + * @dataProvider message_inbound_handler_trim_testprovider + */ + public function test_messageinbound_handler_trim($file, $source,$expectedplain, $expectedhtml) { +$this->resetAfterTest();
+
+        $mime = Horde_Mime_Part::parseMessage($source);
+        if ($plainpartid =$mime->findBody('plain')) {
+            $messagedata = new stdClass(); +$messagedata->plain = $mime->getPart($plainpartid)->getContents();
+            $messagedata->html = ''; + + list($message, $format) = test_handler::remove_quoted_text($messagedata);
+            $this->assertEquals($expectedplain, $message); +$this->assertEquals(FORMAT_PLAIN, $format); + } + + if ($htmlpartid = $mime->findBody('html')) { +$messagedata = new stdClass();
+            $messagedata->plain = ''; +$messagedata->html = $mime->getPart($htmlpartid)->getContents();
+
+            list($message,$format) = test_handler::remove_quoted_text($messagedata); +$this->assertEquals($expectedhtml,$message);
+            $this->assertEquals(FORMAT_PLAIN,$format);
+        }
+    }
+
+    public function message_inbound_handler_trim_testprovider() {
+        $fixturesdir = realpath(__DIR__ . '/fixtures/messageinbound/'); +$tests = array();
+        $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($fixturesdir),
+                \RecursiveIteratorIterator::LEAVES_ONLY);
+
+        foreach ($iterator as$file) {
+            if (!preg_match('/\.test$/',$file)) {
+                continue;
+            }
+
+            try {
+                $testdata =$this->read_test_file($file,$fixturesdir);
+            } catch (\Exception $e) { + die($e->getMessage());
+            }
+
+            $test = array( + // The filename. + basename($file),
+
+                    $testdata['FULLSOURCE'], + + // The plaintext component of the message. +$testdata['EXPECTEDPLAIN'],
+
+                    // The HTML component of the message.
+                    $testdata['EXPECTEDHTML'], + ); + +$tests[basename($file)] =$test;
+        }
+        return $tests; + } + + protected function read_test_file(\SplFileInfo$file, $fixturesdir) { + // Break on the --[TOKEN]-- tags in the file. +$tokens = preg_split('#(?:^|\n*)----([A-Z]+)----\n#', file_get_contents($file->getRealPath()), + null, PREG_SPLIT_DELIM_CAPTURE); +$sections = array(
+            // Key              => Required.
+            'FULLSOURCE'        => true,
+            'EXPECTEDPLAIN'     => true,
+            'EXPECTEDHTML'      => true,
+            'CLIENT'            => true, // Required but not needed for tests, just for documentation.
+        );
+        $section = null; +$data = array();
+        foreach ($tokens as$i => $token) { + if (null ===$section && empty($token)) { + continue; // Skip leading blank. + } + if (null ===$section) {
+                if (!isset($sections[$token])) {
+                    throw new coding_exception(sprintf(
+                        'The test file "%s" should not contain a section named "%s".',
+                        basename($file), +$token
+                    ));
+                }
+                $section =$token;
+                continue;
+            }
+            $sectiondata =$token;
+            $data[$section] = $sectiondata; +$section = $sectiondata = null; + } + foreach ($sections as $section =>$required) {
+            if ($required && !isset($data[$section])) { + throw new coding_exception(sprintf( + 'The test file "%s" must have a section named "%s".', + str_replace($fixturesdir.'/', '', $file), +$section
+                ));
+            }
+        }
+        return $data; + } +} + +/** + * Class test_handler + */ +class test_handler extends \core\message\inbound\handler { + + public static function remove_quoted_text($messagedata) {
+        return parent::remove_quoted_text($messagedata); + } + + public static function get_linecount_to_remove($messagedata) {
+        return parent::get_linecount_to_remove($messagedata); + } + + public function get_name() {} + + public function get_description() {} + + public function process_message(stdClass$record, stdClass $messagedata) {} +} diff --git a/lib/tests/mustache_template_finder_test.php b/lib/tests/mustache_template_finder_test.php new file mode 100644 (file) index 0000000..df3237e --- /dev/null @@ -0,0 +1,98 @@ +<?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/>. + +/** + * Unit tests for lib/classes/output/mustache_template_finder.php + * + * @package core + * @category phpunit + * @copyright 2015 Damyon Wiese + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +use core\output\mustache_template_finder; + +/** + * Unit tests for the Mustache template finder class (contains logic about + * resolving mustache template locations. + */ +class core_output_mustache_template_finder_testcase extends advanced_testcase { + + public function test_get_template_directories_for_component() { + global$CFG;
+
+        // Test a plugin.
+        $dirs = mustache_template_finder::get_template_directories_for_component('mod_assign', 'clean'); + +$correct = array(
+            'theme/clean/templates/mod_assign/',
+            'theme/bootstrapbase/templates/mod_assign/',
+            'mod/assign/templates/'
+        );
+        foreach ($dirs as$index => $dir) { +$this->assertSame($dir,$CFG->dirroot . '/' . $correct[$index]);
+        }
+        // Test a subsystem.
+        $dirs = mustache_template_finder::get_template_directories_for_component('core_user', 'clean'); + +$correct = array(
+            'theme/clean/templates/core_user/',
+            'theme/bootstrapbase/templates/core_user/',
+            'user/templates/'
+        );
+        foreach ($dirs as$index => $dir) { +$this->assertSame($dir,$CFG->dirroot . '/' . $correct[$index]);
+        }
+        // Test core.
+        $dirs = mustache_template_finder::get_template_directories_for_component('core', 'clean'); + +$correct = array(
+            'theme/clean/templates/core/',
+            'theme/bootstrapbase/templates/core/',
+            'lib/templates/'
+        );
+        foreach ($dirs as$index => $dir) { +$this->assertSame($dir,$CFG->dirroot . '/' . $correct[$index]);
+        }
+        return;
+    }
+
+    /**
+     * @expectedException coding_exception
+     */
+    public function test_invalid_get_template_directories_for_component() {
+        // Test something invalid.
+        $dirs = mustache_template_finder::get_template_directories_for_component('octopus', 'clean'); + } + + public function test_get_template_filepath() { + global$CFG;
+
+        $filename = mustache_template_finder::get_template_filepath('core/pix_icon', 'clean'); +$correct = $CFG->dirroot . '/lib/templates/pix_icon.mustache'; +$this->assertSame($correct,$filename);
+    }
+
+    /**
+     * @expectedException moodle_exception
+     */
+    public function test_invalid_get_template_filepath() {
+        // Test something invalid.
+        $dirs = mustache_template_finder::get_template_filepath('core/octopus', 'clean'); + } +} index 1507b88..ae7fc1b 100644 (file) @@ -101,7 +101,8 @@ class core_string_manager_standard_testcase extends advanced_testcase {$this->fail('String "'.$string.'" appearing in one of the lang/en/deprecated.txt files does not have correct syntax'); } list($pluginttype, $pluginname) = core_component::normalize_component($matches[2]);
-            if ($matches[2] !==$pluginttype . '_' . $pluginname) { +$normcomponent = $pluginname ? ($pluginttype . '_' . $pluginname) :$pluginttype;
+            if ($matches[2] !==$normcomponent) {
$this->fail('String "'.$string.'" appearing in one of the lang/en/deprecated.txt files does not have normalised component name');
}
if (!$stringman->string_exists($matches[1], $matches[2])) { index 7997d41..784121a 100644 (file) @@ -58,9 +58,9 @@ class core_user_menu_testcase extends advanced_testcase { // And these are combinations containing both valid and invalid. array('messages,message|/message/index.php|message -myfiles,moodle|/user/files.php|download +privatefiles,moodle|/user/files.php|download ### -mybadges,badges|/badges/mybadges.php|award +badges,badges|/badges/mybadges.php|award -|-|- test - @@ -92,7 +92,7 @@ test // We always add two dividers as standard.$dividercount += 2;

-        // The basic entry count will additionally include the wrapper menu, Dashboard, My profile, and the Logout link.
+        // The basic entry count will additionally include the wrapper menu, Dashboard, Profile, and the Logout link.
$entrycount += 4;$output = $OUTPUT->user_menu($USER);
@@ -128,7 +128,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I should see "I'm the teacher first feedback"
And I should see "60.0"
And I follow "Course 1"
And I should see "1337"
And I log out
@@ -137,7 +137,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I should not see "I'm the teacher first feedback"
And I should not see "60.0"
And I follow "Course 1"
And I should not see "1337"
And I log out
@@ -167,7 +167,7 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I should see "I'm the teacher first feedback"
And I should see "60.0"
And I follow "Course 1"
And I should see "1337"
And I log out
@@ -176,6 +176,6 @@ Feature: In an assignment, teachers grade multiple students on one page
And I follow "Test assignment name"
And I should not see "I'm the teacher first feedback"
And I should not see "60.0"
And I follow "Course 1"
And I should not see "1337"
index 1c09496..e033498 100644 (file)
@@ -162,13 +162,9 @@ class reply_handler extends \core\message\inbound\handler {
$addpost->parent =$post->id;
$addpost->itemid = file_get_unused_draft_itemid(); - if (!empty($messagedata->html)) {
-            $addpost->message =$messagedata->html;
-            $addpost->messageformat = FORMAT_HTML; - } else { -$addpost->message = $messagedata->plain; -$addpost->messageformat = FORMAT_PLAIN;
-        }
+        list ($message,$format) = self::remove_quoted_text($messagedata); +$addpost->message = $message; +$addpost->messageformat = $format; // We don't trust text coming from e-mail.$addpost->messagetrust = false;
@@ -288,7 +284,6 @@ class reply_handler extends \core\message\inbound\handler {
return $fs->create_file_from_string($record, $attachment->content); } - /** * Return the content of any success notification to be sent. * Both an HTML and Plain Text variant must be provided. @@ -308,5 +303,4 @@ class reply_handler extends \core\message\inbound\handler {$message->html = get_string('postbymailsuccess_html', 'mod_forum', $a); return$message;
}
-
}
index 1c4e99a..dd59694 100644 (file)
@@ -417,7 +417,7 @@ $string['repliesmany'] = '{$a} replies so far';
$string['repliesone'] = '{$a} reply so far';
$string['reply'] = 'Reply';$string['replyforum'] = 'Reply to forum';
-$string['replytopostbyemail'] = 'If you reply to this via email, don\'t include a quoted copy of this post. '; +$string['replytopostbyemail'] = 'You can reply to this via email.';
$string['replytouser'] = 'Use email address in reply';$string['reply_handler'] = 'Reply to forum posts via email';
$string['reply_handler_name'] = 'Reply to forum posts'; index bf0013a..3add782 100644 (file) @@ -7833,8 +7833,7 @@ function mod_forum_myprofile_navigation(core_user\output\myprofile\tree$tree, $if (!empty($course)) {
$postsurl->param('course',$course->id);
}
-    $string =$iscurrentuser ? get_string('myprofileownpost', 'mod_forum') :
-            get_string('forumposts', 'mod_forum');
+    $string = get_string('forumposts', 'mod_forum');$node = new core_user\output\myprofile\node('miscellaneous', 'forumposts', $string, null,$postsurl);
$tree->add_node($node);

@@ -7842,8 +7841,7 @@ function mod_forum_myprofile_navigation(core_user\output\myprofile\tree $tree,$
if (!empty($course)) {$discussionssurl->param('course', $course->id); } -$string = $iscurrentuser ? get_string('myprofileowndis', 'mod_forum') : - get_string('myprofileotherdis', 'mod_forum'); +$string = get_string('myprofileotherdis', 'mod_forum');
$node = new core_user\output\myprofile\node('miscellaneous', 'forumdiscussions',$string, null,
$discussionssurl);$tree->add_node($node); index 4720159..45a474a 100644 (file) @@ -31,11 +31,11 @@ Feature: A user can view their posts and discussions | Message | How awesome is this forum discussion? | And I reply "Forum discussion 1" post from "Test forum name" forum with: | Message | Actually, I've seen better. | - When I follow "My profile" in the user menu - And I follow "My forum posts" + When I follow "Profile" in the user menu + And I follow "Forum posts" Then I should see "How awesome is this forum discussion?" And I should see "Actually, I've seen better." - And I follow "My profile" in the user menu - And I follow "My forum discussions" + And I follow "Profile" in the user menu + And I follow "Forum discussions" And I should see "How awesome is this forum discussion?" And I should not see "Actually, I've seen better." index aa78d36..2fd2200 100644 (file) @@ -278,7 +278,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase { // Create what we expect to be returned when querying the forums.$expecteddiscussions = array();
-        $expecteddiscussions[$discussion1->id] = array(
+        $expecteddiscussions[] = array( 'id' =>$discussion1->id,
'course' => $discussion1->course, 'forum' =>$discussion1->forum,
@@ -305,7 +305,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {
'lastuserpicture' => $user4->picture, 'lastuseremail' =>$user4->email
);
-        $expecteddiscussions[$discussion2->id] = array(
+        $expecteddiscussions[] = array( 'id' =>$discussion2->id,
'course' => $discussion2->course, 'forum' =>$discussion2->forum,
@@ -335,7 +335,7 @@ class mod_forum_external_testcase extends externallib_advanced_testcase {

// Call the external function passing forum ids.
$discussions = mod_forum_external::get_forum_discussions(array($forum1->id, $forum2->id)); - external_api::clean_returnvalue(mod_forum_external::get_forum_discussions_returns(),$discussions);
+        $discussions = external_api::clean_returnvalue(mod_forum_external::get_forum_discussions_returns(),$discussions);
$this->assertEquals($expecteddiscussions, $discussions); // Some debugging is going to be produced, this is because we switch PAGE contexts in the get_forum_discussions function, // the switch happens when the validate_context function is called inside a foreach loop. index 19086c7..d5dcb9b 100644 (file) @@ -51,7 +51,7 @@ Feature: Practice mode in a lesson activity | True | 1 | And I press "Submit" Then I should see "View grades" - And I follow "My grades" in the user menu + And I follow "Grades" in the user menu And I follow "Course 1" And I should see "Non-practice lesson" @@ -72,7 +72,7 @@ Feature: Practice mode in a lesson activity | True | 1 | And I press "Submit" Then I should not see "View grades" - And I follow "My grades" in the user menu + And I follow "Grades" in the user menu And I follow "Course 1" And I should not see "Practice lesson" @@ -94,6 +94,6 @@ Feature: Practice mode in a lesson activity | True | 1 | And I press "Submit" Then I should not see "View grades" - And I follow "My grades" in the user menu + And I follow "Grades" in the user menu And I follow "Course 1" And I should not see "Practice lesson with scale" index d0b7af9..9ebc9c2 100644 (file) @@ -17,7 +17,7 @@ Feature: In a lesson activity, teacher can add embedded images in questions answ | teacher1 | C1 | editingteacher | | student1 | C1 | student | And I log in as "teacher1" - And I follow "Manage my private files" + And I follow "Manage private files" And I upload "mod/lesson/tests/fixtures/moodle_logo.jpg" file to "Files" filemanager And I click on "Save changes" "button" When I am on homepage index 83a27b5..b69e374 100644 (file) @@ -47,7 +47,7 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all | Feedback for the response 'True'. | So you think it is true | | Feedback for the response 'False'. | So you think it is false | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I navigate to "Categories and items" node in "Grade administration > Setup" And I follow "Edit quiz Test quiz name" Then I should see "Edit grade item" index b37dbf5..3ae54f2 100644 (file) @@ -46,7 +46,7 @@ Feature: Set a quiz to be marked complete when the student passes | Feedback for the response 'True'. | So you think it is true | | Feedback for the response 'False'. | So you think it is false | And I follow "Course 1" - And I follow "Grades" + And I navigate to "Grades" node in "Course administration" And I set the field "jump" to "Categories and items" And I press "Go" And I follow "Edit quiz Test quiz name" index 9bf2dc3..8afde3e 100644 (file) @@ -23,6 +23,6 @@ Feature: Add blocks to dashboard page When I press "Customise this page" And I add the "Latest news" block Then I should see "Latest news" in the "Latest news" "block" - And I should see "My latest badges" in the "My latest badges" "block" + And I should see "Latest badges" in the "Latest badges" "block" And I should see "Calendar" in the "Calendar" "block" And I should see "Upcoming events" in the "Upcoming events" "block" index fddb0e4..4677d44 100644 (file) @@ -25,7 +25,7 @@ Feature: Reset dashboard page to default And I add the "Comments" block And I press "Reset page to default" Then I should not see "Latest news" - And I should see "My latest badges" + And I should see "Latest badges" And I should see "Calendar" And I should see "Upcoming events" And I should not see "Comments" index 0542c97..6ba0099 100644 (file) @@ -91,13 +91,28 @@$systemcontext = context_system::instance();
note_view($coursecontext,$userid);

$strnotes = get_string('notes', 'notes'); -if ($userid) {
+if ($userid &&$course->id == SITEID) {
$PAGE->set_context(context_user::instance($user->id));
$PAGE->navigation->extend_for_user($user);
// If we are looking at our own notes, then change focus to 'my notes'.
if ($userid ==$USER->id) {
$notenode =$PAGE->navigation->find('notes', null)->make_inactive();
}
+
+    $notesurl = new moodle_url('/notes/index.php', array('user' =>$userid));
+    $PAGE->navbar->add(get_string('notes', 'notes'),$notesurl);
+} else if ($course->id != SITEID) { +$notenode = $PAGE->navigation->find('currentcoursenotes', null)->make_inactive(); +$participantsurl = new moodle_url('/user/view.php', array('id' => $userid, 'course' =>$course->id));
+    $currentcoursenode =$PAGE->navigation->find('currentcourse', null);
+    $participantsnode =$currentcoursenode->find('participants', null);
+    $usernode =$participantsnode->add(fullname($user),$participantsurl);
+    $usernode->make_active(); + +$notesurl = new moodle_url('/notes/index.php', array('user' => $userid, 'course' =>$courseid));
+    $PAGE->navbar->add(get_string('notes', 'notes'),$notesurl);
+
+    $PAGE->set_context(context_course::instance($courseid));
} else {
$link = null; if (has_capability('moodle/course:viewparticipants',$coursecontext)
@@ -109,9 +124,19 @@ if ($userid) {$PAGE->set_pagelayout('incourse');
$PAGE->set_title($course->fullname);
-$PAGE->set_heading($course->fullname);
+if ($course->id == SITEID) { +$PAGE->set_heading(fullname($user)); +} else { +$PAGE->set_heading($course->fullname); +} echo$OUTPUT->header();
+
+if ($course->id != SITEID) { +$headerinfo = array('heading' => fullname($user), 'user' =>$user);
+    echo $OUTPUT->context_header($headerinfo, 2);
+}
+
echo $OUTPUT->heading($strnotes);

$strsitenotes = get_string('sitenotes', 'notes'); index 3d2fae0..7b86046 100644 (file) @@ -380,15 +380,13 @@ function note_view($context, $userid) { */ function core_notes_myprofile_navigation(core_user\output\myprofile\tree$tree, $user,$iscurrentuser, $course) {$url = new moodle_url("/notes/index.php", array('user' => $user->id)); -$title = $iscurrentuser ? get_string('myprofileownnotes', 'core_notes') : - get_string('notes', 'core_notes'); +$title = get_string('notes', 'core_notes');
if (empty($course)) { // Site level profile. if (!has_capability('moodle/notes:view', context_system::instance())) { // No cap, nothing to do. return false; } -$url->param('course', 0);
} else {
if (!has_capability('moodle/notes:view', context_course::instance(\$course->id))) {
// No cap, nothing to do.
index c7fa251..912945e 100644 (file)
@@ -49,13 +49,13 @@ Feature: View the user page for the outline report
And I follow "URL name"
And I follow "URL name"
And I click on "Student 1" "link"
-    And I follow "My profile" in the open menu
+    And I follow "Profile" in the open menu
And I follow "Course 1"
When I follow "Outline report"
Then I should see "4 views" in the "Folder name" "table_row"
And I should see "3 views" in the "URL name" "table_row"
And I click on "Student 1" "link"
-    And I follow "My profile" in the open menu
+    And I follow "Profile" in the open menu
And I follow "Course 1"
When I follow "Complete report"
And I should see "4 views"
@@ -79,12 +79,12 @@ Feature: View the user page for the outline report
And I follow "URL name"
And I follow "URL name"
And I follow "URL name"
-    And I follow "My profile" in the user menu
+    And I follow "Profile" in the user menu
And I follow "Course 1"
When I follow "Outline report"
Then I should see "4 views" in the "Folder name" "table_row"
And I should see "3 views" in the "URL name" "table_row"
-    And I follow "My profile" in the user menu
+    And I follow "Profile" in the user menu
And I follow "Course 1"
When I follow "Complete report"
And I should see "4 views"
@@ -110,12 +110,12 @@ Feature: View the user page for the outline report
And I follow "URL name"
And I follow "URL name"
And I follow "URL name"
-    And I follow "My profile" in the user menu
+    And I follow "Profile" in the user menu
And I follow "Course 1"
When I follow "Outline report"
Then I should see "4 views" in the "Folder name" "table_row"
And I should see "3 views" in the "URL name" "table_row"
-    And I follow "My profile" in the user menu
+    And I follow "Profile" in the user menu
And I follow "Course 1"
When I follow "Complete report"
And I should see "4 views"
index 0b0a740..bdb0d2c 100644 (file)
@@ -7,6 +7,6 @@ Feature: In a report, admin can see current sessions
@javascript
Scenario: Check usersessions report shows current session
Given I log in as "admin"
-    And I follow "My profile" in the user menu
+    And I follow "Profile" in the user menu
When I follow "Browser sessions"
Then I should see "Current session"
index 968a60c..f5666a9 100644 (file)
@@ -10,7 +10,7 @@ Feature: Recent files repository lists the recently used files
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
index 837b5e8..294d5cd 100644 (file)
@@ -10,7 +10,7 @@ Feature: A selected file can be cancelled
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I press "Save changes"
And I am on site homepage
index 794a686..944bd52 100644 (file)
@@ -16,7 +16,7 @@ Feature: Create shortcuts
| user | course | role |
| teacher1 | C1 | editingteacher |
When I log in as "teacher1"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Then I should see "empty.txt" in the "div.fp-content" "css_element"
And I press "Save changes"
index b3685b5..7bd3db2 100644 (file)
@@ -7,15 +7,15 @@ Feature: Delete files and folders from the file manager
@javascript @_bug_phantomjs
Scenario: Delete a file and a folder
Given I log in as "admin"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
And I create "Delete me" folder in "Files" filemanager
And I press "Save changes"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
When I delete "empty.txt" from "Files" filemanager
And I press "Save changes"
Then I should not see "empty.txt"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I delete "Delete me" from "Files" filemanager
And I press "Save changes"
And I should not see "Delete me"
index 3df24c6..91c19c8 100644 (file)
@@ -16,7 +16,7 @@ Feature: Overwrite file feature
| user | course | role |
| teacher1 | C1 | editingteacher |
When I log in as "teacher1"
-    And I follow "Manage my private files"
+    And I follow "Manage private files"
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Then I should see "1" elements in "Files" filemanager
And I upload and overwrite "lib/tests/fixtures/empty.txt" file to "Files" filemanager
index ab3c50e..4cf8fde 100644 (file)
@@ -10,7 +10,7 @@ Feature: Upload files
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
-    When I follow "Manage my private files..."
+    When I follow "Manage private files..."
And I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager
Then I should see "1" elements in "Files" filemanager
And I should see "empty.txt" in the "div.fp-content" "css_element"
index 29d96bf..a7fd6de 100644 (file)
@@ -44,7 +44,9 @@ table.message .searchresults td {
}
.message .contactselector {
-    width: 24%;
+    @media screen and (min-width: 1000px) {
+        width: 24%;
+    }
float: left;
}

@@ -98,9 +100,14 @@ table.message .searchresults td {
}

.message .messagearea  {
-    border-left: 1px solid @tableBorder;
-    width: 74%;
+    @media screen and (min-width: 1000px) {
+        width: 74%;
+        border-left: 1px solid @tableBorder;