- Adding aliases

This commit is contained in:
willcast 2003-11-05 00:06:31 +00:00
parent de1fe38401
commit 1ba2befbf1
9 changed files with 84 additions and 8 deletions

View 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";

View File

@ -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 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)

View 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;
}

View 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`
#

View 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`
#

View 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)) {

View 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.

View 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