Extension talk:Collection/LQT Archive 1

This is the talk page for the MediaWiki page about the Collection extension. It is not a support forum for problems with the extension itself or with the accompanying Python libraries mwlib and mwlib.rl. Please note that this is not rude behavior, this decision is just based on the fact that the discussion of software problems or architectural discussions is far too complex to take place on a single talk page.

There is a Google Group for support and discussion of mwlib, mwlib.rl and the Collection extension. There is also an issue tracker on code.pediapress.com.

Please use those for questions regarding the software and - do not use this talk page. However, if you have comments regarding the contents of the MediaWiki page associated with this talk page, you are welcome to drop your comments. He!ko 10:28, 3 July 2008 (UTC), Jbeigel 21:05, 14 July 2008 (UTC)

Add Copyright Info to PDF Books
I really want to add my copyright info to the PDFs, but I can't find any way to do it.

Do I need to do something with LocalSettings.php, or to create some kind of template?
 * You should be able to add a custom footer by editing the line with pagefooter = u ''  in mwlib.rl/mwlib/rl/pdfstyles.py. Jlerner 18:58, 11 May 2010 (UTC)

Add a link to the "print/export" box at the Sidebar
When I install the Collection extension to my MW 1.15.1, it creates the "print/export" box to the Sidebar automatically, which is very good.

Now, I'd like to add the link of Category:Books (bookshelf) to the "print/export" box, but I can't figure out how to do it.
 * This can be done in PHP or JavaScript - see discussion at Manual:Interface/Sidebar. Jlerner 19:14, 11 May 2010 (UTC)

How to Remove the References Section from Every Downloaded PDF
I can't figure out how to remove the section “References” that is automatically appended to every downloaded PDF? I don’t need contributors’ names to appear on the PDFs.


 * Yeah, I'm interested in the same.--66.9.224.147 13:38, 26 February 2010 (UTC)


 * You can try commenting it out from mwlib.rl/mwlib/rl/rlwriter.py Jlerner 19:19, 11 May 2010 (UTC)


 * Isn't it better to set show_article_attribution = False in mwlib.rl/mwlib/rl/pdfstyles.py ?
 * Yes, good point. Jlerner 14:50, 14 May 2010 (UTC)

Does this have to be on my server for it to work? Or will it work when using the default server everyone else can use? --Bluesoju 01:23, 26 November 2010 (UTC)

How to Enable Adding Pages to Book without Visiting Them
I can see this feature enabled at http://en.wikipedia.org/w/index.php?title=Special:Book&bookcmd=book_creator&referer=Main+Page

If you simply hover on a linked article, a small box will pop up with the message "Add linked wiki page to your book". Click on this link, and the linked article will be added to your book.

I like this feature very much, but I couldn't find a way to enable (or configure) it.


 * With help from Johannes, I have figured out the 2-step solution as below:
 * 1) Modify the Gadget-popups.js file coming from Collection extension under extensions/Collection/js/, replace
 * return 'wiki';     // line 6026
 * with
 * return 'kiwi';     // where 'kiwi' is in my URL http://my.host.com/kiwi/.


 * 2) Add $wgCollectionNavPopups = true; to LocalSettings.php.
 * The README says the default is true, but it seems not true.


 * It works great, and is system wide. I like this feature.

Block Access to non Authenticated users
I am wondering if the feature could be added to block access to non authenticated users? The $wgCollectionPortletForLoggedInUsersOnly does not block access to the Collection SpecialPage.

Mediawiki Version is not anymore supported
I think you missed to change the supported Mediawiki Version as 1.13 and lower are not supported anymore. The SkinMonoBook::link function is (as far as i know) just implemented in 1.14+

That's true ... damn it
Relying on the supported version of MW 1.11 I tried to install this extension. To get it working e.g. with my Mediawiki 1.12, I had to insert missing functions into the includes/Linker.php and includes/Title.php file.

The folloing functions are missing:
 * includes/Linker.php
 * function link;
 * function makeSelfLinkObj;
 * function normaliseSpecialPage;
 * private function linkUrl;
 * private function linkAttribs;
 * private function linkText;
 * public function titleAttrib;
 * public function accesskey;
 * includes/Title.php
 * public function getLinkUrl;

And still then, the links in the left toolbox are broken and all pages in with title=Spezial:Book are broken too. Very sad.

Are there older versions of this extension, that can be used with the current Ubuntu intrepid ibex MW of 1.12?

Bug in collection.body.php line 516
Sorry that I post this issue here (did't found a better place). But there is an anoying bug in Collection.body.php. In Line 516 you write

But this ist wrong, it should be


 * Thanks a lot! I've fixed the typo here. Jbeigel 09:56, 14 April 2009 (UTC)

Lowest supported version of MediaWiki?
Can someone add that please? I think it is a very nice to know... Siebrand 21:35, 4 November 2008 (UTC)
 * added Jbeigel 11:21, 10 November 2008 (UTC)

writers
could somebody please give a list of possible configuration for writers, now the only possibility to get it is to install mwlib, by now I just wanted to test it with the given server, but I don't know how to add the writers that are possible --DaSch 00:06, 9 November 2008 (UTC)
 * As you said, this depends on heavily on the used render server. I've made two changesets to the README of the extension with more explanations about the public render server and custom servers. Jbeigel 11:30, 10 November 2008 (UTC)

CurrentUsers Extension output doesn't render as pdf
This extension is great but it doesn't render sortable tables when converting to pdf Here is my site: http://whitehat.servehttp.com/mediawiki/index.php/Main_Page Well, at least it works way better than the PDF export extension does. I couldn't get that one to install. --Deo Favente 17:18, 17 January 2009 (UTC)
 * The problem is actually not related to sortable tables. There is some problem with the template . I added a ticket for that at http://code.pediapress.com/wiki/ticket/393 -- Volker.haas 10:56, 19 January 2009 (UTC)
 * My colleague looked into the issue - I guess we can't fix that. Sorry Volker.haas 11:25, 19 January 2009 (UTC)
 * What is the reason for this limitation? Also other extensions like and can't be rendered. On the other hand svg-graphics can (at least it worked on de.wikipedia.org). Ok, I know these are no extensions. matz 16:34, 25 February 2009 (UTC)
 * There is a thread about handling the graphviz extension on our mailinglist. There is still no solution, but maybe you'd like to participate: Graphviz Extension Discussion -- Volker.haas 10:32, 27 February 2009 (UTC)

$wgPDFServer Variable
The instructions say "Simply install and configure the Collection extension using the default value http://tools.pediapress.com/cgi-bin/pdf-server.py for $wgPDFServer (see README.txt of the Collection Extension for instructions)". However, I did not find any $wgPDFServer variable in any of the extension files and the README.txt is also silent about this variable. I checked both versions 1.12 and 1.14. Am I missing something? Thanks. -- ok 00:24, 25 March 2009 (UTC)
 * Thanks for the heads-up: The documentation on this page was outdated, I've corrected it. Jbeigel 09:52, 25 March 2009 (UTC)

Don't see "Create a Book" portlet menu after extension is installed
I installed this extension in on my mediawiki. I am able to see the "PDF Version" option in my toolbox, and it works. But I can't see the "Create a Book" menu in the sidebar. Is there something additional I need to do to get this to show up? I couldn't find an explanation for it anywhere.

Thanks!

Whoops...never mind. I misread the version number for the skin modification. It must be made for all versions < 1.14. That's likely my issue.

Better explanation of "Collection" and "PDFWriter" proposal
--82.112.219.246 11:45, 10 April 2009 (UTC) if someone needs, as follows:

Tools overview
Extension:Collection is an extension allowing mediawiki users to manage custom collections of (mediawiki) wiki pages as "books".

Once you create a "Book", you can:
 * obviously edit, delete, save and share it with other wiki users
 * obtain the book printed on paper (through an online service)
 * convert it other formats, including xml, xhtml, odf and pdf


 * To create and manage Books, and print them through an online service you will need
 * to add the Collection extension into your MediaWiki install
 * to configure it through your LocalSettings.php file


 * To be able to convert Books to other formats you will need to
 * configure the Collection extension to reach a mwlib server
 * available formats, and performance issues are related to the mwlib server configured
 * if the server is remote to your MediaWiki install, performance will depend on your internet connection, too.
 * if you have little conversion needs, or if you just want to test, the Collection extension comes with a default server hosted by the extension author, see: PediaPress ToolServer.
 * if you need a faster or better solution, you can configure the Collection extension to use another mwlib server
 * you can setup your own mwlib server

Your own server
If you want to have your own mwlib server you will need:
 * a server machine
 * where the mwlib can be installed: there are many requirements and dependencies
 * where mwlib should be always running and available
 * the preferred server is a linux machine. A windows server is possible but there are issues (see mwlib-install)

The server is named mwlib This tool is a Python library for parsing MediaWiki articles. It is currently aimed at developers, who have a need to somehow handle MediaWiki articles. It parses one or more MediaWiki articles (wiki pages), and then allows you to convert them to other standard formats like:
 * mwxml, XML representation of the parse tree
 * xhtml, XHTML 1.0 Transitional
 * odf, OpenDocument Text
 * docbook

It possible to convert to PDF format, too, but it will need another tool: mwlib.rl This tool is a python library for writing pdf documents from mediawiki articles which were parsed by the mwlib library. It uses the Python Reportlab libraries to generate PDF based on a DOM derived from parsing mediawiki-markup using the mwlib parser.

The server can be run in two different ways:
 * launching mw-serve: this acts as a standalone server (reachable from the internet) and can use http protocol itself
 * you will not need a web server
 * you can set, protocol, port, interface. Default port is 8899.
 * through a cgi-bin, mw-serve.cgi

see also Examples

References PediaPress Open Source Repository, Wiki and Bug Tracking System mwlib  page mwlibrl page

Image Quality in PDF
Is there a possibility to set the imagequality for the pdf. I have some nice PDFs with really bad images.

Stable release?
Hello - when will this release become stable? --Robinson Weijman 10:20, 15 June 2009 (UTC)


 * I don't really know if we want to have something like a "stable release". While the extension is already deployed on several wikis including several language editions of Wikipedia (e.g. de.wikipedia.org, fr.wikipedia.org, ...), feedback from the community permanently flows back in the development process. We try not to break things in commits and we also try to be as backwards compatible with older MediaWikis as possible (although that's not always achievable, for example when saving collection pages by using the editing API etc.) Jbeigel 13:41, 15 June 2009 (UTC)


 * Thanks for the prompt reply but I am confused by it. Does this mean that the release will remain permanently Beta?  Beta implies (to me) that the testing is not yet finished - am I to understand that you interpret it to mean "stable until we release another version"?  If so that's good enough for me!  =:-)  --Robinson Weijman 13:27, 17 June 2009 (UTC)


 * This is open-source software: the testing is never finished. (ESR has a few good lines about what 1.0 really means.) Remember, Gmail is still in beta too. :) —Emufarmers(T 02:18, 19 June 2009 (UTC)


 * =:-) True (about Gmail) but that's not Open Source.  And other MediaWiki Extensions are stable.  Furthermore, I thought this extension was from a company promoting book publishing?  --Robinson Weijman 09:13, 19 June 2009 (UTC)


 * Extension:Lucene-search is on version 2.1 and it's still marked as beta. Ultimately, it's the developer's choice; I'll leave it at that. —Emufarmers(T 09:00, 20 June 2009 (UTC)

Installation Documentation
Any chance of an idiot's guide installation manual? I've got the read me and I read "PHP with cURL support" (how do I know if I have that?) and "Install and Setup a Render Server" (a what, how?). The configuring of LocalSettings looks more straightforward, however. --Robinson Weijman 11:28, 19 June 2009 (UTC)


 * cURL will be mentioned in the output from phpinfo if you have support for it. If not, tell me what operating system your server runs and I'll point you toward an appropriate guide.  You don't need to set up a render server if your wiki doesn't get a lot of traffic. —Emufarmers(T 09:00, 20 June 2009 (UTC)


 * Thanks for the info. So I don't need a render server even if our wiki contains confidential info?  (I don't want to send data to PediaPress.)  --Robinson Weijman 09:44, 22 June 2009 (UTC)


 * You'll need to set up the render server, then. —Emufarmers(T 02:00, 23 June 2009 (UTC)

The README.txt needs some updating. As of 1.15 (Maybe 1.14), it no longer appears to require the addition to the MonoBook.php file the portlet code snippet. I was wondering for about 3 days as to why I kept getting two blocks for "create a book". Paranormal Skeptic 15:14, 15 July 2009 (UTC)

Usage Restrictions?
Since this software is copyrighted by one company, are there any restrictions on its use e.g. by other companies? --Robinson Weijman 11:30, 19 June 2009 (UTC)
 * The software is licensed under the GPL. Other companies are free to reuse, modify, and redistribute the software in accordance with the terms of the license. —Emufarmers(T 09:00, 20 June 2009 (UTC)
 * OK, thanks! --Robinson Weijman 09:44, 22 June 2009 (UTC)

Substituting templates don't work
Was this feature removed, or is this a bug? See b:de:Benutzer:Prog/ Spielwiese and b:en:User:Prog/ Test site for samples. If this is a Bug, than report it please. --Prog 21:13, 25 June 2009 (UTC)
 * Same problem!--77.78.80.212 14:29, 28 June 2009 (UTC)
 * Book_tool, Format is now */Print --Prog 01:48, 29 June 2009 (UTC)

Layout not good for Wikisource

 * I too find it disturbing that this extension has been installed at Wikisource without any concertation.
 * It creates a toolblx entitled "create a book", which is extremely confusing for wikisource users.
 * ThomasV 12:17, 17 July 2009 (UTC)

No rendering
Rendering of a small collection of 4 pages used to work quite well using the public render server. The last few times I tried it the progress indicator keeps showing 0% and nothing seems to happen. Right now it has been more than an hour since I hit the Download button.

Access not granted
I've had this problem when running my password secured wiki. It was behind a htaccess-Password-Dialog. If that's your case too, be sure to grant access to the pediapress server. satisfy any Allow From 85.214.135.240 require valid-user

Extension:GoogleMaps
Maps created by the Google Maps Extension are not rendered in PDF. Any way to make it work? -- Matthias

Is there a stable release TAG for this plugin?
For versioning/stability reasons we'd prefer to download a stable TAG even if it doesnt have all the latest bugfixes. Is there a TAG for e.g. v1.4 of this plugin or is it only download from trunk\ that's available?

-- AlanC

unsupported extensions
Because this extension uses its own parser, not all extensions that generate output on the page will be rendered in pdf by this extension, because this parser does support them (yet). The list of known compatible/incompatible extensions tags shows support for tags used in the Wikipedia site. However, some popular third-party extensions, such as Dynamic Page List, currently will generate output on a wiki page that will not appear in a pdf document created by the Collection extension. You need to be aware of these potential conflicts when considering using this extension. --AJim 21:09, 14 November 2009 (UTC)

Headers & Footers
Is it possible to customise the headers and footers in the generated PDF to include, e.g. company text and logo? --Robinson Weijman 14:07, 20 November 2009 (UTC)

Disable PediaPress
How can the PediaPress functionality (printing to books) be disabled? On the extension page, it says, "This service is seamlessly integrated in this extension (can be disabled)." --Robinson Weijman 14:21, 20 November 2009 (UTC)

Load Collection Link Not Showing Up
I've installed the extension, and for the most part, it works great. I am able to save collecitons, but when I go to the collection page, I don't see a "Load collection" link in the sidebar. Any suggestions as to what might cause this?

--DanRinkes 13:59, 14 May 2010 (UTC)

Special page / Render server error message
After installing the extension the following message appeared on the special page after we tried to create a PDF book.

An error occured on the render server: traceback Traceback (most recent call last): File "/home/tools/py25/lib/python2.5/site-packages/mwlib-0.12.13-py2.5-linux-x86_64.egg/mwlib/apps/render.py", line 169, in __call__ env = self.get_environment File "/home/tools/py25/lib/python2.5/site-packages/mwlib-0.12.13-py2.5-linux-x86_64.egg/mwlib/apps/render.py", line 101, in get_environment self.zip_filename = make_zip(output=self.options.keep_zip, options=self.options, metabook=env.metabook, status=self.status)

We created a ticket#855 on the tracker system. --MWJames 06:33, 3 June 2010 (UTC)

message Coll-load local book
I am a translator on translatewiki.net. The message Coll-load local book is as follows:

"Click OK to continue with your book %TITLE% which contains %NUMPAGES% wiki pages. Click Cancel to delete it and start with an empty book."

I have tried to create a book to find this message in action but unfortunately haven't been able to see this message in action. The message appears to refer to a button with 'OK' on it and a button with 'cancel' on it. I can't find an 'OK' message at translatewiki.net in this extension. Is 'OK' and 'cancel' localisable, or do we have to leave 'OK' and 'cancel' in English without translating them? If so, can you create messages for these two buttons so that we can localise them?

Book has 0 Bytes
When I want to render a book with this extension and the default server, it gets finished without error. But it only has 0 Bytes when I download it. Re-rendering doesn't help I use (the newest) ubuntu karmic (mediawiki 1.15). Any suggestions?

Error in the HTTP GET command
Got the same. The mwlib log shows the error 2010-07-17T23:10:17 mwlib.serve.request_info >> remote_addr: 62.31.33.7, referer: http://www.mypage.de/wiki/index.php/Spezial:Book 2010-07-17T23:10:17 mwlib.serve.error >> no command given 31337.sub.mypage.de - - [17/Jul/2010 23:10:17] "GET /?Array HTTP/1.1" 400 16

Part 1
The array problem is fixed with the following patch: --- GlobalFunctions.php 2009-03-25 03:07:09.000000000 +0100 +++ GlobalFunctions.php 2010-07-17 23:33:17.000000000 +0200 @@ -1239,6 +1239,9 @@ */ function wfAppendQuery( $url, $query ) { if( $query != '' ) { +              if ( is_array( $query ) ) { +                      $query = http_build_query( $query ); +              }                if( false === strpos( $url, '?' ) ) { $url .= '?'; } else {

Problem 2 - PHP Bug
Warning: curl_setopt [function.curl-setopt]: the provided file handle is not writable in /var/lib/mediawiki/extensions/Collection/Collection.body.php on line 1322

This bug is fixed in php 5.3; since you use ubuntu karmic, you have 5.2 and there the bug is present.

A workaround
This patch does not use the php function tmpfile; and therefore works with php5.2 and ubuntu karmic --- Collection.body.php 2010-07-18 01:38:38.000000000 +0200 +++ Collection.body.php.patched 2010-07-18 01:38:30.000000000 +0200 @@ -1144,7 +1144,8 @@ EOS global $wgRequest; global $wgCollectionContentTypeToFilename; -              $tempfile = tmpfile; +              $tmpfname = tempnam("/tmp", "mwlib-pdf"); +              $tempfile = fopen($tmpfname, "w"); $r = self::mwServeCommand( 'render_status', array( 'collection_id' => $wgRequest->getVal( 'collection_id' ), 'writer' => $wgRequest->getVal( 'writer' ), @@ -1181,8 +1182,9 @@ EOS header( 'Content-Disposition: ' . 'inline; filename=' . $wgCollectionContentTypeToFilename[$ct] ); }               } -               fseek( $tempfile, 0 ); -              fpassthru( $tempfile ); +              if (is_resource($tempfile)) +                      fclose($tempfile); +              readfile( $tmpfname ); $wgOut->disable; } @@ -1374,6 +1376,9 @@ EOS if ( !$toFile ) { $text = $result; } +                      else { +                              fclose( $toFile ); +                      }                        $errorMessage = ''; }               curl_close( $c );

Can't download trunk version
When I try to download trunk version I get this message instead of the software:

svn: Working copy '/mnt/upload6/private/ExtensionDistributor/mw-snapshot/trunk/extensions' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)

Compatibility with Labeled Section Transclusion extension
I am trying to use LabeledSectionTransclusion-MW1.15-r47897 together with Collection-MW1.15-r48763 on MediaWiki 1.15.3. No other Extensions are active. I am using my own Render-Server.

Transcluding sections works fine within Mediawiki, when I try to render a Collection however all transcluded text turns out missing. Otherwise the PDFs look fine.

Is this a limitation in one of the extensions or is this some misconfiguration on my part?

Thanks for Your Help! --RayTRoX 20:21, 25 July 2010 (UTC)

Compatibility with Extension:DismissableSiteNotice
The extension works fine. But, if the "create book" function of the is active (from on the top is visible), the "dismiss"-Buton of the extension Extension:DismissableSiteNotice hides the Sitenotice AND the frame for the pdf book extension. Why? How this behavior can be avoided? Kind regards --Jostar 07:52, 11 August 2010 (UTC)

Picture/Files
None of the picture/files show up in the PDF files. The pictures in my wiki are in the form

External URLs not indicate as links in PDFs
The PDFs created by the Collection/mwlib, the only way you can tell that text is linked to an external URL is by hovering over it.

The internal links (to pages that are included in the PDFs) have arrows beside them.

Is there a way to format the externally linked text somehow, so that it is an obvious link when viewing the PDFs online and in the printed PDFs? --Ross Xu 14:07, 20 October 2010 (UTC)

Pink won't render correctly
I'm having a hard time because pink text will not render correctly, it becomes like an aqua like color. Anyone else had this problem?--Bluesoju 14:14, 22 November 2010 (UTC)

Problems with supporting right to left text
When I export the pages in a PDF format my RTL text is showing backwards. Has somebody encountered that problem?--Gregra 10:47, 22 December 2010 (UTC)

Downloaded filename not specified
When downloading a generated PDF, ODT, XML or HTML file, HTTP headers miss the filename. Therefore, my browser is using the URL of the current script : index.php

In Collection.body.php, I added in Download function: $collection = CollectionSession::getCollection; $filename = $collection["title"]."."; switch($wgRequest->getVal( 'writer', 'rl' )) {   case "odf": $filename .= "odt"; break; case "xhtml": $filename .= "html"; break; case "mwxml": $filename .= "xml"; break; default: $filename .= "pdf"; break; }

And modified the following lines : if ( $content_disposition ) { header( 'Content-Disposition: ' . $content_disposition .' name="'.$filename.'"'); } header('Content-Disposition: attachment; filename="'.$filename.'"');

Whole file: http://pastebin.com/02D9Vk4j