OpenTechStrategies / SimpleBook

A fork of the Collection Extension to print books from MediaWiki instances
1 stars 1 forks source link

"Download as PDF" link fails #52

Closed slifty closed 3 years ago

slifty commented 3 years ago

When viewing an item that can be added to a book, the left nav renders a "Download as PDF" link.

Clicking that link results in a failed attempt to print a book.

image

We should make sure that works, or temporarily remove the link until it does.

slifty commented 3 years ago

The issue is that the bookdata sent to the renderer is of a different format / doesn't include a URL when this link is clicked.

Download as PDF payload:

{'type': 'collection', 'licenses': [{'type': 'license', 'name': 'License', 'mw_rights_icon': '', 'mw_rights_page': '', 'mw_rights_url': '', 'mw_rights_text': ''}], 'papersize': 'letter', 'settings': {'papersize': 'letter'}, 'items': [{'type': 'article', 'content_type': 'text/x-wiki', 'title': 'my article', 'revision': '172', 'timestamp': '1622667687'}], 'wikis': [{'type': 'wikiconf', 'baseurl': 'http://localhost/LLIIA2020', 'script_extension': '.php', 'format': 'nuwiki'}]}

vs the normal book payload:

{'type': 'collection', 'licenses': [{'type': 'license', 'name': 'License', 'mw_rights_icon': '', 'mw_rights_page': '', 'mw_rights_url': '', 'mw_rights_text': ''}], 'title': 'test', 'subtitle': 'testing', 'papersize': 'letter', 'settings': {'papersize': 'letter'}, 'items': [{'type': 'article', 'content_type': 'text/x-wiki', 'title': 'My article page', 'revision': '91', 'latest': '91', 'timestamp': '1622667665', 'url': 'http://localhost/LLIIA2020/index.php/my_article_page', 'currentVersion': 1}], 'wikis': [{'type': 'wikiconf', 'baseurl': 'http://localhost/LLIIA2020', 'script_extension': '.php', 'format': 'nuwiki'}]}