Permalink
Browse files

- Cosmetic changes... Changing the Add Entry button for a new tab

- Creating two new tabs for the future export/import features.
- Improving a little the Printer-Friendly version (now it shows what you were watching in the previous frame)
  • Loading branch information...
1 parent fe98ea9 commit ea14e7837359cc52f562c5bf15c72a59e5b19ed1 willcast committed Nov 3, 2003
View
@@ -15,7 +15,7 @@
$string['ascending'] = "(ascending)";
$string['attachment'] = "Attachment";
$string['back'] = "Back";
-$string['casesensitive'] = "This entry is<br>case sensitive";
+$string['casesensitive'] = "This entry is case sensitive";
$string['categories'] = "Categories";
$string['categoryview'] = "Browse by category";
$string['category'] = "Category";
@@ -51,6 +51,7 @@
$string['displayformat4'] = "FAQ";
$string['displayformat5'] = "Full without author";
$string['editcategories'] = "Edit categories";
+$string['editalias'] = "Edit alias";
$string['editentry'] = "Edit entry";
$string['editingcomment'] = "Editing comment";
$string['entries'] = "Entries";
@@ -60,11 +61,12 @@
$string['entryapproved'] = "This entry has been approved";
$string['entrydeleted'] = "Entry deleted";
$string['entryishidden'] = "(this entry is currently hidden)";
-$string['entryusedynalink'] = "This entry should be<br>automatically linked";
+$string['entryusedynalink'] = "This entry should be automatically linked";
$string['entryexported'] = "Entry succesfully exported";
$string['explainspecial'] = "Shows entries that do not begin with a letter";
$string['explainalphabet'] = "Browse the glossary using this index";
$string['explainall'] = "Shows ALL entries on one page";
+$string['explainaddentry'] = "Add a new entry to the current glossary.<br>Concept and definition are mandatory fields.";
$string['exportedentry'] = "Exported entry";
$string['exportglossary'] = "Export glossary";
$string['exporttomainglossary'] = "Export to main glossary";
@@ -67,7 +67,14 @@ function glossary_dynamic_link($courseid, $text) {
"onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid\&concept=$concept->concept', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
}
- $currentconcept = trim(strip_tags($concept->concept));
+ $currentconcept = trim(strip_tags(str_replace("|", "\|", $concept->concept)));
+ if ( !$concept->category ) {
+ if ( $aliases = get_records("glossary_alias","entryid",$concept->id) ) {
+ foreach ($aliases as $alias) {
+ $currentconcept .= "|" . trim(strip_tags(str_replace("|", "\|", $alias->alias)));
+ }
+ }
+ }
$text = glossary_link_concepts($text,$currentconcept,$href_tag_begin, "</a>",$concept->casesensitive,$concept->fullmatch);
}
}
View
@@ -22,7 +22,10 @@
</tr>
<tr valign=top>
<td align=right><p><b><?php echo get_string("categories","glossary") ?>:</b></p></td>
- <td>
+ <td>
+ <table border=0>
+ <tr>
+ <td>
<?php
$categories = get_records("glossary_categories","glossaryid",$glossary->id);
echo "<select size=\"6\" name=\"categories[]\" multiple=\"yes\">";
@@ -41,11 +44,10 @@
}
?>
</select>
- </td>
-</tr>
-<tr valign=top>
- <td align=right><p><b><?php echo get_string("entryusedynalink","glossary") ?>:</b></p></td>
<td>
+ <td width=100%>
+ <table border=0 width=100%>
+ <tr><td align=right width=80%><small><?php echo get_string("entryusedynalink","glossary") ?>:</small></td><td width=20%>
<script>
var items = ['casesensitive','fullmatch'];
</script>
@@ -59,61 +61,38 @@
$selected = "checked";
}
?>
- <input type="checkbox" name="usedynalink" value=1 <?php p($selected) ?> onclick="return lockoptions('form','usedynalink', items)"> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
- </td>
-</tr>
-<tr valign=top>
- <td align=right><p><b><?php echo get_string("casesensitive","glossary") ?>:</b></p></td>
- <td>
- <select size="1" name="casesensitive">
- <option value=1 <?php
- if ( isset($newentry->casesensitive) ) {
- if ( $newentry->casesensitive ) {
- echo "selected";
- }
- } elseif ( $CFG->cnfcasesensitive ) {
- echo "selected";
- }
- ?>
- ><?php echo get_string("yes") ?></option>
- <option value=0 <?php
- if ( isset($newentry->casesensitive) ) {
- if ( !$newentry->casesensitive ) {
- echo "selected";
- }
- } elseif ( !$CFG->cnfcasesensitive ) {
- echo "selected";
- }
- ?>><?php echo get_string("no") ?>
- </option>
- </select> <?php helpbutton("casesensitive", get_string("casesensitive", "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
+ $selected = "";
+ if ( isset($newentry->casesensitive) ) {
+ if ($newentry->casesensitive) {
+ $selected = "checked";
+ }
+ } elseif ( $CFG->cnfcasesensitive ) {
+ $selected = "checked";
+ }
+?>
+ <input type="checkbox" name="casesensitive" value=1 <?php p($selected) ?>> <?php helpbutton("casesensitive", strip_tags(get_string("casesensitive", "glossary")), "glossary") ?>
+ </td></tr>
+ <tr><td align=right width=80%><small><?php echo get_string("fullmatch","glossary") ?>:</small></td><td width=20%>
+<?php
+ $selected = "";
+ if ( isset($newentry->fullmatch) ) {
+ if ($newentry->fullmatch) {
+ $selected = "checked";
+ }
+ } elseif ( $CFG->cnffullmatch ) {
+ $selected = "checked";
+ }
+?>
+ <input type="checkbox" name="fullmatch" value=1 <?php p($selected) ?>> <?php helpbutton("fullmatch", strip_tags(get_string("fullmatch", "glossary")), "glossary") ?>
+ </td></tr>
+ </table>
</td>
-</tr>
-<tr valign=top>
- <td align=right><p><b><?php echo get_string("fullmatch","glossary") ?>:</b></p></td>
- <td>
- <select size="1" name="fullmatch">
- <option value=1 <?php
- if ( isset($newentry->fullmatch) ) {
- if ( $newentry->fullmatch ) {
- echo "selected";
- }
- } elseif ( $CFG->cnffullmatch ) {
- echo "selected";
- }
- ?>
- ><?php echo get_string("yes") ?></option>
- <option value=0 <?php
- if ( isset($newentry->fullmatch) ) {
- if ( !$newentry->fullmatch ) {
- echo "selected";
- }
- } elseif ( !$CFG->cnffullmatch ) {
- echo "selected";
- }
- ?>><?php echo get_string("no") ?>
- </option>
- </select> <?php helpbutton("fullmatch", get_string("fullmatch", "glossary"), "glossary") ?>
+ </tr>
+ </table>
</td>
</tr>
<tr valign=top>
@@ -160,9 +139,9 @@
</tr>
<tr>
<td colspan=2>
- <p align=center>
- <?php if (isset($newentry->id)) {
- echo "<input type=\"hidden\" name=e value=\"$newentry->id\">";
+ <p align=center>
+ <?php if (isset($newentry->id)) {
+ echo "<input type=\"hidden\" name=e value=\"$newentry->id\">";
}
?>
View
@@ -188,11 +188,26 @@
<A HREF=\"view.php?id=$cm->id\">$glossary->name</A> -> $stredit", "form.text",
"", true, "", navmenu($course, $cm));
-print_heading($glossary->name);
+ echo '<p align="center"><font size="3"><b>' . stripslashes_safe($glossary->name);
+ echo '</b></font></p>';
+/// Info box
+
+ if ( $glossary->intro ) {
+ print_simple_box_start('center','70%');
+ echo format_text($glossary->intro);
+ print_simple_box_end();
+ }
+
+/// Tabbed browsing sections
+$tab = GLOSSARY_ADDENTRY_VIEW;
+include("tabs.html");
include("edit.html");
+echo '</center>';
+glossary_print_tabbed_table_end();
+
print_footer($course);
?>
View
@@ -5,7 +5,7 @@
require_variable($id); // Course Module ID
- optional_variable($tab,GLOSSARY_APPROVAL_VIEW);
+ optional_variable($tab,GLOSSARY_STANDARD_VIEW);
optional_variable($l,"ALL");
if (! $cm = get_record("course_modules", "id", $id)) {
View
@@ -11,7 +11,10 @@
define("GLOSSARY_STANDARD_VIEW", 0);
define("GLOSSARY_CATEGORY_VIEW", 1);
define("GLOSSARY_DATE_VIEW", 2);
-define("GLOSSARY_APPROVAL_VIEW", 3);
+define("GLOSSARY_ADDENTRY_VIEW", 3);
+define("GLOSSARY_IMPORT_VIEW", 4);
+define("GLOSSARY_EXPORT_VIEW", 5);
+define("GLOSSARY_APPROVAL_VIEW", 6);
define("GLOSSARY_FORMAT_SIMPLE", 0);
define("GLOSSARY_FORMAT_CONTINUOUS", 1);
@@ -93,6 +96,7 @@ function glossary_delete_instance($id) {
$ents = substr($ents,0,-1);
if ($ents) {
delete_records_select("glossary_comments", "entryid in ($ents)");
+ delete_records_select("glossary_alias", "entryid in ($ents)");
}
}
delete_records("glossary_entries", "glossaryid", "$glossary->id");
@@ -214,36 +218,45 @@ function glossary_log_info($log) {
AND u.id = '$log->userid'");
}
-function glossary_get_entries($glossaryid, $entrylist) {
+function glossary_get_entries($glossaryid, $entrylist, $pivot = "") {
global $CFG;
+ if ($pivot) {
+ $pivot .= ",";
+ }
- return get_records_sql("SELECT id,userid,concept,definition,format
+ return get_records_sql("SELECT $pivot id,userid,concept,definition,format
FROM {$CFG->prefix}glossary_entries
WHERE glossaryid = '$glossaryid'
AND id IN ($entrylist)");
}
-function glossary_get_entries_sorted($glossary, $where="", $orderby="") {
+function glossary_get_entries_sorted($glossary, $where="", $orderby="", $pivot = "") {
global $CFG;
if ($where) {
$where = " and $where";
}
if ($orderby) {
$orderby = " ORDER BY $orderby";
}
- return get_records_sql("SELECT *
+ if ($pivot) {
+ $pivot .= ",";
+ }
+ return get_records_sql("SELECT $pivot *
FROM {$CFG->prefix}glossary_entries
WHERE (glossaryid = $glossary->id or sourceglossaryid = $glossary->id) $where $orderby");
}
-function glossary_get_entries_by_category($glossary, $cat, $where="", $orderby="") {
+function glossary_get_entries_by_category($glossary, $cat, $where="", $orderby="", $pivot = "") {
global $CFG;
if ($where) {
$where = " and $where";
}
if ($orderby) {
$orderby = " ORDER BY $orderby";
}
- return get_records_sql("SELECT ge.*
+ if ($pivot) {
+ $pivot .= ",";
+ }
+ return get_records_sql("SELECT $pivot ge.*
FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories c
WHERE (ge.id = c.entryid and c.categoryid = $cat) and
(ge.glossaryid = $glossary->id or ge.sourceglossaryid = $glossary->id) $where $orderby");
@@ -284,9 +297,20 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $tab="",$cat="")
}
}
}
-function glossary_print_entry_concept($entry) {
- echo $entry->concept;
-}
+function glossary_print_entry_concept($entry, $alias = true) {
+static $glossary; // to avoid unnecessary calls when dealing with the same glossary
+static $cm;
+ echo $entry->concept;
+/*
+ if ($alias) {
+ if ($glossary->id != $entry->glossaryid) {
+ $glossary = get_record("glossary","id",$entry->glossaryid);
+ $cm = get_coursemodule_from_instance("glossary", $glossary->id, $glossary->course);
+ }
+ echo " <a title=\"" . get_string("editalias","glossary") . "\" href=\"alias.php?id=$cm->id&eid=$entry->id\"><img border=0 src=alias.gif></a>";
+ }
+*/
+ }
function glossary_print_entry_definition($entry) {
$definition = str_ireplace($entry->concept,"<nolink>$entry->concept</nolink>",$entry->definition);
@@ -397,6 +421,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$tab="",$cat
echo " <font size=-1>" . get_string("exportedentry","glossary") . "</font>";
}
}
+ echo "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)
}
function glossary_search_entries($searchterms, $glossary, $includedefinition) {
@@ -808,6 +833,10 @@ function glossary_print_approval_menu($cm, $glossary, $l, $sortkey, $sortorder =
glossary_print_sorting_links($cm, $sortkey,$sortorder, $tab);
}
+function glossary_print_addentry_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
+ echo '<center>' . get_string("explainaddentry","glossary") . '<p>';
+}
+
function glossary_print_alphabet_menu($cm, $glossary, $l, $sortkey, $sortorder = "", $tab=GLOSSARY_STANDARD_VIEW) {
if ( $tab != GLOSSARY_DATE_VIEW ) {
if ($glossary->showalphabet and $glossary->displayformat != GLOSSARY_FORMAT_CONTINUOUS) {
Oops, something went wrong.

0 comments on commit ea14e78

Please sign in to comment.