Commit 8858f497 authored by Maria Sorica's avatar Maria Sorica Committed by Robert Lyon
Browse files

Bug 1722861: Add the option to use institution tags

On the institution settings page,admins
are able to turn "Allow institution tags" on.

Change-Id: I404f74c56aac435465c4bd67128d1c262405d5c3
parent aa8817f8
...@@ -267,6 +267,7 @@ if ($institution || $add) { ...@@ -267,6 +267,7 @@ if ($institution || $add) {
$data->showonlineusers = 2; $data->showonlineusers = 2;
$data->allowinstitutionpublicviews = get_config('allowpublicviews') ? 1 : 0; $data->allowinstitutionpublicviews = get_config('allowpublicviews') ? 1 : 0;
$data->allowinstitutionsmartevidence = 0; $data->allowinstitutionsmartevidence = 0;
$data->tags = 0;
$data->licensemandatory = 0; $data->licensemandatory = 0;
$data->licensedefault = ''; $data->licensedefault = '';
$data->dropdownmenu = get_config('dropdownmenu') ? 1 : 0; $data->dropdownmenu = get_config('dropdownmenu') ? 1 : 0;
...@@ -592,6 +593,13 @@ if ($institution || $add) { ...@@ -592,6 +593,13 @@ if ($institution || $add) {
'disabled' => is_plugin_active('framework', 'module') == false, 'disabled' => is_plugin_active('framework', 'module') == false,
'help' => true, 'help' => true,
); );
$elements['allowinstitutiontags'] = array(
'type' => 'switchbox',
'title' => get_string('allowinstitutiontags'),
'description' => get_string('allowinstitutiontagsdescription'),
'defaultvalue' => $data->tags,
'help' => true,
);
$elements['reviewselfdeletion'] = array( $elements['reviewselfdeletion'] = array(
'type' => 'switchbox', 'type' => 'switchbox',
'title' => get_string('reviewsselfdeletion', 'admin'), 'title' => get_string('reviewsselfdeletion', 'admin'),
...@@ -945,6 +953,7 @@ function institution_submit(Pieform $form, $values) { ...@@ -945,6 +953,7 @@ function institution_submit(Pieform $form, $values) {
$newinstitution->allowinstitutionpublicviews = (isset($values['allowinstitutionpublicviews']) && $values['allowinstitutionpublicviews']) ? 1 : 0; $newinstitution->allowinstitutionpublicviews = (isset($values['allowinstitutionpublicviews']) && $values['allowinstitutionpublicviews']) ? 1 : 0;
$newinstitution->allowinstitutionsmartevidence = (isset($values['allowinstitutionsmartevidence']) && $values['allowinstitutionsmartevidence']) ? 1 : 0; $newinstitution->allowinstitutionsmartevidence = (isset($values['allowinstitutionsmartevidence']) && $values['allowinstitutionsmartevidence']) ? 1 : 0;
$newinstitution->tags = (isset($values['allowinstitutiontags']) && $values['allowinstitutiontags']) ? 1 : 0;
// do not set 'reviewselfdeletion' if it has never been changed at institution level // do not set 'reviewselfdeletion' if it has never been changed at institution level
// and the value is the same as site setting 'defaultreviewselfdeletion' // and the value is the same as site setting 'defaultreviewselfdeletion'
......
...@@ -214,6 +214,10 @@ $string['norelatedtaggeditemstoviewfiltered'] = 'There is no %s you can view wit ...@@ -214,6 +214,10 @@ $string['norelatedtaggeditemstoviewfiltered'] = 'There is no %s you can view wit
$string['selfsearch'] = 'Search my portfolio'; $string['selfsearch'] = 'Search my portfolio';
$string['resultsperpage'] = 'Results per page'; $string['resultsperpage'] = 'Results per page';
// Institution tags
$string['allowinstitutiontags'] = 'Allow institution tags';
$string['allowinstitutiontagsdescription'] = 'Administrators can define a set of tags that institution members can use.';
// License metadata // License metadata
$string['license'] = 'License'; $string['license'] = 'License';
$string['licenseother'] = 'Other license (enter URL)'; $string['licenseother'] = 'Other license (enter URL)';
......
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<FIELD NAME="licensedefault" TYPE="char" LENGTH="255" NOTNULL="false"/> <FIELD NAME="licensedefault" TYPE="char" LENGTH="255" NOTNULL="false"/>
<FIELD NAME="dropdownmenu" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/> <FIELD NAME="dropdownmenu" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
<FIELD NAME="skins" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/> <FIELD NAME="skins" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
<FIELD NAME="tags" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" /> <KEY NAME="primary" TYPE="primary" FIELDS="name" />
......
...@@ -5874,5 +5874,15 @@ function xmldb_core_upgrade($oldversion=0) { ...@@ -5874,5 +5874,15 @@ function xmldb_core_upgrade($oldversion=0) {
ensure_record_exists('event_type', $event, $event); ensure_record_exists('event_type', $event, $event);
} }
if ($oldversion < 2018061800) {
log_debug('Add a "tags" field to the institution table');
$table = new XMLDBTable('institution');
$field = new XMLDBField('tags');
$field->setAttributes(XMLDB_TYPE_INTEGER, 1, null, XMLDB_NOTNULL, null, null, null, 0);
if (!field_exists($table, $field)) {
add_field($table, $field);
}
}
return $status; return $status;
} }
...@@ -58,7 +58,8 @@ class Institution { ...@@ -58,7 +58,8 @@ class Institution {
'licensedefault' => null, 'licensedefault' => null,
'licensemandatory' => 0, 'licensemandatory' => 0,
'dropdownmenu' => 0, 'dropdownmenu' => 0,
'skins' => true 'skins' => true,
'tags' => false
); );
// This institution's config settings // This institution's config settings
...@@ -124,6 +125,7 @@ class Institution { ...@@ -124,6 +125,7 @@ class Institution {
// int 1 (i.e. true/false) // int 1 (i.e. true/false)
case 'registerallowed': case 'registerallowed':
case 'skins': case 'skins':
case 'tags':
case 'suspended': case 'suspended':
case 'licensemandatory': case 'licensemandatory':
case 'expirymailsent': case 'expirymailsent':
......
...@@ -16,7 +16,7 @@ $config = new stdClass(); ...@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy // See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date. // For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2018061600; $config->version = 2018061800;
$config->series = '18.10'; $config->series = '18.10';
$config->release = '18.10dev'; $config->release = '18.10dev';
$config->minupgradefrom = 2015030409; $config->minupgradefrom = 2015030409;
......
...@@ -13,6 +13,7 @@ Scenario: Creating an institution (selenium test) ...@@ -13,6 +13,7 @@ Scenario: Creating an institution (selenium test)
And I press "Add institution" And I press "Add institution"
And I fill in the following: And I fill in the following:
| Institution name | Institution One | | Institution name | Institution One |
And I enable the switch "Allow institution tags"
And I press "Submit" And I press "Submit"
# Verifying the institution has been created # Verifying the institution has been created
Then I should see "Institution added successfully" Then I should see "Institution added successfully"
......
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