Page 1 of 1

Link to Internal Article from within Editor

Posted: Thu Jan 17, 2008 1:23 am
by cosmicfantasia
Joomla really really needs to have the option of linking to an article without having to first find out what the url is and then manually linking to that url. There should be a list of the articles and perhaps a context search to help find the articles..

:)

Re: Link to Internal Article from within Editor

Posted: Thu Jan 17, 2008 12:14 pm
by bodica
I second this request.

It's a time consuming trying to figure out what the URL is, especially when it's an article which isn't linked to a menu item already... etc.

(If anyone knows how to do this easily, please post it somewhere.)

Re: Link to Internal Article from within Editor

Posted: Thu Jan 17, 2008 11:50 pm
by cosmicfantasia
The xhtml suite editor does it but isn't for 1.5 yet. Should be core anyway.

Have heard devs talk about it before for a 1.6 release, but saw this forum and thought to post anyway. Can't hurt.

Re: Link to Internal Article from within Editor

Posted: Thu Jan 24, 2008 10:30 pm
by Vince
The core 1.5 already does this now for linking internal articles to a menu.
But I nelieve to do the same witin a page using the editor requires functionality to be built into the editor itself, so not really down to core devs, unless they maintain TinyMCE or another as the default Joomla editor?

It could really do with it for sure.

- Vince

Re: Link to Internal Article from within Editor

Posted: Mon Jan 28, 2008 4:01 am
by mtlnews
I had the same problem but couldn't find a simple solution to it. So I built a Joomla! extension myself. I don't know if its listed in the extensions area yet, but you can check it out at codes.mtlnews.com.

If you find any bugs or problems, ill be glad to look into it.

Frank

Re: Link to Internal Article from within Editor

Posted: Tue Jan 29, 2008 5:33 am
by chopstik
Hi mtlnews,

Will be a great plugin. I did a fresh install onto Jv1.5 and got the following error when clicking on the "Link Article" button below the content editor.  I logged out and back into Administrator.  Any ideas?
Fatal error: Class 'JModel' not found in /home/kakapo/public_html/administrator/components/com_linkr/models/articles.php on line 11

Re: Link to Internal Article from within Editor

Posted: Tue Jan 29, 2008 9:15 am
by Vince
mtlnews wrote: I had the same problem but couldn't find a simple solution to it. So I built a Joomla! extension myself. I don't know if its listed in the extensions area yet, but you can check it out at codes.mtlnews.com.
If you find any bugs or problems, ill be glad to look into it.
Frank
Hi Frank,
This looks great. I especially like the preview part when selecting the article:
http://codes.mtlnews.com/images/stories/ss/linkr/4.png

I will definately give this a whirl soon.

- Vince

Re: Link to Internal Article from within Editor

Posted: Tue Jan 29, 2008 5:57 pm
by ralig
mtlnews wrote: I had the same problem but couldn't find a simple solution to it. So I built a Joomla! extension myself. I don't know if its listed in the extensions area yet, but you can check it out at codes.mtlnews.com.

If you find any bugs or problems, ill be glad to look into it.

Frank
Frank,
This extension works great!  The only problem I've had with it, is it replaces the highlighted text/items instead of making them be the link.  So I hacked at it a bit and changed the way it inserts the link.  If you leave the text field blank, it will put the a tags around the highlighted text.  Quick and Dirty hack, but it works well enough for me, and maybe will give you a good starting point for making this be implemented well.

In the file:  administrator/components/com_linkr/assessts/helper.js , I changed the link function:

Code: Select all

link:function(){
		t=$('linkText');
		u=$('linkURL');
		x=$('target');
		/*changed by ralig */
		if(t.value.length==0){
			var inst = window.parent.tinyMCE.selectedInstance;
			t.value = inst.selection.getSelectedHTML();
		} /*end changed */
		if(t.value.length==0){
			alert(this.missingText);
			t.focus();

Re: Link to Internal Article from within Editor

Posted: Wed Jan 30, 2008 12:31 am
by chopstik
Hi the mtlnews,

Last error resolved itself. However another crops up when you select an individual article:
Fatal error: Class 'JSite' not found in /home/kakapo/public_html/components/com_content/helpers/route.php on line 99
Any ideas?

// ALL SOLVED. WAS USING 1.5RC3, 1.5 STABLE FIXED ALL PROBS.  NICE WORK, GREAT PLUG IN.

Re: Link to Internal Article from within Editor

Posted: Wed Jan 30, 2008 3:06 am
by mtlnews
The only problem I've had with it, is it replaces the highlighted text/items instead of making them be the link.  So I hacked at it a bit and changed the way it inserts the link.  If you leave the text field blank, it will put the a tags around the highlighted text.  Quick and Dirty hack, but it works well enough for me, and maybe will give you a good starting point for making this be implemented well.
Thanks ralig!

Re: Link to Internal Article from within Editor

Posted: Sat Feb 02, 2008 10:04 pm
by ralig
OK, 1 problem with the code I gave for putting in the highlighted code:  It only works if you have TinyMCE set as your editor (which isn't so bad, since it is the default editor.)  If there is a different editor, it makes execution freeze, even in the 1.1.1 update.

I can't seem to find a solution to this.  There doesn't seem to be any other joomla editor function wrappers except for jInsertEditorText.  It would be nice if there were a jGetEditorSelected, or something of the sort.

Re: Link to Internal Article from within Editor

Posted: Mon Feb 04, 2008 7:25 am
by mtlnews
Your right, there isn't a "jGetEditorSelected". so I made a few changes to the code, and the highlighted code can only be used when editing with tinyMCE. The fact is that xstandard doesn't have a similar function already integrated.

That seems like the last bug. Do you know of any other popular editors I should consider considering?

Heres the new code:

Code: Select all

getSelectedText: function()
{
	if (window.parent.tinyMCE) {
		// Thanks to ralig
		var inst=window.parent.tinyMCE.selectedInstance;
		txt=inst.selection.getSelectedHTML();
	} else if ($('xstandard')!=false) {
		txt='';	// There is no way of finding the highlighted text in current version
	} else {
		txt='';
	}
	return txt;
}
To get the "xstandard" editor, we need to use getElementById(), or mootools' $().
I don't know much javascript, but that seems about right. Works for me anyways.

tell me what you think

Re: Link to Internal Article from within Editor

Posted: Mon Feb 04, 2008 2:01 pm
by ralig
The new code looks great!  That should do the trick nicely.
That seems like the last bug. Do you know of any other popular editors I should consider considering?
By looking in the Joomla extension gallery, I found JCE and JoomlaFCK as two popular editors.  I know JoomlaFCK is updated for 1.5, but JCE doesn't appear to be yet.  I haven't looke dthrough the code or documentation for JoomlaFCK yet, so not sure if it has a function to get the selected text.

Re: Link to Internal Article from within Editor

Posted: Mon Feb 04, 2008 3:25 pm
by mtlnews
ill look into joomlaFCK, then ill try to convert the extension to be joomla 1.0.x compatible.

thanks again.

Re: Link to Internal Article from within Editor

Posted: Sat Feb 09, 2008 8:31 pm
by pafb12903
Hi mtlnews,

I am having problems with Linkr.  I installed the component and the plugin on my Joomla! 1.5 site and no errors were reported.  I am running my site in legacy mode for compatibility with docman.  When I attempt to link to another article from within an article there linkr button is missing.  Is there a step or something that I am missing?

Thanks,

Jim