diff --git a/mod/glossary/backuplib.php b/mod/glossary/backuplib.php
index 2ffb33a8ba4..31a8bc51a84 100644
--- a/mod/glossary/backuplib.php
+++ b/mod/glossary/backuplib.php
@@ -57,6 +57,7 @@
fwrite ($bf,full_tag("DEFAULTAPPROVAL",4,false,$glossary->defaultapproval));
fwrite ($bf,full_tag("GLOBALGLOSSARY",4,false,$glossary->globalglossary));
fwrite ($bf,full_tag("ENTBYPAGE",4,false,$glossary->entbypage));
+ fwrite ($bf,full_tag("EDITALWAYS",4,false,$glossary->editalways));
fwrite ($bf,full_tag("RSSTYPE",4,false,$glossary->rsstype));
fwrite ($bf,full_tag("RSSARTICLES",4,false,$glossary->rssarticles));
fwrite ($bf,full_tag("TIMECREATED",4,false,$glossary->timecreated));
diff --git a/mod/glossary/db/mysql.php b/mod/glossary/db/mysql.php
index 9475154bae5..f6761302458 100644
--- a/mod/glossary/db/mysql.php
+++ b/mod/glossary/db/mysql.php
@@ -335,6 +335,10 @@ function glossary_upgrade($oldversion) {
}
}
}
+
+ if ( $oldversion < 2004080800) {
+ table_column("glossary","","editalways","tinyint","2", "unsigned", "0", "", "entbypage");
+ }
return true;
}
diff --git a/mod/glossary/db/mysql.sql b/mod/glossary/db/mysql.sql
index b55b314fa18..404a51b2209 100644
--- a/mod/glossary/db/mysql.sql
+++ b/mod/glossary/db/mysql.sql
@@ -25,6 +25,7 @@ CREATE TABLE prefix_glossary (
defaultapproval tinyint(2) unsigned NOT NULL default '1',
globalglossary tinyint(2) unsigned NOT NULL default '0',
entbypage tinyint(3) unsigned NOT NULL default '10',
+ editalways tinyint(2) unsigned NOT NULL default '0',
rsstype tinyint(2) unsigned NOT NULL default '0',
rssarticles tinyint(2) unsigned NOT NULL default '0',
assessed int(10) unsigned NOT NULL default '0',
diff --git a/mod/glossary/db/oci8po.sql b/mod/glossary/db/oci8po.sql
index 092dadd9b3c..a1cff108891 100755
--- a/mod/glossary/db/oci8po.sql
+++ b/mod/glossary/db/oci8po.sql
@@ -21,6 +21,7 @@ CREATE TABLE prefix_glossary (
showspecial number(2) default '1' not null,
showall number(2) default '1' not null,
showalphabet number(2) default '1' not null,
+ editalways number(2) default '0' NOT NULL,
rsstype number(2) default '0' NOT NULL,
rssarticles number(2) default '0' NOT NULL,
timecreated number(10) default '0' not null,
diff --git a/mod/glossary/db/postgres7.php b/mod/glossary/db/postgres7.php
index 0f654484c2c..2a4b458b258 100644
--- a/mod/glossary/db/postgres7.php
+++ b/mod/glossary/db/postgres7.php
@@ -97,6 +97,10 @@ function glossary_upgrade($oldversion) {
}
}
+ if ( $oldversion < 2004080800) {
+ table_column("glossary","","editalways","integer","2", "unsigned", "0", "", "entbypage");
+ }
+
return true;
}
diff --git a/mod/glossary/db/postgres7.sql b/mod/glossary/db/postgres7.sql
index 5d1f637e52a..3840cef6d33 100644
--- a/mod/glossary/db/postgres7.sql
+++ b/mod/glossary/db/postgres7.sql
@@ -25,6 +25,7 @@ CREATE TABLE prefix_glossary (
defaultapproval int2 NOT NULL default '1',
globalglossary int2 NOT NULL default '0',
entbypage int NOT NULL default '10',
+ editalways integer NOT NULL default '0',
rsstype integer NOT NULL default '0',
rssarticles integer NOT NULL default '0',
assessed int4 NOT NULL default '0',
diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php
index bc700bc736f..0b5b8c5bad8 100644
--- a/mod/glossary/lib.php
+++ b/mod/glossary/lib.php
@@ -621,8 +621,11 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
$icon = "$CFG->pixpath/t/delete.gif";
}
- // Exported entries can be updated/deleted only by teachers in the main glossary
- if ( !$importedentry and ($isteacher or !$ismainglossary) ) {
+ //Decide if an entry is editable:
+ // -It isn't a imported entry (so nobody can edit a imported (from secondary to main) entry)) and
+ // -The user is teacher or he is a student with time permissions (edit period or editalways defined).
+ $ineditperiod = (time() - $entry->timemodified < $CFG->maxeditingtime);
+ if ( !$importedentry and ($isteacher or ($entry->userid == $USER->id and ($glossary->editalways or $ineditperiod)))) {
$return .= " id&mode=delete&entry=$entry->id&prevmode=$mode&hook=$hook\"> ";
diff --git a/mod/glossary/mod.html b/mod/glossary/mod.html
index 49f2a4099d6..99f086ffbac 100644
--- a/mod/glossary/mod.html
+++ b/mod/glossary/mod.html
@@ -44,12 +44,15 @@ if (!isset($form->showalphabet)) {
if (!isset($form->showspecial)) {
$form->showspecial = 1;
}
- if (!isset($form->rsstype)) {
- $form->rsstype = 0;
- }
- if (!isset($form->rssarticles)) {
- $form->rssarticles = 0;
- }
+if (!isset($form->editalways)) {
+ $form->editalways = 0;
+}
+if (!isset($form->rsstype)) {
+ $form->rsstype = 0;
+}
+if (!isset($form->rssarticles)) {
+ $form->rssarticles = 0;
+}
?>