Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Dynamic dropdown menu for upload.php  (Read 3189 times)

0 Members and 1 Guest are viewing this topic.

dustyb

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Dynamic dropdown menu for upload.php
« on: June 08, 2004, 07:37:02 pm »

Please excuse. I just posted something similar in a thread on the hack/modification forum.

I'm looking for the following modification/feature/hack:

The dropdown in upload.php requires the user to select the target album for their photo. It would be a huge improvement if the select album mene could be more intuitive. For instance, if you are viewing xyz album, chances are you want your upload to go to xyz album. xyx should be selected as first in the dropdown.

I was thinking some javascript or php on upload.php which would... parse the referring url, if it is matches on "album=x", (ie you clicked upload while viewing thumbnails.php) then manipulate the select album dropdown accordingly to have "x" be selected. Else if it matches on "cat=x", (ie you are viewing index.php), then refer to a hard-coded data structure which would at least limit the select album dropdown to the albums in the cat. Else display the whole dropdown like now.


Dusty
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Dynamic dropdown menu for upload.php
« Reply #1 on: June 09, 2004, 09:55:09 am »

not a bad idea, will be considered for future versions.

GauGau
Logged

dustyb

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Dynamic dropdown menu for upload.php
« Reply #2 on: June 09, 2004, 05:44:33 pm »

Great. I guess my problem in the immediate term is that even the basic <option value="albumnumber" selected> function which does seem to be part of function form_alb_list_box is not working. No album gets the 'selected' flag.

Code: [Select]
$sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;
That line should set up this line

Code: [Select]
echo '        <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>* ' . $album['title'] . "</option>\n";
Any ideas? $HTTP_GET_VARS['album'] would appear to be null
Logged

hyperion

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 1317
  • - retired -
Re: Dynamic dropdown menu for upload.php
« Reply #3 on: June 09, 2004, 06:53:16 pm »

That's dormant code. It is meant to be used in future versions, but it does not have all the necessary code elsewhere to make it functional yet.
Logged
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png)

dustyb

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Dynamic dropdown menu for upload.php
« Reply #4 on: June 09, 2004, 09:44:29 pm »

Ahh I see. Well a dynamic pulldown would be a great feature and I'm glad it obviously is being planned. For now, I inserted the following:

Code: [Select]
   // $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

    $referrer = getenv("HTTP_REFERER");
    preg_match("/.*album=(\d+)/i", $referrer, $match);
    $sel_album = $match[1];

I figured I could use HTTP_REFERER and set $sel_album for at least some pages like thumbnails.php, displayimages.php, etc... anywhere album=() is in the referrer. The rest of the code (writing out the html <option> lines with the selected flag) works great. So, a small step towards what I wanted.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.