easy keyword insert mod easy keyword insert mod
 

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

easy keyword insert mod

Started by nickfzx, March 14, 2007, 04:32:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickfzx

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:
// 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)
//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:
                // If the type is a hidden form
                case 4 :

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

after add:
//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:
    array($lang_upload_php['keywords'], 'keywords', 0, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),
replace with this:
    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.

nickfzx

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.

nickfzx

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:

<form id="form1" name="form1" method="post" action="">

</form>

now it works :)

nickfzx

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

in upload.php:

find:
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1)
replace with:
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1)

it's around line 994

Joachim Müller

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.

nickfzx


Joachim Müller

OK, thank you. Closing & locking this thread. All users who are looking for this mod should follow the link Nick has posted above.