Advanced search  

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

Pages: 1 [2]   Go Down

Author Topic: limit one user album by category ?  (Read 21514 times)

0 Members and 1 Guest are viewing this topic.

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #20 on: February 03, 2014, 07:23:00 pm »

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
Code: [Select]
if(data['message'] == 'true'){and below, add
Code: [Select]
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.
Logged

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #21 on: February 03, 2014, 10:29:14 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 !!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #22 on: February 04, 2014, 10:44:04 am »

Always force the user name

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

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

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Re: limit one user album by category ?
« Reply #23 on: February 04, 2014, 01:07:52 pm »

Open delete.php, find
Code: [Select]
$get_album_name = trim($superCage->get->getEscaped('name'));and replace with
Code: [Select]
$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)

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Re: limit one user album by category ?
« Reply #24 on: February 04, 2014, 01:19:55 pm »

could it be avoid with a direct validation on "OK" or "New album" button (with removing the entry field).

Open albmgr.php, find
Code: [Select]
    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
Code: [Select]
    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


Is it may be a chmod problem ?
No.
« Last Edit: February 04, 2014, 01:58:55 pm by Αndré »
Logged

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #25 on: February 04, 2014, 01:50:21 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #26 on: February 04, 2014, 01:59:31 pm »

nothing happen at all on "OK" confirmation
Above code updated.


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

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Re: limit one user album by category ?
« Reply #27 on: February 04, 2014, 02:47:05 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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Re: limit one user album by category ?
« Reply #28 on: February 04, 2014, 03:49:22 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?
Logged

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #29 on: February 04, 2014, 04:33:57 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #30 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.
Logged

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Re: limit one user album by category ?
« Reply #31 on: February 04, 2014, 05:09:15 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #32 on: February 04, 2014, 05:12:49 pm »

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

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #33 on: February 04, 2014, 05:23:39 pm »

ok, thanks
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #34 on: February 05, 2014, 05:01:15 pm »

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

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #35 on: February 11, 2014, 02:06:52 pm »

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

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #36 on: February 11, 2014, 04:05:11 pm »

This should fix the issue.

Open albmgr.php, find
Code: [Select]
            $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
Code: [Select]
            $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__);
            }
Logged

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #37 on: February 14, 2014, 02:07:02 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: limit one user album by category ?
« Reply #38 on: February 14, 2014, 03:16:34 pm »

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

colapaca

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: limit one user album by category ?
« Reply #39 on: February 14, 2014, 04:31:31 pm »

you're right!!! I forget to set up album permission correctly :)
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.032 seconds with 19 queries.