]> git.mjollnir.org Git - moodle.git/commitdiff
- Solving bug 817 (adding a glossary overview)
authorwillcast <willcast>
Wed, 15 Oct 2003 16:12:38 +0000 (16:12 +0000)
committerwillcast <willcast>
Wed, 15 Oct 2003 16:12:38 +0000 (16:12 +0000)
- Minor changes adopting moodle's naming and coding conventions (perhaps not fully adopted yet)
- Solving bug that traspose All Categories with Not Categorised view.

14 files changed:
lang/en/glossary.php
lang/en/help/glossary/description.html [new file with mode: 0644]
mod/glossary/backuplib.php
mod/glossary/db/mysql.php
mod/glossary/db/mysql.sql
mod/glossary/db/oci8po.sql
mod/glossary/db/postgres7.sql
mod/glossary/edit.html
mod/glossary/edit.php
mod/glossary/lib.php
mod/glossary/mod.html
mod/glossary/restorelib.php
mod/glossary/version.php
mod/glossary/view.php

index 7d0cdffb57573586ad72ec6f65760e5d8f0f4da8..7ce7d0d72595d89c053e6b9916f99a26be408589 100644 (file)
@@ -42,7 +42,7 @@ $string['mainglossary'] = "Main glossary";
 $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";
diff --git a/lang/en/help/glossary/description.html b/lang/en/help/glossary/description.html
new file mode 100644 (file)
index 0000000..cd98ad5
--- /dev/null
@@ -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. 
index 0b0fe07552259ce7755f9c2bd35ecc53dda5284f..9a406ab2000b88e69d4f448fd893a0c0c65d6561 100644 (file)
@@ -37,6 +37,7 @@
                 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));       
index 2fb33b28b9a22a540e15bbce33aac8189247946b..17a69aeb7e695b4d7dce11807e96faef2aaac8de 100644 (file)
@@ -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;
 }
index 71e9d6e8e7dc203026053cf80ec774547a337cdb..d6196acb98a6ae5f0cda015350ae11924e8086a1 100644 (file)
@@ -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',
index 231af0223190c99c270cc759472265d3adb4107b..d18e06be51124c605af195c175894d82944761c9 100755 (executable)
@@ -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;
 
index 81631aaeee29248f4f97319528410d860bcf288b..0c1746c09c18e342caf462acb7d6c2cd485f607c 100644 (file)
@@ -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',
index c173ac0f0724176168904b339932a789dc176bd5..1324a230fea5cc6e1fadf17140ae268eee0588ba 100644 (file)
@@ -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 ) {
index 63d4ec9a7b07a2598d1bc12d0d1cf1e4142b29aa..e2a936f4734424b07292ccb89bdfc10650a646ed 100644 (file)
@@ -57,20 +57,20 @@ if ($e) {
                 $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 @@ if ($e) {
                 $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 {
index 1b2fdb5b24e03d42cfe22755b462f41bd1a7a187..a0096525ef3b3c8d2f156c976c4cf7148e15f433 100644 (file)
@@ -5,12 +5,10 @@
 
 require_once("$CFG->dirroot/files/mimetypes.php");
 
-$tCFG->TabTableBGColor = $THEME->cellcontent2;
-$tCFG->TabTableWidth = "70%";
-$tCFG->ActiveTabColor = $THEME->cellcontent2;
-$tCFG->InactiveTabColor = $THEME->cellheading2;
-$tCFG->TabsPerRow = 5;
-$tCFG->TabSeparation = 4;
+define("GLOSSARY_SHOW_ALL_CATEGORIES", 0);
+define("GLOSSARY_SHOW_NOT_CATEGORISED", -1);
+define("GLOSSARY_STANDARD_VIEW", 0);
+define("GLOSSARY_CATEGORY_VIEW", 1);
 
 function glossary_add_instance($glossary) {
 /// Given an object containing all the necessary data,
@@ -187,7 +185,7 @@ function glossary_get_entries($glossaryid, $entrylist) {
 function glossary_print_entry($course, $cm, $glossary, $entry,$currentview="",$cat="") {
     global $THEME, $USER, $CFG;
     
-    $PermissionGranted = 0;
+    $permissiongranted = 0;
     $formatfile = "$CFG->dirroot/mod/glossary/formats/$glossary->displayformat.php";
     $functionname = "glossary_print_entry_by_format";
 
@@ -195,14 +193,14 @@ function glossary_print_entry($course, $cm, $glossary, $entry,$currentview="",$c
         if ( file_exists($formatfile) ) {
            include_once($formatfile);
            if (function_exists($functionname) ) {
-              $PermissionGranted = 1;
+              $permissiongranted = 1;
            }
         }
     } else {
-       $PermissionGranted = 1;
+       $permissiongranted = 1;
     }
     
-    if ( $glossary->displayformat > 0 and $PermissionGranted ) {
+    if ( $glossary->displayformat > 0 and $permissiongranted ) {
         glossary_print_entry_by_format($course, $cm, $glossary, $entry,$currentview,$cat);
     } else {
         glossary_print_entry_by_default($course, $cm, $glossary, $entry,$currentview,$cat);
@@ -233,14 +231,14 @@ function glossary_print_entry_by_default($course, $cm, $glossary, $entry,$curren
 function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview="",$cat="") {
     global $THEME, $USER;
 
-    $ImportedEntry = ($entry->sourceglossaryid == $glossary->id);
-    $IsTeacher = isteacher($course->id);
-    $IsMainGlossary = $glossary->mainglossary;
+    $importedentry = ($entry->sourceglossaryid == $glossary->id);
+    $isteacher = isteacher($course->id);
+    $ismainglossary = $glossary->mainglossary;
     
-       if ($IsTeacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
+       if ($isteacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
                echo "<p align=right>";
                // only teachers can export entries so check it out
-               if ($IsTeacher and !$IsMainGlossary and !$ImportedEntry) {
+               if ($isteacher and !$ismainglossary and !$importedentry) {
                        $mainglossary = get_record("glossary","mainglossary",1,"course",$course->id);
                        if ( $mainglossary ) {  // if there is a main glossary defined, allow to export the current entry
                                
@@ -256,13 +254,13 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview
         }
 
                // Exported entries can be updated/deleted only by teachers in the main glossary
-        if ( !$ImportedEntry and ($IsTeacher or !$IsMainGlossary) ) {
+        if ( !$importedentry and ($isteacher or !$ismainglossary) ) {
             echo "<a href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("delete") . "\"src=\"";
             echo $icon;
             echo "\" height=11 width=11 border=0></a> ";
             
             echo "<a href=\"edit.php?id=$cm->id&e=$entry->id&currentview=$currentview&cat=$cat\"><img  alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
-        } elseif ( $ImportedEntry ) {
+        } elseif ( $importedentry ) {
             echo "<font size=-1>" . get_string("exportedentry","glossary") . "</font>";
         }
        }
@@ -522,112 +520,129 @@ function glossary_print_attachments($entry, $return=NULL, $align="left") {
     return $imagereturn;
 }
 
-function glossary_print_tabbed_table_start($data, $CurrentTab, $tTHEME = NULL) {
+function glossary_print_tabbed_table_start($data, $currenttab, $tTHEME = NULL) {
 
 if ( !$tTHEME ) {
      global $THEME;
      $tTHEME = $THEME;
 }
 
-$TableColor           = $tTHEME->TabTableBGColor;
-$TableWidth           = $tTHEME->TabTableWidth;
-$CurrentTabColor      = $tTHEME->ActiveTabColor;
-$TabColor             = $tTHEME->InactiveTabColor;
-$TabsPerRow           = $tTHEME->TabsPerRow;
-$TabSeparation        = $tTHEME->TabSeparation;
+$tablecolor           = $tTHEME->TabTableBGColor;
+$currenttabcolor      = $tTHEME->ActiveTabColor;
+$tabcolor             = $tTHEME->InactiveTabColor;
+$inactivefontcolor    = $tTHEME->InactiveFontColor;
 
-$Tabs                 = count($data);
-$TabWidth             = (int) (100 / $TabsPerRow);
+$tablewidth           = $tTHEME->TabTableWidth;
+$tabsperrow           = $tTHEME->TabsPerRow;
+$tabseparation        = $tTHEME->TabSeparation;
 
-$CurrentRow           = ( $CurrentTab - ( $CurrentTab % $TabsPerRow) ) / $TabsPerRow;
+$tabs                 = count($data);
+$tabwidth             = (int) (100 / $tabsperrow);
 
-$NumRows              = (int) ( $Tabs / $TabsPerRow ) + 1;
+$currentrow           = ( $currenttab - ( $currenttab % $tabsperrow) ) / $tabsperrow;
+
+$numrows              = (int) ( $tabs / $tabsperrow ) + 1;
 
 ?>
   <center>
-  <table border="0" cellpadding="0" cellspacing="0" width="<?php p($TableWidth) ?>">
+  <table border="0" cellpadding="0" cellspacing="0" width="<?php p($tablewidth) ?>">
     <tr>
       <td width="100%">
 
       <table border="0" cellpadding="0" cellspacing="0" width="100%">
 
 <?php
-$TabProccessed = 0;
-for ($row = 0; $row < $NumRows; $row++) {
+$tabproccessed = 0;
+for ($row = 0; $row < $numrows; $row++) {
      echo "<tr>\n";
-     if ( $row != $CurrentRow ) {
-          for ($col = 0; $col < $TabsPerRow; $col++) {
-               if ( $TabProccessed < $Tabs ) {
+     if ( $row != $currentrow ) {
+          for ($col = 0; $col < $tabsperrow; $col++) {
+               if ( $tabproccessed < $tabs ) {
                     if ( $col == 0 ) {
-                        echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
+                        echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
                     }
-                    if ($TabProccessed == $CurrentTab) {
-                         $CurrentColor = $CurrentTabColor;
+                    if ($tabproccessed == $currenttab) {
+                         $currentcolor = $currenttabcolor;
                     } else {
-                         $CurrentColor = $TabColor;
+                         $currentcolor = $tabcolor;
                     }
-
-                    echo "<td width=\"$TabWidth%\" bgcolor=\"$CurrentColor\" align=\"center\"><b>";
-                    if ($TabProccessed != $CurrentTab) {
-                        echo "<a href=\"" . $data[$TabProccessed]->link . "\">";
+                    echo "<td width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
+                    if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
+                        echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
                     }
-                    echo $data[$TabProccessed]->caption;
-                    if ($TabProccessed != $CurrentTab) {
+
+                                       if ( !$data[$tabproccessed]->link ) {
+                                           echo "<font color=\"$inactivefontcolor\">";
+                                       }
+                    echo $data[$tabproccessed]->caption;
+                                       if ( !$data[$tabproccessed]->link ) {
+                                           echo "</font>";
+                                       }
+
+                    if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
                         echo "</a>";
                     }
                     echo "</b></td>";
                     
-                    if ( $col < $TabsPerRow ) {
-                        echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
+                    if ( $col < $tabsperrow ) {
+                        echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
                     }
                } else {
-                    $CurrentColor = "";
+                    $currentcolor = "";
                }
-               $TabProccessed++;
+               $tabproccessed++;
           }
      } else {
-          $FirstTabInCurrentRow = $TabProccessed;
-          $TabProccessed += $TabsPerRow;
+          $firsttabincurrentrow = $tabproccessed;
+          $tabproccessed += $tabsperrow;
      }
-     echo "</tr><tr><td colspan=" . (2* $TabsPerRow) . " ></td></tr>\n";
+     echo "</tr><tr><td colspan=" . (2* $tabsperrow) . " ></td></tr>\n";
 }
      echo "<tr>\n";
-          $TabProccessed = $FirstTabInCurrentRow;
-          for ($col = 0; $col < $TabsPerRow; $col++) {
-               if ( $TabProccessed < $Tabs ) {
+          $tabproccessed = $firsttabincurrentrow;
+          for ($col = 0; $col < $tabsperrow; $col++) {
+               if ( $tabproccessed < $tabs ) {
                     if ( $col == 0 ) {
-                        echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
+                        echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
                     }
-                    if ($TabProccessed == $CurrentTab) {
-                         $CurrentColor = $CurrentTabColor;
+                    if ($tabproccessed == $currenttab) {
+                         $currentcolor = $currenttabcolor;
                     } else {
-                         $CurrentColor = $TabColor;
+                         $currentcolor = $tabcolor;
                     }
-                    echo "<td width=\"$TabWidth%\" bgcolor=\"$CurrentColor\" align=\"center\"><b>";
-                    if ($TabProccessed != $CurrentTab) {
-                        echo "<a href=\"" . $data[$TabProccessed]->link . "\">";
+                    echo "<td width=\"$tabwidth%\" bgcolor=\"$currentcolor\" align=\"center\"><b>";
+                    if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
+                        echo "<a href=\"" . $data[$tabproccessed]->link . "\">";
                     }
-                    echo $data[$TabProccessed]->caption;
-                    if ($TabProccessed != $CurrentTab) {
+
+                                       if ( !$data[$tabproccessed]->link ) {
+                                           echo "<font color=\"$inactivefontcolor\">";
+                                       }
+                    echo $data[$tabproccessed]->caption;
+                                       if ( !$data[$tabproccessed]->link ) {
+                                           echo "</font>";
+                                       }
+
+                    if ($tabproccessed != $currenttab and $data[$tabproccessed]->link) {
                         echo "</a>";
                     }
                     echo "</b></td>";
 
-                    if ($col < $TabsPerRow) {
-                         echo "<td width=\"$TabSeparation\" align=\"center\">&nbsp;</td>";
+                    if ($col < $tabsperrow) {
+                         echo "<td width=\"$tabseparation\" align=\"center\">&nbsp;</td>";
                     }
                } else {
-                    if ($NumRows > 1) {
-                         $CurrentColor = $TabColor;
+                    if ($numrows > 1) {
+                         $currentcolor = $tabcolor;
                     } else {
-                         $CurrentColor = "";
+                         $currentcolor = "";
                     }
-                    echo "<td colspan = " . (2 * ($TabsPerRow - $col)) . " bgcolor=\"$CurrentColor\" align=\"center\">";
+                    echo "<td colspan = " . (2 * ($tabsperrow - $col)) . " bgcolor=\"$currentcolor\" align=\"center\">";
                     echo "</td>";
 
-                    $col = $TabsPerRow;
+                    $col = $tabsperrow;
                }
-               $TabProccessed++;
+               $tabproccessed++;
           }
      echo "</tr>\n";
      ?>
@@ -636,10 +651,10 @@ for ($row = 0; $row < $NumRows; $row++) {
       </td>
     </tr>
     <tr>
-      <td width="100%" bgcolor="<?php p($TableColor) ?>"><hr></td>
+      <td width="100%" bgcolor="<?php p($tablecolor) ?>"><hr></td>
     </tr>
     <tr>
-      <td width="100%" bgcolor="<?php p($TableColor) ?>">
+      <td width="100%" bgcolor="<?php p($tablecolor) ?>">
           <center>
 <?php
 }
@@ -711,8 +726,8 @@ global $CFG, $THEME;
      echo "<td align=center width=60%>";
      echo "<b>";
 
-     $menu["-1"] = get_string("allcategories","glossary");
-     $menu["0"] = get_string("nocategorized","glossary");
+     $menu[GLOSSARY_SHOW_ALL_CATEGORIES] = get_string("allcategories","glossary");
+     $menu[GLOSSARY_SHOW_NOT_CATEGORISED] = get_string("notcategorised","glossary");
 
      $categories = get_records("glossary_categories", "glossaryid", $glossary->id, "name ASC");
      if ( $categories ) {
@@ -727,18 +742,22 @@ global $CFG, $THEME;
           }
      }
      if ( !$selected ) {
-         $selected = "0";
+         $selected = GLOSSARY_SHOW_NOT_CATEGORISED;
      }
 
      if ( $category ) {
         echo $category->name;
      } else {
-        if ( $cat < 0 ) {
-            echo get_string("allcategories","glossary");
-            $selected = "-1";
-        } elseif ( $cat == 0 ) {
+        if ( $cat == GLOSSARY_SHOW_NOT_CATEGORISED ) {
+
             echo get_string("entrieswithoutcategory","glossary");
-            $selected = "0";
+            $selected = GLOSSARY_SHOW_NOT_CATEGORISED;
+
+        } elseif ( $cat == GLOSSARY_SHOW_ALL_CATEGORIES ) {
+
+            echo get_string("allcategories","glossary");
+            $selected = GLOSSARY_SHOW_ALL_CATEGORIES;
+
         }
      }
      echo "</b></td>";
index 951173a9fa325481276ed52a41973009df09364a..ca0238dff04e257194b6d8b263b5f654053e4253 100644 (file)
         <INPUT type="text" name="name" size=30 value="<?php p($form->name) ?>">
     </TD>
 </TR>
+<tr valign=top>
+    <td align=right><p><b><?php print_string("description") ?>:</b></p>
+     <font size="1">
+     <?php
+        helpbutton("description", get_string("description"), "glossary", true, true);
+        echo "<br \>";
+        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+        echo "<br \>";
+        helpbutton("text", get_string("helptext"), "moodle", true, true);
+     ?>
+     <br />
+     </font>
+    </td>
+    <td>
+        <textarea name="intro" rows=5 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
+    </td>
+</tr>
 <!-- More rows go in here... -->
 <?php
 $mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
index ba812beb444871fba8250a6eea633d00b257fc57..085ed792ea89197de427bc3a42532810a81d92fd 100644 (file)
@@ -41,6 +41,7 @@
             //Now, build the glossary record structure
             $glossary->course = $restore->course_id;
             $glossary->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
+            $glossary->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
             $glossary->studentcanpost = backup_todb($info['MOD']['#']['STUDENTCANPOST']['0']['#']);
             $glossary->allowduplicatedentries = backup_todb($info['MOD']['#']['ALLOWDUPLICATEDENTRIES']['0']['#']);
             $glossary->displayformat = backup_todb($info['MOD']['#']['DISPLAYFORMAT']['0']['#']);
index 75cec4a16dc15f1f49b20d31379ae7e58d6981f7..de38c6f75f0f06c64ced2adf7bdc7ed6427c3094 100644 (file)
@@ -5,9 +5,9 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2003092400;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2003101500;  // The current module version (Date: YYYYMMDDXX)
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
-$release = "0.4 development";   // User-friendly version number
+$release = "0.5 development";   // User-friendly version number
 
 ?>
index 105eb0f7b3ee4efc38b6fb8bc718643976bb9688..92186b368ff647f263abbbc41105ab221b8875d6 100644 (file)
@@ -3,7 +3,6 @@
 /// This page prints a particular instance of glossary
     require_once("../../config.php");
     require_once("lib.php");
-    require_once("dynalink.php");
     
     require_variable($id);           // Course Module ID
     optional_variable($l);           // letter to look for
@@ -34,7 +33,7 @@
     
     add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id");
     
-    $search = trim(strip_tags($search));
+       $search = trim(strip_tags($search));
     if ($search and !$entryid) {
         $l = "";
         $searchterms = explode(" ", $search); // Search for words independently
@@ -49,8 +48,9 @@
         $search = "";
     } 
     
+    $alphabet = explode("|", get_string("alphabet","glossary"));
     if ($l == "" and $search == "" and ($eid == "" or $eid == 0)) {
-        $l = "A";
+        $l = $alphabet[0];
     } elseif ($eid) {
         $l = "";
     } 
     print_heading($glossary->name);
     
     
+/// Info box
+
+    if ( $glossary->intro ) {
+           print_simple_box_start("center","70%");
+        echo '<p>';
+        echo $glossary->intro;
+        echo '</p>';
+        print_simple_box_end();
+       }
+
 /// Add button
 
     if (isteacher($course->id) or ($glossary->studentcanpost) and !isguest($course->id)) {
     $data[1]->caption = get_string("categoryview", "glossary");
     
     if ($currentview) {
-        $CurrentTab = 1;
+        $currenttab = GLOSSARY_CATEGORY_VIEW; //1;
     } else {
-        $CurrentTab = 0;
+        $currenttab = GLOSSARY_STANDARD_VIEW; //0;
     } 
+    $glossary_tCFG->TabTableBGColor = $THEME->cellheading;
+    $glossary_tCFG->ActiveTabColor = $THEME->cellheading;
+    $glossary_tCFG->InactiveTabColor = $THEME->cellcontent2;
+    $glossary_tCFG->InactiveFontColor= $THEME->hidden;
+       
+    $glossary_tCFG->TabTableWidth = "70%";
+    $glossary_tCFG->TabsPerRow = 5;
+    $glossary_tCFG->TabSeparation = 4;
 
-    glossary_print_tabbed_table_start($data, $CurrentTab, $tCFG);
+    glossary_print_tabbed_table_start($data, $currenttab, $glossary_tCFG);
     echo "<center>";
     if ($currentview) {
         glossary_print_categories_menu($course, $cm, $glossary, $cat, $category);
     } else {
         glossary_print_alphabet_menu($cm, $glossary, $l);
         if ($l) {
-            $CurrentLetter = "";
+            $currentletter = "";
         } elseif ($search) {
             echo "<h3>$strsearch: $search</h3>";
         } 
         $allentries = glossary_search_entries($searchterms, $glossary, $includedefinition);
     } elseif ($eid) { // looking for an entry
         $allentries = get_records("glossary_entries", "id", $eid);
-    } elseif ($currentview and $cat == -1) { // Browsing all categories
+    } elseif ($currentview and $cat == GLOSSARY_SHOW_ALL_CATEGORIES) { // Browsing all categories
         $sql = "SELECT gec.id gecid, gc.name, gc.id CID, ge.*
                     FROM {$CFG->prefix}glossary_entries ge,
                         {$CFG->prefix}glossary_entries_categories gec,
     } 
     
     if ($allentries) {
-        $DumpedDefinitions = 0;
+        $dumpeddefinitions = 0;
         foreach ($allentries as $entry) {
-            $DumpToScreen = 0;
-            $FirstLetter = strtoupper(substr(ltrim($entry->concept), 0, strlen($l)));
+            $dumptoscreen = 0;
+            $firstletter = strtoupper(substr(ltrim($entry->concept), 0, strlen($l)));
             if ($l) {
-                if ($l == "ALL" or $FirstLetter == $l) {
-                    if ($CurrentLetter != $FirstLetter[0]) {
-                        $CurrentLetter = $FirstLetter[0];
+                if ($l == "ALL" or $firstletter == $l) {
+                    if ($currentletter != $firstletter[0]) {
+                        $currentletter = $firstletter[0];
     
                         if ($glossary->displayformat == 0) {
-                            if ($DumpedDefinitions > 0) {
+                            if ($dumpeddefinitions > 0) {
                                 echo "</table></center><p>";
                             } 
                             echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=10><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
                         } 
                         if ($l == "ALL") {
-                            echo "<b>$CurrentLetter</b>";
+                            echo "<b>$currentletter</b>";
                         } 
     
                         if ($glossary->displayformat == 0) {
                             echo "\n</center></td></tr></table></center>";
-                            if ($DumpedDefinitions > 0) {
+                            if ($dumpeddefinitions > 0) {
                                 echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
                             } 
                         } 
                     } 
-                    $DumpToScreen = 1;
-                } elseif ($l == "SPECIAL" and ord($FirstLetter) != ord("Ñ") and 
-                         (ord($FirstLetter) < ord("A") or ord($FirstLetter) > ord("Z"))) {
-                    $DumpToScreen = 1;
+                    $dumptoscreen = 1;
+                } elseif ($l == "SPECIAL" and ord($firstletter) != ord("Ñ") and 
+                         (ord($firstletter) < ord("A") or ord($firstletter) > ord("Z"))) {
+                    $dumptoscreen = 1;
                 } 
             } else {
                 if ($currentview) {
-                    if ($category) {
+                    if ($category) {   // if we are browsing a category
                         if (record_exists("glossary_entries_categories", "entryid", $entry->id, "categoryid", $category->id)) {
-                            $DumpToScreen = 1;
+                            $dumptoscreen = 1;
                         } 
-                    } else {
-                        if ($cat < 0) { // No categorized
+                    } else { 
+                        if ($cat == GLOSSARY_SHOW_NOT_CATEGORISED) { // Not categorized
                             if (! record_exists("glossary_entries_categories", "entryid", $entry->id)) {
-                                $DumpToScreen = 1;
+                                $dumptoscreen = 1;
                             } 
                         } else { // All categories
                             if ($currentcategory != $entry->CID) {
                                 $currentcategory = $entry->CID;
                                 if ($glossary->displayformat == 0) {
-                                    if ($DumpedDefinitions > 0) {
+                                    if ($dumpeddefinitions > 0) {
                                         echo "</table></center><p>";
                                     } 
                                     echo "\n<center><table border=0 cellspacing=0 width=95% valign=top cellpadding=10><tr><td align=center bgcolor=\"$THEME->cellheading2\">";
     
                             if ($glossary->displayformat == 0) {
                                 echo "\n</center></td></tr></table></center>";
-                                if ($DumpedDefinitions > 0) {
+                                if ($dumpeddefinitions > 0) {
                                     echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
                                 } 
                             } 
     
-                            $DumpToScreen = 1;
+                            $dumptoscreen = 1;
                         } 
                     } 
                 } else {
-                    $DumpToScreen = 1;
+                    $dumptoscreen = 1;
                 } 
             } 
     
-            if ($DumpToScreen) {
-                $DumpedDefinitions++;
+            if ($dumptoscreen) {
+                $dumpeddefinitions++;
     
                 $concept = $entry->concept;
                 $definition = $entry->definition;
     
-                if ($DumpedDefinitions == 1) {
+                if ($dumpeddefinitions == 1) {
                     if ($glossary->displayformat == 0) {
                         echo "\n<center><table border=1 cellspacing=0 width=95% valign=top cellpadding=10>";
                     } 
                     $entry->concept = highlight($search, $concept);
                     $entry->definition = highlight($search, $definition);
                 } 
-                if (!$glossary->mainglossary) {
-                    $entry->definition = glossary_dynamic_link($course->id, $definition);
-                } 
     
                 glossary_print_entry($course, $cm, $glossary, $entry, $currentview, $cat);
     
             } 
         } 
     } 
-    if (! $DumpedDefinitions) {
+    if (! $dumpeddefinitions) {
         print_simple_box_start("center", "70%", "$THEME->cellheading");
         if (!$search) {
             echo "<center>$strnoentries</center>";