fix CSP error in nextmatch print, if EGroupware is installed direct into docroot

et2.template_base_url == '/' generates url //api/templates/... which is a protocol independent representation of domain api and not identical to /api/templates
This commit is contained in:
Ralf Becker 2016-08-19 14:54:12 +02:00
parent 961a2a01da
commit 845f9aee36

View File

@ -2243,12 +2243,14 @@ var et2_nextmatch = (function(){ "use strict"; return et2_DOMWidget.extend([et2_
} }
},this); },this);
var base_url = this.getInstanceManager().template_base_url;
if (base_url == '/') base_url = ''; // otherwise we generate a url //api/templates, which is wrong
var dialog = et2_createWidget("dialog",{ var dialog = et2_createWidget("dialog",{
// If you use a template, the second parameter will be the value of the template, as if it were submitted. // If you use a template, the second parameter will be the value of the template, as if it were submitted.
callback: callback, // return false to prevent dialog closing callback: callback, // return false to prevent dialog closing
buttons: et2_dialog.BUTTONS_OK_CANCEL, buttons: et2_dialog.BUTTONS_OK_CANCEL,
title: 'Print', title: 'Print',
template:this.egw().link(this.getInstanceManager().template_base_url+'/api/templates/default/nm_print_dialog.xet'), template:this.egw().link(base_url+'/api/templates/default/nm_print_dialog.xet'),
value: { value: {
content: { content: {
row_count: Math.min(100,total), row_count: Math.min(100,total),
@ -3458,7 +3460,7 @@ var et2_nextmatch_taglistheader = (function(){ "use strict"; return et2_taglist.
} }
}, },
rows: { default: 2}, rows: { default: 2},
class: {default: 'nm_filterheader_taglist'}, class: {default: 'nm_filterheader_taglist'}
}, },
/** /**
@ -3483,7 +3485,7 @@ var et2_nextmatch_taglistheader = (function(){ "use strict"; return et2_taglist.
{ {
if(options && options.length <= 2 && this.options.multiple == 'toggle') if(options && options.length <= 2 && this.options.multiple == 'toggle')
{ {
this.set_multiple(false) this.set_multiple(false);
} }
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },
@ -3544,7 +3546,7 @@ var et2_nextmatch_taglistheader = (function(){ "use strict"; return et2_taglist.
} }
}, },
rows: { default: 2}, rows: { default: 2},
class: {default: 'nm_filterheader_taglist'}, class: {default: 'nm_filterheader_taglist'}
}, },
/** /**
@ -3569,7 +3571,7 @@ var et2_nextmatch_taglistheader = (function(){ "use strict"; return et2_taglist.
{ {
if(options && options.length <= 2 && this.options.multiple == 'toggle') if(options && options.length <= 2 && this.options.multiple == 'toggle')
{ {
this.set_multiple(false) this.set_multiple(false);
} }
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },
@ -3615,7 +3617,7 @@ var et2_nextmatch_entryheader = (function(){ "use strict"; return et2_link_entry
* @param {object} event * @param {object} event
* @param {object} selected * @param {object} selected
*/ */
onchange: function() { onchange: function(event, selected) {
var col_filter = {}; var col_filter = {};
col_filter[this.id] = this.get_value(); col_filter[this.id] = this.get_value();
this.nextmatch.applyFilters.call(this.nextmatch, {col_filter: col_filter}); this.nextmatch.applyFilters.call(this.nextmatch, {col_filter: col_filter});