<%@language = "javascript" %>
<% /*
     $Revision$
     $Id$
*/
var JSON_Result = true;
%>
<!-- #include file="../Shared/common.inc" -->
<%
user.checkAutorisation("WEB_FACTAB");

protectRequest.validateToken();

var framework = getFParamSafe("framework");
var result = { framework: framework };

var sql = "SELECT ini_setup_date FROM ini_setup WHERE UPPER(ini_setup_name) = " + safe.quoted_sql_upper(framework);
var oRs = Oracle.Execute(sql);
var all_ok = !oRs.EOF;
if (all_ok) {
    all_ok = oRs("ini_setup_date").Value === null;
}
oRs.Close();

user.anything_todo_or_abort(all_ok);

__DoLog("Het " + framework + " framework wordt geïnstalleerd.", "#FFFF44");

var sql = "BEGIN "
        + "  ini." + framework.toLowerCase() + "_ini ();"
        + "  UPDATE ini_setup"
        + "    SET ini_setup_date = SYSDATE"
        + "  WHERE UPPER(ini_setup_name) = " + safe.quoted_sql_upper(framework) + ";"
        // + "EXCEPTION"
        // + "  WHEN OTHERS THEN"
        // + "  NULL;" // Iets van een fac.imp_writelog(error) oid? Voorlopig alleen nog maar de _AiAi
        + "END;";
Oracle.Execute(sql);

result.success = !result.warning;

Response.Write(JSON.stringify(result));
ASPPAGE_END();
%>