From d3a679e93cd72e44a636ca59ada4cfa10f65d2ad Mon Sep 17 00:00:00 2001 From: zmsdev Date: Tue, 18 Jul 2023 08:50:11 +0200 Subject: [PATCH] replace ajaxGetBodyContent by /++rest:api/.../get_body_content --- .../ZMSLinkElement/inferface0.zpt | 2 +- .../www/bootstrap/plugin/bootstrap.plugin.zmi.js | 2 +- Products/zms/plugins/www/zmi.core.js | 15 ++++++++++++++- Products/zms/zmsobject.py | 7 ------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Products/zms/conf/metaobj_manager/com.zms.foundation/ZMSLinkElement/inferface0.zpt b/Products/zms/conf/metaobj_manager/com.zms.foundation/ZMSLinkElement/inferface0.zpt index ad4fad4e1..061614334 100644 --- a/Products/zms/conf/metaobj_manager/com.zms.foundation/ZMSLinkElement/inferface0.zpt +++ b/Products/zms/conf/metaobj_manager/com.zms.foundation/ZMSLinkElement/inferface0.zpt @@ -23,7 +23,7 @@ function zmiOnSubmitEventHandler(el) { // Set wait-cursor. $(document.body).css( "cursor", "wait"); // JQuery.AJAX.get - $.get( remoteHref+"/ajaxGetBodyContent", remoteResponse); + $.get( $ZMI.get_rest_api_url(remoteHref)+'/get_body_content', remoteResponse); // Set time-out. setTimeout("remoteResponseTimedout()",remoteHrefResponseTimeout); } diff --git a/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js b/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js index 54e09bc1b..ab33a7093 100644 --- a/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js +++ b/Products/zms/plugins/www/bootstrap/plugin/bootstrap.plugin.zmi.js @@ -1423,7 +1423,7 @@ ZMIObjectTree.prototype.previewClick = function(sender) { else { var coords = $ZMI.getCoords(sender); var abs_url = $(sender).parent('li').children('[data-page-physical-path]').attr('data-page-physical-path'); - $.get(abs_url+'/ajaxGetBodyContent',{lang:getZMILang(),preview:'preview'},function(data){ + $.get($ZMI.get_rest_api_url(abs_url)+'/get_body_content',{lang:getZMILang(),preview:'preview'},function(data){ $('div.zmi-browse-iframe-preview').remove(); $('body').append('' +'
' diff --git a/Products/zms/plugins/www/zmi.core.js b/Products/zms/plugins/www/zmi.core.js index 97d81d37a..c91d63601 100644 --- a/Products/zms/plugins/www/zmi.core.js +++ b/Products/zms/plugins/www/zmi.core.js @@ -9,6 +9,20 @@ Array.prototype.indexOf = function(obj) {var i,idx=-1;for(i=0;i= 0) { + i = url.indexOf('/content')+'/content'.length; + } + else if (url.indexOf('://') >= 0) { + i = url.indexOf('://')+'://'.length; + i = i+url.substr(i).indexOf('/'); +} + return url.substr(0,i)+'/++rest_api'+url.substr(i); +} + /** * Parse url-params. */ @@ -335,7 +349,6 @@ ZMI.prototype.getConfProperty = function(key, defaultValue) { /** * Returns conf-properties. */ - ZMI.prototype.getConfProperties = function(prefix) { var r = this.getCachedValue(prefix); if (typeof r=="undefined") { diff --git a/Products/zms/zmsobject.py b/Products/zms/zmsobject.py index 10c4ba132..8ba0754f7 100644 --- a/Products/zms/zmsobject.py +++ b/Products/zms/zmsobject.py @@ -1522,13 +1522,6 @@ def _getBodyContent(self, REQUEST): rtn = self._getBodyContentContentEditable(self.metaobj_manager.renderTemplate( self)) return rtn - security.declareProtected('View', 'ajaxGetBodyContent') - def ajaxGetBodyContent(self, REQUEST, forced=False): - """ - HTML presentation in body-content. - """ - return self.getBodyContent(REQUEST, forced) - def getBodyContent(self, REQUEST, forced=False): html = '' if forced or self.isVisible( REQUEST):