jfqbi= = eqji=qççäâáí= = = eqji=^ééäáÅ~íáçå=m~Åâ~ÖÉê= rëÉê=dìáÇÉ= oÉäÉ~ëÉ=OKO= HTML Application Packager User Guide NOTICE The information contained in this document is believed to be accurate in all respects but is not warranted by Mitel Networks™ Corporation (MITEL®). The information is subject to change without notice and should not be construed in any way as a commitment by Mitel or any of its affiliates or subsidiaries. Mitel and its affiliates and subsidiaries assume no responsibility for any errors or omissions in this document. Revisions of this document or new editions of it may be issued to incorporate such changes. No part of this document can be reproduced or transmitted in any form or by any means - electronic or mechanical - for any purpose without written permission from Mitel Networks Corporation. TRADEMARKS Mitel and M MITEL (design) are registered trademarks of Mitel Networks Corporation. Windows is a registered trademark of Microsoft Corporation. Other product names mentioned in this document may be trademarks of their respective companies and are hereby acknowledged. Mitel HTML Toolkit HTML Application Packager User Guide Release 2.2 September 2010 ®,™ Trademark of Mitel Networks Corporation © Copyright 2010, Mitel Networks Corporation All rights reserved ii HTML Application Packager User Guide LIST OF CONTENTS OVERVIEW ............................................................................................................... 1 USING THE TOOL .................................................................................................... 2 Behavior in GUI mode ......................................................................................................... 2 Invocation ........................................................................................................................................ 2 Selection of the Package Directory ................................................................................................. 4 Contents of a Package Directory .................................................................................................... 4 Initial Selection of the Files to be Packaged ................................................................................... 5 Changing the Treatment of a File.................................................................................................... 5 Other Information for the spx file..................................................................................................... 7 Re-reading the Package Directory – the Refresh button ................................................................ 7 Selecting the License Type ............................................................................................................. 8 Writing the spx file – the Generate button....................................................................................... 8 Cleanup of the manifest file............................................................................................................. 9 Visiting a Previously Used Directory.................................................................................. 10 Behavior in Command Line Mode ..................................................................................... 11 Command Mode Syntax................................................................................................................ 12 LIST OF FIGURES Figure 1 – Initial HTML Packager Form ................................................................................................. 3 Figure 2 - Selecting a previously visited directory.................................................................................. 4 Figure 3 - Selecting a previous application name .................................................................................. 4 Figure 4 - Moving two files from one collection to another..................................................................... 6 Figure 5 - Before the move..................................................................................................................... 6 Figure 6 - After the move....................................................................................................................... 6 Figure 7 - Using the drop down menut to choose a license type ........................................................... 8 Figure 8 - After the package file has been generated ............................................................................ 9 Figure 9 - Revisiting a previously used directory ................................................................................. 10 iii HTML Application Packager User Guide iv HTML Application Packager User Guide Overview This document describes how to use the HTML Toolkit Application Packager to create a package file. The HTML Toolkit Application Packager creates an SPX format file from a directory of files that are packaged into an HTML application. The SPX format file consists of individual files bundled together. The phone uses the SPX file and extracts the individual files. When generating a package, the input is a directory (possibly containing subdirectories) containing the files to be packaged. There are two outputs: a package file (in SPX file format) and a “package contents” file. The latter is purely for convenience: it captures the decisions made by the system and the user, and is used to be able to reproduce the same output from the same input. The packager takes existing files and packages them into an SPX format file. All the files required for an app must reside in or below a directory. This directory is called the package directory. In addition, there must be a valid manifest file. This must be named manifest.xml and must reside in the package directory (not a subdirectory of it). The manifest.xml file is not verified for valid XML syntax, but it is required to contain a valid name field. The program is normally a GUI, but can be invoked as a command line program. 1 HTML Application Packager User Guide Using the Tool Behavior in GUI mode Invocation When the program is invoked without any parameters (as, for example, in the case when double-clicking on the file in Windows Explorer) the program runs in GUI mode. This displays a form with various controls (see Figure 1 – Initial HTML Packager Form); the main ones are summarized below. 2 The Package Directory field is used to select a directory and display the one chosen. A history of previously visited directories is maintained; the field’s menu button allows one of these to be selected. The Application Name field shows the application name (taken from the manifest file in the package directory). A history of previously used names is maintained; selecting one updates the package directory field. The Package Filename is the name of the output package file. The Vendor and Version fields are text fields. Three boxes that display the files in and below the project directory. Each of the three boxes corresponds to one of the three ways of treating a file. A status area displays status information, errors and warning messages. HTML Application Packager User Guide Figure 1 – Initial HTML Packager Form 3 HTML Application Packager User Guide Selection of the Package Directory A package directory must be selected before anything else can be done. The GUI allows this to be done in several ways: The Browse for Directory button invokes a graphical browser, which can be used to select the directory. The path to the directory can be typed or pasted into the Package Directory field. A previously used directory can be recalled from the drop-down list that appears when the button at the right of the field is pressed. Figure 2 - Selecting a previously visited directory The application name of a previously used directory can be recalled from the application name drop-down list. Figure 3 - Selecting a previous application name The history lists of previously visited directories and their application names have the most recently visited directories at the top. Both lists have a maximum of 20 entries; older ones are discarded. The lists are saved in a file and so this history persists between GUI invocations of the Packager tool. When Packager is run in command mode, the history is neither accessible nor updated. Contents of a Package Directory The package directory must contain the file manifest.xml. This file must contain a valid name field (it cannot be blank, for example). If the packager has previously been run for this directory, there will be a generated package contents file with the reserved name of “spx.package”. The remaining files are displayed as explained in the next section. 4 HTML Application Packager User Guide Initial Selection of the Files to be Packaged Once a valid package directory has been selected, the filenames of all regular files in and below that directory are found. All of them are put into one of three following collections: files that are to be compressed and encrypted files that are stored directly, neither compressed nor encrypted files that are to be excluded from the package file The determination of which of the three collections a file is put into is determined as follows: 1. If the packager has previously been run on this directory and this file existed at that time, then it is put into the same collection as it was previously. 2. Otherwise, if the filename ends in “.html”, “.htm”, “.js” or “.css”, then it is put into the compress-and-encrypt collection. 3. Otherwise, if the filename ends in “.jpg”, “.jpeg”, “.gif” or “.png”, then it is put into the neither-compress-nor-encrypt collection. 4. Otherwise, the filename is put into the “exclude” collection. Changing the Treatment of a File After the filenames have been gathered and each one’s collection has been determined, the three collections are displayed. The filenames displayed are always relative to the package directory, and each collection is sorted (so all filenames within the same sub-directory are contiguous). The following files are not displayed: The manifest.xml file is not displayed, but it is always stored neither compressed nor encrypted. The package contents file (spx.package) is not displayed, nor is it included in the output SPX file. manifest.xml.bak Files whose name end in “.spx” Apart from these two special files, all others are displayed, and the user may now move files from one collection to another by simply dragging filenames between the displayed collections. In the pictures below, files Bell Tower.jpg and Tiemsjam.jpeg are initially placed in the “Not encrypted” collection. To have them encrypted and compressed, the filenames are selected by clicking on them, and then dragged to the “Encrypted and Compressed” box. 5 HTML Application Packager User Guide Figure 4 - Moving two files from one collection to another Figure 5 - Before the move 6 Figure 6 - After the move HTML Application Packager User Guide Other Information for the spx file The GUI contains five other fields. 1. The Application Name, which is determined from the manifest.xml file, is displayed but is not changeable. The only way to change the application name is to update the manifest.xml file. If this file is changed while the package tool is running the user must tell the Packager to rescan the directory. The Refresh button is designed for this, though alternatively the directory could be re-selected in the normal way. 2. The Package Filename. This is the name of the package file that is being generated. The default is the application name with .spx appended, except that certain characters that may cause problems in filenames are replaced with ASCII characters. The file must end with ‘.spx”. 3. The Vendor-Name string may be used to identify the vendor. 4. The Version field may be used to attach version information. 5. The default License Type is set to “Licensed Application”. The vendor field, version field and the time and date of generation of the SPX file are stored within the SPX file and may appear on log files generated for the SPX file. All five of these fields are stored in the package contents file. Re-reading the Package Directory – the Refresh button The Refresh button allows the package directory to be rescanned. Any existing files remain in whatever collection they previously were, and any new files are placed in the default collection as specified above. The refresh operation again validates the manifest file. If it does not exist, or is invalid (e.g. does not contain a name entry), then no operations are allowed other than selecting a different entry or pressing the Refresh button (or exiting the program of course). Because the manifest file is rescanned (to validate it), the package name and thus the default output filename may be changed by this operation. If the output filename has been manually entered, this value will be preserved. (The package name cannot be entered from the form; it is only read from the manifest file.) 7 HTML Application Packager User Guide Selecting the License Type This packager version is only able to generate Licensed Applications; therefore, Licensed Application is the only option available. Figure 7 - Using the drop down menut to choose a license type Writing the spx file – the Generate button When the user is satisfied that each file is in the correct collection, clicking the Generate button will generate the SPX file. The user will be prompted for the password the first time this button is pressed. The password is "Mitel Licensed Applications". The manifest file may be slightly altered, as explained in the next section 0 “Cleanup of the manifest file”. The output SPX file is written into the package directory. Its filename is whatever is in the package filename field. It must have the suffix “.spx” 8 HTML Application Packager User Guide Figure 8 - After the package file has been generated Cleanup of the manifest file Just before generating a package, the manifest file is checked to see if it contains any white space at the beginning or end of content inside an element. If so, the file is re-rewritten with this whitespace removed from. For example, <name> a test <name> would be replaced by <name>a test<name> If the file is changed, the original file is renamed to “manifest.xml.bak”. 9 HTML Application Packager User Guide Visiting a Previously Used Directory To re-generate a package file (usually done after at least one of the files have changed) the directory is re-selected. Figure 9 - Revisiting a previously used directory 10 HTML Application Packager User Guide Behavior in Command Line Mode Command line mode is entered when there is at least one option given. This is not an interactive mode; there is no scripting language for example. Instead, all user input is done with command line options. Since there are defaults for all of the options listed below, there is a special option that just specifies that command line mode is to be used. The same functionality is provided in command line as in GUI mode, but the operations are controlled with command line arguments rather than with buttons and mouse movements. The package directory is normally the current directory, but can be specified by an option. The same “filename to collection” mapping is done as described earlier. In particular, if a previous package contents file exists, this is used to control mappings. Any files not mentioned in the package contents file are put into the collection determined by their filename extension as described above. If there were files mentioned in the package contents file that are not found in the current directory a warning is produced (but the program continues). This mapping can be overwritten by specifying a collection option followed by a list of filenames that are to be put in that collection. Note that filenames specified directly on the command line must exist. Also, all the files must be in or below the package directory. They may be written as relative filenames; if so, they are treated as relative to the package directory, not the current directory (if that is different). If the package contents file previously existed, default values for the vendor string and version number are taken from it. Either of these strings can be overwritten by options on the command line. A password must be available. It can be supplied with the –p option, or for licensed apps only if it was previously given it will reused. Otherwise (if no password is available) the program will terminate with an error. If there are no errors, the manifest file may be cleaned up (see 0 Cleanup of the manifest file) and then the package is generated and the package contents file is written. After the files are written, a summary is given. This shows the vendor, version and license type, and lists each filename in the SPX file (except for the manifest file) along with an indication of its handling. 11 HTML Application Packager User Guide Command Mode Syntax The syntax for command mode is as follows. HtmlAppPackager [options] Options: 12 -d directory Specifies the package directory to use. If omitted, the current directory is used. -f package_filename Specifies the output filename. If omitted, the application name [with some changes for special characters] plus “.spx” is used. -v vendor_string Sets the vendor string -r version_number Sets the version number (a string) (Think “r” for revision.) -p password Specifies the password to be used. -e file… Specifies a list of files to be encrypted and -s file… Specifies a list of files to be stored directly (neither encrypted nor compressed) -x file… Specifies a list of files to be excluded from the package. -o Override mode – only the files listed (with the –e or –s options) are to be packaged, all others are to be excluded. -m Modified override mode: Only files specified in a package information file are used, except that any the –e –s or –x options can be used to override this.. Any other files found in the directory are automatically excluded. The intent of this option is to repeat a previous packaging with possibly some changes. -c This forces command line mode, and is used only when no other options are needed. This option isn’t really needed, because “-d” would suffice. -h Show help. This includes a brief option synopsis, and lists the numbers (for the –l option) corresponding to the license types. compressed. HTML Application Packager User Guide Examples: HtmlAppPackager –f neatstuff.spx –p "Mitel Licensed Applications" –v "Mitel Networks" –r "1.0" –d c:\packages\neatstuff This will package the directory c:\packages\neatstuff into an application package called neatstuff.spx. It also specifies the vendor string as Mitel Networks, and versions it to 1.0. HtmlAppPackager –p “Mitel Licensed Applications” –v "1.01" In this example, a package has already been generated in the current directory and so the vendor, package name and so on are taken from that. However, the version number is being changed, and the password is supplied. HtmlAppPackager –f tranquility.spx -v Zensoft –r 2.7182817 –e Tienshan.jpeg "Bell Tower.gif" –p "Mitel Licensed Applications" This example specifies that two files are to be stored encrypted and compressed. Note that the “-e” option allows several files to be specified (as does the “-s” option). Quotes are required around the second of these filenames because it contains a space. 13