Merge branch 'MDL-44343-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Marina Glancy 2014-08-04 11:23:10 +08:00
commit 5fcdf22034
10 changed files with 42 additions and 40 deletions

View File

@ -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'));

View File

@ -48,17 +48,6 @@ function glossary_show_entry_TEMPLATE($course, $cm, $glossary, $entry, $mode='',
echo '<td class="entryattachment">';
//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 "<br />\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 "<br />\n";

View File

@ -8,11 +8,11 @@ function glossary_show_entry_continuous($course, $cm, $glossary, $entry, $mode='
echo '<tr valign="top">';
echo '<td class="entry">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry, $cm, 'html', 'right');
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
$entry->alias = '';
echo '</td></tr>';

View File

@ -8,11 +8,11 @@ function glossary_show_entry_dictionary($course, $cm, $glossary, $entry, $mode='
echo '<tr valign="top">';
echo '<td class="entry">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry, $cm, 'html', 'right');
echo '<div class="concept">';
glossary_print_entry_concept($entry);
echo '</div> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
echo '</td></tr>';
echo '<tr valign="top"><td class="entrylowersection">';
glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook, $printicons, $aliases);

View File

@ -38,16 +38,8 @@ function glossary_show_entry_encyclopedia($course, $cm, $glossary, $entry, $mode
echo '<td class="left side" rowspan="2">&nbsp;</td>';
echo '<td colspan="2" class="entry">';
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 '</td></tr>';

View File

@ -20,7 +20,6 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry, $cm, 'html', 'right');
echo '</td>';
echo '</tr>';
@ -30,6 +29,7 @@ function glossary_show_entry_faq($course, $cm, $glossary, $entry, $mode="", $hoo
echo '<b>'.get_string('answer','glossary').':</b> ';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
echo '</td></tr>';
echo '<tr valign="top"><td colspan="3" class="entrylowersection">';

View File

@ -31,7 +31,6 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry, $cm, 'html', 'right');
echo '</td>';
echo '</tr>';
@ -41,6 +40,7 @@ function glossary_show_entry_fullwithauthor($course, $cm, $glossary, $entry, $mo
echo '<td colspan="2" class="entry">';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
echo '</td></tr>';
echo '<tr valign="top">';

View File

@ -20,7 +20,6 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
echo '<td class="entryattachment">';
glossary_print_entry_approval($cm, $entry, $mode);
glossary_print_entry_attachment($entry, $cm, 'html', 'right');
echo '</td>';
echo '</tr>';
@ -29,6 +28,7 @@ function glossary_show_entry_fullwithoutauthor($course, $cm, $glossary, $entry,
echo '<td width="100%" colspan="2" class="entry">';
glossary_print_entry_definition($entry, $glossary, $cm);
glossary_print_entry_attachment($entry, $cm, 'html');
echo '</td></tr>';
echo '<tr valign="top"><td colspan="2" class="entrylowersection">';

View File

@ -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 "<table border=\"0\" width=\"100%\" align=\"$align\"><tr><td align=\"$align\" nowrap=\"nowrap\">\n";
}
echo glossary_print_attachments($entry, $cm, $format, $align);
if ($insidetable) {
echo "</td></tr></table>\n";
}
echo '<div class="attachments">';
echo glossary_print_attachments($entry, $cm, $format, $align);
echo '</div>';
}
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);
}
}

10
mod/glossary/upgrade.txt Normal file
View File

@ -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.