Closed (fixed)
Project:
Node Order
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
28 Nov 2006 at 08:44 UTC
Updated:
8 Jan 2009 at 19:28 UTC
Jump to comment: Most recent file
Nodeorder should use whatever hook to get the field sortable using views so that sorting is possible for list views and such.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | sortcriteria.png | 10.17 KB | marcp |
| #18 | views_taxonomy_inc.patch | 943 bytes | marcp |
| #2 | views_nodeorder.inc.txt | 989 bytes | petterw |
Comments
Comment #1
webavant commentedI guess I am requesting this module act more like the weight module, which does not have the move up/down capabilities that nodeorder has.
Comment #2
petterw commentedI've put together a views include file that adds nodeorder as a sort criteria.
Drop it in your views/modules folder. I had to wipe my views installation completely for views to pick it up http://drupal.org/node/64165
Instead of being implemented as a views include I assume this code could be added as a patch to nodeorder.module directly.
Comment #3
webavant commentedYes! That is awesome! You are awesome!
Comment #4
webavant commentedHmm... I added the include and wiped the views module completely, but nodeorder is not showing up in the sort criteria for views.
Comment #5
webavant commentedhmmm... I can't get it to work. Shouldn't there be a require statement somewhere to pick it up? Where is the nodeorder_views_tables() function called?
Comment #6
bonobo commentedAt first glance, this feature request doesn't apply to this module -- the nodeorder module allows for drag and drop ordering of nodes within taxonomy terms -- you can use this module to specify the order in which nodes display within taxonomy terms -- I'm not entirely clear how/what you would want to expose to views -- can you be more specific?
In the meantime, until this is clarified, I am marking this "by design."
Comment #7
bonobo commentedI just re-read the thread, and I think I get it now --
whoops!
You want the ability to sort nodes that appear within views, in addition to within taxonomy terms -- got it.
I'll check this out.
Comment #8
petterw commentedIf done correctly you should get a "Nodeorder: Order of nodes" option in your views "Sort criteria" > "add criteria" drop down.
is the views_nodeorder.inc in the modules/views/modules folder together with the other include files? (note the file should not be saved as a txt. The txt file ending is something that is added when uploaded here)
My views picked up the new up sort criteria fine. Only problem was when I made changes to the include. Had to wipe my views tables clean (as mentioned earlier) to pick up the changes. Assume some chaching going on!?
nodeorder_views_tables is a hook that interface with views.module. All correctly named files in the views/modules folder are called/included by the views.module. See the views api http://drupal.org/node/42609
I hope that was enough clues for you to get it to work.
Comment #9
webavant commentedHope that works... I placed the file in /modules/views, not /modules/views/modules.
Comment #10
marcp commentedFolks - I have just committed a new version of nodeorder.module to CVS that incorporates the patch into nodeorder.module. I made just a couple small changes to kenandi's patch. Please test it out and set the status to "fixed" if you are satisfied. Thanks for everyone's interest in nodeorder.
-------
http://www.funnymonkey.com
Tools for Teachers
Comment #11
marcp commentedPS - I put the code in nodeorder.module per webchick's advice in this comment: http://drupal.org/node/42609#comment-146021
Comment #12
petterw commentedUnfortunately it breaks if the same node exists in two different orderable categories since it just picks out the weight_in_tid based on nid independently of tid.
After a quick look though I came across another problem with the module:
If image a,b,a are all assigned to both taxonomy-1 and taxonomy-2 only their order in taxonomy-1 is saved. Their weight_in_tid value in the db for the second entry of any of the image nodes stays 0.
Haven't had time yet to investigate it properly but does this make sense or is it just my system?
If it's a bigger problem with the node we should try and fix that first I guess, otherwise I'll give the views a bit a go within the next couple of days.
Thanks btw. marcp. for putting together the module in the first place.
Comment #13
marcp commentedSee the suggestion in my comment here -- http://drupal.org/node/98584#comment-157899 -- for a quick workaround to the "node in different categories" bug. If that doesn't fix your problem, then follow it up in that issue's space. Let's keep this issue around for the Views integration.
Thanks!
Marc
Comment #14
gmak commentedWhether I add this as an include file (in modules/views/modules) or paste the code directly into nodeorder.module, I get really strange results. I'm using node order to arrange a series of images that are then called into a page via an inserted view.
1. In the sort criteria field within Views I get four items saying "nodeorder: order of nodes"
2. If I select one of the above as the sort criteria for the view, I get multiple copies of the same image being shown in the view. I can't see what logic they are being pulled in.
I've tried clearing the cache (sometimes helps to get views working properly), but nothing seems to help.
Any suggestions?
Comment #15
marcp commentedgmak - if you get the latest code, you should see "Nodorder: Order of nodes in YourVocabularyName" in the Sort Criteria. So that is a good thing.
The bad thing is that there is still a bug in the way Nodeorder interacts with Views. It really doesn't make sense to say "Order of nodes in SomeVocabulary" because the nodes may appear in multiple categories within a Vocabulary. So, really, what needs to happen is that the Sort Criteria should allow you to set the "Order of nodes in SomeTerm" where SomeTerm is any term that's in an Orderable vocabulary. That fix will require some new code.
As for now, sorting integration with Views is just plain broken...
Comment #16
marcp commentedHere is my latest attempt. I am hoping there is a way to do this without having to add code to views_taxonomy.inc.
First thing to do is to remove the views hooks in nodeorder.module (nodeorder_views_tables, nodeorder_views_arguments, and nodeorder_views_default_views). Next, you need to add the following lines to views_taxonomy.inc in your modules/views/modules directory on line 31:
Let me know what you think....
Marc
Comment #17
gmak commentedDoing the steps suggested above (modifying the views_taxonomy.inc), I get nothing showing in my Sort Criteria that has any reference to nodeorder.
Any other possibilities?
Comment #18
marcp commentedHere is a patch for views_taxonomy.inc just to make sure that the code gets in there properly. Again, if you have the latest nodeorder.module, remove the functions named nodeorder_views_tables, nodeorder_views_arguments, and nodeorder_views_default_views. I will remove those functions from the checked-in code in the next couple days.
Also, you may want to clear your cache file. You should see the following as one of the options in the Sort Criteria when creating a View:
Nodeorder: weight_in_tid
Comment #19
marcp commentedHere is a screenshot of the sort criteria option you should see... Let us know.
Comment #20
gmak commentedStill not getting anything showing up. I've cleared the cache, installed the patch, etc.
I'm using:
Views 1.159.2.18 (2006/12/03)
NodeOrder 1.5 (2006/12/01)
Is there a version problem?
Comment #21
marcp commentedGeoffrey,
Contact me via http://drupal.org/user/20885/contact and let me know how to get in touch with you. I think we'll better be able to work this out offline. I'm not sure what could be going on if you've got the Views and Nodeorder modules both enabled, removed the views_* hooks in nodeorder.module and have applied the patch attached to comment #18.
Marc
Comment #22
webavant commentedI haven't tried the most recent patch in this thread, but I've had success just sorting by nodeorder and all with a single vocabulary term. The problem I am posting about is a javascript error in IE. Works fine in FF.
Error: 'title' is undefined.
The error is in column 390 (bolded text) of this line:
I haven't tried fixing it yet, but at first glance, the reason for the error has not become apparent.
Comment #23
webavant commentedMy source formatting got screwed up... Apparently the comment engine does not parse tags inside of tags... Here it is without the tags:
This code appears at column 390 on that line:
$(title).classNameAnyone know why that wouldn't work in IE?
Comment #24
webavant commentedHmm... I just remembered that this is a spajax issue, not nodeorder.
Comment #25
webavant commentedActually there is a problem with nodeorder using the SPAJAX module. Nodeorder attempts to sort the objects contained in an object with ID "title", but that container object does not exist. Module needs to wrap the items inside a
Comment #26
webavant commentedIt appears that the container exists, but it's ID is not 'title'... it's
Comment #27
webavant commentedOK I was able to at least make the sorting work, although there is a new error, it does not seem to change the functionality.
In nodeorder.module change 'title' to 'node-order-list'.
Comment #28
webavant commentedhmm.... I suppose I should have created a new issue instead of all of this spam. Feel free to delete my last few posts from this thread.
Comment #29
pvanderspek commentedVersion 5.x-1.2 has functionality to make the field accessible for the Views1 API, and version 6.x-1.x-dev integrates with the Views2 API.