From 30e1fcf7c94bcdb9a7857d513f327c89038f5cec Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 13 May 2007 03:27:37 +0000 Subject: [PATCH] template loading git-svn-id: svn://svn.open-ils.org/ILS/trunk@7279 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/reports/xul/source-setup.js | 29 +++++++++++++++++++++++++++++ Open-ILS/web/reports/xul/template-config.js | 4 +++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/reports/xul/source-setup.js b/Open-ILS/web/reports/xul/source-setup.js index 548d6c6236..a54c11419e 100644 --- a/Open-ILS/web/reports/xul/source-setup.js +++ b/Open-ILS/web/reports/xul/source-setup.js @@ -33,6 +33,31 @@ function sortLabels (a,b) { return aname < bname ? -1 : 1; } + +function loadTemplate(id) { + var cgi = new CGI(); + var session = cgi.param('ses'); + + var r = new Request('open-ils.reporter:open-ils.reporter.template.retrieve', session, id); + + r.callback( + function(res) { + var tmpl = res.getResultObject(); + var template = JSON2js( tmpl.data() ); + + $('template-name').value = tmpl.name + ' (clone)'; + $('template-description').value = tmpl.description; + + rpt_rel_cache = template.rel_cache; + resetUI( template.core_class ); + renderSources(); + } + ); + + r.send(); +} + + function loadIDL() { var req = new XMLHttpRequest(); req.open('GET', '../fm_IDL.xml', true); @@ -45,6 +70,10 @@ function loadIDL() { } } req.send(null); + + var cgi = new CGI(); + var template_id = cgi.param('ct'); + if (template_id) loadTemplate(template_id); } function getIDLClass (id) { return filterByAttribute( oilsIDL.getElementsByTagName('class'), 'id', id )[0] } diff --git a/Open-ILS/web/reports/xul/template-config.js b/Open-ILS/web/reports/xul/template-config.js index 484be194ad..c1d533dde9 100644 --- a/Open-ILS/web/reports/xul/template-config.js +++ b/Open-ILS/web/reports/xul/template-config.js @@ -747,7 +747,7 @@ function save_template () { param_count = 0; var template = { - version : 1, + version : 2, core_class : $('sources-treetop').getElementsByTagName('treeitem')[0].getAttribute('idlclass'), select : [], from : {}, @@ -776,6 +776,8 @@ function save_template () { for each (var order in rpt_rel_cache.order_by) fleshTemplateField( template, rpt_rel_cache[order.relation], 'dis_tab', order.field ); + template.rel_cache = rpt_rel_cache; + //prompt( 'template', js2JSON( template ) ); // and the saving throw ... -- 2.11.0