67 lines
2.3 KiB
PHP
67 lines
2.3 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_apis.inc
|
|
|
|
Description: Api model.
|
|
Parameters:
|
|
Context:
|
|
|
|
Notes:
|
|
*/
|
|
|
|
%>
|
|
<!--#include file="./api2_dispatch.inc"-->
|
|
<%
|
|
model_apis =
|
|
{
|
|
table: "apis",
|
|
primary: "id",
|
|
records_name: "apis",
|
|
record_name: "api",
|
|
fields : { "id" : { typ: "varchar", label: "Api", filter: "exact" },
|
|
"module" : { typ: "varchar", label: "Module", filter: "exact" },
|
|
"name" : { typ: "varchar", label: "Api", filter: "exact" }
|
|
},
|
|
|
|
REST_GET: function _GET(params)
|
|
{
|
|
var autfunction = "WEB_APIDOC"; // is dit niet erg streng?
|
|
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
|
|
|
var api2_names = [];
|
|
for (var dispatch in api2_mapper)
|
|
{
|
|
var module = api2_mapper[dispatch].substr(9, 3).toUpperCase();
|
|
// TODO: kijken of er een L() bestaat voor de api2_mapper filenaam
|
|
api2_names.push({ id: dispatch, name: dispatch, modulecode: module, module: L("lcl_module_" + module) });
|
|
}
|
|
|
|
var fullpath = Server.MapPath("./appl/api2");
|
|
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({ id: name, name: name });
|
|
}
|
|
// Graag zou ik er ook info instoppen over het model zelf.
|
|
// Dan moet ik echter alle model_xxxx.inc bestanden includen wat ik niet wil.
|
|
// Daarom moet je zelf maar /api2/xxxx.api aanroepen voor de details
|
|
}
|
|
|
|
return api2_names;
|
|
},
|
|
|
|
search: { autosearch: true },
|
|
list: { default_url: "api2/{0}.scf" }
|
|
// list: { default_url: "api2/{0}.api?pretty=1" }
|
|
}
|
|
%> |