Skip to content

Commit

Permalink
replace ajaxGetBodyContent by /++rest:api/.../get_body_content
Browse files Browse the repository at this point in the history
  • Loading branch information
zmsdev committed Jul 18, 2023
1 parent de3bbd9 commit d3a679e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(''
+'<div id="zmi_preview_'+data_id+'">'
Expand Down
15 changes: 14 additions & 1 deletion Products/zms/plugins/www/zmi.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ Array.prototype.indexOf = function(obj) {var i,idx=-1;for(i=0;i<this.length;i++)
Array.prototype.lastIndexOf = function(obj) {this.reverse();var i,idx=-1;for(i=0;i<this.length;i++){if(this[i]==obj){idx=(this.length-1-i);break;}}this.reverse();return idx;};
Array.prototype.contains = function(obj) {var i,listed=false;for(i=0;i<this.length;i++){if(this[i]==obj){listed=true;break;}}return listed;};

/**
* Get REST API URL.
*/
ZMI.prototype.get_rest_api_url = function(url) {
if (url.indexOf('/content') >= 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.
*/
Expand Down Expand Up @@ -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") {
Expand Down
7 changes: 0 additions & 7 deletions Products/zms/zmsobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d3a679e

Please sign in to comment.