Skip to content

Commit

Permalink
MetaData: small changes to pre-installed copyright licences (41301, 4…
Browse files Browse the repository at this point in the history
…1898)
  • Loading branch information
schmitz-ilias committed Aug 12, 2024
1 parent c92eb1c commit 23bdc52
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ protected function extractFields(string $copyright): array
}

$image_link = $this->translatePreInstalledLinksToSVG($image_link);
$full_name = $this->cleanupPreInstalledPublicDomainFullName($full_name);

return [
'full_name' => [\ilDBConstants::T_TEXT, $full_name],
Expand Down Expand Up @@ -143,4 +144,15 @@ protected function translatePreInstalledLinksToSVG(string $image_link): string
}
return $image_link;
}

/**
* see https://mantis.ilias.de/view.php?id=41301
*/
protected function cleanupPreInstalledPublicDomainFullName(string $full_name): string
{
if ($full_name === 'This work has all rights reserved by the owner.') {
return 'All rights reserved';
}
return $full_name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ public function step_8(): void
$old_image_link = "https://licensebuttons.net/p/zero/1.0/88x31.png";
$new_image_link = "https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg";

$next_id = $this->db->nextId('il_md_cpr_selections');

$res = $this->db->query(
'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
$this->db->quote($title, ilDBConstants::T_TEXT) . ' AND full_name = ' .
Expand All @@ -180,4 +178,106 @@ public function step_8(): void
);
}
}

/**
* Change title, description and full name of 'All rights reserved',
* see https://mantis.ilias.de/view.php?id=41301
*/
public function step_9(): void
{
$title = "All rights reserved";
$old_full_name = "This work has all rights reserved by the owner.";
$new_full_name = "All rights reserved";
$new_description = "The copyright holder reserves, or holds for their own use, all the rights provided by copyright law.";

$res = $this->db->query(
'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
$this->db->quote($title, ilDBConstants::T_TEXT) . ' AND full_name = ' .
$this->db->quote($old_full_name, ilDBConstants::T_TEXT) .
" AND COALESCE(link, '') = '' AND COALESCE(description, '') = ''"
);
if (($row = $this->db->fetchAssoc($res)) && isset($row['entry_id'])) {
$this->db->update(
'il_md_cpr_selections',
[
'full_name' => [\ilDBConstants::T_TEXT, $new_full_name],
'description' => [\ilDBConstants::T_TEXT, $new_description]
],
['entry_id' => [\ilDBConstants::T_INTEGER, $row['entry_id']]]
);
}
}

/**
* Change title, description and full name of 'Public Domain',
* see https://mantis.ilias.de/view.php?id=41301
*/
public function step_10(): void
{
$title = "Public Domain";
$link = "http://creativecommons.org/publicdomain/zero/1.0/";
$old_full_name = "This work is free of known copyright restrictions.";
$new_full_name = "Public Domain";
$new_description = "Creative work to which no exclusive intellectual property rights apply.";

$res = $this->db->query(
'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
$this->db->quote($title, ilDBConstants::T_TEXT) . ' AND full_name = ' .
$this->db->quote($old_full_name, ilDBConstants::T_TEXT) . ' AND link = ' .
$this->db->quote($link, ilDBConstants::T_TEXT) .
" AND COALESCE(description, '') = ''"
);
if (($row = $this->db->fetchAssoc($res)) && isset($row['entry_id'])) {
$this->db->update(
'il_md_cpr_selections',
[
'full_name' => [\ilDBConstants::T_TEXT, $new_full_name],
'description' => [\ilDBConstants::T_TEXT, $new_description]
],
['entry_id' => [\ilDBConstants::T_INTEGER, $row['entry_id']]]
);
}
}

/**
* Change title of CC licences, see https://mantis.ilias.de/view.php?id=41898
*/
public function step_11(): void
{
$old_titles_by_link = [
'http://creativecommons.org/licenses/by-nc-nd/4.0/' => 'Attribution Non-commercial No Derivatives (by-nc-nd)',
'http://creativecommons.org/licenses/by-nc-sa/4.0/' => 'Attribution Non-commercial Share Alike (by-nc-sa)',
'http://creativecommons.org/licenses/by-nc/4.0/' => 'Attribution Non-commercial (by-nc)',
'http://creativecommons.org/licenses/by-nd/4.0/' => 'Attribution No Derivatives (by-nd)',
'http://creativecommons.org/licenses/by-sa/4.0/' => 'Attribution Share Alike (by-sa)',
'http://creativecommons.org/licenses/by/4.0/' => 'Attribution (by)'
];
$new_titles_by_link = [
'http://creativecommons.org/licenses/by-nc-nd/4.0/' => 'Attribution Non-commercial No Derivatives (BY-NC-ND) 4.0',
'http://creativecommons.org/licenses/by-nc-sa/4.0/' => 'Attribution Non-commercial Share Alike (BY-NC-SA) 4.0',
'http://creativecommons.org/licenses/by-nc/4.0/' => 'Attribution Non-commercial (BY-NC) 4.0',
'http://creativecommons.org/licenses/by-nd/4.0/' => 'Attribution No Derivatives (BY-ND) 4.0',
'http://creativecommons.org/licenses/by-sa/4.0/' => 'Attribution Share Alike (BY-SA) 4.0',
'http://creativecommons.org/licenses/by/4.0/' => 'Attribution (BY) 4.0'
];

foreach ($old_titles_by_link as $link => $old_title) {
$res = $this->db->query(
'SELECT entry_id FROM il_md_cpr_selections WHERE title = ' .
$this->db->quote($old_title, ilDBConstants::T_TEXT) . ' AND link = ' .
$this->db->quote($link, ilDBConstants::T_TEXT)
);
if (
($row = $this->db->fetchAssoc($res)) &&
isset($row['entry_id']) &&
isset($new_titles_by_link[$link])
) {
$this->db->update(
'il_md_cpr_selections',
['title' => [\ilDBConstants::T_TEXT, $new_titles_by_link[$link]]],
['entry_id' => [\ilDBConstants::T_INTEGER, $row['entry_id']]]
);
}
}
}
}
20 changes: 10 additions & 10 deletions components/ILIAS/MetaData/docs/copyrights.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ version of the CC licenses. These can however be added manually.

## Pre-Installed Licenses

| Title | Full Name | URL | Image URL |
|------------------------------------------------------|------------------------------------------------------------------------------------|---------------------------------------------------|-----------------------------------------------------------------------------|
| All rights reserved | This work has all rights reserved by the owner. | - | - |
| Attribution Non-commercial No Derivatives (by-nc-nd) | Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License | http://creativecommons.org/licenses/by-nc-nd/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg |
| Attribution Non-commercial Share Alike (by-nc-sa) | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License | http://creativecommons.org/licenses/by-nc-sa/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg |
| Attribution Non-commercial (by-nc) | Creative Commons Attribution-NonCommercial 4.0 International License | http://creativecommons.org/licenses/by-nc/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg |
| Attribution No Derivatives (by-nd) | Creative Commons Attribution-NoDerivatives 4.0 International License | http://creativecommons.org/licenses/by-nd/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg |
| Attribution Share Alike (by-sa) | Creative Commons Attribution-ShareAlike 4.0 International License | http://creativecommons.org/licenses/by-sa/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg |
| Attribution (by) | Creative Commons Attribution 4.0 International License | http://creativecommons.org/licenses/by/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg |
| Public Domain | This work is free of known copyright restrictions. | http://creativecommons.org/publicdomain/zero/1.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg |
| Title | Description | Full Name | URL | Image URL |
|----------------------------------------------------------|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|---------------------------------------------------|-----------------------------------------------------------------------------|
| All rights reserved | The copyright holder reserves, or holds for their own use, all the rights provided by copyright law. | All rights reserved | - | - |
| Attribution Non-commercial No Derivatives (BY-NC-ND) 4.0 | Creative Commons License | Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License | http://creativecommons.org/licenses/by-nc-nd/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg |
| Attribution Non-commercial Share Alike (BY-NC-SA) 4.0 | Creative Commons License | Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License | http://creativecommons.org/licenses/by-nc-sa/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg |
| Attribution Non-commercial (BY-NC) 4.0 | Creative Commons License | Creative Commons Attribution-NonCommercial 4.0 International License | http://creativecommons.org/licenses/by-nc/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg |
| Attribution No Derivatives (BY-ND) 4.0 | Creative Commons License | Creative Commons Attribution-NoDerivatives 4.0 International License | http://creativecommons.org/licenses/by-nd/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nd.svg |
| Attribution Share Alike (BY-SA) 4.0 | Creative Commons License | Creative Commons Attribution-ShareAlike 4.0 International License | http://creativecommons.org/licenses/by-sa/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg |
| Attribution (BY) 4.0 | Creative Commons License | Creative Commons Attribution 4.0 International License | http://creativecommons.org/licenses/by/4.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg |
| Public Domain | Creative work to which no exclusive intellectual property rights apply. | Public Domain | http://creativecommons.org/publicdomain/zero/1.0/ | https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg |

## Default License

Expand Down

0 comments on commit 23bdc52

Please sign in to comment.