FSN#33635 Scaffolding generiek via bonnen printen

svn path=/Website/trunk/; revision=26106
This commit is contained in:
Jos Groot Lipman
2015-08-27 21:14:04 +00:00
parent ed9fca3be1
commit 57d27b10bb
3 changed files with 13 additions and 3 deletions

View File

@@ -91,6 +91,7 @@ function scaffolding(model, scf_params)
def(model, mode, {});
def(model, "list", {});
def(model, "edit", {});
def(model, "print", {});
if ("id" in model.fields && "name" in model.fields)
def(model.list, "columns", ["id", "name"]);

View File

@@ -12,25 +12,34 @@
Note:
*/ %>
<!-- #include file="../Shared/xml_converter.inc" -->
<!-- #include file="../api2/api2_rest.inc" -->
<%
function scaffolding_print(model, scf_params)
{
scf_params.print = scf_params.print || {};
var allincludes = []
if (model.includes)
if (!model.print.xmlnode && model.includes) // Bij xmlnode doen we toch niets met de data
{
allincludes = [];;
for (var inc in model.includes)
allincludes.push(inc);
}
var key = getQParam("id");
var xxx_params = { filter: { id: key }, include: allincludes };
var xxx_array = model.REST_GET(xxx_params);
if (!xxx_array.length)
shared.record_not_found();
// Voor de xmlnode variant gebruiken we bovenstaande REST_GET helemaal niet
// Toch voeren we die wel uit voor de automatische authorisatiecontrole
if (model.print.xmlnode) // Die is simpel
{
FCLT2XMLResponse( {xmlnode: model.print.xmlnode, key: key, stylsesheet: model.print.xmlnode});
Response.End; // Simpel klaar
}
var xxx_data = xxx_array[0];
var xml_antwoord = api2_rest.json2xml(xxx_array, model, true);

View File

@@ -89,7 +89,7 @@ function scaffolding_show(model, scf_params)
// if stylesheet gevonden
var fso = Server.CreateObject("Scripting.FileSystemObject");
var xslfile = Server.MapPath(custpath + "/xsl/scf_" + model.table + ".xsl");
if (fso.FileExists(xslfile))
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));