Referring to external files
External files are image files, stylesheets, or files containing Javascript that you want to use in the current template. When you write and test a script using UNICOM Intelligence Professional, you might have these files in a different location to where they will be for live interviews. This means that you have to remember to change the references to the files in the template before you activate. A better approach is to name these files in the template using an <mrRef> or <mrSharedRef> tag. The <mrRef> and <mrSharedRef> tags are similar except that the <mrRef> tag is typically used to reference project specific files while the <mrSharedRef> tag is used to reference files that might be shared across projects (like Javascript frameworks used to support custom controls or large media files).
When a template contains an <mrRef> tag and you test your script in UNICOM Intelligence Professional, the interviewing program looks for external files in folders relative to the location of the template. When you activate the project, the <mrRef> locations are prefixed with the image cache URL or, if you are manually copying the files to the web server, with the relative path to the images folder. The interviewing program for live interviews will find the external files without you needing to make any changes to the template.
<mrRef> tag
<mrRef RefType="type" RefPosition="position" attribute="value" ...> [Text] </mrRef>
type
The tag name that you would normally use to reference a file of the current type; for example, a for hyperlinks, img for images, link for stylesheets, and script for JavaScript files.
position
Either head or bottom and indicates that the reference to the file is put in either the <head> section or the closing body tag of the HTML document that the Player creates for the page. You can use the same custom control more than once on a page without having to repeat the reference for each use.
attribute
An attribute that you would normally specify on the type tag, as follows:
Tag
|
Attributes Required
|
<a>
|
src, alt
|
<imageCacheURL>
|
Defines the URL that is used to reference files in the rendered HTML that is sent to the respondent’s browser. For example, <mrRef RefType="imageCacheURL"/> results in the following URL address:
http://<ServerName>/SPSSMR/ImageCache/ImageCache.aspx?Project=<ProjectName>&File=
|
<img>
|
src, alt. id is also beneficial. Other attributes might be included as necessary.
|
<link>
|
rel, type, href
|
<script>
|
type, src
|
value
The value for that attribute.
▪The following keywords are case‑sensitive: mrRefTag, RefType, href, src.
▪Some HTML tags do not support the empty tag format: for example, <script> does not support the <script/> notation, and will not display anything if a tag of this form is read. To avoid this problem, always place some text between the opening and closing <mrRef> tags. If you reference a Javascript program, you can type a description of what the program does.
You can define any number of attributes and values by listing them one after the other, separated by spaces. When the interviewing program reads the <mrRef> tag, it builds an HTML tag by using the information given with <mrRef>. For example, if the <mrRef> tag is:
<mrRef RefType="img" src="logo.jpg" alt="SPSS logo" border="0">Dummy text</mrRef>
the instructions passed to the browser are:
<img src="logo.jpg" alt="SPSS logo" border="0"/>
Similarly:
<mrRef RefType="link" rel="stylesheet" type="text/css" Standard2.css">Dummy text</mrRef>
becomes:
<link Standard2.css" rel="stylesheet" type="text/css"></link>
<mrSharedRef> tag
The <mrSharedRef> tag provides similar functions as the <mrRef> tag, but locations used in <mrSharedRef> are based on a global location.
▪For Web/CATI Survey and UNICOM Intelligence Author Server Edition:
[FMRoot]\Shared\Content
▪For UNICOM Intelligence Interviewer - Offline for Windows, UNICOM Intelligence Author, and UNICOM Intelligence Professional:
[INSTALL_FOLDER]\IBM\SPSS\DataCollection\<version>\SharedContent
Desktop products, such as UNICOM Intelligence Interviewer - Offline for Windows, UNICOM Intelligence Author, and UNICOM Intelligence Professional, use this location as a prefix when referencing files specified in <mrSharedRef>. For example,
<mrSharedRef RefPosition="head" RefType="script" type="text/javascript" src="Dojo//dojo/dojo.js" djConfig="parseOnLoad: true">
Dojo script</mrSharedRef>
is rendered in UNICOM Intelligence Professional as:
<script type="text/javascript" src="C:\Documents and Settings\All Users\Application Data\IBM\SPSS\DataCollection\7\
SharedContent/Dojo/dojo/dojo.js" djConfig="parseOnLoad: true">Dojo script</script>
For server products, such as UNICOM Intelligence Interviewer - Server and UNICOM Intelligence Author Server Edition, the same tag might be rendered and loaded from the shared content area using the ImageCache. For example:
<script type="text/javascript" src="Images/Dojo/dojo/dojo.js" djConfig="parseOnLoad: true">Dojo script</script>
In addition, when referring to JavaScript frameworks like Dojo, you can update the examples to use hard-coded links from a content delivery network. For example:
< script type="text/javascript"
src=" http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
jQuery HTML control example
The jQuery HTML Control example demonstrates HTML controls built with the jQuery JavaScript library.
For information on installing jQuery, see Readme.htm file that is installed with the UNICOM Intelligence Developer Documentation Library at [INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\Interview\HTML Controls\jQuery.
See also