29 May 2012
This article will describe how to add note taking functionality to a folio using HTML and JavaScript. Familiarity with Adobe Digital Publishing Suite, HTML, and JavaScript is assumed.
All
This article provides example files to implement note-taking for items in your folio using HTML and JavaScript. By implementing this functionality, you can enable users to take notes on items and review them at a later time. Use cases can range anywhere from instructional material to the Sotheby's Catalogue. Sotheby's allows users to take notes on auction items and view all of their notes in a list. This example uses two HTML pages: one for taking notes and another to view all notes. Note that data is stored locally in an HTML5 database that is available to all iOS webviews.
Figures 1–3 show the example files in the viewer.
If you unzip notes.zip, you will see the file structure displayed in Figure 4.
Here are the files and folders:
alert() dialogs are suppressed.To make use of the example files with your own content, you will have to complete the following steps.
The following sections explain these steps in more detail.
On line 13, set a value for FOLIO_ID. This ID does not have to match the ID from Folio Producer. This is an ID you assign to the folio for which you are adding note-taking functionality.
On line 16, modify the records array so it matches the items for which you would like note-taking functionality. Be sure to close each item with curly braces, { }, and separate them with commas. Each itemId must be unique.
For each item in your folio that you would like note-taking functionality, create a new version of addNote using the format addNote.folio-id.item-id.html. For example, in step 1 if you set FOLIO_ID = f1 and you have an item with itemId = 1, the file name would be addNote.f1.1.html. You do not have to modify the contents of the file. The reason why a copy of this file has to be created for each item is because it's impossible to pass URL parameters to local hyperlinks in InDesign. For example, ideally you would use addNote.html?folioId=f1&itemId=1, but instead you have to use addNote.f1.1.html.
On line 3, set the value for FOLIO_ID to the same value set in step 1.
Open an addNote HTML page in Safari to test. Verify a title and description is displayed for the item. If nothing is displayed, there was probably a formatting error introduced when modifying the JavaScript. Open the debug console and see where the error occurred, and then go back to the appropriate JavaScript file and fix the formatting. If there aren't any problems, enter a note.
Open notes.html to view the note entered from addNote.
Create a folio that contains an INDD file that links to an addNote HTML file (created in step 2) and notes.html. The hyperlink should have the path "HTMLResources/" followed by the name of the file. For example, to create a hyperlink that opens notes.html, in the Hyperlinks panel set URL= HTMLResources/notes.html.
Zip the contents of HTMLResources, name it HTMLResources and upload to your folio in Folio Producer. Make sure to zip at the content level of the folder, not the folder level of HTMLResources—otherwise, there will be an extra path to your files. To upload your zip to your folio, in Folio Producer, locate your folio, click "open," and then click the "HTML" button.
Open your device and verify that everything works.
Data is stored locally in an HTML5 database that is available to all iOS WebViews, although as of iOS 5.1 the data could be erased at any time. For more info, you can view this blog post from Sencha. In my limited testing of the Sotheby's app and my own development, I did not see any data loss, although if any is experienced in your testing it is recommended that a server-side solution is implemented that complements local storage.
This article has provided example files on how to implement note-taking functionality. To learn more about Adobe Digital Publishing, visit the Digital Publishing Suite Developer Center.