Skip to content

SAK-51198 Lessons restore the print all feature #13501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4607,6 +4607,11 @@
# DEFAULT: false
# lessonbuilder.personalize.text=true

# Allows the user to print all the lesson pages using a button next to the "Print" option
# Turning on this property can cause performance issues. Enable it at your own risk
# DEFAULT: false
# lessonbuilder.printAll=true

## END LESSONBUILDER

# If you don't want to use ui.service as the Production name, use:
Expand Down
1 change: 1 addition & 0 deletions lessonbuilder/api/src/resources/lessons.properties
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ simplepage.edit_youtube=Edit YouTube Link Below
simplepage.edit_movie=Edit Item Below
simplepage.open_new_window=Open in new window
simplepage.print_view=Print
simplepage.print_all=Print All
simplepage.edititems=Edit Items
simplepage.itemstatus=Item Status
simplepage.items=Items
Expand Down
3 changes: 2 additions & 1 deletion lessonbuilder/api/src/resources/lessons_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ simplepage.edit_youtubelink=Editar en el enlace de Youtube
simplepage.edit_youtube=Editar el siguiente enlace de Youtube
simplepage.edit_movie=Editar el siguiente \u00edtem
simplepage.open_new_window=Abrir en una ventana nueva
simplepage.print_view=Vista de impresi\u00f3n
simplepage.print_view=Imprimir
simplepage.print_all=Imprimir todo
simplepage.edititems=Editar \u00edtems
simplepage.itemstatus=Estado del \u00edtem
simplepage.items=\u00cdtems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public void setImageToMimeMap(Map<String,String> map) {
public boolean allowCcExport = ServerConfigurationService.getBoolean("lessonbuilder.cc-export", true);
public boolean allowDeleteOrphans = ServerConfigurationService.getBoolean("lessonbuilder.delete-orphans", false);

public boolean isLessonPrintAllEnabled = ServerConfigurationService.getBoolean("lessonbuilder.printAll", false);

// I don't much like the static, because it opens us to a possible race
// condition, but I don't see much option
// see the setter. It has to be static because it's used in makeLink, which
Expand Down Expand Up @@ -690,6 +692,13 @@ public void fillComponents(UIContainer tofill, ViewParameters viewParams, Compon
showAll.setSource("summary");
UIInternalLink.make(tofill, "print-view", showAll)
.decorate(new UITooltipDecorator(messageLocator.getMessage("simplepage.print_view")));

if (isLessonPrintAllEnabled) {
UIOutput.make(tofill, "show-print-all");
}

UIInternalLink.make(tofill, "print-all", showAll)
.decorate(new UITooltipDecorator(messageLocator.getMessage("simplepage.print_all")));
UIInternalLink.make(tofill, "show-pages", showAll)
.decorate(new UITooltipDecorator(messageLocator.getMessage("simplepage.showallpages")));

Expand Down
9 changes: 9 additions & 0 deletions lessonbuilder/tool/src/webapp/js/show-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ $(window).load(function () {
window.print();
});

// Print all pages
document.getElementById('print-all').addEventListener('click', function() {
const url = printViewWithParameter(window.location.href);
const win = window.open(url, '_blank');
win.focus();
win.print();
return false;
});

});

function fixAddBefore(href) {
Expand Down
6 changes: 6 additions & 0 deletions lessonbuilder/tool/src/webapp/templates/ShowPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ <h2 id="toolbar-label" rsf:id="msg=simplepage.toolbar" class="lb-offscreen"></h2
<span class="bi-printer" aria-hidden="true"></span>
</a>
</span>
<span class="contentButton" rsf:id="show-print-all">
<a role="button" href="#" rsf:id="print-all" id="print-all" class="btn btn-link my-1 Mrphs-toolTitleNav__link top-icon">
<span rsf:id="msg=simplepage.print_all" class="Mrphs-itemTitle me-1 d-none d-xl-inline-block"></span>
<span class="bi-printer-fill" aria-hidden="true"></span>
</a>
</span>
<span class="contentButton">
<a role="button" href="#" rsf:id="show-pages" id="show-pages" class="btn btn-link my-1 Mrphs-toolTitleNav__link top-icon">
<span rsf:id="msg=simplepage.showallpages" class="Mrphs-itemTitle me-1 d-none d-lg-inline-block"></span>
Expand Down
Loading