Hi,

First thanks for the very good work done on rc5, especially WYSIWYG support :)

Now I would like my users to have a WYSIWYG button to select a node in an autocomplete form and then insert in the textarea the title of the node, linked to the node : tag is [#NID]

It works well with "Create the taglist using a content type" but I would like to have all the content types. It works well with "Create the taglist using a view" but not for a basic view including all the published nodes. Maybe that view has too many results, hitting a hidden limit ?

I'd prefer to have a third option for the creation of content types, like "Create the taglist for all nodes" which would save lots of queries. Is it doable ?

Thanks for reading

Comments

Roi Danton’s picture

Title: create taglist for ALL nodes ? » Create taglist for ALL nodes

A standard view should do it, you even need no view fields or a different display than "standard". Just make sure to set Items to display/Items per page: Unlimited since the view result array contains the first page (if pager is activated) only. The view I use for testing:

$view = new view;
$view->name = 'nodes';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Standards', 'default');
$handler->override_option('filters', array(
  'status_extra' => array(
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'teaser' => 1,
  'links' => 1,
  'comments' => 0,
));

Regarding the feature request: The option "Create the taglist using a content type" should be expanded to "Create the taglist using content type(s)" so you can select more content types.

guillaumeduveau’s picture

Title: Create taglist for ALL nodes » Limit with autocompletion widget and large nodes number

Hi Roi, thanks for your answer. Before posting that issue I tried with a simple view like the one you posted, and I just tried with your view code but it doesn't work.

It does not work with the autocompletion widget, however it works with the dropdown list.

Roi Danton’s picture

Category: feature » bug
Status: Active » Needs review
StatusFileSize
new661 bytes

Maxlength of the autocomplete form was set to 512. I have increased it to 8192. Please test if the patch solves your problem. Normally maxlength sets the amount of characters allowed in a textfield but I have no other reason found yet that could cause a limitation - so the patch is a guess in the dark.

Roi Danton’s picture

Status: Needs review » Active

The patch from #3 has no effect as expected. Also I couldn't reproduce the problem yet, using more than 500 nodes. How many items your view returns?

guillaumeduveau’s picture

Component: Taglists (ex buttons API) » Code (general)

Hello Roi, the view returns 1306 nodes. But it could be a really larger number (number of published nodes) on big sites, so I don't think a view is OK for performance here in that particular case ?

Roi Danton’s picture

When using the autocomplete widget and you want your users to be able to embed all of your nodes then all nodes have to be in the view even if your site has 1000000+ nodes - otherwise only a part of nodes can be selected. With 5000 nodes the performance should be okay. You just have to wait a little after entering a string.
I didn't do tests with 50000 or 500000 nodes. However in those use cases it would be meaningful to create a node view per year or divide them by categories or similar. So for each year you can create a taglist with the corresponding view.

Have you verified the bug with the autocompletion limit? I've created 2000 nodes and can select all of them with autocomplete.

Roi Danton’s picture

Component: Code (general) » Taglists

so I don't think a view is OK for performance here in that particular case ?

A view does not need more performance than my custom functions if this view contains no fields. However what also requires much performance is the script for the autocomplete form. I'm using strpos() to determine the matches, see linodef_taglists_autocomplete() in includes/pages.inc.

Any update regarding the limit issue?

guillaumeduveau’s picture

Category: bug » support

Hi Roi, sorry for not answering sooner. I tested with 1500 nodes both on a fresh Drupal install and a local copy of my website, and it works. So I have a problem somewhere with my production server... you can close that issue !

Roi Danton’s picture

Status: Active » Fixed

Okay, thanks for replying! I mark it as fixed so - if somebody detects similar problems - it is visible in the issue queue for a while.

Status: Fixed » Closed (fixed)

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