FSN#33521 Rapporten verder configureren
svn path=/Website/trunk/; revision=26004
This commit is contained in:
@@ -454,11 +454,15 @@ api2 = {
|
||||
// Zorg dat de parent_key niet genoemd wordt bij de children. Dat is redundant
|
||||
if (inc.joinfield in inc.model.fields)
|
||||
inc.model.fields[inc.joinfield].hidden = true;
|
||||
|
||||
var incquery = api2.sqlfields(params, inc.model);
|
||||
|
||||
selects = selects.concat (incquery.selects);
|
||||
tables = tables.concat (incquery.tables);
|
||||
wheres = wheres.concat (incquery.wheres);
|
||||
if (inc.model.soft_delete) // Bij includes tonen we *nooit* verwijderde records
|
||||
wheres.push(inc.model.soft_delete + " IS NULL");
|
||||
|
||||
if (inc.joinfunction)
|
||||
{
|
||||
var where = inc.joinfunction(params);
|
||||
@@ -1266,6 +1270,13 @@ function generic_REST_DELETE(model, gparams)
|
||||
}
|
||||
}
|
||||
|
||||
// Algemene normalizing
|
||||
function def(hash, fld, val)
|
||||
{
|
||||
if (!(fld in hash))
|
||||
hash[fld] = val;
|
||||
}
|
||||
|
||||
// Backwards compatible FACMGT_LCL
|
||||
var __F = [];
|
||||
function F(tekst)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="api2.inc" -->
|
||||
<!-- #include file="../scf/scaffolding_common.inc" -->
|
||||
<%
|
||||
|
||||
api2_rest = {
|
||||
|
||||
@@ -27,6 +27,17 @@ function model_reports_template()
|
||||
|
||||
this.REST_GET = function _GET(params)
|
||||
{
|
||||
// Als parameters niet in de url zijn meegegeven is waarschijnlijk rechtstreeks de list
|
||||
// aangeroepen. Pak dan de geconfigureerde defaults
|
||||
def(params.filter, "scf_pivot", (this.list.autoPivot & 1)?1:0);
|
||||
def(params.filter, "scf_graph", (this.list.autoGraph & 2) == 2?"on":"");
|
||||
|
||||
if (!params.columns)
|
||||
{
|
||||
params.columns = this.list.columns;
|
||||
params.groupby = this.list.groupby;
|
||||
}
|
||||
|
||||
var groupbys = [];
|
||||
var hasAggregate = false; // Als er uitsluitend GROUP BY is zonder ook maar een enkele
|
||||
// aggregate functie zouden effectief dubbelen verwijderd worden.
|
||||
@@ -205,7 +216,7 @@ function model_reports_template()
|
||||
|
||||
var maxcnt = params.filter.showall==1?S("qp_maxrows2"):S("qp_maxrows");
|
||||
var sql = "SELECT * FROM (" + sql + ")"
|
||||
+ (params.filter.nolimit ? "" : " WHERE ROWNUM <= " + (maxcnt+1)); // Eentje extra om overflow-melding te triggeren in resultsettable
|
||||
+ ((params.filter.nolimit || params.filter.scf_pivot == 1)? "" : " WHERE ROWNUM <= " + (maxcnt+1)); // Eentje extra om overflow-melding te triggeren in resultsettable
|
||||
|
||||
for (var fld in this.fields)
|
||||
{ // Overrules voor groeperingen
|
||||
@@ -276,8 +287,7 @@ function model_reports_template()
|
||||
if (params.filter["scf_graph"] != "on" && (this.fields[datacol].typ == 'number' || this.fields[datacol].typ == 'float'))
|
||||
params.columns.push(datacol);
|
||||
|
||||
if (this.total_count == json.length)
|
||||
this.total_count = newdata.length;
|
||||
this.total_count = newdata.length;
|
||||
json = newdata;
|
||||
}
|
||||
|
||||
@@ -295,16 +305,23 @@ function model_reports_template()
|
||||
for (var fld in this.fields)
|
||||
{
|
||||
var field = this.fields[fld];
|
||||
if (field.filterdefault && field.filterdefault.substr(0,2) == ':!') // Filter/fixed?
|
||||
if (!field.filterdefault)
|
||||
continue;
|
||||
|
||||
var fixed = field.filterdefault.substr(0,2) == ':!';
|
||||
if (!(fld in filter) || fixed) // Filter/fixed?
|
||||
{
|
||||
var defs = scf.parseDefault(field.filterdefault, field);
|
||||
if (field.filter == 'like' || field.filter == 'exact' || !("filter" in field))
|
||||
{
|
||||
filter[fld] = defs.vmin;
|
||||
if (fixed || !(fld in filter))
|
||||
filter[fld] = defs.vmin;
|
||||
}
|
||||
else if (field.filter == "range")
|
||||
{
|
||||
filter["start_" + fld] = defs.vmin;
|
||||
if (fixed || !("start_" + fld in filter))
|
||||
filter["start_" + fld] = defs.vmin;
|
||||
if (fixed || !("end_" + fld in filter))
|
||||
filter["end_" + fld] = defs.vmax;
|
||||
}
|
||||
}
|
||||
@@ -408,7 +425,7 @@ function model_reports(fac_usrrap_key)
|
||||
model.records_title = usrrap.name;
|
||||
model.autorefresh = usrrap.autorefresh;
|
||||
model.styling = usrrap.styling;
|
||||
model.list = { columns : [], canGroup: true, canCSV: true, autoCount: usrrap.count.id, autoPivot: usrrap.pivot.id, autoGraph: usrrap.graph.id };
|
||||
model.list = { columns : [], groupby : [], canGroup: true, canCSV: true, autoCount: usrrap.count.id, autoPivot: usrrap.pivot.id, autoGraph: usrrap.graph.id };
|
||||
if (model.styling && (model.styling.id & 1))
|
||||
model.list.fixedColumns = true;
|
||||
model.search.title = L("lcl_usrrap_report") + " " + usrrap.name;
|
||||
@@ -486,11 +503,20 @@ function model_reports(fac_usrrap_key)
|
||||
fld = "id";
|
||||
model.fields[fld] = field;
|
||||
if (usrrap.columns[i].visible.id == 'V')
|
||||
{
|
||||
model.list.columns.push(fld);
|
||||
|
||||
model.list.groupby.push(field.group.id);
|
||||
}
|
||||
if (usrrap.columns[i].filter)
|
||||
model.search.filters.push(fld);
|
||||
}
|
||||
|
||||
if ((model.list.autoCount & 2) == 2)
|
||||
{
|
||||
model.list.columns.push("scf_count");
|
||||
model.list.groupby.push("");
|
||||
}
|
||||
|
||||
__Log(model);
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -55,46 +55,6 @@
|
||||
if ("estimated_rows" in rapport && rapport.estimated_rows < 250)
|
||||
params.search.autosearch = true;
|
||||
|
||||
// Algemene normalizing
|
||||
function def(hash, fld, val)
|
||||
{
|
||||
if (!(fld in hash))
|
||||
hash[fld] = val;
|
||||
}
|
||||
|
||||
if (mode == "list")
|
||||
{
|
||||
params.filter = shared.qs2json();
|
||||
def(params.filter, "scf_pivot", (rapport.list.autoPivot & 1)?1:0);
|
||||
def(params.filter, "scf_graph", (rapport.list.autoGraph & 2) == 2?"on":"");
|
||||
|
||||
for (var fld in rapport.fields)
|
||||
{
|
||||
var field = rapport.fields[fld];
|
||||
var defs = scf.parseDefault(field.filterdefault, field);
|
||||
if (field.filter == 'like' || field.filter == 'exact' || !("filter" in field))
|
||||
{
|
||||
def(params.filter, fld, defs.vmin);
|
||||
}
|
||||
else if (field.filter == "range")
|
||||
{
|
||||
def(params.filter, "start_" + fld, defs.vmin);
|
||||
def(params.filter, "start_" + fld, defs.vmax);
|
||||
}
|
||||
}
|
||||
if (!params.list)
|
||||
{
|
||||
params.list = {};
|
||||
params.list.columns = "mld_melding_datum,ins_srtdiscipline_omschrijving".split(",");
|
||||
params.list.groups = "Y,".split(",");
|
||||
if ((rapport.list.autoCount & 2) == 2)
|
||||
{
|
||||
params.list.columns.push("scf_count");
|
||||
params.list.groups.push("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rapport.styling && (rapport.styling.id & 1)) // XSL proc doen we niet via resultsettable
|
||||
{
|
||||
rapport.list.canGraph = false;
|
||||
@@ -168,7 +128,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mode == "list" && params.filter["scf_graph"] == "on")
|
||||
if (mode == "list" && (getQParam("scf_graph", "") == "on" || (rapport.list.autoGraph & 2) == 2))
|
||||
{
|
||||
FCLTHeader.Requires({plugins: ["jQuery"],
|
||||
js: ["../Localscripts/jqPlot/dist/excanvas.js",
|
||||
@@ -197,6 +157,7 @@ function fac_usrrap_list_graph (model, scf_params)
|
||||
{
|
||||
scf_params.list = scf_params.list || {};
|
||||
scf_params.list.columns = scf_params.list.columns || [];
|
||||
scf_params.list.groupby = scf_params.list.groupby || [];
|
||||
|
||||
var transit = "";
|
||||
if ("transit" in scf_params)
|
||||
@@ -206,14 +167,17 @@ function fac_usrrap_list_graph (model, scf_params)
|
||||
if (cols.length && cols[0])
|
||||
scf_params.list.columns = cols;
|
||||
|
||||
var grps = getQParamArray("groups", []);
|
||||
var grps = getQParamArray("groupby", []);
|
||||
if (grps.length)
|
||||
scf_params.list.groups = grps;
|
||||
scf_params.list.groupby = grps;
|
||||
|
||||
if (!scf_params.list.columns.length && "list" in model)
|
||||
{
|
||||
scf_params.list.columns = model.list.columns;
|
||||
scf_params.list.groupby = model.list.groupby;
|
||||
}
|
||||
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groupby };
|
||||
var xxx_array = model.REST_GET(xxx_params);
|
||||
|
||||
graphData = { teller: xxx_array.length
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
var usrrap_key = getQParamInt("usrrap_key", -1);
|
||||
if (mode == "list" && usrrap_key > 0)
|
||||
{
|
||||
// Let op: mobile zijn we nog veel strengen dan volledige 3D autorisatie!
|
||||
// Let op: mobile zijn we nog veel strenger dan volledige 3D autorisatie!
|
||||
params.filter.fclt_3d_locatie_key = user.alg_locatie_key({withcurrent:true});
|
||||
params.filter.fclt_3d_gebouw_key = user.alg_gebouw_key({withcurrent:true});
|
||||
|
||||
|
||||
@@ -73,11 +73,6 @@ function scaffolding(model, scf_params)
|
||||
scf_params.this_path = scf_params.this_fullpath.substring(rooturl.length + 1);
|
||||
|
||||
// Algemene normalizing
|
||||
function def(hash, fld, val)
|
||||
{
|
||||
if (!(fld in hash))
|
||||
hash[fld] = val;
|
||||
}
|
||||
def(model, "record_title", model.record_name);
|
||||
def(model, "records_title", model.records_name);
|
||||
for (var fld in model.fields)
|
||||
|
||||
@@ -15,6 +15,7 @@ function scaffolding_list(model, scf_params)
|
||||
{
|
||||
scf_params.list = scf_params.list || {};
|
||||
scf_params.list.columns = scf_params.list.columns || [];
|
||||
scf_params.list.groupby = scf_params.list.groupby || [];
|
||||
|
||||
var transit = "";
|
||||
if ("transit" in scf_params)
|
||||
@@ -24,12 +25,15 @@ function scaffolding_list(model, scf_params)
|
||||
if (cols.length && cols[0])
|
||||
scf_params.list.columns = cols;
|
||||
|
||||
var grps = getQParamArray("groups", []);
|
||||
var grps = getQParamArray("groupby", []);
|
||||
if (grps.length)
|
||||
scf_params.list.groups = grps;
|
||||
scf_params.list.groupby = grps;
|
||||
|
||||
if (!scf_params.list.columns.length && "list" in model)
|
||||
{
|
||||
scf_params.list.columns = model.list.columns;
|
||||
scf_params.list.groupby = model.list.groupby;
|
||||
}
|
||||
|
||||
var modal = model.edit.modal; // dan doen we een detailrecord altijd modal
|
||||
|
||||
@@ -129,7 +133,7 @@ function scaffolding_list(model, scf_params)
|
||||
buttons.push({ icon: "plus.png", title: L("lcl_add"), action: "scf_add()" });
|
||||
}
|
||||
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groupby };
|
||||
|
||||
if (!("limit" in xxx_params.filter))
|
||||
{
|
||||
|
||||
@@ -63,11 +63,6 @@ function scaffolding(model, scf_params)
|
||||
scf_params.this_path = scf_params.this_fullpath.substring(rooturl.length + 1);
|
||||
|
||||
// Algemene normalizing
|
||||
function def(hash, fld, val)
|
||||
{
|
||||
if (!(fld in hash))
|
||||
hash[fld] = val;
|
||||
}
|
||||
def(model, "record_title", model.record_name);
|
||||
def(model, "records_title", model.records_name);
|
||||
for (var fld in model.fields)
|
||||
|
||||
@@ -15,6 +15,7 @@ function scaffolding_m_list(model, scf_params)
|
||||
{
|
||||
scf_params.list = scf_params.list || {};
|
||||
scf_params.list.columns = scf_params.list.columns || [];
|
||||
scf_params.list.groupby = scf_params.list.groupby || [];
|
||||
|
||||
var transit = "";
|
||||
if ("transit" in scf_params)
|
||||
@@ -24,14 +25,15 @@ function scaffolding_m_list(model, scf_params)
|
||||
if (cols.length && cols[0])
|
||||
scf_params.list.columns = cols;
|
||||
|
||||
var grps = getQParamArray("groups", []);
|
||||
var grps = getQParamArray("groupby", []);
|
||||
if (grps.length)
|
||||
scf_params.list.groups = grps;
|
||||
scf_params.list.groupby = grps;
|
||||
|
||||
if (!scf_params.list.columns.length && "list" in model)
|
||||
{
|
||||
scf_params.list.columns = model.list.columns;
|
||||
|
||||
var modal = model.edit.modal; // dan doen we een detailrecord altijd modal
|
||||
scf_params.list.groupby = model.list.groupby;
|
||||
}
|
||||
|
||||
FCLTHeader.Requires({js: []});
|
||||
|
||||
@@ -71,7 +73,7 @@ function scaffolding_m_list(model, scf_params)
|
||||
buttons.push({ icon: "plus.png", title: L("lcl_add"), action: "FcltMgr.openDetail('" + addurl + "', '" + L("lcl_add") + " " + model.record_title + "')" });
|
||||
}
|
||||
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groupby };
|
||||
var xxx_array = model.REST_GET(xxx_params);
|
||||
|
||||
function fnHeader(oRs)
|
||||
|
||||
@@ -113,7 +113,7 @@ function scaffolding_search(model, scf_params)
|
||||
}
|
||||
);
|
||||
$("#columns").val(cols.join(","));
|
||||
$("#groups").val(groups.join(","));
|
||||
$("#groupby").val(groups.join(","));
|
||||
|
||||
$("#scf_pivot").val($("#chk_pivot").prop("checked")?1:0);
|
||||
|
||||
@@ -131,7 +131,7 @@ function scaffolding_search(model, scf_params)
|
||||
<form name="u2" method="get" target="workFrame" onsubmit="doSubmit()">
|
||||
<input type='hidden' name='mode' value='list'>
|
||||
<input type='hidden' name='columns' id='columns'>
|
||||
<input type='hidden' name='groups' id='groups'>
|
||||
<input type='hidden' name='groupby' id='groupby'>
|
||||
<input type='hidden' name='scf_pivot' id='scf_pivot' value='<%=(model.list.autoPivot&1)?1:0%>'>
|
||||
<%
|
||||
var defaults = shared.qs2json(); // TODO: Ook via scf_params
|
||||
|
||||
Reference in New Issue
Block a user