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

Merge "Follow the CC REL spec in Creative Commons block"

parents cd05dba8 9c759967
......@@ -30,7 +30,9 @@ $string['description'] = 'Attach a Creative Commons license to your page';
$string['blockcontent'] = 'Block Content';
$string['alttext'] = 'Creative Commons License';
$string['licensestatement'] = "This work is licensed under a <a rel=\"license\" href=\"%s\">Creative Commons %s 3.0 Unported License</a>.";
$string['cclicensename'] = 'Creative Commons %s 3.0 Unported';
$string['cclicensestatement'] = "%s by %s is licensed under a %s license.";
$string['otherpermissions'] = 'Permissions beyond the scope of this license may be available from %s.';
$string['sealalttext'] = 'This license is acceptable for Free Cultural Works.';
$string['config:noncommercial'] = 'Allow commercial uses of your work?';
......@@ -43,5 +45,3 @@ $string['by-nd'] = 'Attribution-No Derivative Works';
$string['by-nc'] = 'Attribution-Noncommercial';
$string['by-nc-sa'] = 'Attribution-Noncommercial-Share Alike';
$string['by-nc-nd'] = 'Attribution-Noncommercial-No Derivative Works';
?>
......@@ -57,16 +57,27 @@ class PluginBlocktypeCreativecommons extends SystemBlocktype {
$licensetype = reset(preg_grep('/^([a-z\-]+)$/', array($configdata['license'])));
$licenseurl = "http://creativecommons.org/licenses/$licensetype/3.0/";
$licensename = get_string($licensetype, 'blocktype.creativecommons');
$html = '<div class="license"><a class="licenseicon" rel="license" href="http://creativecommons.org/licenses/'.$licensetype.'/3.0/"><img alt="'.
get_string('alttext', 'blocktype.creativecommons').
'" style="border-width:0" src="'.
$THEME->get_url('images/' . $licensetype . '-3_0.png', false, 'blocktype/creativecommons') . '" /></a>';
$html .= '<div class="licensedesc">';
$html .= get_string('licensestatement', 'blocktype.creativecommons', $licenseurl, $licensename);
$html .= '</div><div class="cb"></div></div>';
return $html;
$view = $instance->get_view();
$workname = '<span rel="dc:type" href="http://purl.org/dc/dcmitype/Text" property="dc:title">'
. $view->display_title(true, false, false) . '</span>';
$authorurl = $view->owner_link();
$authorname = hsc($view->formatted_owner());
$licensename = get_string('cclicensename', 'blocktype.creativecommons', get_string($licensetype, 'blocktype.creativecommons'));
$licenselink = '<a rel="license" href="' . $licenseurl . '">' . $licensename . '</a>';
$attributionlink = '<a rel="cc:attributionURL" property="cc:attributionName" href="' . $authorurl . '">' . $authorname . '</a>';
$licensestatement = get_string('cclicensestatement', 'blocktype.creativecommons', $workname, $attributionlink, $licenselink);
$permissionlink = '<a rel="cc:morePermissions" href="'. $authorurl .'">' . $authorname . '</a>';
$otherpermissions = get_string('otherpermissions', 'blocktype.creativecommons', $permissionlink);
$smarty = smarty_core();
$smarty->assign('licenseurl', $licenseurl);
$smarty->assign('licenselogo', $THEME->get_url('images/' . $licensetype . '-3_0.png', false, 'blocktype/creativecommons'));
$smarty->assign('licensestatement', $licensestatement);
$smarty->assign('otherpermissions', $otherpermissions);
return $smarty->fetch('blocktype:creativecommons:statement.tpl');
}
public static function has_instance_config() {
......@@ -169,5 +180,3 @@ class PluginBlocktypeCreativecommons extends SystemBlocktype {
}
}
?>
{* Full copyright statement using CC REL (http://wiki.creativecommons.org/CC_REL) *}
<div class="license">
<a class="licenseicon" href="{$licenseurl}">
<img alt="{str tag='alttext' section='blocktype.creativecommons'}" style="border-width:0" src="{$licenselogo}" /></a>
<div class="licensedesc" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<p>{$licensestatement|safe}</p>
<p>{$otherpermissions|safe}</p>
</div>
<div class="cb"></div>
</div>
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