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: change textfield to list menu  (Read 7181 times)

0 Members and 1 Guest are viewing this topic.

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
change textfield to list menu
« on: April 04, 2010, 03:01:01 pm »

Good Day !
Im quite sure this is a small change that needs to be made I just cant find the file(hopefully not files) to edit .
I would like to change the area (Custom fields for image description) where when you upload a file and have to add image descriptions , from a text field to a list menu . as an example I would like to make this change to the form so that when you upload a picture you have a drop down list of all the countries and you could choose the country the picture was taken ,,  if any one could help me i would be very happy :-)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: change textfield to list menu
« Reply #1 on: April 04, 2010, 05:57:11 pm »

You should start by respecting board rules... You've been told so when you signed up and when you composed your posting.
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #2 on: April 05, 2010, 04:03:48 pm »

sencere appologies . im using a localhost "xampp" for testing and the site that it will be deployed will be www.bloggersplace.com. here is also a snapshot of the screen that i would like the text field in to change to a list menu . 
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #3 on: April 12, 2010, 07:18:50 am »

we i cant figure this out ,, mybe someone can help me with a script that brings up n sort of popup  menu with choices to insert  into the text field .. :-\ or does any one know where i would be able to insert my own form into the upload.php to display only my form, as a simple up loader
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: change textfield to list menu
« Reply #4 on: April 17, 2010, 03:52:22 pm »

You have to edit upload.php. Find
Code: [Select]
$form_array[] = array($CONFIG['user_field1_name'], 'user1', 0, 255, 1);to
Code: [Select]
$form_array[] = array($CONFIG['user_field1_name'], 'user1', 5, 255, 1);
Then find
Code: [Select]
            // Based on the type declared in the data array's third position, create a different form input.
            switch ($element[2]) {

                // If the type is a text box input
                case 0 :

                    //Call the form input function.
                    text_box_input($element[0], $element[1], $element[3], $element[4], (isset($element[5])) ? $element[5] : '');
                    break;

                // If the type is a file input.
                case 1 :

                    // Call the file input function.
                    file_input($element[0], $element[1], $element[3]);
                    break;

                // If the type is an album list dropdown.
                case 2 :

                    // Call the album list function.
                    form_alb_list_box($element[0], $element[1]);
                    break;

                // If the type is a text area
                case 3 :

                    // Call the text area function.
                    text_area_input($element[0], $element[1], $element[3], (isset($element[4])) ? $element[4] : '');
                    break;

                // If the type is a hidden form
                case 4 :

                    // Call the hidden input funtion.
                    hidden_input($element[0], $element[1]);
                    break;

                // If the type is not present, kill the script.
                default:
                    cpg_die(ERROR, $lang_upload_php['reg_instr_1'], __FILE__, __LINE__);
            } // switch
        }
and add a new case 5, where you create your drop down box.
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #5 on: April 20, 2010, 03:38:39 pm »

Whoo thank you it works ;D ! I will make a guide for this as-well if any one else would like to do this ..
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: change textfield to list menu
« Reply #6 on: April 20, 2010, 03:45:08 pm »

I will make a guide for this
Thank you very much! :)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: change textfield to list menu
« Reply #7 on: April 20, 2010, 06:50:17 pm »

What "guide"?
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #8 on: April 24, 2010, 10:38:21 pm »

okay the guide is complete you can see it on my blog with this link
http://bloggersplace.com/dean/changecoppermine-testfield-to-list-menu/
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: change textfield to list menu
« Reply #9 on: April 25, 2010, 09:19:33 am »

And what exactly is the benefit of the page you just refered to except the extra spelling mistakes that you added and the background that makes it harder to read? Looks like a copycat page to me - after all, Αndré has done all the work, and you don't even credit him or refer to the palce where you found piece of code.
You could at least have done as we suggest per board rules: Common policies: Resolve your threads
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: change textfield to list menu
« Reply #10 on: April 25, 2010, 09:45:19 am »

The guide is a little more detailed and useful for people who don't know anything about HTML. As we have seen so much websites being not available after a while the real benefit would be to see that guide here in this thread.
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #11 on: April 25, 2010, 10:11:10 am »

@Andre . i was meaning to put a special thanx to you and if you look at the page again you will see i added it ..
@Joachim thank you for yet again pionting out my mistakes .. this is how i learn , but i dont understand why you say it looks like a copycat page ? could you let me know why you think it is a copycat page ? if my spelling mistakes make it look less like a copycat page mybe ill make some more spelling mistakes next time .lol.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: change textfield to list menu
« Reply #12 on: April 25, 2010, 10:14:03 am »

How old are you?
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #13 on: April 25, 2010, 10:58:42 am »

I’m 999 years of age,, what does that have to do with anything on this script or thread .. if your revering to my sarcasm then I’m sorry for you if happy people get you upset .. .I am trying to contribute to your forum,, so at least try to make me feel welcome .
Logged

deanhat

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 13
Re: change textfield to list menu
« Reply #14 on: April 25, 2010, 11:02:00 am »

Now the purpose of this guide is to make filling in info like location or a brand name etc.
lets start by opening the upload.php file
around about line 100 you will find the area where the functions start
we need to add the dropdown function so scroll down to where you want to add the code
I added it above

   
Quote
// The hidden form input function. Takes the hidden input field name and value.
Now add the code :

 
Quote
  // Create the easyfill area.

    function easyfill ($text, $name)

    {

    echo <<<EOT

    <tr>

    <td class="tableb tableb_alternate" width="50">

    $text

    </td>

    <td class="tableb tableb_alternate" valign="top">

    <select >

    <option>example1</option>

    <option>example2</option>

    <option>example3</option>

    </select>

    </td>

    </tr>

    EOT;
    }
Perfect . next we will create a case for this function lets find the code

   
Quote
// If the type is a hidden form

    case 4 :

    // Call the hidden input funtion.

    hidden_input($element[0], $element[1]);

    break;
just below that we will add the new case we have created , so just below the “break; add the next piece of code

   
Quote
//creat a easy fill dropdown list case

    case 5 :

    easyfill($element[0], $element[1]);

    break;

Now all we need to do is to change the text fields current case to our new case 5

Go down and look for the code

   
Quote
if(!empty($CONFIG['user_field4_name'])) {

    $form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);

    }

And change

'user4', 0, 255, 1);
to
'user4', 5, 255, 1);

So the code should now look like this

 
Quote
  if(!empty($CONFIG['user_field4_name'])) {

    $form_array[] = array($CONFIG['user_field4_name'], 'user4', 5, 255, 1);

    }

Save your changes and provide easy fill to your users

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: change textfield to list menu
« Reply #15 on: April 25, 2010, 11:32:09 am »

Please remove unneeded double linebreaks and add indentation instead.
Logged
Pages: [1]   Go Up
 

Page created in 0.057 seconds with 20 queries.