Module: Upload Approval Queue

Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Thu, 2013-11-21 16:56




ADMIN EDIT: MODULE TEST FOUND HERE



If you can develop a module, I'll pay you for it. The catch is that I need it within a month. Reply with you can do it.

Thanks,

Chris

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-11-21 22:49

What exactly are you looking for? There is also a forum for requests like these as well - Services

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Fri, 2013-11-22 20:21

I need to make all uploads go into an approval queue before they are visible in the album. I don't mind posting it in the other forum, but do you do module development? Is this something you could do?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Fri, 2013-11-22 20:56

I think you may be able to accomplish this with a hidden album that has 'add' for everyone, but not 'view' except for admin. Then you could use the 'organize' module to move the approved photos to the appropriate album. I remember seeing a suggestion of something like this before, I'll have to dig around and see if I can find it.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Fri, 2013-11-22 21:04

I played around with that, but it frustrated a lot of people. Uploads are available to the general public. Maybe I didn't do it "right"?

It has to be as simple as clicking "Upload", finding their file, and then clicking "Submit". Once I start asking them to upload to one album but show pictures in another... they will just get frustrated.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-11-22 21:10

To get this right a very detailed use story is needed.
go into an approval queue before they are visible in the album is vaugue at best.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Fri, 2013-11-22 21:18

I thought it was pretty descriptive, but I'll try to be more specific... There may be a better way to do this than what I spec out here.

Someone registers on the site. They then upload a photo. Perhaps they can see their photo, perhaps they just get a message saying their photo will be available once it has been approved. Either works fine for what we're doing. In the admin interface, there is a page with all the recent uploads that are awaiting admin approval. Next to each photo is a button/checkbox/whatever to either approve or reject the photo. An admin goes through and determines what gets approved and what gets rejected. Approved photos go into the public album for anyone and everyone to see. Rejected photos can either be deleted or put into a private folder only admins can see.

The goal of this is to eliminate pornographic content on what is a family friendly image gallery. The last time I turned the site on, it got a lot of traffic. I can't have pornographic content visible on there.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2013-11-23 00:12

Let's start the dialog then:

Module thought process:

1) Disable uploads to the public
2) On the sidebar, have an 'upload item for approval' (this can be displayed in each album for example so you know where the item is supposed to reside once approved)
2a) Does the user need to be registered to upload, or can guest upload as well? (should this be an option?)
3) The upload an item for approval 'hides' in an album that is -not viewable- to anyone
4) Add an option at the bottom of the item (in the hidden album) that allows admin to 'approve' it (therefore moving it to the appropriate album)

Further notes:

1) 'Add' must -not- be enabled for 'live albums' to the registered users
2) 'Add' must be enabled for the 'Approval Queue' album
3) 'View' must -not- be enabled for the 'Approval Queue' album

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Sun, 2013-11-24 17:02

That sounds like the right approach to me.

Users MUST register to upload. There should only be one album that users can see, whether they log in or not, and that is the album that contains the approved images. If there needs to be different albums to make the approval process work, that's perfectly fine as long as there is no option for people to click on an album and "get lost". It seems ridiculous, but it has happened.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-11-25 03:34

Just about done with the framework...

The module will provide a sidebar block that will have an 'upload for approval' button that will allow the user to select the photo(s) they want to upload
- The button will only show for registered users
- will show in each album the user has view access to
- this way if you have multiple albums, and a user wants to upload to a specific album, they can (even though it will go in to the approval queue album until approved)
- The uploaded photo(s) will be uploaded to the 'approval queue' folder which will only be visible to the admin of the gallery
- The admin can browse in the 'approval queue' folder and for each photo, an option will be provided to approve the photo
- Once admin approves a photo, it is automatically moved to the album from which the user original uploaded to (even though it went in to the approval queue album)

Does this sound about right and makes sense?

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-11-26 00:57

That sounds great! I'm anxious to see the first beta and give it a test run!!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-12-02 03:09

I think I have everything wrapped up for the initial release...

All admin/install stuff completed...

Testing out final and should release tomorrow.

Sample screenshots to follow

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Mon, 2013-12-02 03:22

That's great news! I look forward to testing it out!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-12-02 03:38
 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Mon, 2013-12-02 03:46

Epic! That looks great!!! This will be a huge help!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2013-12-02 03:50

Give it a shot, remember, this is -initial- (If anyone looks at the code, I hope your eyes bleed! I joke... remember, I'm not a coder!)

Approval Queue Module

 
punctuation

Joined: 2012-12-11
Posts: 37
Posted: Tue, 2013-12-03 03:17

Suggestion to add input fields for title, description, tags before upload. And input field for comment/message to the admin.

____________________________
Gallery 3.0.8 | Clean Canvas theme

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 03:52

Good suggestions. I'll see what I can do for the next update, once this gets tested a bit and confirmed working well.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 16:11

I got it installed and running. It looks great! The only issue I have is that, as a regular user, I can't seem to get the upload window. As admin, it pops up and everything is fine. Maybe I'm doing something wrong?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 16:15

Good catch - fix will be up in a sec, along with some minor changes.

Added ability to add description and comment for admin on upload form (tags may come later, but I don't want to redo the form (which I have to) right now until all is tested)

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 16:31

I got v2, but still can't get the upload for regular users. I can see the extra fields when I upload as an admin. Those are great!!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 16:34

Okay, v2 uploaded give this a shot

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 16:36
Digitizit wrote:
I got v2, but still can't get the upload for regular users. I can see the extra fields when I upload as an admin. Those are great!!

I jumped the gun - look up and get the v2 there...

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 16:39

The link to upload has not completely disappeared for regular users. Admin can still see it and it still seems to work.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 16:50

Hmmm, hold one...

Think I may have missed something

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 16:54

Right. As an admin, I see it all. If I open a different browser and log in as a normal user, I don't see the upload link. I did see it with v1, but when I clicked it, it never gave me the upload window.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 18:55

Allrighty, let's give this a try:

v3

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 19:06

That worked! I can now see it as a regular user and the link opens the upload dialog. The upload worked, but the dialog box did not close. That's not the biggest deal, but I think it will confuse people.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 19:08

Also, I just noticed, when I approve the photo, the dialog box that comes up is blank. I assume I can just move the photo from that album into the main, which isn't a problem.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 19:13

Ah, okay... I see what has happened on the upload. It actually wants to download the .json file that says "success" after it successfully uploads.

Also, the admin approval appears to be working now. I must have had something stuck in cache.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 19:13

Hmmm, shouldn't be blank, and no, don't just move it... it will confuse the database later

On both dialogs it's not returning to the album? And on the approval dialog, it's blank?

What browser are you using? I can't reproduce this.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 19:18

Sorry, I posted that before really trying everything on my side. I got the approval working. It does everything it should. It's great!!! That worked beautifully.

The only issue I can't get around yet is Chrome (and IE) prompting to save the .json file that is the success message.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 19:27

Hmmm, I can't reproduce that in IE or Chrome. Once uploaded, it refreshes back to the album with a success message up top saying "Added One photo for approval."

I've tested in Safari, Firefox, IE and Chrome. (The success json is just like all other dialogs, so I'm not sure why that's happening to you)

If you're familiar with the database, try emptying the 'caches' table...

Also, have you turned on error_reporting? If you don't know the answer, don't worry about it.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Tue, 2013-12-03 19:34

Perfect! That did the trick! This is REALLY going to help out. Amazing work!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-12-03 19:43

Good to hear! Please keep me posted on it's use and effectiveness... I sort of rushed out some things in this, and it's ugly, ugly code... I'll spend more time refining it once I know it's working well.

Thanks!


Dave. if you're reading this, can you create a codex page? Thanks, James

 
punctuation

Joined: 2012-12-11
Posts: 37
Posted: Wed, 2013-12-04 21:26

I tested the module today. It' not working for me.

Have same problems as Digitizit mentioned:
- The upload worked, but the dialog box did not close.
- when I approve the photo, the dialog box that comes up is blank.

Do we need to specify Album where will approved photos go?
I deleted Approval-queue album, and deactivated modul, then activated modul, and approval-queue album does not appear. I can still upload a photo, it looks like that is working, but where the hell is it? :-) Where is uploaded photo? :-)
I think I broke it.

While it was still working, when I go to Approval-queue album and click on a photo, title and description doesn't show up. Same for comment for admin.

____________________________
Gallery 3.0.8 | Clean Canvas theme

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2013-12-04 21:43

Make sure you grabbed the latest version a few posts up (v3)

I'm not able to reproduce any of the issues you've mentioned.

If you're logged in as admin, and there is an issue with any of the settings, it will automatically take you to the admin page to have them fixed for you.

If you're using v3, try emptying the cache table in the database. For some reason it seems if you had an older version installed, it cached those pages and doesn't pull the new ones.

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Wed, 2013-12-04 21:46

One thing I had to do, and it could just have been me, was toggle the permissions off and on again. I did that first thing, and everything after that was good.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-12-05 01:31
jnash wrote:

Dave. if you're reading this, can you create a codex page? Thanks, James

http://codex.galleryproject.org/Gallery3:Modules:approval_queue
I have yet to try it out. Just moved so renos and unpacking still.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-12-05 05:10
floridave wrote:
jnash wrote:

Dave. if you're reading this, can you create a codex page? Thanks, James

http://codex.galleryproject.org/Gallery3:Modules:approval_queue
I have yet to try it out. Just moved so renos and unpacking still.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

Thank you kind sir!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-12-05 14:33

v4 uploaded - only to fix an initial install bug fix. No need to upgrade if you have it installed already...

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2013-12-05 20:03

Found an issue with permissions settings on some installs - reworking and will send up new version soon.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Fri, 2013-12-06 03:27

okay, v5 - initial release

If you've installed this previously, you should upgrade for sure to this version...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-12-06 14:50

Finally got round to looking at this.
Coding looks fine and you have done some stuff that is impressive so don't kid yourself.

When I tried to activate the module (5) for the first time I got a error and the checkbox on the modules page would not stick.
I think it is this bit of code:

    $db = Database::instance();
    $table = "appqs";
    $query = "SHOW TABLES LIKE 'appqs'";
    $result = $db->query($query)->count();
    if(empty($result)) { 
      message::error("ERR [approvalqueue]: APPQ database does not exist!");
      if(identity::active_user()->admin){
	url::redirect("admin/approvalqueue");
      } else {
	return "ERROR";
      }
    }

is the culprit as I removed it and the module activated properly. The table was already created so I don't know why this bit of code did not see the table that was created.

Anyway I have no time to test further at this time.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Fri, 2013-12-06 15:06

I see the same issue. I didn't remove any code, though. I'll await further investigation. Nash, did you get my PM?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Fri, 2013-12-06 15:34

I think I might know why this is...

Do you guys have table prefixes on in Gallery?

if so, I can add the table prefix code in to the query... (I keep forgetting about the table prefixes)

 
Digitizit

Joined: 2013-07-05
Posts: 29
Posted: Fri, 2013-12-06 15:43

I do.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-12-06 17:03
Quote:
Do you guys have table prefixes on in Gallery?

Yes.
Good catch!

Dave_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2013-12-07 03:09

Okay, working it. Trying to figure out what boo boo I made on the upload right now...

New version coming soon.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2013-12-07 04:45

Okay, v6 now up. Think I have those two pesky bugs worked out...

1) I fixed the appq db search to account for table prefixes
2) I reverted a 'test setting' that caused a bug on uploading to say nothing uploaded...

 
punctuation

Joined: 2012-12-11
Posts: 37
Posted: Sat, 2013-12-07 22:03

Module is working great.
Now we need to wait for Gallery 3.1 so the users can edit their own pics.

"For speed, code complexity, upgrade-ability and other considerations, we went with a per album permissions approach and not a per item.

Dave"
Allow user to edit and delete their own pics

"If you want/need to keep that same structure, you'll need to stick with G2 for now. Keep an eye on G3, the permissions system is in for big changes for 3.1 :)"
how can a user change his own Picturs bot nothing else

____________________________
Gallery 3.0.8 | Clean Canvas theme