open clicking the "linktomenu" icon, the dialog open, i see the loading animation, and then get an error-dialog saying
Error on retrieving data from module.
TypeError
elemname has no properties
I already did deactive the devel module to make sure we got no error output confusing the linktomenu plugin.
Checking the transfered data with wireshark I found we get the following result:
{ "menus": { "1": { "root": true, "mid": 1, "path": "", "title": "Navigation", "hasChildren": true }, "2": { "root": true, "mid": 2, "path": "", "title": "Primary links", "hasChildren": true } } }
When trying linktonode I also get an error:
Error on retrieving data from module.
SyntaxError
syntax error
haven't yet found the data we get as response here ...
any hints what's going wrong?
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | linktocontent_bugfix.tgz | 5.82 KB | stborchert |
Comments
Comment #1
stborchertThis looks as it should.
Did you try version 5.x-1.4? Version 5.x-1.x-dev is quite old.
greetings,
Stefan
Comment #2
ray007 commentedYes, I did use version 1.4 - didn't even know there was a 1.x-dev version too ;-)
Comment #3
ray007 commentedUpdate: the module doesn't work with jquery 1.1.2 - downgrading to 1.0.4 (as shipped with drupal 5.1) makes it work again.
Unfortunately I need a new jquery library for other stuff on my site ...
Comment #4
ray007 commentedUpdate 2: jquery 1.0.4 makes linktomenu work, linktonode still gets the same error.
Comment #5
stborchertHi.
Argh, I don't know where these errors came from (it worked before I created the release).
Whatever, please try the attached files (or use the patch within the archive) and don't forget to empty the browser cache (you can call the js-files directly in your browser to reload them).
Hope this is working now (worked with jQuery 1.1.2 for me).
Comment #6
ray007 commentedI'm sorry, but no luck so far. At least not with linktonode, linktomenu now also works with jquery 1.1.2.
Comment #7
stborchertHm, I tried with different systems and browsers and both worked fine :-[
What is your error message? Still "syntax error"?
Comment #8
ray007 commentedyes, still syntax error.
and I still can't find an answer from the server with the protocol analyzer.
otoh, there are lines in the apache log suggesting a http 200 return code, which would mean 'all ok'.
maybe a timeout problem because I have too many nodes?
seems it's giving up after about 12 seconds ...
Comment #9
stborchertHm, strange. I tried with about 10.000 nodes and about 1.000 categories (created by devel.module) and never had any problems.
Could you please try this file: http://drupal.org/files/issues/ltc_1.html
(You have to edit it and insert the url of your drupal installation).
If you don't change "vocabulary-id" and submit the form you should see the results that are sent to the plugin the first time you open it. Perhaps its not well-formed.
Comment #10
ray007 commentedIn your html-file the vocabulary id is prefilled with '0', while the linktonode dialog seems to initialize this parameter with '-1'. In both cases I get an empty result.
Once I change that parameter to '1', I do get a result:
other valid vocabulary ids work as well.
Comment #11
stborchertYou're right. -1 is the initial param.
Looks good.
Now the big question: where's the error?
linktonode/functions.js
Try to replace this with
Perhaps we now get a line number.
Comment #12
ray007 commentedHmm, that didn't really improve things.
Now the error message is just "Error: error".
The problem is the empty response which makes
in line 58 fail.
Comment #13
stborchertOn setting vocabulary-id to -1 (see comment #10) do you get an empty result or
{ "categories": { }, "nodes": { } }?At least "categories" must contain an entry (the root vocabulary).
Comment #14
ray007 commentedempty - nothing at all
Comment #15
ray007 commenteda bit debugging tells me function linktocontent_node_get_data() doens't return.
I don't reach the end of the
while ($nd = db_fetch_object($nodes)) { ...loop, but only checking the nid-results and not loading all the nodes does show a sane (but quite big) result.Haven't yet tested it, but I assume changing _linktocontent_node_query_nodes() to directly get more node-properties instead of doing a node_load() for each node in the result set may help things ...
Or limit the size of the result set, or ...
Comment #16
stborchertHm, ok. How many (uncategorized) nodes do you have?
A quick hack could be changing linktocontent_node.module.
function _linktocontent_node_get_nodes(...)line 200:and
function _linktocontent_node_query_nodes($tid)line 250 toIt loads the data directly from the database (unfortuantely without running load-hooks from other modules). I couldn't test it yet but it should work.
Btw., linktonode/jscripts/dropdown.js has a small additional bug. Change lines 35-40 to:
Otherwise nothing happens if you select a category.
hope this works,
Stefan
Comment #17
ray007 commentedHow many nodes? Didn't count them but a rough estimate from printing out the node-ids in the loop I'd say it's a 4 digit number ...
Will try to test your fix a bit later today.
Comment #18
ray007 commentedWell, with your changes we're a step further now:
The call for linktonodes now returns with a result, the category selection box is filled, but unfortunately it didn't return any nodes.
After modifying the $sql sting on line 250 to also select n.type I now do get nodes in the result.
It's still unresponsive because I have too many nodes, I probably need a pager.
Note 1: I've been told one should enter the fields to select in a query in the same order as they are in the table for better performance. If this is true the query string on line 250 should be a bit re-ordered.
Note 2: Probably related to my many nodes - changing the category selection box to some value does _nothing_ here ... no change of selection, no ajax request, nothing.
Note 3: maybe it would make sense to also have a select box for the type of the node?
Comment #19
stborchertArgh, forgot this.
Is planed for 6.x (http://rikrikrik.com/jquery/pager/ -> I modified it once to work with browsers history).
Did you try this? Makes sense (at least a little).
Did you change linktonode/jscripts/dropdown.js as suggested in comment 16 (don't forget to clear browser cache or cal the file directly in browser)?
linktonode/jscripts/dropdown.js #35
I plan to add a table filter. So you can filter for name, author, date, etc.
Probably grouping by type (typename as heading + collapsible rows) would make things easier?!
Uh, a lot of work :-)
Comment #20
ray007 commentedUh, yeah, sorry, had forgotten the js-file.
After that change things now work, though a bit surprising:
Choosing a vocabulary gives me the names of the terms in it in the document selection area ... is this as planned?
Selecting a term in the select box then gives the correct selection, un-selecting the term again (and having the vocabulary still selected) brings up again the selection of all nodes.
And the main point about paging is not some nice jquery magic for the display, but to only return a limited result set and get the next page with a new ajax request.
I'll try to take a stab at it if I find time, currently I still get the browser warning about unresponsive script, so it's not yet at a stage where a user can use it on my site.
Note: in the medium term it may make sense to not create select-statements in the module, but use views and the views argument api?
Note 2: I guess your fixes to the javascript and the changed sql query warrant a new release (or maybe just cvs checkin). Haven't yet checked if you already did since some ****** cvs admin made some monster commit on drupal.org so I can't the what modules have changed.
Many thanks for your help and the great work your doing here!
Comment #21
stborchertIf you've checked "term" on
admin/settings/linktocontent/linktocontent_node. Otherwise its an error.All content type you've selected (terms, pages, stories, etc.) should be shown (don't know which order).
You're right. That would reduce the load time remarkable.
This is on my ToDo-list for 6.x. With the new version of drupal you can define the output type of a page (JSON!) so we can build a view and send it as JSON directly to the plugin. Then we get paging for free :-)
Haven't done this yet but will do today.
Guess this was Derek (dww) removing the version string from all info-files ;-)
Comment #22
ray007 commentedOk, I had been wondering about "Term" on that settings page since I didn't have a content type "Term", but unchecking "Term" there now gives me an empty selection once I select a vocabulary.
Wishlist: all nodes tagged with a term in this vocabulary?
Maybe drupal 6 (or the views module for drupal 6) will have a json plugin for views, but this is possible today. I.e. the KML and the georss modules return their special xml format for view with those types.
But it's not even necessary that the views-module return the json string, we could use views to just get the list of nodes (with fields) and then format the json string ...
A quick search on drupal.org brings me to http://drupal.org/project/views_json ;-)
Comment #23
stborchertCommited to cvs and created a new release (hope I did not forget anything).
I see... I see some new feature requests coming... :-)
Two weeks from now my final exams are completed and after that I'll have more time to code.
Comment #24
stborchert