My site will list lots of community organisations (using the contacts module). I want users to be able to create an event and include a freelink to the organisation that is coordinating the event. Freelink can do this. My problem is that users will sometimes mis-type the name of the organisation. I don't want freelink to assume that the user wants a new node - I want it to ask.

So, it would be fantastic if there could be a configuration setting with three options as follows...

What to do when node title does not exist
1. Always create a new node
2. Warn the user that does not exist and it will be created
3. Create an error and tell the user that does not exist. S/he should check the spelling

Freelink looks like a very valuable module. Thanks for all your work on it.

Warm regards,
Chris

Comments

eafarris’s picture

Assigned: Unassigned » eafarris

While I like this idea, it's not possible to implement in freelinking.module without changing it significantly.

The way freelinking.module makes links currently is to scan through the text, looking for link-ish things, and marking them up with a link to freelinking/(whatever). It does not attempt to link to node/(whatever), because, to do that, it would have to scour the database looking for a title, and do that for every freelink it finds in the node body. A very expensive operation, particularly at content-creation time.

Instead, the node lookup is done 'on click,' when a user clicks a link that goes to freelinking/(whatever). At THAT time the db is searched for a suitable target, then is redirected to the appropriate actual page. This moves the expensive operation back to where it would be least noticable -- during surfing.

So, there is currently no way to know at content-creation time whether a link points to an existing target or not.

I'm serious when I say that I like the idea. I can definitely see the benefits, but I'm afraid we'd sacrifice too much to implement it at present. That said, if the code's not too much, perhaps it can be implemented via a "Resolve Freelinks during content creation" checkbox in settings, and then just taking separate paths down the code. I have a lot of more pressing things in my Next Action lists right now, but it's worth a look at least. Anyone want to cook up a patch?

rajaiskandarshah’s picture

hi,

first of all i am not a php programmer, but i do understand a little bit of sql statements.

i modified part of the freelinking.module to the following:

// FIXME ***
    while ($node = db_fetch_object($result)) { // only one, I hope... what if there's more than one?
      $nid = $node->nid;
    }
    if (empty($nid)) { // the node doesn't exist, set the path to create it
      // $nodetype = variable_get('freelinking_nodetype', 'wiki');
      // $delimiter = variable_get('clean_url', 0) ? '?' : '&';
      // $path = 'node/add/' . $nodetype . $delimiter . "edit[title]=$thetitle";
	$path = 'search/node/' . $title;
    }
    else { // else the node does exist, set the path to go there
      $path = 'node/' . $nid;
    }
  }
// FIXME ***

so that if the title can't be found, it will produce a search result page. useful for people who do not have access as a content writer.

a sample page: http://norazilaco.biz/?q=node/6708

how do i add this to the list of options in home >> administer >> settings >> freelinking configuration ?

thanks

eafarris’s picture

Status: Active » Fixed

I committed this feature, with options, to DRUPAL-4-6. Thanks, barc and rajaiskandarshah! Still to do for HEAD.

eafarris’s picture

Now in HEAD as well.

Anonymous’s picture

Status: Fixed » Closed (fixed)