www.AiEDV.ch | Organizing ePaper Data and Full-Text Search for «BatchXSLT for InDesign»

For «BatchXSLT for InDesign» (InDesign CC, CS6)
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.
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
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 (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. The issue is back from "2008"
5. The publication'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 containing the original InDesign document exports
– The other one is a copy somewhere on our web server to publish the data
It is always a good idea, to name the InDesign 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:
MN_20080607.indd
The document automatically will be exported into above mentioned sub-folder structure ..../MN/2008/20080607.
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" only.
The 'Object Shortcut", 'Year' and 'Date' fields should have been set automatically from your document's name.
The document will be exported into the path:
YourHomeFolder/Export/out/MyNews Company/MyNews/MN/2008/20080607
To export the document to a sliding pages e-Book press the Export - Button.
Wait a moment, until «BatchXSLT for InDesign» has finished work. You should find the eBook data in the above mentioned folder structure as HTML and XML files.
At the folder 'MyNews Company/MyNews/MN/2008/20080607' open the file with '.htm' extension ('MN_20080607.htm') in your browser and verify the sliding 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 entire subfolder structure remains the same.
To Content

Export Folder Structure Explained
Very few things to explain:
One important folder is the folder named XSLCSS on the same level as the object shortcut folder 'MN'.
It contains:
a) 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
b) 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 HTML 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 'XSLCSS' folder must be transferred to the web server only once!
For following transfers, the checkbox "Transfer XSLCSS Folder" can be unchecked.
Let's check the integrity of the eBook data on the web server.
We must be able to view the transferred data as sliding/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:
Option #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 Option #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: 'BatchXSLT4Ind2DB'@localhost' and BatchXSLT4Ind2DB'@'%'
– an other users must have been added: ft_flipbookWEB'@localhost and ft_flipbookWEB@'%'
– user 'BatchXSLT4Ind2DB' must have rights on both tables: SELECT, INSERT, UPDATE
– user 'ft_flipbookWEB' 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:
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 should 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.
Testing the search engine for the flip page eBook:
Call the search module for the flip page eBook from your browser by entering the following address:
http://www.myNewsCompany.com/ePaper/search/search.php
and the search window for flipping pages eBook 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.
Testing the search engine for the slide page eBook:
Call the search module for the slide page eBook from your browser by entering the following address:
http://www.myNewsCompany.com/ePaper/search/search_sb.php
and you should see the following messages:
*** Fulltext Search System Reachable.
*** Database 'ft_SLIDEdemos' accessible.
To Content

Directly Accessing an Article
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
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...
...
For each additional publication 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

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
Web Site: www.aiedv.ch
*** End of Document ***