Commit a827e1c9 authored by Jiri Baum's avatar Jiri Baum
Browse files

License metadata - schema change. (Bug #1095499)



This feature adds standard license metadata fields on every artefact and every
artefact edit page. This allows users to specify the license for the content
they create or upload. For content originating elsewhere, the users can also
enter the name of the licensor and original URL.

Previously, adding license metadata to an artefact or page was achievable in an
ad hoc fashion using a block on a page, but had many limitations.

See also bug #1095499.

This commit changes the database schema and the artefact abstract data type.

Change-Id: Icf9143864a252b43fa91294825b24e5a65c0b4d5
Signed-off-by: default avatarJiri Baum <jiri@catalyst-au.net>
parent e19d7fb0
......@@ -140,6 +140,9 @@ abstract class ArtefactType {
protected $approvecomments;
protected $rolepermissions;
protected $mtimemanuallyset;
protected $license;
protected $licensor;
protected $licensorurl;
protected $viewsinstances;
protected $viewsmetadata;
......
......@@ -77,6 +77,8 @@
during the postinst phase. -->
<FIELD NAME="logo" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="style" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="licensemandatory" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="licensedefault" TYPE="char" LENGTH="255" NOTNULL="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
......@@ -447,6 +449,9 @@
<FIELD NAME="authorname" TYPE="text" NOTNULL="false" />
<FIELD NAME="allowcomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="approvecomments" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="license" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="licensor" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="licensorurl" TYPE="char" LENGTH="255" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
......@@ -469,6 +474,17 @@
<KEY NAME="attachmentfk" TYPE="foreign" FIELDS="attachment" REFTABLE="artefact" REFFIELDS="id" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_license">
<FIELDS>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="displayname" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="shortname" TYPE="char" LENGTH="255" NOTNULL="false" />
<FIELD NAME="icon" TYPE="char" LENGTH="255" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
</KEYS>
</TABLE>
<TABLE NAME="artefact_tag">
<FIELDS>
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="true" />
......
......@@ -3158,5 +3158,34 @@ function xmldb_core_upgrade($oldversion=0) {
insert_record('cron', $cron);
}
if ($oldversion < 2013020500) {
$table = new XMLDBTable('artefact');
$field = new XMLDBField('license');
$field->setAttributes(XMLDB_TYPE_CHAR,255);
add_field($table, $field);
$field = new XMLDBField('licensor');
$field->setAttributes(XMLDB_TYPE_CHAR,255);
add_field($table, $field);
$field = new XMLDBField('licensorurl');
$field->setAttributes(XMLDB_TYPE_CHAR,255);
add_field($table, $field);
$table = new XMLDBTable('institution');
$field = new XMLDBField('licensedefault');
$field->setAttributes(XMLDB_TYPE_CHAR,255);
add_field($table, $field);
$field = new XMLDBField('licensemandatory');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
add_field($table, $field);
$table = new XMLDBTable('artefact_license');
$table->addFieldInfo('name', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL);
$table->addFieldInfo('displayname', XMLDB_TYPE_CHAR, 255, null, null);
$table->addFieldInfo('shortname', XMLDB_TYPE_CHAR, 255, null, null);
$table->addFieldInfo('icon', XMLDB_TYPE_CHAR, 255, null, null);
$table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('name'));
create_table($table);
}
return $status;
}
......@@ -30,7 +30,7 @@ defined('INTERNAL') || die();
$config = new StdClass;
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2013012101;
$config->version = 2013020500;
$config->release = '1.7.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
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