forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: mirdonamy on September 23, 2007, 09:48:50 pm

Title: Auto-Fill Album Fields - Help Needed
Post by: mirdonamy on September 23, 2007, 09:48:50 pm
Hi there,

Is there a way to auto-fill album fields when editing the image information for an album? 

For instance, I have a custom field called "Locations" (which I made in config).  For a trip called "Trip to Las Vegas," I'd like to auto-fill all 200+ photos with "Las Vegas, NV" as the Location rather than copying/pasting it into every single image's 'Location' field.

Does anyone kno:
1. if this is possible; and if so,
2. how to do this?

Thank you so much, in advance,
~ Arielle :)
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: mirdonamy on September 28, 2007, 07:38:55 am
I would really appreciate some help on this issue.

Thanks :)
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: Joachim Müller on October 01, 2007, 07:54:56 am
Change the default value by editing the core code of modifyalb.php. However, this is probably not what you're up to - I raather guess that you're looking for a solution to batch-modify several pics at once. This can not be accomplished using the Coppermine user interface. Instead, run a query directly on the database using a tool like phpMyAdmin.
Post a link to the example aplbum you refer to.
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: mirdonamy on October 01, 2007, 06:43:26 pm
The picture I included is the example.  When I upload photos (batch), I go to edit photos and then start typing in the title, description, location, date, etc.  I added location and date myself as new fields in the config area.  Anyhow, I have a lot of photos that will be the same date (a birthday party) or same location (my apartment).  I want to be able to fill in the location one time, and have all 200 photos that are in that album have that location without me having to copy and paste.  I'd like to do this with the interface rather than take an extra step every single time I update an album.. having to go to PhpMyAdmin and do it.  I don't even know how to to do that.

Please help!
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: Nibbler on October 01, 2007, 07:22:09 pm
Modify your copy of editpics.php - replace the form_input function with this new version.

Code: [Select]
function form_input($text, $name, $max_length,$field_width=100)

{

    global $CURRENT_PIC;
    static $done = array();
   
    $link = '';
   
    if (empty($done)){

$link = <<< EOT

<script type="text/javascript">

function map(id, field){

var inputs = document.getElementsByTagName('input');

var value = document.getElementById(id).value;

for (var i in inputs){
if (inputs[i].className != 'textinput field_' + field) continue;
inputs[i].value = value;
}

return false;
}

</script>

EOT;

    }
   
    $fname = $name;

    $value = $CURRENT_PIC[$name];

    $name .= $CURRENT_PIC['pid'];
   
    if (empty($done[$fname])){
    $link .= '<a href="" onclick="return map(\''.$name.'\', \''.$fname.'\')">[Apply to all]</a>';
    $done[$fname] = true;
    $field_width = '90';

    }
   

    if ($text == '') {

        echo "        <input type=\"hidden\" name=\"$name\" value=\"\" />\n";

        return;

    }



    echo <<<EOT

        <tr>

            <td class="tableb" style="white-space: nowrap;">

                        $text

        </td>

        <td width="100%" class="tableb" valign="top">

                <input type="text" style="width: {$field_width}%" name="$name" id="$name" maxlength="$max_length" value="$value" class="textinput field_$fname" />
                $link

                </td>

        </tr>



EOT;

}
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: François Keller on October 01, 2007, 09:01:19 pm
the keyword_add plugin  (http://forum.coppermine-gallery.net/index.php?topic=37103.0)allow you auto-fill pictures custom fields for all pictures in an album. But not for picture title (sorry  ;))
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: skidpics on January 04, 2008, 01:08:02 am
Awesome! Exactly what I was looking for in a previous thread I started!  However, how do we get this to apply to the description also?

Title: Re: Auto-Fill Album Fields - Help Needed
Post by: Nibbler on January 04, 2008, 01:13:58 am
You'd need to expand the mod to include textarea elements - form_textarea().
Title: Re: Auto-Fill Album Fields - Help Needed
Post by: skidpics on January 04, 2008, 04:57:54 pm
You'd need to expand the mod to include textarea elements - form_textarea().

is it as simple as copying and pasting the coding into the form_textarea, without the function form_input($text, $name, $max_length,$field_width=100) from the original source?