Commit 5a3a8039 authored by Jiri Baum's avatar Jiri Baum
Browse files

License metadata - settings - site, institution and user. (Bug #1095499)



Adds settings for license metadata on the site, institution and user levels.

Change-Id: I8e684ec1befdd66cbf1d3ed87092bfe785582f86
Signed-off-by: default avatarJiri Baum <jiri@catalyst-au.net>
parent db8d9cc7
......@@ -592,6 +592,21 @@ $siteoptionform = array(
'defaultvalue' => get_config('registerterms'),
'disabled' => in_array('registerterms', $OVERRIDDEN),
),
'licensemetadata' => array(
'type' => 'checkbox',
'title' => get_string('licensemetadata', 'admin'),
'description' => get_string('licensemetadatadescription', 'admin'),
'defaultvalue' => get_config('licensemetadata'),
'help' => true,
'disabled' => in_array('licensemetadata', $OVERRIDDEN),
),
'licenseallowcustom' => array(
'type' => 'checkbox',
'title' => get_string('licenseallowcustom', 'admin'),
'description' => get_string('licenseallowcustomdescription', 'admin'),
'defaultvalue' => get_config('licenseallowcustom'),
'disabled' => in_array('licenseallowcustom', $OVERRIDDEN),
),
'allowmobileuploads' => array(
'type' => 'checkbox',
'title' => get_string('allowmobileuploads', 'admin'),
......@@ -671,7 +686,7 @@ function siteoptions_submit(Pieform $form, $values) {
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments', 'loggedinprofileviewaccess', 'disableexternalresources',
'proxyaddress', 'proxyauthmodel', 'proxyauthcredentials', 'smtphosts', 'smtpport', 'smtpuser', 'smtppass', 'smtpsecure',
'noreplyaddress', 'defaultnotificationmethod', 'homepageinfo', 'showonlineuserssideblock', 'onlineuserssideblockmaxusers',
'registerterms', 'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg',
'registerterms', 'licensemetadata', 'licenseallowcustom', 'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg',
'staffreports', 'staffstats', 'userscandisabledevicedetection',
'masqueradingreasonrequired', 'masqueradingnotified',
'eventloglevel', 'eventlogexpiry',
......
......@@ -32,6 +32,7 @@ define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutions');
require_once('pieforms/pieform.php');
require_once('license.php');
define('MENUITEM', 'manageinstitutions/institutions');
$institution = param_variable('i', '');
......@@ -245,6 +246,8 @@ if ($institution || $add) {
$data->defaultmembershipperiod = null;
$data->showonlineusers = 2;
$data->allowinstitutionpublicviews = get_config('allowpublicviews') ? 1 : 0;
$data->licensemandatory = 0;
$data->licensedefault = '';
$lockedprofilefields = array();
$authtypes = auth_get_available_auth_types();
......@@ -412,6 +415,20 @@ if ($institution || $add) {
'collapseifoneoption' => true,
'options' => $showonlineusersoptions,
);
if (get_config('licensemetadata')) {
$elements['licensemandatory'] = array(
'type' => 'checkbox',
'title' => get_string('licensemandatory', 'admin'),
'description' => get_string('licensemandatorydescription','admin'),
'defaultvalue' => $data->licensemandatory,
);
$elements['licensedefault'] = license_form_el_basic(null, true);
$elements['licensedefault']['title'] = get_string('licensedefault','admin');
$elements['licensedefault']['description'] = get_string('licensedefaultdescription','admin');
if ($data->licensedefault) {
$elements['licensedefault']['defaultvalue'] = $data->licensedefault;
}
}
if ($USER->get('admin') || get_config_plugin('artefact', 'file', 'institutionaloverride')) {
$elements['defaultquota'] = array(
'type' => 'bytes',
......@@ -564,6 +581,10 @@ function institution_validate(Pieform $form, $values) {
}
}
if (get_config('licensemetadata') and $values['licensemandatory'] and $values['licensedefault'] == '') {
$form->set_error('licensedefault', get_string('licensedefaultmandatory', 'admin'));
}
// Check uploaded logo
if (!empty($values['logo'])) {
require_once('file.php');
......@@ -649,6 +670,11 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->style = null;
}
if (get_config('licensemetadata')) {
$newinstitution->licensemandatory = ($values['licensemandatory']) ? 1 : 0;
$newinstitution->licensedefault = $values['licensedefault'];
}
if (!empty($values['resetcustom']) && !empty($oldinstitution->style)) {
$newinstitution->style = null;
}
......
......@@ -56,6 +56,10 @@ $string['off'] = 'Off';
$string['disabled'] = 'Disabled';
$string['enabled'] = 'Enabled';
$string['licensedefault'] = 'Default license';
$string['licensedefaultdescription'] = 'The default license for your content.';
$string['licensedefaultinherit'] = 'Use the institution default';
$string['messagesdescr'] = 'Messages from other users';
$string['messagesnobody'] = 'Do not allow anyone to send me messages';
$string['messagesfriends'] = 'Allow people on my friends list to send me messages';
......
......@@ -330,6 +330,10 @@ $string['pathtoclam'] = 'Path to ClamAV';
$string['pathtoclamdescription'] = 'The file system path to clamscan or clamdscan';
$string['registerterms'] = 'Registration agreement';
$string['registertermsdescription'] = "Force users to agree to the terms and conditions before registration. You should edit your site's terms and conditions page before enabling this option.";
$string['licensemetadata'] = 'License metadata';
$string['licensemetadatadescription'] = "Request and store license metadata for user-generated content.";
$string['licenseallowcustom'] = 'Allow custom licenses';
$string['licenseallowcustomdescription'] = "For license metadata, allow users to enter any URL as the license. If not checked, users will be limited to the licenses configured by the site administrator.";
$string['allowmobileuploads'] = 'Allow mobile uploads';
$string['allowmobileuploadsdescription'] = 'If checked, users will have the option of setting an authentication token. Content uploaded with this token will be saved as artefacts.';
$string['remoteavatars'] = 'Display remote avatars';
......@@ -779,6 +783,11 @@ $string['defaultmembershipperiod'] = 'Default membership period';
$string['defaultmembershipperioddescription'] = 'How long new members remain associated with the institution.';
$string['showonlineusers'] = 'Show online users';
$string['showonlineusersdescription'] = 'The online users to show to members of this institution. If users are allowed to be in multiple institutions and these have different settings, the most permissive institution settings will be used.';
$string['licensemandatory'] = 'Require license information';
$string['licensemandatorydescription'] = 'If checked, users will be required to select a license when creating artefacts. Otherwise, they will be able to leave the license field blank.';
$string['licensedefault'] = 'Default license';
$string['licensedefaultdescription'] = 'The default license for content created or uploaded by institution members. Users can override this on their account settings page and on the individual items.';
$string['licensedefaultmandatory'] = 'If users are required to choose a license, you need to choose a default license here. If you do not want to choose a default license, do not make it required for users.';
$string['Logo'] = 'Logo';
$string['logodescription'] = 'You can upload an image here that will be displayed to your institution\'s members in place of the standard header logo. For best results, this image should have the same dimensions as the site logo in your institution\'s theme. As each theme can have a different header height, no exact dimensions can be provided.';
......
<h3>Default license</h3>
<p>Use this setting to indicate the default license for content you create or upload to the site. You will be able to override this on each piece of content as you create or upload it.</p>
<p><strong>Note:</strong> The default license for any content is standard copyright, but you may choose a different default license for your content. If you are not sure which default license to choose, please check with your organisation as it may require you to use a specific license.</p>
<p>If in doubt which would be the best default license, you can ask the lawyer at your organisation or consult a copyright lawyer.</p>
<p>If you are a member in multiple institutions and choose "Use institution default", you will not be able to select the institution whose license you want to make the default one. One will be chosen by the system.</p>
<h3>Default license</h3>
<p>Use this setting to indicate the default license for content your users create or upload to this site.</p>
<p>Users will be able to override this on their "Settings" page and on each artefact they create or upload.</p>
<p><strong>Note:</strong> If you are not sure which default license to choose, please consult your organisation's lawyer or a copyright lawyer.</p>
<h3>License metadata</h3>
<p>If checked, users will be asked to enter license information for all content
they create and / or upload. This will include the license and optionally also
the licensor and the original URL of the content.</p>
<p>Licenses are stored as URLs of an (external) license document. If the site
administrator configures a list of licenses, name and icon of the license will
be displayed for these licenses.</p>
......@@ -205,6 +205,7 @@ function get_user_language($userid) {
function expected_account_preferences() {
return array('friendscontrol' => 'auth',
'wysiwyg' => 1,
'licensedefault' => '-',
'messages' => 'allow',
'lang' => 'default',
'addremovecolumns' => 0,
......@@ -221,6 +222,8 @@ function expected_account_preferences() {
}
function general_account_prefs_form_elements($prefs) {
global $USER;
require_once('license.php');
$elements = array();
$elements['friendscontrol'] = array(
'type' => 'radio',
......@@ -241,6 +244,17 @@ function general_account_prefs_form_elements($prefs) {
'help' => true,
'disabled' => get_config('wysiwyg'),
);
if (get_config('licensemetadata')) {
$elements['licensedefault'] = license_form_el_basic(null);
$elements['licensedefault']['title'] = get_string('licensedefault','account');
if ($USER->get('institutions')) {
$elements['licensedefault']['options']['-'] = get_string('licensedefaultinherit','account');
}
$elements['licensedefault']['description'] = get_string('licensedefaultdescription','account');
if (isset($prefs->licensedefault)) {
$elements['licensedefault']['defaultvalue'] = $prefs->licensedefault;
}
}
$elements['maildisabled'] = array(
'type' => 'checkbox',
'defaultvalue' => $prefs->maildisabled,
......
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