Commit aa87e308 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge changes Ib225c743,Ic82367dd

* changes:
  Allow more characters in pieform 'checkboxes' labels (bug #905069)
  Site option to remove 'copy of ' from copied titles (bug #905067)
parents d939148f e7f864c5
......@@ -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 = 'http://moodle.example.com/auth/mnet/jump.php?hostwwwroot={wwwroot}&wantsurl={shorturlencoded}';
// If true, new copies of views & collections will have 'Copy of' prepended to the title.
$cfg->renamecopies = true;
......@@ -46,6 +46,9 @@ function pieform_element_checkboxes(Pieform $form, $element) {/*{{{*/
$element['name'] .= '[]';
// Number of characters in checkbox labels (use 0 or false for no limit).
$labelwidth = isset($element['labelwidth']) ? (int) $element['labelwidth'] : 17;
foreach ($element['elements'] as $e) {
if (!$submitted || !empty($e['disabled'])) {
$checked = $e['defaultvalue'];
......@@ -53,11 +56,12 @@ function pieform_element_checkboxes(Pieform $form, $element) {/*{{{*/
else {
$checked = !empty($value[$e['value']]) || in_array($e['value'], $value);
}
$title = $labelwidth ? str_shorten_text($e['title'], $labelwidth, true) : $e['title'];
$result .= '<div class="checkboxes-option"><input type="checkbox" value="' . $e['value'] . '" '
. $form->element_attributes($element)
. ($checked ? ' checked="checked"' : '')
. (!empty($e['disabled']) ? ' disabled' : '')
. '>' . Pieform::hsc(str_shorten_text($e['title'], 17, true)) . '</div>';
. '>' . Pieform::hsc($title) . '</div>';
}
$result .= '<div class="cl"></div>';
......
......@@ -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);
}
......
Markdown is supported
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