Home -> VRSmarty plugins page -> panologic.swf
This plugin is completely free for use in any context or connection.
panologic.swf
A plugin that makes it possible to apply IF-ELSE logic to your VRSmarty commands. The logic can of course not be written directly in the VRSmarty XML file, but is instead entered in its own file from where it can be executed just as easily with a simple command. Your logic is stored in "functions", and would normally consist of one or several IF-ELSE statements and one or several VRSmarty commands.

The following parameters are supported:

In VRSmarty xml file:
xmlFilexmlFile='myFuncs.xml'plugin control XML file, default=panologic.xml



Plugin attributes:set with spot_id.content.name=value
xmlFilexmlFile='myFuncs.xml'load new plugin XML file
xmlDataxmlData='<?xml...'new plugin XML data as string


Plugin methods: call with spot_id.content.name(value)
exec('func_name')exec('test3')IF-ELSE function call
or
exec('func_name',value)exec('test27',120)call with value, see below



Plugin external xml file:

<panologic> is the top tag
<functions> is the tag inside which all functions have their own tag:
In <function> tag:
namename="test4"function name (used in exec() command)
The function code should be placed inside a <![CDATA[ ... ]]> tag,
because we need to use characters like "<" and "&" that are normally
forbidden in XML. See NOTES below.
In <internet> tag:
urlurl="http://wirestam.com/iptest.html"url for checking Internet availability



Overview

Your pano logic is written in "functions" that you can execute from VRSmarty. Each function can contain as many IF-ELSE statements and VRSmarty commands as you need - there is no limit.

The IF-ELSE statements can be nested in any number of levels, and the expressions to be tested can be grouped with parentheses in any number of levels.

When expressions are evaluated, a numeric compare will be made if at least one of the operands are numeric, else a string compare will be made.

No arithmetic is allowed in expressions.



Allowed operators are:

==equal to
!=not equal to
<less than
<=less than or equal to
>greater than
>=greater than or equal to
~operand1 contains operand2



Logical operators:

&&logical AND operation
||logical OR operation



Operands can be:

numbersex: 123 85.4 -11
stringsex: "images/pano5"
meta operandsex: $pan $panoname $date



Meta operands are used for values that are not fixed, and the plugin has to fetch at the moment when the evaluation takes place - like pan position, date, fullscreen state. They are written in the form "$meta_name" and can be one of the following:

$internetconnected to Internet (true=1, false=0)
$panonamename of loaded pano
$panowidthwidth of loaded pano
$panoheightheight of loaded pano
$panoratiowidth/height of loaded pano
$fullscreencurrent display state (true=1, false=0)
$pancurrent pan value
$tiltcurrent tilt value
$zoomcurrent zoom value
$timecurrent time ("hh:mm")
$datecurrent date ("yymmdd")
$parmparameter value (spot_id.content.exec('func_name',parameter_value)
$javascript:function_namestring value returned from a JavaScript function call
$name.attributehotspot attribute, ex: $image22.alpha



VRSmarty commands to be executed has to be written as:

$command(VRSmarty_commands)
Example: $command(pano.tweenPan=125)



Executing an IF-ELSE statement

When you want to execute your IF-ELSE statement, you do this by calling the function in which you have written it. An example:

Lets say you have two (invisible) hotspots, and when the viewer presses a button you want to show SpotA if he is in fullscreen mode and SpotB if he is not. The button then has an onClick:
onClick="spot_id.content.exec(fulltest)"
In your plugin XML file, you have this function:
   <function name="fulltest">
      <![CDATA[
      if ($fullscreen == 1) {
         $command(SpotA.visible=1)
      }
      else {
         $command(SpotB.visible=1)
      }
      ]]>
   </function>
					



NOTES:

When calling the plugin (example: myspot.content.exec(test7,'abcd'), the value parameter 'abcd' is only necessary if you want to use it in your function. And there the value is represented by the meta operand $parm:
if ($parm == "defg") {...} else {...}


You have to write your "if" statements in the <function> tag inside a CDATA section:

<![CDATA[ ...your_if-else_statement... ]]>
Data inside a CDATA section is ignored by the XML parser, and can therefore contain special characters like "<" and "&".



The format of the "if" statement is quite free - you can write everything on one line, or split it up in several lines. All whitespace (blanks, tabs, newlines) is removed by the plugin when parsing the functions.



Meta operands can also be used in your VRSmarty command string. If you for example want to center your pano on a hotspot with id="xyz", you can use a function like this:

<function name="gospot">
   <![CDATA[ $command(pano.pan=$xyz.pan,3000;pano.tilt=$xyz.tilt,3000) ]]>
</function>
					



To use the Internet connection test you have to include the <internet url="..."> tag in the XML file. The url should point to a very small file that the plugin can load at initialization. If the loading is successful, all tests for Internet connection will result in "true".



Example of a panologic XML file:

<?xml version = '1.0'?>
<panologic>
   <internet url="http://wirestam.com/panos/vrs/panologic/iptest.txt" />
   <functions>
      <function name="tohires">
         <![CDATA[
         if ($Pano1low.visible == "1") { $command(global.showPano1High) }
         if ($Pano2low.visible == "1") { $command(global.showPano2High) }
         if ($Pano3low.visible == "1") { $command(global.showPano3High) }
         ]]>
      </function>
      <function name="tolowres">
         <![CDATA[
         if ($Pano1hi.visible == "1") { $command(global.showPano1Low) }
         if ($Pano2hi.visible == "1") { $command(global.showPano2Low) }
         if ($Pano3hi.visible == "1") { $command(global.showPano3Low) }
         ]]>
      </function>

      <function name="showpano1">
         if ($gohires.visible == "0") { $command(global.showPano1High) }
         else { $command(global.showPano1Low) }
      </function>
      <function name="showpano2">
         if ($gohires.visible == "0") { $command(global.showPano2High) }
         else { $command(global.showPano2Low) }
      </function>
      <function name="showpano3">
         if ($gohires.visible == "0") { $command(global.showPano3High) }
         else { $command(global.showPano3Low) }
      </function>

      <function name="fulltest">
         if ($fullscreen == 1) { $command(global.fullYes) }
         else { $command(global.fullNo) }
      </function>

      <function name="iptest">
         if ($internet == 1) { $command(global.internetYes) }
         else { $command(global.internetNo) }
      </function>
   </functions>
</panologic>
					


Version history:

1.2:
Added "~" operator for testing if a string operand contains a (sub)string.

1.1:
Added xmlData='...' attribute.