From: willcast Date: Sat, 18 Oct 2003 13:33:46 +0000 (+0000) Subject: - Fixed a problem when showing the icons in entries with inline images. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=891ae55ee463195f2c66ce4a84e8a64ccfabfdf0;p=moodle.git - Fixed a problem when showing the icons in entries with inline images. - Fixed a bug when deleting entries without attachments. --- diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php index ef773ecb7c..08eac80727 100644 --- a/mod/glossary/deleteentry.php +++ b/mod/glossary/deleteentry.php @@ -1,7 +1,7 @@ "; - 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 "

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

$entrydeleted"; //CAMBIAR + echo "
"; + print_simple_box_end(); + } + print_footer($course); + add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id¤tview=$currentview&cat=$cat", $entry); + redirect("view.php?id=$cm->id¤tview=$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 "
$entrydeleted"; //CAMBIAR - echo "
"; - print_simple_box_end(); - } - print_footer($course); - add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id¤tview=$currentview&cat=$cat", $entry); - redirect("view.php?id=$cm->id¤tview=$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 "
$entryfields->concept
$strareyousuredelete"; - - ?> + echo "
$entryfields->concept
$strareyousuredelete"; + + ?>
@@ -93,12 +95,12 @@
diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 70a1fc64e6..a1725a5aba 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -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 ""; - echo "
"; + + echo "

"; + $count = count_records("glossary_comments","entryid",$entry->id); if ($count) { echo "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 ""; + echo " "; } - echo "

"; - echo ""; if ( $glossary->allowcomments ) { echo "id&eid=$entry->id\">\"" "; } 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 "" . get_string("exportedentry","glossary") . ""; } } - echo "
"; } function glossary_search_entries($searchterms, $glossary, $includedefinition) {