Commit 7943364a authored by Aaron Wells's avatar Aaron Wells
Browse files

Clarify that "no license chosen" means default copyright

Bug 1279526

behatnotneeded: Covered by existing tests

Change-Id: Ifc707fe735e090a2756468e93bcdedd8cd80d7a7
parent 575d9267
......@@ -398,7 +398,7 @@ EOF;
'type' => 'html',
'class' => $readonly ? '' : 'hidden',
'title' => get_string('license'),
'value' => '<div id="instconf_licensereadonly_display">' . (isset($artefact) ? render_license($artefact) : get_string('licensenone')) . '</div>',
'value' => '<div id="instconf_licensereadonly_display">' . (isset($artefact) ? render_license($artefact) : get_string('licensenone1')) . '</div>',
),
'allowcomments' => array(
'type' => 'switchbox',
......
......@@ -194,9 +194,8 @@ $string['license'] = 'License';
$string['licenseother'] = 'Other license (enter URL)';
$string['licenseotherurl'] = 'Enter URL';
$string['licensedesc'] = 'The license for this content.';
$string['licensenone'] = 'None selected';
$string['licensenonedetailed'] = '%s has not chosen a license for this content.';
$string['licensenonedetailedowner'] = 'You have not chosen a license for this content.';
$string['licensenone1'] = 'All rights reserved';
$string['licensenonedetailed1'] = '© %s, all rights reserved';
$string['licensingadvanced'] = 'Advanced licensing';
$string['licensor'] = 'Licensor';
$string['licensordesc'] = 'The original licensor for this content.';
......
......@@ -55,7 +55,7 @@ function license_form_el_basic($artefact, $always_allow_none=false) {
$include_noneselected = true;
}
if ($include_noneselected) {
$options[''] = get_string('licensenone');
$options[''] = get_string('licensenone1');
}
if (empty($artefact)) {
......@@ -262,15 +262,32 @@ function render_license($artefact) {
$license = $artefact->get('license');
$licensor = $artefact->get('licensor');
$licensorurl = $artefact->get('licensorurl');
// TODO: Should probably rewrite this URL cleanup code
if ($licensorurl) {
if ($licensor == '') {
$licensor = preg_replace('(^https?://)', '', $license);
}
if (strpos($licensorurl, '://') === FALSE) {
$licensorurl = 'http://' . $licensorurl;
}
}
if ($license) {
$details = get_record('artefact_license', 'name', $license);
}
else if ($USER->get('id') == $artefact->get('owner')) {
return get_string('licensenonedetailedowner');
}
else {
return get_string('licensenonedetailed', 'mahara', $artefact->display_owner());
// No license selected, so it's the default "all rights reserved" to the copyright holder
if ($licensor) {
$copyrightholder = $licensor;
}
else {
$copyrightholder = $artefact->display_owner();
}
if ($licensorurl) {
$copyrightholder = '<a href="' . hsc($licensorurl) . '" class="licensor">' . hsc($copyrightholder) . "</a>";
}
return get_string('licensenonedetailed1', 'mahara', $copyrightholder);
}
if (strpos($license, '://') === FALSE) {
......@@ -294,13 +311,7 @@ function render_license($artefact) {
hsc(preg_replace('(^https?://)', '', $license)) . '</a>';
}
if ($licensorurl != '') {
if ($licensor == '') {
$licensor = preg_replace('(^https?://)', '', $license);
}
if (strpos($licensorurl, '://') === FALSE) {
$licensorurl = 'http://' . $licensorurl;
}
if ($licensorurl) {
$html .= '<br>' . get_string('licensor') . ': '
. '<a href="' . hsc($licensorurl) . '" class="licensor">'
. hsc($licensor) . '</a>';
......
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