User tests: Successful: Unsuccessful:
Suppose you have a Joomla website that is reachable via different domain names or via HTTP and HTTPS. If you want to use the links A/B/C in your articles (I assume that your template knows what to do with these, which is the case e.g. with the Beez 5 template) you currently have to decide which of your domain names you want to use resp. whether you want to use HTTP or HTTPS as protocol if you want to assign links to other pages within your website to the links A/B/C.
This PR proposes changes which allow to assign internal links to the links A/B/C.
About testing these changes:
For testing I used the fruit shop welcome page from the example installation but any other pages should work as well. I added links to the "Apples", "Bananas" and "Tamarind" pages to the "Welcome" page of the fruit shop.
What should work with these changes (and what not) - examples based upon the fruit shop pages:
I know that there are other components in Joomla which also allow to enter URLs,e.g. the contact manager. It is probably also in those components of interest to allow internal URLs beside the external URLs currently only allowed there. If you enter a relative URL (means: URL without protocol etc.) the library routines do their best to convert this URL into an external URL (see libraries(joomla/form/form.php for details) but by principle it cannot work well always though I found an error in this part and corrected it as part of my changes.
Labels |
Added:
?
|
@zero-24 yes I am, but as you've probably already seen I sent the same enhancement for the staging branch as well. Reason for sending it against the 2.5.x branch is that I think this branch will stay around for while (yes I know about the deadline December 31, 2014) and these changes come from my installation where I have to take care every time I'm doing an update that they don't get lost - and if these changes are part of the next patch I do no longer need to take care of it.
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
yes I am, but as you've probably already seen I sent the same enhancement for the staging branch as well.
Oh sorry i have not see it ;)
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
Can you provide testing instructions? I'm not entirely clear on how this is being used.
If you have the example pages installed you might open the article "Fruit Shop" with the article manager. After doing so you find on the right side the section "Images and links" which you must open in order to add the links A, B and C to this article (by default the first section "Publishing options" is open).
There are three fields for each of the three links: the first one for the URL, the second for the text that will be displayed as link with the URL as target and the third controls whether the URL is opened in the same browser window, in a new one, as a popup window or as a modal window. Best is to leave the third field as it is ("Use global").
In my test instructions above I used the three pages "Apples", "Bananas" and "Tamarind" you find in the Fruit Encyclopedia of the Fruit Shop as targets for the links. Feel free to use any other article where you add the links A, B and C, and naturally you might also use any other up to three pages as targets for these links.
By default (means: with the current Joomla 2.5 code) you might only add complete URLs consisting of a protocol (http), a server name, a path and optionally a query and/or a fragment in the three URL fields. This is also stated in the tooltip for these three fields. If you enter anything else, like a server-internal path (/index.php/fruit-encyclopedia/38-a/6-apples), you'll get an error when saving the article.
After applying the patches for the six files in this PR you should be able to enter server-internal paths into those three URL fields, and they should be saved with the rest of the article. In case that the relative URL entered in one of these fields doesn't start with "/" the modified Joomla code tries to convert it into a server-internal path starting with a "/" (which will not always lead to the expected result but it works in most cases). But the modified code will not try to convert the given relative URL into a complete URL, with one exception: if it finds the name of the server at the beginning of the URL it will prepend the URL with the protocol ("http://"). This is (I think) due to the fact that some browsers don't show the protocol in the address field if the protocol is "http", and if the user copies the target URL from the address field of the browser the protocol is missing (and will be added by the Joomla code if the string at the beginning of the URL is the name of the current server).
After having saved the article with server-internal links in at least one of the fields link A, B or C and a text for the link to click at open this article in the frontend. With the default template ("Beez 5", if you use the Fruit Shop example pages) these links are displayed on top of the article. Clicking upon them shall lead you to the referenced page, but more interesting is the source code of the web page. Search there for the link text and check whether the URL left to this link text is a complete URL or an URL starting with a "/".
After applying my patches and when entering server-internal URLs into the link fields these URLs should start with a "/" such that the browser automatically uses the protocol and the server name of the referring page (means: the page you're currently looking at or at its source code).
I hope these instructions are clear enough for testing the behaviour of the Joomla 2.5 code prior and after applying my patches. If not feel free to ask again.
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
Labels |
Added:
?
|
I doubt about adding any new feature in 2.5.x. at this stage.
@infograf768 I removed the superfluous brace at line 82 in the file url.php
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
I'm not in favor of adding things like that to 2.5.
Reason for sending it against the 2.5.x branch is that I think this branch will stay around for while
End of life is in 3 months and by then everyone should have upgraded to Joomla 3.
The branch may stay available for archive purposes, but it will not accept a single commit after 2014-12-31. And obviously there will be no release anymore next year.
but by principle it cannot work well always though I found an error in this part and corrected it as part of my changes.
If you have seen an error though, please create a new tracker for that one only.
@infograf768
I created PR #4321 for the error I've found in libraries/joomla/form/form.php.
This comment was created with the J!Tracker Application at http://issues.joomla.org/.
4321 works fine. Closing this one.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-09-22 09:14:41 |
@jo-sf are you sure to send a new feature against the 2.5.x branche?