<% /*
     $Revision$
     $Id$
*/

var bdr_templates = {
    "basic":
        {
            "name": L("lcl_prs_bedrijfadres_template_basic"),
            "hidefields": "attachfile,lockuser,locksecret,lockexpire,ordermode,soapaction,sender,replyaddress,extension,certificate",
            "licensed": true
        },
    "generic": // (old style, database default)
        {
            "name": L("lcl_prs_bedrijfadres_template_generic"),
            "licensed": true
        }
};

var licensed_templates = S("licensed_templates").split(",");

function scantemplates(folder)
{
    var f = fso.GetFolder(folder);
    var fc = new Enumerator(f.files);

    for (; !fc.atEnd(); fc.moveNext())
    {
        var fsoFile = fc.item();
        var filename = fsoFile.Name;
        if (filename.match(/\.template$/i))
        {
            var template = filename.replace(/\.template$/, "");
            bdr_templates[template] = shared.readJSONfile(folder + "/" + filename);
            var tpl = bdr_templates[template];
            tpl.licensed = true;
            if (!(inArray(template, licensed_templates)))
            {
                tpl.licensed = false;
                tpl.name = L("lcl_prs_bedrijfadres_template_unlicensed").format(tpl.name);
            }
        }
    }
}

scantemplates(Server.MapPath("../exp"));
%>
