Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Adding aliases

  • Loading branch information...
commit 1ba2befbf12dafd125495e91f68e2008a054a01c 1 parent de1fe38
willcast authored
View
3  lang/en/glossary.php
@@ -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['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['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";
View
5 lang/en/help/glossary/aliases.html
@@ -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>
View
10 mod/glossary/TODO.txt
@@ -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)
View
9 mod/glossary/db/mysql.php
@@ -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;
}
View
11 mod/glossary/db/mysql.sql
@@ -53,6 +53,17 @@ CREATE TABLE prefix_glossary_entries (
) 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`
#
View
11 mod/glossary/db/postgres7.sql
@@ -62,6 +62,17 @@ CREATE TABLE prefix_glossary_categories (
);
#
+# 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`
#
View
20 mod/glossary/edit.html
@@ -28,7 +28,7 @@
<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 @@
</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 @@
$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 @@
<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 @@
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)) {
View
21 mod/glossary/edit.php
@@ -139,6 +139,7 @@
}
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 ( 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 @@
$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.
View
2  mod/glossary/version.php
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.