MDL-59227 course: add (copy) to duplicated modules
authorRohan Khajuria <rkhajuria99@gmail.com>
Mon, 10 Sep 2018 22:02:00 +0000 (15:02 -0700)
committerRex Lorenzo <rex@oid.ucla.edu>
Mon, 17 Sep 2018 22:14:12 +0000 (15:14 -0700)
backup/util/ui/tests/behat/duplicate_activities.feature
course/lib.php
lang/en/moodle.php

index 1207eb7..40a65dc 100644 (file)
@@ -20,12 +20,13 @@ Feature: Duplicate activities
       | Name | Test database name |
       | Description | Test database description |
     And I duplicate "Test database name" activity
+    And I should see "Test database name (copy)"
     And I wait until section "1" is available
     And I click on "Edit settings" "link" in the "Test database name" activity
     And I set the following fields to these values:
       | Name | Original database name |
     And I press "Save and return to course"
-    And I click on "Edit settings" "link" in the "Test database name" activity
+    And I click on "Edit settings" "link" in the "Test database name (copy)" activity
     And I set the following fields to these values:
       | Name | Duplicated database name |
       | Description | Duplicated database description |
index aba5bdc..2b95f09 100644 (file)
@@ -3469,6 +3469,9 @@ function duplicate_module($course, $cm) {
         $newcm = get_fast_modinfo($cm->course)->get_cm($newcmid);
         $event = \core\event\course_module_created::create_from_cm($newcm);
         $event->trigger();
+
+        // Add ' (copy)' to duplicates.
+        set_coursemodule_name($newcm->id, get_string('duplicatedmodule', 'moodle', $newcm->name));
     }
 
     return isset($newcm) ? $newcm : null;
index a854d19..1680fc1 100644 (file)
@@ -537,6 +537,7 @@ $string['downloadtext'] = 'Download in text format';
 $string['doyouagree'] = 'Have you read these conditions and understood them?';
 $string['droptoupload'] = 'Drop files here to upload';
 $string['duplicate'] = 'Duplicate';
+$string['duplicatedmodule'] = '{$a} (copy)';
 $string['edhelpaspellpath'] = 'To use spell-checking within the editor, you MUST have <strong>aspell 0.50</strong> or later installed on your server, and you must specify the correct path to access the aspell binary.  On Unix/Linux systems, this path is usually <strong>/usr/bin/aspell</strong>, but it might be something else.';
 $string['edhelpbgcolor'] = 'Define the edit area\'s background color.<br />Valid values are, for example: #FFFFFF or white';
 $string['edhelpcleanword'] = 'This setting enables or disables Word-specific format filtering.';