Permalink
Browse files

- Solving bug 817 (adding a glossary overview)

- Minor changes adopting moodle's naming and coding conventions (perhaps not fully adopted yet)
- Solving bug that traspose All Categories with Not Categorised view.
  • Loading branch information...
1 parent 108ef20 commit 7dd8844764f693a49d2d8b50355e32d9424ceb59 willcast committed Oct 15, 2003
View
@@ -42,7 +42,7 @@
$string['modulename'] = "Glossary";
$string['modulenameplural'] = "Glossaries";
$string['newglossaryentries'] = "New glossary entries:";
-$string['nocategorized'] = "Not categorised";
+$string['notcategorised'] = "Not categorised";
$string['noentries'] = "No entries found in this section";
$string['noentry'] = "No entry found.";
$string['searchindefinition'] = "Search definitions too";
@@ -0,0 +1,3 @@
+<P ALIGN=CENTER><B>Description</B></P>
+
+<P>It should describe the purpouse of this glossary, who will be able to post new entries, etc.
@@ -37,6 +37,7 @@ function glossary_backup_mods($bf,$preferences) {
fwrite ($bf,full_tag("ID",4,false,$glossary->id));
fwrite ($bf,full_tag("MODTYPE",4,false,"glossary"));
fwrite ($bf,full_tag("NAME",4,false,$glossary->name));
+ fwrite ($bf,full_tag("INTRO",4,false,$glossary->INTRO));
fwrite ($bf,full_tag("STUDENTCANPOST",4,false,$glossary->studentcanpost));
fwrite ($bf,full_tag("ALLOWDUPLICATEDENTRIES",4,false,$glossary->allowduplicatedentries));
fwrite ($bf,full_tag("DISPLAYFORMAT",4,false,$glossary->displayformat));
@@ -65,6 +65,12 @@ function glossary_upgrade($oldversion) {
"ADD `sourceglossaryid` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `attachment` " );
}
+
+ if ( $oldversion < 2003101500 ) {
+ execute_sql( "ALTER TABLE `{$CFG->prefix}glossary` " .
+ "ADD `intro` text NOT NULL DEFAULT '' AFTER `name` " );
+
+ }
return true;
}
@@ -12,6 +12,7 @@ CREATE TABLE prefix_glossary (
id int(10) unsigned NOT NULL auto_increment,
course int(10) unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ intro text NOT NULL,
studentcanpost tinyint(2) unsigned NOT NULL default '0',
allowduplicatedentries tinyint(2) unsigned NOT NULL default '0',
displayformat tinyint(2) unsigned NOT NULL default '0',
@@ -13,6 +13,7 @@ CREATE TABLE prefix_glossary (
id number(10) primary key,
course number(10) default '0' not null,
name varchar2(255) default '' not null,
+ intro varchar2(255) default '' not null,
studentcanpost number(2) default '0' not null,
allowduplicatedentries number(2) default '0' not null,
displayformat number(2) default '0' not null,
@@ -39,10 +40,10 @@ create or replace trigger p_glossary_trig
.
/
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(1,'1',1,1,1,1,1,1,1,1,1);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(2,'2',2,2,2,2,2,2,2,2,2);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(3,'3',3,3,3,3,3,3,3,3,3);
-insert into prefix_glossary(course,name,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(4,'4',4,4,4,4,4,4,4,4,4);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(1,'1','1',1,1,1,1,1,1,1,1,1);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(2,'2','2',2,2,2,2,2,2,2,2,2);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(3,'3','3',3,3,3,3,3,3,3,3,3);
+insert into prefix_glossary(course,name,intro,studentcanpost,allowduplicatedentries,displayformat,mainglossary,showspecial,showall,showalphabet,timecreated,timemodified) values(4,'4','4',4,4,4,4,4,4,4,4,4);
select * from prefix_glossary order by 1,2;
@@ -12,6 +12,7 @@ CREATE TABLE prefix_glossary (
id SERIAL,
course int4 NOT NULL default '0',
name varchar(255) NOT NULL default '',
+ intro text NOT NULL default '',
studentcanpost int2 NOT NULL default '0',
allowduplicatedentries int2 NOT NULL default '0',
displayformat int2 NOT NULL default '0',
View
@@ -1,6 +1,7 @@
<?php
global $CFG, $THEME;
require_once("../../config.php");
+ require_once("lib.php");
?>
<FORM name="theform" method="post" <?=$onsubmit ?> action="edit.php" enctype="multipart/form-data">
<table class=generalbox cellpadding=5 bgcolor="<?php p($THEME->cellheading)?>">
@@ -16,7 +17,7 @@
<?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id);
echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
- echo "<option value=0>" . get_string("nocategorized","glossary") . "</optioon>";
+ echo "<option value=\"0\">" . get_string("nocategorized","glossary") . "</optioon>";
if ( $categories ) {
foreach ( $categories as $category ) {
View
@@ -57,20 +57,20 @@
$newentry->timemodified = time();
$newentry->teacherentry = isteacher($course->id,$USER->id);
- $PermissionGranted = 1;
+ $permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
$dupentries = get_records("glossary_entries","UCASE(concept)", strtoupper($newentry->concept));
if ($dupentries) {
foreach ($dupentries as $curentry) {
if ( $glossary->id == $curentry->glossaryid ) {
if ( $curentry->id != $entry ) {
- $PermissionGranted = 0;
+ $permissiongranted = 0;
}
}
}
}
}
- if ( $PermissionGranted ) {
+ if ( $permissiongranted ) {
$newentry->attachment = $_FILES["attachment"];
if ($newfilename = glossary_add_attachment($newentry, $newentry->attachment)) {
$newentry->attachment = $newfilename;
@@ -97,14 +97,14 @@
$newentry->teacherentry = isteacher($course->id,$USER->id);
$newentry->sourceglossaryid = 0;
- $PermissionGranted = 1;
+ $permissiongranted = 1;
if ( !$glossary->allowduplicatedentries ) {
$dupentries = get_record("glossary_entries","UCASE(concept)", strtoupper($newentry->concept), "glossaryid", $glossary->id);
if ($dupentries) {
- $PermissionGranted = 0;
+ $permissiongranted = 0;
}
}
- if ( $PermissionGranted ) {
+ if ( $permissiongranted ) {
if (! $newentry->id = insert_record("glossary_entries", $newentry)) {
error("Could not insert this new entry");
} else {
Oops, something went wrong.

0 comments on commit 7dd8844

Please sign in to comment.