- Fixed a problem when showing the icons in entries with inline images.

- Fixed a bug when deleting entries without attachments.
This commit is contained in:
willcast
2003-10-18 13:33:46 +00:00
parent 9c379682aa
commit 891ae55ee4
2 changed files with 43 additions and 45 deletions
+38 -36
View File
@@ -1,7 +1,7 @@
<?PHP // $Id$
require_once("../../config.php");
require_once("lib.php");
require_once("../../config.php");
require_once("lib.php");
require_variable($id); // course module ID
require_variable($mode); // edit or delete
@@ -47,37 +47,39 @@
/// If data submitted, then process and store.
if ($mode == "edit" or $mode == "delete" ) {
echo "<p>";
if ( isteacher($cm->id) or $glossary->studentcanpost ) {
if ($go) { // the operation was confirmed.
if ( $mode == "delete") {
// if it is an imported entry, just delete the relation
$entry = get_record("glossary_entries","id", $entry);
if ( $entry->sourceglossaryid ) {
$entry->glossaryid = $entry->sourceglossaryid;
$entry->sourceglossaryid = 0;
echo "<p>";
if ( isteacher($cm->id) or $glossary->studentcanpost ) {
if ($go) { // the operation was confirmed.
if ( $mode == "delete") {
// if it is an imported entry, just delete the relation
$entry = get_record("glossary_entries","id", $entry);
if ( $entry->sourceglossaryid ) {
$entry->glossaryid = $entry->sourceglossaryid;
$entry->sourceglossaryid = 0;
if (! update_record("glossary_entries", $entry)) {
error("Could not update your glossary");
}
} else {
glossary_delete_old_attachments($entry->id);
delete_records("glossary_entries","id", $entry->id);
}
}
} else {
if ( $entry->attachment ) {
glossary_delete_old_attachments($entry->id);
}
delete_records("glossary_entries","id", $entry->id);
}
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>$entrydeleted"; //CAMBIAR
echo "</center>";
print_simple_box_end();
}
print_footer($course);
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&currentview=$currentview&cat=$cat", $entry);
redirect("view.php?id=$cm->id&currentview=$currentview&cat=$cat");
} else { // the operation has not been confirmed yet so ask the user to do so
if ( $mode == "delete") {
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
?>
echo "<center>$entrydeleted"; //CAMBIAR
echo "</center>";
print_simple_box_end();
}
print_footer($course);
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&currentview=$currentview&cat=$cat", $entry);
redirect("view.php?id=$cm->id&currentview=$currentview&cat=$cat");
} else { // the operation has not been confirmed yet so ask the user to do so
if ( $mode == "delete") {
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><b>$entryfields->concept</b><br>$strareyousuredelete";
?>
<form name="form" method="post" action="deleteentry.php">
<input type="hidden" name=id value="<?php p($cm->id) ?>">
@@ -93,12 +95,12 @@
</form>
</center>
<?php
print_simple_box_end();
}
}
} else {
error("You are not allowed to edit or delete entries");
}
print_simple_box_end();
}
}
} else {
error("You are not allowed to edit or delete entries");
}
}
print_footer($course);
?>
+5 -9
View File
@@ -232,11 +232,11 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview
global $THEME, $USER;
$importedentry = ($entry->sourceglossaryid == $glossary->id);
$isteacher = isteacher($course->id);
$isteacher = isteacher($course->id) or isadmin($course->id);
$ismainglossary = $glossary->mainglossary;
echo "<table width=100% border=0>";
echo "<tr><td>";
echo "<p align=\"right\">";
$count = count_records("glossary_comments","entryid",$entry->id);
if ($count) {
echo "<font size=1><a href=\"comments.php?id=$cm->id&eid=$entry->id\">$count ";
@@ -245,18 +245,15 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview
} else {
print_string("comments", "glossary");
}
echo "</a></font>";
echo "</a></font> ";
}
echo "</td><td align=\"right\">";
echo "<td align=\"right\">";
if ( $glossary->allowcomments ) {
echo "<a href=\"comment.php?id=$cm->id&eid=$entry->id\"><img alt=\"" . get_string("addcomment","glossary") . "\" src=\"comment.gif\" height=16 width=16 border=0></a> ";
}
if ($isteacher or $glossary->studentcanpost and $entry->userid == $USER->id) {
// only teachers can export entries so check it out
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
@@ -283,7 +280,6 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry,$currentview
echo "<font size=-1>" . get_string("exportedentry","glossary") . "</font>";
}
}
echo "</td></tr></table>";
}
function glossary_search_entries($searchterms, $glossary, $includedefinition) {