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: Ultimate Keyword Selector  (Read 27025 times)

0 Members and 1 Guest are viewing this topic.

Elwood J. Blues

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Eymard.net
Ultimate Keyword Selector
« on: August 25, 2007, 04:02:27 pm »

Hello, I'm French, so excuse me for my English...  ;D

To add keyword to a photograph in Coppermine v1.4 is not simpler, it should be typed in the fields… Thus if the keyword “photographs” exists and that you add the keyword “Photographs” or “photograph” that will create a double keyword, and for research it is not cool… What I propose it is to be able to have the list of the keywords already existing and to add them by selecting them…

Live demo : http://media.fanaticf1.com/mod_Elwood/motcle.htm

The MOD “easy keyword insert MOD v2” is not bad, but it's not perfect ! The idea is excellent but going in the code to each time that you wants to add a keyword to the drop-down list, it's boring… One will make a mix between this MOD and keyword_select.php page which recovers us the list of the keywords of the base.

In upload.php, search

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
Code: [Select]
// Ok, go with "Easy keyword insert MOD v2"
//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.". ";
    }
// Hop stop here ! Add request of keyword_select.php to get the keyword list
$query = "SELECT * FROM {$CONFIG['TABLE_PREFIX']}dict ORDER BY keyword";
$result = cpg_db_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $keywordIds[] = $row["keyId"];
    $keywords[]   = $row["keyword"];
}
$form = "";
foreach ($keywords as $keyword) {
            $form.= '<option value="'.$keyword.' ">'.$keyword.'</option>';
        }
// Return at the mod
    // Create the keyword  box.
    echo <<<EOT
        <tr>
            <td width="40%" class="tableb">
                        $text  $ordinal
        </td>
        <td width="60%" class="tableb" valign="top">
<label> <br />
Keyword<select name="select" onchange="document.forms[0].keywords.value += this.value">
<option></option>
$form;
</select>
</label>
 (You can select several of them)
                 <input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" /><br />

                </td>
        </tr>

EOT;
    }
}

Search
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;
I don't know what is doing...
Search
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1)Remplace by
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1)Search
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),Remplace by
Code: [Select]
array($lang_upload_php['keywords'], 'keywords', 5, 255, 1,(isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']): ''),
That's all folks !

In French : http://forum.coppermine-gallery.net/index.php?topic=46346.0
« Last Edit: August 26, 2007, 11:41:33 am by GauGau »
Logged
Avant de poser une question passez par ici . 90% des réponses s'y trouvent !

Bergami

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Ultimate Keyword Selector
« Reply #1 on: November 06, 2007, 06:21:51 pm »

Hi and thanks for your great work!

Is there a way to integrate this function into the editOnePic.php ?
Logged

veki

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Ultimate Keyword Selector
« Reply #2 on: December 18, 2007, 08:42:50 pm »

Great,

I would like to implement that on mine site.  Actually, I am putting approx 22000 scanned news articles.

Naturally, there will be a lot of key words in 5 categories of keywords .  Since many of them are inter-related I would like to have 5 drop down choices so people can narrow their search.

Congratulations for your wokr and please advise if your work can be done in a way that is satisfies my need too.

Thanks,

veki
Logged

steviepryke

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Ultimate Keyword Selector
« Reply #3 on: February 02, 2008, 10:49:37 pm »

Hi,

Been using Coppermine for a while now, but just started investigating a few more things, like this...

I may be being completely brain dead, but I have made the changes detailed above and unfortunately I get a completely empty keyword box. I presumed that this would fill automatically from the keyword entered when using it, but that doesn´t seem to happen. What am I doing wrong here?? Do I need to enter the keywords somewhere else? That´s fine too if that´s what I´ve got to do.

Thanks for the help!

Stephen
Logged

Elwood J. Blues

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Eymard.net
Re: Ultimate Keyword Selector
« Reply #4 on: February 03, 2008, 09:13:57 am »

Hello !

In update.php, you must add this :

Code: [Select]
// Hop stop here ! Add request of keyword_select.php to get the keyword list
$query = "SELECT * FROM {$CONFIG['TABLE_PREFIX']}dict ORDER BY keyword";
$result = cpg_db_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $keywordIds[] = $row["keyId"];
    $keywords[]   = $row["keyword"];
}
$form = "";
foreach ($keywords as $keyword) {
            $form.= '<option value="'.$keyword.' ">'.$keyword.'</option>';
        }

Look in my first post, you have a scrollbar
Logged
Avant de poser une question passez par ici . 90% des réponses s'y trouvent !

steviepryke

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Ultimate Keyword Selector
« Reply #5 on: February 05, 2008, 02:00:14 pm »

Hi, thanks for the help, but it didn't seem to work. Here's what my upload.php shows:


Quote

// 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;
}



// 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.". ";
    }
// Hop stop here ! Add request of keyword_select.php to get the keyword list
$query = "SELECT * FROM {$CONFIG['TABLE_PREFIX']}dict ORDER BY keyword";
$result = cpg_db_query($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    $keywordIds[] = $row["keyId"];
    $keywords[]   = $row["keyword"];
}
$form = "";
foreach ($keywords as $keyword) {
            $form.= '<option value="'.$keyword.' ">'.$keyword.'</option>';
        }
// Return at the mod
    // Create the keyword  box.
    echo <<<EOT
        <tr>
            <td width="40%" class="tableb">
                        $text  $ordinal
        </td>
        <td width="60%" class="tableb" valign="top">
<label> <br />
Keyword<select name="select" onchange="document.forms[0].keywords.value += this.value">
<option></option>
   $form;
</select>
</label>
 (You can select several of them)
                 <input type="text" style="width: 100%" name="$name" maxlength="$max_length"

value="$default" class="textinput" /><br />

                </td>
        </tr>   

EOT;
    }
}


I think it might be because "Easy keyword insert MOD v2" is missing. Is that right? I've tried it with the MOD in, and I get a "parse" error. I'm a real newbie. Sorry!

Thanks,
Stephen

Logged

Elwood J. Blues

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Eymard.net
Re: Ultimate Keyword Selector
« Reply #6 on: February 05, 2008, 07:22:51 pm »

What your parse error ?

I join my update.php
Logged
Avant de poser une question passez par ici . 90% des réponses s'y trouvent !

steviepryke

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Ultimate Keyword Selector
« Reply #7 on: February 06, 2008, 11:27:05 pm »

Excellent, excellent, excellent. I have no idea what you did, but it is working perfectly!!

Tres magnifique, mon amis!

I have to select the "Renegade dictionary" to update the list each time, but that is no real problem.

Merci beaucoup
Stephen
Logged

Elwood J. Blues

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 171
    • Eymard.net
Re: Ultimate Keyword Selector
« Reply #8 on: February 06, 2008, 11:32:07 pm »

De rien  ;D
Logged
Avant de poser une question passez par ici . 90% des réponses s'y trouvent !

noeinstein

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Ultimate Keyword Selector
« Reply #9 on: September 09, 2008, 01:45:15 pm »

Hi, i have tried this and i am getting close to what i am trying to do with the upload.php in coppermine. But i would very much like to have one checkboxes for each keyword in the database and NO psooibility for users to write their own keywords.

Any help with this would be appriciated..

Regards Noeinstein
Logged

hlabout

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 118
    • Harald Labout Fotografie
Re: Ultimate Keyword Selector
« Reply #10 on: August 28, 2010, 11:43:24 am »

I hope there is still some support for this mod/hack.
I really would like to see this mod working on my gallery: www.haraldlabout.nl

Running cpg 1.4.27 and applied this Ultimate Keyword Selector mod.
The keyword pull down box shows up after the picture upload but the box remains empty.
No keyword list available.

Tried several changes but without result.
Hope someone can help me.

Harald
Logged

hlabout

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 118
    • Harald Labout Fotografie
Re: Ultimate Keyword Selector
« Reply #11 on: August 29, 2010, 09:50:23 am »

new topic started about my problem.

Harald
Logged

hlabout

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 118
    • Harald Labout Fotografie
Re: Ultimate Keyword Selector
« Reply #12 on: September 17, 2010, 09:04:45 am »

Info:

Found the solution for my problem after great advice form Nibbler, see:

http://forum.coppermine-gallery.net/index.php/topic,66837.0.html

Working fine now, great mod.

Harald
Logged
Pages: [1]   Go Up
 

Page created in 0.037 seconds with 19 queries.