easy keyword insert mod v2 easy keyword insert mod v2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

easy keyword insert mod v2

Started by nickfzx, March 15, 2007, 03:41:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nickfzx

This 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">
<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" />
                </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:
// 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)
replace with this:
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1)

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']): ''),

I have attached a screen shot of what this mod does.


this mod is not compatible with this mod:  http://forum.coppermine-gallery.net/index.php?topic=9391.0  (the upload files and edit them all at once mod)   As I tried for at least an hour to get it to work.

ravendark

hello i've tried your mod but it gives me error Parse error: syntax error, unexpected $end in /public_html/gallery/upload.php on line 2643. Please help me solve this. I have a bridged Coppermine gallery.

Nibbler

Attach your modified version to your next post.

ravendark

Hello
I've replaced the line
<select name="select" onchange="document.forms[0].keywords.value += this.value">
with this one
<select name="select" onchange="document.getElementById('textinput').value=this.options[this.selectedIndex].value;">
and it works with the Upload files at once MOD http://forum.coppermine-gallery.net/index.php?topic=9391.0

lovelife

using copper 1.4.14 and current version of mySQL/PHP:

Parse error: syntax error, unexpected $end in ~PATHWASHERE/copper/upload.php on line 2661

any ideas?

Nibbler

Quote from: Nibbler on September 30, 2007, 12:55:49 PM
Attach your modified version to your next post.

Helps to actually read the thread you are replying to.

hedtrips

this topic is soo old, but i need this mod to complete our site.

i read the topic again and again and i try to modify upload.php but ive got the same error and i cannot understand it:
Parse error: syntax error, unexpected $end in /home/site/public_html/gallery/upload.php on line 2671 - the line 2671 is empty line!

if you have a time can you look at upload.php and help me to fix this unexpected error $end ?

thanks in advance! and sorry for!

~Burov~


Nibbler

You need to add an additional closing brace after the first change described.

Gostemilov

Is it possible to run this script in version 1.5? I've tried, but there are lot of differences in upload.php  :(