? ? ? ? Pending
Referenced as Related to: # 7259

User tests: Successful: Unsuccessful:

avatar roland-d
roland-d
24 Jun 2017

Pull Request for Issue #7259

Summary of Changes

This is a redo of the original done at #7259 with some small code changes

Testing Instructions

  1. Make sure that the Redirect plugin is either disabled or the Collection of URLs is disabled
  2. Go to administrator/index.php?option=com_redirect
  3. When the collection of URLs is disabled you will see this message:
    image

When the plugin is disabled you will see this message:
image

  1. Click on the Redirect System Plugin link and you are taken to a new page where you can edit the plugin settings. Now you need to navigate back to the Redirect plugin.
  2. Apply patch
  3. When the collection of URLs is disabled you will see this message:
    image

When the plugin is disabled you will see this message:
image

I changed the regular link to a button so it is easier to see where to click.
7. Click on the Redirect System Plugin link and you are shown a modal in which you can change the settings. Update the settings and click Save.
8. The page is refreshed and the message has changed.

Expected result

I stay on the same page and can edit the settings.

Actual result

I am taking to a new page and need to navigate back.

Documentation Changes Required

None

Pinging @brianteeman @franz-wohlkoenig for testing :)

avatar roland-d roland-d - open - 24 Jun 2017
avatar roland-d roland-d - change - 24 Jun 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Jun 2017
Category Administration com_plugins com_redirect Language & Strings Libraries
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jun 2017

can you please change Color on hover for easier reading?
bildschirmfoto 2017-06-24 um 10 43 13

avatar roland-d
roland-d - comment - 24 Jun 2017

@franz-wohlkoenig I can if you tell me which class I should be using :)

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jun 2017

i can't, i'm the one who ask;-) CSS-Gurus here?

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 24 Jun 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jun 2017

I have tested this item successfully on 4a8b5f8


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

avatar Quy
Quy - comment - 24 Jun 2017

@roland-d Use the alert-link class instead of a button.

avatar brianteeman
brianteeman - comment - 24 Jun 2017

@roland-d other than the previouslt mentioned css issue its all good - thanks


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

avatar roland-d roland-d - change - 24 Jun 2017
Labels Added: ? ?
avatar roland-d
roland-d - comment - 24 Jun 2017

Thanks everybody for your input. I have made the following changes:

  • Fixed the copyright
  • Changed the CSS class from btn to alert-link
  • Changed the reload of the parent page because the old way showed JS errors and had issues if you filtered the list before clicking the plugin modal
avatar franz-wohlkoenig franz-wohlkoenig - change - 24 Jun 2017
Easy No Yes
avatar franz-wohlkoenig franz-wohlkoenig - test_item - 24 Jun 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jun 2017

I have tested this item successfully on cb243fc

But Link is difficult to read:
bildschirmfoto 2017-06-24 um 17 05 59


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/16844.
avatar roland-d
roland-d - comment - 24 Jun 2017

@franz-wohlkoenig I could remove the label class and then it is just bold text. That just doesn't look clear enough to me that it is a link you can click. @Quy Any other options for styling this so it looks more like a clickable link?

avatar mbabker
mbabker - comment - 24 Jun 2017

Improve the implementation of the alert-link class if you don't think it stands out as a link (which is just a backport from Bootstrap 3). Please don't try to fudge the display with extra UI elements to make it "stand out".

avatar roland-d
roland-d - comment - 24 Jun 2017

Ok, I removed the label class. Declaring styling out of scope :)

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 24 Jun 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jun 2017

I have tested this item successfully on 6f1d7aa


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

avatar infograf768
infograf768 - comment - 24 Jun 2017

Can't we make this generic? I mean not specific to the redirect plugin?
I am talking about the edit.php
window.top.setTimeout('window.parent.location = \"index.php?option=com_redirect&view=links\"', 1000);

We could use the modal for other instances of editing a plugin when we have such situation:
in com_associations for example for the system - languagefilter and in com_fields for system - Fields.

avatar roland-d
roland-d - comment - 24 Jun 2017

@infograf768 This was generic and then I made the mistake of putting that URL in there :P I will change this so it is generic.

avatar dgt41
dgt41 - comment - 24 Jun 2017

@infograf768 in Joomla4 we have events so this can be a lot nicer and of course not generic.

Also this probably needs some attention when merging static to j4 (we don't have inline scripts anymore)

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 25 Jun 2017

@roland-d please give a go if PR is ready for Test.

avatar roland-d
roland-d - comment - 25 Jun 2017

@franz-wohlkoenig Let's ask @andrepereiradasilva if he wants anymore changes. If not, we can test.

avatar roland-d
roland-d - comment - 25 Jun 2017

@franz-wohlkoenig Looks like we can test, @andrepereiradasilva has not raised any other issues.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 25 Jun 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 25 Jun 2017

I have tested this item successfully on 6f5fc46


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

avatar roland-d
roland-d - comment - 26 Jun 2017

Thanks for the feedback but I am going to wait a week to make changes in case anybody else comes up with something.

avatar Quy
Quy - comment - 26 Jun 2017

In \administrator\templates\hathor\html\com_redirect\links\default.php line 148, it is missing an argument.

				<span class="enabled"><?php echo JText::_('COM_REDIRECT_COLLECT_URLS_DISABLED'); ?></span>
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jun 2017
Category Administration com_plugins com_redirect Language & Strings Libraries Administration com_plugins com_redirect Language & Strings Templates (admin) Libraries
avatar roland-d
roland-d - comment - 26 Jun 2017

@Quy requested a change in the Hathor override but what we have now is 2 messages. One is the enqueued message and the other the regular displayed message. The enqueued message contains the modal link which doesn't work in Hathor anyway. Are we leaving it like this or add a harcoded check for Hathor? A template which is going to be removed anyway.

avatar zero-24
zero-24 - comment - 26 Jun 2017

Thanks

avatar zero-24
zero-24 - comment - 26 Jun 2017

Sorry broken autocorrect

avatar roland-d
roland-d - comment - 29 Jun 2017

Can we move this forward or does it need more changes?

avatar infograf768
infograf768 - comment - 30 Jun 2017

This will not be B/C language wise if you just modify the string values. We get a 404 with non updated language packs (Tested with fa-IR and fr-FR)
I suggest to create new strings/constants and marked the other ones as deprecated by a comment above them.

Obsolete:
; The following string is deprecated and will be removed with 4.0.
COM_REDIRECT_COLLECT_URLS_DISABLED
; The following string is deprecated and will be removed with 4.0.
COM_REDIRECT_PLUGIN_DISABLED

Possible new constants:
COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED
COM_REDIRECT_PLUGIN_MODAL_DISABLED

avatar infograf768
infograf768 - comment - 30 Jun 2017

Also I remarked an RTL issue that was also present before this patch
We should not use
$app->enqueueMessage(JText::_('COM_REDIRECT_PLUGIN_ENABLED') . ' ' . JText::sprintf('COM_REDIRECT_COLLECT_URLS_DISABLED', $link), 'notice');

As this is not RTL aware. The first string displays on the left in RTL.

I think we should rather have a sprintf with 2 variables, 1 for the link, the other for the string.
something like:
$app->enqueueMessage(JText::sprintf('COM_REDIRECT_COLLECT_URLS_DISABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED'), $link), 'notice');

COM_REDIRECT_COLLECT_URLS_DISABLED="%1$s The 'Collect URLs' option in the %2$s is disabled. Error page URLs will not be collected by this component."

avatar roland-d
roland-d - comment - 30 Jun 2017

@infograf768

We get a 404 with non updated language packs (Tested with fa-IR and fr-FR)

You can't get a 404 when using JText. If a language string doesn't exist it will just show the supplied string. What 404 are you talking about?

I will look into the sprintf for RTL

avatar infograf768
infograf768 - comment - 1 Jul 2017

You can't get a 404 when using JText. If a language string doesn't exist it will just show the supplied string. What 404 are you talking about?

As you have not changed the constant, the original value for the string is
COM_REDIRECT_PLUGIN_DISABLED="The <a href="_QQ_"%s"_QQ_">Redirect System Plugin</a> is disabled. It needs to be enabled for this component to work."

Therefore, if the language pack is NOT updated, % is the $link value
and we get a 404 because <a href="_QQ_"JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId());"_QQ_">Redirect System Plugin</a> makes no sense.

I suggest you just install French available pack for example + your PR and test.

avatar infograf768
infograf768 - comment - 1 Jul 2017

@roland-d
If you like, I will make an animated gif

avatar roland-d
roland-d - comment - 1 Jul 2017

@infograf768 No need I think, I get the issue you are pointing out.

avatar roland-d
roland-d - comment - 1 Jul 2017

@infograf768 I believe it should be correct now, I tested this with both French and English.

avatar Quy
Quy - comment - 1 Jul 2017

In Hathor, invalid markup <a href="<a href=:

<span class="enabled">The 'Collect URLs' option in the <a href="<a href="index.php?option=com_plugins&filter_search=redirect" >Redirect System Plugin</a>">Redirect System Plugin</a> is disabled. Error page URLs will not be collected by this component.</span>
avatar infograf768
infograf768 - comment - 3 Jul 2017

@roland-d
Hathor still broken here:
screen shot 2017-07-03 at 11 36 10

The link in the Error Message looks correct but it does not display the Modal.
I get a js error
Empty string passed to getElementById().

The link in the table footer is wrong. It should be a sprintf
line 150 to 152 should be

		<?php else : ?>
			<span class="disabled"><?php echo JText::sprintf('COM_REDIRECT_PLUGIN_DISABLED', 'index.php?option=com_plugins&filter_search=redirect'); ?></span>
		<?php endif; ?>
avatar roland-d
roland-d - comment - 3 Jul 2017

I don't think there should be a modal in Hathor, should there be?

avatar infograf768
infograf768 - comment - 3 Jul 2017

We use Modals in Hathor, for example when we have associations.
But, yes, I don't think it is necessary, taking into account the fact that we are not supposed to code for hathor anymore. We just should not destroy what works ;)
The Error message should have the same link as the table footer, i.e. link to the old behavior
'index.php?option=com_plugins&filter_search=redirect'

avatar infograf768
infograf768 - comment - 3 Jul 2017

I could get it to work in a basic way though, by adding

<?php if ($this->redirectPluginId) : ?>
			<?php $link = JRoute::_('index.php?option=com_plugins&client_id=0&task=plugin.edit&extension_id=' . $this->redirectPluginId . '&tmpl=component&layout=modal'); ?>
			<?php echo JHtml::_(
				'bootstrap.renderModal',
				'plugin' . $this->redirectPluginId . 'Modal',
				array(
					'url'        => $link,
					'title'      => JText::_('COM_REDIRECT_EDIT_PLUGIN_SETTINGS'),
					'height'     => '400px',
					'modalWidth' => '60',
					'footer'     => '<button class="btn" data-dismiss="modal" aria-hidden="true">'
						. JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '</button>'
						. '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#plugin' . $this->redirectPluginId . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
						. JText::_("JSAVE") . '</button>'
				)
			); ?>
		<?php endif; ?>

after line 53

But it does not look very good :)

screen shot 2017-07-03 at 12 07 04

avatar roland-d
roland-d - comment - 4 Jul 2017

@infograf768 I agree, we shouldn't destroy what is working ;) Instead of keeping the link you gave I did update the link to go directly to the edit screen as this also works in the isis template. Both links are the same now and not using a modal.

avatar infograf768
infograf768 - comment - 4 Jul 2017

You forgot

The link in the table footer is wrong. It should be a sprintf
line 150 to 152 should be

this is used when the plugin is disabled. We need the link.


		<?php else : ?>
			<span class="disabled"><?php echo JText::sprintf('COM_REDIRECT_PLUGIN_DISABLED', 'index.php?option=com_plugins&filter_search=redirect'); ?></span>
		<?php endif; ?>

Or use as link
index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()

as other wise we get this type of url:
http://mysite.com/administrator/%s

avatar roland-d
roland-d - comment - 4 Jul 2017

@infograf768 Thanks, updated things again and checked and checked but who knows what else I forgot :)

avatar Quy
Quy - comment - 5 Jul 2017

The sentence is repeated.

The Redirect Plugin is enabled. The Redirect Plugin is enabled. The option 'Collect URLs' is enabled.

avatar infograf768
infograf768 - comment - 5 Jul 2017

@roland-d
we also have to take care of RTL.
I suggest this

	<p class="footer-tip">
		<?php if ($this->enabled && $this->collect_urls_enabled) : ?>
			<span class="enabled"><?php echo JText::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED')); ?></span>
		<?php elseif ($this->enabled && !$this->collect_urls_enabled) : ?>
			<span class="enabled"><?php echo JText::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED'), 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()); ?></span>
		<?php elseif (!$this->enabled) : ?>
			<span class="disabled"><?php echo JText::sprintf('COM_REDIRECT_PLUGIN_DISABLED', 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()); ?></span>
		<?php endif; ?>
	</p>
avatar infograf768
infograf768 - comment - 5 Jul 2017

hmm, still a small issue.
we get
The Redirect Plugin is enabled. The 'Collect URLs' option in the index.php?option=com_plugins&task=plugin.edit&extension_id=427 is disabled. Error page URLs will not be collected by this component.
coming back with corrected proposal

avatar infograf768
infograf768 - comment - 5 Jul 2017

Here it is:

	<p class="footer-tip">
		<?php if ($this->enabled && $this->collect_urls_enabled) : ?>
			<span class="enabled"><?php echo JText::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED')); ?></span>
		<?php elseif ($this->enabled && !$this->collect_urls_enabled) : ?>
			<?php $link = JHtml::_(
					'link',
					JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()),
					JText::_('COM_REDIRECT_SYSTEM_PLUGIN')
				);
			?>
			<span class="enabled"><?php echo JText::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED'), $link); ?></span>
		<?php elseif (!$this->enabled) : ?>
			<span class="disabled"><?php echo JText::sprintf('COM_REDIRECT_PLUGIN_DISABLED', 'index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()); ?></span>
		<?php endif; ?>
	</p>

this should work fine now.

avatar roland-d roland-d - reference | fc25aa7 - 5 Jul 17
avatar roland-d roland-d - change - 5 Jul 2017
Labels Added: ?
avatar roland-d
roland-d - comment - 5 Jul 2017

Thank you @infograf768 I have added the code verbatim as I don't have time to test it further at this moment but at least if it is all good others can test as well.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 5 Jul 2017 - Tested successfully
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 5 Jul 2017

I have tested this item successfully on fc25aa7

Tested Hathor, Isis; English, Persian.


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

avatar infograf768 infograf768 - test_item - 6 Jul 2017 - Tested successfully
avatar infograf768
infograf768 - comment - 6 Jul 2017

I have tested this item successfully on fc25aa7


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

avatar infograf768 infograf768 - change - 6 Jul 2017
Status Pending Ready to Commit
Labels
avatar infograf768
infograf768 - comment - 6 Jul 2017

RTC. Thanks!


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

avatar infograf768 infograf768 - change - 6 Jul 2017
Title
Implements a modal to edit the Redirect plugin settings when needed
New Feature: Implements a modal to edit the Redirect plugin settings when needed
avatar infograf768 infograf768 - edited - 6 Jul 2017
avatar infograf768 infograf768 - change - 6 Jul 2017
Title
Implements a modal to edit the Redirect plugin settings when needed
New Feature: Implements a modal to edit the Redirect plugin settings when needed
avatar rdeutz rdeutz - assigned - 6 Jul 17
avatar infograf768
infograf768 - comment - 6 Jul 2017

@rdeutz
did not set milestone. I guess it can go into 3.7.4. as we can in further releases use the new modal for other places in admin.

avatar brianteeman
brianteeman - comment - 6 Jul 2017

As its a new feature it should be 3.8 surely

avatar rdeutz rdeutz - change - 6 Jul 2017
Milestone Added:
avatar rdeutz rdeutz - unassigned - 6 Jul 17
avatar infograf768
infograf768 - comment - 6 Jul 2017

@roland-d
Just remarked that you are deleting in this PR
administrator/manifests/packages/pkg_weblinks.xml

I guess it is just an error. Please correct.

avatar roland-d
roland-d - comment - 6 Jul 2017

@infograf768 That is a mistake, for some reason this thing keeps popping up. I don't think this file is even part of the core. I will fix this.

avatar roland-d roland-d - change - 6 Jul 2017
Labels Added: ?
avatar roland-d roland-d - reference | 34dc757 - 6 Jul 17
avatar infograf768
infograf768 - comment - 6 Jul 2017

it IS part of core ;)

avatar infograf768
infograf768 - comment - 6 Jul 2017

Looks like it solved itself, weird.

avatar roland-d
roland-d - comment - 6 Jul 2017

@infograf768 Still part huh? :/ No, it didn't solve itself, I removed the previous commit and made a new commit.

avatar infograf768
infograf768 - comment - 6 Jul 2017

Then github is weird as, normally, a new commit would take off the RTC label...
Anyhow, all is fine.

avatar mbabker
mbabker - comment - 25 Jul 2017

Needs to be synced with staging since the plugin helper class has now moved to its namespaced location (should just be able to git merge staging and be good, I had no issues testing another more complex PR).

avatar roland-d
roland-d - comment - 26 Jul 2017

@mbabker Done as requested

avatar mbabker mbabker - change - 26 Jul 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-07-26 11:36:35
Closed_By mbabker
avatar mbabker mbabker - close - 26 Jul 2017
avatar mbabker mbabker - merge - 26 Jul 2017
avatar brianteeman
brianteeman - comment - 26 Jul 2017

thank you

Add a Comment

Login with GitHub to post a comment