diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 232c3ede509..bc9e144df1d 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3379,9 +3379,6 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa $output .= html_writer::end_tag('div'); //left side $output .= html_writer::start_tag('div', array('class'=>'no-overflow')); $output .= html_writer::start_tag('div', array('class'=>'content')); - if (!empty($attachments)) { - $output .= html_writer::tag('div', $attachments, array('class'=>'attachments')); - } $options = new stdClass; $options->para = false; @@ -3419,6 +3416,10 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa $output .= html_writer::tag('div',' ', array('class'=>'left')); $output .= html_writer::start_tag('div', array('class'=>'options clearfix')); + if (!empty($attachments)) { + $output .= html_writer::tag('div', $attachments, array('class' => 'attachments')); + } + // Output ratings if (!empty($post->rating)) { $output .= html_writer::tag('div', $OUTPUT->render($post->rating), array('class'=>'forum-post-rating')); diff --git a/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php b/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php index 45d089920ad..dff4efad8e2 100644 --- a/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php +++ b/mod/glossary/formats/TEMPLATE/TEMPLATE_format.php @@ -48,17 +48,6 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', echo ''; - //Use this function to show the attachment. It'll be showed if necessary - //Comments: You can configure this parameters: - //----Define how to show the attachment - $attachmentformat = 'html'; //Values: html (link) and NULL (inline image if possible) (default NULL) - //----Define where to show the attachment - $attachmentalign = 'right'; //Values: left, center and right (default right) - //----Define if the attachment must be showed into a 100% width table - $attachmentinsidetable = true; //Values: true, false (default true) - //Call the function - glossary_print_entry_attachment($entry, $cm, $attachmentformat, $attachmentalign, $attachmentinsidetable); - //Line separator to show this template fine. :-) echo "
\n"; @@ -78,6 +67,9 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='', //Comments: Configuration not supported glossary_print_entry_definition($entry, $glossary, $cm); + // Use this function to show the attachment. It'll be shown if necessary. + glossary_print_entry_attachment($entry, $cm, 'html'); + //Line separator to show this template fine. :-) echo "
\n"; diff --git a/mod/glossary/formats/continuous/continuous_format.php b/mod/glossary/formats/continuous/continuous_format.php index 3ae4318e2d2..6f7583556df 100644 --- a/mod/glossary/formats/continuous/continuous_format.php +++ b/mod/glossary/formats/continuous/continuous_format.php @@ -8,11 +8,11 @@ function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode=' echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); - glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo '
'; glossary_print_entry_concept($entry); echo '
'; glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, 'html'); $entry->alias = ''; echo ''; diff --git a/mod/glossary/formats/dictionary/dictionary_format.php b/mod/glossary/formats/dictionary/dictionary_format.php index 362c5ce09fa..3c71ccecae7 100644 --- a/mod/glossary/formats/dictionary/dictionary_format.php +++ b/mod/glossary/formats/dictionary/dictionary_format.php @@ -8,11 +8,11 @@ function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode=' echo ''; echo ''; glossary_print_entry_approval($cm, $entry, $mode); - glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo '
'; glossary_print_entry_concept($entry); echo '
'; glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, 'html'); echo ''; echo ''; glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases); diff --git a/mod/glossary/formats/encyclopedia/encyclopedia_format.php b/mod/glossary/formats/encyclopedia/encyclopedia_format.php index 60b5ba4b7cc..245e60311c5 100644 --- a/mod/glossary/formats/encyclopedia/encyclopedia_format.php +++ b/mod/glossary/formats/encyclopedia/encyclopedia_format.php @@ -38,16 +38,8 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode echo ' '; echo ''; - if ($entry->attachment) { - $entry->course = $course->id; - if (strlen($entry->definition)%2) { - $align = 'right'; - } else { - $align = 'left'; - } - glossary_print_entry_attachment($entry, $cm, null,$align,false); - } glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, null); if ($printicons or $aliases) { echo ''; diff --git a/mod/glossary/formats/faq/faq_format.php b/mod/glossary/formats/faq/faq_format.php index 99ec7597191..8a417a26591 100644 --- a/mod/glossary/formats/faq/faq_format.php +++ b/mod/glossary/formats/faq/faq_format.php @@ -20,7 +20,6 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo echo ''; glossary_print_entry_approval($cm, $entry, $mode); - glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo ''; echo ''; @@ -30,6 +29,7 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo echo ''.get_string('answer','glossary').': '; glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, 'html'); echo ''; echo ''; diff --git a/mod/glossary/formats/fullwithauthor/fullwithauthor_format.php b/mod/glossary/formats/fullwithauthor/fullwithauthor_format.php index 0d34805c43a..7ff31a7344c 100644 --- a/mod/glossary/formats/fullwithauthor/fullwithauthor_format.php +++ b/mod/glossary/formats/fullwithauthor/fullwithauthor_format.php @@ -31,7 +31,6 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo echo ''; glossary_print_entry_approval($cm, $entry, $mode); - glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo ''; echo ''; @@ -41,6 +40,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo echo ''; glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, 'html'); echo ''; echo ''; diff --git a/mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php b/mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php index 92145b711c8..7ef0a022fc1 100644 --- a/mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php +++ b/mod/glossary/formats/fullwithoutauthor/fullwithoutauthor_format.php @@ -20,7 +20,6 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, echo ''; glossary_print_entry_approval($cm, $entry, $mode); - glossary_print_entry_attachment($entry, $cm, 'html', 'right'); echo ''; echo ''; @@ -29,6 +28,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry, echo ''; glossary_print_entry_definition($entry, $glossary, $cm); + glossary_print_entry_attachment($entry, $cm, 'html'); echo ''; echo ''; diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 8522bb61331..f92af441341 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -1352,20 +1352,27 @@ function glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $m } /** - * @todo Document this function + * Print the list of attachments for this glossary entry + * + * @param object $entry + * @param object $cm The coursemodule + * @param string $format The format for this view (html, or text) + * @param string $unused1 This parameter is no longer used + * @param string $unused2 This parameter is no longer used */ -function glossary_print_entry_attachment($entry, $cm, $format=NULL, $align="right", $insidetable=true) { -/// valid format values: html : Return the HTML link for the attachment as an icon -/// text : Return the HTML link for tha attachment as text -/// blank : Print the output to the screen +function glossary_print_entry_attachment($entry, $cm, $format = null, $unused1 = null, $unused2 = null) { + // Valid format values: html: The HTML link for the attachment is an icon; and + // text: The HTML link for the attachment is text. if ($entry->attachment) { - if ($insidetable) { - echo "
\n"; - } - echo glossary_print_attachments($entry, $cm, $format, $align); - if ($insidetable) { - echo "
\n"; - } + echo '
'; + echo glossary_print_attachments($entry, $cm, $format, $align); + echo '
'; + } + if ($unused1) { + debugging('The align parameter is deprecated, please use appropriate CSS instead', DEBUG_DEVELOPER); + } + if ($unused2 !== null) { + debugging('The insidetable parameter is deprecated, please use appropriate CSS instead', DEBUG_DEVELOPER); } } diff --git a/mod/glossary/upgrade.txt b/mod/glossary/upgrade.txt new file mode 100644 index 00000000000..9f066ec6f8c --- /dev/null +++ b/mod/glossary/upgrade.txt @@ -0,0 +1,10 @@ +This files describes API changes in /mod/glossary/*, +information provided here is intended especially for developers. + +=== 2.8 === +* The glossary_print_entry_attachment function no longer takes an `align` + or `insidetable` property. Instead the attachments are printed within a + div whose class is `attachments` and which can be targetted using + appropriate CSS rules. +* The glossary_print_entry_attachment function now displays the attachments + on the left by default.