Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-33206

Add a link to display the print dialog in the print book tool

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3, 2.4
    • Fix Version/s: 2.5
    • Component/s: Book
    • Testing Instructions:
      Hide

      The following has to be tested on all supported browsers

      • Create a book resource in a course and add at least one chapter
      • In the book administration, click on "Print book".
      • In the top left of the print book page, click on the link "Print book"
        You should see the print dialog box again
      • In the book administration, click on "Print this chapter".
      • In the top left of the print chapter page, click on the link "Print this chapter"
        You should see the print dialog box again
      Show
      The following has to be tested on all supported browsers Create a book resource in a course and add at least one chapter In the book administration, click on "Print book". In the top left of the print book page, click on the link "Print book" You should see the print dialog box again In the book administration, click on "Print this chapter". In the top left of the print chapter page, click on the link "Print this chapter" You should see the print dialog box again
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-33206-master

      Description

      From https://github.com/skodak/moodle-mod_book/issues/22

      Users get confused when printing book/chapter – the window shows content to be printed, but there's no "print" button.

      Yes, Ctrl+P helps, but a lot of users don't know that.

      I suggest adding javascript print dialog opening in the end of HTML output of print page:

      diff --git a/tool/print/index.php b/tool/print/index.php
      index b1949dd..d616eca 100644
      --- a/tool/print/index.php
      +++ b/tool/print/index.php
      @@ -111,6 +111,8 @@ if ($chapter) {
           $chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $chapter->id);
           echo format_text($chaptertext, $chapter->contentformat, array('noclean'=>true, 'context'=>$context));
           echo '</div>';
      +
      +    echo '<script type="text/javascript">window.print();</script>';
           echo '</body> </html>';
       
       } else {
      @@ -172,6 +174,8 @@ if ($chapter) {
               echo '</div>';
               //echo '<a href="#toc">'.$strtop.'</a>';
           }
      +
      +    echo '<script type="text/javascript">window.print();</script>';
           echo '</body> </html>';
       }
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/13