104 lines
3.9 KiB
PHP
104 lines
3.9 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: scaffolding_list.asp
|
|
|
|
Description: Toont een lijst
|
|
Parameters:
|
|
Context: Vanuit scaffolding.inc
|
|
Note: model variabele is globaal beschikbaar
|
|
*/
|
|
%>
|
|
<%
|
|
function scaffolding_list(model, scf_params)
|
|
{
|
|
scf_params.list = scf_params.list || {};
|
|
scf_params.list.columns = scf_params.list.columns || [];
|
|
|
|
var transit = "";
|
|
if ("transit" in scf_params)
|
|
transit = "&" + scf_params.transit.name + "=" + safe.url(scf_params.transit.val);
|
|
|
|
var cols = getQParamArray("columns", []);
|
|
if (cols.length && cols[0])
|
|
scf_params.list.columns = cols;
|
|
|
|
var grps = getQParamArray("groups", []);
|
|
if (grps.length && grps[0])
|
|
scf_params.list.groups = grps;
|
|
|
|
if (!scf_params.list.columns.length && "list" in model)
|
|
scf_params.list.columns = model.list.columns;
|
|
|
|
var modal = (model.parent_key != null); // dan doen we een detailrecord altijd modal
|
|
|
|
FCLTHeader.Requires({js: []});
|
|
|
|
var authparams = user.checkAutorisation(model.autfunction);
|
|
var showall = getQParamInt("showall", 0) == 1;
|
|
var outputmode = getQParamInt("outputmode", 0)
|
|
%>
|
|
<html>
|
|
<head>
|
|
<% FCLTHeader.Generate({ outputmode: outputmode }); %>
|
|
<script>
|
|
function scf_show(row)
|
|
{
|
|
var key = row.getAttribute("ROWKEY");
|
|
<% if (modal) { %>
|
|
var url = "<%=scf_params.this_fullpath%>?mode=edit<%=transit%>&id=" + key;
|
|
FcltMgr.openModalDetail(url, "<%=safe.jsstring(model.record_name)%>", { callback: FcltMgr.reload });
|
|
<% } else { %>
|
|
$(row).addClass('dirty');
|
|
var url = "<%=scf_params.this_path%>?mode=wrap<%=transit%>&id=" + key;
|
|
FcltMgr.openDetail(url, "<%=safe.jsstring(model.record_name)%>");
|
|
<% } %>
|
|
}
|
|
</script>
|
|
</head>
|
|
<body id="listbody">
|
|
<%
|
|
buttons = [];
|
|
buttons.push({ icon: "page_refresh.png", title: L("lcl_refresh"), action: "FcltMgr.reload()" });
|
|
if (model["REST_POST"] && authparams.PRSwritelevel < 9 && authparams.ALGwritelevel < 9)
|
|
{
|
|
var addurl = scf_params.this_path + "?mode=edit" + transit;
|
|
buttons.push({ icon: "plus.png", title: L("lcl_add"), action: "FcltMgr.openDetail('" + addurl + "', '" + L("lcl_add") + " " + model.record_name + "')" });
|
|
}
|
|
|
|
var xxx_params = { filter : scf_params.filter || api2.qs2json(), columns: cols, groupby: grps };
|
|
|
|
var xxx_array = model.REST_GET(xxx_params);
|
|
var rst = new ResultsetTable({ dataset: xxx_array,
|
|
keyColumn: "id",
|
|
ID: model.table,
|
|
title: model.records_title || model.records_name,
|
|
showAll: showall,
|
|
outputmode: outputmode,
|
|
buttons: buttons
|
|
});
|
|
|
|
for (i in scf_params.list.columns)
|
|
{
|
|
var fld = scf_params.list.columns[i];
|
|
if (!(fld in model.fields)) // Tijdens ontwikkeling vaak fout
|
|
{
|
|
__DoLogj(model.fields);
|
|
__DoLogj(scf_params.list.columns);
|
|
abort_with_warning("Field '{0}' not found in model '{1}'".format(fld, model.table));
|
|
}
|
|
var field = model.fields[fld];
|
|
rst.addColumn(new Column({ caption: field.label || fld, content: fld, datatype: field.typ }));
|
|
}
|
|
|
|
if (model["REST_PUT"])
|
|
rst.addAction({ action: "scf_show", caption: L("lcl_edit"), isDefault: true } );
|
|
|
|
var cnt = rst.processResultset();
|
|
%>
|
|
</body>
|
|
</html>
|
|
<%
|
|
}
|
|
%> |