I'm writing a custom handler for DraggableViews to allow Organic Groups users to order nodes within their own groups (1 node could be shared across many groups, needing a weight value for each group). I've got a table that contains the nid, og_id, and weight, and the database saves are working fine from DraggableViews. My roadblock is currently with getting DraggableViews to use my custom sort order to re-display these values.

I have accomplished this in a "hackish" way, but I want to integrate as well into DraggableViews and Views API as I can. How can I deliver my sort order to DraggableViews?

CommentFileSizeAuthor
#6 draggableviews_og.zip7.86 KBcharlie-s

Comments

charlie-s’s picture

An update for anyone that runs into this, I was thrown off by trying to implement hook_views_query_alter() within my module unnecessarily. I stumbled upon this post (http://drupal.org/node/464870) and was trying to go that route, but ultimately discovered the Views API integration I was seeking is much easier than I first thought. Simply providing the weight field as a views_handler_sort did the trick (and of course selecting this handler as my sort order in the DraggableViews display).

charlie-s’s picture

This module is complete. If anyone needs to use DraggableViews to order nodes unique to each organic group, please post a message here and I'll get the module in a sandbox project.

charlie-s’s picture

Status: Active » Closed (fixed)
Joyy’s picture

Hi csdco,
I would like to use draggable views with organic groups... I want to check this as an alternative to smartqueues for og.

charlie-s’s picture

Hey Joyy,

I will get this up @ drupal.org/project/draggableviews_og shortly and update you. Basically it stores a node's weight number per group as opposed to per node (via the cck handler) per user or per View (via the default draggableviews handler).

charlie-s’s picture

StatusFileSize
new7.86 KB

Joyy, here's the module. Installing this will give you a new block that has shortcut links to sort your nodes and also provides a default View that will use these weights.

Go to admin/settings/draggableviews/draggableviews_og to import existing nodes so that Draggableviews OG is made aware of them.

There are some typos and such with this module but it certainly does its job. When I get some free time I'll clean it up and post it properly.

Joyy’s picture

Hi csdco,
Thanks for this module! I look forward to try it out this weekend.
By the way, how do I associate the block/view into all the organic groups (existing and new).
I have OG homepage built up of Context Layout with different sets of blocks and views. Does inserting Draggable_OG View into the OG homepage (using context layout in my case) will automatically associate with all the Organic Groups (existing and new)? Also does this View has an edit draggable views order link for the OG members to be able to edit?
Thanks!

charlie-s’s picture

Once you import existing nodes into the system, you'll be good going forward; that is, new groups and new nodes should always appear within this system. New nodes are (I believe) at the top of the sort order by default until they are sorted lower.

I'm not sure I follow your last question. If you're referring to a link to the View where items are sorted, those will be presented to you in a block. You can copy those links elsewhere if you'd like, and there should be a permission setting to allow roles to sort group nodes.

kodab’s picture

Hi csdco,

Have a urgent need for this solution or similar, what are the possibilities for using in 7.x-2.0-beta1?

Many thanks!