Henry,

I've tested the documented features (generation of Widget through SOLO
deploy wizard, command line generation using lzdeploy) for both HTML5
and SWF10. Everything worked as documented.

For SWF10 there is still the security error for the ExternalInterface
call (sandbox violation). Even when I set "allowScriptAccess" to
"always" inside the flash.js, that error still was reported. Based on
the Adobe documentation - as I understood it - that should fix the
problem, but I'll investigate that problem more in detail this week.

I just have one question: Why do you list android as the 2nd possible
format for widgets? There is Android specific widget format, the
standards are W3C, JIL, BONDI and Opera. I'd support W3C and JIL next
to Opera. If you need example config.xml files, I can prepare them and
attach them to the JIRA entry.

Great work,
Raju

On Sun, Aug 8, 2010 at 9:56 PM,  <[email protected]> wrote:
> Author: hqm
> Date: 2010-08-08 12:56:04 -0700 (Sun, 08 Aug 2010)
> New Revision: 17232
>
> Added:
>   openlaszlo/trunk/lps/admin/widget-icon.png
>   openlaszlo/trunk/lps/admin/widget-templates/
>   openlaszlo/trunk/lps/admin/widget-templates/config.jil.xml
>   openlaszlo/trunk/lps/admin/widget-templates/config.opera.xml
> Modified:
>   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java
>   
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
>   
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLOSWF.java
>   
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/LZHttpUtils.java
>   openlaszlo/trunk/lps/admin/solo-deploy.jsp
>   openlaszlo/trunk/lps/admin/solo-dhtml-deploy.jsp
> Log:
> Change 20100805-hqm-I by [email protected] on 2010-08-05 16:09:26 EDT
>    in /Users/hqm/openlaszlo/trunk3
>    for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary:  Replace 'SOLO deploy' with 'Create w3c widget'
>
> New Features:
>
> Bugs Fixed: LPP-9148
>
> Technical Reviewer: raju
> QA Reviewer: max
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> Overview:
>
> generate w3c widget format files for solo deploy
>
>
> Details:
>
> Generates a config.xml file, which Opera can consume. Generates a wrapper 
> named index.html as the default start filename.
> (this will override any existing index.html, in the archive)
>
> config file templates are stored in lps/admin/widget-templates, the default 
> is 'opera' format.
>
> skip-pre-commit-checks
>
>
>
> Tests:
>
> - generate widget the app console in the browser, using the "SOLO" button
>   from examples/contactlist/contactlist.lzx in SWF10, DHTML.
>
>   Download the generated .wgt file , and install in Opera, verify that it runs
>
> - generate widget file for swf10 and dhtml, using the lzdeploy command line 
> util
>
>  lzdeploy --runtime=swf10 --output swf10.wgt --title "My Contacts" 
> examples/contactlist/contactlist.lzx
>  lzdeploy --runtime=dhtml --output dhtml.wgt --title "My Contacts" 
> examples/contactlist/contactlist.lzx
>
>  install .wgt files in Opera, verify that it runs
>
>
>
>
>
>
> Modified: 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java
> ===================================================================
> --- 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java  
>       2010-08-08 08:07:34 UTC (rev 17231)
> +++ 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java  
>       2010-08-08 19:56:04 UTC (rev 17232)
> @@ -3,7 +3,7 @@
>  * 
> ****************************************************************************/
>
>  /* J_LZ_COPYRIGHT_BEGIN 
> *******************************************************
> -* Copyright 2001-2004, 2008, 2009 Laszlo Systems, Inc.  All Rights Reserved. 
>              *
> +* Copyright 2001-2004, 2008, 2009, 2010 Laszlo Systems, Inc.  All Rights 
> Reserved.              *
>  * Use is subject to license terms.                                           
>  *
>  * J_LZ_COPYRIGHT_END 
> *********************************************************/
>
> @@ -40,6 +40,8 @@
>         "  The name of the output file to write.",
>         "--title titlestring",
>         "  The title of the application to use in the wrapper.",
> +        "--widgettype target",
> +        "  The widget config.xml template to use, defaults to 'opera'",
>         "-v",
>         "  Write progress information to standard output.",
>         "--help",
> @@ -64,6 +66,7 @@
>         String sourcepath = null;
>         String title = null;;
>         String runtime = "dhtml";
> +        String widgetType = null;
>
>         Properties compilationProperties =  new Properties();
>         for (int i = 0; i < args.length; i++) {
> @@ -84,6 +87,8 @@
>                     title = args[++i];
>                 } else if (arg == "-v") {
>                     verbose = true;
> +                } else if (arg == "--widgettype") {
> +                    widgetType = args[++i];
>                 } else if (arg == "--wrapperonly") {
>                     wrapperonly = true;
>                 } else if (arg.startsWith("-D")) {
> @@ -119,7 +124,7 @@
>         }
>
>         if (outfile == null) {
> -            outfile = new File(sourcepath).getName() + ".zip";
> +            outfile = new File(sourcepath).getName() + ".wgt";
>         }
>
>         if (sourcepath == null) {
> @@ -156,6 +161,7 @@
>                                                    new 
> FileOutputStream(outfile),
>                                                    tmpdir,
>                                                    title,
> +                                                   widgetType,
>                                                    compilationProperties,
>                                                    skipfiles));
>             } else if ("swf10".equals(runtime) || "swf8".equals(runtime) || 
> "swf9".equals(runtime)) {
> @@ -168,6 +174,7 @@
>                                                    new 
> FileOutputStream(outfile),
>                                                    tmpdir,
>                                                    title,
> +                                                   widgetType,
>                                                    compilationProperties,
>                                                    skipfiles));
>             } else {
>
> Modified: 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
> ===================================================================
> --- 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
>    2010-08-08 08:07:34 UTC (rev 17231)
> +++ 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
>    2010-08-08 19:56:04 UTC (rev 17232)
> @@ -32,6 +32,7 @@
>  import org.openlaszlo.compiler.Canvas;
>  import org.openlaszlo.compiler.CompilationEnvironment;
>  import org.openlaszlo.compiler.CompilerMediaCache;
> +import org.openlaszlo.utils.FileUtils;
>  import org.openlaszlo.server.LPS;
>  import org.w3c.dom.Document;
>  import org.w3c.dom.Element;
> @@ -79,10 +80,11 @@
>                               String sourcepath,
>                               FileOutputStream outstream,
>                               File tmpdir,
> -                             String title)
> +                             String title,
> +                             String widgetType)
>       throws IOException
>     {
> -        return deploy(wrapperonly, canvas, lpspath, url, sourcepath, 
> outstream, tmpdir, title, null, null);
> +        return deploy(wrapperonly, canvas, lpspath, url, sourcepath, 
> outstream, tmpdir, title, widgetType, null, null);
>     }
>
>     public static int deploy(boolean wrapperonly,
> @@ -93,6 +95,7 @@
>                               FileOutputStream outstream,
>                               File tmpdir,
>                              String title,
> +                             String widgetType,
>                              Properties props,
>                              HashMap skipfiles)
>       throws IOException
> @@ -186,6 +189,13 @@
>         /* Create a DOM for the Canvas XML descriptor  */
>         Element canvasElt = parse(canvasXML);
>
> +        String appwidth = canvasElt.getAttribute("width");
> +        String appheight = canvasElt.getAttribute("height");
> +
> +        if (appwidth.equals("")) { appwidth = "400"; }
> +        if (appheight.equals("")) { appheight = "400"; }
> +
> +
>         // We need to adjust the  wrapper, to make the path to 
> lps/includes/dhtml-embed.js
>         // be relative rather than absolute.
>
> @@ -200,6 +210,7 @@
>         wrapper = wrapper.replaceFirst("serverroot:(.*?),",
>                                        "serverroot: 'lps/resources/',");
>
> +
>         // replace title
>         // wrapper = wrapper.replaceFirst("<title>.*</title>", 
> "<title>"+title+"</title>\n");
>         // extract width and height with regexp
> @@ -261,13 +272,40 @@
>             ZipOutputStream zout = new ZipOutputStream(outstream);
>
>             // create a byte array from lzhistory wrapper text
> -            htmlfile = new File(appname).getName()+".html";
> +            // htmlfile = new File(appname).getName()+".html";
> +            htmlfile = "index.html";
>
> +
>             byte lbytes[] = wrapper.getBytes();
>             //Write out a copy of the lzhistory wrapper as appname.lzx.html
>             //System.out.println("<br>copyFileToZipFile dstfixed="+htmlfile+" 
> lookup "+zippedfiles.contains(htmlfile));
>             copyByteArrayToZipFile(zout, lbytes, htmlfile, zippedfiles);
>
> +         ////////////////
> +         // Write the widget config.xml file
> +
> +         // This is the default, if no template matches widgetType
> +         if (widgetType == null) {
> +             widgetType = "opera";
> +         }
> +         File template = new File(basedir + "/" + 
> "lps/admin/widget-templates/" + "config."+widgetType+".xml");
> +
> +         String configXML = FileUtils.readFileString(template);
> +
> +         // We substitute for these vars
> +
> +         configXML = configXML.replaceAll("%APPURL%", sourcepath);
> +         configXML = configXML.replaceAll("%APPTITLE%", title);
> +         configXML = configXML.replaceAll("%APPHEIGHT%", appheight);
> +         configXML = configXML.replaceAll("%APPWIDTH%", appwidth);
> +
> +         copyByteArrayToZipFile(zout, configXML.getBytes(), "config.xml", 
> zippedfiles);
> +         ////////////////
> +
> +         // Copy widget icon file
> +         copyFileToZipFile(zout, basedir + "/" + 
> "lps/admin/widget-icon.png", "widget-icon.png", zippedfiles);
> +
> +
>             // Compress the include files
>             for (int i=0; i<filenames.size(); i++) {
>                 String srcfile = basedir + "/" + (String) filenames.get(i);
> @@ -311,6 +349,7 @@
>             // Complete the ZIP file
>             zout.close();
>         } catch (IOException e) {
> +            System.err.println("got error "+e.getMessage());
>             // Unix error return code
>             return 1;
>         }
>
> Modified: 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLOSWF.java
> ===================================================================
> --- 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLOSWF.java
>      2010-08-08 08:07:34 UTC (rev 17231)
> +++ 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLOSWF.java
>      2010-08-08 19:56:04 UTC (rev 17232)
> @@ -30,6 +30,7 @@
>  import org.openlaszlo.compiler.Canvas;
>  import org.openlaszlo.compiler.CompilationEnvironment;
>  import org.openlaszlo.compiler.CompilerMediaCache;
> +import org.openlaszlo.utils.FileUtils;
>  import org.openlaszlo.server.LPS;
>  import org.w3c.dom.Document;
>  import org.w3c.dom.Element;
> @@ -71,10 +72,11 @@
>                               String sourcepath,
>                               FileOutputStream outstream,
>                               File tmpdir,
> -                             String title)
> +                             String title,
> +                             String widgetType)
>       throws IOException
>     {
> -        return deploy(runtime, wrapperonly, canvas, lpspath, url, 
> sourcepath, outstream, tmpdir, title, null, null);
> +        return deploy(runtime, wrapperonly, canvas, lpspath, url, 
> sourcepath, outstream, tmpdir, title, widgetType, null, null);
>     }
>
>     public static int deploy(String runtime,
> @@ -86,6 +88,7 @@
>                               FileOutputStream outstream,
>                               File tmpdir,
>                              String title,
> +                             String widgetType,
>                              Properties props,
>                              HashMap skipfiles)
>       throws IOException
> @@ -172,6 +175,14 @@
>         /* Create a DOM for the Canvas XML descriptor  */
>         Element canvasElt = parse(canvasXML);
>
> +        String appwidth = canvasElt.getAttribute("width");
> +        String appheight = canvasElt.getAttribute("height");
> +
> +        if (appwidth.equals("")) { appwidth = "400"; }
> +        if (appheight.equals("")) { appheight = "400"; }
> +
> +
> +
>         // We need to adjust the  wrapper, to make the path to 
> lps/includes/dhtml-embed.js
>         // be relative rather than absolute.
>
> @@ -250,13 +261,38 @@
>             ZipOutputStream zout = new ZipOutputStream(outstream);
>
>             // create a byte array from lzhistory wrapper text
> -            htmlfile = new File(appname).getName()+".html";
> +            //htmlfile = new File(appname).getName()+".html";
> +            htmlfile = "index.html";
>
>             byte lbytes[] = wrapper.getBytes();
>             //Write out a copy of the lzhistory wrapper as appname.lzx.html
>             //System.out.println("<br>copyFileToZipFile dstfixed="+htmlfile+" 
> lookup "+zippedfiles.contains(htmlfile));
>             copyByteArrayToZipFile(zout, lbytes, htmlfile, zippedfiles);
>
> +            ////////////////
> +            // Write the widget config.xml file
> +
> +         // This is the default, if no template matches widgetType
> +         if (widgetType == null) {
> +             widgetType = "opera";
> +         }
> +         File template = new File(basedir + "/" + 
> "lps/admin/widget-templates/" + "config."+widgetType+".xml");
> +
> +         String configXML = FileUtils.readFileString(template);
> +
> +         // We substitute for these vars
> +
> +         configXML = configXML.replaceAll("%APPURL%", sourcepath);
> +         configXML = configXML.replaceAll("%APPTITLE%", title);
> +         configXML = configXML.replaceAll("%APPHEIGHT%", appheight);
> +         configXML = configXML.replaceAll("%APPWIDTH%", appwidth);
> +
> +         copyByteArrayToZipFile(zout, configXML.getBytes(), "config.xml", 
> zippedfiles);
> +            ////////////////
> +
> +            // Copy widget icon file
> +            copyFileToZipFile(zout, basedir + "/" + 
> "lps/admin/widget-icon.png", "widget-icon.png", zippedfiles);
> +
>             // Compress the include files
>             for (int i=0; i<filenames.size(); i++) {
>                 String srcfile = basedir + "/" + (String) filenames.get(i);
> @@ -284,6 +320,7 @@
>             // Complete the ZIP file
>             zout.close();
>         } catch (IOException e) {
> +            System.err.println("got error "+e.getMessage());
>             // Unix error return code
>             return 1;
>         }
>
> Modified: 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/LZHttpUtils.java
> ===================================================================
> --- 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/LZHttpUtils.java 
>       2010-08-08 08:07:34 UTC (rev 17231)
> +++ 
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/LZHttpUtils.java 
>       2010-08-08 19:56:04 UTC (rev 17232)
> @@ -24,9 +24,16 @@
>  import org.apache.commons.httpclient.URIException;
>
>  import java.text.SimpleDateFormat;
> +import java.util.Arrays;
> +import java.util.ArrayList;
> +import java.util.List;
> +import java.util.HashMap;
> +import java.util.StringTokenizer;
>  import java.util.TimeZone;
>  import java.util.Date;
>  import java.util.Enumeration;
> +import java.util.regex.Matcher;
> +import java.util.regex.Pattern;
>  import java.security.*;
>
>  import org.apache.log4j.*;
> @@ -522,4 +529,88 @@
>         return (needToChange? sb.toString() : s);
>     }
>
> +    /**
> +       Parse out options value from lzoptions, of the form
> +           ?lzoptions=runtime(dhtml),wrapper(html),debug(false),proxy(true)
> +           For boolean options, we default that if they are present they are 
> true, if not they are false so:
> +           ?lzoptions=runtime(dhtml),wrapper(html),proxy
> +           would be the same as the above.
> +
> +           multiple comma separated values can be passed in args list, e.g.,
> +
> +           ?lzoptions=runtime(swf10),package(widget,android)
> +
> +           @return hashmap of key=>List
> +     */
> +    private static final int KEY = 1;
> +    private static final int ARGS = 2;
> +
> +    public static HashMap getLzRequestOptions(String query) {
> +        HashMap options = new HashMap();
> +        int mystate = KEY;
> +        List vals = new ArrayList();
> +        String lastkey = null;
> +        int nvals = 0;
> +
> +        StringTokenizer st = new StringTokenizer(query, ",()", true);
> +        while (st.hasMoreTokens()) {
> +            String token = st.nextToken();
> +            switch(mystate) {
> +              case KEY:
> +                if (token.equals(",")) {
> +                    // we only saw key name, but no value, so give it an 
> implicit true value.
> +                    if (lastkey != null && nvals == 0) {
> +                        options.put(lastkey, Arrays.asList(new 
> String[]{"true"}));
> +                    }
> +                } else if (token.equals("(")) {
> +                    mystate = ARGS;
> +                    vals = new ArrayList();
> +                    options.put(lastkey, vals);
> +                } else {
> +                    lastkey = token;
> +                }
> +                break;
> +              case ARGS:
> +                if (token.equals(")")) {
> +                    lastkey = null;
> +                    mystate = KEY;
> +                    nvals = 0;
> +                } else if (token.equals(",")) {
> +
> +                } else {
> +                    vals.add(token);
> +                    nvals++;
> +                }
> +                break;
> +            }
> +        }
> +        if (lastkey != null && nvals == 0) {
> +            options.put(lastkey, Arrays.asList(new String[]{"true"}));
> +        }
> +
> +        return options;
> +    }
> +
> +    public static String getLzOption(String key, HashMap options) {
> +        List vals = (List) (options.get(key));
> +        if (vals == null) {
> +            return null;
> +        } else {
> +            return (String) vals.get(0);
> +        }
> +    }
> +
> +
> +    // Look for new style lzoptions, then fall back to old style discrete 
> query args
> +    public static String getLzOption(String key, HttpServletRequest req) {
> +        String lzoptions = req.getParameter("lzoptions");
> +        if (lzoptions == null) {
> +            // revert to old behavior
> +            return req.getParameter(key);
> +        } else {
> +            HashMap optionsmap = LZHttpUtils.getLzRequestOptions(lzoptions);
> +            return LZHttpUtils.getLzOption(key, optionsmap);
> +        }
> +    }
> +
>  }
>
> Modified: openlaszlo/trunk/lps/admin/solo-deploy.jsp
> ===================================================================
> --- openlaszlo/trunk/lps/admin/solo-deploy.jsp  2010-08-08 08:07:34 UTC (rev 
> 17231)
> +++ openlaszlo/trunk/lps/admin/solo-deploy.jsp  2010-08-08 19:56:04 UTC (rev 
> 17232)
> @@ -16,7 +16,7 @@
>
>  <html>
>     <head>
> -    <title>SOLO Application Deployment Wizard</title>
> +    <title>OpenLaszlo Widget Application Deployment Wizard</title>
>     </head>
>     <body>
>
> @@ -69,6 +69,11 @@
>  String appwidth = request.getParameter("appwidth");
>  String appheight = request.getParameter("appheight");
>
> +// The "widgettype" arg controls which flavor of config.xml file we generate.
> +// We will look for a config file named config.WIDGET_TYPE.xslt,
> +// fallback to Opera format config file
> +String widgetType = request.getParameter("widgettype");
> +
>  // Get app width/height from its canvas wrapper
>
>  // download text content of URL
> @@ -119,7 +124,7 @@
>  You entered <tt><i><%= appUrl %></i></tt>, which names a file in the server 
> document root directory. Please
>  place the file in a subdirectory of the server root directory and try
>  again with the new path.<p>
> -              Explanation: The SOLO deployment tool creates an
> +              Explanation: The widget deployment tool creates an
>  archive of all files, recursively, starting in the directory that
>  contains the application source file.  If the application source file
>  is in the servlet root container, this tool will create a zip that
> @@ -228,18 +233,18 @@
>     // if no form vars, we are at page #0
>     if (whatpage.equals("configure")) {
>  %>
> -<font face="helvetica,arial"> <b> <i> Setup SOLO Application Deployment</i> 
> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Setup Widget Application 
> Deployment</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>
>
>  <br>
>
>  <table><tr><td width=600>
> -     This wizard will generate a zip file containing all the resources you 
> need to deploy a serverless (SOLO) application. For deployments which do not 
> require browser the Javscript browser integration support files, it  will 
> also generate some simple HTML wrappers which can be cut and pasted into HTML 
> pages.
> +     This wizard will generate a zip file containing all the resources you 
> need to deploy a serverless SOLO widget application. For deployments which do 
> not require browser the Javscript browser integration support files, it  will 
> also generate some simple HTML wrappers which can be cut and pasted into HTML 
> pages.
>  </td></tr><table>
>
>  <form  method="POST" action="<%= sUrl %>">
> -<input type="hidden" name="runtime" value="<%= appRuntime %>">
> +<input type="hidden" name="runtime" value="<%= appRuntime %>">
>  <input type="hidden" name="whatpage" value="preview">
>  <table border=0 width=800>
>   <tr>
> @@ -250,6 +255,14 @@
>   <tr>
>     <td align="right">Title for web page:</td><td><input name="apptitle" 
> size="40" type="text" value="Laszlo Application"/></td>
>   </tr>
> +  <tr>
> +     <td align="right">Widget Type (config.xml file):</td><td>
> +<select name="widgettype">
> +<option value="opera" selected>Opera</option>
> +<option value="jil">Android</option>
> +</select>
> +</td>
> +  </tr>
>   <tr><td/><td/></tr>
>
>  </table>
> @@ -266,7 +279,7 @@
>
>
>  %>
> -<font face="helvetica,arial"> <b> <i> Preview SOLO Application in 
> Browser</i> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Preview Widget Application in 
> Browser</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>  <p>
>
> @@ -291,6 +304,7 @@
>  <input type="hidden" name="appurl" value="<%= appUrl %>">
>  <input type="hidden" name="apptitle" value="<%= title %>">
>  <input type="hidden" name="runtime" value="<%= appRuntime %>">
> +<input type="hidden" name="widgettype" value="<%= widgetType %>">
>
>  <p>
>  <input type=submit value="Continue...">
> @@ -341,17 +355,40 @@
>          // Create the ZIP file
>          SimpleDateFormat format =
>              new SimpleDateFormat("MMM_dd_yyyy_HH_mm_ss");
> -         String outFilename = "solo_deploy_" + format.format(new Date()) + 
> ".zip";
> +         String outFilename = "solo_deploy_" + format.format(new Date()) + 
> ".wgt";
>          zipfilename = outFilename;
>          ZipOutputStream zout = new ZipOutputStream(new 
> FileOutputStream(tmpdir+"/"+outFilename));
>
>          // create a byte array from lzhistory wrapper text
> -         htmlfile = new File(appUrl).getName()+".html";
> -
> +         //htmlfile = new File(appUrl).getName()+".html";
> +         htmlfile = "index.html";
>          byte lbytes[] = lzhistwrapper.getBytes();
> -
>          copyByteArrayToZipFile(zout, lbytes, htmlfile, zippedfiles);
>
> +         ////////////////
> +         // Write the widget config.xml file
> +
> +         // This is the default, if no template matches widgetType
> +         if (widgetType == null) {
> +             widgetType = "opera";
> +         }
> +         File template = new File(basedir + "/" + 
> "lps/admin/widget-templates/" + "config."+widgetType+".xml");
> +
> +         String configXML = readFile(template);
> +
> +         // We substitute for these vars
> +
> +         configXML = configXML.replaceAll("%APPURL%", appUrl);
> +         configXML = configXML.replaceAll("%APPTITLE%", title);
> +         configXML = configXML.replaceAll("%APPHEIGHT%", appheight);
> +         configXML = configXML.replaceAll("%APPWIDTH%", appwidth);
> +
> +         copyByteArrayToZipFile(zout, configXML.getBytes(), "config.xml", 
> zippedfiles);
> +         ////////////////
> +
> +         // Copy widget icon file
> +         copyFileToZipFile(zout, basedir + "/" + 
> "lps/admin/widget-icon.png", "widget-icon.png", zippedfiles);
> +
>          // Compress the include files
>          for (int i=0; i<filenames.size(); i++) {
>              String srcfile = basedir + "/" + (String) filenames.get(i);
> @@ -378,7 +415,7 @@
>
>                  warned = true;
>                  %>
> -                <h3><font color="red">The zip file has had more than <%= 
> warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what 
> you intended, but remember that the SOLO deployment tool creates an
> +                <h3><font color="red">The zip file has had more than <%= 
> warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what 
> you intended, but remember that the Widget deployment tool creates an
>  archive of all files, recursively, from the directory that
>  contains your specified application source file.  If your application source 
> file
>  is in a directory with other apps, this tool will create a zip that
> @@ -407,14 +444,14 @@
>  Click here to download zip-archived file <a 
> href="<%=zipfilename%>"><tt><%=zipfilename%></tt></a>.
>  <p>
>  In the zip file, a wrapper HTML file named <tt><%= htmlfile %></tt> has been 
> created
> -to launch your SOLO application.
> +to launch your SOLO widget application.
>  <p>
>
>
>  Note: the file may take a moment to generate and save to disk, please be 
> patient.
>
>   <p>
> -<font face="helvetica,arial"> <b> <i> SOLO Application Deployment: Wrapper 
> HTML</i> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Widget Application Deployment: Wrapper 
> HTML</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>  <p>
>  Paste this wrapper into a browser to deploy your app:
> @@ -561,6 +598,17 @@
>  }
>
>
> +public String readFile(File file)
> +  throws IOException
> +{
> +    java.io.InputStream istr = new java.io.FileInputStream(file);
> +    byte bytes[] = new byte[istr.available()];
> +    istr.read(bytes);
> +    istr.close();
> +    return new String(bytes, "UTF-8");
> +}
> +
> +
>  public String fixSlashes (String path) {
>        return(path.replace('\\', '/'));
>  }
>
> Modified: openlaszlo/trunk/lps/admin/solo-dhtml-deploy.jsp
> ===================================================================
> --- openlaszlo/trunk/lps/admin/solo-dhtml-deploy.jsp    2010-08-08 08:07:34 
> UTC (rev 17231)
> +++ openlaszlo/trunk/lps/admin/solo-dhtml-deploy.jsp    2010-08-08 19:56:04 
> UTC (rev 17232)
> @@ -24,7 +24,7 @@
>
>  <html>
>     <head>
> -    <title>SOLO HTML5 Application Deployment Wizard</title>
> +    <title>W3C Widget HTML5 Application Deployment Wizard</title>
>     </head>
>     <body>
>
> @@ -81,6 +81,12 @@
>  String appwidth = request.getParameter("appwidth");
>  String appheight = request.getParameter("appheight");
>
> +// The "widgettype" arg controls which flavor of config.xml file we generate.
> +// We will look for a config file named config.WIDGET_TYPE.xslt,
> +// fallback to Opera format config file
> +String widgetType = request.getParameter("widgettype");
> +
> +
>  // Get app width/height from its canvas wrapper
>
>  // download text content of URL
> @@ -133,7 +139,7 @@
>  You entered <tt><i><%= appUrl %></i></tt>, which names a file in the server 
> document root directory. Please
>  place the file in a subdirectory of the server root directory and run this 
> deployment tool
>  again with the new path.<p>
> -              Explanation: The SOLO deployment tool creates an
> +              Explanation: The W3C Widget deployment tool creates an
>  archive of all files, recursively, starting in the directory that
>  contains the application source file.  If the application source file
>  is in the servlet root directory, this tool will create a zip that
> @@ -175,7 +181,7 @@
>         String canvasdebug = canvasElt.getAttribute("debug");
>         if ("true".equals(canvasdebug)) {
>             %> <h2><font color="red">Note: your app has its canvas debug flag 
> enabled,
> -                the Laszlo DHTML debugger curently does not work in a 
> standalone SOLO deployment, continue?</h2>
> +                the Laszlo DHTML debugger curently does not work in a 
> standalone widget deployment, continue?</h2>
>                 <%
>         }
>
> @@ -264,14 +270,14 @@
>  if (whatpage.equals("configure")) {
>  %>
>
> -<font face="helvetica,arial"> <b> <i> Setup SOLO HTML5 Application 
> Deployment</i> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Setup W3C Widget HTML5 Application 
> Deployment</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>
>
>  <br>
>
>  <table><tr><td width=600>
> -     This wizard will generate a zip file containing all the resources you 
> need to deploy a serverless (SOLO) application. For deployments which do not 
> require the Javscript browser integration support files, it  will also 
> generate some simple HTML wrappers which can be cut and pasted into HTML 
> pages.
> +     This wizard will generate a zip file containing all the resources you 
> need to deploy a serverless (Widget) application. For deployments which do 
> not require the Javscript browser integration support files, it  will also 
> generate some simple HTML wrappers which can be cut and pasted into HTML 
> pages.
>  </td></tr><table>
>
>  <form  method="POST" action="<%= sUrl %>">
> @@ -285,6 +291,14 @@
>   <tr>
>     <td align="right">Title for web page:</td><td><input name="apptitle" 
> size="40" type="text" value="Laszlo Application"/></td>
>   </tr>
> +  <tr>
> +     <td align="right">Widget Type (config.xml file):</td><td>
> +<select name="widgettype">
> +<option value="opera" selected>Opera</option>
> +<option value="jil">Android</option>
> +</select>
> +</td>
> +  </tr>
>   <tr><td/><td/></tr>
>
>
> @@ -301,9 +315,9 @@
>
>  <table><tr><td width=600>
>
> -The SOLO deployment tool creates a
> +The W3C Widget deployment tool creates a
>  Zip archive of <i>all</i> files, recursively, from the <i>directory</i> that
> -contains your specified application source file. So it is best to use this 
> SOLO tool
> +contains your specified application source file. So it is best to use this 
> tool
>  on an application which resides in its own directory.
>  If there are other applications in the same directory, this tool will copy
>  all of those apps and their assets (and subdirectories) into the Zip file. 
> That may not be what you want.
> @@ -318,7 +332,7 @@
>
>
>  %>
> -<font face="helvetica,arial"> <b> <i> Preview SOLO Application in 
> Browser</i> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Preview W3C Widget Application in 
> Browser</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>  <p>
>
> @@ -343,6 +357,7 @@
>  <p>
>  <input type=radio name="whatpage" value="configure">Go back to change</td>
>  <input type="hidden" name="appurl" value="<%= appUrl %>">
> +<input type="hidden" name="widgettype" value="<%= widgetType %>">
>  <input type="hidden" name="apptitle" value="<%= title %>">
>
>  <p>
> @@ -381,8 +396,8 @@
>      filenames.add("lps/includes/embed-compressed.js");
>      filenames.add("lps/includes/blank.gif");
>      filenames.add("lps/includes/spinner.gif");
> -     filenames.add("lps/includes/excanvas.js");
> -     filenames.add("lps/includes/iframemanager.js");
> +     filenames.add("lps/includes/excanvas.js");
> +     filenames.add("lps/includes/iframemanager.js");
>      filenames.add("lps/includes/rtemanager.js");
>      filenames.add("lps/includes/laszlo-debugger.css");
>      filenames.add("lps/includes/laszlo-debugger.html");
> @@ -398,17 +413,47 @@
>          // Create the ZIP file
>          SimpleDateFormat format =
>              new SimpleDateFormat("MMM_dd_yyyy_HH_mm_ss");
> -         String outFilename = "solo_deploy_" + format.format(new Date()) + 
> ".zip";
> +         String datestamp = format.format(new Date());
> +         String outFilename = "solo_deploy_" + datestamp + ".wgt";
>          zipfilename = outFilename;
>          ZipOutputStream zout = new ZipOutputStream(new 
> FileOutputStream(tmpdir+"/"+outFilename));
> +
> +         ////////////////
> +         // Create wrapper .html file, we make a byte array from
> +         // lzhistory wrapper text, and write it to the zip archive.
> +         //
> +         //htmlfile = new File(appUrl).getName()+".html";
> +         htmlfile = "index.html";
>
> -         // create a byte array from lzhistory wrapper text
> -         htmlfile = new File(appUrl).getName()+".html";
> -
>          byte lbytes[] = wrapper.getBytes();
>          //Write out a copy of the lzhistory wrapper as appname.lzx.html
>          copyByteArrayToZipFile(zout, lbytes, htmlfile, zippedfiles);
> +         ////////////////
>
> +         ////////////////
> +         // Write the widget config.xml file
> +
> +         // This is the default, if no template matches widgetType
> +         if (widgetType == null) {
> +             widgetType = "opera";
> +         }
> +         File template = new File(basedir + "/" + 
> "lps/admin/widget-templates/" + "config."+widgetType+".xml");
> +
> +         String configXML = readFile(template);
> +
> +         // We substitute for these vars
> +
> +         configXML = configXML.replaceAll("%APPURL%", appUrl);
> +         configXML = configXML.replaceAll("%APPTITLE%", title);
> +         configXML = configXML.replaceAll("%APPHEIGHT%", appheight);
> +         configXML = configXML.replaceAll("%APPWIDTH%", appwidth);
> +
> +         copyByteArrayToZipFile(zout, configXML.getBytes(), "config.xml", 
> zippedfiles);
> +         ////////////////
> +
> +         // Copy widget icon file
> +         copyFileToZipFile(zout, basedir + "/" + 
> "lps/admin/widget-icon.png", "widget-icon.png", zippedfiles);
> +
>          // Compress the include files
>          for (int i=0; i<filenames.size(); i++) {
>              String srcfile = basedir + "/" + (String) filenames.get(i);
> @@ -450,7 +495,7 @@
>
>              warned = true;
>              %>
> -                 <h3><font color="red">The zip file has had more than <%= 
> warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what 
> you intended, but remember that the SOLO deployment tool creates an
> +                 <h3><font color="red">The zip file has had more than <%= 
> warnZipFileSize / 1000000 %>MB of content added to it, perhaps this is what 
> you intended, but remember that the widget deployment tool creates an
>                       archive of all files, recursively, from the directory 
> that
>                       contains your specified application source file.  If 
> your application source file
>                       is in a directory with other apps, this tool will 
> create a zip that
> @@ -480,15 +525,15 @@
>
>  Click here to download zip-archived file <a 
> href="<%=zipfilename%>"><tt><%=zipfilename%></tt></a>.
>  <p>
> -In the zip file, a wrapper HTML file named <tt><%= htmlfile %></tt> has been 
> created
> -to launch your SOLO application.
> +In the .wgt zip file, a wrapper HTML file named <tt><%= htmlfile %></tt> has 
> been created
> +to launch your widget application.
>  <p>
>
>
>  Note: the file may take a moment to generate and save to disk, please be 
> patient.
>
>   <p>
> -<font face="helvetica,arial"> <b> <i> SOLO Application Deployment: Wrapper 
> HTML</i> </b> </font>
> +<font face="helvetica,arial"> <b> <i> Widget Application Deployment: Wrapper 
> HTML</i> </b> </font>
>  <hr align="left" width="420" height="2"/>
>  <p>
>  Paste this wrapper into a browser to deploy your app:
> @@ -577,6 +622,19 @@
>     return null;
>  }
>
> +
> +public String readFile(File file)
> +  throws IOException
> +{
> +    java.io.InputStream istr = new java.io.FileInputStream(file);
> +    byte bytes[] = new byte[istr.available()];
> +    istr.read(bytes);
> +    istr.close();
> +    return new String(bytes, "UTF-8");
> +}
> +
> +
> +
>  public Element parse(String content, javax.servlet.jsp.JspWriter out) throws 
> IOException {
>     try {
>         // Create a DOM builder and parse the fragment
>
> Added: openlaszlo/trunk/lps/admin/widget-icon.png
>
>
> Property changes on: openlaszlo/trunk/lps/admin/widget-icon.png
> ___________________________________________________________________
> Name: svn:mime-type
>   + application/octet-stream
>
> Added: openlaszlo/trunk/lps/admin/widget-templates/config.jil.xml
>
>
> Property changes on: 
> openlaszlo/trunk/lps/admin/widget-templates/config.jil.xml
> ___________________________________________________________________
> Name: svn:mime-type
>   + text/plain
> Name: svn:eol-style
>   + native
>
> Added: openlaszlo/trunk/lps/admin/widget-templates/config.opera.xml
>
>
> Property changes on: 
> openlaszlo/trunk/lps/admin/widget-templates/config.opera.xml
> ___________________________________________________________________
> Name: svn:mime-type
>   + text/plain
> Name: svn:eol-style
>   + native
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
>

Reply via email to