I would really like to see the LinkToContent module integrated into FCKeditor for Drupal 6. I like FCKeditor much better than TinyMCE, but this is one addition that's really needed.

Using the version of LinkToContent discussed at http://drupal.org/node/252938, I've gotten the buttons to appear in FCKeditor, but I get an error when the pop-up window opens.

Error on retrieving data from module.
TypeError
$(select).addOption is not a function

If I close the error message and the pop-up, then click the link to node button again, the pop-up opens and I can use the category drop down to select the term for the article I'm looking to link to, but a list of articles doesn't appear.

As I said, this is a needed add-on for FCKeditor, so I hope someone is able to figure out how to get it to work properly.

Thanks.

Comments

nw’s picture

I've had my head down for a few hours and have Drupal 6, FCKEditor, and LinkToContent providing basic functionality. I'm not in a position to publish any code as I've hacked this together. However, I welcome contact from parties interested in collaborating on work towards a distributable patch and/or instructions.

wwalc’s picture

@nw: could you send me a PM with link to this code (or a patch)?

wwalc’s picture

Status: Active » Fixed

Ok, I've added experimental support for Link to content/node integration in CVS. It should be available in an hour as a dev release. Let me know if you find any issues with it.

RWWood’s picture

I'm using the link to content version that's in linktocontent-fckeditor-6.x-2.x-dev with fckeditor-6.x-2.x-dev. The pop-up for link to node appears and allows me to drill down through the taxonomy categories to the parent of the item I want to use, but nothing appears in the list.

Also, sometimes I get an error message when the pop-up first appears:
Error on retrieving data from module.
TypeError
$(select).addOption is not a function

If I then close the error pop-up and the link-to-node pop-up, then re-open the link-to-node pop-up, I get the same results as above, ie. no list of nodes to link to.

With link-to-menu, there is nothing in the list.

RWWood’s picture

Status: Fixed » Active
wwalc’s picture

Hummm this is something that I cannot reproduce on my Drupal installation. Could you provide me a list of steps to reproduce this starting with a fresh Drupal installation?
Alternatively, any chance to see this bug live (use PM to send me a link)?

RWWood’s picture

This is a fresh install of Drupal 6.8 and I have all other modules disabled except taxonomy, fckeditor, and link-to-content. I'm running this on a local server, so I don't have a URL you can visit. Is there any reason I'd have problems on an Apache server running on Windoze rather than Linux?

Thanks

wwalc’s picture

I have installed the following on my local WAMP server:
- Drupal 6.8 + clean URL's disabled
- FCKeditor 6.x-2.x-dev 2008-Dec-17
- FCKeditor 2.6.3
- Experimental version of Link to content module: http://drupal.fckeditor.net/download/linktocontent-fckeditor-6.x-2.x-dev...
- Enabled Linktocontent, Linktocontent Menu, Linktocontent Node, FCKeditor
- uncommented in fckeditor.config.js: FCKConfig.Plugins.Add(...) and enabled 'LinkToNode','LinkToMenu' buttons
- created Cars taxonomy associated with Page content type
- created simple page with tags "Ford, Toyota"
- now I made an attempt to reproduce this issue and I've got it! The problem is that Link to content module should be properly installed first :P

Go to: admin/settings/linktocontent, enable Link to menu and Link to node plugins (actually I don't know why, because I've already installed such module).
That's not all, you should also click on a "edit settings" link and associate those plugins with selected content type.

After setting up the Link to content module, I've made another attempt to use it, I've clicked on a "link to node" button inside of FCKeditor and it started working.

RWWood’s picture

Duh. I'm an idiot. I totally missed the configuration for Link to content.

Thanks. It works like a charm.

wwalc’s picture

Status: Active » Fixed

Well... I must admit that the first time I tried to install this module I couldn't get it working either, due to the same problem, that's why I could be so smart this time ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

jlmeredith’s picture

Status: Closed (fixed) » Reviewed & tested by the community
ypfuquen’s picture

Which one is the patch??? where i can fin it...

Does any body is actually using link to node in FCKeditor displaying the categories?? I need a filter...

Please any help welcome..

wwalc’s picture

Status: Reviewed & tested by the community » Fixed

The status of this ticket has been set to fixed already, there is nothing to patch.
Instructions regarding Linktocontent module are in README file.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mattez’s picture

Category: feature » support
Status: Closed (fixed) » Active

My site is multilingual. English (default) / Czech.
linktonode works fine but shows only nodes in English.
No matter if I'm editing node under English or in Czech.

Any hints? Anybody with experience with setup linktonode on multilingual page?
Don't you know if it's bug or wrong setup?
Thanx a lot...

P.S.
I've tried to play with fckeditor.config.js settings:

FCKConfig.Plugins.Add( 'linktonode', 'en,cs' ) ;
FCKConfig.Plugins.Add( 'linktomenu', 'en,cs' ) ;

but with no result (sure). Than I found its availableLanguages: a list of available language files for the plugin.
It's only for translation of UI? Or what is it good for?

wwalc’s picture

In
FCKConfig.Plugins.Add( 'linktonode', 'en,cs' ) ;
you're instructing FCKeditor to use specified language files from sites\all\modules\fckeditor\plugins\(linktonode)\lang directory.

I'm not sure why do you see only English nodes it seems that it works fine on my local installation... Are you using Drupal 6? Could you write an instruction on how exactly did you setup multilingual site?

Jorrit’s picture

Status: Active » Closed (fixed)

Closed because of inactivity.

higherform’s picture

I know I'm commenting to a closed issue, but I'm hoping this might get a bit more attention...

Downloaded http://ftp.drupal.org/files/projects/linktocontent-6.x-2.x-dev.tar.gz and installed per #8... linktonode worked fine under D6.13 (with clean URLs on), fckeditor 2.6.4.1 and 6.x-1.4-rc1, but linktomenu only resulted in an apparent AJAX error.

My other problem is that linktonode generates a link to the alias'ed path, not node/nodeid... so if the title of the page changes, the link to it goes invalid on most of the sites we have set up for our clients.

Let me see how hard this would be to patch..

freddyseubert’s picture

@higherform: any updates regarding the patch?

Equinger’s picture

I would also like to see updates here. I am only seeing 'Primary Links' available in 'LinktoMenu.' Do not think that this was a problem prior to adding OG. Any thoughts?

jpshayes’s picture

Subscribing

alek123’s picture

Subscribing

momper’s picture

not_Dries_Buytaert’s picture

Subscribing

matkeane’s picture

@19 - I've just run into the problem of the LinkToNode module setting the href using the path alias, rather than an more future-proof 'node/nid' link.

In linktocontent_node.module, the '_linktocontent_node_get_nodes' function runs the 'node/nid' paths through the Drupal url() function, which returns an alias if one exists. A quick hack is to add an option to tell the url function that the path is already an alias:

url('node/'. $node->nid, array('alias' => true));
... and ...
$obj->href = url('taxonomy/term/'. $obj->nid, array('alias' => true));

... which returns a path without converting it to a path alias, so now I can fix my path aliases without messing up internal links.

robbertnl’s picture

Subscribing

glenshewchuck’s picture

FYI: For those who are thinking of upgrade, on Drupal 6.17 I get a not compatible with core (big red X) so I can't install.

thomastsang’s picture

funny, i cannot run this integration, as link 'node/x' will not pass to the link in the content.

The new button 'LinkToNode' is shown, pop up is working, node list is loaded, however, empty link is created when i pick a node in the list and click ok in the popup. (i.e. In context of html, <a href="">title xxxx</a> is created, instead of <a href="node/x">title xxxx</a>)

When i looked on the code, i found function insertAction() in sites\all\modules\fckeditor\plugins\linktonode\jscripts\function.js is the one doing exact what i mentioned above, however, the code is running in tinyMce mode, not fckeditor!!!!!!!!!!!

I am very confuse now, especially how people does make this working!!!! Please correct me if i am wrong, also, how can i fix the problem?

Thank you so much~ Great integration, great work :)

Enclosed code on function insertAction()

function insertAction() {
  if (selectedNode == null) {
    return;
  }
  var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
  var elm = inst.getFocusElement();

  elm = tinyMCE.getParentElement(elm, "a");

  tinyMCEPopup.execCommand("mceBeginUndoLevel");

  // Create new anchor elements
  if (elm == null) {
    var nid = selectedNode.cells[0].firstChild.nodeValue;
    var insertText = selectedNode.cells[1].firstChild.nodeValue;
    if (inst.selection.getSelectedText().length == 0) {
      tinyMCEPopup.execCommand("mceInsertContent", false,
        '<a href="' + nid + '">' + insertText + '</a>');
    }
    else {
       tinyMCEPopup.execCommand("mceInsertContent", false,
        '<a href="' + nid + '">' + inst.selection.getSelectedHTML() + '</a>');
    } // end (getSelectedText == 0)
  }
  else {
    elm.setAttribute("mce_href", selectedNode.cells[0].firstChild.nodeValue);
    // Refresh in old MSIE
    if (tinyMCE.isMSIE5)
      elm.outerHTML = elm.outerHTML;
  }

  tinyMCE._setEventsEnabled(inst.getBody(), false);
  tinyMCEPopup.execCommand("mceEndUndoLevel");
  tinyMCEPopup.close();
}
thomastsang’s picture

I found that there are some injection codes to replace the function.

I also found that order of loading js files may causes problem on the integration.

Do anyone encounter the problem?

According to my result, js files must load in such order to work: fck_link.js, function.js and fck_util.js.

How can i ensure the order of loading these js files?????

Any advice please?

thomastsang’s picture

Enhance the script in fck_linktonode.html at sites\all\modules\fckeditor\plugins\linktonode

Change the seq to jquery, function, fck_link and utils.

FYR
From

	//<!-- linktonode START -->
	//source: popup.php
	function appendScripts() {
		var jquery = document.createElement("script");
		var functions = document.createElement("script");
		var url = FCKConfig.BasePath.substring(0, FCKConfig.BasePath.indexOf('modules/'));
		if (url.indexOf('sites/') > -1) {
			url = url.substring(0, url.indexOf('sites/'));
		}
		jquery.type = functions.type = "text/javascript";
		jquery.src = url + "misc/jquery.js";
		functions.src = "jscripts/functions.js";
		document.getElementsByTagName("head")[0].appendChild(jquery);
		document.getElementsByTagName("head")[0].appendChild(functions);
	}
	appendScripts();
	//<!-- linktonode END -->
	</script>
	
	<!--
	The original fck_link.js taken from FCKeditor
	Injected code is between tags: 
	!-- linktonode START -- 
	and 
	!-- linktonode END --
	-->
	<script src="jscripts/fck_link.js" type="text/javascript"></script>
	<script src="jscripts/utils.js" type="text/javascript"></script>

To

	//<!-- linktonode START -->
	var url = FCKConfig.BasePath.substring(0, FCKConfig.BasePath.indexOf('modules/'));
	
	if (url.indexOf('sites/') > -1)
		url = url.substring(0, url.indexOf('sites/'));
	
	document.write( '<script src="' + url + 'misc/jquery.js" type="text/javascript"><\/script>' );
	document.write( '<script src="jscripts/functions.js" type="text/javascript"><\/script>' );
	document.write( '<script src="jscripts/fck_link.js" type="text/javascript"><\/script>' );
	document.write( '<script src="jscripts/utils.js" type="text/javascript"><\/script>' );	
	//<!-- linktonode END -->
	</script>

Finally, it works in most latest browser (i.e. chrome, ie8 and firefox 3)