152 lines
5.0 KiB
PHP
152 lines
5.0 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: scaffolding_show.asp
|
|
Description: show detailed information of a usrrapx
|
|
|
|
Parameters: usrrap_key (usrrapx id)
|
|
|
|
Context:
|
|
Note:
|
|
|
|
*/ %>
|
|
<%
|
|
function scaffolding_show(model, scf_params)
|
|
{
|
|
scf_params.show = scf_params.show || {};
|
|
|
|
FCLTHeader.Requires({ plugins: ["jQuery"],
|
|
js: ["jquery-ui.js"]
|
|
})
|
|
if ("requires" in scf_params.show)
|
|
FCLTHeader.Requires(scf_params.show.requires);
|
|
|
|
var transit = scf_transit2url(scf_params);
|
|
|
|
var key = getQParamInt("id");
|
|
var xxx_params = { filter: { id: key } };
|
|
var xxx_array = model.REST_GET(xxx_params);
|
|
if (!xxx_array.length)
|
|
shared.record_not_found();
|
|
var xxx_data = xxx_array[0];
|
|
%>
|
|
|
|
<html>
|
|
<head>
|
|
<% FCLTHeader.Generate(); %>
|
|
<script>
|
|
<% if ("name" in xxx_data) { %>
|
|
FcltMgr.setTitle("<%=safe.jsstring(xxx_data.name + ' (' + model.record_title) + ')'%>", {hot:false});
|
|
<% } %>
|
|
|
|
function xxx_change()
|
|
{
|
|
if (FcltMgr.startEdit(window))
|
|
{
|
|
window.location.href = "<%=scf_params.this_fullpath%>?mode=edit&id=<%=key%><%=transit%>";
|
|
}
|
|
}
|
|
|
|
function xxx_delete()
|
|
{
|
|
if (confirm('<%=safe.jsstring(L("lcl_scf_confirm_delete").format(model.record_title, xxx_data.name || xxx_data.id))%>'))
|
|
{
|
|
var data = { key: "<%=key%>"};
|
|
<% protectRequest.dataToken("data"); %>
|
|
$.post("<%=scf_params.this_fullpath%>?mode=delete&id=<%=key%><%=transit%>",
|
|
data,
|
|
FcltCallbackClose,
|
|
"json");
|
|
}
|
|
}
|
|
|
|
function scf_print()
|
|
{
|
|
window.open("<%=scf_params.this_fullpath%>?mode=print&id=<%=key%><%=transit%>");
|
|
}
|
|
</script>
|
|
</head>
|
|
<body id="showbody">
|
|
<% var buttons = [];
|
|
if (scf_params.show.buttons)
|
|
{
|
|
for (var i = 0; i < scf_params.show.buttons.length; i++)
|
|
{ // Als je een action opgeeft *zonder* haakjes voegen we automagisch de key en model toe
|
|
if (scf_params.show.buttons[i].action.indexOf("(") < 0)
|
|
scf_params.show.buttons[i].action += "(" + key + ", '" + model.table + "')"
|
|
buttons.push(scf_params.show.buttons[i]);
|
|
}
|
|
}
|
|
|
|
if (model["REST_PUT"]) // TODO: Eventueel autfunction testen?
|
|
{
|
|
buttons.push({title: L("lcl_change"), action: "xxx_change()", icon: "wijzigen.png" });
|
|
if (model["REST_DELETE"])
|
|
buttons.push({title: L("lcl_delete"), action: "xxx_delete()", icon: "delete.png" });
|
|
}
|
|
// if stylesheet gevonden
|
|
var fso = Server.CreateObject("Scripting.FileSystemObject");
|
|
var xslfile = Server.MapPath(custpath + "/xsl/scf_" + model.table + ".xsl");
|
|
if (model.print.xmlnode || fso.FileExists(xslfile))
|
|
buttons.push({ icon: "print.png", title: L("lcl_print"), action: 'scf_print()' });
|
|
else
|
|
__Log("Geen printknop want {0} is niet gevonden".format(xslfile));
|
|
|
|
if (model.edit.modal|| scf_params.edit && scf_params.edit.modal)
|
|
{ // het is dan vreemd dat we hier zijn. Expliciete showmode
|
|
buttons = []; // zoals fac_usrtab record vanuit materiaal.
|
|
}
|
|
IFRAMER_HEADER(model.record_title, buttons);
|
|
%>
|
|
<div id="show">
|
|
<form name="u2" onSubmit="return false;">
|
|
<%
|
|
var fld_arr = [];
|
|
for (var fld in model.fields)
|
|
{
|
|
var field = model.fields[fld];
|
|
if (!field.hidden_fld)
|
|
fld_arr.push(fld);
|
|
}
|
|
|
|
var col_id = "scf_info";
|
|
var col_1_length = fld_arr.length;
|
|
if (scf_params.multicolumn)
|
|
{
|
|
col_id = "scfInfo";
|
|
col_1_length = ( ((fld_arr.length % 2)==0) ? (fld_arr.length/2) : ((fld_arr.length+1)/2) );
|
|
}
|
|
|
|
var i = 0;
|
|
BLOCK_START(col_id, model.record_title);
|
|
while (i < col_1_length)
|
|
{
|
|
var fld = fld_arr[i];
|
|
scf_ROFIELDTR(model, fld, xxx_data[fld], key);
|
|
i++;
|
|
}
|
|
BLOCK_END();
|
|
|
|
if (scf_params.multicolumn)
|
|
{
|
|
BLOCK_START("scfInfo_F", model.record_title);
|
|
while (i < fld_arr.length)
|
|
{
|
|
var fld = fld_arr[i];
|
|
scf_ROFIELDTR(model, fld, xxx_data[fld], key);
|
|
i++;
|
|
}
|
|
BLOCK_END();
|
|
}
|
|
|
|
|
|
|
|
%>
|
|
</form>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
<%
|
|
}
|
|
%> |