I see the picture on the project page. How do I do that?

Is using Flag Weights to let users organize their flagged content as in the picture there actually possible as it is now?

CommentFileSizeAuthor
#3 draggableviews.inc_.patch1.58 KBlyricnz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lyricnz’s picture

Well, I've done it here (the screenshot is real), but it currently requires hacking Draggable Views to accept weights in non-CCK fields. I haven't had time to come up with a clean way to do this, but the maintainer of that module has expressed an interest in adding this support when I do.

See #317400: Support non-CCK weights.

OneTwoTait’s picture

Darn... I can't really "hack" anything.

lyricnz’s picture

FileSize
1.58 KB

Well, here's my hack to draggableviews.inc, though if you can't code, it's not going to help you too much. I didn't want to build any flag-specificness into the hack, so the patch lets other modules do the actual save, via a hook_draggableviews_save_hierarchy($view, $info).

Then, in your own module, you need to implement this. Something like:


/**
 * Implementation of hook_draggableviews_save_hierarchy().
 * Used to save the reordered list of flags from Draggable Views module.
 */
function robots4everyone_draggableviews_save_hierarchy($view, $info) {
  // If this is not our save, return
  if ($view->field['weight']->table != 'flag_content') {
    return;
  }
  if ($view->relationship['flag_content_rel']->options['flag'] != 'wishlist') {
    return;
  }

  // Determine which flag to use TOOD: use view relationships to ...?
  $flag_name = $view->relationship['flag_content_rel']->options['flag'];

  // Look up flag-name to find a fid
  $flag = db_fetch_object(db_query("SELECT f.* FROM {flags} f WHERE f.name = '%s'", $flag_name));
  // TODO: check for errors

  $account = $GLOBALS['user'];

  // dsm("Info: save this information: ". print_r($info, TRUE));
  foreach ($info['nodes'] as $nid => $values) {
    flag_weights_set_weight($flag->fid, 'node', $nid, $account->uid, $values['weight']);
  }
  return TRUE;
}

Sorry, I don't have time to explain much more than that right now!

lyricnz’s picture

Status: Active » Fixed

Support for this is in the -dev versions of both this module, and Draggable Views (you need the -dev versions of both).

jjbarrows’s picture

hi,
i've installed the -dev veriosn of both, but now the drag handles have vanished.
(i did have draggable flag'ed lists before, using draggable table, filtered by flags and flag users, but something changed recently and drupal crashes when a user tries to log in)
-joseph

lyricnz’s picture

Sorry, I have no idea. I have had reports of success from other users. If your Drupal install is crashing you may have bigger problems than these module.

jjbarrows’s picture

there were much more major problems with the drupal install, but yeah! i have fixed them now.

thanks for the great module! i love it
-joseph

looplog’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Status: Fixed » Active

I've reopened this issue rather than open a new one as my issue is the same and the actual documentation issue remains unfixed. After trying for a couple of hours to get draggableviews to work with flag weights I've reached a dead end. I tried the steps listed in the draggableviews issue queue as follows:

- enable Flag + Flag Weight module
- create a new Flag (eg "cool stuff"). tag some nodes with it.
- clone the Views created by flag module, change it to Draggable Views, and add the Weight field from the relationship. Sort by this field.

This does not seem to work. If somebody who has this combination working could post some detailed step by step documentation it would be greatly appreciated. In particular, the instructions above do not detail what to place in the draggableviews style settings.

lyricnz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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