[[BackLinksMenu]] [[TicketQuery(summary=BOOK_HTML_EXPORT_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]] = Analysis = == Overview == User should be able to export Sophie 2 Book as html file. == Task requirements == * Provide prototype that exports book to html file. * Add 'Export as' sub menu in file menu that contains 'as pdf' and 'as HTML' buttons.'as HTML' button evoke dialog window who allows the users to select the name of the html file. * The entire book should be exported as single html file in this revision. * Multiple html export as well as export single page should be consider in the next revision. * Links and timlines will not be preserved for now. * Images should be exported. * See if we could export firs frame of the movie as image in this revision. * Audio will not be exported in this revision. * Rotated frames will be exported without rotation. * Research how to allow to export for video, audio, rotated frames etc. * If needed frames background (as gradient color) should be exported as image background. * Research and implement if possible in this revision export of alpha property. * Test in different browsers. (Firefox, IE6, IE7, Safari etc.). Give list of known problems in specific browser. == Task result == * The result should be code. == Implementation idea == * Export every page as div tag with needed attributes (width, height etc.). * Export every frame as div tag (child of the page div) * Use absolute positioning for div tags. == Related == == How to demo == * Run the application * Create new book * Insert few frames as well as few pages * Export the book as html * Open the html file in some web browser. = Design = * Exporting sophie books to html, will use the org.sophie2.base.persistence library. For more information about it see [wiki:GROUP_PERSISTENCE_R0]. * Will create a module for HTML export named [source:/trunk/sophie2-platform/modules/org.sophie2.extra.func.html org.sophie2.extra.func.html] * It will have a module class named [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/HtmlModule.java HtmlModule] that will register all the extensions of the [source:trunk/sophie2-platform/modules/org.sophie2.base.persistence/src/main/java/org/sophie2/base/persistence/persister/MasterPersister.java MasterPersister]. * Will create Persister implementations for Book, Page, Frame and ImmImage and will register them as extensions to the MasterPersister. The already created persisters about Book, Page etc are not of use for the html persisting. The tags used are not html compatible. That is why the new ones will be created that are alike the already created, differing in schema and tags. * [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/BookToHtmlPersister.java BookToHtmlPersister] having a schema "book|storage|html" - will convert a book to a storage node. * [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/PageToHtmlPersister.java PageToHtmlPersister] having a schema "page|storage|html" - will convert a page to a storage node. * [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/FrameToHtmlPersister.java FrameToHtmlPersister] having a schema "frame|storage|html" - will convert a frame to a storage node. * The FrameToHtmlPersister will invoke a persister for content to html invoking two other persisters for text and images: * [source:branches/private/peko/peko2/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/ContentToHtmlPersister.java ContentToHtmlPersister] will have a schema "storage|text:html|html" and will invoked a persister fot HotText and a persister for Images. * [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/HotTextHtmlPersister.java HotTextHtmlPersister] having a schema "hot-text|storage|html" - will convert a Sophie formated text to a storage node. * [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/persister/ImageHtmlPersister.java ImageHtmlPersister] having a schema "image|storage|html" - will convert a Sophie image content to a storage node. Images will be stored in a directory "_resources" and will be linked in the main html file. * These will also be extensions of the MasterPersister. * Exporting to HTML will be done from the [source:trunk/sophie2-platform/modules/org.sophie2.main.app.menus/src/main/java/org/sophie2/main/app/menus/file/ExportSubMenu.java ExportSubMenu] which is a sub-menu of the file menu. An [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/ExportAsHtmlItem.java ExportAsHtmlItem] will represent a menu item in the ExportSubMenu which when clicked fires an event that will be handled in a [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/main/java/org/sophie2/extra/func/html/HtmlLogic.java HtmlLogic]. '''Note: The [source:/trunk/sophie2-platform/modules/org.sophie2.extra.func.print/src/main/java/org/sophie2/extra/func/print/pdf/export/ExportToPDFItem.java ExportToPDFItem] will also be attached to the ExportSubMenu, since that menu will contain all supported formats that we export to.''' * The title of the ExportSubMenu will be "Export as". It will have a mnemonic VK_E. The mnemonic of the ExportToPDFItem will be VK_P and its title "PDF". The mnemonic of the ExportAsHtmlItem will be VK_H and its title "HTML". * The logic will eventually show a dialog and prompt the user to export the book to a file. * The new persisters will be located in the org.sophie2.extra.func.html module. For current revision they are not that much to be divided by what they persist. In addition, they need nothing else, but the model and nothing needs them, but the HtmlLogic. * Changesets: * [changeset:3097] * [changeset:3099] * [changeset:3138] * [changeset:3138] * [changeset:3160] * [changeset:3161] * [changeset:3162] * [changeset:3188] * [changeset:3199] - synchronized with trunk. * [changeset:3217] - synchronized with trunk. * Test: [source:trunk/sophie2-platform/modules/org.sophie2.extra.func.html/src/test/java/org/sophie2/extra/func/html/HtmlExportTest.java HtmlExportTest] Design related code merged into the trunk in [3223]. = Implementation = * Changesets: * [changeset:3242] * [changeset:3249] * Implementation 2: * [changeset:3318] - fixed some stuff pointed out in comments section... Merged into the trunk in [3356]. = Testing = ^(Place the testing results here.)^ = Comments = ^(Write comments for this or later revisions here.)