CPG 1.3.2 - Upload files and edit them all at once - Page 4 CPG 1.3.2 - Upload files and edit them all at once - Page 4
 

News:

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

Main Menu

CPG 1.3.2 - Upload files and edit them all at once

Started by mstralka, August 27, 2004, 06:15:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joachim Müller

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.

u-n-i


willstein

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

Guerrilla

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 

Joachim Müller


Guerrilla

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

willstein

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.

alanlai

the working one is not working on cpg 1.3.5

can anyone post a proper working one here?

:(

ganeshcp

ditto that......this is a very useful mod if someone can post a final version.

legend107

Quote from: DJ TrEVo on September 02, 2005, 01:20:12 AM
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

AWJunkies

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.

Guerrilla

Quote from: 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.

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 !!!

AWJunkies

#72
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.


Guerrilla

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 ;-))

AWJunkies

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


Guerrilla

#75
Thanx !!! Now I get no errors after syntax check !!!
What about Applet ??? I get "Starting Applet" ... message ... and then "No Applet found"   :'(

AWJunkies

## 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
## 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):

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:

  '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:

  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:

// The function to create the album list drop down.
function form_alb_list_box($text, $name) {

REPLACE WITH:

// The function to create the album list drop down.
function form_alb_list_box($text, $name,$onChange='') {

FIND WITHIN:

   // Create the opening of the drop down box.

Before ADD:

if (!empty($onChange)) {
$onChange = " onChange=\"$onChange\" ";
}

FIND WITHIN:

            <select name="$name" class="listbox">

REPLACE WITH:

           <select name="$name" class="listbox" $onChange>

FIND:

// 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:

// 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:

        // Create array index.
        $index = count($escrow_array) - 1;

Add this below:

$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:

        // We have incoming placement data. Let's capture it.

Add this below:

$x = $index;
if ((int)$CONFIG['allow_assign_multiple_photos'] == 0) {
$x = 0;
} else {
$x = $index;
}


FIND:

$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:

$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:

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

BEFORE ADD:

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

FIND:

// Exit the script.
exit;
}

AFTER ADD:

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

    // Create array index.
    $index = count($escrow_array) - 1;

ADD:


$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:

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

AWJunkies

#77
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

Guerrilla

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

farhan

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