Can No Longer Move Groups of Images to New Album After Upgrade Can No Longer Move Groups of Images to New Album After Upgrade
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Can No Longer Move Groups of Images to New Album After Upgrade

Started by Gillie, October 19, 2012, 06:53:11 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Gillie

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?

Αndré

Quote from: Gillie on October 19, 2012, 06:53:11 AM
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.


Quote from: Gillie on October 19, 2012, 06:53:11 AM
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.

Gillie

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?

Gillie

Let me add that only admins have the edit file form you mention.


Αndré

Quote from: Gillie on October 23, 2012, 09:05:46 PM
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 and the edit files form should be displayed to everybody.

Gillie

QuoteΑndré wrote:
Try to enable the config option Allow users to retain control over their pics in public galleries 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.

Αndré

Quote from: Gillie on October 24, 2012, 08:59:08 PM
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.


Quote from: Gillie on October 24, 2012, 08:59:08 PM
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.



afrunti

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?

afrunti

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

Αndré


afrunti

Hello

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

Thanks


Αndré

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

Αndré


afrunti

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.

Αndré

I just noticed that you get a
QuoteYou 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
    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
        $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
$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.

Αndré

Quote from: Αndré on January 09, 2013, 05:09:31 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:
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]

Αndré

To reduce database query count, here's an optimized version of album_adm_menu:
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.

afrunti

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. 

Αndré

cpg1.5.22 has just been released and already contains the latest version.

afrunti

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