| 1362 | | application. You can view the initial page easily by opening an |
| 1363 | | application in a web browser and viewing its source code. The easiest way |
| 1364 | | to embed an application is simply to copy and paste the embedding code |
| 1365 | | from the initial page. |
| | 1362 | application. You can easily configure it to load multiple IT Mill Toolkit |
| | 1363 | applications on the same page, assuming that they use the same widget set. |
| | 1364 | </para> |
| | 1365 | |
| | 1366 | <para> |
| | 1367 | You can view the initial page for your application easily simply by |
| | 1368 | opening the application in a web browser and viewing the HTML source |
| | 1369 | code. You could just copy and paste the embedding code from the default |
| | 1370 | initial page. It has, however, some extra functionality that is not |
| | 1371 | normally needed: it generates some of the script content with |
| | 1372 | <methodname>document.write()</methodname> calls, which is useful only |
| | 1373 | when you are running the application as a portlet in a portal. The method |
| | 1374 | outlined below is much simpler. |
| | 1375 | </para> |
| | 1376 | |
| | 1377 | <para> |
| | 1378 | The <filename>WebContent/multiapp.html</filename> file included in the IT |
| | 1379 | Mill Toolkit installation package provides an example of embedding |
| | 1380 | (multiple) IT Mill Toolkit applications in a page. After launching the |
| | 1381 | demo application, you can view the example at URL |
| | 1382 | <uri>http://localhost:8888/multiapp.html</uri>. Notice that the example |
| | 1383 | assumes the use of root context for the applications |
| | 1384 | (<parameter>/</parameter>). |
| 1390 | | associative map that contains parameters for the engine. The two |
| 1391 | | required parameters are the application URI, |
| 1392 | | <varname>appUri</varname>, and path info, |
| 1393 | | <varname>pathInfo</varname>. They are defined simply as follows: |
| | 1409 | associative map that can contain various runtime data used by the |
| | 1410 | Client-Side Engine of IT Mill Toolkit. The |
| | 1411 | <varname>toolkitConfigurations</varname> item is itself an |
| | 1412 | associate map that contains parameters for each of the |
| | 1413 | applications embedded in the page. The map must contain the |
| | 1414 | following items: |
| 1396 | | <programlisting> <script type="text/javascript"> |
| 1397 | | var itmill = {appUri:'Calc', pathInfo: '/'}; |
| 1398 | | </script></programlisting> |
| | 1417 | <table> |
| | 1418 | <title>toolkitConfigurations parameters</title> |
| | 1419 | <tgroup cols="2" align="left"> |
| | 1420 | <tbody> |
| | 1421 | <row valign="top"> |
| | 1422 | <entry><classname>appUri</classname></entry> |
| | 1423 | <entry>The application URI consists of the context and |
| | 1424 | the application path. If the context is |
| | 1425 | <literal>/mycontext</literal> and the application path |
| | 1426 | is <literal>myapp</literal>, the |
| | 1427 | <parameter>appUri</parameter> would be |
| | 1428 | <literal>/mycontext/myapp</literal>. The |
| | 1429 | <filename>multiapp.html</filename> example assumes the |
| | 1430 | use of root context, which is used in the demo |
| | 1431 | application.</entry> |
| | 1432 | </row> |
| | 1433 | <row valign="top"> |
| | 1434 | <entry><classname>pathInfo</classname></entry> |
| | 1435 | <entry>The <parameter>PATHINFO</parameter> parameter |
| | 1436 | for the Servlet.</entry> |
| | 1437 | </row> |
| | 1438 | <row valign="top"> |
| | 1439 | <entry><classname>themeUri</classname></entry> |
| | 1440 | <entry>URI of the application theme. The URI must |
| | 1441 | include application context and the path to the theme |
| | 1442 | directory. Themes are, by default, stored under the |
| | 1443 | <filename>/ITMILL/themes/</filename> path.</entry> |
| | 1444 | </row> |
| | 1445 | <row valign="top"> |
| | 1446 | <entry><classname>versionInfo</classname></entry> |
| | 1447 | <entry>This item is itself an associative map that |
| | 1448 | contains two parameters: |
| | 1449 | <parameter>toolkitVersion</parameter> contains the |
| | 1450 | version number of the IT Mill Toolkit version used by |
| | 1451 | the application. The |
| | 1452 | <parameter>applicationVersion</parameter> parameter |
| | 1453 | contains the version of the particular |
| | 1454 | application.</entry> |
| | 1455 | </row> |
| | 1456 | </tbody> |
| | 1457 | </tgroup> |
| | 1458 | </table> |
| | 1459 | |
| | 1460 | <para> |
| | 1461 | The following example defines two applications to run in the same |
| | 1462 | window: the Calculator and Hello World examples. In the example, |
| | 1463 | the application context is <literal>/tk5</literal>. |
| | 1464 | </para> |
| | 1465 | |
| | 1466 | <programlisting><script type="text/javascript"> |
| | 1467 | var itmill = { |
| | 1468 | toolkitConfigurations: { |
| | 1469 | '<emphasis role="bold">calc</emphasis>': { |
| | 1470 | appUri:'<emphasis role="bold">/tk5/Calc</emphasis>', |
| | 1471 | pathInfo: '<emphasis role="bold">/</emphasis>', |
| | 1472 | themeUri: '<emphasis role="bold">/tk5/ITMILL/themes/example</emphasis>', |
| | 1473 | versionInfo : { |
| | 1474 | toolkitVersion:"5.9.9-INTERNAL-NONVERSIONED-DEBUG-BUILD", |
| | 1475 | applicationVersion:"NONVERSIONED" |
| | 1476 | } |
| | 1477 | }, |
| | 1478 | '<emphasis role="bold">hello</emphasis>': { |
| | 1479 | appUri:'<emphasis role="bold">/tk5/HelloWorld</emphasis>', |
| | 1480 | pathInfo: '<emphasis role="bold">/</emphasis>', |
| | 1481 | themeUri: '<emphasis role="bold">/tk5/ITMILL/themes/example</emphasis>', |
| | 1482 | versionInfo : { |
| | 1483 | toolkitVersion:"5.9.9-INTERNAL-NONVERSIONED-DEBUG-BUILD", |
| | 1484 | applicationVersion:"NONVERSIONED" |
| | 1485 | } |
| | 1486 | } |
| | 1487 | }}; |
| | 1488 | </script></programlisting> |