ION Script User’s Guide
ION Version 6.3 April 2006 Edition Copyright © RSI All Rights Reserved
0406ION63SCR Restricted Rights Notice The IDL®, ION Script™, and ION Java™ software programs and the accompanying procedures, functions, and documentation described herein are sold under license agreement. Their use, dupli- cation, and disclosure are subject to the restrictions stated in the license agreement. RSI reserves the right to make changes to this document at any time and without notice. Limitation of Warranty RSI makes no warranties, either express or implied, as to any matter not expressly set forth in the license agreement, including without limitation the condition of the software, merchantability, or fitness for any particular purpose. RSI shall not be liable for any direct, consequential, or other damages suffered by the Licensee or any others resulting from use of the IDL or ION software packages or their documentation. Permission to Reproduce this Manual If you are a licensed user of this product, RSI grants you a limited, nontransferable license to repro- duce this particular document provided such copies are for your use only and are not sold or dis- tributed to third parties. All such copies must contain the title page and this notice page in their entirety. Acknowledgments
IDL® is a registered trademark and ION™, ION Script™, ION Java™, are trademarks of ITT Industries, registered in the United States Patent and Trademark Office, for the computer program described herein. Numerical Recipes™ is a trademark of Numerical Recipes Software. Numerical Recipes routines are used by permission. GRG2™ is a trademark of Windward Technologies, Inc. The GRG2 software for nonlinear optimization is used by permission. NCSA Hierarchical Data Format (HDF) Software Library and Utilities Copyright 1988-2001 The Board of Trustees of the University of Illinois All rights reserved. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright 1998-2002 by the Board of Trustees of the University of Illinois. All rights reserved. CDF Library Copyright © 2002 National Space Science Data Center NASA/Goddard Space Flight Center NetCDF Library Copyright © 1993-1999 University Corporation for Atmospheric Research/Unidata HDF EOS Library Copyright © 1996 Hughes and Applied Research Corporation This software is based in part on the work of the Independent JPEG Group. Portions of this software are copyrighted by DataDirect Technologies, 1991-2003. Portions of this software were developed using Unisearch's Kakadu software, for which Kodak has a commercial license. Kakadu Software. Copyright © 2001. The University of New South Wales, UNSW, Sydney NSW 2052, Australia, and Unisearch Ltd, Australia. Portions of this computer program are copyright © 1995-1999 LizardTech, Inc. All rights reserved. MrSID is protected by U.S. Patent No. 5,710,835. Foreign Patents Pending. Portions of this software are copyrighted by Merge Technologies Incorporated. IDL Wavelet Toolkit Copyright © 2002 Christopher Torrence. Other trademarks and registered trademarks are the property of the respective trademark holders. Contents
Chapter 1 Configuring ION Script ...... 9 Configuring ION Script for Windows ...... 10 The Images Tab ...... 10 The URLs Tab ...... 11 The Files Tab ...... 12 The Format Tab ...... 13 The Debug Tab ...... 13 Configuring ION Script for UNIX ...... 14 Manually Configuring Your UNIX Web Server ...... 16 ION Script Configuration Options ...... 18 Images ...... 18 URLs ...... 19 Files ...... 20 Format ...... 23 Debug ...... 24
ION Script User’s Guide 3 4
Chapter 2 Overview of ION Script ...... 27 ION Script and ION Java ...... 28 ION Script ...... 28 ION Java ...... 28 Which Product Should I Use? ...... 28 What Is ION Script? ...... 30 ION Script Pages ...... 30 ION Script Applications ...... 34 Anatomy of an ION Script Application ...... 34 Example ...... 36 Requesting an ION Script Page ...... 39 Where to Store Your Files ...... 41 How HTML Files Are Normally Requested ...... 41 ION Script Files ...... 41 Keeping .ion and .html Files in the Same Place ...... 42 IDL Files ...... 42 Running the ION Script Examples ...... 44 Chapter 3 Variables, Expressions & Operators ...... 45 Variables ...... 46 Declaring & Assigning Values ...... 46 Variable Types ...... 46 Assigning String Literals to ION Script Variables ...... 48 Determining Variable Type ...... 48 Null Strings Versus Undefined Strings ...... 49 Variable Names ...... 49 Variable Scope ...... 50 Variable Persistence ...... 51 ION System Variables ...... 52 $Browser ...... 52 $Document ...... 53 $Form ...... 55 $FormURL ...... 56 $ION ...... 60
Contents ION Script User’s Guide 5
$Mouse ...... 61 Expressions ...... 63 Values ...... 63 Expression Types ...... 63 Operators ...... 66 Mathematical Operators ...... 66 String Operators ...... 66 Comparison Operators ...... 67 Logical Operators ...... 68 Operator Precedence ...... 69 Chapter 4 Creating ION Script Applications ...... 71 Specifying URLs ...... 72 HTTP URLs ...... 73 HTTPS URLs ...... 73 File URLs ...... 74 ION URLs ...... 74 Absolute Paths vs. the ION Search Path ...... 75 HTML Forms vs. ION Script Forms ...... 76 Passing Name/Value Pairs in a URL ...... 77 Passing ION Script Variables in a URL ...... 77 Passing Multiple Values with the Same Name ...... 78 Handling Multiple Selections in a SELECT Element ...... 79 Parsing the $Form Variable in an
ION Script User’s Guide Handling Multiple Selections in a SELECT Element 82 Chapter 4: Creating ION Script Applications Passing IDL Variables to ION Script
There may be cases in which you need to access the value of an IDL variable in your ION Script application. This can be accomplished by writing IDL code that writes an ION_EVALUATE tag to a temporary file, and using ION_INCLUDE to include the IDL-generated ION_EVALUTE tag in your ION Script page. For example, suppose you want to conditionally execute ION Script code depending on the value of an IDL variable. In the following example, the user enters a number and submits the form. The number entered is passed to IDL, which evaluates the square root of the number, and writes an ION_EVALUATE tag containing the square root to a temporary file. The ION Script page contains an ION_IF block that conditionally executes code depending on the value of the variable defined in the IDL-generated ION_EVALUTE tag. First, we create the form in which the user enters a number: page1.ion
In the action page of this form, page2.ion, we initialize two variables: the $TEMPFILE variable is used to hold the name of the temporary file that IDL will create, and the $IDLVALUE variable holds the value of the IDL variable. Then we use ION_EVALUATE to define the value of the $TEMPFILE variable using the $ION.uniqueID system variable to ensure the name of our temporary file does not collide with any other filenames. Next, we use ION_DATA_OUT to call an IDL function defined in writefile.pro. This IDL function accepts the value of $TEMPFILE and the value entered by the user,
Passing IDL Variables to ION Script ION Script User’s Guide Chapter 4: Creating ION Script Applications 83
calculates the square root, and defines the value of $IDLVALUE by writing the result as an ION_EVALUTE string to the file defined by $TEMPFILE. The ION Script page then includes this temporary file, thereby re-evaluating the value of the $IDLVALUE variable. An ION_IF block then conditionally evaluates the $IDLVALUE variable written by IDL. page2.ion
writefile.pro PRO writefile,tempfile, val A = SQRT(val) OPENW,lun,tempfile,/GET_LUN, ERROR=err if err NE 0 then begin print,!ERROR_STATE.MSG RETURN endif PRINTF,lun,'
ION Script User’s Guide Passing IDL Variables to ION Script 84 Chapter 4: Creating ION Script Applications Using Frames with ION Script
Frames are a useful tool for simplifying the navigation of a Web site, and offering different ways to present your information. It is often desirable to simultaneously display information from different sources in the same browser window, rather than force the user to navigate back and forth between pages. Creating framed ION Script pages is no different than creating framed HTML pages: you just need to know how to specify the frame source files, and how to target different frames. This section will show you how to create ION Script applications that use fixed framesets and floating frames. Overview of Fixed Framesets
When you load a Web page that is divided into frames, you are loading an HTML frameset, defined with the