danami
Silver Pleskian
TITLE:
Custom button iframe no longer auto resizes to correct height.
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:Product version: Plesk Onyx 17.9.5
Build date: 2018/08/24 16:00
OS version: CentOS 7.5.1804
Revision: e9a8b33ab2aa446e48a2d368c9282458159e5f73
Architecture: 64-bit
Wrapper version: 1.2
PROBLEM DESCRIPTION:Build date: 2018/08/24 16:00
OS version: CentOS 7.5.1804
Revision: e9a8b33ab2aa446e48a2d368c9282458159e5f73
Architecture: 64-bit
Wrapper version: 1.2
In all previous Plesk versions when creating a custom button in Plesk with the option "Open URL in Plesk" the iframe that Plesk uses has a function that will automatically resize the iframe height to the size of the child content. In Plesk 17.9.5 the javascript function has been updated and is currently broken.
The new broken function is:
The previous one that worked:
STEPS TO REPRODUCE:The new broken function is:
Code:
<script type="text/javascript">
//<![CDATA[
Jsw.onReady(function () {
var resizeBlocks = function () {
var bodyHeight = (Prototype.Browser.IE)
? document.documentElement.clientHeight
: document.body.clientHeight;
var frameHeight = bodyHeight - Element.cumulativeOffset(document.getElementById('frameWrapper'))[1] - parseInt(document.querySelector('.page-content').style.paddingBottom);
if (document.querySelector('.page-footer-wrapper')) {
frameHeight -= Element.getHeight(document.querySelector('.page-footer-wrapper'));
}
document.getElementById('pageIframe').style.height = frameHeight + 'px';
};
resizeBlocks();
window.addEventListener('resize', resizeBlocks);
});
//]]>
</script>
The previous one that worked:
Code:
<script type="text/javascript">
//<![CDATA[
Jsw.namespace('Smb.Views.CustomButtons');
Smb.Views.CustomButtons.resizeBlocks = function() {
var bodyHeight = (Prototype.Browser.IE)
? document.documentElement.clientHeight
: document.body.clientHeight;
var frameHeight = bodyHeight - $('frameWrapper').cumulativeOffset()[1] - parseInt($$('.page-content')[0].getStyle('paddingBottom'));
if ($$('.page-footer-wrapper').first()) {
frameHeight -= $$('.page-footer-wrapper').first().getHeight();
}
$('pageIframe').setStyle({ 'height': frameHeight + 'px' });
};
Jsw.onReady(function() {
Smb.Views.CustomButtons.resizeBlocks();
Event.observe(window, 'resize', Smb.Views.CustomButtons.resizeBlocks, false);
});
//]]>
</script>
1. Create the file /usr/local/psa/admin/htdocs/test.html with the following code:
2. Go To Tools and Settings -> Custom Buttons. Add the custom button with:
Button label: test
Location: common access
URL: /test.html
Open URL in Plesk: checked.
3. Click on the newly added button and you will see that the content is no longer resizing the height as the iframe height is always 400px regardless of the size of the html content.
ACTUAL RESULT:
HTML:
<html>
1<br/>
2<br/>
3<br/>
4<br/>
5<br/>
6<br/>
7<br/>
8<br/>
9<br/>
10<br/>
11<br/>
12<br/>
13<br/>
14<br/>
15<br/>
16<br/>
17<br/>
18<br/>
19<br/>
20<br/>
21<br/>
22<br/>
23<br/>
24<br/>
25<br/>
</html>
2. Go To Tools and Settings -> Custom Buttons. Add the custom button with:
Button label: test
Location: common access
URL: /test.html
Open URL in Plesk: checked.
3. Click on the newly added button and you will see that the content is no longer resizing the height as the iframe height is always 400px regardless of the size of the html content.
The content is no longer resizing the height as the iframe height is always 400px regardless of the size of the custom button html content.
EXPECTED RESULT:The custom button iframe should resize its height as all previous versions of Plesk.
ANY ADDITIONAL INFORMATION:This affects all of our current Plesk extensions.
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:Confirm bug