<%@language = "javascript" %>
<% /*
    $Revision$
    $Id$

    File:           shared/qrcode.asp
    Parameters:
        text        De text
        -- optioneel --
        version     -1 is auto of 1-40
        autoextend  1 is ja, 0 is nee
        level       error level 0=7%, 1=15%, 2=25%, 3=30%
        masking     masking algoritme -1 is auto of 0 to 7
        size        pixels/module, default 8
        color       Color, default  S("qr_color")
        bggraycolor 0-255, default S("qr_bggray_color") (255, white)
*/ %>

<%
DOCTYPE_Disable = true;
if (getQParamInt("nocache", 0) != 1) {
  var FCLTEXPIRES = 8*60; // 8 uur kan al flink schelen
}
%>
<!-- #include file="../Shared/common.inc" -->
<%
var xc = Server.CreateObject("SLNKDWF.QRCode");
var proto = (Request.ServerVariables("SERVER_PORT") == "443")?"https":"http";
var sitenoroot = proto + "://" + Request.ServerVariables("SERVER_NAME");
var site = sitenoroot + rooturl;
// url must start with forward slash (/)
xc.text       = getQParam("text");
if (xc.text.charAt(0) == "\/")
{
  xc.text       = site + xc.text;
}
else if (xc.text.indexOf(".") > -1)
{
  INTERNAL_ERROR_PARAMETER_text_IS_BAD;
}

xc.Version    = getQParamInt("version", -1);
xc.Autoextend = getQParamInt("autoextend", 1)==1;
xc.Level      = getQParamInt("level", 1);
xc.Masking    = getQParamInt("masking", -1);
xc.Size       = getQParamInt("size", 8);
xc.Color      = getQParamInt("color", S("qr_color"));
var oAbout = new ActiveXObject("SLNKDWF.About");
if (oAbout.VersionString >= "4,41")
{
  xc.BgGrayColor = getQParamInt("bggraycolor", S("qr_bggray_color")); // Grayscale 0-255
}
//xc.Logo       = getQParamInt("logo", "FACILITOR");
//xc.LogoSize   = getQParamInt("logosize", 0);

// unsafe Response.AddHeader("QRCode",xc.Text);

Response.clear;
Response.contenttype = "image/png";
Response.BinaryWrite(xc.GetAsPNG());
%><% ASPPAGE_END(); %>
