www.ePaperArchives.com
&   www.AiEDV.ch
 
Organizing ePaper Data
and Full-Text Search
for «BatchXSLT for InDesign»
For BatchXSLT for InDesign V 1020x and later

This manual describes how to organize ePaper (eBook) data exported with «BatchXSLT for InDesign», and how to install and configure the FullText Search module on a web server.
As a licensed user of «BatchXSLT for InDesign», you may use this Full-Text Search module for FREE and it is Open Source!

Prerequisites

«BatchXSLT for InDesign»
You should be familiar with
– calling JavaScripts from InDesign's Scripts window
– exporting InDesign documents using «BatchXSLT for InDesign»


MySQL
Your web server must run MySQL version 5.0.23 or later (Unicode)
You should be familiar with using the MySQL console
You must know the root/administrator password to create a database


Web Server
You must have ftp access rights to upload files to your web server
Your web server must run PHP 5.2.4 or newer (on Apache, Windows IIS ...)

Multi-byte support must be enabled in PHP! In the php.ini file, the line
"extension=php_mbstring.dll"
must be uncommented.


MOST IMPORTANT: WHEN SWITCHING TO A PRODUCTIVE ENVIRONMENT
    CHANGE ALL PASSWORDS!
Otherwise, anyone who knows this package and your MySQL's IP address may change your full-text database!






Content

Organizing and Storing ePaper Data on Web Servers
ePaper Export using «BatchXSLT for InDesign»
   Export Folder Structure Explained
   FTP Transfer to the Web Archives

Installing and Configuring the Full-Text Search Database
Installing and Configuring the Full-Text Search Module
Loading the Full-Text Search Database

Directly Accessing an Article

Multiple Objects in a Full-Text Search Database

Troubles?
Disclaimer


To Content

Organizing and Storing ePaper Data on Web Servers

An export of a printed product easily can contain up to several hundred files. Therefore, it makes sense, to store data exports into a clearly defined folder structure.
This is ESSENTIAL and it is EASY!

Let's go:
1. Assume you work in a company named "MyNews Company"
2. You want to export a periodical or News Paper named "MyNews"
3. This print product has the shortcut "MN"
4. We have the year "2008"
5. The paper's issue date in the form YYYYMMDD "20080607" (June 7, 2008)

Let's build a folder path from this information:
MyNews Company/MyNews/MN/2008/20080607

This folder structure is self explaining and clean: issue per issue is stored in its own folder.

We will have two such folder structures:
– One is on our local machine where we export the InDesign documents
– The other one is somewhere on our web server to publish the data

It is always a good idea, to name the documents in a similar self-explaining way:
We simply take the product's shortcut, an 'underscore' and the issue date to build the names for our InDesign documents. The document which will go into the above mentioned folder structure should be named:
MN_20080607.indd




To Content

ePaper Export using «BatchXSLT for InDesign»

In the previous section we have learned how to name and store ePaper data.

1. Name a document like mentioned above and open it in InDesign.
2. Call the script "ExportCurrentDocument.jsx"

You should see the following window:



You have to fill in the fields: "Company Name", "Object Name" and "CSS Name"
Name the CSS like the shortcut of your document and give it the name extension '.css'!
The 'Object Shortcut", 'Year' and 'Date' fields should have been set automatically from your document's name.

The above image also shows the full data export path. As my name is Andreas Imhof, the export path in my case is shown as:
Users/andreasimhof/Export/out/MyNews Company/MyNews/MN/2008/20080607

To export the document to a flipping pages e-Book press the  OK  - Button.
After a moment, when «BatchXSLT for InDesign» has finished work, you should find the eBook data in the mentioned folder structure below the Folder ~/Export/out in your home directory.

At the folder 'MyNews Company/MyNews/MN/2008/20080607' open the file whose name ends with '.html' in your browser and verify the flipping pages eBook.

Local and Web server paths
Automatically, the local export folder structure has been created and, on OSX, Unix and Windows Vista looks like this:
Users/YourName/Export/out/MyNews Company/MyNews/MN/2008/20080607
On Windows XP:
C:/Documents and Settings/YourName/Export/out/MyNews Company/MyNews/MN/2008/20080607

The folder structure on our web server will differ in the part which points to the local machine and could look like this:
www.myNewsCompany.com/ePaper/DATA/MyNews Company/MyNews/MN/2008/20080607

The whole subfolder structure remains the same.





To Content

Export Folder Structure Explained

Few things only to explain:



One important folder is the the folder named XSLCSS on the same level as the object shortcut folder 'MN'.
It contains:
– The CSS matching the document's styles: You must edit it to match display needs in a browser: Font families, sizes, background colors and more
– Many background images and several javascripts which control the e-Book's behavior in a browser.
The .htm and .xml eBooks rely on this folder. Without it, the exported data does not have a special behavior and is just plain HTTML or XML.





To Content

FTP Transfer to the Web Archives

Again: the exported data should go into the following path on our web server:
www.myNewsCompany.com/ePaper/DATA/MyNews Company/MyNews/MN/2008/20080607

Exported data may be transferred to the web server with any FTP program.
«BatchXSLT for InDesign» can make FTP transfers and can be triggered from InDesign.

Call the script "ftpToWebArchive.jsx" and you should see the following window:



You have to fill in the fields:
FTP Domain Name: fill in the real domain name
Data Root Path: like ePaper/DATA
User Name: your ftp user name
Password: your ftp password

You do not have to enter any sub-path! The folder sub-structure below the 'Source Data Path' will automatically be created on the web server below 'Data Root Path'.

Hit the  OK  - Button and await completion of the ftp data transfer.

IMPORTANT!
The following step must be done only once and must not be repeated for every issue!
Use a standard FTP client program to transfer the 'XSLCSS' folder to your web server. It must be on the same level like the object shortcut folder 'MN'!
(See screen shot in the previous section)
This folder is not copied automatically, because we do NOT want to overwrite it with following exports. We have edited the CSS style sheet to match our display needs and do NOT want that it gets overwritten.

Let's check the integrity of the eBook data on the web server.
We must be able to view the transferred data as flipping pages eBook. Enter the address to the html file in your browser's address line. It should look similar to this (sure, use your real domain name):

www.myNewsCompany.com/ePaper/DATA/MyNews Company/MyNews/MN/2008/20080607/MN_20080607.htm

OK? – great, if you answer with 'YES'.
If your answer is 'NO', then check the data files on your web server.

The flipping pages eBook can and MUST work properly when opened locally AND from the web server!





To Content

Installing the Full-Text Search Database

Your must have MySQL version 5.0.23 or later
You should be familiar with MySQL

First, we create the database named 'ft_flipbook' which contains two tables.
An SQL script named 'ft_flipbook_STRUCT.sql' may be found in the «BatchXSLT for InDesign» software package at the path
BatchXSLT4InDesign/BatchXSLT/Utilities/FullTextSearch/search/InstallDatabase

Several ways to run this SQL script:
Way #1
Start your preferred MySQL client and copy/paste the content of the file 'ft_flipbook_STRUCT.sql' into a query window and run it.

or Way #2
Make sure you can call the mysql console program:
Type 'mysql' at a terminal prompt and check if the mysql console answers correctly.
Quit the mysql console
Copy the file 'ft_flipbook_STRUCT.sql' to a location where it is accessible directly.
At the terminal prompt enter the line: (use your own user and password):

mysql --user=root --password=mysql -f -e "source ft_flipbook_STRUCT.sql"

Verify the created database:
– a database named 'ft_flipbook' must have been created
– 'ft_flipbook' DB must contain the tables 'flipbook_1' and 'objects'
– a user must have been added: 'BatchXSLT2DB'@localhost' and BatchXSLT2DB'@'%'
– an other users must have been added: ft_flipbook'@localhost and ft_flipbook@'%'
– user 'BatchXSLT2DB' must have rights on both tables: SELECT, INSERT, UPDATE
– user 'ft_flipbook' must have rights on both tables: SELECT

OK? - the database is ready





To Content

Loading the Full-Text Search Database

«BatchXSLT for InDesign» can be triggered from InDesign to push our exported data into the database.
Call the script "pushToWebDatabase.jsx" from InDesign's scripts palette and you should see the following window:

Push XML data to full-text search database

Fill in all fields, and pay special attention to the fields 'Database URL', 'Domain Name' and 'Data Root Path' to match your system.
You may check the box 'Extract Text from PDF files' to extract the text from PDF files too.
You may check the box 'Move to WEBdone after complete' if the data schould be moved to the folder 'WEBdone' after transfer is complete.

Hit the  OK  - Button and await completion of the data transfer.

Check the table content with your preferred MySQL client program. Entries should have been added like:



IMPORTANT:
The fields
'domain' / 'root_datapath' / 'path' / name_html
concatenated with slashes must point into our web archives path!







To Content

Installing and Configuring the Full-Text Search Module

Installation
The full-text search module for the web server is contained in the «BatchXSLT for InDesign» software package at the path
BatchXSLT4InDesign/BatchXSLT/Utilities/FullTextSearch
Copy the folder 'search' to your web server.

It must be at the same level like the 'DATA' folder!
Your web path 'www.myNewsCompany.com/ePaper' must contain the folders:
– DATA
(which contains the epaper data folders)
– search (which contains the search programs)

The installed search module is automatically detected by the epaper files by searching their own path for a "data/" subfolder!


Configuration
The 'inc' folder (within 'search') contains a file named 'vars.php'.
Everything should be fine without making any changes if your MySQL database and your web server are on the same machine. If they are not, then change the line
$hostname = "localhost";
from 'localhost' to the address of your MySQL database.

Call the search module from your browser by entering the following address:
http://www.myNewsCompany.com/ePaper/search/search.php
and the search window should open:



The top left popup menu must contain the 'title' field from the 'objects' table.

Enter a search term in the 'Fulltext Search' field and some matching results should be returned (if found any).



Clicking on the blue title line will open the eBook from the web server in a new window, flip to the selected article's page and show the article.






To Content

Directly Accessing an Article

Sometimes, it might be useful to be able to show a certain article without the help of a database.

This section describes how to directly access and display a certain article on a given page with a single link in a browser.

What we need to directly access an article from a certain document:
– the document's URL
– the article's page number
– the article's unique index number within the document
The values for the page number and the article index number may be found in the exported XML document.
All articles in a document are uniquely identified and have the syntax like the following article on page number 3:

<article idx="45" page_sequence="3" page_name="" ...">

If we take a look into the fulltext search table 'flipbook_1', we again find the full URL, the 'article_page' and the 'article_id'.
To directly show this article whose 'idx' is 45 and whose 'page_sequence' is 3, you need to create the browser link:
http://www.somedomain.com/anyPath/TheDocument.htm?p=3&a=45

Such links work on HTML and XML files!

See a working link from our demo site:
http://epaperarchives.com/Flipbook2/HM/didruma07_ausgabe1.htm?p=3&a=45

So, if you index your XML documents on any other full-text search engine, make sure, you do not loose the article's document name and the attributes 'page_sequence' and 'idx'!






To Content

Multiple Objects in a Full-Text Search Database

No problem!
The full-text search table 'flipbook_1' can have any number of objects (publications).
In our example installation above, we have an object with a shortcut of 'MN':
MN  www.myNewsCompany.com  ePaper/DATA  MyNews Company/MN/2008/20080607/ MN_20080607.htm...
...

Any number of other objects may be added like:
OC  www.otherCompany.com  ePaper/DATA  MyOther Company/OC/2008/20080607/ OC_20080607.htm...
...
Also add a record into the 'objects' table.
The full-Text search then will combine all objects contained in the table 'flipbook_1'.


You may create parallel installations by copying all software into a different web folder and by creating more full-text tables like 'flipbook_2', 'flipbook_3' ...





To Content

Troubles?

We are glad to hear from you if you have any troubles using this package!
Thank you!






Disclaimer
This Full-text search module is Open Source and FREE!

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PRODUCER OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.





MOST IMPORTANT: WHEN SWITCHING TO A PRODUCTIVE ENVIRONMENT
    CHANGE ALL PASSWORDS!
Otherwise, anyone who knows this package and your MySQL's IP address may change your full-text database!



Andreas Imhof
Email: info@aiedv.ch
Web Site: www.aiedv.ch
*** End of Document ***