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?

AttachmentSize
flag_queue.tar_.gz1.63 KB

#1

Amitaibu - May 28, 2009 - 22:00

Maybe the queue size should be in flag core, so it will be exportable as-well as other flag settings?

#2

Amitaibu - June 10, 2009 - 16:49

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.

AttachmentSize
flag-options-alter.patch 623 bytes
flag_queue.tar_.gz 1.55 KB

#3

Amitaibu - June 10, 2009 - 16:56

btw, I've removed for now the queue size, as this can already be implemented via Rules.

#4

Amitaibu - June 11, 2009 - 09:09

- 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.

AttachmentSize
flag-queue-changes-in-flag-2.patch 1.37 KB
flag_queue.tar_.gz 1.82 KB

#5

Amitaibu - June 19, 2009 - 22:02

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

Amitaibu - June 21, 2009 - 13:17

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).

AttachmentSize
flag-queue-changes-in-flag-3.patch 2.26 KB
flag_queue.tar_.gz 2.56 KB
Snap1.png 12.84 KB

#7

Amitaibu - June 21, 2009 - 16:34

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.

AttachmentSize
flag_queue.tar_.gz 3.61 KB
Snap2.png 14.28 KB

#8

Amitaibu - June 22, 2009 - 09:14

Fix the re-positioning of 2 flagged content.

AttachmentSize
flag-queue-changes-in-flag-4.patch 2.26 KB
flag_queue.tar_.gz 3.77 KB

#9

Amitaibu - June 22, 2009 - 16:41

I've added a "Shuffle" button.

AttachmentSize
flag_queue.tar_.gz 3.84 KB

#10

Amitaibu - July 9, 2009 - 16:13

This version shows the title of content if it's node, user or comment; Otherwise it will show the content ID.

AttachmentSize
flag_queue.tar_.gz 4.17 KB

#11

Amitaibu - July 13, 2009 - 10:17

Module is starting to get some shape :)
Now 'Flag queue' tabs are added users and nodes.

AttachmentSize
flag_queue.tar_.gz 4.72 KB

#12

ajayg - August 16, 2009 - 19:59

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

Amitaibu - August 17, 2009 - 08:00

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

quicksketch - September 13, 2009 - 22:59

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

ajayg - September 14, 2009 - 15:52

So looks we got all dependencies checked in. So What would be next step?

#16

Amitaibu - September 14, 2009 - 15:56

1) Add uid colum in flag queue, so flags can be ordered per user.
2) Find time to do it... ;)

#17

ajayg - September 14, 2009 - 21:02

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

quicksketch - September 14, 2009 - 21:36

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

ajayg - September 15, 2009 - 04:17

flag_queue table already has fcid. So do we still need uid?

#20

quicksketch - September 15, 2009 - 04:41

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

Amitaibu - September 15, 2009 - 06:26

> 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

ajayg - September 15, 2009 - 13:45

@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?

 
 

Drupal is a registered trademark of Dries Buytaert.