]> git.mjollnir.org Git - moodle.git/commitdiff
- Adding aliases
authorwillcast <willcast>
Wed, 5 Nov 2003 00:06:31 +0000 (00:06 +0000)
committerwillcast <willcast>
Wed, 5 Nov 2003 00:06:31 +0000 (00:06 +0000)
lang/en/glossary.php
lang/en/help/glossary/aliases.html [new file with mode: 0644]
mod/glossary/TODO.txt
mod/glossary/db/mysql.php
mod/glossary/db/mysql.sql
mod/glossary/db/postgres7.sql
mod/glossary/edit.html
mod/glossary/edit.php
mod/glossary/version.php

index d23697f763e1925b93b4c61af4545794631b37c4..6511a223c77a359d9e93f1137034490274ec26ba 100644 (file)
@@ -4,6 +4,7 @@
 $string['addcomment'] = "Add comment";
 $string['addentry'] = "Add a new entry";
 $string['approve'] = "Approve";
+$string['aliases'] = "Aliases";
 $string['allentries'] = "ALL";
 $string['allcategories'] = "All Categories";
 $string['allowcomments'] = "Allow comments on entries";
@@ -57,7 +58,6 @@ $string['displayformat4']  = "FAQ";
 $string['displayformat5'] = "Full without author";
 $string['duplicateentry'] = "Duplicate entry";
 $string['editcategories'] = "Edit categories";
-$string['editalias'] = "Edit alias";
 $string['editentry'] = "Edit entry";
 $string['editingcomment'] = "Editing comment";
 $string['entries'] = "Entries";
@@ -101,6 +101,7 @@ $string['noconceptfound'] = "No concept or definition found.";
 $string['nocomments'] = "(No comments found on this entry)";
 $string['noentries'] = "No entries found in this section";
 $string['noentry'] = "No entry found.";
+$string['onebyline'] = "(one by line)";
 $string['printerfriendly'] = "Printer-friendly version";
 $string['question'] = "Question";
 $string['rejectedentries'] = "Rejected entries";
diff --git a/lang/en/help/glossary/aliases.html b/lang/en/help/glossary/aliases.html
new file mode 100644 (file)
index 0000000..148234e
--- /dev/null
@@ -0,0 +1,5 @@
+<P ALIGN=CENTER><B>Aliases</B></P>
+
+<p>The glossary allows to maintain a list of aliases for every entry.
+
+<p>Aliases are used as alternative terms to refer concepts so wherever the concept OR any alias is found, it will be automatically linked with the concept.</p>
index bcff97cd7355b5134d6eca4d80611fc81cc2b079..eb54ca3c21cdde50640387c8e1dfd68713e07c9c 100644 (file)
@@ -2,14 +2,18 @@ Things that are in the inkpot yet:
 ==================================
 
 
-- Allow to export/import entries (Working on it)
+- Allow to export/import entries (in beta now)
    IMPORTING OPTIONS:
         * New glossary o just append entries to the current one?
         * With or withot categories?
-- Add Alias to concepts in order to use dynalinks on them.
+
+- Add Alias to concepts in order to use dynalinks on them. (in beta now)
+
 - Allow to set default values for glossaries and entries settings (done)
+
 - Allow grading of entries
     * Evaluation
     * Self-evaluation?
     * Co-evaluation?
-- Add printer friendly version of glossaries (Working on it)
+
+- Add printer friendly version of glossaries (in beta)
index 2db2e3de813c6e836d29de525bc030b463bf5b8a..ca3b52a11b0968eb6e9a322638e352d9695a9c6a 100644 (file)
@@ -156,6 +156,15 @@ function glossary_upgrade($oldversion) {
             }
         }
     }
+
+    if ( $oldversion < 2003110400 ) {
+        execute_sql("CREATE TABLE `{$CFG->prefix}glossary_alias` (
+                    `id` INT(10) unsigned NOT NULL auto_increment,
+                    `entryid` INT(10) UNSIGNED NOT NULL default '0',
+                    `alias` TEXT NOT NULL default '',
+                    PRIMARY KEY  (`id`)
+                    ) TYPE=MyISAM COMMENT='entries alias'");
+    }
     return true;
 }
 
index 1c19299bcb58b5d631331d5a5fa58f1b4382fd2f..2948f7765454cecee8a6d387efebe945b3ab7a71 100644 (file)
@@ -52,6 +52,17 @@ CREATE TABLE prefix_glossary_entries (
      PRIMARY KEY  (id)
 ) TYPE=MyISAM COMMENT='all glossary entries';
 
+#
+# Table structure for table `glossary_alias`
+#
+
+CREATE TABLE prefix_glossary_alias (
+     id int(10) unsigned NOT NULL auto_increment,
+     entryid int(10) unsigned NOT NULL default '0',
+     alias text NOT NULL,
+     PRIMARY KEY  (id)
+) TYPE=MyISAM COMMENT='entries alias';
+
 #
 # Table structure for table `glossary_cageories`
 #
index cf6cfd2072f3b6e3b1e78f8138464a809153fd44..c16c5e981e7652333e0a3bca559d5077cf7333ab 100644 (file)
@@ -61,6 +61,17 @@ CREATE TABLE prefix_glossary_categories (
      PRIMARY KEY  (id)
 );
 
+#
+# Table structure for table `glossary_alias`
+#
+
+CREATE TABLE prefix_glossary_alias (
+     id SERIAL,
+     entryid int4 NOT NULL default '0',
+     alias TEXT NOT NULL,
+     PRIMARY KEY  (id)
+);
+
 #
 # Table structure for table `glossary_entries_category`
 #
index d05cddd8109505e667252a26bdf99c4a925e43d1..aafc2679cff94802fb718d1bdeb28d07971a50fa 100644 (file)
@@ -28,7 +28,7 @@ if (isset($errors)) {
     <td>
     <?php
         $categories = get_records("glossary_categories","glossaryid",$glossary->id);
-        echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
+        echo "<select size=\"8\" name=\"categories[]\" multiple=\"yes\">";
         echo "<option value=\"0\">" . get_string("notcategorised","glossary") . "</optioon>";
 
         if ( $categories ) {
@@ -46,6 +46,10 @@ if (isset($errors)) {
     </select>
     <td>
     <td width=100%>
+    <table border=0>
+        <tr>
+        <td align=center width=58%>
+
     <table border=0 width=100%>
         <tr><td align=right width=80%><small><?php echo get_string("entryusedynalink","glossary") ?>:</small></td><td width=20%>
     <script>
@@ -61,7 +65,7 @@ if (isset($errors)) {
         $selected = "checked";
     }
 ?> 
-    <input type="checkbox" name="usedynalink" value=1 <?php p($selected) ?> onclick="return lockoptions('form','usedynalink', items)"> <?php helpbutton("usedynalink", strip_tags(get_string("usedynalink"), "glossary"), "glossary") ?>
+    <input type="checkbox" name="usedynalink" value=1 <?php p($selected) ?> onclick="return lockoptions('form','usedynalink', items)"> <?php helpbutton("usedynalink", strip_tags(get_string("usedynalink", "glossary")), "glossary") ?>
         </td></tr>
         <tr><td align=right width=80%><small><?php echo get_string("casesensitive","glossary") ?>:</small></td><td width=20%>
 <?php
@@ -90,6 +94,16 @@ if (isset($errors)) {
     <input type="checkbox" name="fullmatch" value=1 <?php p($selected) ?>> <?php helpbutton("fullmatch", strip_tags(get_string("fullmatch", "glossary")), "glossary") ?>
         </td></tr>
     </table>
+
+        </td>
+        <td align=center width=42% valign=top>
+            <small><strong><?PHP p(get_string("aliases","glossary")) ?> <?php helpbutton("aliases", strip_tags(get_string("aliases", "glossary")), "glossary") ?></strong><small><br>
+            <font size=1><?PHP p(get_string("onebyline","glossary")) ?></font><br>
+            <textarea rows="5" name="aliases" cols="20"><?PHP p($newentry->aliases) ?></textarea>
+        </td>
+        </tr>
+    </table>
+
     </td>
     </tr>
     </table>
@@ -115,7 +129,7 @@ if (isset($errors)) {
        print_textarea($usehtmleditor, 20, 60, 680, 400, "text", $newentry->definition);
     
        echo "<p align=right>";
-        helpbutton("textformat", get_string("helpformatting"));
+       helpbutton("textformat", get_string("helpformatting"));
        print_string("formattexttype");
        echo ":&nbsp;";
        if (!isset($newentry->format)) {
index b56c02eeca9c6d280cef74760059242d04018aad..4e9bdf03e1529cad57d6b013ca7ed21dbd089413 100644 (file)
@@ -139,6 +139,7 @@ if ( $confirm ) {
     }
 
     delete_records("glossary_entries_categories","entryid",$e);
+    delete_records("glossary_alias","entryid",$e);
 
     if ( isset($form->categories) ) {
         $newcategory->entryid = $newentry->id;
@@ -151,6 +152,19 @@ if ( $confirm ) {
             }
         }
     }
+    if ( isset($form->aliases) ) {
+        if ( $aliases = explode("\n",$form->aliases) ) {
+            foreach ($aliases as $alias) {
+                if ($alias) {
+                    unset($newalias);
+                    $newalias->entryid = $e;
+                    $newalias->alias = $alias;
+                    insert_record("glossary_alias",$newalias);
+                }
+            }
+        }
+    }
+
     redirect("view.php?id=$cm->id&eid=$newentry->id&tab=$tab&cat=$cat");
     die;
 } else {
@@ -166,6 +180,13 @@ if ( $confirm ) {
         $newentry->usedynalink = $form->usedynalink;
         $newentry->casesensitive = $form->casesensitive;
         $newentry->fullmatch = $form->fullmatch;
+        $newentry->aliases = "";
+
+        if ( $aliases = get_records("glossary_alias","entryid",$e) ) {
+            foreach ($aliases as $alias) {
+                $newentry->aliases .= $alias->alias . "\n";
+            }
+        }
     }
 }
 /// Otherwise fill and print the form.
index 9234157f99874827c53de44c0d131fc9c4113dd2..0b9394600744ad239c2311b9cf8c86d4608f1665 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2003103100;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2003110400;  // The current module version (Date: YYYYMMDDXX)
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
 $release = "0.5 development";   // User-friendly version number