Dynamic dropdown menu for upload.php Dynamic dropdown menu for upload.php
 

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

Dynamic dropdown menu for upload.php

Started by dustyb, June 08, 2004, 07:37:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dustyb

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

Joachim Müller

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

GauGau

dustyb

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.

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

That line should set up this line

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

hyperion

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

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

dustyb

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:

   // $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.