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

     File:               get_apinames.asp
     Description:        Levert de bestanden in in de aangegeven map staan op de server.
     Parameters:
         -               -
*/
%>

<%
ANONYMOUS_Allowed = 1;
var JSON_Result = true;
%>

<!-- #include file="../../Shared/json2.js" -->

<%
/***** Get webform parameters *****/
//var searchfolder = getQParam("folder", "appl/api2");
// Geen autorisatie check nodig
/***** End get webform parameters *****/
//var fullpath = (Server.MapPath(searchfolder));
var fullpath = Server.MapPath("../");
var api2_names = [];

var objFso = new ActiveXObject("Scripting.FileSystemObject");
var objFiles = objFso.GetFolder(fullpath);
var allFiles = new Enumerator(objFiles.files);
for (; !allFiles.atEnd(); allFiles.moveNext())
{
    var attFile = allFiles.item();

    var ext = objFso.GetExtensionName(attFile);
    if ((attFile.name.indexOf("api_") == 0) && (ext == "asp"))
    {
        var name = attFile.name.substring(4, attFile.name.indexOf(".asp"))
        api2_names.push(name);
    }

}
api2_names.sort();
var result = { success: true
             , apinames: api2_names
             };
Response.Write(JSON.stringify(result));
%>
