forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: Gillie on October 19, 2012, 06:53:11 am

Title: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Gillie on October 19, 2012, 06:53:11 am
On the site, our gallery is organized into albums by topic, and members upload images into a particular album. While the entire membership shares the albums and all images, only the individual user can edit the images that he/she's uploaded.

Before the upgrade, it was easy to move my images into another album in groups up to 25 images. After I uploaded an image into an album, I could see all my previously uploaded images that were in that album. If I wanted to move some to another album, I just went to the drop-down menu for a particular image and chose another album designation, and clicked "Save changes". It was done.

Now, after the upgrade, there's a problem.  When I upload my images into a particular album, I can only see my images from my most recent upload. If I need to move any of my previously uploaded images that are in that album, I have to track them down individually and edit them one at a time which is time-consuming.

Any suggestions?
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on October 23, 2012, 02:53:17 pm
When I upload my images into a particular album, I can only see my images from my most recent upload.
That's a new feature related to the flash uploader. It only lists the recently uploaded images.


If I need to move any of my previously uploaded images that are in that album, I have to track them down individually
You don't have to track them down individually. Just use the edit files form and all your images will be displayed as usual.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Gillie on October 23, 2012, 09:05:46 pm
There are 2000 members without access to the edit file form.  They've uploaded 40,000 pictures in 28 albums that the memberbase shares. Individuals need the ability to move their pictures which are 100 out of thousands.

How can they search through everybody's pictures to find theirs in a particular album?

Is there a way that each member can see THEIR uploads only in a particular album?
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Gillie on October 23, 2012, 09:32:07 pm
Let me add that only admins have the edit file form you mention.

Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on October 24, 2012, 09:10:42 am
How can they search through everybody's pictures to find theirs in a particular album?

Is there a way that each member can see THEIR uploads only in a particular album?
Both can be accomplished with the lastupby meta album. But I think we should focus on your actual question. Try to enable the config option Allow users to retain control over their pics in public galleries (http://documentation.coppermine-gallery.net/en/configuration.htm#admin_user_editpics_public_start) and the edit files form should be displayed to everybody.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Gillie on October 24, 2012, 08:59:08 pm
Quote
Αndré wrote:
Try to enable the config option Allow users to retain control over their pics in public galleries (http://documentation.coppermine-gallery.net/en/configuration.htm#admin_user_editpics_public_start) and the edit files form should be displayed to everybody.
Thanks, Andre, for your reply.

I have checked everything in my config and all is set to allow members to retain control over their pics in public galleries.  As a member, not as an admin, they can no longer control the editing of their pictures by seeing all their uploads and scrolling down to change all at once and then hitting 'save changes'.  The only option available since the upgrade is to have them click on one image.  Then they have the option of :

crop and rotate
edit file
delete file

They can choose one of those 3 and then they have to leave that picture and then choose another picture to edit.

We used to be able to view up to a certain amount (25 is what we set).  Then we'd see all our uploads from a particular album when we uploaded.  Then we used to be able to scroll down the page and edit titles, drop down arrow to move to other albums, add descriptions and etc, etc.  When we finished, we were able to click 'save changes' on the bottom of our screen and 25 were edited at the same time.

Now, we can only do one.

I've asked my webhost to check and he suggested maybe it's a bug because he didn't see how I could change it.

Can you please try on your end in a gallery and see if you, as a member not as an admin, can edit pictures.

The only thing I can see at one time is all my pictures in a thumbnail mode page by page, which is fine for viewing, but I can't edit from that view.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on October 25, 2012, 11:19:04 am
We used to be able to view up to a certain amount (25 is what we set).  Then we'd see all our uploads from a particular album when we uploaded.  Then we used to be able to scroll down the page and edit titles, drop down arrow to move to other albums, add descriptions and etc, etc.  When we finished, we were able to click 'save changes' on the bottom of our screen and 25 were edited at the same time.
That's exactly what the edit files form still does.


Can you please try on your end in a gallery and see if you, as a member not as an admin, can edit pictures.
Of course I checked that in advance. That's why I asked you to enable the config option. The link to the edit files form is displayed in the category/album list view (not in the thumbnail or intermediate-sized view). Please post a link to your gallery and a test user account, so I can have a look at your gallery myself.


Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on October 25, 2012, 04:02:08 pm
Thanks for your help Andre.

I'm Alana and an admin on that site too.  Is there a place where I can private message or email you the links and test accounts?
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on October 25, 2012, 05:12:10 pm
Andre, 

I've rechecked the config and the groups permissions under "Manage user groups" and all is set correctly and the same settings as we had before the recent upgrade.

I also want to make sure we're talking about the public gallery, the one all members use.  We don't allow personal galleries.

thank you
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on October 25, 2012, 07:09:34 pm
afrunti, PM sent.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on October 26, 2012, 05:30:00 am
Hello

Have you had a chance to view the gallery settings I have?  Hopefully you'll see what I'm doing wrong.

Thanks

Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on October 29, 2012, 03:30:12 pm
The button to the edit files form is simply not displayed. Please try the following fix and report any unexpected behavior. If it works as expected, it will be added to cpg1.5.22.

Open index.php and replace the whole function album_adm_menu with the following one:
Code: [Select]
function album_adm_menu($aid, $cat, $owner)
{
    global $CONFIG, $USER_DATA, $lang_album_admin_menu;

    static $public_upload_albums = null;
    if ($public_upload_albums === null) {
        $public_upload_albums = array();
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE uploads = 'YES'");
        while ($row = mysql_fetch_assoc($result)) {
            $public_upload_albums[] = $row['aid'];
        }
    }

    //check if user is allowed to edit album
    if (USER_ADMIN_MODE) {
        //check if it is the user's gallery
        if ($cat == USER_ID + FIRST_USER_CAT) {
            return html_albummenu($aid);
        } elseif ($owner == USER_ID) {
            //check if admin allows editing after closing category
            if ($CONFIG['allow_user_edit_after_cat_close'] == 0) {
                //Disallowed -> Check if album is in such a category
                $result = cpg_db_query("SELECT DISTINCT alb.category FROM {$CONFIG['TABLE_ALBUMS']} AS alb INNER JOIN {$CONFIG['TABLE_CATMAP']} AS catm ON alb.category=catm.cid WHERE alb.owner = '" . $USER_DATA['user_id'] . "' AND alb.aid='$aid' AND catm.group_id IN (" . implode(', ', $USER_DATA['groups']) . ")");
                $allowed_albums = cpg_db_fetch_rowset($result);
                if (!$allowed_albums || ($allowed_albums[0]['category'] == '')) {
                    return "<strong>" . $lang_album_admin_menu['cat_locked'] . "</strong>";
                }
            }
            if (!$CONFIG['users_can_edit_pics']) {
                //return menu without edit pics button
                return html_albummenu3($aid);
            } else {
                //return whole menu
                return html_albummenu($aid);
            }
        } elseif (in_array($aid, $public_upload_albums) && mysql_result(mysql_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid AND owner_id = ".USER_ID), 0)) {
            return html_albummenu2($aid);
        } else {
            return '';
        }
    } elseif (GALLERY_ADMIN_MODE) {
        return html_albummenu($aid);
    } elseif (in_array($aid, $USER_DATA['allowed_albums'])) {
   
        //check for moderator rights
        return html_albummenu2($aid);
    } else {
        return '';
    }
} // function album_adm_menu
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on November 27, 2012, 02:11:26 pm
afrunti, does it work for you as expected?
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on December 27, 2012, 06:06:06 pm
Hello Andre

I know it's been a while, had some problems after a major hurricane where I live.  I've given this to my technical expert and as soon as he is able I will let you know if it works or not.

Thank you very much.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on January 09, 2013, 05:09:31 pm
I just noticed that you get a
Quote
You don't have permission to perform this operation.
error message after you follow the edit files button in some cases (I just tested it as a regular user on a password protected album owned by somebody else).

The scripts stops at editpics.php - Line: 113, which is
Code: [Select]
    if ((!user_is_allowed() && !GALLERY_ADMIN_MODE && !MODERATOR_EDIT_MODE)) {
        cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
    }

If we have a look at the function user_is_allowed(), we find something like
Code: [Select]
        $public_albums = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} INNER JOIN {$CONFIG['TABLE_CATEGORIES']} ON cid = category WHERE category < " . FIRST_USER_CAT . " AND ((uploads='YES' AND (visibility = '0' OR visibility IN ".USER_GROUP_SET." OR alb_password != '')) OR (owner=".USER_ID.")) AND aid=$album_id");which differs from my
Code: [Select]
$result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE uploads = 'YES'");as it additionally checks the visibility and album password.


I'll post an updated code suggestion soon.
Title: Re: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on January 09, 2013, 05:30:21 pm
I just noticed that you get a error message after you follow the edit files button in some cases (I just tested it as a regular user on a password protected album owned by somebody else).
This was a bug I just fixed in SVN revision 8525.

However, we still need to fix the code for private albums, i.e. open index.php and replace the whole function album_adm_menu with the following one:
Code: [Select]
function album_adm_menu($aid, $cat, $owner)
{
    global $CONFIG, $USER_DATA, $lang_album_admin_menu;

    static $public_upload_albums = null;
    if ($public_upload_albums === null) {
        $public_upload_albums = array();
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE uploads = 'YES' AND category < ".FIRST_USER_CAT." AND (visibility = '0' OR visibility IN ".USER_GROUP_SET." OR alb_password != '')");
        while ($row = mysql_fetch_assoc($result)) {
            $public_upload_albums[] = $row['aid'];
        }
    }

    //check if user is allowed to edit album
    if (USER_ADMIN_MODE) {
        //check if it is the user's gallery
        if ($cat == USER_ID + FIRST_USER_CAT) {
            return html_albummenu($aid);
        } elseif ($owner == USER_ID) {
            //check if admin allows editing after closing category
            if ($CONFIG['allow_user_edit_after_cat_close'] == 0) {
                //Disallowed -> Check if album is in such a category
                $result = cpg_db_query("SELECT DISTINCT alb.category FROM {$CONFIG['TABLE_ALBUMS']} AS alb INNER JOIN {$CONFIG['TABLE_CATMAP']} AS catm ON alb.category=catm.cid WHERE alb.owner = '" . $USER_DATA['user_id'] . "' AND alb.aid='$aid' AND catm.group_id IN (" . implode(', ', $USER_DATA['groups']) . ")");
                $allowed_albums = cpg_db_fetch_rowset($result);
                if (!$allowed_albums || ($allowed_albums[0]['category'] == '')) {
                    return "<strong>" . $lang_album_admin_menu['cat_locked'] . "</strong>";
                }
            }
            if (!$CONFIG['users_can_edit_pics']) {
                //return menu without edit pics button
                return html_albummenu3($aid);
            } else {
                //return whole menu
                return html_albummenu($aid);
            }
        } elseif (in_array($aid, $public_upload_albums) && mysql_result(cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid AND owner_id = ".USER_ID), 0)) {
            return html_albummenu2($aid);
        } else {
            return '';
        }
    } elseif (GALLERY_ADMIN_MODE) {
        return html_albummenu($aid);
    } elseif (in_array($aid, $USER_DATA['allowed_albums'])) {

        //check for moderator rights
        return html_albummenu2($aid);
    } else {
        return '';
    }
} // function album_adm_menu[/quote]
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on January 10, 2013, 11:38:19 am
To reduce database query count, here's an optimized version of album_adm_menu:
Code: [Select]
function album_adm_menu($aid, $cat, $owner)
{
    global $CONFIG, $USER_DATA, $lang_album_admin_menu;

    static $public_album_uploads = null;
    if ($public_album_uploads === null) {
        $public_album_uploads = array();
        $result = cpg_db_query("SELECT a.aid FROM {$CONFIG['TABLE_ALBUMS']} AS a INNER JOIN {$CONFIG['TABLE_PICTURES']} as p ON p.aid = a.aid WHERE uploads = 'YES' AND category < ".FIRST_USER_CAT." AND (visibility = '0' OR visibility IN ".USER_GROUP_SET." OR alb_password != '') AND owner_id = ".USER_ID);
        while ($row = mysql_fetch_assoc($result)) {
            $public_album_uploads[] = $row['aid'];
        }
        mysql_free_result($result);
    }

    //check if user is allowed to edit album
    if (USER_ADMIN_MODE) {
        //check if it is the user's gallery
        if ($cat == USER_ID + FIRST_USER_CAT) {
            return html_albummenu($aid);
        } elseif ($owner == USER_ID) {
            //check if admin allows editing after closing category
            if ($CONFIG['allow_user_edit_after_cat_close'] == 0) {
                //Disallowed -> Check if album is in such a category
                $result = cpg_db_query("SELECT DISTINCT alb.category FROM {$CONFIG['TABLE_ALBUMS']} AS alb INNER JOIN {$CONFIG['TABLE_CATMAP']} AS catm ON alb.category=catm.cid WHERE alb.owner = '" . $USER_DATA['user_id'] . "' AND alb.aid='$aid' AND catm.group_id IN (" . implode(', ', $USER_DATA['groups']) . ")");
                $allowed_albums = cpg_db_fetch_rowset($result);
                if (!$allowed_albums || ($allowed_albums[0]['category'] == '')) {
                    return "<strong>" . $lang_album_admin_menu['cat_locked'] . "</strong>";
                }
            }
            if (!$CONFIG['users_can_edit_pics']) {
                //return menu without edit pics button
                return html_albummenu3($aid);
            } else {
                //return whole menu
                return html_albummenu($aid);
            }
        } elseif (in_array($aid, $public_album_uploads)) {
            return html_albummenu2($aid);
        } else {
            return '';
        }
    } elseif (GALLERY_ADMIN_MODE) {
        return html_albummenu($aid);
    } elseif (in_array($aid, $USER_DATA['allowed_albums'])) {

        //check for moderator rights
        return html_albummenu2($aid);
    } else {
        return '';
    }
} // function album_adm_menu

This change has just been committed in SVN revision 8526.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on January 12, 2013, 03:46:03 pm
thank you so much for your help andre.  I'm still waiting for my tech guy to help me do this since it's a bit over my head. 
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on January 12, 2013, 07:28:31 pm
cpg1.5.22 has just been released and already contains the latest version.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on February 07, 2013, 01:50:24 am
Hi Andre

Should I give my tech guy the details in the 'fix' or would it be easier for him to do a complete upgrade again?

thank you
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Jeff Bailey on February 07, 2013, 04:05:05 am
Upgrading would be best.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on February 26, 2013, 04:28:14 pm
We've completed the upgrade and it did not fix my problem about admins and members being able to edit their pictures.  It still only shows us one at a time.

Please help.

Andre, I have you as an admin in our gallery.  Can you check for me.  I can PM you the log in info if you don't have it.

thanks for your help.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on February 26, 2013, 04:47:18 pm
I just logged in as admin and regular user. As admin, I can see the edit files button and can select different albums to move each picture. As regular user the edit files button is still not displayed, for whatever reason. If I manipulate the URL manually, the form is displayed as expected.

To investigate this further I'd need either a dump of your database (you can skip the users table as it contains the password hashes - I don't need it) or access to your galleries files and database (FTP, phpMyAdmin). You can send the dump / data to my known email address.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on February 26, 2013, 05:00:38 pm
sending you all the info Andre.  but, as admin I still cannot see the files to edit.  As admin, the edit files button is there and I can move pictures from one album to the next, but I can only do one at a time, where I used to be able to view all (as I choose 25) at a time.  so, I'd see all the files I uploaded to one album and from there, I could scroll down to each thumbnail image and choose another album. 
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on February 26, 2013, 05:14:13 pm
I used to be able to view all (as I choose 25) at a time
This is maybe a misunderstanding. Do you change the album for each picture separately and after you submit the form the changes are just applied to the first album or do you expect to choose the new album for all pictures just once? Please try to describe exactly what you want to accomplish.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on February 26, 2013, 05:30:18 pm
Ok.  Example

I have 30 albums.  Each album is titled with a name. 

Album one is Alana
Album two is Joan
Album three is Andre :)

etc, etc.

Then I accidentally added 100 pictures to album Alana in error.

Now I want to go into album Alana and see all my uploads and move the last 100 of them to album Andre.  I used to be able to scroll down seeing a thumbnail of all images in album alana and then I'd click a dropdown of album names to move to the correct album.  I'd click the dropdown, then go to the next image and so on and so on.  when I got to the last image on that page, which was 25 because that's where I set it, I would then hit 'submit' and all the 25 images were at once movedf to the correct album.  Now I can only see one image at a time.

I have a visual tutorial on this on my forum that I can point you to if I'm still being unclear.  If so, I'll email you the link to our forum page describing to our members how to do this.

thanks
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on February 26, 2013, 07:10:03 pm
Andre, I want to clarify one thing I said. 

When I said "I used to be able to scroll down seeing a thumbnail of all images in album alana" I want to clarify that it was all images "I" uploaded.  Not other members.

  Except for admins, registered members should have control of moving their images only and when they see all uploaded images that they uploaded to one particular album over the past few years, that's where they should be able to move them all from the same page, still setting each one at a time to the correct album but not submitting until they've changed them all.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on February 28, 2013, 11:54:23 am
Now I want to go into album Alana and see all my uploads and move the last 100 of them to album Andre.  I used to be able to scroll down seeing a thumbnail of all images in album alana and then I'd click a dropdown of album names to move to the correct album.  I'd click the dropdown, then go to the next image and so on and so on.  when I got to the last image on that page, which was 25 because that's where I set it, I would then hit 'submit' and all the 25 images were at once movedf to the correct album.
That's exactly how it it supposed to work, still works in my gallery and also works in your gallery for me, at least with the test admin account. Example link: http://bonanzaboomers.com/gallery/editpics.php?album=2
Please note that you, as admin, always see all pictures in an album, not just those you uploaded yourself.

Is this what you're looking for? See attached screenshot how it looks to me.

I have a visual tutorial on this on my forum that I can point you to if I'm still being unclear.  If so, I'll email you the link to our forum page describing to our members how to do this.
Please do so. I assume you're using the wrong form.


Regarding the user issue I'll perform some tests now.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on February 28, 2013, 12:21:46 pm
The edit files button for registered users isn't displayed in your gallery, as USER_ADMIN_MODE is false in your gallery.

From include/init.inc.php:
Code: [Select]
define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && !GALLERY_ADMIN_MODE);
From bridge/udb_base.inc.php:
Code: [Select]
define('USER_CAN_CREATE_ALBUMS', ((int)$USER_DATA['can_create_albums'] || (int)$USER_DATA['can_create_public_albums']));
Coppermine currently doesn't set USER_ADMIN_MODE to true, if a user isn't allowed to create either private or public albums. To fix this issue in your gallery (actually, I already fixed it temporary), there are three possibilities:
(consider this list as a reminder to myself).
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on February 28, 2013, 03:07:20 pm
Check for USER_ADMIN_MODE remains for now as. Display of edit files button next to public albums if user isn't allowed to create albums, but can upload files, has been fixed in SVN revision 8545.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on March 01, 2013, 07:13:42 pm
Thank you Andre.  The way it is working now is actually better than what we had before.  As each member views the gallery, they see the edit button right there next to each album.  That's perfect!

We never had that edit button before unless we uploaded something and we used to have to upload a picture just to get to see the edit button for all our uploads in one album.

So it's working now the way I want.  Do I have to do something or is it already done?
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: Αndré on March 01, 2013, 08:21:20 pm
So this thread is finally solved, hopefully. Actually the final fix which I committed to our SVN repository is slightly different from what I applied at your gallery. I'll apply that fix probably next week to check if everything still works as expected in your gallery.
Title: Re: Can No Longer Move Groups of Images to New Album After Upgrade
Post by: afrunti on March 02, 2013, 04:57:37 am
oh my gosh, I think this thread is finally solved, yes.  I will continue to test but it's looking good.  Actually, it's looking great!

I will not touch anything.

thank you.