limit one user album by category ? - Page 2 limit one user album by category ? - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

limit one user album by category ?

Started by colapaca, November 11, 2010, 06:30:08 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

colapaca

Quote from: andre on February 03, 2014, 11:32:53 AM
We have 2 possibilities:
1. Pre-populate the album manager with the user name, so he just need to accept the default value. In this case, the user is able to change the album name.
2. Always force the user name as album name, regardless what the user enters. Keep in mind that it's still possible to change the album name at another form, so if you want to disable that option you need some more modification.
Which option do you prefer?
We could start with case the 2. - Always force the user name and keep the possibility of change later (if username is not user friendly or if they thought to enter first name or last as it's not mandatory). It still could try to hide the album name field by myself but I suppose it will hidde it for all users even admininstor.

Quote
Quick & dirty solution: open js/albmgr.js, find
if(data['message'] == 'true'){
and below, add
window.location.replace('albmgr.php');

yes, it seems a little bit dirty because the created album still appears while the next available category is also listed and at this step this not possible to create a new album properly : error message as if it was second album creation. Going on anohter menu change nothing, the only way to clean it is to select another category available and coming back to the first available category that become then usable.
I would prefer waiting for your better refresh solution (display the next available category without the display of the previous created album below or going to new created album properties directly).


Quote
That's intended behavior, but could of course be changed if you always want to go to your gallery root when selecting "Album list".
yes, I admit I'm not very accustomed with this change of menu behavior (same menu could display 2 different windows depending the main menu previously you used before). Perhaps there is good reason but I admit I didn't think yet.

In fact, I'm also in trouble with the Main menu because I noticed when connected as Administrator, I have well the "upload" menu file but I can't find "create/sort album" because this option (under the "My profil" menu when as users) is not available. The "admin "My profil"" is inserted under the "users" admin menu).

That's why concerning the behaviour menu I also have prefering having the "create/sort album" menu and all other album manipulation menu directly placed under the main "Album" menu (as if it's possible). It then could work as administrator too, and cheery and the cake more clear for user to find where to manage album.

Thanks for hearing patiently all my suggestions as usual.

colapaca

Quote from: colapaca on February 03, 2014, 07:23:00 PM
yes, it seems a little bit dirty because the created album still appears while the next available category is also listed and at this step this not possible to create a new album properly : error message as if it was second album creation. Going on another menu change nothing, the only way to clean it is to select another category available and coming back to the first available category that become then usable.
edit 1 : those symptoms appear on "registred" profile but it works fine under "admin" profile!

Quote
In fact, I'm also in trouble with the Main menu because I noticed when connected as Administrator, I have well the "upload" menu file but I can't find "create/sort album" because this option (under the "My profil" menu when as users) is not available. The "admin "My profil"" is inserted under the "users" admin menu).
edit 2 : I finally found the "create/sort album" submenu but under "Files" Menu on admin profile.

Quote
That's why concerning the behaviour menu I also have prefering having the "create/sort album" menu and all other album manipulation menu directly placed under the main "Album" menu (as if it's possible). It then could work as administrator too, and cheery and the cake more clear for user to find where to manage album.
edit 3: still would prefer this Menu possibility for "registered" users but I suppose it should be under another discussion...

edit 4 : Under admin profil, even if I create an album, nothing appears under the "Album" main Menu. Not sure if it's a normal behaviour because result is nothing.

8 years after my first coppermine try, almost really near to put this type of gallery configuration in production with your assistance !!

Αndré

Quote from: colapaca on February 03, 2014, 07:23:00 PM
Always force the user name

Open delete.php, find
$get_album_name = trim($superCage->get->getEscaped('name'));
and replace with
$get_album_name = GALLERY_ADMIN_MODE ? trim($superCage->get->getEscaped('name')) : $USER_DATA['user_name'];


Quote from: colapaca on February 03, 2014, 10:29:14 PM
those symptoms appear on "registred" profile but it works fine under "admin" profile!

This also works for non-admins in my gallery.


Regarding your theme question, please start a new thread.

colapaca

Quote from: Αndré on February 04, 2014, 10:44:04 AM
Open delete.php, find
$get_album_name = trim($superCage->get->getEscaped('name'));
and replace with
$get_album_name = GALLERY_ADMIN_MODE ? trim($superCage->get->getEscaped('name')) : $USER_DATA['user_name'];

it works but the "regardless what the user enters" is confusing for users, could it be avoid with a direct validation on "OK" or "New album" button (with removing the entry field).

Quote
This also works for non-admins in my gallery.

Tried again the quick & dirty solution (js/albmgr.js) but unfortunately it's still not well working for me under "registred",

see pict: 2.jpg (as "registered" user the album staies on the screen),
see pict: 3.jpg (as "admin": there is well the reset of the screen and the dropdown list)

Is it may be a chmod problem ? (my web hosting doesn't accept 777)


Αndré

#24
Quote from: colapaca on February 04, 2014, 01:07:52 PM
could it be avoid with a direct validation on "OK" or "New album" button (with removing the entry field).

Open albmgr.php, find
    echo <<< EOT
                        <button type="button" id="delete_album" name="delete_album" class="button" value="{$lang_albmgr_php['delete_album']}" disabled="disabled" title="{$lang_albmgr_php['delete_album']}">{$icon_array['delete']}</button>
                        &nbsp;&nbsp;&nbsp;
                        <button type="button" id="modify_album" name="modify_album" class="button" value="{$lang_common['album_properties']}" disabled="disabled">{$icon_array['modifyalb']}{$lang_common['album_properties']}</button>
                        <button type="button" id="editfiles_album" name="editfiles_album" class="button" value="{$lang_common['edit_files']}" disabled="disabled">{$icon_array['edit_files']}{$lang_common['edit_files']}</button>
                        <button type="button" id="thumbnail_album" name="thumbnail_album" class="button" value="{$lang_common['thumbnail_view']}" disabled="disabled">{$icon_array['thumbnail']}{$lang_common['thumbnail_view']}</button>
                        &nbsp;&nbsp;&nbsp;
                        <button type="button" id="add_new_album" name="add_new_album" class="button" value="{$lang_albmgr_php['new_album']}">{$icon_array['new']}{$lang_albmgr_php['new_album']}</button>
                        <img id="loading" class="icon" src="{$prefix}images/loader.gif" style="margin-left: 10px; display: none;" alt="" />
                        <input type="text" id="add-name" name="add-name" size="27" maxlength="255" class="textinput" value="" onkeypress="return Sort.disableEnterKey(event)" style="display: none;" />

and replace with
    if (GALLERY_ADMIN_MODE) {
        $add_name = '<input type="text" id="add-name" name="add-name" size="27" maxlength="255" class="textinput" value="" onkeypress="return Sort.disableEnterKey(event)" style="display: none;" />';
    } else {
        $add_name = '<input type="hidden" id="add-name" name="add-name" value="user name"/>';
    }
    echo <<< EOT
                        <button type="button" id="delete_album" name="delete_album" class="button" value="{$lang_albmgr_php['delete_album']}" disabled="disabled" title="{$lang_albmgr_php['delete_album']}">{$icon_array['delete']}</button>
                        &nbsp;&nbsp;&nbsp;
                        <button type="button" id="modify_album" name="modify_album" class="button" value="{$lang_common['album_properties']}" disabled="disabled">{$icon_array['modifyalb']}{$lang_common['album_properties']}</button>
                        <button type="button" id="editfiles_album" name="editfiles_album" class="button" value="{$lang_common['edit_files']}" disabled="disabled">{$icon_array['edit_files']}{$lang_common['edit_files']}</button>
                        <button type="button" id="thumbnail_album" name="thumbnail_album" class="button" value="{$lang_common['thumbnail_view']}" disabled="disabled">{$icon_array['thumbnail']}{$lang_common['thumbnail_view']}</button>
                        &nbsp;&nbsp;&nbsp;
                        <button type="button" id="add_new_album" name="add_new_album" class="button" value="{$lang_albmgr_php['new_album']}">{$icon_array['new']}{$lang_albmgr_php['new_album']}</button>
                        <img id="loading" class="icon" src="{$prefix}images/loader.gif" style="margin-left: 10px; display: none;" alt="" />
                        $add_name



Quote from: colapaca on February 04, 2014, 01:07:52 PM
Is it may be a chmod problem ?
No.

colapaca

modification done: "Ok" & "Cancel" well appeared after clicking on "New album" but nothing happen at all on "OK" confirmation.

Could I cry help and request more investigation on my Gallery for the dropdown list refresh not working "Registred" and this direct validation ? (both are important for the "limit one user album by category" request).

thanks

Αndré

Quote from: colapaca on February 04, 2014, 01:50:21 PM
nothing happen at all on "OK" confirmation
Above code updated.


Quote from: colapaca on February 04, 2014, 01:50:21 PM
Could I cry help and request more investigation on my Gallery for the dropdown list refresh not working "Registred" and this direct validation ?
One thing at a time, please.

colapaca

Quote from: Αndré on February 04, 2014, 01:59:31 PM
Above code updated.
works very well now, thanks.

Quote
One thing at a time, please.
ok, I'm waiting your suggestion... (just see below detailed symptoms for a better understanding)

1a.jpg : when connected as "registred", we arrive by default, with dropdown list already on the first available category where seems remain a user album (but not existing for real).
2a.jpg : when connected as "admin", by default you have the category dropdown list well waiting on *No category* and without the phantom "user" album.

Αndré

Quote from: colapaca on February 04, 2014, 02:47:05 PM
1a.jpg : when connected as "registred", we arrive by default, with dropdown list already on the first available category where seems remain a user album (but not existing for real).

This is different from what I understood earlier today/yesterday. I thought the current issue is, that the page isn't refreshing after creating a new album, to update the available category list. Now you just told me something totally different. Does the first issue exist at all? Is it somehow related?

colapaca

Previously I tried to described what's happening when you are creating a album. But as you told me it was working on your side I tried to give description of it. In the last remark, I just added something I noticed today and who could help the resolution. But it concerns the same problem and there is no change about the issue: reset dropdown ( and then consequently album creation) works well under admin but not very well under registered user.
Let me know If more details are needed.

Αndré

Please post a link to your gallery and a test user account (no admin account!) which can create albums in public categories, to exclude client side issues. I just applied all changes of this thread to an unmodified gallery and it still works for me for non-admin users.

colapaca

Quote from: Αndré on February 04, 2014, 04:40:40 PM
Please post a link to your gallery and a test user account (no admin account!) which can create albums in public categories, to exclude client side issues. I just applied all changes of this thread to an unmodified gallery and it still works for me for non-admin users.
http://lesgolden.free.fr/gallery
user : test333
pwd : test333

Αndré

The redirect works as expected, solely the category "1er étoile de la Paix (Juin 1983)" isn't hidden for some reason. I'll have a look at it tomorrow.

colapaca


Αndré

Today I got what happens (I think you already tried to explain that ;)). The category "1er étoile de la Paix (Juin 1983)" (which was the topmost category when I tested yesterday) actually had no album, but Coppermine displayed that it had one. After switching to another category and back, it was empty, as expected.

The "good" news, this now also happens in my testbed. The bad news, I haven't found out yet why. I already tried to add some random parameter, as I thought it's some weird caching issue, but this didn't help. I'll perform some other tests as soon as possible.

colapaca

ok :) it's clear for everybody now ;)

hope that would be possible to fix this issue in user mode.

Αndré

This should fix the issue.

Open albmgr.php, find
            $result = cpg_db_query("SELECT cm.cid FROM {$CONFIG['TABLE_CATMAP']} AS cm INNER JOIN {$CONFIG['TABLE_CATEGORIES']} AS c ON cm.cid = c.cid WHERE cm.group_id in (" .  implode(",", $USER_DATA['groups']). ") ORDER BY pos LIMIT 1");
            $cat = mysql_result($result, 0);
            mysql_free_result($result);

and replace with
            $result = cpg_db_query("SELECT cm.cid FROM {$CONFIG['TABLE_CATMAP']} AS cm INNER JOIN {$CONFIG['TABLE_CATEGORIES']} AS c ON cm.cid = c.cid WHERE cm.group_id in (" .  implode(",", $USER_DATA['groups']). ") AND c.cid NOT IN (SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE owner = ".USER_ID.") ORDER BY pos LIMIT 1");
            $cat = mysql_result($result, 0);
            mysql_free_result($result);
            if (!$cat) {
                cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
            }

colapaca

so easy for you.... works fine. thanks !!!

with all the modification we made, is it still possible to allow the "Allow unlogged users (guest or anonymous) access"   Yes: thumbnail only.  I can only see category title visible but nothing inside.

Αndré

I don't see a reason why that shouldn't work. It also works in my test gallery where I've still applied the modifications. It seems that you've currently set your gallery to disable guest access completely.

colapaca

you're right!!! I forget to set up album permission correctly :)