?
avatar marco-pistone
marco-pistone
14 Mar 2020

Steps to reproduce the issue

Enable versioning for a component, modify an item of that component and save.
Then open "Versions" menu and try to compare two versions.

Expected result

This kind of menu
joom_bug4

with a correct populated head:
joom_bug5

Actual result

The menu and the content are rendered incorrectly
joom_bug1

The modal page doesn't contain any information in HEAD section
joom_bug2

and if you click any of this button you have errors in the brower's console
joom_bug3

System information (as much as possible)

Joomla 3.9.16
PHP 7.3

Additional comments

After some debug i've found that the problem is in
\administrator\components\com_contenthistory\views\compare\tmpl\compare.php
This piece of code is executed but doesn't produce any result.

JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers/html');
JHtml::_('textdiff.textdiff', 'diff');

JFactory::getDocument()->addScriptDeclaration("
	(function ($){
		$(document).ready(function (){
            jQuery('.diffhtml, .diffhtml-header').hide();
        });
	})(jQuery);
"
);

Also in the administrator\components\com_contenthistory\helpers\html\textdiff.php file
the paths seem incorrect
the current paths is:
com_contenthistory/diff_match_patch.js
com_contenthistory/jquery.pretty-text-diff.min.js
com_contenthistory/jquery.pretty-text-diff.css
The correct path should be:
com_contenthistory/js/diff_match_patch.js
com_contenthistory/js/jquery.pretty-text-diff.min.js
com_contenthistory/css/jquery.pretty-text-diff.css

JHtml::_('script', 'com_contenthistory/diff_match_patch.js', array('version' => 'auto', 'relative' => true));
JHtml::_('script', 'com_contenthistory/jquery.pretty-text-diff.min.js', array('version' => 'auto', 'relative' => true));

In a quick and dirty way i've found a shortcut to avoid this problem.
In \administrator\components\com_contenthistory\views\compare\tmpl\compare.php
i've added this piece of code in the html output, before the filedset tag:

<script type="text/javascript">
	(function() {
		// Load JQuery
		var mainScript = document.createElement("SCRIPT");
		mainScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js';
		mainScript.type = 'text/javascript';
		mainScript.onload = function() {
			//Load textdiff CSS file
			var cssFile = document.createElement("link");
			cssFile.type = 'text/javascript';
			cssFile.rel  = 'stylesheet';
			cssFile.type = 'text/css';
			cssFile.href = '/media/com_contenthistory/css/jquery.pretty-text-diff.css';
			cssFile.media = 'all';
			document.getElementsByTagName("head")[0].appendChild(cssFile);

			// Load bootstrap
			var script1 = document.createElement("script");
			script1.src = '/media/jui/js/bootstrap.min.js';
			script1.type = 'text/javascript';
			document.getElementsByTagName("head")[0].appendChild(script1);

			// Load textdiff javascripts
			var script2 = document.createElement("script");
			script2.src = '/media/com_contenthistory/js/diff_match_patch.js';
			script2.type = 'text/javascript';
			document.getElementsByTagName("head")[0].appendChild(script2);

			var script3 = document.createElement("script");
			script3.src = '/media/com_contenthistory/js/jquery.pretty-text-diff.min.js';
			script3.type = 'text/javascript';
			script3.onload = function() {
				var $ = window.jQuery;
				$(document).ready(function (){
					var containerId='diff';
					jQuery('#'+containerId+' tr').prettyTextDiff();
					jQuery('.diffhtml, .diffhtml-header').hide();
				});
			};
			document.getElementsByTagName("head")[0].appendChild(script3);
		};
		document.getElementsByTagName("head")[0].appendChild(mainScript);
	})();
</script>

There is something wrong in my joomla version or is known bug?

Thanks

avatar marco-pistone marco-pistone - open - 14 Mar 2020
avatar joomla-cms-bot joomla-cms-bot - change - 14 Mar 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Mar 2020
avatar marco-pistone marco-pistone - change - 14 Mar 2020
The description was changed
avatar marco-pistone marco-pistone - edited - 14 Mar 2020
avatar ReLater
ReLater - comment - 14 Mar 2020
Also in the administrator\components\com_contenthistory\helpers\html\textdiff.php file
the paths seem incorrect
the current paths is:
com_contenthistory/diff_match_patch.js
com_contenthistory/jquery.pretty-text-diff.min.js
com_contenthistory/jquery.pretty-text-diff.css
The correct path should be:
com_contenthistory/js/diff_match_patch.js
com_contenthistory/js/jquery.pretty-text-diff.min.js
com_contenthistory/css/jquery.pretty-text-diff.css

No. The "current paths" are correct because the JHtml method has a relative => true flag

JHtml::_('script', 'com_contenthistory/diff_match_patch.js', array('version' => 'auto', 'relative' => true));

With that flag Joomla is searching automatically also in path com_contenthistory/js/diff_match_patch.js

Aaaaand if Joomla doesn't find the files it's loading nothing.

I think your localhost installation is not configured correctly or your Joomla in a wrong directory or...

I wonder that your urls are pointing to http://localhost/administrator/ and not http://localhost/someOtherFolder/administrator/

Please ask in Joomla forum for help and describe there how and where you have installed your Joomla! For example: https://forum.joomla.org/

avatar marco-pistone
marco-pistone - comment - 14 Mar 2020

I'm agree for the problem with textdiff.php.
But why the code in compare.php do not produce any results?
This is the only component with this kind of issues and the history/tmpl/modal.php works fine.

JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom')); JHtml::_('behavior.multiselect'); JHtml::_('jquery.framework');

avatar ReLater
ReLater - comment - 14 Mar 2020

Then post your whole system informations:
Backend > System > System Informations > The lines in tabulator "System Informations"

BTW: Your "Expected result" screen shot looks somehow weird, too.

avatar ReLater
ReLater - comment - 14 Mar 2020

And tell us which localhost server you use. XAMPP?
And how the directory structure of your Joomla installation is.

avatar marco-pistone
marco-pistone - comment - 14 Mar 2020

I'm using IIS 10.
obviously this is not my first joomla installation under windows system, but is the first time that i'm using the joomla versioning.

What do you mean

Your "Expected result" screen shot looks somehow weird, too.

PHP Built On | Windows NT QUAD-I7 10.0 build 18363 (Windows 10) AMD64
Database Type | mysql
Database Version | 5.7.14-log
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.3.11
Web Server | Microsoft-IIS/10.0
WebServer to PHP Interface | cgi-fcgi
Joomla! Version | Joomla! 3.9.16 Stable [ Amani ] 10-March-2020 15:00 GMT
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
avatar marco-pistone
marco-pistone - comment - 14 Mar 2020

I have the same problem with the same component also on a linux server, this is our pre-production server, the host is on Siteground, and joomla was installed with the automatic deployment tool.

PHP Built On | Linux it14.siteground.eu 3.12.18-clouder0 #1 SMP Tue Oct 9 18:14:47 EEST 2018 x86_64
Database Type | mysql
Database Version | 5.6.40-84.0-log
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.2.28
Web Server | Apache
WebServer to PHP Interface | cgi-fcgi
Joomla! Version | Joomla! 3.9.16 Stable [ Amani ] 10-March-2020 15:00 GMT
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
avatar ReLater
ReLater - comment - 15 Mar 2020

What do you mean
Your "Expected result" screen shot looks somehow weird, too.

Compare it with 2 screenshots from my Joomla with ISIS template:

15-03-_2020_10-45-30

15-03-_2020_10-44-55

avatar ReLater
ReLater - comment - 15 Mar 2020

I can't reproduce your issue with XAMPP/localhost

Setting Value
 
PHP Built On Windows NT DELL-M6800 10.0 build 18363 (Windows 10) i586
Database Type mysql
Database Version 5.5.5-10.1.34-MariaDB
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.2.7
Web Server Apache/2.4.33 (Win32) OpenSSL/1.1.0h PHP/7.2.7
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.9.16 Stable [ Amani ] 10-March-2020 15:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
avatar ReLater
ReLater - comment - 15 Mar 2020

I can't reproduce your issue with Linux/"standard" host:

Setting Value
 
PHP Built On Linux dd46134 4.15.0-76-generic #86~16.04.1-Ubuntu SMP Mon Jan 20 11:02:50 UTC 2020 x86_64
Database Type mysql
Database Version 5.7.28-nmm1-log
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 7.2.24-nmm1
Web Server Apache
WebServer to PHP Interface fpm-fcgi
Joomla! Version Joomla! 3.9.17-dev Development [ Amani ] 10-March-2020 15:28 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
avatar ReLater
ReLater - comment - 15 Mar 2020

15-03-_2020_11-10-17

I don't have IIS.

Perhaps somebody else here has further ideas.

avatar ReLater
ReLater - comment - 15 Mar 2020

I don't think that it helps but try another browser, too.

avatar marco-pistone
marco-pistone - comment - 15 Mar 2020

I'll try your suggestion.
The weird thing is that under two completly different environments, with two different deployment methods i've the same results.
This is a server related issue the browser receive only the output from the server.
However thanks for your time.

avatar jwaisner jwaisner - change - 15 Apr 2020
Status New Closed - Unconfirmed Report
Closed_Date 0000-00-00 00:00:00 2020-04-15 14:38:59
Closed_By jwaisner
avatar joomla-cms-bot joomla-cms-bot - change - 15 Apr 2020
Status Closed - Unconfirmed Report Closed
Closed_By jwaisner joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 15 Apr 2020
avatar joomla-cms-bot
joomla-cms-bot - comment - 15 Apr 2020

Set to "closed" on behalf of @jwaisner by The JTracker Application at issues.joomla.org/joomla-cms/28343

avatar jwaisner
jwaisner - comment - 15 Apr 2020

Closing as not a bug.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/28343.

Add a Comment

Login with GitHub to post a comment