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

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

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5
    • 2.3, 2.4
    • Book
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MOODLE_25_STABLE
    • MDL-33206-master
    • 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

      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>';
       }
      

            gaudreaj Jean-Philippe Gaudreau
            stronk7 Eloy Lafuente (stronk7)
            Frédéric Massart Frédéric Massart
            Dan Poltawski Dan Poltawski
            Rajesh Taneja Rajesh Taneja
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.