SiteCash Object



 
The SiteCash object controls the environment of the Payment Module plugin.


Members Table

Remarks
    This object is available through the collection Plugins.

    Note that the path of a file using SiteKiosk objects must be allowed in the
    SiteKiosk configuration (Security -> Access -> URL's With Script Permission)
    if it is not a browser skin file.
Examples
    The following example shows information about the Payment Module plugin of SiteKiosk.

    <html>
    <body>
    <table border="0" bgcolor="#ebebeb" width="600" cellspacing="5"
    cellpadding="5" style="font-family:verdana;font-size:8pt;"
    align="center">
    <tr><td bgcolor="f8f8f8">
    The following example shows information about the
    Payment Module of SiteKiosk. The statusbar contains the
    connection status, name and price of the current
    zone and the current credit. When the link is
    clicked, the credit will be decreased by the
    specified value.
    </td></tr>
    <tr><td style="font-family:verdana;font-size:8pt;">
    <pre>
    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    if (SiteKiosk.Plugins('SiteCash').Enabled)
    {
       pmstatus = "SiteCash plugin is active";
       pmdevices = SiteKiosk.Plugins('SiteCash').Devices.Count;
       pmzone = SiteKiosk.Plugins('SiteCash').ZoneName;
       pmprice = SiteKiosk.Plugins('SiteCash').PricePerHourAsString;
       pmstartbal = SiteKiosk.Plugins('SiteCash').CurrentBalance;
       pmpphas = SiteKiosk.Plugins('SiteCash').PricePerHourAsString;
    }
    else
    {
       pmstatus = "The Payment Module has not been configured";
       pmdevices = "-";
       pmzone = "-";
       pmprice = "-";
       pmstartbal = "-";
       pmpphas = "free";
    }
    document.writeln("Status: " + pmstatus);
    document.writeln("Devices: " + pmdevices);
    mycfm = SiteKiosk.Plugins("SiteCash").CreateCurrencyFormatter();
    if (SiteKiosk.Plugins('SiteCash').Enabled)
    {
       mycur = mycfm.CurrencySymbol;
       myzone = SiteKiosk.Plugins('SiteCash').ZoneName;
    }
    else
    {
       mycur = "";
       myzone = "No zone";
    }
    document.writeln("\n<table border='0' bgcolor='#dbdbdb'><tr>");
    document.writeln("<td width='25'><img border='0'" +
    "name='id_offon' src='" + SiteKiosk.SiteKioskDirectory +
    "skins\\default\\img\\icons\\online.gif'></td>");
    document.writeln("<td width='8'><img border='0' src='" +
    SiteKiosk.SiteKioskDirectory +
    "skins\\default\\img\\icons\\line.gif'></td>");
    document.writeln("<td width='20'><img border='0' src='" +
    SiteKiosk.SiteKioskDirectory +
    "skins\\default\\img\\icons\\world.gif'></td>");
    document.write("<td width='230' style='font-size:11px;'>" +
    "<span id='id_pmzname'>" + myzone + "</span>" +
    " (<span id='id_ph'>" + pmpphas + "</span>)</td>");
    document.writeln("<td width='8'><img border='0' src='" +
    SiteKiosk.SiteKioskDirectory +
    "skins\\default\\img\\icons\\line.gif'></td>");
    document.writeln("<td width='130' style='font-size:11px;'>" +
    "<span id='id_pmbalance'>Credit: " + pmstartbal + "</span>" +
    " " + mycur +" </td>");
    document.write("</tr></table>");
    SiteKiosk.Plugins('SiteCash').OnBalanceChange = OnBalanceChange;
    SiteKiosk.Plugins('SiteCash').OnZoneCrossing = OnZoneCrossing;
    SiteKiosk.Dialup.OnConnect = OnConnCh;
    SiteKiosk.Dialup.OnDisconnect = OnConnCh;
    function OnConnCh()
    {
       if (SiteKiosk.Dialup.ConnectionStatus) id_offon.src =
       SiteKiosk.SiteKioskDirectory +
       "skins\\default\\img\\icons\\online.gif";
       else id_offon.src = SiteKiosk.SiteKioskDirectory +
       "skins\\default\\img\\icons\\offline.gif";
    }
    OnConnCh();
    
    function OnBalanceChange()
    {
       id_pmbalance.innerHTML = "Credit: " +
       SiteKiosk.Plugins('SiteCash').CurrentBalance;
    }
    function OnZoneCrossing()
    {
       id_pmzname.innerHTML = SiteKiosk.Plugins('SiteCash').ZoneName;
       pphas = SiteKiosk.Plugins('SiteCash').PricePerHourAsString;
       id_ph.innerHTML = pphas;
    }
    function OnPullRequestCompleted(success)
    {
       if (success)
       {
            var lk_skwindow = SiteKiosk.SiteKioskUI.CreateBrowserWindow();
            lk_skwindow.SiteKioskWebBrowser.Navigate(id_scurl.value);
    		lk_skwindow.Show();
       }
    }
    function pullmode()
    {
       if (SiteKiosk.Plugins('SiteCash').Enabled)
       {
          if ((id_scinput.value > 0) && (id_scinput.value <= 1000))
          {
             antw = confirm("This costs " + id_scinput.value);
             if (antw) SiteKiosk.Plugins("SiteCash").Script.Dispatch.
             StartPullRequest("Navigation", id_scinput.value, 
             OnPullRequestCompleted, 30);
          }
          else alert("Please enter a value between 0 and 1000");
       }
       else alert("SiteCash plugin has not been configured");
    }
    </SCRIPT>
    <br>
    URL:
    <input name="id_scurl" type="text" value="http://www.yahoo.com"
    style="width:225px;" onfocus="mymerk=value;"
    onblur="if (value == '') value = mymerk;">
    <br>
    Price (in current currency):
    <input name="id_scinput" type="text" maxlength="4" value="1"
    style="width:225px;" onfocus="mymerk=value;"
    onblur="if (value == '') value = mymerk;">
    </pre>
    </td></tr>
    </table>
    <br><br>
    <div align="center">
    <a href="javascript:pullmode()">Open URL</a>
    </div>
    </body>
    </html>
    

Applies to
    SiteKiosk v5.0 (and later versions).

Back to top