Home

ION Script User's Guide

image

Contents

1. lt VARIABLES gt lt VARIABLE_DECL NAME TEMPFILE VALUE TYPE STR gt lt VARIABLE_DECL NAME IDLVALUE VALUE 0 0 TYPE DOUBLE lt VARIABLES gt ION HEADER ION BODY ION EVALUATE EXPR STEMPFILE SION temp val S ION uniqueID ion lt ION_DATA_OUT DEBUG FALSE gt lt IDL gt writefile STEMPFILE SForm num lt IDL gt lt ION_DATA_OUT gt lt ION_INCLUDE SRC ion STEMPFILE PRE FALSE gt ION IF EXPR SIDLVALUE GT 4 gt IDL returned a value greater than 4 ION ELSE IDL returned a value less or equal to 4 ION IF ION BODY ION SCRIPT 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 EVALUATE EXPR IDLVALUE STRCOMPRESS A REMOVE_ALL gt FREE_LUN lun s ION guide Passing IDL Variables to ION Script 82 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
2. ION Script does not support HTTP proxies Therefore ION INCLUDE can only be used to include files that are accessible without a proxy If your system resides inside a firewall that uses a proxy for accessing Web sites outside the firewall you cannot include a Web page that resides outside the firewall Syntax ION INCLUDE SRC url ASTEXT TRUE FALSE PRE TRUE FALSE Attributes ASTEXT If the file to be included contains HTML tags or text that contains characters used in HTML and you want these characters displayed as text such as a code listing rather than being rendered as HTML set this attribute to TRUE By default ION Script converts special characters such as lt and gt to character entities so that they will not ION guide ION INCLUDE 166 Chapter 5 ION Script Tag Reference be interpreted as HTML by the browser Setting this attribute to TRUE prevents ION Script from converting special characters to character entities See Example 1 on page 144 for an example of the effect of the ASTEXT attribute Note that ASTEXT has no effect on included ION Script files PRE Determines how the included file is treated by the ION Script parser e If set to TRUE the included file is rendered in a fixed width font line breaks are preserved whitespace including spaces and tabs is preserved and word wrapping will
3. Temp Location ESTEM Text Extensions txt ION Extensions ion Redir Protocols Ppp Configuring ION Script for Windows ION guide Chapter 1 Configuring ION Script 13 The Format Tab The Format tab shown below is used to specify defaults that affect the way certain text elements are formatted on an ION Script page ION Script Configuration The Debug Tab The Debug tab shown below is used to specify the name and location of the log file created when DEBUG TRUE is specified for the ION IMAGE or ION DATA OUT tag and the type of error reporting for ION Script syntax errors ION Script Configuration ION guide Configuring ION Script for Windows 14 Chapter 1 Configuring ION Script Configuring ION Script for UNIX The UNIX version of ION Script uses a shell script called ionsrc to define various default settings preferences and file paths The ionsrc file listed below is installed in the ion_script directory Each time the ION Script parser is called it executes the ionsrc file The parser first searches for the ionsrc file in the same directory in which the parser itself ion p is located your Web server s cgi bin directory If the file is not found in the cgi bin directory it looks for the file in the ion script directory By copying the ionsrc file to your Web server s cgi bin directory you can specify different configuration settings for each Web server runnin
4. This EVENT DECL specifies that the page ex1_scale ion is processed when the SCALE COLORS event occurs In this case the SCALE COLORS event occurs when the user clicks the button Note that the URL in the ACTION attribute of the EVENT DECL tag begins with ion This causes the specified page to be processed by the ION Script parser If you simply wanted to load an HTML page when the user clicks the button you could use an http or file URL ION guide Example Creating a Complete Application 102 Chapter 4 Creating ION Script Applications Creating Persistent Variables We want the scaled image to use the same region and center as the original display region Therefore we need to pass the values of the REGION_W REGION_H CENTER X and CENTER Y variables declared in ex1_main ion to the exl scale ion page To do this we must make the variables persistent by specifying the PERSIST attribute in our VARIABLE DECL tags as follows VARIABLE DECL NAME REGION W VALUE 320 TYPE INT PERSIST TRUE VARIABLE DECL NAME REGION H VALUE 256 TYPE INT PERSIST TRUE gt lt VARIABLE_DECL NAME CENTER_X VALUE 600 TYPE INT PERSIST TRUE gt lt VARIABLE_DECL NAME CENTER_Y VALUE 600 TYPE INT PERSIST TRUE gt Note We do not need to declare persistent
5. page2 ion ION SCRIPT ION BODY ION IF EXPR Form Link EQ One gt lt B gt You selected link 1 lt B gt ION ELSE lt B gt You selected link 2 lt B gt lt ION_IF gt lt ION_BODY gt lt ION_SCRIPT gt ION guide ION LINK 172 Chapter 5 ION Script Tag Reference For another example of how the VALUE attribute of an ION_LINK can be used see Example 2 on page 145 ION LINK ION guide Chapter 5 ION Script Tag Reference 173 ION_OBJECT The ION_OBJECT tag pair is used to insert content such as VRML MPEG and WAV files into an ION Script application IDL is capable of creating output in a variety of file formats other than the image formats handled by ION_IMAGE and text handled by ION_DATA_OUT The ION_IMAGE tag allows the ION Script developer to insert any IDL generated data that can be inserted into a Web page with either the lt OBJECT gt tag or lt EMBED gt tag Implementation of the lt OBJECT gt and lt EMBED gt tags differs significantly from browser to browser Therefore it is usually necessary to write ION OBJECT code differently for each browser supported by your application It is important to understand how each browser you intend to support handles the MIME types you are including in your ION Script application In addition plug ins are often used to render data contained in lt OBJECT gt and lt EMBED gt tags Each plug in has its own coding requirements
6. ION IMAGE ION IMAGE ION PARAM ION LINK ION LINK ION RADIO ION OBJECT ION OBJECT ION VARIABLE ION SCRIPT ION SCRIPT VARIABLE DECL VARIABLES lt VARIABLES gt Syntax Conventions ION guide Chapter 5 ION Script Tag Reference 115 Elements of Syntax Each tag listed in this reference includes a Syntax section that defines how the tag is used The following elements are used in syntax listings Element Description Square brackets Indicates that the contents are optional Italics Indicates arguments expressions or statements for which you must provide values Braces Indicates that you must choose one of the values they contain Vertical lines Separates values from which you must choose ION guide Consider the following syntax example TAG ATTRIBUTE I value ATTRIBUTE2 value ATTRIBUTE3 value 1 value2 gt content lt TAG gt In this example ATTRIBUTE is required while all other attributes are optional ATTRIBUTES can be set to either value or value2 Square Brackets e Content between square brackets is optional e Do not include square brackets in your statement Noe Square Brackets are used in IDL to define an array When including IDL code as the value of an ION Script tag attribute or the cont
7. lt ION_BUTTON TYPE IMAGE gt creates lt INPUT TYPE IMAGE gt Note that not all browsers support borders on lt INPUT TYPE IMAGE gt When the EVENT attribute has been specified for the ION _IMAGE tag the border is drawn in the color specified by the LINK attribute of the ION_BODY tag if used or in the link color used by the browser If no EVENT has been specified the border color is black If desired you could wrap the ION_IMAGE tag in a lt FONT gt tag to specify a different color as follows lt FONT COLOR 808080 gt ION IMAGE lt ION_IMAGE gt lt FONT gt URLs ION guide Image Server URL The Image Server URL field is used to specify the path to the ION Script Image Server ion i This default value can be overridden by specifying the SERVER attribute of the ION IMAGE tag See ION IMAGE on page 159 ION Script Parser URL The ION Script Parser URL field is used to specify the path to the ION Script parser ion p ION Script Configuration Options 20 Chapter 1 Configuring ION Script Files IDL Search Path The IDL Search Path field is used to specify the search path used by IDL for pro and sav files To specify multiple directories separate each directory with a semicolon Windows or a colon UNIX Place the symbol at the beginning of a directory to indicate that all subdirectories of the specified directory should be searched For example the following Windows I
8. gt ION SCRIP RAM NAM E FileName EBUG true FILE file MIM CLASSID CLSID 05589FA1 C356 11CE BF01 00AA0055595A E audio wav VALUE SION IDLURL ION OBJECT 178 Chapter 5 ION Script Tag Reference ION_PARAM The ION_PARAM tag is used to define object parameters inside the lt ION_OBJECT gt lt ION_OBJECT gt tag pair This tag is identical to the HTML lt PARAMsS gt tag except that this tag is first processed by the ION Script parser This allows you to use ION Script variables to define lt PARAM gt tags Syntax ION OBJECT ION PARAM PARAM attributes Can contain variable gt ION OBJECT Attributes Any attribute accepted by the HTML PARAM tag can be used with the ION PARAM tag HTML Mapping The ION PARAM tag is converted to the HTML PARAMP tag ION PARAM ION guide Chapter 5 ION ION Script Tag Reference 179 RADIO An ION RADIO button is similar to an HTML radio button created with lt INPUT TYPE RADIO gt ION RADIO allows you to maintain the selection state of a radio button group when reloading the page Syntax ION RADIO NAME group name VALUE value DEFAULT lt INPUT TYPE RADIO gt attributes gt Attributes ION guide DEFAULT Include this attribute to cause this radio button to be the button that is initially selected when the page loads for the first time Only one button in a
9. lt IDL gt str ION VARIABLE NAME SForm Region gt str array STRSPLIT str EXTRACT parse str array sLr array IDL ION DATA OUT ION BODY ION SCRIPT parse str array pro pro parse str array array length n elements array for i 0 length 1 do begin print array i endfor end Instead of printing the values contained in the Form variable you could pass the IDL variables to ION Script variables Refer to the example Passing IDL Variables to ION Script Example on the ION Script Advanced Examples page index examples ion Parsing the Form Variable in a SCRIPT Block This example demonstrates the use of a SCRIPT block to extract multiple values from a Form variable pagel ion ION SCRIPT ION HEADER EVENTS EVENT DECL NAME DISPLAY ACTION ion page2 ion lt EVENTS gt lt ION_HEADER gt Handling Multiple Selections in a SELECT Element ION guide Chapter 4 Creating ION Script Applications 79 lt ION_BODY gt lt ION_FORM gt lt SELECT NAME Region MULTIPLE gt lt OPTION gt East lt OPTION gt ION SELECTED gt West lt OPTION gt lt SELECT gt lt ION_BUTTON TYPE BUTTON EVENT DISPLAY LABEL Display gt lt ION_FORM gt A Oo U lt ION_BODY gt lt ION_SCRIPT gt page2 ion lt
10. included ion ION SCRIPT ION HEADER VARIABLES VARIABLE DECL NAME B VALUE 10 TYPE INT gt VARIABLE DECL NAME C VALUE 20 TYPE INT gt lt VARIABLES gt lt ION_HEADER gt lt ION_BODY gt lt BR gt lt B gt Included file lt B gt lt BR gt A lt ION_VARIABLE NAME SA gt lt BR gt B lt ION_VARIABLE NAME B gt lt BR gt C ION VARIABLE NAME C gt ION BODY ION SCRIPT In this example the enclosing page declares variables A and B each set to 5 The included page also declares variable B but sets the value to 10 The value of B in the included page becomes 10 Although variable A was not declared in the included page we have access to its value from the enclosing page The reverse is not true however the variable C declared in the included page is not accessible in the ION guide Chapter 3 Variables Expressions amp Operators 49 enclosing page because its scope is limited to the included page The following figure shows the result of loading Enclosing ion in the browser Scope Test Netscape OE x File Edit View Go Communicator Help Enclosing file A 5 B 5 C Error Variable C does not exist Included file A 5 B 10 C 20 Document Done Variable Persistence ION guide Variables can be persistent across ION Scri
11. ION VARIABLE 184 Chapter 5 ION Script Tag Reference Flag Description Pad the result with leading zeros if the specified width is greater than the width of the result width is an integer specifying the minimum field width If the result has fewer characters than the field width it is padded on the left or right if the flag has been specified The padding is done with spaces unless the first character of width is a zero in which case the padding is done with zeros precision is an integer preceded by a decimal point specifying the minimum number of digits to appear for the d o or x format specifiers or the maximum number of characters to be printed for the s format specifier It is also the precise number of digits to display after the decimal including trailing zeros for the e E f g or G specifiers type length is one of the following Type Length Description For d i 0 u x or X specifiers value is treated as a short or unsigned short 1 lower case L The value is treated as a long or unsigned long L The value is treated as a long double specifier is one of the following ION Variable Type Valid Specifiers BOOL STRING dos INT d 96i 0 You 96x YX DOUBLE 96e WE f 96g 96G Note ION VARIABLE For more information on using format specifiers refer to a C programming manual ION guide Chapter 5 ION Script Tag Re
12. This variable needs to be defined only on pages that use the Form variable in a numeric expression You then use this new variable in place of the Form variable in a numeric expression such as in the following example ION IF EXPR SAGE GT 30 gt AGE is SForm Age The reason for this requirement is that Form variables are always treated as strings Since strings and numerics cannot be used together in a numeric expression except to concatenate a numeric to a string using the operator creating a numeric variable equal to the form variable allows you to use the form variable in a numeric expression such as an expression using a comparison operator FormURL The FormURL system variable is equivalent to the Form variable except that FormURL returns the string in URL encoded format In a URL encoded string special characters such as carriage returns and tabs are replaced with codes representing that character ION Script defines special characters as e ASCII values up to 32 e Any of the following amp lt gt 1 J e ASCII values from 127 255 When URL encoded these special characters are replaced by hh where hh is the hexadecimal ASCII value of the character Carriage returns are replaced by O0D OA The IDL program st rdecode pro located in the ion_script examples directory can be used to decode the URL encoded string in an lt IDL gt block System Variables ION guide Chapter
13. lt ION_BODY gt lt ION_FORM gt Enter contour data lt BR gt lt TEXTAREA NAME data ROWS 5 gt lt TEXTAREA gt lt BR gt ION BUTTON TYPE BUTTON EVENT DRAW LABEL Draw Contour gt ION FORM ION BODY ION SCRIPT textarea2 ion LON SCRIPT ION BODY ION IMAGE TYPE DIRECT BORDER 0 gt lt IDL gt Decode the URL encoded string into a 2D array data strdecode SFormURL data array System Variables ION guide Chapter 3 Variables Expressions amp Operators 57 Convert to float array data float data Smooth the data data min curve surf data Draw the contour plot contour data lt IDL gt lt ION_IMAGE gt lt ION_BODY gt lt ION_SCRIPT gt Using strdecode pro The IDL program st rdecode pro is provided as an example of how you can decode URL encoded strings The st rdecode command uses the following syntax Result STRDECODE String ARRAY NO_SPLIT The String argument is the FormURL string to be decoded If ARRAY is set spaces commas tabs and carriage returns are treated as delimiters and the scalar string is converted into a string array If NO_SPLIT is set a one dimensional vector string array will be returned otherwise the result will be a two dimensional string array Noe For a two dimensional ar
14. tags inside the ION HEADER Syntax ION HEADER lt AUTHOR gt author lt AUTHOR gt lt APPLICATION gt application name lt APPLICATION gt lt COPYRIGHT gt copyright lt COPY RIGHT gt lt DATE gt date lt DATE gt lt LASTUPDATE gt date lt LASTUPDATE gt lt TITLE gt title lt TITLE gt lt EVENTS gt EVENT_DECL tags lt EVENTS gt lt VARIABLES gt VARIABLE_DECL tags lt VARIABLES gt Any other HTML tags that are valid inside HEAD such as lt BASE gt LINK META lt SCRIPT gt and lt STYLE gt lt ION_HEADER gt Metadata Tags The following tags are used to provide information about an ION Script document Search engines use this metadata to index your page according to its content These tags are valid only inside the ION HEADER ION HEADER block APPLICATION The name of the ION Script application to which this page belongs AUTHOR The document author of this page ION HEADER ION guide Chapter 5 ION Script Tag Reference 157 COPYRIGHT A copyright statement By default ION Script automatically inserts the symbol before the value of this tag when you include Document COPYRIGHT using ION_VARIABLE If you do not want to use this symbol you can change the default using the Format tab of the configuration utility DATE The date the document was created LASTUPDATE The date the document was last updated TITLE The page title Note that this is
15. validating form data 104 VALUE attribute ION CHECKBOX 138 ION Script User s Guide 205 VALUE attribute continued ION FORM 152 ION RADIO 179 VARIABLE DECL 187 values in expressions 61 variable substitution 98 117 VARIABLE DECL tag 186 variables 44 assigning string literals 46 assigning values to 44 187 declaring 44 44 98 186 189 form troubleshooting 196 form using in expressions 54 in HTML attributes 117 in ION Script attributes 98 117 inserting value of 99 183 names 47 186 persistence 49 186 system 50 type conversion 196 type determining 46 types 44 undefined 46 VARIABLES tag 189 version SION system variable 59 version browser 50 VLINK attribute 134 W whitespace preserving 143 166 WIDTH attribute 162 ION_OBJECT 175 WINDEX keyword 159 WINDOW procedure 124 windows creating IDL 124 word wrap preventing 143 166 Z z buffer 91 Index
16. E 324 a Back Foward Reload Home Search Image Data Minimum Value o Maximum Value 254 Mean Value 102 584 Document Done Example Creating a Complete Application 110 Chapter 4 Creating ION Script Applications Note LL For another example of how ION DATA OUT can be used to generate HTML see ION DATA OUT on page 141 Also see the examples dropframe ion and pickfile ion which can be accessed by the Dynamic Droplist Example and Dynamic Table Example links on the Advanced examples page index examples ion A Note On Using the Back Button When you design an application always test the behavior of the application when navigating with the browser s Back button Using the Back button to navigate through an application may cause undesired results Try to design your application interface to discourage use of the Back button For example on the ex1 scale ion and ex1 data ion pages you must use the Back button to return to the previous page We could add an ION BUTTON to each page and assign an event that returns to the previous page This ensures that any changed variable values are passed back to the previous page Note however that you cannot depend on the user clicking your ION BUTTON instead of the Back button Therefore make sure that using the Back button does not cause problems with your application regardless of whether you provide alternative means of navigation Applica
17. Files section of the ionsrc file UNIX Variables Check user defined variables to make sure that each variable is used consistently with regard to case and spelling throughout the document For example make sure you didn t declare a variable as A and later assign a value to a When checking the value of a boolean variable such as in the statement A EQ TRUE make sure you use either all uppercase or all lowercase letters for the boolean value In other words use only TRUE true FALSE or false Do not use True or False Make sure you didn t mistakenly declare a variable with a value that is of a different type than the specified TYPE For example if you assign a value of 4 99 to a variable declared as an INT the value becomes 4 When using a form variable in a numeric expression make sure you declare a variable with the same value as the form variable and assign a numeric TYPE See Using Form Variables in Numeric Expressions on page 54 If a value is being passed to an ION Script page in a URL make sure you refer to this value as a Form variable in the page to which the value is being passed For example assume you want to pass the parameter DATA with a value of 34 to the page mypage ion with the following URL http myserver cgi bin ion p page mypage ion amp DATA 34 In mypage ion in order to access the DATA parameter you must refer to it as Form DATA not DATA Images Not Displaying If your ION S
18. ION Script User s Guide RSI Research Systems Inc ION Version 6 1 July 2004 Edition Copyright Research Systems Inc All Rights Reserved 0704ION61SCR 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 duplication and disclosure are subject to the restrictions stated in the license agreement Research Systems Inc reserves the right to make changes to this document at any time and without notice Limitation of Warranty Research Systems Inc 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 Research Systems Inc shall not be liable for any direct consequential or other damages suffered by the Lic ensee 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 Research Systems Inc grants you a limited nontransferable license to reproduce this particular document provided such copies are for your use only and are not sold or distrib uted to third parties All such copies must contain the title page and this notice page in their entirety Acknowledgments IDL isa r
19. This is a simple ION Script page Fisa Document Done 31 The header section of an ION Script page is also where we define variables and events using the VARIABLES VARIABLE_DECL EVENTS and EVENT_DECL tags The following example creates a button that triggers the PLOT event which executes the page plot ion TON SCRIPT2 ION HEADER lt TITLE gt My ION Script Page lt TITLE gt VARIABLES VARIABLE DECL NAME A VALUE 5 TYPE INT gt lt VARIABLES gt lt EVENTS gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt lt EVENT_DECL NAME PLOT ACTION ion plot ion gt lt ION_BUTTON EVENT PLOT TYPE BUTTON LABEL Draw Plot gt ION FORM ION BODY ION SCRIPT ION guide What Is ION Script 32 Chapter 2 Overview Variables and events allow you to create interactive applications in which the user can control the behavior of the application and the appearance of generated images and data Also important in creating interactive applications are ION Script s flow control tags ION IF ION ELSE and ION_ELSEIF These tags allow you to perform certain actions depending on the actions of the user such as reporting invalid entries ION IF EXPR SUSERENTRY EQ 0 gt You can t enter 0 ION ELSE You entered ION VARIABLE N
20. What Is ION Script ION guide Chapter 2 Overview 33 Anatomy of an ION Script Application Before you learn the details of writing an ION Script application it helps to understand what ION Script does under the hood when a client requests an ION Script page ION Script tags are processed by the ION Script parser and converted to HTML As illustrated in the following figure the output of every ION Script application is an HTML page CLIENT SERVER ION Script User requests Document ion page ION Script Tags HTML Tags Parser 4 IDL User gets HTML page Image Server rt Hs HTML The following sequence of events occurs when a request is made for an ION Script page 1 The client requests an ION Script page by requesting a URL of the form http myserver cgi bin ion p page mypage ion by clicking a link pointing to such a URL or by submitting an HTML form with an action that points to the ION Script parser 2 The Web server passes the request to the parser the CGI program ion p 3 The parser converts ION Script content to HTML ION guide What Is ION Script 34 Chapter 2 Overview e The content of ION DATA OUT tags is sent to the Data Server which passes the IDL content to IDL for processing and the Data Server returns the IDL output to the Web page e Any other ION Script content such as ION EVALUATE and IO
21. gt ION EVALUATE EXPR CENTER_Y SIMAGE_H 1 SREGION H 2 lt FONT COLOR 0000CC gt lt BR gt Top edge of image reached view center has been adjusted lt FONT gt ION ELSEIF EXPR SCENTER_Y SREGION H 2 LT 0 ION EVALUATE EXPR SCENTER Y SREGION_H 2 gt lt FONT COLOR 0000CC gt lt BR gt Bottom edge of image reached view center has been adjusted lt FONT gt lt ION_IF gt Step 7 Displaying IDL Generated Data Our final task for this application is to provide the user with some data about the image We ll add a link to the ex1_main ion page that executes a page called ex1_data ion which displays the minimum maximum and mean values in the image To create the link we use the ION LINK tag as follows ION LINK EVENT SHOW DATA View Image Data ION LINK Like an ION BUTTON an ION LINK has an EVENT attribute When the user clicks on the link we want to load ex1_data ion We ll therefore define the event as follows EVENT DECL NAME SHOW DATA ACTION ion exl data ion Next we need to create the ex1 data ion page Whereas the ION IMAGE tag displays an IDL generated image the ION DATA OUT tag is used to insert textual IDL output into the page The following code is used to create the ex1_data ion page LION SCRIPT ION HEADER lt
22. A Em 156 Metadata Tags Pc 156 Evems and TIL iE 157 ION IF TON ELSEIF IUN ELSE cocep cei reo ederet bebe 158 a D E E 159 Notes About Using ION IMAGE Lenses entr iet nitent ee ta tee Hoe do 160 TON B DSL OLEL RU zm 165 CENE I s D 170 ION BIELE 12e Peter ee evs nee E 173 TON PARAM T eE dagen ie haa i eee 178 TON RADIO asus chicas sass ta ves ieii AERE sssacns spartan EEE AAEE EENE EEEE EES 179 ION SCRIBE A A E E E E AEE T 182 E VARIABLE aeie nib a E ediderat e 183 VARIABLE BELL ced tes cea tien Codecatesd EEEE poem Eee anaE E OREAREN ido 186 VARIABLES hcp scssetisieancsarstenatiaesb E AE E E E E Eaa 189 Chapter 6 puke tle inlete 111a Meee nd bx E E plaid Vbi 191 Web Server Problemi RR 192 If You Are Using Mictosolt IS 1er teeth lentianisisivenieeecl 192 Conector Failed Errors MP 192 DT E o E E E E retis eese E stuns rene eo 193 DOE emt Ot Pape EIO Em 194 Licensing ENOS 5 ek tes res 194 TON Senpt Syntax POS eon nieto saseviess EEA ia 194 EL S E 195 bio M 196 Images Not Displaying 22 22 ance Diener te ed et pee tabe LED ER eade 196 p M ess 197 Sai MATE DM DN cc 199 ION Script User s Guide Contents Chapter 1 Configuring ION Script This chapter discusses the configuration task
23. Browser system variable 50 Document system variable 51 Form system variable 53 Form variables 196 FormURL system variable 54 ION IDLURL system variable 58 ION temp system variable 58 ION uniqueID system variable 59 ION version system variable 59 Mouse system variable 59 107 to group expressions 67 ION Script User s Guide operator 64 operator string concatenation 64 operators 64 operator 64 lt gt comment tag 119 square brackets 115 backslash character 128 operator 64 blank 153 162 170 parent 153 162 170 self 153 162 170 _top 153 162 170 braces 116 single quotation mark 116 199 200 Numerics 24 bit images 92 8 bit character sets 94 8 bit images 92 A ACTION attribute EVENT_DECL 122 FORM tag HTML 36 addition operator 64 ALINK attribute 134 AND operator 66 APPLICATION tag 156 applications performance 92 ASCII character sets 94 ASTEXT attribute ION_DATA_OUT 141 ION_INCLUDE 165 attributes using variables in 98 117 AUTHOR tag 156 B BACKGROUND attribute 134 backslash character 128 bandwidth 92 BGCOLOR attribute 134 BODY tag 197 BOOL type 44 187 boolean expressions 62 BORDER attribute ION_BUTTON 135 ION_IMAGE 160 braces 116 brackets curly 116 square 115 Browser system variable 50 Index browsers determining type of 50 support of frames 89 b
24. Configuration Utility Windows or in the Debug section of the ionsrc file UNIX See DEBUG on page 142 This debugging file contains the exact code sent to IDL as well as any errors reported by IDL Make sure your lt IDL gt blocks do not use IDL commands that cannot be entered at the command line such as a FOR loop or BEGIN statement Make sure you are not using any other IDL commands that are not allowed in ION Script See IDL Tag Limitations on page 124 If your lt IDL gt block contains a number or an ION Script variable that begins with a number enclosed in quotation marks make sure you enclose the number or variable in single rather than double quotation marks In IDL a double quotation mark followed by a number denotes an octal constant For example the following code would cause a syntax error in IDL print 1 Elm Street Instead you would need to use print 1 Elm Street See Single vs Double Quotation Marks on page 126 for more information 196 Chapter 6 Troubleshooting If you get an Attempt to call undefined procedure function error make sure the pro or sav file containing the procedure or function you are calling is located in a directory specified in the IDL Search Path On UNIX also make sure all directories in the IDL Search Path have the proper read permissions Set the IDL Search Path on the Files tab of the ION Script Configuration utility Windows or in the
25. FORM tag s ACTION attribute and the METHOD attribute of the FORM tag is set to GET For example if you have set the ION Script Parser URL to http myhost mydomain com cgi bin ion p then ION FORM is converted to the following HTML lt FORM ACTION 2 http myhost mydomain com cgi bin ion p METHOD GET gt All attributes of the HTML FORM tag can be used in the ION FORM tag Note that the attributes listed above ACTION METHOD etc are simply attributes of the FORM tag and are listed here for convenience ION guide Chapter 5 ION Script Tag Reference 155 Note One exception is the MULTIPLE attribute of the HTML lt FORM gt s SELECT tag This tag attribute combination is not functional with ION FORM which then completely disables the HTML FORM implementation of listbox menus that allow multiple selections ION guide ION FORM 156 Chapter 5 ION Script Tag Reference ION_HEADER The ION_HEADER tag pair is used to declare information called metadata about an ION Script document If included the ION HEADER section appears before the ION BODY section In addition to the ION Script metadata tags listed below HTML tags that are valid inside the HEAD element of an HTML page can also be included inside the ION HEADER For example if you wish to include a script and style sheet in the HEAD element of the Web page include the HTML SCRIPT and STYLE
26. ION Script Pages An ION Script page is similar in organization to an HTML page In fact ION Script pages can contain HTML Consider the following HTML page lt HTML gt lt HEAD gt lt TITLE gt My HTML Page lt TITLE gt lt HEAD gt lt BODY gt lt H1 gt My HTML Page lt H1 gt This is a simple HTML page lt BODY gt lt HTML gt What Is ION Script ION guide Chapter 2 Overview 29 This simple page is rendered by the browser as follows F My HTML Page Netscape Iof xi File Edit View Go Communicator Help My HTML Page This is a simple HTML page Document Done 7 ION Script pages are constructed in much the same way lt ION_SCRIPT gt lt ION_HEADER gt lt TITLE gt My ION Script Page lt TITLE gt lt ION_HEADER gt lt ION_BODY gt lt H1 gt My ION Script Page lt H1 gt This is a simple ION Script page lt ION_BODY gt lt ION_SCRIPT gt Every ION Script page must have the ION_SCRIPT and ION_BODY tags The ION_SCRIPT tag is a container for everything in the ION Script page All content on the page must reside inside the ION_SCRIPT block Everything inside the ION_BODY tag is converted to HTML to create the Web page delivered to the user Optionally an ION Script page can contain an ION_HEADER block used to define document attributes such as the title to declare ION Script variables and events and to include any HTML tag
27. ION Script is based on XML which requires the use of quotation marks Make sure you enclose all lt ION_BODY gt attributes inside double quotation marks Attributes ION guide Note Several of the following attributes can be specified either as an RGB triplet using the general syntax ATTRIBUTE RRGGBB or as a valid color name using the syntax ATTRIBUTE color name See http www htmlhelp com cgi bin color cgi for a list of RGB values and color names Using RGB values instead of color names is recommended because not all browsers support color names ION BODY 134 Chapter 5 ION Script Tag Reference BACKGROUND The URL of the background image to use for the document BGCOLOR The background color of the page Can be specified either as BGCOLOR RRGGBB or BGCOLOR color name TEXT Text color Can be specified either as TEXT RRGGBB or TEXT color name LINK Color of hyperlinks Can be specified either as LINK RRGGBB or LINK color name VLINK Color of visited hyperlinks Can be specified either as VLINK RRGGBB or VLINK color name ALINK Color of active hyperlinks Can be specified either as ALINK RRGGBB or ALINK color name ONLOAD The script to execute when the page is loaded See Using JavaScript and VBScript on page 90 for information on specifying this attribute ONUNLOAD Script to execute when document has been exited See Using JavaScript and VBScript
28. ION guide Chapter 4 Creating ION Script Applications 71 e file used to specify a file except for ion that is accessible on a particular host computer e jon used to specify the URL of a ion file either as an event action or an included file Files specified using the ion protocol are parsed by the ION Script parser URLs using the ion protocol cannot be used in HTML tags nor can they be entered in the browser s location field Note Because UNIX is case sensitive make sure if using a UNIX Web server that URLs used in your ION Script and HTML pages use the same case as the files to which they refer HTTP URLs HTTP Hypertext Transfer Protocol is the protocol used to transfer HTML files over a network Cases in which you would use the http protocol in your ION Script applications include e when specifying an HTML page as the EVENT attribute to the ION BUTTON or ION IMAGE tag e when including an HTML page using the ION INCLUDE tag e when adding a link to another HTML page from your ION Script page using the HTML lt A gt tag or the ION LINK tag HTTPS URLs HTTPS Hypertext Transfer Protocol Secure is the protocol used to transfer files over a network using secure transactions The https protocol behaves like the http protocol but is intended to provide secure communication of information such as credit card numbers
29. ION guide Expressions 64 Operators Chapter 3 Variables Expressions amp Operators Operators are used to perform comparisons and mathematical operations on the terms of an expression Operators are used between values or expressions in the general form value OP value2 Some operators only accept values of a certain type If the value for a variable is not a type supported by the operation the operation will fail Mathematical Operators ION Script s mathematical operators are listed in the following table Operator Description Types Accepted Addition Add value to value2 variables numbers Subtraction Subtract value2 from valuel variables numbers Division Divide value by value2 variables numbers Multiplication Multiply value by value2 variables numbers MOD Modulus Returns the integer remainder of variables numbers dividing value by value2 Raise to the Power Of Returns value raised to the power value2 variables numbers String Operators ION Script s string operators are listed in the following table Operator Description Types Accepted String concatenation String1 String2 variables creates String 1String2 numbers strings CONTAINS String contains value CONTAINS value2 variables strings returns true if value2 is found in valuel returns false otherwise Operators ION guide Chapter 3 Variables Expressions amp Operators
30. Images ION_IMAGE 162 ION IMAGE Chapter 5 ION Script Tag Reference tab of the configuration utility Windows or in the Images section of the ionsrc file UNIX is used as the default This label is also used in some cases as the tooltip that appears when you hold the mouse cursor over the image depending on which browser type and version you are using Because different browsers and different versions of each implement alternate text and tooltips differently it helps to know how ION Script maps the label to HTML This label value or the LABEL attribute of ION IMAGE if specified becomes the value of the ALT attribute of the HTML lt IMG gt tag for an ION IMAGE without an EVENT or the ALT attribute of the lt INPUT TYPE IMAGE gt tag for an ION IMAGE with an EVENT Because some browsers handle images created with the IMG tag differently than those created with the lt INPUT gt tag the name of the EVENT may be displayed in place of the value specified for the label if the EVENT attribute of the ION IMAGE tag has been specified for an image SERVER The full path to the image engine ion i This must be a valid absolute URL using the HTTP or HTTPS protocol This attribute which is also an attribute of ION DATA OUT and ION OBJECT can be used for load control by specifying different servers for different tasks provided you have a copy of ion i on each server and that you have the proper lic
31. Syntax lt ION_EVALUATE EXPR expression DISPLAY TRUE FALSE FORMAT format string gt Attributes ION guide EXPR The expression to be evaluated by the parser This attribute can contain a variable See Chapter 3 Variables Expressions amp Operators for details on writing ION Script expressions Note that the way you declare a variable is different from the way you use ION_EVALUATE to assign a value to a variable When declaring a variable with VARIABLE_DECL you do not prefix the variable name with the symbol When you assign a variable a value using ION EVALUATE you do prefix the variable name with the symbol regardless of whether or not the variable has already been declared For example ION EVALUATE EXPR STemperature 98 6 gt Warning Assigning Browser REMOTE USER as a string variable to the VALUE attribute can be dangerous because it is frequently an undefined system variable When VALUE is undefined IDL reports an error However it is possible that code that uses SBrowser REMOTE USER could be implemented and tested without error on one system and fail if ported to another system DISPLAY Determines whether or not to display the result of the expression in the outputted HTML page The default value is FALSE ION EVALUATE
32. directory is often called cgi bin For the Apache Web Server the path to this directory might look something like usr local apache2 cgi bin Copy the files ion i and ion p from the directory RSI DIR ion 6 1 ion script cgi bin to your Web server s CGI executables directory Make sure these files have execute permission for all users Copy the files ion 1I and ion P from the directory RSI DIR ion 6 1 ion script cgi bin bin platform where platform is the name of your platform to your Web server s CGI executables directory Make sure these files have execute permission for all users Edit the Image Server and Parser URLs iF Open the file RSI DIR ion_6 1 ion_script ionsrc ina text editor This is the ION Script configuration file If multiple Web servers will be using the same ION Script installation copy ionsrc to your Web server s CGI executables directory and modify the file in that location Configuring ION Script for UNIX ION guide Chapter 1 Configuring ION Script 17 2 Edit the Image Server URL and ION Script Parser URL entries so they contain the fully qualified domain name of your Web server and the correct path to your Web server s CGI executables directory For example the Image Server URL might look like the following http myhost mydomain com cgi bin ion i 3 Save the ionsrc file ION guide Configuring ION Script for UNIX 18 Chapter 1 Configuring ION Script ION Script Configuration Opti
33. on page 90 for information on specifying this attribute HTML Mapping The ION_BODY tag is converted to the HTML lt BODY gt tag All attributes of the lt BODY gt tag can be included in the ION BODY tag Note that the attributes listed above are simply attributes of the lt BODY gt tag and are listed here for convenience ION BODY ION guide Chapter 5 ION Script Tag Reference 135 ION BUTTON An ION BUTTON is similar to an HTML button created with lt INPUT TYPE SUBMIT gt The ION BUTTON is a special input type that can have an ION Script event assigned to it When the button is pressed or if the image is clicked for IMAGE type buttons the event is processed If the ION BUTTON is contained in a form only those inputs local to the form are passed on to the new page An ION BUTTON can be either a standard HTML button or an image If the TYPE is BUTTON a standard button is used and the label comes from the LABEL attribute IMAGE buttons get their visual representation from the URL specified in the SRC attribute When TYPE is set to IMAGE you can retrieve the location of the mouse when clicked on the image by using the Mouse x and Mouse y system variables Syntax ION BUTTON TYPE BUTTON EVENT eventName LABEL label METHOD GET POST lt INPUT TYPE SUBMIT gt attributes gt or lt ION_BUTTON TY PE IMAGE EVENT eventName SRC url BORDER width METHOD GET POST lt INPUT
34. 121 Alphabetical Listing of ION Script Tags This section contains an alphabetical listing of all ION Script tags including their syntax and a description of each attribute The following ION Script tags are covered in this section Tag Page EVENT_DECL 122 EVENTS 123 IDL 124 INPUT 129 ION_BODY 133 ION_BUTTON 133 ION CHECKBOX 138 ION DATA OUT 141 IJONEBVALUASE M9 ION FORM 152 ION HEADER 156 ION IF ION ELSEIF ION ELSE 158 ION IMAGE 159 ION INCLUDE 165 ION LINK 170 ION OBJECT 173 ION PARAM 178 ION RADIO 179 ION SCRIPT 182 ION VARIABLE 183 VARIABLE DECL 186 VARIABLES 189 ION guide Alphabetical Listing of ION Script Tags 122 Chapter 5 ION Script Tag Reference EVENT DECL The EVENT DECL tag declares an event When the user clicks a button image or link with an assigned event the page defined by the event is processed and displayed The event name is used as the value of the EVENT attribute of the ION BUTTON ION IMAGE and ION LINK tags Note __ Ss SSSSSSSSSSSsSSsSsSsSSSSSSSSSSSSSSSSSSSSSSSSSSSS The EVENT DECL tag must reside between the EVENTS and EVENTS tags Syntax EVENT DECL NAME name A Z a z 0 9 and _ only ACTION url gt Attributes ACTION Defines the URL of the document to be displayed when the event occurs See Specifying URLs on page 70 for more on specifying va
35. 150 Chapter 5 ION Script Tag Reference FORMAT Specifies the C style printf formatting string The syntax for the FORMAT attribute is as follows FORMAT flags width precision type length specifier where flags is one or more of the following characters Flag Description space Precede the result with a space Left justify the result within the field if width is specified Precede the result with a sign or The default is to display only a minus sign f specifier is o precede result with 0 f specifier is x precede result with Ox f specifier is X precede result with OX e f specifier is e E f g G the decimal point is always present in the result even if no digits follow the decimal f specifier is g G trailing zeros will display 0 Pad the result with leading zeros if the specified width is greater than the width of the result width is an integer specifying the minimum field width If the result has fewer characters than the field width it is padded on the left or right if the flag has been specified The padding is done with spaces unless the first character of width is a Zero in which case the padding is done with zeros precision is an integer preceded by a decimal point specifying the minimum number of digits to appear for the d o or x format specifiers or the maximum number of characters to be printed for the s format sp
36. 256 TYPE INT VARIABLE DECL NAME CENTER X VALUE 600 TYPE INT VARIABLE DECL NAME CENTER Y VALUE 600 TYPE INT lt VARIABLES gt Using Variables in ION Script Tags and IDL Code We now need to insert the variables we have created into the code used to generate the image To use a variable instead of an explicit value as an attribute of an ION Script tag or in IDL code we precede the variable name with the symbol This tells the ION Script parser to replace variable with the value of variable The following code uses our variables in the ION_IMAGE tag and in the IDL code ION IMAGE WIDTH SREGION W HEIGHT SREGION H TYPE DIRECT gt lt IDL gt Read in the original image image read_png filepath subdir ion script examples data landsat png r g b Calculate the x subscripts xstart CENTER X REGION W 2 xend S CENTER X SREGION W 2 1 Calculate the y subscripts ystart S CENTER Y SREGION_H 2 yend SCENTER Y SREGION H 2 1 Create the specified region region image xstart xend ystart yend Load the display color table tvlct r g b Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications 99 Display the region tv region lt IDL gt ION IMAGE Displaying Variable Values on the Page At times you will
37. 3 Variables Expressions amp Operators 55 When Should You Use FormURL FormURL is useful in cases where the user might enter characters that would cause problems when passed in a string directly to IDL such as carriage returns and quotation marks as illustrated in the following example Example 1 In this example a text field is used to enter the x axis label for a plot Assume the user enters a label containing an apostrophe single quotation mark such as Doug s Data The value of Form LABEL is the string Doug s Data If Form LABEL is enclosed in single quotation marks in an lt IDL gt block such as with the IDL command label SForm LABEL a syntax error would occur because this would be interpreted by IDL as label Doug s Data This would cause the string to be terminated prematurely in IDL The FormURL LABEL variable is the string Doug 27s 20Data This can be decoded in an lt IDL gt block using the IDL program st rdecode pro as follows label strdecode SFormURL LABEL Now label is the string Doug s Data FormURL1 ion lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME PLOT ACTION ion FormURL2 ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt X axis Label lt INPUT TYPE TEXT NAME xlabel gt lt BR gt lt ION_BUTTON TYPE BUTTON EVENT PLOT LABEL Show Plot gt lt ION_FORM gt lt ION_BODY gt l
38. 5 ION Script Tag Reference symbol in an ION Script page is considered a variable The following example illustrates what is and what is not allowed when using the line continuation character lt IDL gt The following is a legal use of line continuation A This is legal print A The following is not a legal use of line continuation because the character is not the last character B This is Cannot put a comment here illegal print B C This is also legal A comment is allowed here because the lin does not contain a character print C lt IDL gt Making IDL Print the Symbol If you want a symbol to be interpreted by IDL as a symbol instead of a line continuation character you must precede the symbol with a backslash For example if you want IDL to print the value of the variable cost preceded by the symbol you would use the following code lt ION_DATA_OUT gt lt IDL gt cost 100 print string cost lt IDL gt lt ION_DATA_OUT gt HTML Mapping The IDL tag does not produce HTML and therefore does not support any additional attributes IDL ION guide Chapter 5 ION Script Tag Reference 129 INPUT The INPUT tag is an HTML tag used to define a form element such as a pushbutton or a text input field In ION_SCRIPT the INPUT tag is used inside the ION_FORM tag to define form elements for the ION form All INPUT types can be used in ION Scri
39. 65 Comparison Operators ION Script s comparison operators are listed in the following table Operator Description Types Accepted GT Greater Than TRUE if value is greater than variables numbers value2 GE Greater Than or Equal To TRUE if value is variables numbers greater than or equal to value2 LT Less Than TRUE if value is less than value2 variables numbers LE Less Than or Equal To TRUE if value is less variables numbers than or equal to value2 EQ Equality TRUE if valuel is equal to value2 variables numbers strings NE Not Equal To TRUE if value is NOT equal variables numbers to value2 strings ISTYPE TRUE if the data type of the variable specified variables numbers by valuel corresponds to value2 a string strings representing the variable type value2 can be one of the following string literals BOOL STR INT DOUBLE or UNDEF ION guide Operators 66 Chapter 3 Variables Expressions amp Operators Logical Operators ION Script s logical operators are listed in the following table Note that values used with logical operators can be values variables or expressions but they must evaluate to a boolean value Operator Description Types Accepted AND Logical AND value AND value2 Boolean value or variable returns true if both value and value2 or expression that evaluate to true Returns false otherwise evaluates to a boole
40. FIELD1 ROW PRINT TD TR ENDFOR PRINT lt TABLE gt lt CENTER gt ENDELSE ION guide ION DATA OUT 148 Chapter 5 ION Script Tag Reference The following figure shows the starting page of this application pickfile ion 3 Netscape File Edit View Go Communicator Help Choose a data file to display mydatal dat mydata2 dat Blu x I p http hydra cgi bin T agParser exe Createl able e A When the user selects mydata1 dat the following page is returned Netscape File Edit View Go Communicator Help Biel E3 12 0000 53 0000 42 0000 34 0000 55 0000 66 0000 74 0000 90 0000 31 0000 10 0000 12 0000 23 0000 19 0000 18 0000 15 0000 10 0000 90 0000 76 0000 50 0000 34 0000 78 0000 86 0000 28 0000 33 0000 23 0000 53 0000 87 0000 42 0000 28 0000 64 0000 97 0000 18 0000 ION DATA OUT ION guide Chapter 5 ION Script Tag Reference 149 ION_EVALUATE The ION_EVALUATE tag evaluates expressions inside an ION Script document It can simply evaluate an expression or output the result of the expression into the resulting document
41. FORM gt These attributes can be set to either the name of a JavaScript VBScript function or procedure or to a single JavaScript VBScript statement Note that different browsers support different sets of events For example to call the JavaScript function MyFunction when the ION_FORM is submitted you would set the ONSUBMIT attribute as follows ONSUBMIT MyFunction To pop up a message box saying Form Submitted when the form is submitted you could set the ONSUBMIT attribute to a single JavaScript statement as follows ONSUBMIT alert Form Submitted The Advanced Examples page index_examples ion which can be accessed from the main examples page index ion contains several examples that demonstrate how to use JavaScript in an ION Script application such as how to validate form data using JavaScript and how to use JavaScript to capture mouse events in an ION_IMAGE configured as an image map Using JavaScript and VBScript ION guide Chapter 4 Creating ION Script Applications 91 Graphics in ION Script ION Script images can be created using either of IDL s graphics systems Direct Graphics or Object Graphics The following sections describe how each graphics system is implemented in ION Script Direct Graphics Images created using the IDL Direct Graphics commands are drawn to the IDL Z Buffer The Z Buffer is an 8 bit device that stores intensity values for each pixel These values are combined with th
42. File Edit View Go Communicator Help Below is an included text file Below is an included text file that uses lt PRE gt that does not use lt PRE gt PRO MyProg This is an IDL program PRO MyProg Array FINDGEN 10 FOR i 0 9 DO XDL BEGIN PRINT Array i ENDFOR is is an program END Array FINDGEN 10 FOR i 0 9 DO BEGIN PRINT Array i ENDFOR END ar Document Done JL a Document Done For more on including text files see ION_INCLUDE on page 165 Default of PRE TRUE for lt ION_DATA_OUT gt Select this checkbox on Windows or set Pre DO t in the ionsrc file on UNIX to use TRUE as the default value of the PRE attribute of the ION_DATA_OUT tag See ION DATA OUT on page 141 for a discussion and example using the PRE attribute Include when displaying Document COPYRIGHT Select this checkbox on Windows or set Use Copy t in the ionsrc file on UNIX to display the symbol when using the Document COPYRIGHT system variable See COPYRIGHT on page 157 and Document on page 51 for more on including a copyright statement in an ION Script page Debug ION Debug Location Set this field to a writable path specifying the location on the server machine in which to write the debug log file The debug log file is created when the DEBUG attribute of either the ION DATA OUT or ION IMAGE tag is set to TRUE This debugging file contains the exact code sent to IDL as well as any
43. HIDDEN NAME page VALUE ion page2 ion gt lt INPU YPE SUBMIT VALUE Load page via an HTML form gt lt FORM gt lt ION_BODY gt lt ION_SCRIPT gt page2 ion lt ION_SCRIPT gt lt ION_BODY gt ION IF EXPR S Document EVENT NE page gt The ION VARIABLE NAME SDocument EVENT gt loaded this page ION ELSE This page was not loaded from an event ION IF ION BODY System Variables ION guide Chapter 3 Variables Expressions amp Operators 53 lt ION_SCRIPT gt LASTUPDATE The date the document was last updated defined with the lt LASTUPDATES tag TITLE The document title defined with the lt TITLE gt tag Form Form variables are variables that arrived in the page as the result of one of the following An HTML or ION Script form being submitted e AnION LINK being clicked e A value passed to the page in a URL query string Form variables are always treated as strings Form variables are referred to using the following syntax Form Formvar Formvar can be any of the following e The NAME attribute of an lt INPUT gt tag For example consider the following form field definition lt INPUT NAME MyVar TYPE TEXT VALUE Hello gt On the action page of this form you would refer to the v
44. ION ELSEIF ION ELSE ION guide Chapter 5 ION Script Tag Reference 159 ION IMAGE The ION IMAGE tag pair inserts an IDL generated graphic into an ION Script document Both Direct and Object graphics images can be generated An EVENT assigned to the ION IMAGE makes the image an input that can be clicked on to load a new ION Script document The location of the mouse click is passed on to the new document through the Mouse x and Mouse y system variables The IDL code that generates the image is embedded an lt IDL gt lt IDL gt block inside the ION IMAGE block For a Direct Graphics image the last image created using a Direct Graphics command is rendered to the output page For an Object Graphics image the last image rendered to the ION SCRIPT BUFFER object is output in the page For images with events ION Script creates the image using the HTML INPUT TYPE IMAGE NAME EventName ALT LABEL gt For images without events ION Script creates the image with the HTML IMG NAME IMG ALT LABEL gt Syntax ION guide lt ION_IMAGE TYPE DIRECT OBJECT BORDER width DEBUG TRUE FALSE EVENT eventName HEIGHT Aeight IMG_TYPE PNG8 PNG24 JPEG24 LABEL label SERVER url TARGET frame target WIDTH width lt IMG gt attributes if EVENT not present or lt INPUT gt attributes if EVENT present gt lt IDL gt IDL code can contain variable lt IDL gt lt ION_IM
45. ION EVALUATE EXPR SSCALE MIN USER SCALE MIN ION EVALUATE EXPR SSCALE MAX USER SCALE MAX ION EVALUATE EXPR SSCALE TOP S USER SCALE TOP ION IF 6 Lastly we need to add an ION INCLUDE tag in ex2 main ion to include the validation page Validate the user input ION INCLUDE SRC ion exl validate ion Example Creating a Complete Application ION guide Chapter 5 ION Script Tag Reference The following topics are covered in this chapter e Syntax Conventions e HTML Mappings The HTML Comment Tag e Alphabetical Listing of ION Script Tags ION guide 113 114 Chapter 5 ION Script Tag Reference Syntax Conventions ION Script tags take one of the following two forms TAG content lt TAG gt TAG Tag Pair Single Tag Noe It is important to note that single tags are closed with gt Don t forget the or you will get a syntax error The following table lists which ION Script tags are tag pairs and which are single tags Tag Pairs Single Tags EVENTS lt EVENTS gt EVENT DECL IDL lt IDL gt ION BUTTON ION BODY ION BODY ION CHECKBOX ION DATA OUT ION DATA OUT ION EVALUATE ION FORM ION FORM ION ELSE gt ION HEADER ION HEADER ION ELSEIF gt ION IF ION IF ION INCLUDE
46. ION FORM Note that each text input field is given a name A variable called Form name is automatically created for each text field where name is the NAME attribute of the INPUT tag Therefore we can now access the values entered by the user by referring to the Form SCALE MIN Form SCALE MAX and Form SCALE TOP variables We assign each text field an initial value using the INPUT tag s VALUE attribute This is the value that appears in the text field when the page is initially loaded After adding a form the page now looks like this Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications 101 3 ION Script Image Example Netscape File Edit View Go Communicator Help 4X P 4244 2 uu c wd N Back Forward Reload Home Search Netscape Print Security ION Script Image Example Image Size 1200 1200 Region Size 320 256 Region Center 600 600 Color Scale Range Min o Max ess Top 255 Scale Colors Defining the Event The ION_BUTTON tag in our form uses the EVENT attribute to specify the name of the event that occurs when the user clicks the button In this case we called our event SCALE COLORS We must now define the SCALE COLORS event which we do by adding to the ex1_main ion header block an EVENTS block that contains an EVENT DECL tag EVENTS EVENT DECL NAME SCALE COLORS ACTION ion exl scale ion EVENTS
47. ION_DATA_OUT gt Attributes ASTEXT If your IDL output contains HTML tags or text that contains characters used in HTML and you want these characters displayed as text such as a code listing rather than being rendered as HTML set this attribute to TRUE When ASTEXT is set to TRUE ION Script converts special characters in text output from IDL such as lt and amp to character entities so that they will not be interpreted as HTML by the browser Setting this attribute to FALSE prevents ION Script from converting special characters to character entities The default is FALSE The following example illustrates the difference between ASTEXT TRUE and ASTEXT FALSE lt ION_SCRIPT lt ION_BODY gt lt ION_DATA_OUT PRE TRUE ASTEXT TRUE gt lt IDL gt print lt HR gt lt IDL gt lt ION_DATA_OUT gt lt ION_DATA_OUT PRE TRUE ASTEXT FALSE gt lt IDL gt print lt HR gt V ION guide ION DATA OUT 142 Chapter 5 ION Script Tag Reference lt IDL gt lt ION_DATA_OUT gt lt ION_BODY gt lt ION_SCRIPT gt The following figure shows the result of the above code rd Netscape ioj x File Edit View Go Communicator Help lt HR gt iif D Document Done DEBUG Setting this attribute to TRUE causes the following e ION Script generates a text file that can be used to help debug your ION Script application This debugging file contains the exact co
48. TYPE IMAGE gt attributes gt Attributes BORDER ION guide The width of the border drawn around the image A value of 0 causes the image to be displayed without a border The default value is 1 but this default can be changed on the Images tab of the ION Script Configuration utility Windows or in the Images section of the ionsrc file UNIX This attribute is used only when TYPE is set to IMAGE This attribute can contain a variable ION BUTTON 136 Chapter 5 ION Script Tag Reference Note ION BUTTON TYPE IMAGE gt creates lt INPUT TYPE IMAGE gt Note that not all browsers support borders on lt INPUT TYPE IMAGE gt EVENT The name of the EVENT to execute when the user clicks the button This name must be one of the names defined in the NAME attribute of an EVENT_DECL tag This attribute can contain a variable LABEL The text that appears on the button face This attribute can contain a variable METHOD The method used to submit form data Valid values include e GET Passes information via the URL The amount of information that can be passed using the GET method is limited by server and browser URL length limitations An advantage of the GET method however is that the user can bookmark the URL and the browser s Reload button works seamlessly This is the default method e POST Form input is submitte
49. This example can be run by running the file pickfile ion in the examples directory 1 Inthe ION61 ion_script examples data directory there are two ASCII text files named mydatal dat and mydata2 dat containing a rectangular matrix of data such as the following 12 53 42 34 55 66 74 90 31 10 12 23 19 18 15 10 90 76 50 34 78 86 28 33 23 53 87 42 28 64 97 18 2 In the ION61 ion script examples directory is the ION Script file pickfile ion which is the starting page of the application LION SCRIPT ION HEADER EVENTS EVENT DECL NAME CreateTable ACTION ion createtable ion lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt U gt lt B gt Choose a data file to display lt B gt lt U gt lt BR gt lt BR gt lt TT gt lt ION_LINK EVENT CreateTable NAME1 filename VALUE1 mydatal dat gt mydatal dat lt ION_LINK gt lt TT gt lt BR gt lt BR gt lt TT gt lt ION_LINK EVENT CreateTable NAME1 filename VALUE1 mydata2 dat gt mydata2 dat lt ION_LINK gt lt TT gt lt ION_BODY gt lt ION_SCRIPT gt 3 In the ION61 ion_script examples directory is the EVENT page createtable ion Note that the form variable Form filename holds the name of the data file corresponding to the clicked ION_LINK Also note that the FILEPATH function in the lt IDL gt block points to the data files
50. This is Frame2 j Jame 2 Note that main htm1 does not use the lt BODY gt tag the lt FRAMESET gt tag is used instead We can further divide one of the frames in the previous example vertically into two frames by nesting a lt FRAMESET gt within the main lt FRAMESET gt as follows HTML lt FRAMESET ROWS 25 FRAME NAME Framel SRC http myserver framel html lt FRAMESET COLS 50 gt FRAME NAME Frame2 SRC http myserver frame2 html lt FRAME NAME Frame3 SRC http myserver frame3 html FRAMESET lt FRAMESET gt lt HTML gt This creates the following Web page Netscape OE x File Edit View Go Communicator Help This is Frame This is Frame2 This is Frame3 ION guide Using Frames with ION Script 84 Chapter 4 Creating ION Script Applications Tip Note the way that we referred to the HTML files in the SRC attribute of the FRAME tag For example consider the following HTML lt FRAME NAME Framel SRC http myserver framel html gt In this case the file frame1 htm1 must be located in your Web server s default document directory such as htdocs To allow us to keep the HTML files in the same location as the ION Script files we can change the SRC attributes of our FRAME tags to load the HTML page using ion p instead lt FRAME NAME Framel S
51. URLs HTML Forms vs ION Script Forms e Passing Name Value Pairs in a URL e Handling Multiple Selections in a SELECT Element e Passing IDL Variables to ION Script e Using Frames with ION Script e Using JavaScript and VBScript e Graphics in ION Script e Using Special and International Characters e Example Creating a Complete Application ION guide 69 70 Specifying URLs Chapter 4 Creating ION Script Applications The following ION Script tags have an attribute that takes a URL as its value ION Script Tag Attribute pee lt EVENT_DECL gt ACTION http https file 10n lt ION_BODY gt BACKGROUND http https file lt ION_BUTTON TYPE IMAGE gt SRC http https file lt ION_IMAGE gt SERVER http https lt ION_INCLUDE gt SRC http https file ion In addition the following HTML tags have an attribute that can take a URL that points to an ION Script page HTML Tag Attribute Allowable Protocols lt FORM gt ACTION http https file ion lt FRAME gt SRC http https file ion lt IFRAME gt SRC http https file ion The general syntax for URLs is as follows protocol username password hostname port path protocol must be one of the following e http used to specify the location of a file on a remote network such as the WWW e https used to specify the location of a file on a remote network handling secure transactions Specifying URLs
52. You need only specify this protocol to take advantage of this security which the Web server and browser handle for you If you want to use https you can change existing references to http in the following three places e The Image Server URL configuration setting used to find 1on i e The ION Script Parser URL configuration setting used to find the parser via a URL the ion protocol uses this setting e The ionand html code used with ION ION guide Specifying URLs 72 Chapter 4 Creating ION Script Applications File URLs File URLs are used to access files on a particular host computer as opposed to files located on a remote network such as the WWW The file protocol is intended to provide access to text and other files on your Web server such as when you want to include a file in your ION Script page using the ION INCLUDE tag The syntax for URLs that use the file protocol is as follows file path filename If the path is absolute the leading must be present as in the following examples UNIX file usr local etc readme txt Windows file cl projects ionscript readme txt Note __ sss EFeeSSSSSSSSS S C FFSSSSSSSS For Windows drives a vertical line is used in place of the colon when specifying the drive ION URLs The ion protocol causes the page referred to in the URL to be parsed by the ION Script parser When the ion protocol is used the page referred to in the URL wi
53. denote an octal constant Therefore the following statement is not valid print 1 Elm Street To avoid the syntax error caused by the above statement you can enclose your string in single quotation marks print 1 Elm Street Keep this in mind when using ION Script variables in an lt IDL gt block as well For example suppose you have defined the following ION Script variable VARIABLE DECL NAME Address VALUE 1 Elm Street TYPE STR Assume you used the following code to print the value of this variable in an lt IDL gt block print SAddress This code would be evaluated as print 1 Elm Street Because 1 has a special meaning in IDL the above code would cause a syntax error Instead you would need to enclose the variable in single quotation marks as follows print SAddress IDL ION guide Chapter 5 ION Script Tag Reference 127 Commenting IDL Code IDL code inside the lt IDL gt lt IDL gt block can contain comments IDL comments begin with the semicolon character Everything after the character is ignored on that line Comments can exist on their own line or at the end of a line of code as in the following example lt IDL gt This comment is on its own line A 10 This comment is on the same line as a command IDL Note Comments cannot exist on a line that contains the line continuation character See the following section U
54. errors reported by IDL If not set the file is written to the default location that your Web server uses for CGI executables For example on the Apache Web server this would be the cgi bin directory ION Script Configuration Options ION guide Chapter 1 Configuring ION Script 25 ION Debug Filename Set this field to the filename of the debug log file The debug log file is created when the DEBUG attribute of either the ION DATA OUT or ION IMAGE tag is set to TRUE This debugging file contains the exact code sent to IDL as well as any errors reported by IDL Instead of using a specific filename you can include the d formatting string in it such as ioni log 6d txt This causes the process ID of ion i to be inserted where the formatting characters are Because the process ID is different each time ion i is requested the log filename is different each time thereby preventing the log file from being overwritten If not set the default filename is ion out d Syntax Logging This field defines the default method for reporting ION Script syntax errors On Windows select one of the following buttons e Off Error messages are not reported e As Comment Error messages are included in the returned HTML page as part of an HTML comment This makes the error messages accessible but invisible to the client To view the error messages you must view the source of the HTML page sent to the browser by selecting View Page S
55. http hostname cgi bin ion i ION Script Parser URL Parser URL http hostname cgi bin ion p Files IDL Search Path IDL Path usr local rsi ion 6 1 ion script ION Search Path ION Search Path 10N DIR ion script examples ION Temp Location ION Temp Location tmp Text Extensions ext Exts txt text ION Extensions ION Exts ion Redirect Protocols Redir Protos http TAENCPOr mat Use PRE with Text Files Pre Txt t Default of PRE TRUE for ION DATA OUT Pre DO t Include c when displaying Doc COPYRIGHT 15 Configuring ION Script for UNIX Chapter 1 Configuring ION Script Use Copy t kck Debug ckck Location for debug log files ION Debug Location Format for ion i log files ION Debug Filename ion out d txt Syntax errors from ion p can be returned to the browser Valid options are OFF COMMENT or PRE ION Debug Syntax OFF Manually Configuring Your UNIX Web Server If you skipped the Web Server Configuration dialog during the UNIX installation process you will need to either execute the script config script located in the RSI DIR ion 6 1 ion script bin directory or perform the following tasks manually to ensure that ION Script knows the necessary information about your Web Server Copy the ION Script Executables Web servers have a default directory in which CGI executables are located This
56. lt FORM NAME MyForm ACTION http server cgi bin ion p INPU YPE HIDDEN NAME page VALUE filename xxx gt lt INPU YPE SUBMIT gt lt FORM gt lt HTML gt ION guide Requesting an ION Script Page 38 Chapter 2 Overview Where to Store Your Files This section provides some strategies for locating your ion html and pro files How HTML Files Are Normally Requested You re probably used to requesting HTML files using URLs that look like this http www mydomain com index html In this case the file index html is located in the Web server s default document directory On the Apache Web Server for example this is called htdocs by default Files requested via the HTTP protocol must be located in or under the htdocs directory unless you have changed the Apache server settings in the httpd conf file to include other directories You could create a subdirectory of nt docs called htmlfiles and locate your html files in this directory The URL to which you would refer would be http www mydomain com htmlfiles index html Often users request a URL such as http www mydomain com In this case the Web server will serve a default page which is specified in the Web server configuration file If you want your users to be able to access your ION Script application using a URL such as http www mydomain com you need to define a default page in your Web server configuration file an
57. more than one name value pair uses the same name then a single Form variable is created in which the values assigned to the variable are separated by the character For example if you pass to the ION Script parser the URL http host cgi bin ion p exe varl One amp varl Two amp varl Three then a Form variable named Form var1 will be created with the value OnelTwolThree This functionality is helpful when you use the MULTIPLE attribute to the SELECT element to allow the user to select multiple options from a drop down list In this case each of the options selected by the user will be appended to the Form variable and separated by the character when the form is submitted You must then parse the Form variable to extract the values For an example of how to use the MULTIPLE attribute of the SELECT tag see Handling Multiple Selections in a SELECT Element on page 77 Passing Name Value Pairs in a URL ION guide Chapter 4 Creating ION Script Applications 77 Handling Multiple Selections in a SELECT Element When the MULTIPLE attribute is specified for the HTML SELECT tag the user is allowed to select multiple options When a user selects multiple options ina SELECT element that resides in an ION FORM the Form variable created on the page that is loaded when the form is submitted contains the value of all selected options separated by the I character For example suppose an ION FORM contains the f
58. simply the HTML TITLE tag Including a lt TITLE gt tag in your ION HEADER block allows you to access the variable Document TITLE Events and Variables ION Script event and variable declarations are made in the header section using the EVENTS and VARIABLES tags respectively HTML Mapping ION guide The ION HEADER tag is converted to the HTML HEAD tag All attributes of the HTML lt HEAD gt tag can be used in the opening ION HEADER tag Additionally any HTML tags that can be nested inside the lt HEAD gt lt HEAD gt block can be included inside the ION HEADER ION HEADER block The ION Script metadata tags are also converted to HTML as illustrated in the following examples ION Script Metadata Tag Resulting HTML lt AUTHOR gt name lt AUTHOR gt lt META NAME Author CONTENT name gt lt APPLICATION gt myapp lt META NAME Application lt APPLICATION gt CONTENT myapp gt lt COPYRIGHT gt 2001 lt COPYRIGHT gt lt META NAME Copyright CONTENT 2001 gt lt DATE gt 1 1 01 lt DATE gt lt META NAME Date CONTENT 1 1 01 gt lt LASTUPDATE gt 1 1 01 lt META NAME LastUpdate lt LASTUPDATE gt CONTENT 1 1 01 gt ION HEADER 158 Chapter 5 ION Script Tag Reference ION IF ION ELSEIF ION ELSE The ION_IF tag pair is the main flow control tag in ION Script It allow
59. so make sure you know which information is required by the plug ins you are supporting The lt OBJECT gt tag was originally implemented by Microsoft to support their ActiveX applets In a similar manner Netscape initially supported the alternative lt EMBED gt and APPLET tags for inclusion objects and later provided support for the OBJECT tag HTML 4 0 standard supports the OBJECT tag and this is expected to be the standard If you want your code to be supported in the future it is recommended you use the lt OBJECT gt tag before the lt EMBED gt tag Syntax ION guide lt ION_OBJECT FILE filename MIME mime type DEBUG TRUE FALSE DELETE_FILE TRUE FALSE HEIGHT height OBJTYPE EMBED OBJECT SERVER server name WIDTH Wwidth Any attribute of the HTML lt EMBED gt or lt OBJECT gt tags gt ION PARAM tags ION OBJECT 174 Chapter 5 ION Script Tag Reference lt IDL gt IDL code used to write a file named filename lt IDL gt lt ION_OBJECT gt Attributes In addition to the attributes listed below it is usually necessary when using the HTML lt OBJECT gt or lt EMBED gt tag to specify an attribute that tells the plug in where to retrieve the data that will be displayed by the plug in For the lt OBJECT gt tag the DATA attribute is used for this purpose For the lt EMBED gt tag the SRC attribute is used Some plug ins ignore the DATA or SRC attribute and in
60. the file or script you requested cannot be found such as HTTP Error 404 but the URL you are using appears to be correct check the following The required executables may not have been copied to your Web server s cgi bin directory Make sure that the files ion i exe and ion p exe Windows or ion i ion I ion p and ion P UNIX are in your Web server s cgi bin directory If not copy them from the ION61 ion script cgi bin subdirectory of your ION Script installation to your Web server s cgi bin directory On UNIX make sure that the files ion i ion I ion p and ion P have execute permission Note that these executables would not be copied to the cgi bin directory if during the installation process you left the field blank on the Web Server Configuration dialog in which you specify the CGI executables directory If you are using Microsoft IIS the exe extension must be included in URLs that point to executables You will need to use 1on p exe instead of ion p in any URLs in your HTML and ION Script pages and in the location field of your browser when requesting a URL 194 Chapter 6 Troubleshooting No Event or Page Errors e If you get Error No event or page when you use the Enter key to submit an ION FORM containing a single text field you need to associate an event with the text field by defining an event with the same name as the NAME attribute of the text field For an example see Forms Containi
61. to perform client side validation of form data before allowing the form to be submitted to the server thereby saving your server from having to check form data This attribute can contain a variable TARGET The name of the window or frame in which to load the URL specified by an EVENT contained within the form when the form is submitted This attribute can be set to either the NAME attribute of an HTML FRAME or IFRAME tag or to one of four predefined windows blank parent self or top See Targeting Different Frames on page 88 for a description of these predefined windows See Overview of Fixed Framesets on page 82 for an example of how to use the TARGET attribute ONSUBMIT The script to execute when the form is submitted See Using JavaScript and VBScript on page 90 for information on specifying this attribute ONRESET The script to execute when the form is reset See Using JavaScript and VBScript on page 90 for information on specifying this attribute Forms Containing a Single Text Field ION guide HTML forms that contain a single text field can be submitted by pressing the Enter key when the cursor is in the text field If your ION FORM contains a single text field pressing the Enter key when the cursor is in the text field will cause an error unless an event is associated with the text field To prevent an error make sure you have defined an event with the same name as the NAME attribute of the text field F
62. variables for the values entered by the user Values entered in a form become Form variables which are automatically passed to the action page when an event occurs Creating the Action Page We ve provided a means of user input established the variables as persistent so that their values can be passed to the action page and specified that the page exl scale ion be processed when the user clicks the button All that s left is to create the ex1_scale ion page that generates the scaled image We can make use of the Form variables in the IDL code that generates the scaled image The ex1 scale ion page is coded as follows ION SCRIPT ION HEADER lt TITLE gt Scaled Image lt TITLE gt ION HEADER ION BODY lt FONT SIZE 2 gt Scaled Image lt FONT gt lt BR gt lt BR gt ION IMAGE WIDTH SREGION W HEIGHT SREGION H TYPE DIRECT gt lt IDL gt Read in the original image image read png filepath subdir ion script examples data landsat png r g b Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications ION guide Calculate the x subscripts xstart SCENTER_X SREGION_W 2 xend SCENTER_X SREGION W 2 1 Calculate the y subscripts ystart SCENTER_Y SREGION_H 2 yend SCENTER Y REGION_H 2 1 Create the reg
63. want to display the value of a variable on the Web page For example we could help the user of our application determine what portion of the image is being displayed by writing to the page the sizes of the original and displayed images and the center of the display region The ION VARIABLE tag is used to insert the value of a variable into a page We ll display three variables on our page by adding the following code to exi main ion BR lt B gt Image Size B ION VARIABLE NAME SIMAGE W ION VARIABLE NAME SIMAGE_H gt lt BR gt lt B gt Region Size B ION VARIABLE NAME SREGION W ION VARIABLE NAME SREGION_H gt lt BR gt lt B gt Region Center B ION VARIABLE NAME SCENTER X ION VARIABLE NAME SCENTER Y Loading ex1_main ion in our browser now results in the following page HX ION Script Image Example Netscape BEE File Edit View Go Communicator Help x 3 ia b ION Seript Image Example i x p re EFRY Image Size 1200 1200 Region Size 320 256 Region Center 600 600 eae Document Done Z Note LA The ION VARIABLE tag can also be used to insert an ION Script variable into an HTML tag attribute See Variable Substitution in Attribute Values on page 117 ION guide Example Creating a Complete Application 100 Chapter 4 Creating ION Script Appli
64. you could load the page using a URL of the following format http myhost mydomain com cgi bin ion p page myfile html See Overview of Fixed Framesets on page 82 for an example of how the SRC attribute of the lt FRAME gt tag can also use this type of URL If you want to keep your ion and html files in the same directory but also want to use your Web server s default documents directory to store your htm1 files you could add the Web server s default documents directory to your ION Search Path IDL Files ION guide The IDL Search Path is the path IDL uses to find pro and sav files Initially RSI DIR IDL61 products ION61 ion_script and its subdirectories are the only directories specified for the IDL Search Path Note By default the directory RSI DIR IDL61 products ION61 ion_script examples Windows or RSI DIR ion_6 1 ion_script examples UNIX and its subdirectories are automatically searched by IDL You do not need to add this directory to the IDL Search Path However you may want to keep your own IDL files in another location For example you could create a directory called C ion pro Windows or home ion pro UNIX in which to store your pro and sav files You would then add this directory to your IDL Search Path which would then look like this Where to Store Your Files 40 Chapter 2 Overview Windows C rsi IDL61 products ION61 ion_script examples C ion pro UNIX usr local rsi ion
65. 2 INPUT Chapter 5 ION Script Tag Reference For SUBMIT and RESET buttons VALUE specifies the button label If VALUE is not specified Submit Query and Reset are the default button labels For CHECKBOX and RADIO buttons VALUE does not specify whether the button is checked or unchecked this is specified with the CHECKED attribute Instead VALUE simply assigns a value to the checkbox or radio button For HIDDEN fields VALUE specifies the value that is passed to the server upon form submission ION guide Chapter 5 ION Script Tag Reference 133 ION BODY The ION BODY tag pair delimits the body section of an ION Script document The body is the part of the ION Script document that is converted into HTML for display in a Web browser All valid HTML tags are allowed in the body that is between the ION BODY and ION BODY tags Note that it is not necessary to include the lt HTML gt or lt BODY gt tags in an ION Script page ION Script inserts these elements automatically Syntax ION BODY BACKGROUND image url BGCOLOR rgb value or color name LINK rgb value or color name TEXT rgb value or color name VLINK rgb value or color name ALINK rgb value or color name ONLOAD script ONUNLOAD script Any other lt BODY gt attributes gt ION and HTML content ION BODY Noe HTML allows you to specify lt BODY gt attributes without using quotation marks
66. 30 SIZE 3 gt lt ION_BUTTON TYPE BUTTON LABEL Show Plot EVENT PLOT gt lt ION_FORM gt lt ION_BODY gt lt ION_SCRIPT gt frame2 ion lt ION_SCRIPT gt lt ION_HEADER gt lt VARIABLES gt VARIABLE DECL NAME DISP_VALUE VALUE Form DISP_VALU TYPE INT gt lt VARIABLES gt ION HEADER fl lt ION_BODY gt ION IF EXPR SDISP VALUE LE 0 gt tt ION VARIABLE NAME S DISP VALUE tt is too small ION ELSE ION IMAGE TYPE DIRECT gt lt IDL gt loadct 5 show3 dist SDISP_VALUE lt IDL gt lt ION_IMAGE gt lt ION_IF gt ION BODY ION SCRIPT blank html HTML HTML Load main html in your browser using a URL such as http myserver cgi bin ion p page main html ION guide Using Frames with ION Script 86 Chapter 4 Creating ION Script Applications When you click the Show Plot button you ll see the page shown in the following figure F Netscape o x File Edit View Go Communicator Help Display Value IE o Note that when loading an ION Script page through an HTML tag such as lt FRAME gt you must explicitly pass name value pairs in the URL for any variables required by the ION Script page For example suppose in the previous example that you w
67. AGE gt ION IMAGE 160 Chapter 5 ION Script Tag Reference Notes About Using ION_IMAGE Note the following when using the ION IMAGE tag e The IDL code inside the lt IDL gt lt IDL gt block can consist of the actual IDL statements that generate an image or can simply be a call to a pro file that generates an image e Unlike ION DATA OUT ION IMAGE does not support the POST method This is because image data is always passed to 1on i via an encrypted URL If IDL blocks in your ION IMAGE tags are large enough to exceed the maximum allowable length of a URL such as very large data sets or a very large amount of IDL code then you can work around the limitation by first using ION DATA OUT to create an IDL sav file and then simply restoring the sav file in the ION IMAGE call For an example of this technique see the example application 1argeData ioninthe examples directory e The IDL code in the lt IDL gt block of an ION IMAGE tag is not processed until the entire ION Script page has been parsed into HTML Therefore ION IMAGE cannot be used to create data that is later used in constructing the web page For example you cannot use ION IMAGE to create a sav file that is restored in the lt IDL gt block of an ION IMAGE or ION DATA OUT tag on the same page Similarly you cannot use ION IMAGE to create a file that is included in the same ION Script page with ION INCLUDE For these cases you would need to create the da
68. ALSE if A B evaluates to 0 and TRUE if A B evaluates to anything other than 0 String Expressions String expressions are expressions that return strings Strings can be used with five operators EQ NE CONTAINS and ISTYPE The operator is used to concatenate or combine two strings For example the expression Hello World yields Hello World The following are examples of string expressions e Your name is Name e RST e Form variable All Form variables are treated as strings See INPUT on page 129 for information on when you should declare variables corresponding to Form variables e 5 gallons When adding a numeric value to a string value the result of the numeric value is concatenated as a string to the string value Name CONTAINS Smith Note that Name in the above examples must be a string If you declare a variable as type string and assign it a numeric value the number will be converted to double precision and then to a string For example the following code creates a string variable and assigns the value 35 4 VARIABLE DECL NAME A VALUE 35 4 TYPE STR gt If you write the value of this variable to the page it will read as 35 40 instead of 35 4 To prevent the number from being converted to a double precision value enclose it in single quotation marks as follows XVARIABLE DECL NAME A VALUE 35 4 TYPE STR gt
69. AME SUSERENTRY gt ION IF As with HTML tags some ION Script tags are called tag pairs meaning that they must contain an opening and closing tag such as ION BODY ION BODY ION BODY Other ION Script tags are called single tags which do not contain a closing tag Unlike single HTML tags such as lt BR gt and lt INPUT gt single ION Script tags such as VARIABLE DECL use XML syntax and are therefore closed with gt instead of just gt VARIABLE DECL NAME A VALUE 5 TYPE INT ION Script Applications An ION Script application is composed of one or more ION Script pages that contain ION Script and HTML tags An ION Script application can also contain pure HTML pages that can link to other ION Script pages Unlike an HTML page which is passed directly from the Web server to the client an ION Script page is first parsed by the ION Script parser which converts any ION Script content to HTML before returning the page to the client The ION Script content can consist of tags that embed IDL data or visualizations and tags that add brains to your application allowing you to generate Web pages dynamically depending on the user s actions For example you can allow your users to click on an IDL generated image to zoom in on a certain part of the image or provide users with a choice of image processing algorithms to apply to the image
70. BUTTON EVENT PAGE2 TYPE BUTTON gt ION FORM ION BODY htmlform ion ION BODY lt FORM ACTION http myserver cgi bin ion p lt INPUT TYPE HIDDEN NAME page VALUE page2 ion gt lt INPUT NAME Text1 TYPE TEXT VALUE Hello lt INPU YPE SUBMIT gt lt FORM gt lt ION_BODY gt page2 ion lt ION_BODY gt ION VARIABLE NAME S Form Text1 gt ION BODY HTML Forms vs ION Script Forms ION guide Chapter 4 Creating ION Script Applications 75 Passing Name Value Pairs in a URL Any name value pairs passed in a URL query string to the ION Script parser will become ION Script variables in the page loaded by the URL For example consider the URL in the following ION Script page pagel ion ION SCRIPT ION BODY A HREF 2 http host cgi bin ion p exe page page2 ion amp varl 5 amp var2 abc Pass varl and var2 to page2 ion lt A gt lt ION_BODY gt lt ION_SCRIPT gt When you click the link in the above page the values var1 and var2 are passed to page2 ion You can access these values on page2 ion as Form varl and Form var2 as shown in the following example page2 ion ION SCRIPT ION BODY The value of varl is ION VARIABLE NAME Form varl BR The value of var2 is ION VARIABLE NAME F
71. DL Search Path specifies that the directory C rsi IDL61 products ION61 ion_script examples and all its subdirectories be searched as well as the directory C ion pro C rsi IDL61 products ION61 ion_script examples C ion pro The following UNIX IDL Search Path specifies that usr local rsi ion be searched as well as the directory home ion and all its subdirectories usr local rsi ion home ion Note By default the directory RSI DIR IDL61 products ION61 ion_script examples Windows or RSI DIR ion_6 1 ion_script examples UNIX and its subdirectories are automatically searched by IDL You do not need to add this directory to the IDL Search Path Noe On UNIX make sure that any directory you add to the IDL Search Path has the proper read permissions See Where to Store Your Files on page 38 for strategies on locating IDL files ION Search Path The ION Search Path field is used to specify the search path for URLs using the file or ion protocols ION Script searches the ION Search Path for the specified file specified by the page parameter in the URL When ION Script searches the ION Search Path it will search all directories specified in this field in the order listed Multiple directories can be specified by separating the directory names with a semicolon Windows or colon UNIX as in the following examples Windows C rsi IDL61 products ION61 ion_script examples C ion C ion test UNIX u
72. EMBED Refer to ION OBJECT on page 173 for examples on using ION IDLURL temp SION temp is a read only string value specifying the location in which ION Script writes temporary files before transferring them to the client This location is specified on the Files tab of the ION Script Configuration Utility Windows or in the Files section of the ionsrc file UNIX SION temp can be used to write files to the temporary directory when writing files from your ION Script application System Variables ION guide Chapter 3 Variables Expressions amp Operators 59 uniquelD SION uniqueID is a read only integer value representing the process number of the ion p process Because the process number is unique each time ion p is executed this number can be used to create unique filenames when writing files from IDL This prevents files written by your ION Script application from being overwritten when multiple users are running your application For an example in which ION temp and SION uniqueID are used to generate a filename see the example application largeData ionin the examples directory Version SION version is a read only string value specifying the version of ION Script you are currently using Mouse ION guide The Mouse system variables store the x and y coordinates of the mouse cursor when the mouse is clicked on an ION IMAGE an ION BUTTON of TYPE IMAGE or any HTML image created with lt INPUT TYPE
73. FALSE lt BR gt lt ION_DATA_OUT PRE TRUE ASTEXT FALSE gt lt IDL gt A 1 2 31 B 4 5 6 print lt H1 gt print A print B print lt H1 gt lt IDL gt lt ION_DATA_OUT gt ION DATA OUT ION guide Chapter 5 ION Script Tag Reference 145 ION BODY ION SCRIPT The following figure shows the resulting output in the browser for the four combinations of ASTEXT and PRE Netscape CU E3 Netscape OE x File Edit View Go Communicator Help File Edit View Go Communicator Help PRE TRUE ASTEXT TRUE PRE TRUE ASTEXT FALSE Hi 1 2 3 4 5 6 lt H1 gt 2 3 il lf D Document Done JA f D Document Done A Eile Edi View Go Communicator Help File Edit View Go Communicator Help PRE FALSE ASTEXT TRUE PRE FALSE ASTEXT FALSE lt H1 gt 123456 lt H1 gt 123456 wa Domet Doe uP D Domet Dore Example 2 In this example we will use IDL to dynamically generate HTML The first page of this application allows the user to choose which data file to display as an HTML table The EVENT page passes the path and filename to an IDL procedure that generates an HTML using data from the specified file Note that unlike Example 1 we must call an IDL pro file because we use an IDL FOR loop which cannot be used at the command line and therefore cannot be used in an lt IDL gt block ION guide ION DATA OUT 146 Chapter 5 ION Script Tag Reference Note
74. IMAGE gt X Mouse x stores the x location of the cursor y Mouse y stores the y location of the cursor Note that when you click an image the browser considers the origin 0 0 to be the upper left corner of the image In IDL however the origin of the image is the lower left corner Therefore when you want to pass the y location of the mouse click to IDL you must subtract Mouse y from the height of the image For example to annotate a 300 x 300 image at the location of the mouse click using the XYOUTS procedure you could use IDL code similar to the following XYOUTS Mouse x 300 Mouse y You clicked here DEVICE To see this behavior in an ION Script application run the example mouse ion in the ION61 ion script examples subdirectory of your ION Script installation See ION IMAGE on page 159 for another example using Mouse The default values of Mouse x and Mouse y are 0 0 therefore you can check to see if the user has clicked the mouse with the statement ION IF EXPR SMouse x NE 0 0 System Variables 60 Chapter 3 Variables Expressions amp Operators See Using the Mouse System Variable on page 107 for an example that employs this technique System Variables ION guide Chapter 3 Variables Expressions amp Operators 61 Expressions An expression is a combination of values variables and or other expressions separated by operators or simply a single value or va
75. ION Script attribute For example the ION Script code ION BUTTON EVENT event TYPE BUTTON gt is converted to the HTML lt INPUT TYPE SUBMIT NAME event gt Therefore if you specify the NAME attribute in the ION BUTTON tag it will be ignored HTML Mappings ION guide Chapter 5 ION Script Tag Reference 119 The HTML Comment Tag ION guide The HTML comment tag is used to add text to an HTML document without including that text in the Web page When used in an ION Script page HTML comment tags and the content they enclose are passed unchanged directly to the browser The HTML comment tag consists of the opening tag lt and the closing tag gt Text between lt and gt will not appear in the Web page nor will it be evaluated by the ION Script parser This text will not be displayed on the Web page This comment will however be passed in the HTML file sent to the browser and can be seen by viewing the page source View Source Comments can be used on a single line as shown above or can span multiple lines as follows This text will not be displayed on the Web page Comments are used in the following ways e Documenting your code Comments are useful in documenting your Web page or ION Script application and can help clarify your ION Script code for you and other developers e Debugging ION Script applications Comments allow you to t
76. ION page2 ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt ION FORM NAME forml lt INPUT NAME num TYPE TEXT ION BUTTON TYPE BUTTON EVENT go LABEL Find square root ION FORM ION BODY ION SCRIPT 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 SION 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 STEMPFILE and the value entered by the user Passing IDL Variables to ION Script ION guide Chapter 4 Creating ION Script Applications 81 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 lt ION_SCRIPT gt lt ION_HEADER gt
77. ION_SCRIPT gt lt ION_BODY gt lt SCRIPT LANGUAGE JScript gt var str ION VARIABLE NAME SForm Region DISPLAY FALSE gt var str_array str split for i 0 1i lt str_array length i document write str_array i document write lt br gt lt SCRIPT gt lt ION_BODY gt lt ION_SCRIPT gt ION guide Handling Multiple Selections in a SELECT Element 80 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 pagel ion lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME go ACT
78. LAY TRUE ION BODY ION SCRIPT Example 3 Include the file includefile txt ION SCRIPT ION BODY ION INCLUDE SRC file includefile txt ION BODY ION SCRIPT Assuming txt is listed as one of the Text Extensions in the configuration utility or ionsrc file the file is automatically treated as a text file If the configuration option Use lt PRE gt with Text Files is turned on this results in the following page Note that this is the same as including the HTML file with ASTEXT TRUE and PRE TRUE ION INCLUDE ION guide Chapter 5 ION Script Tag Reference 169 Netscape Biel Es File Edit View Go Communicator Help lt ION_SCRIPT gt lt ION_BODY gt Hi This is an HTML heading lt H1 gt ION EVALUATE EXPR 5 5 DISPLAY TRUE lt ION BODY lt ION_SCRIPT gt Example 4 Include the file includefile ion lt ION_SCRIPT gt lt ION_BODY gt lt ION_INCLUDE SRC ion includefile ion gt lt ION_BODY gt lt ION_SCRIPT gt Assuming ion is listed as one of the Text Extensions on the Files tab of the ION Script Configuration utility Windows or in the Files section of the ionsrc file UNIX the file is automatically treated as an ION Script page Netscape i D x File Edit View Go Communicator Help This is an HTML heading 10 ION guide ION INCLUDE 170 Chapter 5 ION Script Tag Reference ION_LINK The IO
79. LION EVALUATE and ION VARIABLE blocks are evaluated in the order in which they appear in the IDL block and the result of each block replaces the ION Script code in the IDL block 2 ION Script variables specified by variable are evaluated and the result replaces the ION Script variable in the IDL block The following example illustrates a case in which you might need to have the ION Script parser evaluate an ION EVALUATE block before passing the data to IDL ION SCRIPT ION HEADER VARIABLES XVARIABLE DECL NAME A VALUE 123 TYPE INT gt lt VARIABLES gt lt ION_HEADER gt lt ION_BODY gt lt ION_DATA_OUT METHOD GET gt lt IDL gt help SA help ION VARIABLE NAME SA FORMAT dL gt IDL ION DATA OUT ION BODY ION SCRIPT The FORMAT attribute causes the ION Script variable to be evaluated differently than if the variable were simply inserted into the IDL block This page produces the following output INT 123 LONG 123 ION guide IDL 126 Chapter 5 ION Script Tag Reference Single vs Double Quotation Marks In IDL strings can be enclosed in either single or double quotation marks For example both the following statements are valid print Hello World print Hello World Note however that double quotation marks have a special meaning when followed by a number This syntax is used to
80. ME fullPath TYPE STR VALUE SION Temp 4 file VARIABLE DECL NAME HTMLPath TYPE STR VALUE http BROWSER SERVER NAME 4 file gt lt VARIABLES gt lt ION_HEADER gt lt ION_BODY gt lt ION_DATA_OUT gt lt IDL gt x findgen 5000 y sin x 5 6000 wave fix y print fullPath write_wav S fullPath y 10000 print finished writing lt IDL gt lt ION_DATA_OUT gt lt ION_OBJECT HEIGHT 80 WIDTH 2500 FILE Sfile MIME audio wav DATA SION IDLURL Wav file test ION OBJECT ION BODY ION SCRIPT ION OBJECT ION guide Chapter 5 ION Script Tag Reference ION guide wav_ie ion lt ION_SCRIPT gt lt ION_HEADER gt lt VARIABLES gt lt VARIAB lt VARIAB VA U E DECL NAME file iE DECL lt VARIABLES gt lt ION_HEADER gt lt ION_BODY gt lt ION_DATA_OUT gt lt IDL gt x findgen 5000 y sin x 5 6000 wave fix y print SfullPath write_wav fullPath y 10000 print finished writing lt IDL gt lt ION_DATA_OUT gt lt br gt D 177 TYPE STR VALUE test wav NAME fullPath TYPE STR E SION tempt file ION OBJECT ID snd1 lt ION_PA ION OBJEC ION BODY
81. MP URINE IEF M T 54 l ei WT mE 58 i50 HM 59 lm enuscciin E 61 LO o dareetaceek 61 EXDuSeODn TYPES acinis em tener ei a ice ro b nr e epi bora 61 Contents ION Script User s Guide Die Io i csc C M 64 Mathematical DII ORA nece eo hn ee eet nice emere oda 64 Siring brc D o 64 Compason DBPIEDES eua cecinere rte Ee Pr Ee CL ee ere Ete ddr as 65 Logical SOAS 12e tb etr e EE cei e n ed ib ie rar ees 66 DEEA coi D 67 Chapter 4 Creating ION Script Applications eese 69 Specitying URL ndun HER er eh TEE eee 70 icu ud iK c M 71 HTIPS URL ente ien aperi gere tein epa 71 Pile URLS e 72 je 2s or 72 Absolute Patlis vs the ION Search Path anseres rebns 72 HTML Formes v6 ION Ser POI ea uere eorr D tone ete ertet 74 Passing Name Value Pars in a URL utem ite vised sone teer ter eriein 75 Passing ION Script Variables in a URL eene 75 Passing Multiple Values With the Same Name eene 76 Handling Multiple Selections in a SELECT Element eese TI Parsing the SForm Variable in an lt UL Block 1 edente hrec TI Parsin
82. N LINK tag is used to create a text hyperlink to another ion page Unlike an HTML hyperlink the ION LINK allows you to pass all persistent variables to the destination page ION LINK also allows you to assign a value to the link and pass that value to the destination page where it can be accessed as a form variable Syntax ION LINK EVENT eventName TARGET frame target NAME1 name VALUEI value NAMEn name VALUEn value gt Link Text can be HTML lt ION_LINK gt Attributes ION LINK EVENT The name of the EVENT DECL to execute when the user clicks on the link This name must be one of the names defined in the NAME attribute of an EVENT DECL tag This attribute can contain a variable NAMEn The name of the value to pass to the destination page The first NAMEn must be NAME and subsequent names must be consecutively numbered NAMEI corresponds to the value passed in VALUE As with form fields this name becomes a Form variable named Form NAME This attribute can contain a variable TARGET The name of the window or frame in which to load the URL specified by the EVENT attribute when the link is clicked This attribute can be set to either the NAME attribute of an HTML FRAME or IFRAME tag or to one of four predefined windows blank parent self or top See Targeting Different Frames on page 88 for a description of these predefined windows See Overview of Fixed Framesets on page 82 for an e
83. N VARIABLE is evaluated by the parser and converted to HTML e HTML tags are passed as is to the outputted HTML page ON IMAGE tags are converted to HTML lt IMG gt tags These lt IMG gt tags are then processed by the Image Server which passes the IDL content to IDL for processing and the Image Server returns the IDL generated image to the Web page as a PNG or JPEG image e Any attribute used inside an ION Script tag that is not recognized by the ION Script Parser as an ION Script attribute is passed unchanged to the browser This allows you to use in an ION Script tag any valid attribute of the HTML tag to which the ION Script tag is converted For each ION Script tag listed in Chapter 5 ION Script Tag Reference there is a section called HTML Mapping that tells you what HTML if any is produced by that tag Example Suppose you have the following ION Script page mypage ion on your Web server lt ION_SCRIPT gt lt ION_BODY gt lt H1 gt Below is an IDL Generated Image lt H1 gt ION IMAGE IMG TYPE PNG8 TYPE DIRECT gt lt IDL gt LOADCT 5 SHOW3 DIST 30 lt IDL gt lt ION_IMAGE gt lt BR gt lt H1 gt Below is IDL Generated Data lt H1 gt lt ION_DATA_OUT gt lt IDL gt Array INDGEN 5 Print Array lt IDL gt lt ION_DATA_OUT gt lt ION_BODY gt ION SCRIPT If you re familiar with HTML you ll notice a couple plain HTML tags in this page th
84. N_SCRIPT gt clickloc ion LON SCRIPT ION BODY You clicked a X ION VARIAB y 10N VARIAB ION BODY ION SCRIPT ION IMAGE dist 30 t I NAME Mouse x NAME Mouse y TYP E DIR ECT gt ION guide Chapter 5 ION Script Tag Reference 165 ION_INCLUDE The ION_INCLUDE tag inserts the contents of another ION Script text or HTML file into the current ION Script document These file types are handled by ION Script as follows e ION Script files included with ION INCLUDE are processed by the ION Script parser and included as HTML in the final document e Text files are processed to translate special characters used in HTML such as and into character entities that can be recognized by any Web browser For example the symbol is converted to amp gt When rendered by a Web browser amp gt will appear as This allows all characters in the text file to be rendered as they appear in the text file instead of being interpreted as HTML e HTML files are included unchanged The file extension of the included file determines whether ION Script treats the file as text ION Script or HTML The ION Extensions field on the Files tab of the configuration utility specifies extensions that are to be considered ION Script files and the Text Extensions field specifies extensions that are to be considered text files Noe
85. ON guide ION_RADIO 182 Chapter 5 ION Script Tag Reference ION SCRIPT The ION_SCRIPT tag pair is the container that holds all other ION Script tags similar to the way the lt HTML gt tag contains all HTML tags All content whether it is ION Script or HTML must reside inside the ION SCRIPT tag pair Syntax ION SCRIPT SYNTAX OFF COMMENT PRE lt HTML gt tag attributes gt ION Script tags HTML tags ION SCRIPT Attributes SYNTAX This attribute defines how expression parser error messages are reported for a given ION Script page Valid values include e OFF Error messages are not reported COMMENT Error messages are included in the returned HTML page as part of an HTML comment This makes the error messages accessible but invisible to the client To view the error messages you must view the source of the HTML page sent to the browser by selecting View Page Source Netscape or View Source Internet Explorer e PRE Error messages are included in the returned HTML page as lt PRE gt text and will appear at the bottom of the returned HTML page This is useful during development of your ION Script applications The default method for reporting error messages is specified in the Syntax Logging section on the Debug tab of the ION Script Configuration utility Windows or in the Debug section of the ionsrc file UNIX See Syntax Logging on page 25 for deta
86. POST does not impose the length restrictions imposed by GET Therefore the POST method can be used to submit lt IDL gt blocks containing amounts of code that would be too large to submit in a URL using the GET method Refer to an HTML HTTP reference for more information on GET and POST PRE Determines how the IDL output is treated by the ION Script parser e Ifset to TRUE the text inserted by ION DATA OUT is formatted exactly as output by IDL Text is rendered in a fixed width font line breaks are preserved whitespace including spaces and tabs is preserved and word wrapping will not occur This is equivalent to using the HTML lt PRE gt lt PRE gt block to surround text that you want formatted as typed e If set to FALSE line breaks and whitespace in IDL output will be ignored and the output will be displayed in the browser s default font or in the font specified by an HTML tag if used The default value for PRE is TRUE but this default can be changed on the Format tab of the configuration utility SERVER Note This attribute is deprecated If provided it will be ignored The full path to the image server 1on i This must be a valid absolute URL using the http protocol This attribute which is also an attribute of ION IMAGE and ION OBJECT can be used for load control by specifying different servers for different tasks provided you have a copy of ion i on each server and that you have the proper li
87. RC ion p page framel html We can also keep the page main html in the same directory as the ion files and load the page using the following URL format http servername cgi bin ion p page main html Loading ION Script Pages in Frames In the above examples the source of all our frames were HTML files Frames can also contain ION Script pages For example we ll create a frameset with two frames where the upper frame contains an ION Script page and the lower frame initially contains a blank HTML page When the user clicks the button in the upper frame the ION Script form is submitted and the target of that form is the lower frame The ION FORM tag uses the TARGET attribute to define the window in which the EVENT page is loaded upon form submission main html HTML lt FRAMESET ROWS 20 gt lt FRAME NAME upper SRC ion p page framel ion lt FRAME NAME lower SRC ion p page blank html lt FRAMESET gt lt HTML gt framel ion lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME PLOT ACTION ion frame2 ion gt lt EVENTS gt ION HEADER Using Frames with ION Script ION guide Chapter 4 Creating ION Script Applications 85 lt ION_BODY BGCOLOR ADD8E6 gt ION FORM TARGET lower gt B Display Value lt B gt lt INPUT NAME DISP VALUE TYPE TEXT VALUE
88. STR VALUE dog gt If you are assigning a string variable as opposed to a string literal to the VALUE attribute do not enclose the variable in single quotation marks For example if the variable animal has already been defined as a string you would assign the value of the animal variable to a new variable as follows lt VARIABLE_DECL NAME pet TYPE STR VALUE Sanimal gt Determining Variable Type To easily determine the data type of a variable use the ISTYPE operator as follows VarName ISTYPE VarType where VarName is the name of the variable and VarType is one of the following string literals BOOL STR INT DOUBLE or UNDEF Note The left side of the ISTYPE expression must be a variable and not an expression If you need to determine the resulting type of an expression assign the expression to a variable and use ISTYPE to determine the type of the variable For example to determine whether the variable Myvar is undefined you could use the following ION Script code ION IF EXPR MyVar ISTYPE UNDEF MyVar is undefined ION ELSE The value of MyVar is ION VARIABLE NAME MyVar ION IF Null Strings Versus Undefined Strings Variables There is a difference between an empty null string and an undefined string A null string is a defined variable that is assigned no characters If the
89. Script is lightweight easy to learn and implement can capable of creating applications that range in complexity from simple Web based visualizations to interactive data picking applications including Region Of Interest selection to drill down through a data set or zoom in on an image for example ION Script provides a mechanism for the developer to track the client s state across multiple Web pages ION Script can be easily integrated with other Web based technologies such as JavaScript ActiveX and database applications and can be easily incorporated into existing Web pages If you require the ability to expose your IDL data and visualizations to Internet or intranet users ION Script is the perfect tool For cases in which the Web browser is a suitable container for your application ION Script provides the necessary functionality without burdening you with the complexity of Java programming or burdening the users of your application with the overhead required to run a Java application This brief overview of ION Script will introduce you to some of the main elements of the ION Script language before we get into the more specific details of writing ION Script applications After reading this section you ll have a general idea of what an ION Script page looks like and the kinds of applications for which ION Script can be used For details on the syntax and usage of each ION Script tag refer to Chapter 5 ION Script Tag Reference
90. T tag pair Attributes None IDL Tag Limitations The following IDL code cannot be used inside an lt IDL gt lt IDL gt block e You cannot use the OBJ NEW function to create a window There is no need to create your own IDLgrWindow object Instead you draw an object by calling the Draw method on the ION SCRIPT BUFFER object See Object Graphics on page 91 for an example of how to use Object Graphics in ION Script To run an example run the example file object graphics ionin the examples directory e You should not use the WINDOW procedure to create a graphics or text window ION Script sets up the drawing area itself e Widgets and compound widgets are not available in ION Script e You cannot use the lt IDL gt block to write programs as you would in a pro file ION Script sends the commands in the lt IDL gt block to IDL one line at a time Therefore each line inside the lt IDL gt block must be a statement that is valid at the IDL command line For example you cannot use an lt IDL gt block as follows IDL ION guide Chapter 5 ION Script Tag Reference 125 lt IDL gt FOR X 1 20 DO BEGIN PRINT X ENDFOR lt IDL gt To perform the above statements you would need to write a pro file and call the program from the lt IDL gt block Using ION_EVALUTE and ION_VARIABLE Tags in an IDL Block When an IDL block is evaluated by the ION Script parser the following sequence of events occurs 1 AH
91. TITLE gt Image Data lt TITLE gt ION HEADER ION BODY lt FONT SIZE 2 gt Image Data lt FONT gt Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications ION guide lt BR gt 109 lt ION_DATA_OUT gt lt I DL gt Read in the original image image read png filepath subdir ion script examples data landsat png r g b Calculate the x subscripts xstart xend S CENTER X SREGION_W 2 SCENTER X SREGION W 2 1 Calculate the y subscripts ystart yend Create region Print min SCENTER Y S REGION H 2 SCENTER Y SREGION H 2 1 the region to be displayed image xstart xend ystart yend max and mean print lt B gt Minimum Value B min region print lt B gt Maximum Value B max region print lt B gt Mean Value lt B gt mean region IDL ION DATA OUT ION BODY ION SCRIP Note that the IDL gt print statements include HTML The IDL output inserted by ION_DATA_OUT is inserted directly into the HTML stream therefore we can include HTML in our IDL print statements to control the way the IDL output is rendered by the browser The following figure shows the page generated by exl_data ion Xf Netscape ol x File Edit View Go Communicator Help
92. TLE gt ION HEADER ION BODY lt FONT SIZE 2 gt ION Script Image Example lt FONT gt lt BR gt lt BR gt ION IMAGE WIDTH 320 HEIGHT 256 TYPE DIRECT gt lt IDL gt Read in the original image image read png filepath subdir ion script examples data landsat png r gy b Create a 320x256 region of the image region image 440 759 472 727 Load the display color table tvlct r g b Display the region tv region IDL ION IMAGE ION BODY ION SCRIPT Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications 97 This code creates the following Web page XX ION Script Image Example Netscape File Edit View Go Communicator Help E E a a oa a N ION Script Image Example FEE Document Done Step 2 Declaring and Displaying Variables In Step 1 we specified a subarray of our original image in order to display a smaller image on the Web page To do this we hard coded the subscript values in the IDL command region image 440 759 472 727 Suppose we want to use these subscript values in other parts of the application or we want to allow the user to specify these subscript values To do this we can define variables to hold this information and then reuse or change these variables as needed Our code would be more flexible if we defi
93. _6 1 ion_script examples home ion You can now store all pro and sav files in this new directory Where to Store Your Files ION guide Chapter 2 Overview 41 Running the ION Script Examples ION guide Several example applications are installed with ION Script These examples are located in the RST DIRNIDL61NproductsNVION61 NV ion script examples Windows or RST DIR ion 6 1 ion script examples UNIX where RSI DIR is the directory in which you installed ION Script The page index ion contains links to three different examples pages e Basic Examples These examples illustrate simple ION Script concepts Examples include how to create a simple ION Script page how to define variables and events how to use form elements such as buttons checkboxes and radio buttons and how to use HTML frames e Advanced Examples These more complex examples demonstrate some of the advanced programming concepts in ION Script such as image processing form validation using JavaScript and using IDL to dynamically create HTML tables and droplists e Demos This link takes you to the RSI ION site www RSInc com ion where you can view interactive Web applications built on ION Script Assuming the path to your cgi bin directory is cgi bin you can load the ION Script examples page using the following URL where servername is the name of your server http servername cgi bin ion p page index ion You can also find a link to
94. ag Reference Encode one or more name value pairs in the URL that loads the page If the value you pass in for a checkbox matches the value defined in the VALUE attribute of the ION CHECKBOX tag the checkbox will be checked The following URL specifies that Box3 which in the above example was defined with VALUE 3 be initially checked http myserver cgi bin ion p page checkbox ion amp Box3 3 If the page is loaded as the action of a form use a hidden form field to pass a name value pair for each checkbox you want checked lt FORM AC INPU INPU INPU FORM NAME page VA NAME Box3 VA TYPE SUBMIT gt LU E checkb LU ox ion TION http myserver cgi bin ion p gt TYP E 3 TYP E HIDD EN E HIDDEN gt ION guide Chapter 5 ION Script Tag Reference 141 ION DATA OUT The ION DATA OUT tag pair is used to insert text from an IDL session into an ION Script document The final text can come from either the standard IDL output stream or it can be the textual representation of an IDL variable An lt IDL gt block inside the ION DATA OUT tag contains the IDL code that creates the text or data to be output Syntax ION DATA OUT ASTEXT TRUE FALSE DEBUG TRUE FALSE METHOD GET POST PRE TRUE FALSE SERVER url gt lt IDL gt IDL code can contain variable lt IDL gt lt
95. alue of this form field as follows SForm MyVar The NAME attribute of an ION RADIO button e The NAME attribute of an ION CHECKBOX The NAMEn attribute of an ION LINK e The name of any name value pairs passed in a URL query string See Passing Name Value Pairs in a URL on page 75 for more information Note You cannot access the value of a Form variable on the page in which the form field is defined The value is not available until the form has been submitted ION guide System Variables 54 Chapter 3 Variables Expressions amp Operators Using Form Variables in Numeric Expressions To use a Form variable in a numeric expression using ION IF or ION EVALUATE you must declare a variable as an INT or DOUBLE using VARIABLE DECL and assign this variable the value Form NAME where NAME is the NAME attribute of the form field or ION LINK or the name in a name value pair passed in a URL This converts the string variable Form variables are always string variables to the type you desire When writing the expression you then use this new variable instead of using the Form variable For example ION FORM lt INPUT NAME Age TYPE TEXT VALUE 35 gt ION FORM In the page that is called you would define a variable as follows VARIABLE DECL NAME AGE VALUE SForm Age TYPE INT gt
96. an OR Logical OR value OR value2 returns Boolean value or variable true if either value or value2 evaluates or expression that to true Returns false otherwise evaluates to a boolean NOT Logical negation NOT value returns true Boolean value or variable if value is false and returns false if value or expression that is true evaluates to a boolean The following are examples of valid expressions using the logical operators For these examples assume BOOL1 true BOOL2 false SA 1 B 2 Type of operand Expression Result Boolean variables BOOL1 AND BOOL2 false BOOLI OR BOOL2 true Boolean values true AND false false true OR false true Expressions that evaluate to booleans A NE B AND A EQ 1 true A EQ 5 OR B EQ 5 false NOT A EQ B true BOOLI AND A EQ 1 true Operators ION guide Chapter 3 Variables Expressions amp Operators Operator Precedence The following table lists the operators are left associative 67 ION Script operators in order of precedence All Meaning that operators of equal precedence such as and are evaluated from left to right Precedence Operators Highest negation NOT MOD T GT GE LT LE CONTAINS ISTYPE AND Y Lowest OR EQ NE Grouping Expressions With Parentheses Parentheses are used in ION Script to control the order of evaluation of expre
97. and therefore does not accept any other attributes VARIABLE_DECL ION guide Chapter 5 ION Script Tag Reference 189 VARIABLES The VARIABLES tag pair delimits a block of variable declarations in the header section of an ION Script document The lt VARIABLES gt lt VARIABLES gt block can contain one or more VARIABLE DECL tags Note The VARIABLES tag pair must reside between the ION HEADER and ION HEADER tags Syntax VARIABLES VARIABLE DECL tags VARIABLES Attributes None HTML Mapping The VARIABLES tag is not converted to HTML and therefore does not accept any other attributes ION guide VARIABLES 190 Chapter 5 ION Script Tag Reference VARIABLES ION guide Chapter 6 Troubleshooting If your ION Script application is not working as expected start by checking the simple things first Following is a list of some of the more common mistakes that may be causing problems with your application ION guide 191 192 Chapter 6 Troubleshooting Web Server Problems Before checking problems related to ION Script and IDL make sure you are able to communicate with your Web server For example if you are using the Apache Web Server you can enter a URL such as http localhost or http hostname where hostname is the hostname or Windows machine name of your computer If your Web server is properly configured you should receive a page that says If you can see this it means that the install
98. ant to pass the initial value displayed in the text field to frame1 ion instead of hard coding the value The page rame1 ion will contain a reference to the variable Form INITIAL ION SCRIPT ION HEADER EVENTS EVENT DECL NAME PLOT ACTION ion frame2 ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY BGCOLOR ADD8E6 gt ION FORM TARGET lower gt B Display Value lt B gt lt INPUT NAME DISP VALUE TYPE TEXT VALUE ION VARIABLE NAME Form INITIAL SIZE 3 gt ION BUTTON TYPE BUTTON LABEL Show Plot EVENT PLOT ION FORM ION BODY ION SCRIPT In order for Form INITIAL to be defined when frame1 ion is executed we must pass the INITIAL parameter in the URL that loads rame1 ion Therefore main html would need to be changed as follows Using Frames with ION Script ION guide Chapter 4 Creating ION Script Applications 87 lt HTML gt lt FRAMESET ROWS 20 lt FRAME NAME upper SRC ion p page framel ion amp INITIAL 30 gt lt FRAME NAME lower SRC ion p page blank html gt lt FRAMESET gt lt HTML gt Floating Frames ION guide Floating frames are a feature introduced in Microsoft Internet Explorer 3 0 Unlike a fixed frameset in which the frames are always anchored to the edge of the
99. are defined by the Image Width and Image Height values specified in the configuration utility or ionsrc file and url is made up of the ION Image Server URL and the data returned by the lt IDL gt block In this case all attributes of the HTML lt IMG gt tag can be used in the ION IMAGE tag If EVENT is Present If specified as ION IMAGE EVENT event TYPE type gt then the following HTML is produced lt FORM ACTION ION Script Parser URL value METHOD GET gt lt INPUT TYPE IMAGE NAME event BORDER 1 SRC url gt lt FORM gt where url is made up of the ION Image Server URL and the data returned by the lt IDL gt block In this case all attributes of the HTML lt INPUT TYPE IMAGE gt tag can be used in the ION IMAGE tag Example ION guide In this simple example we create an image that when clicked takes the user to another ION Script page that reports the x and y location of the mouse cursor image ion lt ION_SCRIPT gt lt ION_HEADER gt lt EVE lt EVENT_DECL ACTION ion clickloc ion lt EVENTS gt ION HEADER NAME CLICKLOC gt ION IMAGE 164 lt ION_BODY gt Chapter 5 ION Script Tag Reference lt ION_IMAGE EV ENT CLICKLOC IMG_TYPI E PNG8 lt IDL gt show3 lt IDL gt lt ION_IMAGE gt lt ION_BODY gt lt IO
100. at extension the file uses ION Extensions The ION Extensions field is used to specify the file extensions that are to be considered ION Script files by ION Script Separate multiple extensions by commas such as ion Xxyz You can omit the period ion xyz Any extension listed in the ION Extensions field can be used in place of xxx in the following cases and the files will be parsed as ION Script files e When included with ION INCLUDE ION INCLUDE SRC protocol filename xxx gt e When an EVENT points to an ION Script file EVENT DECL NAME event ACTION myfile xxx gt e Whenever a URL of the following format is used http server cgi bin ion p page filename xxx ION Script Configuration Options ION guide Chapter 1 Configuring ION Script 23 e When an ION Script page is the action of an HTML form lt FORM NAME MyForm ACTION http server cgi bin ion p gt lt INPUT TYPE HIDDEN NAME page VALUE filename xxx gt lt FORM gt See HTML Forms vs ION Script Forms on page 74 for more on making ION Script pages the action of an HTML form Note If the ion protocol is used the file is parsed as an ION Script file no matter what extension the file uses Redir Protocols When ION Script encounters a URL that uses a protocol specified in the Redir Protocols field it will redire
101. ation of the Apache web server software on this system was successful Consult your Web server documentation to find out how to test your Web server Also make sure you are able to run CGI programs on your Web server If You Are Using Microsoft IIS Using Microsoft IIS the exe extension must be included in URLs that point to executables You will need to use ion p exe instead of ion p in any URLs in your HTML and ION Script pages and in the location field of your browser when requesting a URL Connection Failed Errors If you get the message ION Script Error Connection Failed when you attempt to load an ION Script page check the following Does the page you are trying to load exist If you are using Windows Notepad as your text editor make sure txt was not appended to the end of your ion file When you save a file in Notepad such as myfile ion Notepad may automatically append txt to the end as inmyfile ion txt To avoid this enclose the file in double quotation marks in the Save As dialog before saving the file Does your URL point to the correct location of your cgi bin directory Does your ION Search Path include the directory containing the page you are trying to load The ION Search Path can be set on the Files tab of the ION Script Configuration utility Windows or in the Files section of the ionsrc file UNIX Remember that you cannot use the symbol in the ION Sea
102. bles specified by the Browser system variable The Browser system variable is used to specify actual CGI environment variables such as HTTP_USER_AGENT CGI environment variables are case sensitive Browser The Browser system variable can be used to access any CGI environment variable CGI environment variables contain various information about the request such as the server software being used the hostname making the request and whether the request was made using the GET or POST method One CGI environment variable in particular HTTP_USER_AGENT is useful in determining the type and version of the browser being used to request the page Determining the browser version and type is useful when your application has content that cannot be rendered by all browsers Browser vendors often incorporate proprietary extensions to HTML that add functionality to their product but that are not supported by other browsers It is generally recommended that you limit your use of browser specific proprietary features but when used you are strongly encouraged to provide alternate content that can be viewed by any browser One technique for ensuring that users of different browsers will all see your content in the manner best suited to their browsers is to determine the browser type and version and redirect users to the appropriate page for their browser It is beyond the scope of this document to discuss these techniques in detail but extensive inf
103. browser or to another frame floating frames can exist as a separate island inside a Web page Floating frames are created with the lt IFRAMES gt tag which exists inside the lt BODY gt Therefore floating frames can be inserted anywhere in the HTML stream just like images tables and other HTML elements and can scroll entirely out of the browser This can be useful if you have information that applies to a specific section of your page but you don t want that information to remain on screen at all times The following example creates a page with a floating frame into which we load an ION Script page that displays an IDL generated image msie html HTML HEAD lt TITLE gt Floating Frame Example lt TITLE gt lt HEAD gt lt BODY gt Below is a floating frame lt BR gt lt BR gt lt IFRAME NAME Floati1 SRC ion p page floatSRC ion WIDTH 350 HEIGHT 300 gt lt IFRAME gt lt BODY gt lt HTML gt floatSRC ion lt ION_SCRIPT gt lt ION_BODY gt lt ION_IMAGE TYPE DIRECT gt lt IDL gt show3 dist 30 lt IDL gt ION IMAGE ION BODY ION SCRIPT Using Frames with ION Script 88 Chapter 4 Creating ION Script Applications When you load msie htm in Internet Explorer you ll see the following page 6 Floating Frame Example Microsoft Internet Explorer Of x File Edit View Go Favorites Help Below is a floating f
104. 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 lt FRAMESET gt tag The lt FRAMESET gt tag divides the Web page either horizontally or vertically into multiple frames each defined with its own FRAME tag Each FRAME tag points to a Web page with the SRC attribute For example to create a page divided horizontally into two frames we would create three HTML files similar to the following main html HTML lt FRAMESET ROWS 25 lt FRAME NAME Framel SRC http myserver framel html FRAME NAME Frame2 SRC http myserver frame2 html lt FRAMESET gt lt HTML gt framel html HTML This is Framel HTML frame2 html HTML This is Frame2 HTML Using Frames with ION Script ION guide Chapter 4 Creating ION Script Applications 83 If you load main html in your browser you get the Web page shown in the following figure 5 Netscape OE x Fie Edit View Go Communicator Help This is Framel
105. cations Step 3 Adding Interactivity For our application to be useful we need to allow the user to control the way in which the data is presented We ll add a form to our page to allow the user to specify the maximum and minimum pixel values to consider and the maximum value of the scaled result The form will include a button used to submit the user input and request a new page with the scaled image Creating an ION Script Form Our interactive application will allow color value scaling of the image for which we use the IDL BYTSCL function This function takes the MIN MAX and TOP keywords which we will allow the user to specify Therefore we need to get three values from the user User input in an ION Script application is achieved via an ION Script form which is created with the ION FORM tag Our form will use three text input fields created with the HTML INPUT tag We also need a way to submit user input which we ll accomplish with an ION BUTTON Add the following code to exi main ion to create the form ION FORM lt B gt Color Scale Range lt B gt Min lt INPU YPE TEXT NAME SCALE MIN SIZE 4 VALUE 0 gt Max INPU YPE TEXT NAME SCALE MAX SIZE 4 VALUE 255 gt Top INPU YPE TEXT NAME SCALE TOP SIZE 4 VALUE 255 gt BR ION BUTTON TYPE BUTTON EVENT SCALE COLORS LABEL 2 Scale Colors
106. cense If this attribute is not specified ION Script will use the server specified during installation The default value for this attribute can be changed using the Image Server URL field on the URLs tab of the configuration utility ION DATA OUT 144 Chapter 5 ION Script Tag Reference Windows or the URLs section of the ionsrc file UNIX This attribute can contain a variable HTML Mapping The ION_DATA_OUT tag out creates HTML content based on the textual output from IDL The PRE attribute determines whether the textual output from IDL is contained in an HTML lt PRE gt lt PRE gt block PRE TRUE causes the IDL output to be inserted in an HTML lt PRE gt lt PRE gt block and PRE FALSE causes the IDL output to be inserted directly into the HTML stream For example the ION Script code ION DATA OUT PRE TRUE gt lt IDL gt print hello lt IDL gt lt ION_DATA_OUT gt produces the following HTML lt PRE gt hello lt PRE gt If PREZ FALSE is used then the text hello is simply inserted into the HTML stream Examples Example 1 This example shows how the ASTEXT and PRE attributes can be used in four possible combinations to achieve different output 1 Create the following ION Script file Set the value of the ASTEXT and PRE attributes to TRUE and then to FALSE ION SCRIPT ION BODY PRE TRUE ASTEXT
107. cript applications can be image intensive their performance depends strongly on network bandwidth Bandwidth may not be an issue if you are serving your ION Script applications only to the users of your high speed company intranet but if your users are likely to be accessing your application over the Internet through an analog telephone line and low speed modem then close consideration must be given to the file size of images generated by ION Script and to the overall design of your application For example if your application allows the user to zoom in on a region of interest then you could provide the smallest lowest quality image necessary to give the user the required information at each stage in the drill down process If the final image delivered to the user is a 1200 x 1200 image with millions of colors that does not necessarily mean that the images sent to the user to get to that point must also be so large Another technique that can speed up your application is to use a page with several thumbnail images that the user can click on to see a more detailed larger image Images can vary widely in file size depending on the image format the number of colors in the image and the image dimensions Image format and number of colors may or may not be factors that you can change depending on your data and its intended use If you can achieve acceptable results with a 256 color image instead of a 16 7 million color image the price you pay in i
108. cript page contains an image from an ION IMAGE tag and a box is being displayed in place of the image you expect check the following Make sure there are no IDL errors occurring in your lt IDL gt block To do this set the DEBUG TRUE in the ION IMAGE tag to cause a debugging file to be generated in the directory specified by the ION Debug Location setting on the Debug tab of the ION Script Configuration utility Windows or in the ION guide Chapter 6 Troubleshooting 197 Frames ION guide Debug section of the ionsrc file UNIX This debugging file contains the exact code sent to IDL as well as any errors reported by IDL If your image is created from a pro file make sure the pro file is in the IDL Search Path The IDL Search Path can be set on the Files tab of the ION Script Configuration utility Windows or in the Files section of the ionsrc file UNIX Make sure you have specified the correct TYPE attribute for the ION IMAGE tag If the code in your IDL block uses IDL Object Graphics the TYPE attribute must be set to OBJECT If the code in your IDL block uses IDL Direct Graphics the TYPE attribute must be set to DIRECT When using frames make sure the page containing the lt FRAMESET gt does not contain an HTML lt BODY gt tag or an ION Script ION BODY tag Index Symbols double quotation mark 116 195 symbol IDL line continuation 127 printing in IDL 127 variables in IDL 127
109. ct to the URL rather than attempt to load the URL Redirecting to a Web page is usually quicker than loading the page and when a URL is outside a firewall it may not be possible to connect to the site In this case a redirect allows you to load the URL The URLs to which this applies include EVENT actions URLs that use the query string format page url URLs specified as the VALUE of a hidden form field with NAME page in an HTML form when the ACTION of the form is the ION Script parser See HTML Forms vs ION Script Forms on page 74 for more on making ION Script pages the action of an HTML form Format ION guide Use lt PRE gt with Text Files Select this checkbox on Windows or set Pre Txt t in the ionsrc file on UNIX if you want text files parsed by ION Script to be rendered using the HTML PRE tag Text files are parsed by ION Script in the following cases e When included with ION INCLUDE SRC filename txt or other extensions defined in the Text Extensions field e When an EVENT points to a text file e Whenever a URL of the following format is used http server cgi bin ion p page filename xxx where xxx is any extension listed in the Text Extensions field ION Script Configuration Options 24 Chapter 1 Configuring ION Script The following figure shows the difference between included text files when this feature is turned on and off File Edit View Go Communicator Help
110. d on to the next ION Script page Syntax ION FORM METHOD GET POST NAME name TARGET frame target FORM attributes except ACTION gt lt INPUT gt tags lt ION_CHECKBOX tags JON RADIO tags Any HTML ION tag except FORM ION FORM ION FORM Attributes ION FORM METHOD The method used to submit form data Valid values include e GET Passes information via the URL The amount of information that can be passed using the GET method is limited by server and browser URL length limitations An advantage of the GET method however is that the user can bookmark the URL and the browser s Reload button works seamlessly This is the default method e POST Form input is submitted as an HTTP POST request POST does not impose the length restrictions imposed by GET Therefore the POST method can be used to submit forms containing amounts of data that would be too large to submit in a URL using the GET method A disadvantage of the POST ION guide Chapter 5 ION Script Tag Reference 153 method is that the resulting page cannot be bookmarked and if the user clicks the browser s Reload button a Repost form data dialog will appear Refer to an HTML HTTP reference for more information on GET and POST NAME The name of the form This name can be used to access form elements and methods through JavaScript VBScript For example you could use JavaScript
111. d as an HTTP POST request POST does not impose the length restrictions imposed by GET Therefore the POST method can be used to submit forms containing amounts of data that would be too large to submit in a URL using the GET method A disadvantage of the POST method is that the resulting page cannot be bookmarked and if the user clicks the browser s Reload button a Repost form data dialog will appear If the ION BUTTON is already contained in an ION FORM the METHOD attribute of ION BUTTON is ignored and the METHOD attribute of ION FORM is used instead Refer to an HTML HTTP reference for more information on GET and POST SRC The URL of the image to use for buttons of TYPE IMAGE See Specifying URLs on page 70 This attribute can contain a variable ION BUTTON ION guide Chapter 5 ION Script Tag Reference 137 TYPE The button type Specify BUTTON to create a standard HTML Submit button created with the HTML tag lt INPUT TYPE SUBMIT gt Specify IMAGE to create an image that when clicked executes an event HTML Mapping The ION BUTTON tag is converted to the HTML lt INPUTS gt tag The TYPE attribute of the ION BUTTON tag becomes the TYPE attribute of the lt INPUT gt tag All attributes of the INPUTS tag can be included in the ION BUTTON tag except for NAME and VALUE If the ION BUTTON is not contained in an ION FORM a FORM tag is also created and METHOD attribute of ION BUTTON becom
112. d by the ION Debug Location must be writable See Debug on page 24 for more information The default value for DEBUG is FALSE EVENT The name of the EVENT DECL to execute when the user clicks on the image This name must be one of the names defined in the NAME attribute of an EVENT DECL tag This attribute can contain a variable HEIGHT The height of the image in pixels This attribute can contain a variable IMG TYPE The graphics file format of the image created by the ION Script Image Engine Valid values are e PNGS8 8 bit PNG images e PNG24 24 bit PNG images lossless compression e JPEG24 24 bit JPEG images lossy compression Noe GIF JPEG and PNG are also accepted for backwards compatibility GIF and PNG are interpreted as PNG8 and JPEG is interpreted as JPEG24 For IMG_TYPE DIRECT the default is PNG8 For IMG_TYPE OBJECT the default is JPEG24 These defaults can be changed using the configuration utility or the ionsrc file The value specified in this attribute overrides the default value specified in the configuration utility For information on how to select the appropriate image format see Graphics in ION Script on page 91 LABEL The default text displayed in place of an image for browsers that do not support images and for browsers in which the automatic display of in line images has been turned off If not specified the value specified in the Label field on the
113. d use this as the name of your application s starting page ION Script Files The ION Search Path is the path ION Script uses to find files specified using URLs of the following format http myhost mydomain com cgi bin ion p page myfile ion Initially RSI DIR IDL61 products ION61 ion script examples is the only directory specified for the ION Search Path but you ll probably want to keep your own source files separate from the example files so you may wish to create your own directory in which to store ION Script files For example you could create a directory called C ion Windows or home ion UNIX in which to store your ion files Note that this directory must be accessible from your Web server You would then add this directory to your ION Search Path which would then look like this Where to Store Your Files ION guide Chapter 2 Overview 39 Windows C rsi IDL61 products ION61 ion_script examples C ion UNIX usr local rsi ion_6 1 ion_script examples home ion Keeping ion and html Files in the Same Place For your ION Script applications you may wish to keep all your ion and html files in the same place To avoid having to move your HTML files to your Web server s default documents directory you can load HTML pages using the same URL format as you use to load ION Script pages For example if the file myfile html is located in your ION Search Path rather than the ht docs directory of your Web server
114. de 201 EXPR attribute continued ION_IF 54 158 expression types 61 expressions boolean 62 conditionally evaluating 158 evaluating 149 examples 61 grouping 67 numeric 62 string 63 values in 61 F FILE attribute ION_OBJECT 175 file formats 92 files including 165 location of 38 84 Form system variable 53 form variables 130 170 196 FORMAT attribute ION EVALUATE 150 183 formatting IDL output 143 included files 166 forms creating 100 fields 152 HTML vs ION Script 74 ION Script 152 validating 104 FormURL system variable 54 frames accommodating all browsers 89 fixed 82 floating 87 locating source files 84 targeting different 153 162 170 troubleshooting 197 Index 202 FRAMESET tag 197 G GE operator 65 GET method 136 143 152 graphics direct vs object 91 selecting image format 92 grouping expressions 67 GT operator 65 H header section 156 HEIGHT attribute ION_IMAGE 161 ION_OBJECT 175 hidden form fields to pass name value pairs 36 htdocs directory 38 HTML files including 165 loading ION Script pages from 36 location of 38 84 hypertext links 170 l IDL commenting 127 creating dynamic HTML with 145 creating images with ION Script 159 direct graphics 91 formatting output 143 inserting output into ION Script 141 line continuation 127 object graphics 91 programs large 143 using in ION Script 124 IDL tag 124 IDLgrBuff
115. de sent to IDL as well as any errors reported by IDL The file is given the name specified by the ION Debug Filename setting on the Debug tab of the ION Script Configuration Utility Windows or in the Debug section of the ionsrc file UNIX For example if the ION Debug Filename setting is ion out d txt then a file called ion out lt PID gt txt is created where PID is the unique process ID for the instance of ion i that generated the output The file is written to the directory specified by the ION Debug Location setting on the Debug tab of the ION Script Configuration Utility Windows or in the Debug section of the ionsrc file UNIX In order for this to work the directory specified by the ION Debug Location must be writable See Debug on page 24 for more information e The IDL system variable QUIET is set to zero which causes all IDL messages to appear in the generated Web page The default value for DEBUG is FALSE ION DATA OUT ION guide Chapter 5 ION Script Tag Reference 143 ION guide METHOD The method is used to submit the IDL code contained in the lt IDL gt block to ion 1 Valid values include e GET Code in the lt IDL gt block is submitted via the URL The amount of information that can be passed using the GET method is limited by server and browser URL length limitations e POST Code in the lt IDL gt block is submitted as an HTTP POST request
116. double precision values For example if you declare variables A and B as integers the result of A B will be a double If however you assign the result of A B to a variable that was declared as an integer then the result will be an integer Note ION Script uses the C printf conversion specifier g with 16 significant digits when displaying double precision values If when converted to scientific notation the value s exponent is less than 4 or greater than 16 the value will be displayed using scientific notation Otherwise the value is printed as a floating point value Trailing zeros in the fractional part of the value are not printed Boolean Expressions Boolean expressions are expressions that return a boolean value that is true or false The values used in the expression are numbers or strings The operators that return boolean values are GT GE LT LE EQ NE ISTYPE AND OR NOT The following are examples of boolean expressions e Temp GE 212 XEQ Y e Mouse x GT 128 e Form UserEntry EQ Form1 e Name ISTYPE STR ION guide Chapter 3 Variables Expressions amp Operators 63 e BOOLI AND BOOL2 If you declare a variable as a BOOL and then later reassign it a numeric value the variable is assigned a value of FALSE if the expression evaluates to zero and TRUE otherwise For example if C was declared as type BOOL and later reassigned the value C A B then C would be assigned the value F
117. e H1 and BR tags These HTML tags are sent directly to the HTML page that the parser creates as soon as they are encountered The other tags are ION Script tags What Is ION Script ION guide Chapter 2 Overview 35 ION guide which with the help of the Image Server and IDL are converted to HTML When the client requests mypage ion the following page is returned K Netscape EIEE Fie Edit View Go Communicator Help Below is an IDL Generated Image Below is IDL Generated Data o 1 2 3 a eal Document Done Ja wepaly If you view the source code returned to the client you ll see that it looks very different from the original ION Script page that was requested lt H lt B lt H lt I BO i FA 52 lt B lt H lt P lt lt lt TML gt ODY gt 1 gt Below is an IDL Generated Image lt H1 gt G NAME IMG ALT ION Image WIDTH 320 HEIGHT 256 RDER 1 SRC http www myserver com cgi bin ion DATA DB1AA6B14FAC62CBF 4BDA47CBDE4C4C5E2 64 9F 910E046ACB07A2B910FA4 4FA9E27B062466F914D567636B09190499CBC3871A0A7028F8DDC19643548CC9 33B8B5DDF22128893F798DAC895C51530E412C60F77F58162F0 R gt 1 gt Below is IDL Generated Data lt H1 gt RE gt 0 x 2 3 4 PRE gt BODY gt HTML gt Note the following with regard to this HTML code The lt HTML gt and lt BODY gt tags are automatically added by ION Script The lt H1 gt and lt BR
118. e 110 Applicabon V SOHUOBS uiisunienie emiten eere d tien t ete eia 110 Chapter 5 ION Script Tag Reference uessueeeuseieieene nan aai nin accu ck un anie curan a aia ua 113 Syntax COnvVENNONS Em 114 JATE I E EE EEE E in rao berries ieaeest 115 UE I T s E 116 Using Quotation Marks 1e eee tte ite ne db eme reete b ines e i e 116 Variable Substitution in Attribute Values eite tente cent inet etse 117 HTML MAPPE Em 118 The HTML C Onmin Tag soko nh vec tenean neinean yE e eee ba eee ns 119 Alphabetical Listing of ION Seript Tags 1nd eee ieri thsi ten bola tao 121 BVENT DELL EEEN E ATE A A E E 122 ib UES E 123 DM PEE A agate 124 IDC Tag LIMIN Em 124 Using ION EVALUTE and ION VARIABLE Tags in an IDL Block 125 sine le vs Double OUODBQOR MES te etr ente rrr tart tere 126 Commenang IDE COS uidens nee test eoe tren reden eis 127 Usine the Symbol im dn IDL Block oeeie rto E eo auiii 127 n r TE E EE E EE E A E P 129 ION BODY Loses oar per ei n M b e ee OE E Ee EEES 133 ION BUTTON m 135 TION A iE d 0 X 138 ION DATA OUT e 141 TON EY AEUR TE ener tr etta taedet aee eerie etek 149 dE E D M 152 Contents ION Script User s Guide Forms Lontomu s a Single Text Field i e titre er rere evune 153 ION 5125551
119. e Data Image Scaled Image Form EJEA Link exl form ion exl_validate ion Error Form Code Checking Code ION guide Example Creating a Complete Application 96 Chapter 4 Creating ION Script Applications Step 1 Displaying an IDL Generated Image The first step is to create our main page ex1_main ion on which we display an image The original image is a 1200 x 1200 PNG image called Landsat png which is located in the ion script examples data subdirectory of your ION Script installation Due to the bandwidth limitations of Web based applications we will display only a 320 x 256 region of the image Another approach would be to scale the image to a smaller size The ION IMAGE tag is used to insert an IDL generated image into the page The attributes of ION IMAGE define basic image properties such as its width height and file format The ION IMAGE tag always contains an lt IDL gt lt IDL gt block The IDL tag can only be used inside the ION IMAGE and ION DATA OUT tags It is used inside an ION IMAGE tag to define the IDL code used to generate an image or inside an ION DATA OUT tag to insert textual output from IDL In this example we will enter the IDL code directly into the IDL block We could also use the IDL tag to call an IDL pro file instead The following ION Script code displays a 320 x 256 region of the Landsat png image ION SCRIPT ION HEADER lt TITLE gt ION Script Image Example lt TI
120. e current color map to produce the final output image If you change the device in any IDL code that is executed in an ION IMAGE tag you must make sure to change the device back to the Z Buffer and TV the final image to it Object Graphics ION Script creates a destination object on which to display Object Graphics trees It is an RGB mode IDLgrBuffer object In any embedded ION Script code it is referenced as ION SCRIPT BUFFER Only graphics trees rendered to this instance of the object are displayed in the final Web page The following example illustrates how to use Object Graphics in ION Script Note that it is not necessary nor allowed to create an IDLgrWindow object To draw the object you simply call the Draw method of the ION SCRIPT BUFFER object ION SCRIPT ION BODY ION IMAGE TYPE OBJECT gt lt IDL gt file FILEPATH rose jpg SUBDIR examples data READ_JPEG file image Create the objects myview OBJ NEW IDLgrView view 0 0 227 149 mymodel OBJ NEW IDLgrModel myimage OBJ NEW IDLgrImage image Organize the object hierarchy mymodel Add myimage myview Add mymodel Draw the view to the ION SCRIPT BUFFER ION SCRIPT BUFFER Draw myview IDL ION IMAGE ION BODY ION SCRIPT ION guide Graphics in ION Script 92 Chapter 4 Creating ION Script Applications Bandwidth Issues Because ION S
121. e path to the CGI executables directory for your Web server Similarly for the ION Script Parser URL field you will see a URL of the form http WindowsMachineName cgi bin ion p exe If the path to your Web server s CGI directory is different than cgi bin change this to the correct path for all three fields Next change the Windows machine name to the fully qualified domain name of your Web server For example if your hostname is myhost and your domain is mydomain com you would replace the Windows machine name with myhost mydomain com The Image Server URL would be Configuring ION Script for Windows 12 Chapter 1 Configuring ION Script http myhost mydomain com cgi bin ion i exe The ION Script Parser URL would be http myhost mydomain com cgi bin ion p exe Note ___ SS SS _ SS S S SFFeFeFSSSSSSSS C F FeF If you are using Microsoft IIS the exe extension must be included in URLs that point to executables If you get an error informing you that the file or script you requested cannot be found make sure you are using ion p exe instead of ion p in any URLs in your HTML and ION Script pages and in the location field of your browser when requesting a URL The Files Tab The Files tab shown below is used to specify certain paths file extensions and protocols Images URLs Files Format Debug About IDLSearchPath CARSINONTA on_script ION Search Path CARSIMONTA ion_scriptiexamples
122. e specified exists and the web server has permissions to write to the temp directory Text Extensions The Text Extensions field is used to specify the file extensions that are to be considered text files by ION Script Separate multiple extensions by commas such as txt text You can omit the period txt text Any extension listed in the Text Extensions field can be used in place of xxx in the following cases and the files will be parsed as text files ION Script Configuration Options 22 Chapter 1 Configuring ION Script e When included with ION INCLUDE ION INCLUDE SRC filename xxx e When an EVENT points to a text file as in EVENT DECL NAME event ACTION myfile xxx gt Whenever a URL of the following format is used http server cgi bin ion p page filename xxx e When an ION Script page is the action of an HTML form lt FORM NAME MyForm ACTION http server cgi bin ion p gt lt INPUT TYPE HIDDEN NAME page VALUE filename xxx gt lt FORM gt See ION INCLUDE on page 165 for an example that shows how text files are handled by ION Script See HTML Forms vs ION Script Forms on page 74 for more on making ION Script pages the action of an HTML form Minis If the ion protocol is used the file is parsed as an ION Script file no matter wh
123. ecifier It is also the precise number of digits to display after the decimal including trailing zeros for the e E f g or G specifiers ION EVALUATE ION guide Chapter 5 ION Script Tag Reference 151 type length is one of the following Type Length Description h For d i o u x or X specifiers value is treated as a short or unsigned short 1 lower case L The value is treated as a long or unsigned long L The value is treated as a long double specifier is one of the following ION Variable Type Valid Specifiers BOOL STRING Ps INT d 96i 960 Pu 96x WX DOUBLE e WE 96f g G Note For more information on using format specifiers refer to a C programming manual HTML Mapping The ION_EVALUATE tag inserts the result of EXPR directly into the HTML stream if DISPLAY TRUE If DISPLAY FALSE no HTML output is produced ION guide ION_EVALUATE 152 Chapter 5 ION Script Tag Reference ION FORM The ION FORM tag pair defines a form in an ION Script page An ION Script form is similar to an HTML form except that the action taken when an event occurs inside the form is not limited to one choice Instead the source of the event determines what action is taken For example a form can contain multiple ION BUTTON elements Each button can be assigned a different EVENT that occurs when the button is clicked Only data values within a form and variables marked as persistent are passe
124. eft or right edges of the original image or 256 2 pixels away from the top or bottom edges Therefore we must also add error checking code to adjust the display center if the user clicks outside these boundaries We ll add the following code to ex1_main ion to recalculate the CENTER X and CENTER Y variables If the mouse was pressed recompute the center gt lt ION_IF EXPR SMouse x NE 0 0 gt lt ION_EVALUATE EXPR SCENTER X SCENTER_X Mouse x SREGION_W 2 gt lt ION_EVALUATE EXPR SCENTER_Y SCENTER_Y Mouse y SREGION H 2 ION IF set Make sure we haven t reached the edge of the imag gt ION IF EXPR SCENTER X SREGION W 2 GT SIMAGE_W 1 gt ION EVALUATE EXPR SCENTER X SIMAGE_W 1 SREGION W 2 lt FONT COLOR 0000CC gt Example Creating a Complete Application 108 Chapter 4 Creating ION Script Applications lt BR gt Right edge of image reached view center has been adjusted lt FONT gt ION ELSEIF EXPR SCENTER_X SREGION W 2 LT 0 ION EVALUATE EXPR SCENTER X SREGION_W 2 gt lt FONT COLOR 0000CC gt lt BR gt Left edge of image reached view center has been adjusted lt FONT gt lt ION_IF gt ION IF EXPR SCENTER_Y SREGION_H 2 GT SIMAGE_H 1
125. egistered trademark and ION ION Script ION Java are trademarks of Research Systems Inc 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 HDEFS 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 th
126. ense If this attribute is not specified ION Script will use the server specified during installation The default value for this attribute can be changed using the configuration utility This attribute can contain a variable TARGET The name of the window or frame in which to load the URL specified by the EVENT attribute when the user clicks the image This attribute can be set to either the NAME attribute of an HTML FRAME or IFRAME tag or to one of four predefined windows blank parent self or top See Targeting Different Frames on page 88 for a description of these predefined windows See Overview of Fixed Framesets on page 82 for an example of how to use the TARGET attribute TYPE Specifies whether image is generated using IDL s Direct or Object graphics system Set to DIRECT to use IDL Direct Graphics or to OBJECT to use Object Graphics This is a required attribute WIDTH The width of the image in pixels This attribute can contain a variable ION guide Chapter 5 ION Script Tag Reference 163 HTML Mapping The ION IMAGE tag is converted to HTML as either an lt IMG gt tag or a lt FORM gt tag with a nested lt INPUT gt tag depending on whether the EVENT attribute is present If EVENT is Not Present If specified as lt ION_IMAGE TYPE type gt then the following HTML is produced SRC url gt lt IMG WIDTH width HEIGHT height BORDER 1 where width and height
127. ent of an ION Script tag square brackets that are part of the IDL code must be included For example the lt IDL gt tag might be used as follows lt IDL gt MyArray 1 2 3 4 5 lt IDL gt In this case the square brackets are included in the statement because they are part of the IDL syntax Syntax Conventions 116 Chapter 5 ION Script Tag Reference Braces Braces are used to enclose a list of the possible values for an attribute You must choose one of the listed values which are separated by a vertical line Do not include the braces in your statement For example the following syntax indicates that you must choose either TRUE or FALSE for the DISPLAY attribute if you choose to use DISPLAY ION EVALUATE EXPR expression DISPLAY TRUE FALSE An example of a valid statement is ION EVALUATE EXPR S X 5 DISPLAY TRUE NBlR e Braces are used in IDL to define a structure When including IDL code as the value of an ION Script tag attribute or the content of an ION Script tag braces that are part of the IDL code must be included For example the lt IDL gt tag might be used as follows lt IDL gt MyStructure a 1 b 2 c 3 lt IDL gt In this case the braces are included because they are part of the IDL syntax Italics e Italicized words are place holders for values that you must provide for attributes as well as f
128. er 2 l1 Pu 27 What is TION cun A 28 TON Serim dou NT 28 TON Senpi Application aane pe ite te iere a cive i beet S 32 Anatomy Of an ION Script AppHeSllebk 212 oet ndr tne re reines 33 j cung coas ces seen E EE EE EE E E 34 Requesting an ION Script Page 1 2 2 2 cce tette nter ere e niii 36 bicoranbgncdacg 1 E E tiesto innit hat Sandie ecetee ational 38 How HTML Piles Are Normally Requested 1 cerae ette 38 TION Serie Piles CH 38 Keeping ion and html Files in the Same Place eee 39 Wide cs oj satesei aahelensdn etn eee e oe Pata el a HE HEUTE er Prae 39 Runne the ION Seri Eames 2 arreter tetto de ea be i e etd 41 Chapter 3 Variables Expressions amp Operators eeessess 43 brun e 44 D clorime c ASSUME VOR einn etn tette ite Fiant ete pudet a clc ti tr et atas 44 Natpible Del cuieieonenbao iret aetates E b eap 44 Assigning String Literals to ION Script Variables nee tiete 46 Determining Variable Type usce eie teet cine tini d eit Hed ier peine kann 46 Null Strings Versus Undefined Stings 1 eere eene nette 46 bo o5 dono a 47 bo unu M M 47 Variable iple HT 49 Mi Iur dee 50 sje 0 UMP a I 50 hoop Re fn 51 M D CERTUM Ec a One ee 53
129. er object 91 Index IDLURL ION system variable 58 IF statement 158 image formats 92 images ALT text 161 borders 160 creating 159 events from clicking 107 161 file format 161 labels 161 not displaying 191 size of 92 161 IMG_TYPE attribute choosing value for 92 ION_IMAGE tag 161 including files 106 165 INPUT tag 129 INT type 44 187 international characters 94 ION Script applications 32 architecture 33 examples 41 overview 28 pages 28 requesting a page 36 ION Script files location of 38 84 ION_BODY tag 197 ION_BUTTON tag 135 ION_CHECKBOxX tag 138 ION_DATA_OUT tag 108 141 ION_ELSE 158 ION_ELSEIF 158 ION_EVALUATE tag 44 54 149 ION_FORM tag 100 152 ION_HEADER tag 156 ION_IF tag 54 158 ION_IMAGE tag 159 ION_INCLUDE tag 106 165 ION_LINK tag 170 ION_OBJECT tag 173 ION Script User s Guide ION_PARAM tag 178 ION_RADIO tag 179 ION_SCRIPT tag 182 ION_SCRIPT_BUFFER 91 159 ION_SCRIPT_DEST 91 ION VARIABLE tag 99 183 ISO 8859 94 ISTYPE operator 46 italics See syntax J JPEG images 92 161 L LABEL attribute 136 ION_IMAGE tag 161 LASTUPDATE tag 157 LE operator 65 licensing errors 191 line continuation IDL 127 LINK attribute 134 links ION Script 170 using VALUE attribute 145 logical operators 66 lossless compression 92 lossy compression 92 lower case See case sensitivity LT operator 65 M mathematical opera
130. er value into the form fields Also the original form uses SCALE MIN SCALE MAX and SCALE TOP as the names of the form fields We want to use the user values instead so we ll change these names to USER SCALE MIN USER SCALE MAX and USER SCALE TOP We ll save these changes to the form in a new file called ex2 orm ion which now looks like this Example Creating a Complete Application 112 Chapter 4 Creating ION Script Applications lt ION_FORM gt lt B gt Color Scale Range lt B gt Min lt INPU YPE TEXT NAME USER SCALE MIN SIZE 4 VALUE ION VARIABLE NAME SSCALE MIN Max INPU YPE TEXT NAME USER SCALE MAX SIZE 4 VALUE ION VARIABLE NAME SSCALE MAX Top INPU YPE TEXT NAME USER SCALE TOP SIZE 4 VALUE ION VARIABLE NAME SSCALE TOP BR ION BUTTON TYPE BUTTON EVENT SCALE COLORS LABEL Scale Colors ION FORM 4 In order to use the new form page ex2_form ion we need to change the ION INCLUDE tag that includes the form ION INCLUDE SRC ion ex2 form ion I 5 Next we need to retrieve the user values from the form We do this by adding the following code to ex2_main ion ION IF EXPR Form USER SCALE MIN NE undef
131. ers in which the automatic display of in line images has been turned off This default value can be overridden by specifying the LABEL attribute of the ION IMAGE tag This label is also used in some cases as the tooltip that appears when you hold the mouse cursor over the image depending on which browser type and version you are using Because different browsers and different versions of each implement alternate text and tooltips differently it helps to know how ION Script maps the label to HTML This label value or the LABEL attribute of ION IMAGE if specified becomes the value of the ALT attribute of the HTML IMG tag for an ION IMAGE without an EVENT or the ALT attribute of the ION Script Configuration Options ION guide Chapter 1 Configuring ION Script 19 lt INPUT TYPE IMAGE gt tag for an ION_IMAGE with an EVENT Because some browsers handle images created with the lt IMG gt tag differently than those created with the lt INPUT gt tag the name of the EVENT may be displayed in place of the value specified for the label if the EVENT attribute of the ION_IMAGE tag has been specified for an image Border The Border field is used to specify the default thickness of the border drawn around an image created with ION_IMAGE or an ION_BUTTON of type IMAGE A setting of 0 causes images to be drawn without a border This default value can be overridden by specifying the BORDER attribute of the ION_IMAGE or ION_BUTTON tag Noe
132. es the METHOD of the FORM tag If the ION BUTTON is already contained in an ION FORM the METHOD attribute of ION BUTTON is ignored and the METHOD attribute of ION FORM becomes the METHOD of the FORM tag If TYPEZ BUTTON If specified as ION BUTTON TYPE BUTTON EVENT event LABEL label then the ION BUTTON tag is converted to the following HTML lt INPUT TYPE SUBMIT NAME event VALUE label The EVENT attribute becomes the NAME attribute of the lt INPUT gt tag and the LABEL attribute becomes the VALUE attribute of the lt INPUT gt tag If TYPEZ IMAGE If specified as ION BUTTON TYPE IMAGE SRC url EVENT event BORDER 1 gt then the ION BUTTON tag is converted to the following HTML lt INPUT TYPE IMAGE NAME event BORDER 1 SRC url The EVENT attribute becomes the NAME attribute of the lt INPUT gt tag ION guide ION BUTTON 138 Chapter 5 ION Script Tag Reference ION CHECKBOX An ION_CHECKBOxX is similar to an HTML checkbox created with lt INPUT TYPE CHECKBOX gt ION CHECKBOX allows you to maintain the selection state of a checkbox when the page is reloaded Syntax ION CHECKBOX NAME name VALUE value lt INPUT TYPE CHECKBOX gt attributes gt Attributes NAME The name of the checkbox This name is used to refer to the value of the checkbox using the format Form NAME Thi
133. ference 185 HTML Mapping The ION_VARIABLE tag is not converted to HTML and therefore does not accept any other attributes The value of the specified variable is inserted directly into the HTML stream Example In the following example we declare a variable and then insert the value of the variable into the page Note that in the variable declaration we use only the variable name without the symbol but when referencing the variable in the ION_VARIABLE tag we precede the variable name with the symbol lt ION_SCRIPT gt lt ION_HEADER gt lt VARIABLES gt lt VARIABLE_DECL NAME foo TYPE INT VALUE 5 gt lt VARIABLES gt ION HEADER ION BODY The value of foo is ION VARIABLE NAME foo ION BODY ION SCRIPT The following text is written to the Web page The value of foo is 5 ION guide ION VARIABLE 186 Chapter 5 ION Script Tag Reference VARIABLE_DECL The VARIABLE_DECL tag is used to declare a new variable in an ION Script application The value for a variable can come from another variable a numeric value or an expression If the value you assign to a variable is an undefined variable or any expression that cannot be evaluated the resulting value of the variable depends on the TYPE it was assigned If TYPE is INT or DOUBLE the result is 0 If TYPE is BOOL the result is false If TYPE is STR the result
134. from rewriting much of the code by breaking off reusable portions of code into separate files and then including these files To include a file we use the ION INCLUDE tag First we ll cut the ION FORM block from exi main ion and include a separate ION Script page which we ll call ex1 form ion To do this we replace the ION FORM tag in exi main ion with ION INCLUDE as follows ION INCLUDE SRC ion exl form ion gt The include file looks like this ION FORM lt B gt Color Scale Range lt B gt in lt INPU YPE TEXT AME SCALE MIN SIZE 4 VALUE 0 gt ax lt INPU YPE TEXT AME SCALE_MAX SIZE 4 VALUE 255 Top INPU YPE TEXT AME SCALE_TOP SIZE 4 VALUE 255 gt lt BR gt ION BUTTON TYPE BUTTON EVENT SCALE COLORS ABEL Scale Colors gt lt ION_FORM gt Note that we do not need to use the ION_SCRIPT or ION_BODY tags in this include file The file is simply inserted into the body of the file containing the ION INCLUDE tag Our application also places all of the error checking code into its own ION Script page called ex1 validate ion and uses the following tag in ex1 scale ion ION INCLUDE SRC ion exl_validate ion Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications 107 Step 6 Creating Interactive Images for Data Pick
135. g on page 24 for more information The default value for DEBUG is FALSE DELETE FILE Specifies whether to delete the file created in the lt IDL gt block If TRUE this file is deleted after it is streamed to the browser If FALSE the file is not deleted The default value is TRUE ION OBJECT ION guide Chapter 5 ION Script Tag Reference 175 ION guide HEIGHT Specifies the height of the object Although this attribute is optional it is usually required by a plug in FILE Set this attribute to the name of the file written by IDL in the lt IDL gt lt IDL gt block Specify only the filename not the path The application assumes that this file is written to the directory specified by the ION temp system variable see temp on page 58 The IDL code in the lt IDL gt lt IDL gt block must create a file with the name specified by this attribute and must write it to the path specified by the ION temp system variable MIME Specifies the MIME type of the object OBJTYPE Specifies whether to create the HTML lt OBJECT gt tag or lt EMBED gt tag The default value is OBJECT SERVER The full path to the image engine ion i This must be a valid absolute URL using the HTTP protocol This attribute which is also an attribute of ION DATA OUT and ION IMAGE can be used for load control by specifying different servers for different tasks provided you have a copy of ion i on each server and that you
136. g ION Script To configure ION Script for UNIX do the following 1 If desired copy the ionsrc file from the ion script directory to your Web server s cgi bin directory If you do this be sure to edit only the file in the cgi bin directory as changes you make to the file in the ion script directory will be ignored 2 Open the ionsrc file in a text editor 3 If you didn t configure ION Script to use the path to your Web server s CGI executables directory and fully qualified domain name during the installation process see Manually Configuring Your UNIX Web Server on page 16 4 The ionsrc file consists of a number of settings using the format option value Refer to ION Script Configuration Options on page 18 for a description of each option Modify values in the ionsrc file as desired Change only the values on the right side of the sign Case is important do not change the case when editing a value The following is a listing of the ionsrc file ION Script Resource File ION Script Version VERSION 6 1 KKK Images kK Image Width Image Width 320 Image Height Image Height 256 Configuring ION Script for UNIX ION guide Chapter 1 Configuring ION Script ION guide Image Label Image Label ION Image Link Border Link Border 1 Direct Graphics Image Type GR1 Type PNG8 Object Graphics Image Type GR2 Type JPEG24 URLs Image Server URL Image Server URL
137. g ION Script Applications 105 For more on ION IF see ION IF ION ELSEIF ION ELSE on page 158 Now if the user submits a negative value for SCALE MIN an error will be written to the page as shown in the following figure Ele Edit View Go Communicator Help i 5s a3 43 2 3 Back Foward Reload Home Search Netscape Scaled Image Error Scale min must be greater than or equal to 0 The scaled image however will still be generated with invalid data Therefore if any values are invalid we need to change them to valid values To change the value of a variable on the fly we use the ION_EVALUATE statement as follows lt ION_IF EXPR SCALE_MIN LT 0 gt lt ION_EVALUATE EXPR SCALE_MIN 0 gt lt FONT COLOR CC0000 gt lt BR gt lt B gt Error lt B gt Scale min must be greater than or equal to 0 lt BR gt lt FONT gt ION ELSEIF EXPR SSCALE_MIN GT 255 gt ION EVALUATE EXPR SSCALE MIN 255 gt lt FONT COLOR 2 4CC0000 BR lt B gt Error lt B gt Scale min must be less than 256 BR lt FONT gt lt ION_IF gt ION guide Example Creating a Complete Application 106 Chapter 4 Creating ION Script Applications Step 5 Creating Reusable Pages So far this application uses only one image In a real world application we would most likely want to be able to perform the same manipulations on multiple images We could save ourselves
138. g the Porm Variable in a SCRIPT Block eee enteras 78 Passing IDL Variables to TON SCPI inue eene Peer teret aeter 80 Using Frames vb GUN SCAPE iei teet niesiona e eee pesetas 82 Overview or Pixed Framescis Lieu ede tei tret entre ed eie eee tees 82 Loading ION Script Pages in Frames 1 nein etie terea tudo np ae 84 PP Wat ur qn MM 87 Taorgeurer Diiioremt Frames 5n te Gee estt e Dd ihe cada 88 Accommodating All DtOWSBES i oic is tiec eee etat pe eoe eei aii 89 Using Javascript and VD SCE ue eite eet ee rere baee ede eite redet 90 Cuiplucs an PON SODE v crror eneen dad rae oi a E ERR 91 ihn bro EM PR 9 Object SONOS P E 91 Bandwidih n m 92 A dus SER 92 Using special and International Characters 1 oae 94 ION Script User s Guide Contents Example Creatine a Complete ApplIGatlOB 2 encierra trente prre 95 Step 1 Displaying an IDL Generated Image eene 96 Step 2 Declaring and Displaying Variables etienne 97 Step 3 Adding ntessctbeliy sederit cien I ree rr a rere tue 100 Step Validate Form Dati noted entree ete 104 Step 3 reas B ousable Parcs cuerno eit reete ete hant ENERE 106 Step 6 Creating Interactive Images for Data Picking eee 107 Step 7 Displaying IDL Generated Datta oen eti 108 A Note On Usms the Back BOM Letonia ton eee ent
139. group can include this attribute NAME The name of the radio button group Each radio button in a group uses the same NAME This name is used to refer to the value of the selected radio button using the format Form NAME This attribute can contain a variable The NAME you specify for form fields cannot begin with ION__ VALUE The value assigned to the radio button which can be accessed using Form NAME If this value is numeric and you want to use it in an expression you must declare a new INT or DOUBLE variable assign it the value Form NAME and use the new variable in the expression instead of Form NAME See Using Form Variables in Numeric Expressions on page 54 This attribute can contain a variable Note All attributes of the HTML lt INPUT TYPE RADIO gt are also available to ION_RADIO See INPUT on page 129 ION_RADIO 180 Chapter 5 ION Script Tag Reference HTML Mapping The ION_RADIO tag is converted to the HTML lt INPUT TYPE radio gt tag The NAME and VALUE attributes of the ION_RADIO tag become the NAME and VALUE attributes of the lt INPUT gt tag If DEFAULT is specified it becomes the CHECKED attribute of the lt INPUT TYPE radio gt tag All attributes of the HTML lt INPUT gt tag are also available to ION_RADIO Example In this example we create a group of radio buttons and a button with an EVENT that reloads the page When the user clicks the button the name of the selected button i
140. gt tags are included as is The ION_IMAGE tag becomes an HTML lt IMG gt tag with a SRC attribute that points to the ION Script Image Server The URL specified for the SRC attribute contains encrypted information used to generate the image The ION_DATA_OUT tag becomes plain text surrounded in this case by the HTML lt PRE gt tag by default What Is ION Script 36 Chapter 2 Overview Requesting an ION Script Page In the previous section we skipped over the details of how the client requests the ION Script page in the first place When requesting an HTML page you normally request an HTML file using a URL such as http www myserver com mypage html When requesting an ION Script page you are requesting a CGI application the ION Script parser and providing the name of the page to pass to the parser When calling CGI applications via a URL you pass information to the CGI program by encoding the information in the URL This encoded information is called a query string The ION Script parser takes one argument the name of the file to be parsed The URL you use to request an ION Script page takes the following form http servername cgi bin ion p page pagename ion where servername is the fully qualified domain name of the server on which the ION Script parser is located ion p is the name of the ION Script parser and pagename ion is the name of the ION Script page Note that this URL assumes that the ION Script parser i
141. have the proper license Because the streaming of some types of data can be a resource intensive process it may be beneficial to performance in some cases to use a separate server to stream data inserted with the ION OBJECT tag If this attribute is not specified ION Script will use the server specified during installation The default value for this attribute can be changed using the configuration utility This attribute can contain a variable WIDTH Specifies the width of the object Although this attribute is optional it is usually required by a plug in ION OBJECT 176 Chapter 5 ION Script Tag Reference HTML Mapping The ION_OBJECT tag is converted to either the HTML lt OBJECT gt tag if the OBJTYPE attribute is set to OBJECT or if OBJTYPE is not specified or the HTML lt EMBED gt tag if the OBJTYPE attribute is set to EMBED Examples This example illustrates the fact that the same MIME type is handled differently for Internet Explorer than for Netscape When using the ION OBJECT tag it is usually necessary to code a different ION Script page for each browser that your application supports In this example wav ns ion is the Netscape version which uses the Apple Quicktime plug in and wav ie ionis the Internet Explorer version which uses the Microsoft ActiveMovie plug in wav ns ion ION SCRIPT ION HEADER VARIABLES VARIABLE DECL NAME file TYPE STR VALUE test wav VARIABLE DECL NA
142. he leading the absolute search fails and the ION Search Path is used For example ion include ion If the entire path is used and you do not include the leading as in the following example the URL is NOT valid ion f projects ionscript include ion Specifying URLs 74 Chapter 4 Creating ION Script Applications HTML Forms vs ION Script Forms ION Script forms created with the ION_FORM tag are beefed up versions of the HTML form An HTML form is limited to one action defined by the ACTION attribute An ION Script form can have a different EVENT for each ION_BUTTON ION_IMAGE and ION_LINK contained in the form In addition ION Script forms can contain the ION_CHECKBOX and ION_RADIO elements which unlike their HTML counterparts maintain state when the page is reloaded If however you have an existing HTML form you can still access the form values that are submitted without creating an entirely new ION Script form to replace the HTML version Following are two ION Script pages one uses an ION Script form the other uses an HTML form page2 ion is the action of each form Load both ionform ion and htmlform ion press the button and each form passes the Form variable to page2 ion ionform ion ION HEADER EVENTS EVENT DECL NAME PAGE2 ACTION ion page2 ion lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt lt INPUT NAME Text1 TYPE TEXT VALUE Hello ION
143. he variable even if the value that it is reassigned is of a different type than the variable ION guide Chapter 3 Variables Expressions amp Operators 45 ION guide If you assign a value to an undeclared variable the variable assumes one of the following types If you assign a numeric value to an undeclared variable the type becomes double If you assign a string value to an undeclared variable the type becomes string For example the following code creates a string variable and assigns the value Smith ION EVALUATE EXPR SName Smith DISPLAY TRUE If you assign TRUE or FALSE to an undeclared variable the type becomes boolean For example the following code creates a boolean variable and assigns a value of true ION EVALUATE EXPR Selected TRUE DISPLAY TRUE gt The only case in which ION Script will convert a value from one type to another is when you declare a variable as a TYPE that is different from the value to which you assign it Consider the following examples If you declare a variable as an INT equal to 1 666 the value is converted to an integer equal to 1 When ION Script converts the floating point value to an integer the decimal portion is truncated If you declare a variable as an INT and assign it a non numeric string value the value becomes an integer equal to 0 If you declare a variable as a DOUBLE and assign it a non numeric string va
144. ils The SYNTAX attribute can be used to override the default for an individual ION Script page HTML Mapping The ION SCRIPT tag is converted to the lt HTML gt tag All attributes of the lt HTML gt tag can be used in the ION SCRIPT tag ION SCRIPT ION guide Chapter 5 ION Script Tag Reference ION_VARIABLE The ION_VARIABLE tag is used to insert the value of an ION Script variable into the processed document Syntax ION guide 183 ION VARIABLE NAME variable FORMAT format string gt Attributes NAME The name of the variable Note that when referencing an ION Script variable the variable name must be prefixed with the symbol FORMAT Specifies the C style printf formatting string The syntax for the FORMAT attribute 1s as follows FORMAT flags width precision type length specifier where flags is one or more of the following characters Flag Description space Precede the result with a space Left justify the result within the field if width is specified Precede the result with a sign or The default is to display only a minus sign f specifier is o precede result with 0 If specifier is x precede result with Ox If specifier is X precede result with OX If specifier is e E f g G the decimal point is always present in the result even if no digits follow the decimal If specifier is g G trailing zeros will display
145. image quality The resulting file size of the image The following are general guidelines for selecting the proper image format 1 If your image is created using Direct Graphics use 8 bit PNG Since all Direct Graphics images created using ION Script are 8 bit use 8 bit PNG instead of JPEG for Direct Graphics because JPEG compression of 8 bit images can result in degraded image quality See image types ioninthe examples directory for an example of this If your image is created using Object Graphics the first factor to consider is the number of colors in your image If your image contains 256 or fewer colors use 8 bit PNG If your image contains a large number of colors use either 24 bit PNG or 24 bit JPEG The choice comes down to how large the image file will be versus the required image quality If application performance is of high importance and you can live with the visible artifacts that JPEG s lossy compression can introduce JPEG might be a better choice because the file size of a JPEG image can be considerably smaller The amount of degradation from JPEG compression varies depending on the image content but should be acceptable for most Web applications If image quality is of utmost importance use 24 bit PNG A good way to determine which image format to use is to create the image in all three formats on the same page You can then visually compare the images to see which formats give acceptable quality and weigh the qua
146. in the ion_script examples data directory ION SCRIPT ION BODY ION DATA OUT PRE FALSE gt lt IDL gt path FILEPATH SUBDIR ion script examples data SForm filename datafile Form filename CREATETABLE path datafile lt IDL gt ION DATA OUT ION guide Chapter 5 ION Script Tag Reference 147 lt ION_DATA_OUT gt lt ION_BODY gt lt ION_SCRIPT gt 4 In the ION61 ion_script examples directory is the IDL file createtable pro that generates the HTML PRO CREATETABLE path datafile Read ascii data file RESULT READ ASCII path Find dimensions NUMDIMS SIZE RESULT FIELD1 N DIMENSIONS DIMS SIZE RESULT FIELD1 DIMENSIONS IF NUMDIMS EQ 1 THEN BEGIN COLUMNS 1 ROWS DIMS 0 ENDIF ELSE BEGIN COLUMNS DIMS 0 ROWS DIMS 1 ENDELSE Output HTML table PRINT lt BR gt lt BR gt lt CENTER gt lt TABLE BORDER 1 CELLPADDING 2 5 PRINT TR TH BGCOLOR 008080 COLSPAN STRTRIM COLUMNS 1 PRINT datafile PRINT TH TR IF COLUMNS NE 1 THEN BEGIN FOR ROW 0 ROWS 1 DO BEGIN PRINT lt TR gt FOR COL 0 COLUMNS 1 DO BEGIN PRINT TD WIDTH 30 PRINT RESULT FIELD1 COL ROW PRINT TD ENDFOR PRINT TR ENDFOR PRINT lt TABLE gt lt CENTER gt ENDIF ELSE BEGIN If only one column FOR ROW 0 ROWS 1 DO BEGIN PRINT TR TD WIDTH 30 gt PRINT RESULT
147. index ion by requesting the page called about as follows http servername cgi bin ion p page about This page lists the current version of ION Script and contains a link to the examples page index ion Noe If you are using Microsoft IIS the exe extension must be included in URLs that point to executables If you get an error informing you that the file or script you requested cannot be found you may need to use ion p exe instead of ion p in any URLs in your HTML and ION Script pages or in the location field of your browser when requesting a URL All examples in the examples directory were modified during your ION 6 1 installation for Windows Running the ION Script Examples 42 Running the ION Script Examples Chapter 2 Overview ION guide Chapter 3 Variables Expressions amp Operators This chapter discusses the core language elements of ION Script The following topics are covered in this chapter e Variables e System Variables e Expressions e Operators ION guide 43 44 Chapter 3 Variables Expressions amp Operators Variables This section discusses how to declare and use ION Script variables the types of data an ION Script variable can hold and how to create persistent variables that can be used across multiple ION Script pages All ION Script variables must be prefixed by the symbol when they are referenced and when they are assigned a value using the ION_EVALUATE tag The
148. ing ION guide Two useful features of ION Script are its ability to assign events to images and to capture the location on an image where the mouse was clicked These features allow us to create powerful data picking applications Since our example application displays only a portion of the original image we could allow the user to select the portion of the image to view We ll add an event to the image on the ex1_main ion page that causes the image to be re centered at the location of the mouse click First we need to define an event for the image In the EVENTS block of ex1 main ion we define the event as follows EVENT DECL NAME CENTER IMAGE ACTION ion exl main ion Notice that the action of this event is to reload the same page Now we need to add an EVENT attribute to the image itself The ION IMAGE tag in exi main ion becomes ION IMAGE EVENT CENTER IMAGE WIDTH SREGION W HEIGHT SREGION H TYPE DIRECT gt Using the Mouse System Variable Next we need to add code to find the new center and make sure that we haven t reached one of the four edges of the image Our tool for finding the location of the mouse click is the Mouse system variable Mouse x stores the x location of the mouse click and Mouse y stores the y location Because our image is always 320 x 256 the display center cannot be less than 320 2 pixels away from the l
149. ingle or double quotation marks to delimit a string Note however that in IDL a double quotation mark followed by a number has a special meaning See Single vs Double Quotation Marks on page 126 Variable Substitution in Attribute Values Many ION Script tag attributes can be set to values that contain explicit values and or variables For example the EVENT attribute could be set in the following ways e To an explicit value EVENT http myserver pagel html Toa variable EVENT MyURL e To a combination of explicit values and variables EVENT http myserver S mypage If an attribute can contain a variable this fact is indicated in the attribute description HTML tag attributes can also contain variables but you must insert the variable into the HTML attribute by using the ION VARIABLE tag For example the HTML FONT tag could be specified as follows lt ION_HEADER gt lt VARIABLES gt lt VARIABLE_DECL NAME FontColor TYPE STR VALUE Red VARIABLES ION HEADER ION BODY lt FONT COLOR 2 ION VARIABLE NAME SFontColor This should be Red lt FONT gt lt ION_BODY gt ION guide Syntax Conventions 118 Chapter 5 ION Script Tag Reference HTML Mappings When an ION script is parsed ION Script tags and attributes are converted to HTML HTML tags as we
150. ins the following text ION SCRIPT ION BODY lt H1 gt This is an HTML heading lt H1 gt lt ION_EVALUATE EXPR 5 5 DISPLAY TRUE gt lt ION_BODY gt lt ION_SCRIPT gt Example 1 Include the file includefile html as pure HTML ION SCRIPT ION BODY ION INCLUDE SRC file includefile html ION BODY ION SCRIPT This results in the following page 3 Netscape Biel Es File Edit View Go Communicator Help This is an HTML heading Example 2 Include the HTML file as a text file so that the HTML is not rendered as HTML by the browser and ION Script tags are not evaluated by the ION Script parser This can be accomplished by adding ASTEXT TRUE to the ION_INCLUDE tag ION SCRIPT ION BODY ION INCLUDE SRC file includefile html ASTEXT TRUE ION BODY ION SCRIPT ION INCLUDE 168 Chapter 5 ION Script Tag Reference This results in the following page Netscape OF x File Edit View Go Communicator Help lt ION_SCRIPT gt lt ION_BODY gt lt H1 gt This is an HTML headinge H1 lt ION_EVALUATE EXPR 545 DISPLAY TRUE gt ION BODY ION SCRIPT If we also use PRE TRUE in our ION INCLUDE tag we get the following page 3 Netscape i D x File Edit View Go Communicator Help lt ION_SCRIPT gt lt ION_BODY gt lt Hi gt This is an HTML heading lt H1 gt ION EVALUATE EXPR 5 5 DISP
151. ion to be displayed region image xstart xend ystart yend Scale the region 103 Scale region bytscl region MIN Form SCALE MIN MAX Form SCALE MAX TOP Form SCALE TOP Load the display color table tvlct r g b Display the region tv scale region IDL ION IMAGE ION BODY ION SCRIPT T After we enter some values in the form and click the button we get the following page 3 Scaled Image Netscape G x File Edit View Go Communicator Help 2 y 24 2 c d tint Back Forward Reload Home Search Netscape Scaled Image Document Done Example Creating a Complete Application 104 Chapter 4 Creating ION Script Applications Step 4 Validating Form Data To properly scale the image in our example the values you enter in any of the form fields must be between 0 and 255 and the value you enter for SCALE MIN must be smaller than the value for SCALE MAX We can make our application more user friendly by checking the data entered by the user and reporting any invalid entries To do this we need to be able to conditionally execute portions of our code For example to check for invalid SCALE MIN values we d use an algorithm such as If SCALE MIN is less than O Write Scale min must be greater than 0 to the page If SCALE MIN is greater than 255 Write Scale min must be less than 255 to the page We can access the values s
152. is a null string Note The VARIABLE_DECL tag must reside between the lt VARIABLES gt and VARIABLES tags Syntax VARIABLE DECL NAME name TYPE BOOL INT DOUBLE STR VALUE expression PERSIST TRUE FALSE gt Attributes NAME Defines the name of the variable Do not precede the variable name with the symbol This attribute is required See Chapter 3 Variables Expressions amp Operators for information on variable names PERSIST Set this attribute to TRUE to make the variable persistent Persistent variables are used to maintain application state from one ION Script page to another Once a variable is declared with PERSIST set to TRUE it is available to all ION Script pages that are called without having to re declare the variable in each page If PERSIST is set to FALSE the variable can only be referenced in the page in which it is declared VARIABLE_DECL ION guide Chapter 5 ION Script Tag Reference 187 TYPE Defines the variable s data type This attribute is required The following table lists the allowable values for the TYPE attribute Attribute Value Data Type BOOL Boolean INT Integer DOUBLE Double precision STR String See Variables on page 44 for more on variable types VALUE Defines the initial value of the variable This attribute is required and can contain a variable If the type of data specified for VALUE differs from the s
153. is 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 This product includes software developed by the Apache Software Foundation http www apache org IDL Wavelet Toolkit Copyright 2002 Christopher Torrence Other trademarks and registered trademarks are the property of the respective trademark holders Contents Chapter 1 Contigunng FON SOE uenisse certamina ad ib dtd aca edax Rua a Cul nian daa 9 Confianring ION Script for VOIntdos cese ececee tierno tt eeu t tne one e rette eee etn renati 10 The Images Tab c 10 jS SPD eR 11 Th Files DID esie ER iteiteri tended ienasuer nied 12 The Format Tab iun uarie tiet ined eee pce Ee po CHOR clt doen eben Boon Pao 13 jJ Ib PME coses secees cepiccavazis idea A o a values EE si conc ENTE ENEA EE Eea ie 13 Contiguang IJN Script Tor UNIX cs cccsccescccssuncecissscecsesetes tre terae a ani ssk 14 Manually Configuring Your UNIX Web Server eee 16 ION Script Soni eb OPUONS Lees ede tes scanned tine eo te eren ton e etn ne eene ene en 18 intr e 18 jj 19 j UTEM 20 duni M 23 jo C Um 24 ION Script User s Guide 3 Chapt
154. ke it easier to remember the name for a character For example the British pound can be represented as amp pound Note Support for Entity Names is browser dependent In ION all ISO 8859 1 characters can be natively inserted into ION pages directly from the keyboard Note that ION still supports Numerical Entity References and Entity Names Using Special and International Characters ION guide Chapter 4 Creating ION Script Applications 95 Example Creating a Complete Application In this section we will walk through the process of creating an interactive data picking application This application will do the following Display a region of an IDL generated image e Allow the user to input the desired color scale used to display the image e Check user input for invalid entries e Allow the user to select the center of the displayed region by clicking on the image e Provide a link that displays IDL generated data about the image This application consists of five ion files located in the examples subdirectory of the ION Script installation The following figure illustrates the relationship between the files we will be creating Note The files for this example are included in the examples directory of your ION Script installation You can load this example from the page index examples ion by clicking the User s Guide Example Application link exl data ion exl main ion exl scale ion Imag
155. lid URLs NAME Defines the name of the event This name is used as the value for the EVENT attribute of the ION_BUTTON ION_IMAGE and ION_LINK tags The value specified for the NAME attribute can only contain the characters A Z a z 0 9 or _ and cannot be the name page HTML Mapping The EVENT_DECL tag does not produce HTML and therefore does not support any additional attributes EVENT_DECL ION guide Chapter 5 ION Script Tag Reference 123 EVENTS The EVENTS tag pair is used to delimit a block of event declarations in the header of an ION Script document The lt EVENTS gt lt EVENTS gt block can contain one or more EVENT_DECL tags Note The EVENTS tag pair must reside between the ION HEADER and ION HEADER tags Syntax EVENTS EVENT DECL tags lt EVENTS gt Attributes None HTML Mapping The EVENT tag does not produce HTML and therefore does not support any additional attributes ION guide EVENTS 124 Chapter 5 ION Script Tag Reference IDL The IDL tag pair delimits a block of IDL code This tag pair must reside inside an ION_DATA_OUT or ION_IMAGE tag pair Any valid IDL code is allowed between lt IDL gt and lt IDL gt with the exception of the items listed below under IDL Tag Limitations Syntax lt IDL gt ION EVALUATE or ION VARIABLE tags IDL code can contain variable lt IDL gt Note The IDL tag pair must reside inside an ION_IMAGE or ION_DATA_OU
156. lity against the size of each image To see the size of the image right click on the image and select Save image As or Save Picture As to save the file The example image types ionin the examples directory provides an example of how different image types affect the quality and size of the image You can access this example by clicking the Image Type Example link on the Basic examples page index howto ion Graphics in ION Script 94 Chapter 4 Creating ION Script Applications Using Special and International Characters ION supports 8 bit ASCII character sets as defined by ISO 8859 including ISO 8859 1 also called Latin 1 This character set consists of 256 characters The first 128 characters make up the US ASCII character set consisting of characters used in US English The second 128 characters support languages used in Western European countries Note LL For a table of ISO 8859 character sets visit http www bbsinc com iso8859 html In order to use 8 bit characters in an ION page using versions of ION prior to 1 2 it was necessary to insert either the character s Numerical Entity Reference or the Entity Name The Numerical Entity Reference uses the format amp nnn where nnn is the decimal value of character For example the British pound symbol can be inserted into an ION or HTML page using amp 163 Some characters have been assigned an entity name to ma
157. ll as HTML attributes used in ION Script tags are passed through to the browser unchanged This allows you to use any valid HTML in your ION scripts and ensures that you can always make use of the latest HTML features as Web browsers and the HTML language evolve By knowing what HTML is produced by each ION Script tag you can include in your ION Script tag any attributes associated with the corresponding HTML tag For example the ION_BUTTON tag when used with the TYPE IMAGE attribute is converted to the following HTML lt INPUT TYPE IMAGE BORDER 1 gt Knowing that the lt ION_BUTTON gt tag becomes an HTML INPUTS tag allows you to include in your ION BUTTON tag any valid attributes of the lt INPUT gt tag For example you could include the ALIGN attribute to the lt INPUT gt tag as follows ION BUTTON EVENT myevent SRC http www ResearchSystems com images ion_sm png ALIGN middle YPE IMAGE For each ION Script tag documented in this reference you will find a section called HTML Mapping The HTML Mapping section for each ION Script tag specifies the HTML that is produced by that tag if any You can then consult an HTML reference to get a list of all the attributes that the HTML tag supports Note that certain ION Script tag attributes are converted to HTML attributes You cannot directly specify an HTML attribute if that attribute is created from an
158. ll be parsed as an ION Script file no matter what extension the file uses For example the following EVENT definition causes the file myfile xxx to be parsed as an ION Script file lt EVENT_DECL NAME event ACTION ion c ion myfile xxx gt The only times you specify the ion protocol are when you define an EVENT attribute as another ION Script page and when you include an ION Script file using the SRC attribute of ION INCLUDE Note that you cannot use the ion protocol in the following ways e For the SRC attribute of ION BUTTON which must point to an existing image file In HTML tags e In the location field of the browser Absolute Paths vs the ION Search Path How you specify file and ion URLs determines whether an absolute path or the ION Search Path is used to locate the file The ION Search Path is a search path Specifying URLs ION guide Chapter 4 Creating ION Script Applications 73 ION guide specified in the configuration utility or ionsrc file see ION Search Path on page 20 Absolute paths to ion and file URLs must start with For example ion f projects ionscript include ion If only a filename is entered the ION Search Path is used for the path and the leading may be omitted For example if the following URL is used ION Script will search for include ion in the ION Search Path ion include ion If only a filename is entered but you do include t
159. llowing ION Script reserved words Browser Document Form FormURL ION or Mouse Variable Scope ION Script documents can contain the ION INCLUDE tag which is used to insert the contents of another file ION Script HTML or text into the current ION Script document Variables defined in the enclosing page have global scope meaning they can be accessed from either the enclosing page or the included page Variables ION guide Variables 48 Variables Chapter 3 Variables Expressions amp Operators defined in included files have local scope meaning they can be accessed only from the included page If a variable with the same name is declared in the enclosing page and the included page the variable takes the value that was declared in the included page For example consider the following two ION Script files enclosing ion lt ION_SCRIPT gt lt ION_HEADER gt lt TITLE gt Scope Test lt TITL lt VARIABLES gt lt VARIABLE_DECL NAME A VALUE 5 TYPE INT gt lt VARIABLE_DECL NAME B VALUE 5 TYPE INT gt lt VARIABLES gt ION HEADER ION BODY B Enclosing file lt B gt lt BR gt A ION VARIABLE NAME SA gt lt BR gt B lt ION_VARIABLE NAME B gt lt BR gt C ION VARIABLE NAME C ION INCLUDE SRC ion included ion ION BODY ION SCRIPT E V
160. lue the value becomes a double precision value equal to 0 00 If you declare a variable as a STR and assign it a number the number is converted to double precision and then to a string To avoid having the number converted to double before string nest single quotation marks inside the double quotation marks as follows VARIABLE DECL NAME A TYPE STR VALUE 35 4 If you declare a variable as a BOOL equal to a number the value becomes false A single expression can contain variables and or values of different types The result of an expression containing variables and or values of multiple types assumes the type of the highest precision value For example adding an INT to a DOUBLE results in a DOUBLE The degree of precision from highest to lowest is DOUBLE INT BOOL STR When the expression contains a string added to a numeric value using the operator the result is a string Variables 46 Chapter 3 Variables Expressions amp Operators Assigning String Literals to ION Script Variables Whenever you assign a string literal as the value of an ION Script variable the string literal should be enclosed in single quotation marks which are then enclosed in the double quotation marks used to delimit the attribute value For example the following code shows the correct way to assign a string literal to the VALUE attribute of the VARIABLE_DECL tag lt VARIABLE_DECL NAME animal TYPE
161. mage detail and quality is rewarded with a smaller file size and consequently faster download time for the user The image dimensions i e the height and width of the image in pixels greatly effect file size Use only as large an image as is necessary for your application Output Formats Direct and Object Graphics images can be output to the Web browser in three different formats 24 bit JPEG 8 bit PNG and 24 bit PNG The default format is 8 bit PNG for Direct Graphics images and 24 bit JPEG for Object Graphics images but these defaults can be changed via the configuration utility see Images on page 18 The defaults can be overridden on a case by case basis by specifying a value for the IMG TYPE attribute of the ION IMAGE tag PNG uses a lossless compression scheme whereas JPEG compression is lossy JPEG compression can result in smaller image files but the lossy compression may degrade image quality Whether you should use JPEG 8 bit PNG or 24 bit PNG depends on several factors Some of these factors include Graphics in ION Script ION guide Chapter 4 Creating ION Script Applications 93 ION guide Whether your users have a browser that supports PNG Assuming your user base is using a browser supported by ION Script Netscape Navigator 4 7 or Internet Explorer 5 5 your users will have a browser that supports PNG Whether you are using Direct or Object Graphics The number of colors in the image The required
162. ned the region as follows region image xstart xend ystart yend We can then define these IDL variables as follows xstart Horizontal Center 1 2 Region Width xend Horizontal Center 1 2 Region Width 1 ystart Vertical Center 1 2 Region Height yend Vertical Center 1 2 Region Height 1 Now we can define ION Script variables to hold the horizontal and vertical centers and the region width and height We want our region to be 320 x 256 and we ll place the center at the center of our 1200 x 1200 image which makes the horizontal and vertical centers 600 ION guide Example Creating a Complete Application 98 Chapter 4 Creating ION Script Applications Declaring Variables To define variables in an ION Script page we use the VARIABLES tag which contains one VARIABLE_DECL tag for each variable we declare The VARIABLES tag resides inside the ION HEADER We ll add the following VARIABLES block to exl main ion in which we define the width and height of the original image the region width and height and the horizontal and vertical centers of the display region VARIABLES VARIABLE DECL NAME IMAGE W VALUE 1200 TYPE INT VARIABLE DECL NAME IMAGE H VALUE 1200 TYPE INT gt VARIABLE DECL NAME REGION W VALUE 320 TYPE INT gt VARIABLE DECL NAME REGION H VALUE
163. ng a Single Text Field on page 153 Licensing Errors If you get a page with an error message such as License Error RSI license checkout failed ION Script may not be properly licensed View the licensing instructions in the Installing and Licensing IDL manual and make sure you have properly licensed ION Note Since Web Servers do not read any system environment variables you cannot use the LM LICENSE FILE environment variable to point to where you have located your license file When licensing ION Script you must place your license file in the default location RSI DIR license license dat where RSI DIRis the name of the main installation directory you selected to install ION Java On UNIX if you have a network license that you wish your ION installation to use you can copy the network license file to the default location RST DIR license license dat on the machine on which you are running ION ION Script Syntax Errors e Make sure all single tags use the proper syntax Single tags are closed with gt Make sure you didn t mistakenly close a single tag using only or use tag pair syntax for a single tag ION Script will return an error message to inform you of a mismatched tag pair For example consider the following code ION BODY ION VARIABLE NAME SA gt ION BODY ION Script will return the following error Error Mismatched tag pair ION VARIABLE ION BODY This error message indicate
164. not occur This is equivalent to using the HTML lt PRE gt lt PRE gt block to surround text that you want formatted as typed e If set to FALSE line breaks and whitespace in the file will be ignored and the file will be displayed in the browser s default font or in the font specified by an HTML tag if used The default value is TRUE but this default can be changed on the Format tab of the configuration utility Windows or the Format section of the ionsrc file UNIX See Use lt PRE gt with Text Files on page 23 For an example illustrating the effect of the PRE attribute see Example 1 on page 144 SRC The URL of the file to include See Specifying URLs on page 70 The type of file to be included is identified by its extension This attribute can contain a variable By default the following file extensions are recognized by the ION Script parser File Type Extension Text xt ION Script jon The configuration utility or ionsrc file can be used to define additional extensions for each file type See Text Extensions on page 21 HTML Mapping The ION INCLUDE tag is not converted to HTML and therefore does not accept any other attributes ION INCLUDE ION guide Chapter 5 ION Script Tag Reference 167 Examples ION guide For these examples assume we have the same file saved with three different filenames includefile txt includefile html and includefile ion The file conta
165. ollowing SELECT element SELECT NAME region MULTIPLE gt lt OPTION gt East lt OPTION gt lt OPTION gt West lt OPTION gt lt SELECT gt If the user selects both options and submits the form the value of the Form region variable on the page that is loaded will be the string EastIWest You must then parse the value of Form region to extract the values contained in the string The following sections illustrate two different methods of handling SELECT elements when the MULTIPLE attribute is used Parsing the Form Variable in an lt IDL gt Block ION guide This example demonstrates how you could use the IDL STRSPLIT function to extract multiple values from a Form variable pagel ion ION SCRIPT ION HEADER EVENTS EVENT DECL NAME DISPLAY ACTION ion page2 ion lt EVENTS gt ION HEADER ION BODY ION FORM SELECT NAME Region MULTIPLE gt lt OPTION gt East lt OPTION gt lt OPTION SELECTED gt West lt OPTION gt lt SELECT gt lt ION_BUTTON TYPE BUTTON EVENT DISPLAY LABEL Display gt ION FORM Handling Multiple Selections in a SELECT Element 78 Chapter 4 Creating ION Script Applications ION BODY ION SCRIPT page2 ion ION SCRIPT ION BODY ION DATA OUT
166. on marks 126 SIZE property 152 Index special characters converting to character entities 165 ISO 8859 94 URL encoding 54 square brackets 115 SRC attribute ION BUTTON 136 ION INCLUDE 166 storing files 38 STR type 44 187 strdecode pro 55 string expressions 63 187 string literals 46 string operators 64 strings decoding 55 defining in IDL 126 strongly typed variables 44 SUBMIT form field 152 subtraction operator 64 syntax URLs 70 SYNTAX attribute 182 syntax conventions 114 syntax errors 191 system variables 50 Browser 50 Document 51 Form 53 FormURL 54 ION IDLURL 58 ION temp 58 SION uniqueID 59 ION version 59 Mouse 59 Form 100 Mouse 107 T TABINDEX property 152 tabs 54 ION Script User s Guide tags comment 119 mismatched 191 TARGET attribute ION_FORM 153 ION_IMAGE 162 ION_LINK 170 temp files specifying location 21 temp SION system variable 58 temporary files location 58 TEXT attribute 134 text files including 165 specifying extensions of 21 TEXT form field 152 TITLE tag 157 troubleshooting 191 TYPE attribute ION BUTTON 137 ION IMAGE 162 VARIABLE DECL 187 U undefined procedure function error 196 undefined variables checking for 46 uniqueID ION system variable 59 upper case See case sensitivity URL encoding 54 URLs file protocol 72 http protocol 71 ion protocol 72 passing data in 53 86 196 specifying 70 V
167. ons The following configuration options are available in ION Script The options are grouped as they are on the tabs of the Windows configuration program IONScriptConfig exe and in the UNIX resource file ionsrc Images Width Height The Width and Height fields are used to specify the default dimensions in pixels of images created with the ION IMAGE tag These default values can be overridden by specifying the WIDTH and HEIGHT attributes of the ION IMAGE tag Direct Graphics Image Type The Direct Graphics Image Type specifies the image format for images created with ION_IMAGE with the TYPE attribute set to DIRECT which causes the image to be created using IDL s Direct Graphics This default value can be overridden by specifying the IMG TYPE attribute of the ION IMAGE tag See Graphics in ION Script on page 91 for a discussion of how to choose the proper image format Object Graphics Image Type The Object Graphics Image Type specifies the image format for images created with ION IMAGE with the TYPE attribute set to OBJECT which causes the image to be created using IDL s Object Graphics This default value can be overridden by specifying the IMG TYPE attribute of the ION IMAGE tag See Graphics in ION Script on page 91 for a discussion of how to choose the proper image format Label The Label field is used to specify the default text displayed in place of an image for browsers that do not support images and for brows
168. or HTML or IDL content Case Sensitivity ION Script is case sensitive All ION Script tags and attributes must be entered exactly as shown in this reference User defined variables must use consistent case as well If you declare a variable as A you cannot refer to that variable using a System variables are not case sensitive except for Browser system variables Using Quotation Marks ION Script requires that values assigned to tag attributes be enclosed in double quotation marks using the general form ATTRIBUTE value Noe Carriage returns are not allowed between the double quotation marks that delimit the value of an ION Script attribute When the attribute is an expression the EXPR attribute of ION_DATA_OUT or ION IF you will often need to mix numeric and string values Strings can be Syntax Conventions ION guide Chapter 5 ION Script Tag Reference 117 enclosed in single quotation marks which can be nested inside double quotation marks as in the following example ION IF EXPR SName EQ Smith gt Single quotation marks must also be nested inside double quotation marks whenever you assign a string literal as the value of an ION Script variable For example the following code shows the correct way to assign a string literal to the VALUE attribute of the VARIABLE_DECL tag lt VARIABLE_DECL NAME animal TYPE STR VALUE dog Noe In an lt IDL gt block you can use either s
169. or example the form on the following ION Script page can be submitted with the button or the Enter key ION FORM 154 Chapter 5 ION Script Tag Reference pagel ion lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME BUTTON_PRESS ACTION ion page2 ion gt lt EVENT_DECL NAME TEXT_ENTERED ACTION ion page2 ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt This form can be submitted by clicking the button or lt BR gt pressing the Enter key while the cursor is in the lt BR gt text field lt BR gt lt BR gt lt INPUT NAME TEXT_ENTERED TYPE TEXT VALUE 5 gt ION BUTTON EVENT BUTTON PRESS TYPE BUTTON ION FORM ION BODY ION SCRIPT page2 ion ION SCRIPT ION BODY You submitted ION VARIABLE NAME S Form TEXT ENTERED ION BODY ION SCRIPT Note that the ION BUTTON uses an event with a different name than the event associated with the text field but the ACTION is the same This avoids submitting two parameters with the same name HTML Mapping ION FORM The ION FORM tag is converted to the HTML FORM tag The value of the ION Script Parser URL which is specified in the ION Script Configuration utility or the ionsrc file is used as the value of the
170. orm var2 gt ION BODY ION SCRIPT When you click the link on page1 ion page2 ion displays the following The value of varl is 5 The value of var2 is abc Passing ION Script Variables in a URL ION guide Instead of simply passing hard coded values in a URL as in the above example it is also possible to pass ION Script variables in a URL To do so you must insert the ION Script variable in the URL query string by using the ION VARIABLE tag as follows pagel ion ION SCRIPT ION HEADER VARIABLES XVARIABLE DECL NAME A TYPE INT VALUE 10 Passing Name Value Pairs in a URL 76 Chapter 4 Creating ION Script Applications lt VARIABLES gt ION HEADER ION BODY lt A HREF http host cgi bin ion p exe page page2 ion amp varl ION VARIABLE NAME SA gt gt Page 2 A ION BODY ION SCRIPT page2 ion ION SCRIPT ION BODY The value of the ION Script variable passed in the URL for this page is ION VARIABLE NAME S Form varl ION BODY ION SCRIPT When you click the link on page1 ion page2 ion displays the following The value of the ION Script variable passed in the URL for this page is 10 Passing Multiple Values With the Same Name If you pass a URL to the ION Script parser and the URL contains a query string in which
171. ormation on the subject can be found in many HTML and JavaScript VBScript references System Variables ION guide Chapter 3 Variables Expressions amp Operators 51 The CONTAINS operator can be used to check the Browser HTTP_USER_AGENT variable for a browser type or version For example the following code could be used to determine if the browser is Microsoft Internet Explorer ION SCRIPT ION BODY ION IF EXPR S Browser HTTP USER AGENT CONTAINS MSIE You are using Internet Explorer ION IF ION BODY ION SCRIPT See http hoohoo ncsa uiuc edu cgi env html for a list of CGI environment variables Warning TA Assigning Browser REMOTE USER as a string variable to the VALUE attribute can be dangerous because it is frequently an undefined system variable When VALUE is undefined IDL reports an error However it is possible that code that uses SBrowser REMOTE USER could be implemented and tested without error on one system and fail if ported to another system Document ION guide The Document system variables store the metadata defined in the header section For example if the header section of your ION Script page contains the tag lt TITLE gt My Title lt TITLE gt then Document TITLE contains the text My Title APPLICATION The application name defined with the lt APPLICATION3 gt tag AUTHOR The document author defined wi
172. ou can t guarantee that users are viewing your page in Internet Explorer 3 0 or higher it is best to either avoid floating frames or to create a page that accommodates all browsers The following page uses a floating frame for Internet Explorer a lt FRAMESET gt for Netscape Navigator and a lt NOFRAMES gt block for browsers that don t support frames lt HTML gt lt NOFRAMES gt lt FRAMESET COLS 50 gt E FRAME SRC ion p page netscapel html lt FRAME SRC 2 ion p page netscape2 html lt FRAMESET gt This content will not be visible to Internet Explorer lt BR gt or Netscape Only non frame browsers will display this lt NOFRAMES gt lt BODY gt lt IFRAME NAME msie SRC ion p page msie html WIDTH 150 HEIGHT 150 gt IFRAME This text is visible in the BODY of the page in Internet Explorer lt BODY gt lt HTML gt Using Frames with ION Script 90 Chapter 4 Creating ION Script Applications Using JavaScript and VBScript There are two ways to include JavaScript and VBScript in your ION Script applications Note Use an HTML lt SCRIPT gt lt SCRIPT gt block Use an ION Script tag whose attribute takes a script as its value The attributes that take scripts as values are any ON attributes of the HTML lt BODY gt or FORM tags such as ONLOAD and ONUNLOAD for lt BODY gt and ONRESET and ONSUBMIT for lt
173. ource Netscape or View Source Internet Explorer e As PRE Text Error messages are included in the returned HTML page as lt PRE gt text and will appear at the bottom of the returned HTML page This is useful during development of your ION Script applications On UNIX set the ION Debug Syntax value to either OFF COMMENT or PRE in the ionsrc file The method selected in the ION Script Configuration Utility or ionsrc file becomes the default method for error reporting This default method can be overridden on a page by page basis by setting the SYNTAX attribute for the lt ION_SCRIPT gt tag to either OFF COMMENT or PRE ION guide ION Script Configuration Options 26 ION Script Configuration Options Chapter 1 Configuring ION Script ION guide Chapter 2 Overview This chapter provides a high level overview of ION Script The following topics are covered in this chapter e What Is ION Script e Requesting an ION Script Page e Where to Store Your Files Running the ION Script Examples ION guide 27 28 Chapter 2 Overview What Is ION Script ION Script is a language for creating Web based IDL visualization and analysis applications It contains tags similar to HTML tags for embedding IDL visualizations and data in a Web page It has a rich set of variable event and flow control tags that allow you to create powerful interactive Web applications ION
174. pecified TYPE the value will be changed to the type specified by the TYPE attribute See Variable Types on page 44 for a list of the cases in which the value is converted When setting the VALUE attribute to a string literal the string should be enclosed in single quotation marks all inside the double quotation marks that delimit the attribute value For example the following code shows the correct way to assign a string literal to the VALUE attribute lt VARIABLE_DECL NAME animal TYPE STR VALUE dog gt If you are assigning the VALUE attribute a string variable as opposed to a string literal do not enclose the variable in single quotation marks For example if the variable animal has already been defined as a string you would assign the value of the animal variable to a new variable as follows lt VARIABLE_DECL NAME pet TYPE STR VALUE animal Warning Assigning Browser REMOTE USER as a string variable to the VALUE attribute can be dangerous because it is frequently an undefined system variable When VALUE is undefined IDL reports an error However it is possible that code that uses SBrowser REMOTE USER could be implemented and tested without error on one system and fail if ported to another system ION guide VARIABLE DECL 188 Chapter 5 ION Script Tag Reference HTML Mapping The VARIABLE_DECL tag is not converted to HTML
175. pt applications For a few types however ION Script has custom tags with more functionality than their corresponding INPUT type e Use the ION BUTTON tag instead of lt INPUT TYPE BUTTON gt Buttons created with ION_BUTTON execute an ION Script EVENT when clicked e Use the ION RADIO tag instead of lt INPUT TYPE RADIO gt The ION RADIO tag allows you to maintain the selection state of a radio button group when the page is reloaded e Use the ION CHECKBOX tag instead of lt INPUT TYPE CHECKBOX gt The ION CHECKBOX tag allows you to maintain the selection state of a checkbox when the page is reloaded Noe Not all attributes of the INPUT tag are documented here Only the most commonly used attributes are listed Refer to an HTML reference such as the one at http www htmlhelp com for a complete list of all INPUT tag attributes Syntax lt INPUT NAME name TYPE BUTTON CHECKBOX CHECKED I FILE HIDDEN IMAGE ALT text SRC url ALIGN top middle bottom left right I PASSWORD MAXLENGTH characters SIZE characters RADIO CHECKED RESET SUBMIT TEXT MAXLENGTHE characters SIZE characters ONBLUR script ONCHANGE script ONFOCUS script TABINDEX position VALUE value gt ION guide INPUT 130 Chapter 5 ION Script Tag Reference Attributes INPUT Note To use ION Script variables in an INPUT attribute you must insert the
176. pt pages Once a variable is declared as persistent it is available to all ION Script pages that are called via an ION Script event or ION LINK without having to re declare the variable in each page If the variable is declared as not persistent PERSIST set to FALSE or no PERSIST attribute or not declared at all the variable can be referenced only in the page in which it is declared or assigned a value and in included pages If you declare a persistent variable and pass it to a page that declares a variable persistent or not with the same name the new declaration is not used the value passed from the previous page is used Variables 50 Chapter 3 Variables Expressions amp Operators System Variables System variables are built in ION Script variables used to hold useful information about ION Script applications Each system variable can have multiple variables associated with it You refer to these variables using the following general syntax SSystemVariable VariableName where SystemVariable is Browser Document Form FormURL ION or Mouse and VariableName is the specific variable name for the specified system variable Some system variables have only built in variables associated with them such as Mouse which has Mouse x and Mouse y Other system variables are assigned variables by the user such as Form when the user defines an INPUT element Note System variables are case insensitive except for any varia
177. rame Targeting Different Frames Clicking a link or a button or image with an associated event causes another page to be loaded By default this new page replaces the current page in the full browser window You may want the new page to be loaded in a different frame rather than in the full browser window The frame or window in which the page is to be loaded is called the target The ION_FORM ION_IMAGE and ION_LINK tags each have a TARGET attribute to specify the frame in which to load the URL specified by their corresponding EVENT attribute The TARGET attribute of ION FORM ION IMAGE and ION LINK can be set to either the NAME attribute of an HTML FRAME or IFRAME tag or to one of four predefined windows blank opens the page in a new instance of the browser e parent opens the page in the next higher window in the window hierarchy the immediate FRAMESET parent e Self opens the page in the same window in which the event occurred This is the default target if the TARGET attribute is not specified This is useful for overriding a TARGET specified by the BASE tag e top opens the page in the main browser window Using Frames with ION Script ION guide Chapter 4 Creating ION Script Applications 89 Accommodating All Browsers ION guide Keep in mind that different browsers have different capabilities with respect to frames Floating frames for example are an Internet Explorer specific feature If y
178. ray the first input row is used to determine the number of columns Rows that contain fewer columns will be filled with null strings while extra columns will be ignored If NO_SPLIT is set carriage returns will not be used to split the string into a string array Carriage returns will remain within the string as characters with the value STRING 13b Assume the following data is entered into a textarea CR is a carriage return 1 2 lt CR gt 3 4 lt CR gt 5 6 lt CR gt ION guide System Variables 58 Chapter 3 Variables Expressions amp Operators The following table illustrates how the different keyword combinations effect the value returned by st rdecode returns the following Result when decoding FormURL DATA using the various keyword combinations Keywords Set HELP Result PRINT Result None String Array 3 1 2 3 4 5 6 ARRAY String Array 2 3 12 34 56 NO_SPLIT String 1 2 3 4 5 6 ARRAY NO SPLIT String Array 6 123456 Table 3 1 Effect of different keyword combinations with strdecode pro ION The ION system variables are read only values that contain information about ION Script IDLURL SION IDLURL is a read only string value specifying the URL used to call the ION Script image engine ion i exe This system variable is used as the value of the DATA attribute of the ION OBJECT tag when OBJTYPE is OBJECT or the SRC attribute of the ION OBJECT tag when OBJTYPE is
179. rch Path to indicate that all subdirectories of the specified directory should be searched Therefore each directory you want to be searched must be explicitly specified See ION Search Path on page 20 for more information Do both the page you are trying to load and the directory containing the file have read permission ION guide Chapter 6 Troubleshooting 193 If running ION Script on a UNIX Web server does the case of the filename in the URL match the case of the actual filename If you are able to run ION Script applications directly from your Web server but external users are not able to run ION Script applications check the Image Server URL and ION Script Parser URL values on the URLs tab of the ION Script Configuration utility Windows or in the URLs section of the ionsrc file UNIX You must specify your Web server s fully qualified domain name and path to the CGI executables directory for your Web server For example the Image Server URL should look something like this http myhost mydomain com cgi bin ion i exe If during the installation process you left the field blank on the Web Server Configuration dialog in which you specify your Web server s fully qualified domain name the installer will use your Windows machine name or your hostname on UNIX Do you have an event named page This is an illegal name for an event Not Found Errors ION guide If you get an HTTP error informing you that
180. riable The following are examples of expressions Friday 143 A B 4 0 E M C 2 Stringl EQ String2 Browser type Variable 4 3 Form name X A B Variable 34 GE 341 LastName Smith Values Values used in expressions can be any of the following e Variables of the form varname e String literals of the form string text Numbers of the form x or x x e Numbers using scientific notation of the form xEy xey xDy or xdy where x is any real number and y is a positive or negative exponent For example 2E6 is the same as 2 10 Note that in ION Script there is no difference between the characters e E d and D e Booleans of the form TRUE FALSE true or false For example A EQ TRUE Expression Types There are three main types of expressions They are e Numeric expressions e Boolean expressions e String expressions ION guide Expressions 62 Expressions Chapter 3 Variables Expressions amp Operators Numeric Expressions Numeric expressions are expressions that evaluate to a number The following are examples of numeric expressions e 1 3 40 a b assuming a and b are both numbers Mouse x Numbers can be one of two types DOUBLE double precision such as 1 2345 or INT integer such as 1 All numeric expressions are evaluated as double precision values regardless of whether the variables or values in the expression are integers or
181. s written to the page Note the following in this example e Each radio button in a group is given the same NAME attribute e When the page loads for the first time the radio button given the DEFAULT attribute is initially selected e This example could also be created using radio buttons created with the INPUT tag instead of ION_RADIO but when the page reloads the state of the buttons would be lost lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME RELOAD ACTION ion radio ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt ION RADIO NAME Group1 VALUE 1 gt Button 1 lt BR gt lt ION_RADIO NAME Group1 VALUE 2 DEFAULT gt Button 2 lt BR gt lt ION_RADIO NAME Group1 VALUE 3 Button 3 lt BR gt ION BUTTON EVENT RELOAD LABEL SUBMIT TYPE BUTTON gt lt BR gt ION FORM ION IF EXPR NOT Form Groupl ISTYPE UNDEF gt B Button ION VARIABLE NAME S Form Groupl was selected lt B gt ION IF ION BODY ION SCRIPT ION RADIO ION guide Chapter 5 ION Script Tag Reference 181 The following figure shows the result of this example Netscape _ Oy x File Edit View Go Communicator Help C Button 1 Button 2 C Button 3 SUBMIT Button 2 was selected E Document Done 7 I
182. s attribute can contain a variable The NAME you specify for form fields cannot begin with ION__ VALUE The value assigned to the checkbox which can be accessed using Form NAME If this value is numeric and you want to use it in an expression you must declare a new INT or DOUBLE variable assign it the value Form NAME and use the new variable in the expression instead of Form NAME See Using Form Variables in Numeric Expressions on page 54 This attribute can contain a variable Note LLL All attributes of the HTML lt INPUT TYPE CHECKBOX gt are also available to ION CHECKBOX See INPUT on page 129 HTML Mapping The ION CHECKBOX tag is converted to the HTML lt INPUT TYPE checkbox gt tag The NAME and VALUE attributes of the ION CHECKBOX tag become the NAME and VALUE attributes of the lt INPUT gt tag All attributes of the HTML lt INPUT gt tag are also available to ION CHECKBOX ION CHECKBOX ION guide Chapter 5 ION Script Tag Reference 139 Example In this example named checkbox ion we create three checkboxes and a button with an EVENT that reloads the page When the user clicks the button the page is reloaded and the state of each checkbox is written to the page When the page reloads the checked boxes remain checked Note that this example could also be created using checkboxes created with the INPUT tag instead of ION_CHECKBOX but when
183. s located in the cgi bin directory of the server Different Web servers use different names for this directory therefore the path to 1on p may differ for your Web server Also you must specify the ION Script Parser URL on the URLs tab of the configuration utility See ION Script Parser URL on page 19 This URL format is used to load ION Script pages in the following cases e When you type the URL of an ION Script page in your browser e For the HREF attribute of the A tag when creating a hyperlink to an ION Script page e For the SRC attribute of the FRAME or lt IFRAME gt tag when the frame source is an ION Script page It is also possible to include name value pairs in your URL to pass parameters to the requested page For example you could pass the DATA parameter with a value of 5 to the page mypage ion as follows http servername cgi bin ion p page mypage ion amp DATA 5 You could then access the DATA parameter in the mypage ion using Form DATA ION Script pages can also be loaded as the action of an HTML form HTML forms can use hidden form fields to pass name value pairs to a CGI application Instead of including the query string in the ACTION attribute of the FORM tag we create a Requesting an ION Script Page ION guide Chapter 2 Overview 37 hidden field with the NAME attribute set to page and the VALUE attribute set to the URL of the ION Script page as in the following example lt HTML gt
184. s parts of an ION Script document to be conditionally evaluated and displayed This feature allows you to build interactive Web based applications When an ION_IF tag is encountered in a Web page the ION Script parser evaluates the expression If the expression evaluates to TRUE all content up to either the closing ION IF tag or the first internal ION ELSEIF or ION ELSE tag is processed If the expression evaluates to FALSE the parser searches for an ION ELSEIF or ION ELSE tag If an ION ELSEIF tag is encountered its expression is evaluated and processing continues as with ION IF If an ION ELSE tag is encountered the content between the opening and closing ION IF tags is processed Both ION Script and HTML content can be conditionally displayed Syntax ION IF EXPR expression ION or HTML content ION ELSEIF EXPR expression gt ION or HTML content ION ELSE gt ION or HTML content ION IF Attributes EXPR The expression to be evaluated by the parser This attribute can contain a variable See Chapter 3 Variables Expressions amp Operators for details on writing ION Script expressions HTML Mapping The ION IF ION ELSEIF and ION ELSE tags do not directly produce any HTML output however any valid HTML can be contained within the ION IF ION IF tag pair The EXPR attribute of the ION IF ION ELSEIF and ION ELSE tags is evaluated to determine which content to process ION IF
185. s that must be completed before ION Script will run as well as preferences that can be set to control the behavior of ION Script The following topics are covered in this chapter e Configuring ION Script for Windows e Configuring ION Script for UNIX ON Script Configuration Options ION guide 10 Chapter 1 Configuring ION Script Configuring ION Script for Windows The program IONScriptConfig exe is used to specify various default settings preferences and file paths for the Windows version of ION Script To configure ION Script for Windows do the following 1 Run IONScriptConfig exe You can access this program from the Windows Start menu under Programs Research Systems ION 6 1 gt ION Script Configuration This program is located in the RSI DIR IDL61 products ION61 ion_script bin directory where RSI DIRis the directory in which you installed IDL 2 Modify the desired settings on each of the tabs described below Refer to ION Script Configuration Options on page 18 for a description of each configuration option 3 When you have finished making changes click Apply The changes will take effect immediately you do not need to restart Windows The Images Tab The Images tab shown below is used to specify default properties for images created with the ION IMAGE tag Attributes of the ION IMAGE tag can be used to override the default values specified on the Images tab on a case by case basis For information on
186. s that you opened a tag called ION VARIABLE and ION Script found the next closing tag ION BODY This should alert you to the incorrect syntax for ION VARIABLE i e the proper way to close this tag is with gt rather than just gt ION guide Chapter 6 Troubleshooting 195 Make sure all tag pairs have both the opening and closing tag For example if you have an ION HEADER tag you must also have an lt ION_HEADER gt tag Check the case and spelling of your tags attribute names and system variables Make sure you ve used the exact case shown in the Tag Reference Make sure you have specified all the required attributes of a tag In the syntax listings attributes are required unless they are surrounded by square brackets Make sure all attribute values have been enclosed in double quotation marks Remember to include both opening and closing quotation marks If you get the error Illegal character during parsing make sure you have not included a carriage return between the double quotation marks that delimit the value of an ION Script attribute For example the following ION Script code is not allowed lt ION_EVALUATE EXPR X Sy gt IDL Errors ION guide Set the DEBUG attribute of the ION_DATA_OUT and ION_IMAGE tags to TRUE to cause a debugging file to be generated in the directory specified by the ION Debug Location setting on the Debug tab of the ION Script
187. s you would use inside the HEAD element of an HTML page such as lt META gt lt SCRIPT gt and lt STYLE gt ION guide What Is ION Script 30 Chapter 2 Overview This ION Script page is parsed by the ION Script parser to create the following HTML page My ION Script Page Netscape Jel x File Edit View Go Communicator Help y gt 44 2 Reload Home Back Forward Search My ION Script Page This is a simple ION Script page Creating the above page with ION Script wouldn t make much sense because the same page could be created with pure HTML But pure HTML doesn t provide the means to for example embed a dynamically generated IDL image in a Web page By adding a couple of simple tags ION IMAGE and IDL we can easily accomplish this with ION Script lt ION_SCRIPT gt lt ION_HEADER gt lt TITLE gt My ION Script Page lt TITLE gt lt ION_HEADER gt lt ION_BODY gt lt H1 gt My ION Script Page lt H1 gt This is a simple ION Script page lt BR gt lt BR gt lt ION_IMAGE TYPE DIRECT gt lt IDL gt shade_surf dist 30 lt IDL gt ION IMAGE ION BODY ION SCRIPT What Is ION Script ION guide Chapter 2 Overview This code gives us the following page HY My ION Script Page Netscape mx Eie Edi View Go Communicator Help 3 A 2 A ck S Back Far Reload Home Search Netscape Print Security My ION Script Page
188. sing the Symbol in an IDL Block ION guide The symbol can have three different meanings when used in an IDL block e To indicate that what immediately follows the symbol is an ION Script variable allowing you to use ION Script variables in IDL code e The IDL line continuation character used to continue a line of code on the next line The literal symbol when you want IDL to print the actual symbol Using to Insert ION Script Variables in IDL Code If ION Script encounters a symbol in an IDL block and the symbol is not preceded by the character it will interpret whatever follows the symbol as an ION Script variable unless the symbol is the last character on the line including spaces This allows you to use ION Script variables in your IDL code The value of the ION Script variable will be substituted for the variable name before being passed to IDL Using as the IDL Line Continuation Character When a line of IDL code extends beyond a certain length it is often desirable to continue the code on the next line thereby making your IDL code more readable The IDL line continuation character indicates that the current statement is continued on the following line The symbol must be the last character on the line for the line continuation to work Comments after the symbol will cause an error because the symbol is also used to denote an ION Script variable Anything following the IDL 128 Chapter
189. sr local rsi ion_6 1 ion_script examples home ion home ion test ION Script Configuration Options ION guide Chapter 1 Configuring ION Script 21 ION guide Note You cannot use the symbol in the ION Search Path to indicate that all subdirectories of the specified directory should be searched You must explicitly specify each directory to be searched If you specify an absolute path in your URL such as http myserver cgi bin ion p page c ion myfile ion ION Script attempts to execute the specified page and does not search the ION Search Path See Specifying URLs on page 70 and Absolute Paths vs the ION Search Path on page 72 for more on URLs and the ION Search Path See Where to Store Your Files on page 38 for strategies on locating your ion and html files Temp Location Set this field to the path specifying the location of the temporary graphics and text files that ION Script creates If not specified UNIX servers will write to tmp and Windows servers will write to the location specified by the TEMP system environment variable The value of this setting can be accessed programmatically via the SION temp system variable Noe If the directory you have specified does not exist or if the web server does not have permissions to write to the directory images created with the ION_IMAGE tag do not display and ION Script does not display any errors Make sure that the temp directory you hav
190. ssions Expressions that are contained inside parentheses are evaluated first by ION Script When multiple sets of parentheses are nested within one another the expression contained in the innermost set of parentheses is evaluated first For example consider the fo ION IF AND Temp EXPR Month EO 70 This statement is equivalent ION IF EXP SMonth R SMonth EQ May If your intent was to require llowing code OR Month EQ April EQ May e to the following EQ AND Temp April OR EQ 70 Temp to be 70 but allow the Month to be April or May you would need to override the precedence as follows ION IF Temp EXPR Mont EQ 70 gt ION guide h OR Month EQ April EQ May AND Operators 68 Chapter 3 Variables Expressions amp Operators Tip It is good programming practice to use parentheses to control the order of evaluation even when not technically necessary This ensures that your expressions are being evaluated in the order you intended and makes your code more readable Examples The following table gives several examples of the order in which expressions are evaluated in ION Script Expression Result 10 5 2 48 10 5 2 30 34 4 242 2 11 3 4 2 2 2 35 Operators ION guide Chapter 4 Creating ION Script Applications The following topics are covered in this chapter e Specifying
191. stead require a lt PARAM gt tag to provide this information The method used to provide this information to the plug in depends on the plug in that is used to render the data The SION IDLURL system variable defines the URL used to access the ION Script image engine ion i exe Set either the DATA attribute or SRC attribute to the value of the SION IDLURL system variable See Examples on page 176 for examples that illustrate the use of the SION IDLURL system variable DEBUG Setting this attribute to TRUE causes ION Script to generate a text file that can be used to help debug your ION Script application This debugging file contains the exact code sent to IDL as well as any errors reported by IDL The file is given the name specified by the Log Filename setting on the Debug tab of the ION Script Configuration utility Windows or by the ION Debug Filename in the Debug section of the ionsrc file UNIX For example if the setting is ion out d txt then a file called ion out PID txt is created where PID is the unique process ID for the instance of ion i that generated the output The file is written to the directory specified by the Log Location setting on the Debug tab of the ION Script Configuration utility Windows or by the ION Debug Location in the Debug section of the ionsrc file UNIX In order for this to work the directory specified by the ION Debug Location must be writable See Debu
192. t ION_SCRIPT gt FormURL2 ion ION SCRIPT ION BODY ION IMAGE TYPE DIRECT gt lt IDL gt ION guide System Variables 56 Chapter 3 Variables Expressions amp Operators label strdecode FormURL xlabel plot 0 1 xtitle label lt IDL gt lt ION_IMAGE gt lt ION_BODY gt lt ION_SCRIPT gt Example 2 Another case in which FormURL is useful is if your ION Script form contains a textarea to allow the user to enter or paste in data that is delimited with commas tabs spaces and or carriage returns The st rdecode pro program can convert such data into the format you require In this example a textarea is used to enter a two dimensional array of data for a contour plot By setting the ARRAY keyword in the call to st rdecode we allow the user to enter a two dimensional array where the elements of each row can be separated by spaces tabs or commas and each row is terminated with a carriage return Therefore if the user enters data containing multiple rows and columns this application preserves the format of the data Note that st rdecode creates a string array therefore this array must be converted to a numeric array in this example textareal ion ION SCRIPT ION HEADER lt EVENTS gt lt EVENT_DECL NAME DRAW ACTION ion textarea2 ion gt lt EVENTS gt lt ION_HEADER gt
193. ta using an ION DATA OUT tag in which case the IDL code is processed as soon as it is encountered Attributes BORDER The width of the border drawn around the image A value of 0 causes the image to be displayed without a border The default BORDER is 1 but this default can be changed on the Images tab of the ION Script Configuration utility Windows or in the Images section of the ionsrc file UNIX This attribute can contain a variable DEBUG Setting this attribute to TRUE causes ION Script to generate a text file that can be used to help debug your ION Script application This debugging file contains the exact code sent to IDL as well as any errors reported by IDL The file is given the name specified by the ION Debug Filename setting on the Debug tab of the ION Script Configuration utility Windows or in the Debug section of the ionsrc file ION IMAGE ION guide Chapter 5 ION Script Tag Reference 161 ION guide UNIX For example if the ION Debug Filename setting is ion out d txt then a file called ion out lt PID gt txt is created where PID is the unique process ID for the instance of 1on i that generated the output The file is written to the directory specified by the ION Debug Location setting on the Debug tab of the ION Script Configuration utility Windows or in the Debug section of the ionsrc file UNIX In order for this to work the directory specifie
194. th the lt AUTHOR gt tag COPYRIGHT The copyright statement defined with the COPYRIGHT tag To add a copyright statement to your ION Script page you can use the COPYRIGHT and ION VARIABLE tags as follows ION SCRIPT ION HEADER lt COPYRIGHT gt Copyright 2004 Research Systems Inc lt COPYRIGHT gt ION HEADER System Variables 52 Chapter 3 Variables Expressions amp Operators lt ION_BODY gt ION VARIABLE NAME Document COPYRIGHT ION BODY ION SCRIPT You can control whether or not the O symbol appears before the copyright statement using the Format tab of the configuration utility See Include when displaying Document COPYRIGHT on page 24 DATE The date the document was created defined with the DATE tag EVENT A variable of type STR that contains the name of the event that triggered the current page to be loaded If no event triggered the page its value is page Therefore page is an illegal name for an event The following two ION Script pages demonstrate the use of Document EVENT pagel ion ION SCRIPT ION HEADER EVENTS EVENT DECL NAME PASSEVENT ACTION page2 ion lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt lt ION_BUTTON EVENT PASSEVENT LABEL Load page via an event TYPE BUTTON gt lt BR gt ION FORM FORM ACTION http myserver cgi bin ion p lt INPU YPE
195. the attributes of ION IMAGE see ION IMAGE on page 159 Images URLs Files Format Debug About r Dimensions 3 Label fio Image Width 320 Height 256 Bader NN r Direct Graphics Image Type Object Graphics Image Type PNG 8 bit PNG 8 bit PNG 24 bit C PNG 24 bit C JPEG 24 bit JPEG 24 bit coc toh Configuring ION Script for Windows ION guide Chapter 1 Configuring ION Script 11 The URLs Tab ION guide The URLs tab shown below is used to specify the path to the ION Script Image Server and the parser The Image Server is part of the file ion i exe Note During the installation process you were prompted on the Web Server Configuration dialog for your Web server s fully qualified domain name and the proper path to your Web server s CGI executables directory If you specified these values at that time these values should already appear on the URLs tab and you do not need to do anything further on the URLs tab ION Script Configuration x Images URLs Fies Format Debug About Image Server URL nte 0 foni exe ION Script Parser URL http O ion p exe If you did not specify this value on the Web Server Configuration dialog during the installation process the Image Server field will be given a URL of the form http WindowsMachineName cgi bin ion i exe where WindowsMachineName is the name of your Windows machine and cgi bin is th
196. the page reloads the state of the checkboxes would be lost lt ION_SCRIPT gt lt ION_HEADER gt lt EVENTS gt lt EVENT_DECL NAME RELOAD ACTION ion checkbox ion gt lt EVENTS gt lt ION_HEADER gt lt ION_BODY gt lt ION_FORM gt ION CHECKBOX NAME Box1 VALUE 1 gt Box 1 lt BR gt ION CHECKBOX NAME Box2 VALUE 2 gt Box 2 lt BR gt ION CHECKBOX NAME Box3 VALUE 3 Box 3 lt BR gt ION BUTTON EVENT RELOAD LABEL SUBMIT TYPE BUTTON gt lt ION_FORM gt lt BR gt Box 1 was ION IF EXPR SForm Boxl ISTYPE UNDEF gt unchecked lt BR gt lt ION_ELSE gt checked lt BR gt lt ION_IF gt Box 2 was lt ION_IF EXPR SForm Box2 ISTYPE UNDEF gt unchecked lt BR gt lt ION_ELSE gt checked lt BR gt lt ION_IF gt Box 3 was ION IF EXPR SForm Box3 ISTYPE UNDEF gt unchecked ION ELSE checked ION IF ION BODY ION SCRIPT Note that when a checkbox is unchecked the Form variable associated with that checkbox is undefined This allows us to use the ISTYPE operator on the Form variable to determine whether a checkbox is checked To cause an ION CHECKBOX to be initially selected when the page is loaded ION guide ION CHECKBOX 140 ION CHECKBOX Chapter 5 ION Script T
197. tion Variations To keep this example as simple as possible our button event caused the action page to replace the main page In this section we ll explore a couple alternative ways of writing this application Using Frames In some applications you might find it useful to display an original and a manipulated image next to each other on the same Web page One way to do this would be to use frames We ve included a framed version of this example in the examples directory The file is called ex1 frame main html Load this page using a URL such as http myserver cgi bin ion p page exl frame main html For more information on creating frames see Using Frames with ION Script on page 82 Example Creating a Complete Application ION guide Chapter 4 Creating ION Script Applications 111 ION guide Reloading the Same Page Another option for this application would be to use the same page for the main page and the action page In this case when the user clicks the button the action is to reload the same page We ve included this version in the examples directory The file is called ex2 main ion There are a few changes we need to make to the application when the event is to reload a page with a form 1 First we need to change the event declaration to load the same page EVENT DECL NAME SCALE COLORS ACTION ion ex2 main ion 2 The first time the page is loaded the image is scaled using the
198. tors 64 MAXLENGTH property 152 messages error 191 metadata tags 156 METHOD attribute ION_BUTTON 136 ION_DATA_OUT 143 ION Script User s Guide 203 METHOD attribute continued ION_FORM 152 MIME attribute ION OBJECT 175 MOD operator 64 Mouse system variable 59 107 multiplication operator 64 N NAME attribute EVENT DECL 122 ION CHECKBOX 138 ION FORM 153 ION LINK 170 ION RADIO 179 ION VARIABLE 183 VARIABLE DECL 186 name value pairs 36 53 86 196 NE operator 65 nesting quotation marks 116 numeric expressions 62 O object graphics 91 159 OBJTYPE attribute ION OBJECT 175 ONLOAD attribute 134 ONRESET attribute 153 ONSUBMIT attribute 153 ONUNLOAD attribute 134 operators comparison 65 logical 66 mathematical 64 precedence of 67 string 64 OR operator 66 origin location of 59 output formats 92 Index 204 P parentheses 67 performance 92 PERSIST attribute using 49 VARIABLE_DECL tag 186 persistence form variables 54 variable 49 186 PNG images 92 161 POST method 136 143 152 PRE attribute ION_DATA_OUT 143 ION_INCLUDE 166 precedence operator 67 process ID 59 Q query strings 53 quotation marks 116 126 195 R radio buttons creating 180 determining selected 180 INPUT 129 ION_RADIO 179 reserved words 47 RGB triplets 133 S SERVER attribute ION DATA OUT 143 ION IMAGE 162 ION OBJECT 175 single quotati
199. ubmitted in the form with the variables Form SCALE MIN Form SCALE MAX and Form SCALE TOP But Form variables are always treated as strings therefore we cannot use Form variables in numeric expressions In order to check the numeric values submitted in the form we must first declare numeric variables and set them equal to the Form variables This converts the string to a numeric value We ll therefore add the following VARIABLES block to the ex1_scale ion page VARIABLES VARIABLE DECL NAME SCALE MIN VALUE Form SCALE MIN YPE INT VARIABLE DECL NAME SCALE MAX VALUE Form SCALE MAX YPE INT VARIABLE DECL NAME SCALE TOP VALUE Form SCALE TOP YPE INT VARIABLES Now we re ready to check the values submitted in the form We do this by creating an ION IF block For example we can check the value of SCALE MIN by adding the following code to ex1_scale ion ION IF EXPR S SCALE MIN LT 0 gt lt FONT COLOR 2 4CC0000 BR lt B gt Error lt B gt Scale min must be greater than or equal to 0 lt BR gt lt BR gt lt FONT gt ION ELSEIF EXPR SSCALE_MIN GT 255 gt lt FONT COLOR CC0000 gt lt BR gt lt BR gt lt B gt Error lt B gt Scale min must be less than 256 lt BR gt lt FONT gt lt ION_IF gt Example Creating a Complete Application ION guide Chapter 4 Creatin
200. urn off selected ION Script tags by commenting them out in order to test individual code segments For example to comment out an ION EVALUATE tag you would use the comment tag as follows ION EVALUATE EXPR SA 10 gt Prevent content inside HTML tags from appearing as text in older browsers that do not recognize the tag For example the lt STYLE gt tag is not recognized by some older browsers in which case the content inside the lt STYLE gt tag appears as text The HTML comment tag is often used inside the lt STYLE gt tag to prevent style declarations from appearing as text in older browsers lt STYLE type text css H1 color red BODY background yellow STYLE Similarly because older browsers do not support scripting languages such as JavaScript and VBScript HTML comment tags are often used inside SCRIPT blocks to prevent scripts from appearing as text in older browsers The HTML Comment Tag 120 lt SCRIPT TYPI Chapter 5 ION Script Tag Reference 1 document L lt SCRIPT gt Note E text javascript write Hello World IDL code inside an lt IDL gt lt IDL gt block can also contain comments but IDL comment syntax is used in this case not the HTML comment tag For information on using comments in IDL code see Commenting IDL Code on page 127 The HTML Comment Tag ION guide Chapter 5 ION Script Tag Reference
201. uttons INPUT 129 ION_BUTTON 135 radio 179 C carriage returns 54 case sensitivity 47 116 195 CGI 36 character set 94 characters in URLs 72 73 backslash 128 checkboxes INPUT 129 ION CHECKBOX 138 colors specifying 133 comment tag 119 comments HTML 119 IDL 127 comparison operators 65 compression image 92 CONTAINS operator 64 COPYRIGHT tag 157 curly brackets 116 cursor determining where clicked 59 D data types 187 DATE tag 157 DEBUG attribute ION_DATA_OUT 142 ION_IMAGE 160 ION_OBJECT 174 ION Script User s Guide debugging DEBUG attribute 142 160 single tags 114 troubleshooting 191 using the comment tag 119 declaring variables 44 98 186 189 DEFAULT attribute ION_RADIO 179 DELETE_FILE attribute ION_OBJECT 174 direct graphics 91 159 DISPLAY attribute ION_EVALUATE 149 division operator 64 Document system variable 51 double quotation marks 126 DOUBLE type 44 187 E entity names 94 entity references 94 EQ operator 65 error messages 191 error reporting 104 errors licensing 191 Not Found 191 syntax 25 182 191 troubleshooting 191 undefined procedure function 196 EVENT attribute ION_BUTTON 136 ION_IMAGE 161 ION_LINK 170 EVENT_DECL tag 122 events declaring 122 123 determining name of 52 EVENTS tag 123 examples ION Script 41 exponentiation operator 64 EXPR attribute ION_EVALUATE 54 149 ION Script User s Gui
202. value you assign to a variable is a null string an undefined variable or an expression that cannot be evaluated and the TYPE is STR that variable is defined and the variable s value is ION guide Chapter 3 Variables Expressions amp Operators 47 a null string In the following example the variable A is assigned a null string and the variable B is not declared lt ION_SCRIPT gt lt ION_HEADER gt lt VARIABLES gt lt VARIABLE_DECL NAME A TYPE STR VALUE lt VARIABLES gt lt ION_HEADER gt lt ION_BODY gt lt ION_VARIABLE NAME SA gt ION VARIABLE NAME B gt ION IF EXPR SA ISTYPE UNDEF gt A is undefined ION IF ION IF EXPR SB ISTYPE UNDEF gt B is undefined ION IF ION BODY ION SCRIPT The result of this ION Script page is Error Variable B does not exist B is undefined Variable Names The following rules apply to variable names in ION Script e When referencing the variable or assigning it a value using ION EVALUATE the variable name must be prefixed with the symbol The first character after the symbol must be a letter Subsequent characters can be letters numbers or underscores e Variable names are case sensitive If you declare a variable as A you cannot refer to that variable as a e The variable name cannot be one of the fo
203. values defined for SCALE MIN SCALE MAX and SCALE TOP in the VARIABLE DECL tags When the user enters new values in the form and clicks the button we want to use the values entered by the user rather than the values defined in the VARIABLE DECL tags Therefore we need one set of variables that set the scale values when the page is initially loaded or loaded from a form other than the one containing the entries and another set of variables to set the scale values from the form VARIABLE DECL NAME SCALE MIN VALUE 0 TYPE INT PERSIST TRUE VARIABLE DECL NAME SCALE MAX VALUE 255 TYPE INT PERSIST TRUE VARIABLE DECL NAME SCALE TOP VALUE 255 TYPE INT PERSIST TRUE VARIABLE DECL NAME USER SCALE MIN VALUE S Form USER SCALE MIN TYPE INT VARIABLE DECL NAME USER SCALE MAX VALUE Form USER SCALE MAX TYPE INT VARIABLE DECL NAME USER SCALE TOP VALUE Form USER SCALE TOP TYPE INT 3 When we reload the page ex2 main ion we dlike the values that appear in the form fields to remain the same as the values entered by the user the last time the Scale Colors button was clicked Therefore we don t want to use the hard coded values that ex1 form ion uses Instead we ll use ION VARIABLE to insert the us
204. variable using ION_VARIABLE See Variable Substitution in Attribute Values on page 117 ALIGN For IMAGE fields ALIGN specifies either the position of the image in relation to the left and right borders of the browser or the alignment of text in relation to the image LEFT The image is aligned with the left border of the browser RIGHT The image is aligned with the right border of the browser e TOP Text to the left and right of the image is aligned with the top edge of the image BOTTOM Text to the left and right of the image is aligned with the bottom edge of the image e MIDDLE Text to the left and right of the image is aligned with the vertical midpoint of the image ALT For IMAGE fields ALT specifies the text to be displayed in browsers that do not support images or in browsers that have been set to not display in line images CHECKED Specifies whether a checkbox or radio button is checked or unchecked This attribute is not set to a value it is either included or not included If included the button state is checked MAXLENGTH The maximum number of characters that can be entered in a TEXT or PASSWORD form field NAME The name of the form field This name is used to refer to the value of the form field using the format Form NAME The NAME you specify for form fields cannot begin with ION ION guide Chapter 5 ION Script Tag Reference 131 ION guide ONBLUR The script to e
205. xample of how to use the TARGET attribute ION guide Chapter 5 ION Script Tag Reference 171 VALUEn A value that is passed to the destination page The first VALUEn must be VALUE and subsequent values must be consecutively numbered VALUE corresponds to the value named NAME1 This value can be accessed on the destination page as Form NAME where NAME is the NAMEn attribute corresponding to this value This attribute can contain a variable HTML Mapping The ION_LINK tag is converted to the HTML lt A gt tag EVENT TARGET and VALUEn are used in the construction of the URL specified as the value of the HREF attribute of the A tag Any HTML nested inside the ION LINK ION LINK block is passed to the browser unchanged Example Create two links and pass the value of the clicked link to the destination page By giving each link the same name we can use these links in the same way we use radio buttons Note that the value of the clicked link is accessed using the Form variable pagel ion ION SCRIPT ION HEADER EVENTS EVENT DECL NAME PAGE2 ACTION ion page2 ion EVENTS ION HEADER ION BODY XION LINK EVENT PAGE2 NAME1 Link VALUE1 One gt Link 1 ION LINK BR ION LINK EVENT PAGE2 NAME1 Link VALUE1 Two gt Link 2 ION LINK ION BODY ION SCRIPT
206. xecute when the form field loses focus Focus is lost when the user clicks the mouse outside of the form field or presses the Tab key ONCHANGE The script to execute when the value in the form field changes This event occurs when the form field loses focus but only if the value has changed since the last time the field had focus ONFOCUS The script to execute when the form field receives focus Focus is obtained when the user clicks in or tabs into the form field SIZE The length of a TEXT or PASSWORD field in characters SRC The URL of the image to use for IMAGE form fields TYPE The type of form field Valid values include BUTTON CHECKBOX FILE HIDDEN IMAGE PASSWORD RADIO RESET SUBMIT and TEXT TABINDEX The position of the form field in the Tabbing order The Tabbing order is the order in which fields receive focus when the Tab key is pressed VALUE The value assigned to the form field which can be accessed using Form NAME If this value is numeric and you want to use it in an expression you must declare a new INT or DOUBLE variable assign it the value Form NAME and use the new variable in the expression instead of Form NAME See Using Form Variables in Numeric Expressions on page 54 This attribute applies to the different form elements as follows e For TEXT fields VALUE specifies the text that initially appears in the field e For BUTTON fields VALUE specifies the button label INPUT 13
207. y are not prefixed with the symbol however when they are declared using the VARIABLE_DECL tag Declaring amp Assigning Values ION Script variables can be declared using the lt VARIABLE_DECL gt tag as follows lt VARIABLE_DECL NAME name TYPE type VALUE value PERSIST TRUE gt Declaring a variable allows you to explicitly define the type of data held by the variable and allows you to make the variable persistent Although it is recommended ION Script variables do not need to be declared before they are used Variables can be assigned values equal to the result of an expression using the ION EVALUATE tag as follows ION EVALUATE EXPR Svariable expression gt Variable Types Variables ION Script currently uses four data types DOUBLE Double precision INT Integer e BOOL Boolean e STR String ION Script variables are strongly typed meaning the type of data they hold cannot change once they have been declared or assigned a value Variables are assigned a data type only once if you declare the variable using VARIABLE DECL then you assign the type using the TYPE attribute If you assign a value to the variable using ION EVALUATE then the type assumed by the variable depends on the result of the expression to which it is assigned Reassigning a value to a variable that has already been declared or assigned a value does not change the type of t

Download Pdf Manuals

image

Related Search

Related Contents

Memorex MD6443 CD Player User Manual  Magic maxx.indd  PINHO / PINHO BRAVO  Polaris 9922237 Offroad Vehicle User Manual  ZE500 - Guia do Usuário - Zebra Technologies Corporation  取扱説明書  

Copyright © All rights reserved.
Failed to retrieve file