Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Generate routed Modal links for iframes when not on the root #30007

Merged
merged 2 commits into from
Jul 20, 2020
Merged

[4.0] Generate routed Modal links for iframes when not on the root #30007

merged 2 commits into from
Jul 20, 2020

Conversation

PhilETaylor
Copy link
Contributor

@PhilETaylor PhilETaylor commented Jul 5, 2020

Closes #29998

Summary of Changes

The problem this resolves is the generating of links for iframes that start with a relative path eg src="index.php..... when the url you are on might be /index.php/this/that/

This then generates a url of /index.php/this/that/index.php..... when launched.

Admin modals are unaffected as they are always in the directory /administrator/ and therefore relatively a url starting href="index.php" would load from /administrator/

#29998 has some examples I struggled with today.

This PR fixes two frontend modals - the Versions button when editing content and the SELECT button when selecting a new site logo in Template settings.

Testing Instructions

Install Joomal 4.0-dev @ 1f24603
Login to super admin
Click Install next to Blog Sample Data
Click ok in JS popup

Go to front end and

Login as super admin

click Welcome to your blog
Click cog -> click edit (to edit the article)

INSPECT the DIV before the Versions button

another good example this fixes is #29296

Actual result BEFORE applying this Pull Request

Note the url in the html

data-url="index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&field=jform_contenthistory&item_id=com_content.article.3&108a0c70130a44644e515f55efaca61f=1" 
<div id="versionsModal" role="dialog" tabindex="-1" class="joomla-modal modal fade" data-url="index.php?option=com_contenthistory&amp;view=history&amp;layout=modal&amp;tmpl=component&amp;field=jform_contenthistory&amp;item_id=com_content.article.3&amp;108a0c70130a44644e515f55efaca61f=1" data-iframe="<iframe class=&quot;iframe&quot; src=&quot;index.php?option=com_contenthistory&amp;amp;view=history&amp;amp;layout=modal&amp;amp;tmpl=component&amp;amp;field=jform_contenthistory&amp;amp;item_id=com_content.article.3&amp;amp;108a0c70130a44644e515f55efaca61f=1&quot; name=&quot;Versions&quot; title=&quot;Versions&quot; height=&quot;100%&quot; width=&quot;100%&quot;></iframe>">
	<div class="modal-dialog modal-lg jviewport-width80">
		<div class="modal-content">
			<div class="modal-header">
			<h3 class="modal-title">Versions</h3>
				<button type="button" class="close novalidate" data-dismiss="modal" aria-label="Close">
			<span aria-hidden="true">×</span>
		</button>
	</div>
<div class="modal-body jviewport-height60">
	</div>
<div class="modal-footer">
	<button type="button" class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">Close</button></div>
		</div>
	</div>
</div>

Expected result AFTER applying this Pull Request

Note the url in the html

data-url="/index.php/component/contenthistory?view=history&amp;layout=modal&amp;tmpl=component&amp;field=jform_contenthistory&amp;item_id=com_content.article.3&amp;108a0c70130a44644e515f55efaca61f=1"
<div id="versionsModal" role="dialog" tabindex="-1" class="joomla-modal modal fade" data-url="/index.php/component/contenthistory?view=history&amp;layout=modal&amp;tmpl=component&amp;field=jform_contenthistory&amp;item_id=com_content.article.3&amp;108a0c70130a44644e515f55efaca61f=1" data-iframe="<iframe class=&quot;iframe&quot; src=&quot;/index.php/component/contenthistory?view=history&amp;amp;layout=modal&amp;amp;tmpl=component&amp;amp;field=jform_contenthistory&amp;amp;item_id=com_content.article.3&amp;amp;108a0c70130a44644e515f55efaca61f=1&quot; name=&quot;Versions&quot; title=&quot;Versions&quot; height=&quot;100%&quot; width=&quot;100%&quot;></iframe>">
	<div class="modal-dialog modal-lg jviewport-width80">
		<div class="modal-content">
			<div class="modal-header">
			<h3 class="modal-title">Versions</h3>
				<button type="button" class="close novalidate" data-dismiss="modal" aria-label="Close">
			<span aria-hidden="true">×</span>
		</button>
	</div>
<div class="modal-body jviewport-height60">
	</div>
<div class="modal-footer">
	<button type="button" class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">Close</button></div>
		</div>
	</div>
</div>

Documentation Changes Required

none

@ceford
Copy link
Contributor

ceford commented Jul 6, 2020

With last nights Nightly build the Versions modal is styled with and without the patch. As I have multi-lingual sample data installed here are my links:

My before
data-url="index.php?option=com_contenthistory&view=history&layout=modal&tmpl=component&field=jform_contenthistory&item_id=com_content.article.6&587c449cfbb9305dd906a3bcbec547da=1"

My after
data-url="/j4beta2/index.php/en/component/contenthistory?view=history&layout=modal&tmpl=component&field=jform_contenthistory&item_id=com_content.article.6&587c449cfbb9305dd906a3bcbec547da=1"


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

@PhilETaylor

This comment was marked as abuse.

@ceford
Copy link
Contributor

ceford commented Jul 6, 2020

I have tested this item ✅ successfully on 856b214


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

@PhilETaylor

This comment was marked as abuse.

Co-authored-by: Quy <quy@fluxbb.org>
@richard67
Copy link
Member

Previous test is still valid because last change was only in a code comment.

@Quy
Copy link
Contributor

Quy commented Jul 12, 2020

I have tested this item ✅ successfully on 0cf8eba


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

@Quy
Copy link
Contributor

Quy commented Jul 12, 2020

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 12, 2020
@Quy Quy added this to the Joomla 4.0 milestone Jul 12, 2020
@richard67 richard67 merged commit fecb7ed into joomla:4.0-dev Jul 20, 2020
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jul 20, 2020
@richard67
Copy link
Member

Thanks!

dgrammatiko added a commit to dgrammatiko/joomla-cms that referenced this pull request Jul 21, 2020
…outs

* '4.0-dev' of github.com:joomla/joomla-cms: (612 commits)
  [4.0] Smart Search: Fixing ordering, order direction and disabled button (joomla#29474)
  [4.0] Generate routed Modal links for iframes when not on the root (joomla#30007)
  [4.0] Get menu directly in com_tags menu route helper (joomla#30039)
  Remove collapse when resizing from mobile to desktop (joomla#30132)
  [4.0] Wrap component output in `main` element to make Cassiopeia more accessible (joomla#29870)
  [4.0] Webauthn gmp warning (joomla#29731)
  [4.0] Refactor to return early, remove if depths and throw NotAllowed (joomla#29694)
  [4.0] CLI help text (joomla#29811)
  Feature/draggable typo fixes (joomla#29987)
  [4.0] Removing unnecessary workaround in finder indexer (joomla#30037)
  [4.0] Optimizing Smart Search for larger content (joomla#30008)
  [4.0] Fix js ajax for pre update checker (joomla#29980)
  [4.0] Cassiopea: Fixing modals custom-select fields display (joomla#30097)
  [4.0][com_fields] Fix draggable sorting (joomla#30094)
  [4.0] Correct incorrect @return documentation (joomla#30092)
  [4.0] Menu items modal: adding missing filters (joomla#30087)
  short to long php open tags with echo (joomla#30089)
  Use new Toolbar (joomla#30085)
  [4.0] Center status/date created headers (joomla#29249)
  [4.0] Fix Cassiopea searchtools alignment in modals (joomla#30077)
  ...

# Conflicts:
#	administrator/components/com_templates/src/View/Template/HtmlView.php
#	installation/sql/postgresql/base.sql
#	libraries/src/Application/AdministratorApplication.php
#	libraries/src/Application/SiteApplication.php
sakiss pushed a commit to sakiss/joomla-cms that referenced this pull request Oct 16, 2020
…oomla#30007)

Correctly route modal links

Co-authored-by: Quy <quy@fluxbb.org>

Co-authored-by: Quy <quy@fluxbb.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants