Files
Facilitor/APPL/FAC/fac_edit_api.asp
Jos Groot Lipman e774a40b51 MARX#82611 Is het mogelijk om bij verwerkingsfout een HTTP4xx code wordt teruggestuurd
svn path=/Website/trunk/; revision=64855
2024-05-28 14:52:57 +00:00

151 lines
5.1 KiB
Plaintext

<%@ language="javascript"%>
<% /*
$Revision$
$Id$
File: fac_api.asp
Description:
Parameters: api_key
*/
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/rapportselector.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="fac.inc" -->
<%
FCLTHeader.Requires({ plugins:["jQuery"] })
var api_key = getQParamInt("api_key", -1);
var hasFACFAC = user.checkAutorisation("WEB_FACFAC");
var api_name;
var api_omschrijving;
var api_apikey;
var api_filepath;
var api_loglevel;
var api_errorhandling;
var usrrap_key;
var api_viewmapping_json;
var api_stylesheet;
var api_options_json;
var api_xmlnode;
function prettyJson(j)
{
try
{
var xx = JSON.stringify(JSON.parse(j), null, 2);
if (xx == "null")
return "";
return xx;
}
catch (e)
{
return j;
};
};
if (api_key > 0)
{
var sql = "SELECT * FROM fac_api a"
+ " WHERE fac_api_key =" + api_key;
var oRs = Oracle.Execute(sql);
var api_name = oRs("fac_api_name").Value;
var api_omschrijving = oRs("fac_api_omschrijving").Value;
var api_filepath = oRs("fac_api_filepath").Value;
var api_loglevel = oRs("fac_api_loglevel").Value;
var api_errorhandling = oRs("fac_api_errorhandling").Value;
var usrrap_key = oRs("fac_usrrap_key").Value;
var api_viewmapping_json = prettyJson(oRs("fac_api_viewmapping_json").Value);
var api_stylesheet = oRs("fac_api_stylesheet").Value;
var api_stylesheet_out = oRs("fac_api_stylesheet_out").Value;
var api_options_json = prettyJson(oRs("fac_api_options_json").Value);
oRs.Close();
}
else
{
var api_errorhandling = 1; // default 400 on error
}
%>
<html>
<head>
<% FCLTHeader.Generate(); %>
<script type="text/javascript" >
$(function()
{
$('textarea').resize(function () { FcltMgr.resized(window) } );
$('textarea').autogrow();
});
function api_submit_callback(json)
{
window.location.href = "fac_show_api.asp?api_key=" + json.api_key;
}
async function doSubmit()
{
document.activeElement.blur(); // trigger laatste onChanges
// Standaard checks op verplichte velden, datum formaat, numeriek en float formaat, currency formaat.
if (!await validateForm("u2"))
return false;
$.post($("form[name=u2]")[0].action, $("[name=u2]").serialize(), FcltCallbackAndThen(api_submit_callback), "json");
}
function doCancel()
{
FcltMgr.closeDetail(window, { cancel: true } );
}
</script>
</head>
<body class="editmode">
<%
SUBFRAME_START();
var buttons = []
buttons.push ({title: L("lcl_submit"), icon: "fa-fclt-save", action: "doSubmit()" });
buttons.push( {title: L("lcl_cancel"), icon: "fa-fclt-cancel", action: "doCancel()" } );
IFRAMER_HEADER("Setting", buttons);
%>
<form name=u2
method="post"
action="fac_edit_api_save.asp?api_key=<%=api_key%>"
onSubmit="doSubmit();">
<%
BLOCK_START("apiSample", L("lcl_fac_api"), { "icon": "fa-network-wired" });
RWFIELDTR("fac_api_name", "fld required", L("lcl_fac_api_name") , api_name, {maxlength: 32});
RWFIELDTR("fac_api_omschrijving", "fld", L("lcl_fac_api_omschrijving"), api_omschrijving, {maxlength: 60});
RWFIELDTR("fac_api_filepath", "fld required", L("lcl_fac_api_filepath") , api_filepath, {maxlength: 64});
RWFIELDTR("fac_api_loglevel", "fld", L("lcl_fac_api_loglevel") , api_loglevel);
var sql = " SELECT 0, " + safe.qL("lcl_fac_api_errorhandling0") + " FROM DUAL"
+ " UNION ALL SELECT 1, " + safe.qL("lcl_fac_api_errorhandling1") + " FROM DUAL";
FCLTselector("fac_api_errorhandling", sql,
{ initKey: api_errorhandling,
label: L("lcl_fac_api_errorhandling")
});
FCLTrapportselector("fac_usrrap_key"
,"sgRapport"
,{ label: L("lcl_fac_api_usrrap")
, rapportKey: usrrap_key
, readonly: false
});
RWTEXTAREATR("fac_api_viewmapping_json", "fldtxt", L("lcl_fac_api_viewmapping") , api_viewmapping_json, {maxlength: 4000, no_bb_codes: true});
RWFIELDTR("fac_api_stylesheet", "fld", L("lcl_fac_api_stylesheet") , api_stylesheet, {maxlength: 64});
RWFIELDTR("fac_api_stylesheet_out", "fld", L("lcl_fac_api_stylesheet_out"), api_stylesheet_out, {maxlength: 64});
RWTEXTAREATR("fac_api_options_json", "fldtxt", L("lcl_fac_api_options") , api_options_json, {maxlength: 4000, no_bb_codes: true});
BLOCK_END();
IFACE.FORM_END();
%>
</form>
<% SUBFRAME_END(); %>
</body>
</html>
<% ASPPAGE_END(); %>