User tests: Successful: Unsuccessful:
With this PR a new feature is introduced to the Redirect component:
Batch process to add any number of URLs in one step. The URLs can be added in a modal box which is opened after a click on the new batch button. To speed up the adding, not only the old URL but also the new URL can be added in the same process. The URLs have to be separated with a | (pipe symbol):
http://example.com/old|http://example.com/new
The old URL is mandatory, the new URL not.The host is added automatically to the old URL if not provided which is necessary for the redirect component to work properly.
If an entry already exists, an error "Duplicate entry" is thrown.
How to test
Labels |
Added:
?
?
|
@Kubik-Rubik When I don't enter anything and click "process", the form is submitted and en empty URL (root URL) is registered. The field has a red border so it looks like some client side validation is in place, but it doesn't prevent sending the form and the server side code doesn't check it.
Personally I would not use JError because it's deprecated. In that case here it only shows a warning message anyway. So imho it would be better to just enqueue a message and return after it. It requires that we set the redirect earlier so the return doesn't end up in a white page :)
Something like this:
$this->setRedirect('index.php?option=com_redirect&view=links');
if (!$batch_urls)
{
$this->setMessage(JText::_('COM_REDIRECT_NO_ITEM_ADDED'), 'error');
return;
}
The model error could either be done with a message or an exception. It's personal preference if it should be a simple message or an error page. Currently with JError::raiseWarning it's just a message :)
@Bakual Thank you for your feedback. Please take a look at the new commit. Removed use of deprecated JError class and added server side check for empty values (no empty values possible any more). Tried to avoid unnecessary else
statements in the controller, so I just set the error message as default, then overwrite it with the success message if everything was executed properly!
Thanks @Kubik-Rubik
Cool feature. Here two questions / suggestions:
Thank you for your feedback, @zero-24 !
@Kubik-Rubik Can you try rebasing your branch with staging. Looks like Travis fails for some reason and I think it should work with current staging.
Hmm. I get a database error:
1062 Duplicate entry 'http://sermon.hopto.org/http://example.com/old' for key 'idx_link_old' SQL=INSERT INTO `d1y5s_redirect_links` (`old_url`,`new_url`,`referer`,`comment`,`hits`,`published`,`created_date`) VALUES ('http://sermon.hopto.org/http://example.com/old', 'http://example.com/new' ,'', '',0,0, '2014-07-10 18:55:21'),('http://sermon.hopto.org/foo', 'bar' ,'', '',0,0, '2014-07-10 18:55:21')
The entries are inserted however. So to me it looks like the query is run twice?
Another thing I noted but I'm not sure if that's related to your PR and may even be intentional: The old_url
is always stored with the domain, if it's not specified it's added automatically. However the new_url
is stored as entered.
1.) Can not reproduce the problem with the multiple executions. If an entry already exists, an error "Duplicate entry" is thrown, this is correct.
2.) This is an intentional behavior. The old_url
has to be part of the same domain. The redirect URL (new_url
) can be an external URL, so I don't add the same domain to it.
Can't reproduce it anymore myself. I have no clue what happened yesterday.
Setting to RTC.
Merged into 3.4-dev
branch. Thanks!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-07-11 12:04:58 |
Milestone |
Added: |
JoomlaCode entry: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33877&start=0