forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: mstralka on August 27, 2004, 06:15:05 pm

Title: CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on August 27, 2004, 06:15:05 pm
If your users upload more than one photo at a time, they probably don't like having to:
Select the album each photo should go to
Edit the description
Click Next
Repeat process for each picture they uploaded.

This mod will simplify this process by letting users see alll of the uploaded photos on one page, move them to different albums accordingly (or to the same album with 1 click), set descriptions, keywords, etc (SEE SCREENSHOT BELOW)

EDIT 8/28: Updated the MOD to be easier to follow, and included Admin option.  See my posts below for the complete mod
Title: Re: MOD CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on August 27, 2004, 09:39:02 pm
looks good - we need to discuss on the dev board if this should go into the core code (my vote is yes, as an admin settable option).

Joachim

P.S. As you're a dev team member now, you should be able to post your mods directly on the mods board, or move a thread to it. Please post if this doesn't work for you. Moved your posting accordingly.
Title: Re: MOD CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on August 27, 2004, 09:50:34 pm
looks good - we need to discuss on the dev board if this should go into the core code (my vote is yes, as an admin settable option).

I'll make it an Admin settable option
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: kegobeer on August 27, 2004, 10:00:30 pm
It would be nice for the admin to have this functionality in the batch add process also.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on August 28, 2004, 05:25:54 am
Great mod. Tried making it work but fouled up somewhere. Maybe because I have modded upload.php even though i was able to find all of these. I wish instructions were easier/simplar(like phpbb mods) (same with juploads mod) had trouble figuring out the last find replace. :)


thanks
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on August 28, 2004, 06:31:35 am
I wish instructions were easier/simplar(like phpbb mods)
phpBB uses the same syntax for their mods, they use [OPEN] filename,  [FIND] expression, [BEFORE,ADD] expression, [AFTER,ADD]expression etc.
Does it make a great difference for you if the syntax is [ADD] instead of [AFTER,ADD] ? The way this mod is written, most mods for similar web projects are, so this is sort of a standard. Other projects use Lunix diffs (which is far less readable for humans, as it was designed to be computer-readable) - I doubt this would make you happier ;).

Joachim
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on August 28, 2004, 06:45:25 am
I wish instructions were easier/simplar(like phpbb mods) (same with juploads mod) had trouble figuring out the last find replace. :)

If you can figure out where you think I made a mistake and correct it, please let me know.  The upload.php code is not easy to mod, much less document it.  Feel free to mod the code yourself or rewrite my mod.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on August 28, 2004, 07:18:27 am
Gaugua, it was just a suggestion. And no it doesn't follow the same syntax not to the same degree and maybe because phpbb and cpg are two different scripts and we shouldnt mix them together..

mstralka, by no means am i trying to criticise as I really would like to install this mod as well! As i am not a programmer and looking at this from a USER perspective rather than a developer perspective. For those of us who are not programmers, its VERY easy to get lost but for you guys its much easier to find which function to replace and where the replacement goes exactly. It was just a suggestion so that USERS (people who download cpg script and install it for other people/users) are able to actually mod the file without having to ask questions. It would be much better, easier and professional if we could have something like following of this template for better mods and understanding of them FOR THOSE who are not developers.

http://www.phpbb.com/kb/article.php?article_id=38

http://www.phpbb.com/kb/article.php?article_id=39

Not all of us are blessed with know how and expertise of the programming. It may not make my life easier or happier but it would certainly make someone else's cpg experience much better to see some type of consistency and ease of usage when it comes to adding mods.  :-\\

I hope you guys understand, sorry to drift from the topic.
thanks
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on August 28, 2004, 08:12:18 am
This mod is split over 2 posts, please follow both

Defence, I apologize for my tone.  I write the instructions as I am doing a mod, so they probably aren't as neat as they should be.  I have, however, completed an improved version of this mod that will let the Admin decide whether users can edit all of the upload pictures at once, or separately (CPG default).  Thanks for the phpBB template.  I've never seen their templates but I will definitely start using it now.  See below:

## MOD Title: Multi-File Uploader
## MOD Author: mstralka < email > (Mark Stralka) http://www.photo-junky.com
## MOD Description: This mod will simplify the upload process by
## letting users see alll of the uploaded photos on one page,
## move them to different albums accordingly (or to the same
## album with 1 click), set descriptions, keywords, etc, instead
## of one image per page.
## Administrator can determine whether users will edit all
## uploaded photos at once, or individually.
## MOD Version: 2.0.0
## Built on CPG 1.3.2 - may work with 1.3.1
##
## Installation Level: Easy
## Installation Time: 10 minutes
## Files To Edit:   lang/english.php
##               upload.php
## Included Files: (screenshot)
##############################################################
## Author Notes:
## These steps are in order from top to bottom.  You have to
## be careful modding upload.php because a lot of the code is
## duplicated in different sections.

## This mod incorporates Frogfoot's fancy album dropdown MOD.
## You must install it first (takes 5 minutes)

## http://forum.coppermine-gallery.net/index.php?topic=8861.0
## Thanks to DefenceTalk for the MOD Instruction Template
##############################################################
## MOD History:
##
##   2004-08-27 - Version 1.0.0
##      - Original version, was not in line-by-line order,
##      - no Admin option
##
##############################################################
## Before Adding This MOD To Your Site, You Should Back Up All Files
## Related To This MOD

Database query (use phpMyAdmin):
Code: [Select]
INSERT INTO `cpg132_config` ( `name` , `value` )
VALUES (
'allow_assign_multiple_photos', '0'
);

Adding this code will create a Yes/No option on the CONFIG page, under User Settings.  The default value
is No, which means uploads will work just like they do now.  Setting it to Yes will turn on the mod.
lang/english.php
FIND:
Code: [Select]
  'User settings',
  array('Allow new user registrations', 'allow_user_registration', 1),
  array('User registration requires email verification', 'reg_requires_valid_email', 1),
ADD to end of User Settings section:
Code: [Select]
  array('Allow users to assign uploaded photos at once (instead of one-at-a-time)','allow_assign_multiple_photos',1), //Mark Stralka cpg1.3.2

upload.php:
FIND:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name) {
//Vodovnik.com modified this code to allow display of Categories besides album names

    // Pull the $CONFIG array and the GET array into the function.
    global $CONFIG, $HTTP_GET_VARS;

    // Also pull the album lists into the function.
    global $user_albums_list, $public_albums_list;

    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

    // Create the opening of the drop down box.
    echo <<<EOT
    <tr>
        <td class="tableb">
            $text
        </td>
        <td class="tableb" valign="top">
            <select name="$name" class="listbox">

EOT;

    //Cylce through the User albums.
    foreach($user_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    //Cycle through the public albums.
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    // Close the drop down.
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}
Replace with:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name,$onChange='') {
// frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order

    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $HTTP_GET_VARS, $lang_upload_php;

    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;

    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

if (!empty($onChange)) {
$onChange = " onChange=\"$onChange\" ";
}
    // Create the opening of the drop down box
    echo <<<EOT
    <tr>
        <td class="tableb">
            $text
        </td>
        <td class="tableb" valign="top">
            <select name="$name" class="listbox" $onChange>

EOT;

    // Reset counter
    $list_count = 0;

    // Cycle through the User albums
    foreach($user_albums_list as $album) {

        // Add to multi-dim array for later sorting
        $listArray[$list_count][cat] = $lang_upload_php['personal_albums'];
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Cycle through the public albums
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID
        $album_id = $album['aid'];

        // Get the category name
        $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Add to multi-dim array for sorting later
        if ($vRes['name']) {
            $listArray[$list_count][cat] = $vRes['name'];
        } else {
            $listArray[$list_count][cat] = $lang_upload_php['albums_no_category'];
        }
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray,'cat','title');

    // Finally, print out the nicely sorted and formatted drop down list
    $alb_cat = '';
    echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
    foreach ($listArray as $val) {
        if ($val[cat] != $alb_cat) {
if ($alb_cat) echo "                </optgroup>\n";
            echo '                <optgroup label="' . $val[cat] . '">' . "\n";
            $alb_cat = $val[cat];
        }
        echo '                <option value="' . $val[aid] . '"' . ($val[aid] == $sel_album ? ' selected' : '') . '>   ' . $val[title] . "</option>\n";
    }
    if ($alb_cat) echo "                </optgroup>\n";

    // Close the drop down
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}

FIND:
Code: [Select]
// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
function open_form($path) {

    echo <<<EOT
    <script language="JavaScript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
    </script>
    <form method="post" action="$path" ENCTYPE="multipart/form-data">
    </td>
EOT;
}
Replace with:
Code: [Select]
// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
function open_form($path,$formName = "") {
if (!empty($formName)) $fn = "name=\"$formName\"";
    echo <<<EOT
    <script language="JavaScript" type="text/javascript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
    </script>
    <form method="post" action="$path" $fn ENCTYPE="multipart/form-data">
    </td>
EOT;
}

FIND:
Code: [Select]
        // Create array index.
        $index = count($escrow_array) - 1;
Add this below:
Code: [Select]
$start = 0;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$iCnt = count($_POST["album"]);
} else {
$iCnt = $index + 1;
$start = $index;
}

//Instead of doing one photo at a time, show one page with all of the photos that are being uploaded - this makes it much easier for the users.
for ($index = $start; $index < $iCnt; $index++) {

FIND:
Code: [Select]
        // We have incoming placement data. Let's capture it.
Add this below:
Code: [Select]
$x = $index;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
$x = 0;
} else {
$x = $index;
}

FIND:
Code: [Select]
$album = (int)$HTTP_POST_VARS['album'];
$title = addslashes($HTTP_POST_VARS['title']);
$caption = addslashes($HTTP_POST_VARS['caption']);
$keywords = addslashes($HTTP_POST_VARS['keywords']);
$user1 = addslashes($HTTP_POST_VARS['user1']);
$user2 = addslashes($HTTP_POST_VARS['user2']);
$user3 = addslashes($HTTP_POST_VARS['user3']);
$user4 = addslashes($HTTP_POST_VARS['user4']);
Replace with:
Code: [Select]
$album = (int)$HTTP_POST_VARS['album'][$x];
$title = addslashes($HTTP_POST_VARS['title'][$x]);
$caption = addslashes($HTTP_POST_VARS['caption'][$x]);
$keywords = addslashes($HTTP_POST_VARS['keywords'][$x]);
$user1 = addslashes($HTTP_POST_VARS['user1'][$x]);
$user2 = addslashes($HTTP_POST_VARS['user2'][$x]);
$user3 = addslashes($HTTP_POST_VARS['user3'][$x]);
$user4 = addslashes($HTTP_POST_VARS['user4'][$x]);

FIND:
Code: [Select]
        // Check to see if this is the last one.
        if(count($escrow_array) == '0') {

            // Create the final message.
            if ($PIC_NEED_APPROVAL) {

                if ($file_placement == 'no') {

                    $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

                } else {

                    $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

                }

            } else {

                if ($file_placement == 'no') {

                    $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];

                } else {

                    $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];

                }

            }

            // Delete the temporary data file.
            delete_record($_POST['unique_ID']);

            // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
            if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
                // Encapsulate so included lang file doesn't interfere with global one
                function cpg_send_upload_notification() {
                    global $CONFIG;
                    $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                    // Get the mail files.
                    include_once('include/mailer.inc.php');

                    // Send the message.
                    cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
                }
                cpg_send_upload_notification();
            }

            // That was the last one. Create a redirect box.
            pageheader($lang_info);
            msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
            pagefooter();

            // Exit the script.
            exit;

        }
Replace with:
Code: [Select]
// Check to see if this is the last one.
if(count($escrow_array) == '0') {

// Create the final message.
if ($PIC_NEED_APPROVAL) {

if ($file_placement == 'no') {

$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

} else {

$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

}

} else {

if ($file_placement == 'no') {

$final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];

} else {

$final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];

}

}

if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
// Delete the temporary data file.
delete_record($_POST['unique_ID']);

// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification() {
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once('include/mailer.inc.php');

// Send the message.
cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
}
cpg_send_upload_notification();
}

// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();

// Exit the script.
exit;
}
} //end for loop

            if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
// Delete the temporary data file.
delete_record($_POST['unique_ID']);

// Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
// Encapsulate so included lang file doesn't interfere with global one
function cpg_send_upload_notification() {
global $CONFIG;
$lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
// Get the mail files.
include_once('include/mailer.inc.php');

// Send the message.
cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
}
cpg_send_upload_notification();
}

// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();

// Exit the script.
exit;
}
}

FIND:
Code: [Select]
    // Create array index.
    $index = count($escrow_array) - 1;
ADD:
Code: [Select]

$start = 0;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$iCnt = count($escrow_array);
} else {
$iCnt = $index + 1;
$start = $index;
}

// Create upload form headers.
    pageheader($lang_upload_php['title']);
echo <<<EOT
<script type="text/javascript">
function moveAllTo(d,box) {
var f = document.editForm;
for (i = 0; i < f.length; i++) {
if (f[i].type == "select-one" && f[i].name.indexOf(box) >= 0) {
f[i].value = d
}
}
}
</script>
EOT;
    // Open the form table.
    starttable("100%", $lang_upload_php['title'], 2);
echo <<<EOT
<tr>
<td class="tableh2">
All Photos:
</td>
<td class="tableh2">

EOT;
//MOVE TO ALL MOD
form_alb_list_box("Move all photos to:","moveAllTo","moveAllTo(this.value,'album');");
echo <<<EOT
</td>
</tr>
EOT;
    // Direct the request to this script.
    open_form($_SERVER['PHP_SELF'],'editForm');
//Display all of the photos at once for editing
for ($index = $start; $index < $iCnt; $index++) {


FIND and Delete or comment out:
Code: [Select]
    // Create upload form headers.
    pageheader($lang_upload_php['title']);

    // Open the form table.
    starttable("100%", $lang_upload_php['title'], 2);

    // Direct the request to this script.
    open_form($_SERVER['PHP_SELF']);
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on August 28, 2004, 08:12:43 am
FIND:
Code: [Select]
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));

// Check for user defined fields.
if(!empty($CONFIG['user_field1_name'])) {
$form_array[] = array($CONFIG['user_field1_name'], 'user1', 0, 255, 1);
}

if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name'], 'user2', 0, 255, 1);
}

if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name'], 'user3', 0, 255, 1);
}

if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
}
Replace with:
Code: [Select]
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
$form_array[] = array('control', 'phase_2', 4);
$form_array[] = array('unique_ID', $_POST['unique_ID'], 4);
}

// Check for user defined fields.
if(!empty($CONFIG['user_field1_name[]'])) {
$form_array[] = array($CONFIG['user_field1_name[]'], 'user1', 0, 255, 1);
}

if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name[]'], 'user2', 0, 255, 1);
}

if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name[]'], 'user3', 0, 255, 1);
}

if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name[]'], 'user4', 0, 255, 1);
}

FIND:
Code: [Select]
    // Create the form and echo more instructions.
create_form($form_array);
ADD:
Code: [Select]
}//end loop over pictures

FIND:
Code: [Select]
    // More instructions.
    if(count($escrow_array) > '1') {

        form_statement($lang_upload_php['place_instr_2']);

    }
ADD:
Code: [Select]
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$form_array = array(
array('control', 'phase_2', 4),
array('unique_ID', $_REQUEST['unique_ID'], 4),
);
create_form($form_array);
}
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on August 28, 2004, 04:17:03 pm
Thank You.

:)

I did edit text of your other mod cross platform uploading, etc. Took away
Code: [Select]
bbcodes, spaces between FINDs, replaces, etc. so I can clearly see them. Its a long mod you know. ;)
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: foulu on September 03, 2004, 12:10:54 pm
i do but after add some pics, the final message show nothing and only one pics was uploaded. i don't think i make something wrong. I check it 1.5 hours.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: foulu on September 03, 2004, 05:03:49 pm
FIND:

Code:
      $form_array = array(
      array($lang_upload_php['album'], 'album[]', 2),
      array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
      array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
      array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
      if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
         $form_array[] = array('control', 'phase_2', 4);
         $form_array[] = array('unique_ID', $_POST['unique_ID'], 4);
      }

      // Check for user defined fields.
      if(!empty($CONFIG['user_field1_name'])) {
         $form_array[] = array($CONFIG['user_field1_name'], 'user1', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field2_name'])) {
         $form_array[] = array($CONFIG['user_field2_name'], 'user2', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field3_name'])) {
         $form_array[] = array($CONFIG['user_field3_name'], 'user3', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field4_name'])) {
         $form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
      }
Replace with:

Code:
      $form_array = array(
      array($lang_upload_php['album'], 'album[]', 2),
      array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
      array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
      array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
      if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
         $form_array[] = array('control', 'phase_2', 4);
         $form_array[] = array('unique_ID', $_POST['unique_ID'], 4);
      }

      // Check for user defined fields.
      if(!empty($CONFIG['user_field1_name[]'])) {
         $form_array[] = array($CONFIG['user_field1_name[]'], 'user1', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field2_name'])) {
         $form_array[] = array($CONFIG['user_field2_name[]'], 'user2', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field3_name'])) {
         $form_array[] = array($CONFIG['user_field3_name[]'], 'user3', 0, 255, 1);
      }

      if(!empty($CONFIG['user_field4_name'])) {
         $form_array[] = array($CONFIG['user_field4_name[]'], 'user4', 0, 255, 1);
      }

they all the same
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: mstralka on September 04, 2004, 04:01:19 am
You're right.  This section did not exist in the original code - it needs to be added for this mod:
Code: [Select]
      if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
         $form_array[] = array('control', 'phase_2', 4);
         $form_array[] = array('unique_ID', $_POST['unique_ID'], 4);
      }
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: foulu on September 04, 2004, 11:00:37 am
When use debug mode i receiver some note:

Upload file

Notice: Undefined variable: fn in c:\inetpub\wwwroot\gallery\uploadER.php on line 350

Notice: Undefined offset: 2 in c:\inetpub\wwwroot\gallery\uploadER.php on line 290

Notice: Undefined offset: 3 in c:\inetpub\wwwroot\gallery\uploadER.php on line 296

Notice: Undefined offset: 4 in c:\inetpub\wwwroot\gallery\uploadER.php on line 296
 
and

Notice: Undefined index: URI_array in c:\inetpub\wwwroot\gallery\uploadER.php on line 1302

Notice: Undefined variable: file_failure_array in c:\inetpub\wwwroot\gallery\uploadER.php on line 1980

Notice: Undefined variable: URI_failure_array in c:\inetpub\wwwroot\gallery\uploadER.php on line 1981

Notice: Undefined variable: zip_failure_array in c:\inetpub\wwwroot\gallery\uploadER.php on line 1982

do you think it is normal.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on September 04, 2004, 12:18:00 pm
disable display of notices (coppermin config, at the very bottom) - they are only meant for developers who know what they mean, they usually won't affect anything.

Joachim
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: foulu on September 04, 2004, 12:39:27 pm
thanks, i always scare about it. But i think
Quote
// Check to see if this is the last one.
         if(count($escrow_array) == '0') {
            
            // Create the final message.
            if ($PIC_NEED_APPROVAL) {

               if ($file_placement == 'no') {

                  $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

               } else {

                  $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

               }

            } else {

               if ($file_placement == 'no') {

                  $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];

               } else {

                  $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];

               }

            }

            if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
               // Delete the temporary data file.
               delete_record($_POST['unique_ID']);

               // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
               if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
                  // Encapsulate so included lang file doesn't interfere with global one
                  function cpg_send_upload_notification() {
                     global $CONFIG;
                     $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                     // Get the mail files.
                     include_once('include/mailer.inc.php');

                     // Send the message.
                     cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
                  }
                  cpg_send_upload_notification();
               }

               // That was the last one. Create a redirect box.
               pageheader($lang_info);
               msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
               pagefooter();

               // Exit the script.
               exit;
            }
         } //end for loop

            if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
            // Delete the temporary data file.
            delete_record($_POST['unique_ID']);

            // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
            if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
               // Encapsulate so included lang file doesn't interfere with global one
               function cpg_send_upload_notification() {
                  global $CONFIG;
                  $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                  // Get the mail files.
                  include_once('include/mailer.inc.php');

                  // Send the message.
                  cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
               }
               cpg_send_upload_notification();
            }

            // That was the last one. Create a redirect box.
            pageheader($lang_info);
            msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
            pagefooter();

            // Exit the script.
            exit;
         }
      }
move   } //end for loop   to end to make this mod work !!!
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: djbabytroja on October 15, 2004, 07:13:42 pm
This Hack have bugs... i think so....

but... the idea is good...

because i try to add it... but wenn i take all pics to one album and press next cpg says no folder exist.... !!!!! ?????


Greetiings
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on October 17, 2004, 08:57:54 pm
i am getting this after updating the files:

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: djbabytroja on October 18, 2004, 09:06:14 am
Hi...

Read this...

Quote
##############################################################
## Author Notes:
## These steps are in order from top to bottom.  You have to
## be careful modding upload.php because a lot of the code is
## duplicated in different sections.
## This mod incorporates Frogfoot's fancy album dropdown MOD.
## You must install it first (takes 5 minutes)
## http://forum.coppermine-gallery.net/index.php?topic=8861.0
## Thanks to DefenceTalk for the MOD Instruction Template
##############################################################

I forgott this as first... and i had the same problem like you...
after installing the Frogfoot hack it works...

But this Hack is buggy... because after installing the Frogfoot hack and installing this hack... he shows me... after uploading the files... this abum not exist.. i know why...

because mstralka says...

FIND:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name) {
//Vodovnik.com modified this code to allow display of Categories besides album names

    // Pull the $CONFIG array and the GET array into the function.
    global $CONFIG, $HTTP_GET_VARS;

    // Also pull the album lists into the function.
    global $user_albums_list, $public_albums_list;

    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

    // Create the opening of the drop down box.
    echo <<<EOT
    <tr>
        <td class="tableb">
            $text
        </td>
        <td class="tableb" valign="top">
            <select name="$name" class="listbox">

EOT;

    //Cylce through the User albums.
    foreach($user_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    //Cycle through the public albums.
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID.
        $album_id = $album['aid'];

        //Query the database to determine the category the album belongs to.
        $vQuery = "SELECT category FROM " . $CONFIG['TABLE_ALBUMS'] . " WHERE aid='" . $album_id . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Query the database to get the category name.
        $vQuery = "SELECT name FROM " . $CONFIG['TABLE_CATEGORIES'] . " WHERE cid='" . $vRes['category'] . "'";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Create the option for the drop down list.
        echo '                <option value="' . $album['aid'] . '"' . ($album['aid'] == $sel_album ? ' selected' : '') . '>' . (($vRes['name']) ? '(' . $vRes['name'] . ') ' : '') . $album['title'] . "</option>\n";
    }

    // Close the drop down.
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}

AND REPLACE WITH:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name,$onChange='') {
// frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order

    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $HTTP_GET_VARS, $lang_upload_php;

    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;

    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

if (!empty($onChange)) {
$onChange = " onChange=\"$onChange\" ";
}
    // Create the opening of the drop down box
    echo <<<EOT
    <tr>
        <td class="tableb">
            $text
        </td>
        <td class="tableb" valign="top">
            <select name="$name" class="listbox" $onChange>

EOT;

    // Reset counter
    $list_count = 0;

    // Cycle through the User albums
    foreach($user_albums_list as $album) {

        // Add to multi-dim array for later sorting
        $listArray[$list_count][cat] = $lang_upload_php['personal_albums'];
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Cycle through the public albums
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID
        $album_id = $album['aid'];

        // Get the category name
        $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Add to multi-dim array for sorting later
        if ($vRes['name']) {
            $listArray[$list_count][cat] = $vRes['name'];
        } else {
            $listArray[$list_count][cat] = $lang_upload_php['albums_no_category'];
        }
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray,'cat','title');

    // Finally, print out the nicely sorted and formatted drop down list
    $alb_cat = '';
    echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
    foreach ($listArray as $val) {
        if ($val[cat] != $alb_cat) {
if ($alb_cat) echo "                </optgroup>\n";
            echo '                <optgroup label="' . $val[cat] . '">' . "\n";
            $alb_cat = $val[cat];
        }
        echo '                <option value="' . $val[aid] . '"' . ($val[aid] == $sel_album ? ' selected' : '') . '>   ' . $val[title] . "</option>\n";
    }
    if ($alb_cat) echo "                </optgroup>\n";

    // Close the drop down
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}

AND frogfoot have this CODE:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name) {
// frogfoot re-wrote this function to present the list in categorized, sorted and nicely formatted order

    // Pull the $CONFIG array and the GET array into the function
    global $CONFIG, $HTTP_GET_VARS, $lang_upload_php;

    // Also pull the album lists into the function
    global $user_albums_list, $public_albums_list;

    // Check to see if an album has been preselected by URL addition. If so, make $sel_album the album number. Otherwise, make $sel_album 0.
    $sel_album = isset($HTTP_GET_VARS['album']) ? $HTTP_GET_VARS['album'] : 0;

    // Create the opening of the drop down box
    echo <<<EOT
    <tr>
        <td class="tableb">
            $text
        </td>
        <td class="tableb" valign="top">
            <select name="$name" class="listbox">

EOT;

    // Reset counter
    $list_count = 0;

    // Cycle through the User albums
    foreach($user_albums_list as $album) {

        // Add to multi-dim array for later sorting
        $listArray[$list_count][cat] = $lang_upload_php['personal_albums'];
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Cycle through the public albums
    foreach($public_albums_list as $album) {

        // Set $album_id to the actual album ID
        $album_id = $album['aid'];

        // Get the category name
        $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
        $vRes = mysql_query($vQuery);
        $vRes = mysql_fetch_array($vRes);

        // Add to multi-dim array for sorting later
        if ($vRes['name']) {
            $listArray[$list_count][cat] = $vRes['name'];
        } else {
            $listArray[$list_count][cat] = $lang_upload_php['albums_no_category'];
        }
        $listArray[$list_count][aid] = $album['aid'];
        $listArray[$list_count][title] = $album['title'];
        $list_count++;
    }

    // Sort the pulldown options by category and album name
    $listArray = array_csort($listArray,'cat','title');

    // Finally, print out the nicely sorted and formatted drop down list
    $alb_cat = '';
    echo '                <option value="">' . $lang_upload_php['select_album'] . "</option>\n";
    foreach ($listArray as $val) {
        if ($val[cat] != $alb_cat) {
if ($alb_cat) echo "                </optgroup>\n";
            echo '                <optgroup label="' . $val[cat] . '">' . "\n";
            $alb_cat = $val[cat];
        }
        echo '                <option value="' . $val[aid] . '"' . ($val[aid] == $sel_album ? ' selected' : '') . '>   ' . $val[title] . "</option>\n";
    }
    if ($alb_cat) echo "                </optgroup>\n";

    // Close the drop down
    echo <<<EOT
            </select>
        </td>
    </tr>

EOT;
}

// Multi-dim array sort, with ability to sort by two and more dimensions
// Coded by Ichier2003, available at php.net
// syntax:
// $array = array_csort($array [, 'col1' [, SORT_FLAG [, SORT_FLAG]]]...);
function array_csort() {
   $args = func_get_args();
   $marray = array_shift($args);

   $msortline = "return(array_multisort(";
   foreach ($args as $arg) {
       $i++;
       if (is_string($arg)) {
           foreach ($marray as $row) {
               $sortarr[$i][] = $row[$arg];
           }
       } else {
           $sortarr[$i] = $arg;
       }
       $msortline .= "\$sortarr[".$i."],";
   }
   $msortline .= "\$marray));";

   eval($msortline);
   return $marray;
}

What is to do???

Greetings
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: djbabytroja on October 18, 2004, 09:37:11 am
I Found the mistake...

here... in original CPG 1.3.2 is code in upload.php...

Code: [Select]
array($lang_upload_php['album'], 'album', 2),
array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords', 0, 255, 1),

but in mstralka introductions no infos about that... i dont understand.

take mstralkas code... and replace it in your CPG 1.3.2 in upload.php

Code: [Select]
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));

greetings
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on October 18, 2004, 12:53:05 pm
I know! Frogfots modification is already there in upload.php and not in the other files. :(
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: noname00 on November 16, 2004, 04:23:47 am
i've been trying to install this mod - looks very good - but i've had the same problems:
. only uploads one picture, and only displays "continue" button (after installation of frogfoot's mod).

it seems to be unclear whether this mod should be installed after installation of frogfoot's mod, or not. or maybe frogfoot's changed.??

if anyone has got it to work recently i could use a hand.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: noname00 on November 16, 2004, 02:33:46 pm
ok for what it's worth....
i've got it working, with this sequence of installation:
1. mstralka's jupload mod, WITHOUT doing either frogfoot's fancy album list mod OR mstralka's upload files and edit them all at once mod (this one right here).
2. frogfoot's fancy album list mod.
3. mstralka's upload files mod (this one right here), WITH the bug fix noted by foulo, ie...
"move   } //end for loop   to end to make this mod work !!!"
thus there should be 4 end-braces } in a row...
Code: [Select]
// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();

// Exit the script.
exit;
}
}
}
} //end for loop
anyway it worked for me i hope to have nothing more to do with the matter.
i presume step 1 is optional.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: turtleboy on November 21, 2004, 07:59:25 pm
Nice mod! Works great (cpg1.3.2)
Got parse errors at first, but thanks to contribution from other posters in this thread, I got it to work.

Only one problem.. when you try to place all the files with the " Move all photos to:" option.
I get the error: Selected album does not exist or you don't have permission to upload in this album
So I just removed that option from line 2479 of upload.php

Just a suggestion, but someone should organize it all into one post.  :)
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: noname00 on November 23, 2004, 04:23:56 am
other issues i've had with this mod are:

. the permissions on the "edit" folder are intermittently completely screwed up. it's only when something goes wrong with the upload process, for example it times out and the user pushes "back" on the browser. the only way i can solve the problem each time it happens is to rename the "edit" folder, and create a new one with read/wrte/execute permissions.

. photo descriptions (except the first character) that are added on the multiple uploads page don't get recorded. this appears to happen whether the user uses the jupload plugin or individual file uploads.

any suggestions out there?
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Casper on November 23, 2004, 10:08:02 am
. the permissions on the "edit" folder are intermittently completely screwed up. it's only when something goes wrong with the upload process, for example it times out and the user pushes "back" on the browser. the only way i can solve the problem each time it happens is to rename the "edit" folder, and create a new one with read/wrte/execute permissions.

Try editing your include/picmgmt.inc.php and fid '0666'.  Change it to '0777' or '0755', whichever is the one coppermine needs to work.

Ask your webhost to chown the old folders to you, then you can delete them.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: noname00 on November 24, 2004, 02:07:25 am
and a fix for the descriptions bug:
mstralka's original mod posting part 2 (Posted on: August 28, 2004, 02:12:43 AM) says ...

FIND:

Code: [Select]
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
....

Replace with:

Code: [Select]
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
....

... but should read ...

Replace with:

Code: [Select]
$form_array = array(
array($lang_upload_php['album'], 'album[]', 2),
array($lang_upload_php['pic_title'], 'title[]', 0, 255, 1),
array($captionLabel, 'caption[]', 3, $CONFIG['max_img_desc_length']),
array($lang_upload_php['keywords'], 'keywords[]', 0, 255, 1));
....

the change is addition of square brackets after caption entry.

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: BeerGuzler on November 26, 2004, 10:09:13 am
So with all thre updates on this is there a final release of the mod???  ???

Or does one need to go through the entire topic ?
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Nibbler on November 26, 2004, 11:34:40 am
Please try to show some appreciation for the people who are actually doing the work here. I don't think reading through an entire 2 pages is particularly gruelling.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: donnoman on November 26, 2004, 07:21:22 pm
Matthew,

What you are trying to use with this mod is basically a beta version. They are getting all the kinks worked out.  If you aren't an accomplished coder then perhaps you just need to wait until all the kinks are worked out.

It's the same reason the dev team constantly cautions folks about using the devel version of coppermine. If you insist on using it, you get no training wheels.

When the dev gets good and ready I'm sure he will release a final version for public consumption.  But theres very little point in doing so until all the minor tweakings have settled down to a dull roar and all the initial adopters are happy with it.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Tranz on November 26, 2004, 08:37:25 pm
Mods ... user contributions come with no warranties so "beta" is kind of implied. The authors of the mods don't even have to revise their code or care if it works for someone else. To accuse anyone who volunteers their time and their code of doing it for an ego trip is... insulting. Why would anyone care to share with someone with an attitude like that? People could have just kept their mods to themselves and not expose themselves to this tye of criticism and expectations.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Hein Traag on November 26, 2004, 09:49:12 pm
I got 2 little suggestion.

1) Move all complaints and moaning to a seperate thread before it completely swamps this one and no one gets what they want.
2) When new on the forum, no matter how skilled you are, respect the work of others and mind your manners. Been there done that learned my lesson  ;)

It's a forum about coppermine.. not world war III.

ontopic: Very nice mod. Am going to install it tomorow, going to come in handy when my beloved users get their hands on the upload button *grin*
I'll let know if i run into any trouble installing it.

Cheers!
Hein
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: turtleboy on November 27, 2004, 08:32:19 am
and a fix for the descriptions bug:
mstralka's original mod posting part 2 (Posted on: August 28, 2004, 02:12:43 AM) says ...




the change is addition of square brackets after caption entry.



Good job, thanks!
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: fayoeu on December 05, 2004, 04:37:11 am
After following foulu's post I was able to get this to work.  I also ran into the problem where only one photo shows up after upload photos.  Thanks foulu!  :D

thanks, i always scare about it. But i think
Quote
// Check to see if this is the last one.
         if(count($escrow_array) == '0') {
            
            // Create the final message.
            if ($PIC_NEED_APPROVAL) {

               if ($file_placement == 'no') {

                  $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

               } else {

                  $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_db_input_php['upload_success'];

               }

            } else {

               if ($file_placement == 'no') {

                  $final_message = ''.$lang_upload_php['no_place'].'<br /><br />'.$lang_upload_php['process_complete'];

               } else {

                  $final_message = ''.$lang_upload_php['yes_place'].'<br /><br />'.$lang_upload_php['process_complete'];

               }

            }

            if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
               // Delete the temporary data file.
               delete_record($_POST['unique_ID']);

               // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
               if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
                  // Encapsulate so included lang file doesn't interfere with global one
                  function cpg_send_upload_notification() {
                     global $CONFIG;
                     $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                     // Get the mail files.
                     include_once('include/mailer.inc.php');

                     // Send the message.
                     cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
                  }
                  cpg_send_upload_notification();
               }

               // That was the last one. Create a redirect box.
               pageheader($lang_info);
               msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
               pagefooter();

               // Exit the script.
               exit;
            }
         } //end for loop

            if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
            // Delete the temporary data file.
            delete_record($_POST['unique_ID']);

            // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
            if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
               // Encapsulate so included lang file doesn't interfere with global one
               function cpg_send_upload_notification() {
                  global $CONFIG;
                  $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                  // Get the mail files.
                  include_once('include/mailer.inc.php');

                  // Send the message.
                  cpg_mail($CONFIG['gallery_admin_email'], sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target'].'editpics.php?mode=upload_approval' ));
               }
               cpg_send_upload_notification();
            }

            // That was the last one. Create a redirect box.
            pageheader($lang_info);
            msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
            pagefooter();

            // Exit the script.
            exit;
         }
      }
move   } //end for loop   to end to make this mod work !!!

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: lucasnet on January 19, 2005, 11:49:05 pm
Hmm. I did everything good and fix bugs and this mod dont want work. I can put image url and when i click NEXT after uploading i see empty white page. ???
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: MDxRacing on January 31, 2005, 02:02:39 am
Hi
This Mod Is What I Have Been Looking For.
I Did All Mods Twice Now In The Last Few Months But, Im Doing Something Wrong With The Upload.php File.
Can Someone Post A Working  Upload.php File  So I Can Download It.
Thanks
MDxRacing

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: MDxRacing on February 01, 2005, 05:33:48 pm
Ok I finally got the upload.php to work without errors.
I did a little changes to fit my needs , but i would like some more mods to it.
If someone can take a look at my pics, and if its simple to change, I think more people could use.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: MDxRacing on February 01, 2005, 05:34:32 pm
To This
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: MDxRacing on February 01, 2005, 06:10:37 pm
And Here Is my upload.php file
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: ytknows on April 05, 2005, 12:39:14 am
I got this working, but I have one tiny problem... the custom user fields aren't showing the correct info
see below

(http://img76.exs.cx/img76/8047/uploadphp4mr.gif)

anyone know how to fix this? i've tried and tried and cannot find where to correct this... any help or a point in the right direction will be greatly appreciated. the upload.php file i'm using is attached below.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Justin on April 05, 2005, 09:51:20 am
Yes, I got the same Problem:

Only three of four custom fields are displayed, and the description of all three is "1."

Any one knows where to look?

thx

Justin
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Justin on April 06, 2005, 10:27:32 am
there's an error in the upload.php from the upload. zip.

Search for:

Code: [Select]
// Check for user defined fields.
if(!empty($CONFIG['user_field1_name[]'])) {
$form_array[] = array($CONFIG['user_field1_name[]'], 'user1', 0, 255, 1);
}

if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name[]'], 'user2', 0, 255, 1);
}

if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name[]'], 'user3', 0, 255, 1);
}

if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name[]'], 'user4', 0, 255, 1);
}


and replace with

Code: [Select]

// Check for user defined fields.
if(!empty($CONFIG['user_field1_name'])) {
$form_array[] = array($CONFIG['user_field1_name'], 'user1', 0, 255, 1);
}

if(!empty($CONFIG['user_field2_name'])) {
$form_array[] = array($CONFIG['user_field2_name'], 'user2', 0, 255, 1);
}

if(!empty($CONFIG['user_field3_name'])) {
$form_array[] = array($CONFIG['user_field3_name'], 'user3', 0, 255, 1);
}

if(!empty($CONFIG['user_field4_name'])) {
$form_array[] = array($CONFIG['user_field4_name'], 'user4', 0, 255, 1);
}




Regards,

Justin


PS:

As someone earlier in this thread asked for:
Here's what I changed additionally(!) in upload.php to display one parent category up with (parent-cat / sub-cat) in the pull-downs,

find:

Code: [Select]
$vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
   

and replace with

Code: [Select]
$vQuery = "SELECT ifnull(concat(catp.name,' / ',cat.name),cat.name) name FROM " . $CONFIG['TABLE_ALBUMS'] . " alb ," . $CONFIG['TABLE_CATEGORIES'] . " cat left outer join  " . $CONFIG['TABLE_CATEGORIES'] . " catp on catp.cid = cat.parent WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: ytknows on April 08, 2005, 12:32:06 am
thanks, Justin, for that field fix!
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: NekoChris on April 13, 2005, 02:06:05 am
I also have the problem where after applying this mod and then uploading via urls I get a white screen with only the continue button and the theme dropdown. Any suggestions how to fix that?
Title: Quotes & slashes
Post by: luke on April 21, 2005, 07:56:57 am
I followed the instructions in this thread and got this mod working - thanks to mstralka for the mod and the extra fixes added here, it makes uploading lots of photos much easier  :D

However since installing this mod I've noticed quotes in titles & captions are being escaped and saved to the DB, so if I have a title which is say:
Quote
This is John's friend "Jill"

I get:
Quote
This is John\'s friend \"Jill\"

If I use my upload.php from before I added the mod, the extra slashes are not added.

If I remove addslashes() from the variables around line 2275 (eg following " (int)$HTTP_POST_VARS['album'][$x]; ") the slashes, well, aren't added. However addslashes() are in the original upload.php, so are the any implications for removing them like so:

with the mod, lines like this:
Code: [Select]
$title = addslashes($HTTP_POST_VARS['title'][$x]);would become:
Code: [Select]
$title = $HTTP_POST_VARS['title'][$x];
? If there are issues with this (ie I assume addslashes() are there in the original upload.php for a reason!) please let me know :)

Cheers!
luke
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: duckxtales on April 25, 2005, 11:08:04 am
hi,

can someone upload their working copy of upload.php? I cant seem to get it to work. thanks..
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: duckxtales on April 25, 2005, 10:58:08 pm
i have my upload.php attached below if anyone can help...  ???
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: FedericaSanta on June 11, 2005, 10:22:59 pm
hi,

can someone upload their working copy of upload.php?

Thanks!!
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DefenceTalk.com on June 16, 2005, 08:19:55 pm
Any "working" version of this mod?  :(
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: NeoBladeFX on June 23, 2005, 06:02:44 pm
Hi All ^_^ This mod is something that is seriously needed and it seems to be working for others. I've followed the instructions and did the fixes and the upload section isn't broken. however I still only get one upload displayed at a time. There is improvement though as the " Move all photos to:" section has appeared but when theres only one image displayed at the time its not quite the same.

It seems I'm almost there so I've attached my current upload.php file here for inspection. I've gone through the mod a few times now but can't see, to find the section that will display all the uploaded images at once amongst all the other comments and bug fixes from other members. Fantastic work though by everyone on this. Once I have it working I'll re-post the whole thing as one file giving credit to the original editors of course - Hopefully this will make the mod easier to follow with all fixes included.

If anyone is able to fix my upload.php though I would be rather greatful. Many thanks.

EDIT - Ignore all that, I think I've got it working ^_^ I'm at work atm so can't check but if it is working I'll post it up.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Stramm on June 23, 2005, 08:08:41 pm
Hi All ^_^ This mod is something that is seriously needed and it seems to be working for others. I've followed the instructions and did the fixes and the upload section isn't broken. however I still only get one upload displayed at a time. There is improvement though as the " Move all photos to:" section has appeared but when theres only one image displayed at the time its not quite the same.

It seems I'm almost there so I've attached my current upload.php file here for inspection. I've gone through the mod a few times now but can't see, to find the section that will display all the uploaded images at once amongst all the other comments and bug fixes from other members. Fantastic work though by everyone on this. Once I have it working I'll re-post the whole thing as one file giving credit to the original editors of course - Hopefully this will make the mod easier to follow with all fixes included.

If anyone is able to fix my upload.php though I would be rather greatful. Many thanks.

EDIT - Ignore all that, I think I've got it working ^_^ I'm at work atm so can't check but if it is working I'll post it up.

admin mode -> config -> user settings -> Allow users to assign uploaded photos at once (instead of one-at-a-time)
set this to 'yes'... then it should work
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: NeoBladeFX on June 23, 2005, 08:51:49 pm
Thanks for the reply. I was very sure I did that as it looked like a simple mistake. Trouble is my locall installation doesn't really like me (probably due to my firewallm same happens with phpBB) so the only way to really know is for me to try it out online. Going to test it now while making a backup. Hope it works and if it does many thanks to everyone here as this mod was seriously needed!

EDIT - Ok, everytime I click on YES to "Allow users to assign uploaded photos at once (instead of one-at-a-time)" and click on save, it doesn't... So when I go back into the config, its back on NO.

Any ideas on how to force it instead? At first I thought it was just my locall installation but it seems its also happening to the online one too. Any help would be appreciated.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: NeoBladeFX on June 23, 2005, 09:35:41 pm
Hmm... I'm thinking it could be a problem with the very first step with the DS query. When I log into phpmyadmin and go to submit the query, I get the text "You have to choose at least one Column to display".

Column from where exactly? Usually a mate of mine does the DB stuff but he hasn't been online for months...

EDIT: Fixed as he popped online ^_^

Now I just get a "Critical Error - Script called without the required parameter(s). " I'm going to do it all from the beggining once again and see if I've missed anything or not. Certainly doesn't help that the bug fixes and that are all fragmented and that most of the people who have it working are not around to help. I've even used someone elses upload.php from this thread and applied  the bug fix and I get the same error...

EDIT 2: Right I've re-done the mod this time without doing the bug fixes etc in hope that the original poster updated his hack to include it all and it works to a degree... When uploading more than one image all of the images load up fine when deciding upon which album to put them in & descriptions etc. When submitting the images though I just get a blank info screen on the "Continue" button and only one image is added to the gallery. I've added the bugfix to put the...

Code: [Select]
// That was the last one. Create a redirect box.
pageheader($lang_info);
msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
pagefooter();

// Exit the script.
exit;
}
}
}
} //end for loop

...in and I had to delete the ")" bracket right at the end of my upload file too, to get the file working. I've added my upload file here as everything else seems to work bar the actual inclusion of the files themselves. Any help would be appreciated.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Summi on July 15, 2005, 10:44:43 am
Hi,

i've got big trouble with integrating and combinating the 2 mods "miltiple file upload using a zip" and "upload files and edit them at once" into my coppermine 1.3.3.

My main problem is, that the unzip-function does not work. My server is supporting the unzip function.

http://forum.coppermine-gallery.net/index.php?topic=7750.0  (-> zip upload)
http://forum.coppermine-gallery.net/index.php?topic=9391.0  (-> multiple edit)

I would be very happy, if anybody could post a working copy of all the files that are needed for this mod (eg. upload.php, m-zip.php, lang/english.php, groupmgr.php)
Please post as an attachement, so i could download it.

If you are running coppermine 1.3.2, please post these too. I could integrate the changes from 1.3.2 to 1.3.3 manually.

Thanx for your help,
Summi
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: DJ TrEVo on September 02, 2005, 01:20:12 am
Here my working upload.php file...

I hope It can be useful!

Enjoy ^_^
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: u-n-i on September 29, 2005, 02:12:32 pm
thanks for this mod

but a question

what about watermark hack

will that work witht his ?
i mean will it watermark all images placed at once ?

thanks
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: FedericaSanta on October 02, 2005, 05:30:50 pm
Here my working upload.php file...

I hope It can be useful!

Enjoy ^_^

Hy,

it' s impossible to download . Can you repost it, please?
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on October 03, 2005, 07:36:02 am
try using another browser to download.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: u-n-i on October 18, 2005, 05:06:41 pm
anybody please reply for my question

thank u
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on October 19, 2005, 07:21:56 am
if people don't reply they probably don't know the answer. Why don't you find out and tell us? Just make a backup before you start, so you can safely go back if it fails.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: u-n-i on October 20, 2005, 10:43:54 am
thnanks
nice idea for backup :)

gonna try it
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: willstein on October 30, 2005, 01:50:49 am
After installing the Mod, it looked fine, but only would display one picture at a time (still having to go to 'next' each time)


Then in Admin-->Config (as stated earlier in this thread (http://forum.coppermine-gallery.net/index.php?topic=9391.msg87828#msg87828)) I changed it to allow users to edit many at a time.

But, it doesnt seem to be working completely.
It looks fine, but after submission, the successful info does not show (the successful text pulled from language files).
Also, it only submits the first picture, the rest don't go in.
Finally, "Description" is always 'g', regardless of what I put.

IE and Mozilla produce similiar results.
Admin and User produce similiar results.

Second,
If in Admin-->Config I change the setting to allow many at a time to: "No"
It submits all the photos correctly except (but I have to continue each time)
"Description" seems limited to the first character inputted.

I hope from the above information I can give some experts an idea of what could be wrong.
Also perhaps others can learn who are in the same boat as me.

Any ideas?
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on October 31, 2005, 04:46:46 pm
Hi guys !!!
I run CPG 1.3.3 and want to ask is this Mod working with version 1.3.3 or only with 1.3.2 ???
This feature is very nice and many of my users have mentioned before that it would be nice to have the feature like that. If someone have CPG 1.3.3 and using this Mod, please, let me know how is that working. I'm ready to give a try ;D

Thanx in advance,

Guerrilla 
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Joachim Müller on November 01, 2005, 05:16:50 pm
should work with all cpg1.3.x versions. See my reply above (http://forum.coppermine-gallery.net/index.php?topic=9391.msg105294#msg105294)
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on November 01, 2005, 07:40:26 pm
Okey ... I will try and write here later is everything okey or not ... I think this function would be nice to have in the next CPG version.

Cheers,
Guerrilla
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: willstein on November 09, 2005, 05:35:16 pm
So I've tried a third time on this mod and it doesnt seem to be working.

Everything LOOKS good, but when it's uploaded, only the first image actually uploads.
Title, and Keywords are fine, but Description only lets the first letter through
Finally, the final show on upload.php where it says "complete" doesnt whow any text. Just "INFORMATION" and then white space and "continue"


any ideas?

thanks.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: alanlai on November 11, 2005, 09:01:40 pm
the working one is not working on cpg 1.3.5

can anyone post a proper working one here?

:(
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: ganeshcp on November 20, 2005, 02:48:37 pm
ditto that......this is a very useful mod if someone can post a final version.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: legend107 on November 29, 2005, 01:34:22 pm
Here my working upload.php file...

I hope It can be useful!

Enjoy ^_^

Confirming it works fine. Thank you :D
Tested on CPG 1.3.5  : 2005 Nov 29
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 27, 2006, 02:53:46 am
HELL YA! It works for Stand alone Stable 1.4.3 PLEASE UPDATE! If anyone would like the upload.php file let me know. I started with the non-moded 1.4.3 upload.php file and edited it to work. Off to add JUpload to it now. Thanks again for this thread and everyones posts.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on January 28, 2006, 11:51:18 pm
HELL YA! It works for Stand alone Stable 1.4.3 PLEASE UPDATE! If anyone would like the upload.php file let me know. I started with the non-moded 1.4.3 upload.php file and edited it to work. Off to add JUpload to it now. Thanks again for this thread and everyones posts.

Hi !!!
This Mod sounds very good !!! ... That is exactly what I need for my gallery !!!
Couple you, please, share this file with me ?
You may send it to guerrilla_33@yahoo.com

Thanx in advance !!!
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 29, 2006, 12:00:15 am
This is my current file with adding JUpload. SO I don't actually have the file before this mod was applied. I accidently deleted it when I was starting fresh to install the JUpload. However if you instal JUpload as well you will have the upload.php already done for it.

The instructions on this thread if you follow them it is all the same but the }}}} you only need 3 }}} and the mod will work. Also need to apply the [] stuff like noted in thread. So you can follow the instructions on first page then update the stuff later stated in thread and instead of doing the 4 close outs do 3 and all good. Little bit of tweaking and you have it. It is a MUCH needed MOD and should have been included in core. This MOD has been around for years I don't know why it didn't make it. Hit me up if you have any trouble. You can use my file as a type of guide.

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on January 29, 2006, 06:20:19 pm
Hi AWJunkies!!!
Thank you for your upload file ... but there are several problems ...
first, your upload.txt is turned to be upload.html ...
second, some part of the script is missing at the end ...
third, looks like the right curly } is missing somewhere between lines 2449 and 2700

By the way - at the first page of this topic foulu said move   } //end for loop   to end to make this mod work !!! ... In your script it still at the old place ... where that has to be ???
While cheching the script I get now the following error:
Parse error: syntax error, unexpected $end in C:\....\Temp\dzp116.tmp on line 2899

Could you, please, upload your upload.php (as .txt) which is currently rinning and don't have syntax errors.

Appreciate all your effords and looking forward to get the working file ;-))

P.S.  Sorry, didn't nderstand well about JUpload - in the script I see this:
  code="JUpload/startup.class"
  archive="jupload.jar"

Do I need to download these 2 files (startup.class and jupload.jar) and install on my server ... or ... ??? If so, where can I get them ??? Thanx again ;-))
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 29, 2006, 08:10:54 pm
Ignore the first page //end loop because it is already moved in the orginal code, that was posted. It was the second page I was refering too. That shows:
}
}
}
}end loop

it needs to be:
}
}
}end loop

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on January 29, 2006, 08:20:23 pm
Thanx !!! Now I get no errors after syntax check !!!
What about Applet ??? I get "Starting Applet" ... message ... and then "No Applet found"   :'(
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 29, 2006, 08:39:31 pm
## MOD Title: Multi-File Uploader
## MOD Author: mstralka < email > (Mark Stralka) http://www.photo-junky.com
## MOD Description: This mod will simplify the upload process by
## letting users see alll of the uploaded photos on one page,
## move them to different albums accordingly (or to the same
## album with 1 click), set descriptions, keywords, etc, instead
## of one image per page.
## Administrator can determine whether users will edit all
## uploaded photos at once, or individually.
## MOD Version: 2.0.0
## Built on CPG 1.3.2 - may work with 1.3.1 MODED by AWJ for 1.4.3
##
## Installation Level: Easy
## Installation Time: 10 minutes
## Files To Edit:   lang/english.php
##               upload.php
## Included Files: (screenshot)
##############################################################
## Author Notes:
## These steps are in order from top to bottom.  You have to
## be careful modding upload.php because a lot of the code is
## duplicated in different sections.

## This mod incorporates Frogfoot's fancy album dropdown MOD.
## You must install it first (takes 5 minutes)

## http://forum.coppermine-gallery.net/index.php?topic=8861.0 (http://forum.coppermine-gallery.net/index.php?topic=8861.0)
## Thanks to DefenceTalk for the MOD Instruction Template
##############################################################
## MOD History:
##
##   2004-08-27 - Version 1.0.0
##      - Original version, was not in line-by-line order,
##      - no Admin option
##
##############################################################
## Before Adding This MOD To Your Site, You Should Back Up All Files
## Related To This MOD

Database query (use phpMyAdmin):
Code: [Select]
INSERT INTO `cpg143_config` ( `name` , `value` )
VALUES (
'allow_assign_multiple_photos', '0'
);

Adding this code will create a Yes/No option on the CONFIG page, under User Settings.  The default value
is No, which means uploads will work just like they do now.  Setting it to Yes will turn on the mod.
lang/english.php
FIND:
Code: [Select]
  'User settings',
  array('Allow new user registrations', 'allow_user_registration', 1),
  array('User registration requires email verification', 'reg_requires_valid_email', 1),
ADD to end of User Settings section:
Code: [Select]
  array('Allow users to assign uploaded photos at once (instead of one-at-a-time)','allow_assign_multiple_photos',1), //Mark Stralka cpg1.3.2

upload.php:
FIND:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name) {
REPLACE WITH:
Code: [Select]
// The function to create the album list drop down.
function form_alb_list_box($text, $name,$onChange='') {
FIND WITHIN:
Code: [Select]
   // Create the opening of the drop down box.
Before ADD:
Code: [Select]
if (!empty($onChange)) {
$onChange = " onChange=\"$onChange\" ";
}
FIND WITHIN:
Code: [Select]
            <select name="$name" class="listbox">
REPLACE WITH:
Code: [Select]
           <select name="$name" class="listbox" $onChange>
FIND:
Code: [Select]
// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
function open_form($path) {

    echo <<<EOT
    <script language="JavaScript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
    </script>
    <form method="post" action="$path" ENCTYPE="multipart/form-data">
    </td>
EOT;
}
Replace with:
Code: [Select]
// The open_form function creates the Javascript verification code and the opening form tags.
// $path hold the form action path.
function open_form($path,$formName = "") {
if (!empty($formName)) $fn = "name=\"$formName\"";
    echo <<<EOT
    <script language="JavaScript" type="text/javascript">
    function textCounter(field, maxlimit) {
            if (field.value.length > maxlimit) // if too long...trim it!
            field.value = field.value.substring(0, maxlimit);
    }
    </script>
    <form method="post" action="$path" $fn ENCTYPE="multipart/form-data">
    </td>
EOT;
}

FIND:
Code: [Select]
        // Create array index.
        $index = count($escrow_array) - 1;
Add this below:
Code: [Select]
$start = 0;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$iCnt = count($_POST["album"]);
} else {
$iCnt = $index + 1;
$start = $index;
}

//Instead of doing one photo at a time, show one page with all of the photos that are being uploaded - this makes it much easier for the users.
for ($index = $start; $index < $iCnt; $index++) {

FIND:
Code: [Select]
        // We have incoming placement data. Let's capture it.
Add this below:
Code: [Select]
$x = $index;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
$x = 0;
} else {
$x = $index;
}

FIND:
Code: [Select]
$album = (int)$_POST['album'];
$title = addslashes($_POST['title']);
$caption = addslashes($_POST['caption']);
$keywords = addslashes($_POST['keywords']);
$user1 = addslashes($_POST['user1']);
$user2 = addslashes($_POST['user2']);
$user3 = addslashes($_POST['user3']);
$user4 = addslashes($_POST['user4']);
Replace with:
Code: [Select]
$album = (int)$_POST['album'][$x];
$title = addslashes($_POST['title'][$x]);
$caption = addslashes($_POST['caption'][$x]);
$keywords = addslashes($_POST['keywords'][$x]);
$user1 = addslashes($_POST['user1'][$x]);
$user2 = addslashes($_POST['user2'][$x]);
$user3 = addslashes($_POST['user3'][$x]);
$user4 = addslashes($_POST['user4'][$x]);

FIND:
Code: [Select]
            // Delete the temporary data file.
            delete_record($_POST['unique_ID']);
BEFORE ADD:
Code: [Select]
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
FIND:
Code: [Select]
// Exit the script.
exit;
}
AFTER ADD:
Code: [Select]
                                               }
} //end for loop

if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {

            // Delete the temporary data file.
            delete_record($_POST['unique_ID']);

            // Send e-mail notification to the admin if requested (added by gaugau: 03-11-09).
            if (($CONFIG['upl_notify_admin_email']) and ($PIC_NEED_APPROVAL)) {
                // Encapsulate so included lang file doesn't interfere with global one
                function cpg_send_upload_notification() {
                    global $CONFIG;
                    $lang_db_input_php = cpg_get_default_lang_var('lang_db_input_php');
                    // Get the mail files.
                    include_once('include/mailer.inc.php');

                    // Send the message.
                    cpg_mail('admin', sprintf($lang_db_input_php['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_db_input_php['notify_admin_email_body'], USER_NAME,  $CONFIG['ecards_more_pic_target']. (substr( $CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') .'editpics.php?mode=upload_approval' ));
                }
                cpg_send_upload_notification();
            }

            // That was the last one. Create a redirect box.
            pageheader($lang_info);
            msg_box($lang_info, $final_message, $lang_continue, 'index.php', "100%");
            pagefooter();

            // Exit the script.
            exit;

         }
    }
FIND:
Code: [Select]
    // Create array index.
    $index = count($escrow_array) - 1;
ADD:
Code: [Select]

$start = 0;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 1) {
$iCnt = count($escrow_array);
} else {
$iCnt = $index + 1;
$start = $index;
}

// Create upload form headers.
    pageheader($lang_upload_php['title']);
echo <<<EOT
<script type="text/javascript">
function moveAllTo(d,box) {
var f = document.editForm;
for (i = 0; i < f.length; i++) {
if (f[i].type == "select-one" && f[i].name.indexOf(box) >= 0) {
f[i].value = d
}
}
}
</script>
EOT;
    // Open the form table.
    starttable("100%", $lang_upload_php['title'], 2);
echo <<<EOT
<tr>
<td class="tableh2">
All Photos:
</td>
<td class="tableh2">

EOT;
//MOVE TO ALL MOD
form_alb_list_box("Move all photos to:","moveAllTo","moveAllTo(this.value,'album');");
echo <<<EOT
</td>
</tr>
EOT;
    // Direct the request to this script.
    open_form($_SERVER['PHP_SELF'],'editForm');
//Display all of the photos at once for editing
for ($index = $start; $index < $iCnt; $index++) {


FIND and Delete or comment out:
Code: [Select]
    // Create upload form headers.
    pageheader($lang_upload_php['title']);

    // Open the form table.
    starttable("100%", $lang_upload_php['title'], 2);

    // Direct the request to this script.
    open_form($_SERVER['PHP_SELF']);


I DID THIS REALLY FAST SO PLEASE! Let me know if you get any errors and I can fix it within seconds for you guys.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 29, 2006, 08:44:39 pm
Now for the JUpload MOD that is on the upload.txt above you can get the MOD here: http://forum.coppermine-gallery.net/index.php?topic=8199.0
Watch that thread because I will have the issue solved about the cookies soon. So basically make all changes to the other files BUT the upload.php because it is already done on my upload.txt file. Go to the last post I made and you will see the edits for 1.4.3
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Guerrilla on January 29, 2006, 11:41:44 pm
Hi again !!! ...
So, I had to change 864 from
archive="jupload.jar"
to
archive="./jupload.jar"
Otherwise was getting "Applet not found" error.
So, applet is working now ... I can choose files and click Upload buttom ... it is uploading files ... but after prgress bar shows uploading complete then my browser is trying to send some data to my server ....  and it keeps trying anf trying for aboyt 5 mins till I get "Canot access Database" or something like that ...

I have added one more variable to MySQL - allow_assign_multiple_photos ... changed the language files ... use your upload.php ... and still no luck :-( ...
By the way - how can I change the buttons of the script ??? 3 buttons to ADD, REMOVE and UPLOAD - they are in some Encoding that my brower shows only symbols ... any ideas on it ???

Sorry for bothering you with my questions but you are the one who may help ;-))

Regards,
Guerrilla

P.S. I was using supplied jupload-simple-demo.html for testing ... yes, it is uploading files ... but I cannot find them on my server ... where the hell these files go ??
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: farhan on January 30, 2006, 08:44:58 pm
thanks to your attached upload.php i got this mod working

thanks  AWJunkies

one thing i don't use the jupload mod, any chance you can point the code that can be removed from upload.php related to that mod ?

Thanks again
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on January 30, 2006, 09:07:18 pm
VERY EASY to remove! All code can stay since normaly you call upon a $_POST value. For JUpload all $_POST was changed to $_REQUEST. Which $_REQUEST looks for $_GET, $_COOKIE, and $_POST. Comment this bit of code and it should work fine and when I get the JUpload to work just uncomment it and walla you will have JUpload MOD completed already.

FIND:
Code: [Select]
//JUpload Modification
if (USER_CAN_USE_JUPLOAD) {
jupload_applet();
}
REPLACE WITH:
Code: [Select]
//JUpload Modification
//if (USER_CAN_USE_JUPLOAD) {
//jupload_applet();
//}
That should not call opon the Jupload applet and all other functions should just go stagnet. I do recomend just completing the JUpload MOD and by default no usergroup is aloud to use JUpload and it wont load. There is only like 3 things to edit to complete the JUpload MOD. Look to the Batch Upload 1.4.x link for more info I have complete instructions there: http://forum.coppermine-gallery.net/index.php?topic=27138.0
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: webfairy on February 19, 2006, 12:18:48 am
help, there is no such t hing in my admin....

also I get an error whe upload is clicked.

Code: [Select]
Fatal error: Cannot redeclare array_csort() (previously declared in /home/content/d/o/m/domainrightnow/html/ourgallery/upload.php:247) in /home/content/d/o/m/domainrightnow/html/ourgallery/include/functions.inc.php on line 2654
I reconed that all I had to do was ftp the new file up to the folder?  did I need to do a plug in for this?

Very confusing all this talk about jupload and all  do we just use t he upload.php that is given here?  Or is there other files to deal with?


admin mode -> config -> user settings -> Allow users to assign uploaded photos at once (instead of one-at-a-time)
set this to 'yes'... then it should work
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: webfairy on February 19, 2006, 06:23:28 pm
This is the pits....   No reply or assistance...

a mod is only as good as the support for it and a clean finished incorperated one .   Can't get any help here or not able to get intouch even e-mail with the MOD maker.....

ya all could take some lessons from the PHPBB people on support....   And don't come back with this is a free program and the supporters work for free.....    it is a cop out since PHPBB is also a free program but has much better support and mod makers that at least put in a way to contact them...and   usually have on their websites a working example.

Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: Nibbler on February 19, 2006, 06:33:05 pm
The poster of this mod has not visited the forums since November 09, 2005. Expecting a reply within 24 hours of posting is a bit much to expect. Mod posters have no commitment to provide support for their mods, they are provided 'as is'. Please adjust your attitude.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: AWJunkies on February 19, 2006, 08:25:56 pm
GUYS PLEASE READ THE FULL THREAD

My post #20 has full details on how to do the MOD for 1.4.x  I ported it over to 1.4.x and those are the instructions. Follow those instructions then snag my upload.txt file from the link I provided and change the name to upload.php and overide your old one. Walla everything will work. Now if you don't want JUpload to load read the code at the top of this page to comment out the template from loading or just don't activate it in admin group manager. I will have the JUpload MOD completed within this week and post up necisary info on the JUpload link I provided on the previous page. SO please keep an eye on that thread this week.
Title: Re: CPG 1.3.2 - Upload files and edit them all at once
Post by: ddmp on June 15, 2008, 10:26:15 pm
I know this thread is quite old, but I have sort of a request if possible.
I am running Coppermine Photo Gallery 1.4.18.
Attached is my current upload.php:

I changed a lot around and sort of modified it to my liking, but currently users can edit them all at once, but there is no "select album for all photos" dropdown at the top, and if possible, could somebody modify mine to have this, where the user can select each individually or can select from the dropdown at the top and have all of them switch to that album.

Any help on this would be most appreciated.