Commit c2ec74c5 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Site option to remove 'copy of ' from copied titles (bug #905067)

When pages and collections are copied, the default title of the new
copy is "Copy of <original title>". When users are copying large
collections that are intended as templates, it's annoying for them to
have to go and edit the titles of all the copies.  This change allows
the site to turn this behaviour off and just make the new title the
same as the original.

Change-Id: Ic82367ddecc6a4b9bd3c6ea5b44370ad7fe00d3e
Signed-off-by: default avatarRichard Mansfield <>
parent ebb8b95f
......@@ -222,7 +222,11 @@ class Collection {
$colltemplate = new Collection($templateid);
$data = new StdClass;
$data->name = self::new_name(get_string('Copyof', 'mahara', $colltemplate->get('name')), (object)$collectiondata);
$desiredname = $colltemplate->get('name');
if (get_config('renamecopies')) {
$desiredname = get_string('Copyof', 'mahara', $desiredname);
$data->name = self::new_name($desiredname, (object)$collectiondata);
$data->description = $colltemplate->get('description');
$data->navigation = $colltemplate->get('navigation');
......@@ -254,3 +254,6 @@ $cfg->sslproxy = false;
// Bug MDL-30042 fixes this, if this patch isn't applied, just hard code the login url you want instead
// $cfg->externallogin = '{wwwroot}&wantsurl={shorturlencoded}';
// If true, new copies of views & collections will have 'Copy of' prepended to the title.
$cfg->renamecopies = true;
......@@ -217,7 +217,11 @@ class View {
// Set a default title if one wasn't set
if (!isset($viewdata['title'])) {
$view->set('title', self::new_title(get_string('Copyof', 'mahara', $template->get('title')), (object)$viewdata));
$desiredtitle = $template->get('title');
if (get_config('renamecopies')) {
$desiredtitle = get_string('Copyof', 'mahara', $desiredtitle);
$view->set('title', self::new_title($desiredtitle, (object)$viewdata));
$view->set('dirty', true);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment