Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Documentation » System Administration Documentation » Book Printing And Buying

Book Printing And Buying

Document Actions
An overview of the mechanics and administration of PDF generation and print-on-demand ordering.

Configuring Printing

PDF generation for collections is done asynchronously by a special object called the "AsyncPrinter". This can be on any Zope instance, by any name. On cnx.org, it is called /plone/RCPrinter and is present on all front ends. If you visit RCPrinter in the ZMI, you can control which printing code to use and where the printing code performs its data fetching. This may change between machines, and since this object is present through ZEO on all front ends machines, all of them must have the same path to printing code. (The next rollout of printing changes will make this configuration smarter.)

When a Collection is published, it calls via HTTP some AsyncPrint object. We configure where this call goes in /plone/portal_properties/rhaptos_collection_print_config in the ZMI. Two properties 'servicehost' and 'servicepath' point to an AsyncPrint object on some machine. On cnx.org, this is currently cnx.org, so that such requests are distributed amongst front ends.

When these properties are properly set, the publishing collections should trigger a print process successfully.

PDF Management

A Collection may be "locked" to prevent a print process from happening, and thus overwriting the existing PDF (or lack thereof). This is typically used to keep auto-rendered PDFs off of collections with hand-built PDFs, or collections which should not have a PDF. To set the lock status, either:

  1. enter a URL like http://cnx.org/content/col00000/latest/setProcessStatus?value=locked
  2. enter a debug console and call a method like >>> app.plone.content.col10000.latest.setProcessStatus('locked')

The process status value can be "blank", "working", "succeeded", "failed", or "locked". The "succeeded" status is the suggested opposite of "locked".

Note that this will not affect the presence or display of any existing PDFs or the order button. Those are controlled solely by presence or absence of PDFs.

To quickly remove a PDF:

  1. enter a URL like http://cnx.org/content/col00000/latest/setPrintedFile?value=
  2. enter a debug console and call a method like >>> app.plone.content.col10000.latest.setPrintedFile(None)

This is a common operation in combination with locking.

(See also: http://rhaptos.org/docs/sysadmindocs/printoptions)

To add a PDF manually, enter a debug console, read the data of the file into a variable with open() and file.read(), and call setPrintedFile() with that variable as the argument instead of None. This can be seen in the {RhaptosCollection/}printing/batchupload.zctl script, which may be run with zopectl run to upload multiple PDFs to multiple collections. This is a common operation (after offline generation) for system-wide updates to print code.

Multimedia Zip File

This zip file contains all the available media from the collection. It is synchronously generated on first access, then stored on the collection. The link will show up unless:
  1. There is no PDF.
  2. The collection is "locked" and the stored zip file is null.
Thus, if you lock a collection before generating a zip file, the link will not appear. To get one, unlock, click on the multimedia zip link, and the lock again.
More explicitly:

  1. enter a URL like: http://cnx.org/content/col00000/latest/setProcessStatus?value=succeeded
  2. reload the collection page and click on the 'Download Multimedia' link
  3. Relock: http://cnx.org/content/col00000/latest/setProcessStatus?value=locked

This does leave a hole during which a module publish event could trigger a PDF regeneration. Best to workout the equivalent zopectl deubg code, since that could have the unlock/lock steps in one transaction, and not exposed the 'unlocked' state

Multimedia zip files won't be regenerated on locked collections, just like the PDF.

Order Book Button

Note: the specific logic described here could easily change. For the best idea on what will happen, see RhaptosCollection/skins/rhaptos_collection/collection_view.pt, id="cnx_course_buy".

Under certain circumstances, an Order Printed Copy button will appear on Collections. This hooks us to a print-on-demand service to order a hard copy. To configure where this goes, return to /plone/portal_properties/rhaptos_collection_print_config in the ZMI and set the buyBookURLformat property. It expects a URL with a placeholder for the id of the collection. For production use, this value should be:

https://secure-api.qoop.com/Rice/orderprocessing.php?catalog_number=%s

The "%s" in the URL string is replaced by the collection id (like "col10040"). If this property is blank, the system will not show the button in the normal case. See below for exceptions.

The presence of the order button is also controlled on an collection-individual basis by the orderable property. This may currently be set only by Managers and is by default false. It will show up for Managers in the Metadata tab of any collection, published or in workgroups. To get to that page on published collections, since the tabbed edit interface is not normally displayed, add base_edit to an explicit-version collection URL, like http://cnx.org/content/col10363/1.3/base_edit

The orderable property may also be changed like setProcessStatus above, but the method is setOrderable. Values should be any string for "true" or no string at all for "false". Note that the value on a workgroup collection will replace the value on a published collection when it is published, so all workgroup copies should also be set at the same time. [Jenn has a script for this...]
http://cnx.org//content/col0000/latest/setOrderable?value=True
The book ordering button will appear only under the following conditions:

  1. orderable  is true, and
  2. there is a buy link available
    1. ...as a special configuration (see below), or
    2. ...as autogenerated, which requires
      1. a value for buyBookURLformat, and
      2. a PDF available on that collection
      3. the collection be of non-zero size [future]

(Note: The primacy of the orderable condition will probably be removed in the future, making it an additional condition of an auto-generated link.)

Special Ordering Config

Besides the auto-generated PDFs and print-on-demand, we also can specify an ordering website on an individual basis. As seen above, this will over-ride any auto-gen destination for the order button. This can be used to link to special book ordering pages, which can be handy for special covers, books with hand-crafted PDFs, etc.

To set this, see: http://rhaptos.org/docs/sysadmindocs/addbook

Order Page Config

The print-on-demand service consumes a special info page on collection called printinfo, which may be seen on any collection by appending that name to a collection URL, like so:

http://cnx.org/content/col00000/latest/printinfo

It will tell you about the PDF and various other data about the collection, including orderable and processStatus. It supplies two blocks of text used by the printer in the ordering process: buyBookSiteBlurb and buyBookCnxBlurb. These also reside in /plone/portal_properties/rhaptos_collection_print_config and may be edited in the ZMI. (Merely press the Save button, no checkboxes required.)

The buyBookSiteBlurb field contains some non-standard markup that is interpreted by QOOP, so be careful with your edits. Bold is opened with ^b (caret-b) and closed with \b (backslash-b). Line breaks between paragraphs are \n (backslash-n), followed for our convenience by two actual returns in the textarea. The name of the license, or its URL, or something, is represented by the construct %(license)s. (percent sign, "license" in parentheses, followed by "s"). The S isn't literal; it's part of the variable.

If you're worried about messing something up, just make any minor edits directly in the text box, rather than cutting the whole thing into your own text editor and pasting it back in after the edits.

You can see the changes in these properties reflected in the printinfo page immediately.

Exceptional-cases snapshot, Sept. 2008

This is a condensation of printinfo_all on September 5, 2008. Instead of individual collections on each row, similar rows have been collapsed where their columns were the same. This gives us a view of the various different cases that exist in the system with regard to downloadability and orderability.

A similar table from September 2 was half again as long, because between the 2nd and the 5th we eliminated the RUP and TIMEA custom styling. Since RUP and TIMEA content inhabited several of the below categories, eliminating the custom styling as a variable allowed several categories to collapse much more neatly.

Below the table is an email explaining some of the cases.

Number Category Process Status PDF avail? ZIP avail? Orderable? sQOOP Notes
320 Normal, with PDF and ZIP succeeded TRUE TRUE - -
12 Normal, but missing ZIP succeeded TRUE - - - Some of these are RUP, Case 2 below; others may just need regeneration. See Table A below for the full list.
7 sQOOP-orderable succeeded TRUE TRUE TRUE yes Table B below
3 Regular-orderable succeeded TRUE TRUE TRUE - Case 3 below: col10114 col10264 col10376
2 Locked, with zip locked TRUE TRUE TRUE yes col10241 col10522
2 Locked, without zip locked TRUE - TRUE yes col10040 col10363
18 Known unprintable failed - - - -
Table A

NCPEA	col10293	Introduction to School Leadership
TIMEA	col10371	History through the Stereoscope: Stereoscopy and Virtual Travel
TIMEA	col10375	Using and Creating TIMEA Educational Materials in Connexions
TIMEA	col10378	Places in Egypt
RUP	col10377	The State of Scholarly Publishing in the History of Art and Architecture
fmoody	col10504	Seattle and the Demons of Ambition
frey	col10560	Business, Government, and Society
stats	col10561	Collaborative Statistics (wtih edits: Teegarden)
stats	col10562	Labs For Collaborative Statistics - Teegarden
misc	col10464	Functions
misc	col10563	Study at University
misc	col10564	Introdução à programação com o uso do Python

Table B

col10518	The New-York Historical Society: Lessons from One Nonprofit's Long Struggle for Survival
col10449	Images of Memorable Cases: 50 Years at the Bedside
col10526	Houston Reflections: Art in the City, 1950s, 60s and 70s
col10443	A Learning Approach to School Discipline: Problem Solving Instead of Punishing
col10427	The Handbook of Doctoral Programs: Issues and Challenges
col10441	Educational Administration: The Roles of Leadership and Management
col10547	Collaborative Statistics Teacher's Guide

From: Kathi Fletcher 
Date: Mon, Aug 11, 2008 at 9:20 AM
Subject: Re: [Fwd: POD Ordering Page]
To: Ed Woodward 
Cc: J Cameron Cooper , Jennifer Drummond 

Ed,

All the books that are handled in a special way are in the lens
cnx.org/lenses/cnxorg/books .

These are the special cases:
   1. NCPEA books - click on the NCPEA tag to see the 3 books by NCPEA.
These books show no PDF, because the PDF inside the book you can buy was
produced completely apart from Connexions and it could be misleading.  The
order button goes to a SQOOP page and should bypass the agreement.
Multimedia zip files should behave normally -- update as the collection is
updated.

  2. RUP books -- click on the RUP tag to see the 4 books that RUP has
published through Connexions. These do NOT show a PDF because of a special
arrangement that RUP has with us to keep that hidden. These should not show
a multimedia zip file. They should not go through the agreement. They go to
sqoop landing pages.

  3. Two books in this lens actually use the automated system right now and
should work just like all the collections in the repository that are not
special. Those are col10114 (Physical Electronics) and col10264 (Concept
Development Studies in Chemistry). These should go to the automated qoop
landing page instead. Multimedia zip files should behave normally -- update
as the collection is updated. These should go through the agreement.

  4. The rest of the books in the lens -- Should be "locked" so the PDF
doesn't change and go to SQOOP landing pages. Multimedia zip files should
behave normally -- update as the collection is updated.  These should not go
through the agreement.
Created by jccooper
Last modified 2008-09-30 11:44