Flag queue
Amitaibu - May 28, 2009 - 13:55
| Project: | Flag |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | task |
| Priority: | normal |
| Assigned: | Amitaibu |
| Status: | needs work |
Description
I've started playing around with the idea of flag acting similar to nodequeue, only with other objects as-well.
Here's my work so far, not much, but a start. I'll keep updating this issue as I advance.
This differs from flag_weights, by mainly two things:
1) It doesn't alter the flag's DB.
2) You (will be able to) limit the flag queue size.
Any thoughts about the concept?
| Attachment | Size |
|---|---|
| flag_queue.tar_.gz | 1.63 KB |

#1
Maybe the queue size should be in flag core, so it will be exportable as-well as other flag settings?
#2
A little different approach and a patch for flag, so this still-bare-bones module will work.
- Flag patch adds drupal_alter() to default_options, so flag_queue can add it's own options, without the need to implement a new flag type.
- Flag queue it self now has set_position() function, taken from nodequeue.
#3
btw, I've removed for now the queue size, as this can already be implemented via Rules.
#4
- Flag patch adds a new API function to get all the flagged content counts of a certain flag.
- Flag queue now acts on flag/ unflag of a content.
#5
drupal_alter('flag_default_options', $options);maybe not be needed once #435822: Implement hook_flag_alter is implemented, however until then I'll keep it so I'll be able to continue the work.#6
API is now working - when you flag/ unflag content - it's getting a position in a flag queue (if you have set your flag type to be "flag queue").
Also added Views integration (image attached).
#7
I've added an admin page that allows re-positioning the flagged content in the queue (/flag_queue/FLAGNAME)
Now I need to figure how to get a flagged content title instead of showing the fcid. I think it should be something general for flag (i.e.
function get_content_title($fcid))Please use flag-queue-changes-in-flag-3.patch from #6.
#8
Fix the re-positioning of 2 flagged content.
#9
I've added a "Shuffle" button.
#10
This version shows the title of content if it's node, user or comment; Otherwise it will show the content ID.
#11
Module is starting to get some shape :)
Now 'Flag queue' tabs are added users and nodes.
#12
First of all this a great idea. Somethimg I was looking for.
Few issues noticed.
1.In the admin the checkbox "Attach queue behaviors to the flag." is not working/saving. I checked the box and saved but next time I come in it is unckecked again.
2. I could not find a place where I define the queue size. Shouldn't that be closer to this checkbox. If you making a flag queue there itself you can define the length of queue.
#13
1. You need to apply the patch from #533424: Add hook_flag_options_alter() (create a 2.x branch). for the module to work.
2. Queue size will be implemented after #547082: Make "Trim flag" an API function goes in.
#14
I committed most of #533424: Add hook_flag_options_alter() (create a 2.x branch). and all of #547082: Make "Trim flag" an API function.
The API changes included in this issue have been moved to #576388: Additional API functions for Flag queue functionality, which needs review.
#15
So looks we got all dependencies checked in. So What would be next step?
#16
1) Add uid colum in flag queue, so flags can be ordered per user.
2) Find time to do it... ;)
#17
I want to help out to the extent I can. But I am newbie so please bear with my dumb questions.
Looking at the new "flag_trim_flag", it is operating on flag_content table which already has uid column. So as far as I understand flag queues work on existing flags and not necessary on seperate data structure called as flag_queues, am I correct? flag queues are more about storing metadata about queue, correct?
Is there 1x1 relationship between flag_content and flag_queue?
If yes, I am wondering why can't we leverage existing UID column? What is the use case you see where you will need to access flag_queue table per user basis? Since from user visibilty perspective (ordering flags by users) it is flag_content that needs (and already has) UID.
#18
Any additional tables that flag_queue needs should be using the "fcid" column to reference the data in flag_content. After #405588: Some methods could return 'fcid', it should be easy to access this fcid during any flag/unflag operation, since it's passed along after flag does it's initial insert/delete operations.
#19
flag_queue table already has fcid. So do we still need uid?
#20
No, you can figure the uid from the fcid. Where is this flag_queue module anyway? I'd be able to more accurately answer the question if I could look at the code.
#21
> No, you can figure the uid from the fcid.
Of course, what I meant is flag_queue should have also it's own UID column to indicate who did the sorting. So 5 best comments on the site, that were flagged by different users, can be re-ordered per user - but this might wait for finishing the current work. I'm working on OG7 right now #567840: Upgrade to Drupal 7 , so it might take me a little time to get back to this
> if I could look at the code.
It's in #11 - but as stated, needs some more work.
Worth mentioning, thought, that I talked with sevi about draggableviews which seems to be able to solve re-ordering issues, in a very interesting way - however it lacks a simple API to be able to reorder content.
#22
@Amitaibu
>but as stated, needs some more work.
Could you please elaborate what is still needed so if it is in my capability, I can try to help?
#23
In testing this module, I received the following error when visiting /flag_queue/FLAGNAME.
Fatal error: Call to undefined function flag_get_flag_counts() in [...]/modules/flag_queue/flag_queue.module on line 30When reviewing the flag edit page, it looks like this setting isn't being saved (i.e., checkbox is always unchecked).
In my case, I am also using Draggable Views, and have a rule to keep the flag trimmed. Perhaps there is a conflict. I'm happy to help test this further once you take up development again.
All I'm trying to do is reverse the default trim behaviour so that it removes the last added flag, rather than the oldest flag.