Advanced search  

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

Pages: [1]   Go Down

Author Topic: easy keyword insert mod v2  (Read 19208 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 v2
« on: March 15, 2007, 03:41:22 pm »

This 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">
<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:
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]
// 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)replace with this:
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1)
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']): ''),
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.
« Last Edit: March 16, 2007, 08:39:02 am by GauGau »
Logged

ravendark

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: easy keyword insert mod v2
« Reply #1 on: September 30, 2007, 12:23:20 pm »

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

Nibbler

  • Guest
Re: easy keyword insert mod v2
« Reply #2 on: September 30, 2007, 12:55:49 pm »

Attach your modified version to your next post.
Logged

ravendark

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: easy keyword insert mod v2
« Reply #3 on: December 01, 2007, 02:38:40 am »

Hello
I've replaced the line
Code: [Select]
<select name="select" onchange="document.forms[0].keywords.value += this.value">with this one
Code: [Select]
<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
Logged

lovelife

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: easy keyword insert mod v2
« Reply #4 on: January 26, 2008, 03:00:25 am »

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?
Logged

Nibbler

  • Guest
Re: easy keyword insert mod v2
« Reply #5 on: January 26, 2008, 03:03:07 am »

Attach your modified version to your next post.

Helps to actually read the thread you are replying to.
Logged

hedtrips

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: easy keyword insert mod v2
« Reply #6 on: October 31, 2008, 12:08:15 pm »

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~

Logged

Nibbler

  • Guest
Re: easy keyword insert mod v2
« Reply #7 on: October 31, 2008, 01:21:57 pm »

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

Gostemilov

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: easy keyword insert mod v2
« Reply #8 on: May 19, 2011, 12:18:44 pm »

Is it possible to run this script in version 1.5? I've tried, but there are lot of differences in upload.php  :(
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.