From 541921ab1de0a45002a501a2bea545c47f2c5252 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 8 Aug 2016 14:10:32 -0400 Subject: [PATCH] Let the legacy interface do the right thing when embedded in the web client Signed-off-by: Mike Rylander --- Open-ILS/web/reports/oils_rpt_folder_window.js | 27 +++++++++++++++++++++----- Open-ILS/web/reports/oils_rpt_param_editor.js | 3 ++- Open-ILS/web/reports/oils_rpt_utils.js | 3 +++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/reports/oils_rpt_folder_window.js b/Open-ILS/web/reports/oils_rpt_folder_window.js index 42a53d5d29..0fb78db968 100644 --- a/Open-ILS/web/reports/oils_rpt_folder_window.js +++ b/Open-ILS/web/reports/oils_rpt_folder_window.js @@ -1,6 +1,9 @@ dojo.requireLocalization("openils.reports", "reports"); var rpt_strings = dojo.i18n.getLocalization("openils.reports", "reports"); +var NG_NEW_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/new'; +var NG_CLONE_TEMPLATE_INTERFACE = '/eg/staff/reporter/template/clone'; +var NG_CLONE_LEGACY_TEMPLATE_INTERFACE = '/eg/staff/reporter/legacy/template/clone'; var OILS_TEMPLATE_INTERFACE = 'xul/template_builder.xul'; var OILS_LEGACY_TEMPLATE_INTERFACE = 'oils_rpt_builder.xhtml'; @@ -104,7 +107,11 @@ oilsRptFolderWindow.prototype.drawEditActions = function() { var s = location.search+''; s = s.replace(/\&folder=\d+/g,''); s = s.replace(/\&ct=\d+/g,''); - goTo( OILS_TEMPLATE_INTERFACE+s+'&folder='+obj.folderNode.folder.id()); + if (window.IAMBROWSER) { + window.top.location.href = NG_NEW_TEMPLATE_INTERFACE+'/'+obj.folderNode.folder.id(); + } else { + goTo( OILS_TEMPLATE_INTERFACE+s+'&folder='+obj.folderNode.folder.id()); + } } @@ -294,11 +301,21 @@ oilsRptFolderWindow.prototype.cloneTemplate = function(template) { s = s.replace(/\&folder=\d+/g,''); s = s.replace(/\&ct=\d+/g,''); version = JSON2js(template.data()).version; - if(version && version >= 2) { - _debug('entering new template building interface with template version ' + version); - goTo(OILS_TEMPLATE_INTERFACE+s+'&folder='+folderid+'&ct='+template.id()); + if(version && version >= 5) { + window.top.location.href = NG_CLONE_TEMPLATE_INTERFACE+'/'+folderid+'/'+template.id(); + } else if(version && version >= 2) { + if (window.IAMBROWSER) { + window.top.location.href = NG_CLONE_LEGACY_TEMPLATE_INTERFACE+'/'+folderid+'/'+template.id(); + } else { + _debug('entering new template building interface with template version ' + version); + goTo(OILS_TEMPLATE_INTERFACE+s+'&folder='+folderid+'&ct='+template.id()); + } } else { - goTo(OILS_LEGACY_TEMPLATE_INTERFACE+s+'&folder='+folderid+'&ct='+template.id()); + if (window.IAMBROWSER) { + window.top.location.href = NG_CLONE_LEGACY_TEMPLATE_INTERFACE+'/'+folderid+'/'+template.id(); + } else { + goTo(OILS_LEGACY_TEMPLATE_INTERFACE+s+'&folder='+folderid+'&ct='+template.id()); + } } } ); diff --git a/Open-ILS/web/reports/oils_rpt_param_editor.js b/Open-ILS/web/reports/oils_rpt_param_editor.js index e66a986ca0..e44a02de6c 100644 --- a/Open-ILS/web/reports/oils_rpt_param_editor.js +++ b/Open-ILS/web/reports/oils_rpt_param_editor.js @@ -38,7 +38,8 @@ oilsRptParamEditor.prototype.draw = function() { var par = params[p]; var row = oilsRptParamEditor.row.cloneNode(true); this.tbody.appendChild(row); - $n(row, 'column').appendChild(text(oilsRptMakeLabel(par.path))); + var clabel = oilsRptMakeLabel(par.path) || par.label || par.alias; + $n(row, 'column').appendChild(text(clabel)); if (par.field_doc) { $n(row, 'column').appendChild( diff --git a/Open-ILS/web/reports/oils_rpt_utils.js b/Open-ILS/web/reports/oils_rpt_utils.js index d7017eca2d..2caed793a3 100644 --- a/Open-ILS/web/reports/oils_rpt_utils.js +++ b/Open-ILS/web/reports/oils_rpt_utils.js @@ -90,6 +90,9 @@ function oilsRptPathRel(path) { /* creates a label "path" based on the column path */ function oilsRptMakeLabel(path) { + if (!path) return path; + if (path.indexOf(' ') > -1) return path + var parts = path.split(/-/); var str = ''; for( var i = 0; i < parts.length; i++ ) { -- 2.11.0