Permalink
Browse files

Solve some visualisation issues in encyclopedia format. I think that now

it will be correct!
  • Loading branch information...
1 parent d9399f4 commit 02eb71379e3d862a8db8877eb5fd19f270ad8d6b stronk7 committed Nov 26, 2004
Showing with 16 additions and 7 deletions.
  1. +3 −4 mod/glossary/formats/encyclopedia/encyclopedia_format.php
  2. +13 −3 mod/glossary/lib.php
@@ -36,6 +36,7 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
echo "\n<tr>";
echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\">&nbsp;</td>";
echo "\n<td width=100% colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
+ echo "<table width=\"100%\" border=\"0\"><tr><td>";
if ($entry->attachment) {
$entry->course = $course->id;
@@ -47,11 +48,9 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
glossary_print_entry_attachment($entry,"",$align,false);
}
glossary_print_entry_definition($entry);
+ echo "</td></tr></table>";
+
if ($printicons or $ratings or $aliases) {
- echo "</td></tr>";
- echo "\n<td bgcolor=\"$colour\" width=35 valign=top class=\"forumpostside\">&nbsp;</td>";
- echo "\n<td width=100% colspan=\"2\" bgcolor=\"$THEME->cellcontent\" class=\"forumpostmessage\">";
-
$return = glossary_print_entry_lower_section($course, $cm, $glossary, $entry,$mode,$hook,$printicons,$ratings, $aliases);
echo ' ';
}
View
@@ -687,12 +687,14 @@ function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",
function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') {
global $THEME, $USER, $CFG;
+ $output = false; //To decide if we must really return text in "return". Activate when needed only!
$importedentry = ($entry->sourceglossaryid == $glossary->id);
$isteacher = isteacher($course->id);
$ismainglossary = $glossary->mainglossary;
$return = "<font size=1>";
if (!$entry->approved) {
+ $output = true;
$return .= get_string("entryishidden","glossary");
}
$return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook,'html');
@@ -701,6 +703,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
if ( (!empty($USER->id) && $glossary->allowcomments && !isguest()) || $isteacher) {
+ $output = true;
$return .= " <a title=\"" . get_string("addcomment","glossary") . "\" href=\"comment.php?id=$cm->id&eid=$entry->id\"><img src=\"comment.gif\" height=11 width=11 border=0></a> ";
}
@@ -709,7 +712,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
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
-
+ $output = true;
$return .= " <a title=\"" . get_string("exporttomainglossary","glossary") . "\" href=\"exportentry.php?id=$cm->id&entry=$entry->id&mode=$mode&hook=$hook\"><img src=\"export.gif\" height=11 width=11 border=0></a> ";
}
@@ -726,6 +729,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
// -The user is teacher or he is a student with time permissions (edit period or editalways defined).
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ( !$importedentry and ($isteacher or ($entry->userid == $USER->id and $ineditperiod))) {
+ $output = true;
$return .= " <a title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&mode=delete&entry=$entry->id&prevmode=$mode&hook=$hook\"><img src=\"";
$return .= $icon;
$return .= "\" height=11 width=11 border=0></a> ";
@@ -736,6 +740,12 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$mode="",$ho
}
}
$return .= "&nbsp;&nbsp;"; // just to make up a little the output in Mozilla ;)
+
+ //If we haven't calculated any REAL thing, delete result ($return)
+ if (!$output) {
+ $return = '';
+ }
+ //Print or get
if ($type == 'print') {
echo $return;
} else {
@@ -776,7 +786,7 @@ function glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $m
if ( $printicons ) {
$icons = glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode, $hook,"html");
}
- if ($aliases || $printicons || $ratings) {
+ if ($aliases || $icons || $ratings) {
echo '<table border="0" width="100%" align="center">';
if ( $aliases ) {
echo '<tr><td align="center" valign="top"><font size=1>' .
@@ -1119,7 +1129,7 @@ function glossary_print_attachments($entry, $return=NULL, $align="left") {
} else {
if ($icon == "image.gif") { // Image attachments don't get printed as links
- $imagereturn .= "<img src=\"$CFG->wwwroot/$ffurl\" align=$align>";
+ $imagereturn .= "<img src=\"$CFG->wwwroot/$ffurl\" align=\"$align\">";
} else {
link_to_popup_window("/$ffurl", "attachment", $image, 500, 500, $strattachment);
echo "<a target=_image href=\"$CFG->wwwroot/$ffurl\">$file</a>";

0 comments on commit 02eb713

Please sign in to comment.