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: easy keyword insert mod  (Read 3809 times)

0 Members and 1 Guest are viewing this topic.

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
easy keyword insert mod
« on: March 14, 2007, 04:32:10 pm »

So not sure if this will be a valid mod or not but here goes.

It gives you the option to easily add keywords from a drop-down list into the keywords field during upload.

open upload.php
find:
Code: [Select]
// The function for text areas on forms. Takes the label, field name, and maximum length as arguments.
function text_area_input($text, $name, $max_length,$default='') {

    // Create the text area.
    echo <<<EOT
        <tr>
                <td class="tableb" valign="top">
                        $text
                </td>
                <td class="tableb" valign="top">
<f></f>                        <textarea name="$name" rows="5" cols="40" class="textinput" style="width: 100%;" onKeyDown="textCounter(this, $max_length);" onKeyUp="textCounter(this, $max_length);">$default</textarea>
                </td>
        </tr>
EOT;
}

after add:                (where I have written Contemporary, Vector, Paint, Comic, etc you can edit and insert your own keywords)
Code: [Select]
//mod here

// The text Keyword form  <---- modded     input function. Takes the text label for the box, the input name, the maximum length for text boxes,
// and the number of iterations.
function keyword_box_input($text, $name, $max_length, $iterations, $default='') {

    global $CONFIG;

    $ordinal = '';

    if (($text == '') and ($iterations == '')) {
        echo "        <input type=\"hidden\" name=\"$name\" value=\"$default\" />\n";
        return;
    }

    // Begin loop
    for ($counter=0; $counter<$iterations; $counter++) {

    // Create a numbering system when necessary.
    if ($text == '') {
        $cardinal = $counter + 1;
        $ordinal = "".$cardinal.". ";
    }


    // Create the keyword  box.
    echo <<<EOT
        <tr>
            <td width="40%" class="tableb">
                        $text  $ordinal
        </td>
        <td width="60%" class="tableb" valign="top">
<form id="form1" name="form1" method="post" action="">
<label> <br />
Genre
<select name="select" onchange="document.forms[0].keywords.value += this.value">
<option></option>
<option value=" Contemporary">Contemporary</option>
<option value=" Comics">Comics</option>
<option value=" Other">Other</option>
</select>
</label>
 (you can select more than one)
 <p>
<label>Medium
<select name="select2" onchange="document.forms[0].keywords.value += this.value">
<option></option>
<option value=" Vector">Vector</option>
<option value=" Paint">Paint</option>
<option value=" Collage">Collage</option>
</select>
</label>
(you can select more than one)</p>
                <input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" />
</form>
                </td>
        </tr>

EOT;
    }
}


find:
Code: [Select]
                // If the type is a hidden form
                case 4 :

                    // Call the hidden input funtion.
                    hidden_input($element[0], $element[1]);
                    break;
after add:
Code: [Select]
//mod here
// If the type is keyword input
                case 5 :

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

find:
Code: [Select]
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),replace with this:
Code: [Select]
    array($lang_upload_php['keywords'], 'keywords', 5, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),
This mod will allow people with members who upload a lot of images have some control over the standardizing of keywords.


I have attached a picture that shows what this does.
« Last Edit: March 16, 2007, 08:37:12 am by GauGau »
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: easy keyword insert mod
« Reply #1 on: March 14, 2007, 04:49:04 pm »

ah found a major bug here...the continue button now doesn't work...you think I would have checked that before before posting this but no   ???

I'll figure it out and post an update...if someone would let me edit this thread it would make it clearer to edit the original post.
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: easy keyword insert mod
« Reply #2 on: March 14, 2007, 05:36:56 pm »

ok fixed this so it works and I tested it in IE and FF

Do the above modifications but just don't put in these two lines I told you to put in:

Code: [Select]
<form id="form1" name="form1" method="post" action="">
Code: [Select]
</form>
now it works :)
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: easy keyword insert mod
« Reply #3 on: March 15, 2007, 12:05:18 am »

sorry missed this out to:  (I am being an idiot today.)

in upload.php:

find:
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1)replace with:
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1)
it's around line 994
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: easy keyword insert mod
« Reply #4 on: March 15, 2007, 08:58:45 am »

Thanks for your contribution. However, this thread is already too confusing for newbies. Please start a new thread that contains fixed instructions, so we can move that new thread to the mods section.
Logged

nickfzx

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 285
Re: easy keyword insert mod
« Reply #5 on: March 15, 2007, 03:42:11 pm »

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: easy keyword insert mod
« Reply #6 on: March 16, 2007, 08:38:26 am »

OK, thank you. Closing & locking this thread. All users who are looking for this mod should follow the link Nick has posted above.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.